framework7rails 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/framework7rails/version.rb +2 -2
- data/update_from_vendor.rb +1 -1
- data/vendor/assets/javascripts/framework7.js +335 -196
- data/vendor/assets/javascripts/framework7.js.map +1 -1
- data/vendor/assets/stylesheets/framework7.css +31 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df30f6365c2f4f5fd823e8d41efd6045d83d6f16
|
4
|
+
data.tar.gz: f5a0bda553bb7606e16aa124fea514ff169088d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eee72257dae1507fba7e6b6402a93dad725c7642cbc9ba2cb258a4874945933d81fb9ba355f686aa8640e85845341db4f1982973603af4bee1804f436bd32a77
|
7
|
+
data.tar.gz: 0b58c94a767c2d8afbcac0a8c858c64f09b46beb9e63df1f0da381f250f1f3c020d7533862daf2319918adf9a2a2cd130861d21bedd6bafc6cfafcca9fba75bb
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## Current Version (0.
|
1
|
+
## Current Version (0.10.0)
|
2
2
|
|
3
3
|
Although there exists a gem for f7 already, but I found it complicated and it was really out of date. I try to keep it updated from https://github.com/nolimits4web/Framework7/releases but you can also do it yourself by running ``./update_from_vendor``
|
4
4
|
|
data/update_from_vendor.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Framework7 0.
|
2
|
+
* Framework7 0.10.0
|
3
3
|
* Full Featured HTML Framework For Building iOS 7 Apps
|
4
4
|
*
|
5
5
|
* http://www.idangero.us/framework7
|
@@ -10,7 +10,7 @@
|
|
10
10
|
*
|
11
11
|
* Licensed under MIT
|
12
12
|
*
|
13
|
-
* Released on:
|
13
|
+
* Released on: December 8, 2014
|
14
14
|
*/
|
15
15
|
(function () {
|
16
16
|
|
@@ -24,7 +24,7 @@
|
|
24
24
|
var app = this;
|
25
25
|
|
26
26
|
// Version
|
27
|
-
app.version = '0.
|
27
|
+
app.version = '0.10.0';
|
28
28
|
|
29
29
|
// Default Parameters
|
30
30
|
app.params = {
|
@@ -36,6 +36,7 @@
|
|
36
36
|
uniqueHistory: false,
|
37
37
|
uniqueHistoryIgnoreGetParameters: false,
|
38
38
|
dynamicPageUrl: 'content-{{index}}',
|
39
|
+
allowDuplicateUrls: false,
|
39
40
|
router: true,
|
40
41
|
// Push State
|
41
42
|
pushState: false,
|
@@ -86,6 +87,7 @@
|
|
86
87
|
swipePanel: false, // or 'left' or 'right'
|
87
88
|
swipePanelActiveArea: 0,
|
88
89
|
swipePanelCloseOpposite: true,
|
90
|
+
swipePanelOnlyClose: false,
|
89
91
|
swipePanelNoFollow: false,
|
90
92
|
swipePanelThreshold: 0,
|
91
93
|
panelsCloseByOutside: true,
|
@@ -163,6 +165,7 @@
|
|
163
165
|
reloadPages: false,
|
164
166
|
uniqueHistory: app.params.uniqueHistory,
|
165
167
|
uniqueHistoryIgnoreGetParameters: app.params.uniqueHistoryIgnoreGetParameters,
|
168
|
+
allowDuplicateUrls: app.params.allowDuplicateUrls,
|
166
169
|
swipeBackPage: app.params.swipeBackPage,
|
167
170
|
swipeBackPageAnimateShadow: app.params.swipeBackPageAnimateShadow,
|
168
171
|
swipeBackPageAnimateOpacity: app.params.swipeBackPageAnimateOpacity,
|
@@ -716,7 +719,7 @@
|
|
716
719
|
leftWidth = noLeft ? 0 : left.outerWidth(true),
|
717
720
|
rightWidth = noRight ? 0 : right.outerWidth(true),
|
718
721
|
centerWidth = center.outerWidth(true),
|
719
|
-
navbarWidth = n.
|
722
|
+
navbarWidth = n[0].offsetWidth - parseInt(n.css('padding-left'), 10) - parseInt(n.css('padding-right'), 10),
|
720
723
|
onLeft = n.hasClass('navbar-on-left'),
|
721
724
|
currLeft, diff;
|
722
725
|
|
@@ -926,7 +929,10 @@
|
|
926
929
|
attachEvents();
|
927
930
|
|
928
931
|
// Search
|
932
|
+
var previousQuery;
|
929
933
|
function search(query) {
|
934
|
+
if (query.trim() === previousQuery) return;
|
935
|
+
previousQuery = query.trim();
|
930
936
|
var values = query.trim().toLowerCase().split(' ');
|
931
937
|
var foundItems = [];
|
932
938
|
if (isVirtualList) {
|
@@ -1981,7 +1987,7 @@
|
|
1981
1987
|
if (view.params.reloadPages === true) options.reload = true;
|
1982
1988
|
|
1983
1989
|
if (!view.allowPageChange) return false;
|
1984
|
-
if (url && view.url === url && !options.reload) return false;
|
1990
|
+
if (url && view.url === url && !options.reload && !view.params.allowDuplicateUrls) return false;
|
1985
1991
|
view.allowPageChange = false;
|
1986
1992
|
if (app.xhr && view.xhr && view.xhr === app.xhr) {
|
1987
1993
|
app.xhr.abort();
|
@@ -2127,21 +2133,21 @@
|
|
2127
2133
|
navbarInners = viewContainer.find('.navbar-inner:not(.cached)');
|
2128
2134
|
newNavbarInner.addClass('navbar-on-left').removeClass('cached');
|
2129
2135
|
}
|
2130
|
-
|
2131
2136
|
// Remove/hide previous page in force mode
|
2132
2137
|
if (force) {
|
2133
2138
|
var pageToRemove, navbarToRemove;
|
2134
2139
|
pageToRemove = $(pagesInView[pagesInView.length - 2]);
|
2135
|
-
|
2140
|
+
|
2141
|
+
if (dynamicNavbar) navbarToRemove = $(pageToRemove[0] && pageToRemove[0].f7RelatedNavbar || navbarInners[navbarInners.length - 2]);
|
2136
2142
|
if (view.params.domCache && view.initialPages.indexOf(pageToRemove[0]) >= 0) {
|
2137
|
-
pageToRemove.addClass('cached');
|
2138
|
-
if (dynamicNavbar) {
|
2143
|
+
if (pageToRemove.length && pageToRemove[0] !== newPage[0]) pageToRemove.addClass('cached');
|
2144
|
+
if (dynamicNavbar && navbarToRemove.length && navbarToRemove[0] !== newNavbarInner[0]) {
|
2139
2145
|
navbarToRemove.addClass('cached');
|
2140
2146
|
}
|
2141
2147
|
}
|
2142
2148
|
else {
|
2143
|
-
pageToRemove.remove();
|
2144
|
-
if (dynamicNavbar) {
|
2149
|
+
if (pageToRemove.length) pageToRemove.remove();
|
2150
|
+
if (dynamicNavbar && navbarToRemove.length) {
|
2145
2151
|
navbarToRemove.remove();
|
2146
2152
|
}
|
2147
2153
|
}
|
@@ -2153,14 +2159,33 @@
|
|
2153
2159
|
view.history = view.history.slice(0, view.history.indexOf(url) + 2);
|
2154
2160
|
}
|
2155
2161
|
else {
|
2156
|
-
view.history[view.history.length - 2]
|
2162
|
+
if (view.history[[view.history.length - 2]]) {
|
2163
|
+
view.history[view.history.length - 2] = url;
|
2164
|
+
}
|
2165
|
+
else {
|
2166
|
+
view.history.unshift(url);
|
2167
|
+
}
|
2157
2168
|
}
|
2158
2169
|
}
|
2159
2170
|
|
2160
2171
|
oldPage = $(pagesInView[pagesInView.length - 1]);
|
2172
|
+
if (view.params.domCache) {
|
2173
|
+
if (oldPage[0] === newPage[0]) {
|
2174
|
+
oldPage = pagesContainer.children('.page.page-on-center');
|
2175
|
+
if (oldPage.length === 0 && view.activePage) oldPage = $(view.activePage.container);
|
2176
|
+
}
|
2177
|
+
}
|
2161
2178
|
|
2162
2179
|
if (dynamicNavbar && !oldNavbarInner) {
|
2163
2180
|
oldNavbarInner = $(navbarInners[navbarInners.length - 1]);
|
2181
|
+
if (view.params.domCache) {
|
2182
|
+
if (oldNavbarInner[0] === newNavbarInner[0]) {
|
2183
|
+
oldNavbarInner = navbar.children('.navbar-inner.navbar-on-center:not(.cached)');
|
2184
|
+
}
|
2185
|
+
if (oldNavbarInner.length === 0) {
|
2186
|
+
oldNavbarInner = navbar.children('.navbar-inner[data-page="'+oldPage.attr('data-page')+'"]');
|
2187
|
+
}
|
2188
|
+
}
|
2164
2189
|
if (oldNavbarInner.length === 0 || newNavbarInner[0] === oldNavbarInner[0]) dynamicNavbar = false;
|
2165
2190
|
}
|
2166
2191
|
|
@@ -2236,8 +2261,11 @@
|
|
2236
2261
|
|
2237
2262
|
if (!force) {
|
2238
2263
|
// Go back when there is no pages on left
|
2239
|
-
|
2240
|
-
|
2264
|
+
if (!preloadOnly) {
|
2265
|
+
view.url = view.history[view.history.length - 2];
|
2266
|
+
url = view.url;
|
2267
|
+
}
|
2268
|
+
|
2241
2269
|
if (content) {
|
2242
2270
|
parseNewPage();
|
2243
2271
|
setPages();
|
@@ -2311,7 +2339,6 @@
|
|
2311
2339
|
app.router._back(view, options);
|
2312
2340
|
});
|
2313
2341
|
}
|
2314
|
-
|
2315
2342
|
if (pagesInView.length > 1 && !force) {
|
2316
2343
|
// Simple go back to previos page in view
|
2317
2344
|
app.router._back(view, options);
|
@@ -2332,7 +2359,7 @@
|
|
2332
2359
|
proceed();
|
2333
2360
|
return;
|
2334
2361
|
}
|
2335
|
-
else if (url.indexOf('#')
|
2362
|
+
else if (url.indexOf('#') !== 0) {
|
2336
2363
|
// Load ajax page
|
2337
2364
|
app.get(options.url, view, options.ignoreCache, function (content, error) {
|
2338
2365
|
if (error) {
|
@@ -2438,8 +2465,8 @@
|
|
2438
2465
|
if (newNavbar) {
|
2439
2466
|
previousNavbar = $(view.container).find('.navbar-inner[data-page="' + view.pagesCache[preloadUrl] + '"]');
|
2440
2467
|
previousNavbar.insertBefore(newNavbar);
|
2468
|
+
if(!previousNavbar || previousNavbar.length === 0) previousNavbar = newNavbar.prev('.navbar-inner.cached');
|
2441
2469
|
}
|
2442
|
-
if(!previousNavbar || previousNavbar.length === 0) previousNavbar = newNavbar.prev('.navbar-inner.cached');
|
2443
2470
|
}
|
2444
2471
|
else {
|
2445
2472
|
// Just load previous page
|
@@ -2476,7 +2503,8 @@
|
|
2476
2503
|
var textHTML = params.text ? '<div class="modal-text">' + params.text + '</div>' : '';
|
2477
2504
|
var afterTextHTML = params.afterText ? params.afterText : '';
|
2478
2505
|
var noButtons = !params.buttons || params.buttons.length === 0 ? 'modal-no-buttons' : '';
|
2479
|
-
|
2506
|
+
var verticalButtons = params.verticalButtons ? 'modal-buttons-vertical' : '';
|
2507
|
+
modalHTML = '<div class="modal ' + noButtons + '"><div class="modal-inner">' + (titleHTML + textHTML + afterTextHTML) + '</div><div class="modal-buttons ' + verticalButtons + '">' + buttonsHTML + '</div></div>';
|
2480
2508
|
}
|
2481
2509
|
|
2482
2510
|
_modalTemplateTempDiv.innerHTML = modalHTML;
|
@@ -2717,7 +2745,7 @@
|
|
2717
2745
|
if (typeof removeOnClose === 'undefined') removeOnClose = true;
|
2718
2746
|
if (typeof modal === 'string' && modal.indexOf('<') >= 0) {
|
2719
2747
|
var _modal = document.createElement('div');
|
2720
|
-
_modal.innerHTML =
|
2748
|
+
_modal.innerHTML = modal.trim();
|
2721
2749
|
if (_modal.childNodes.length > 0) {
|
2722
2750
|
modal = _modal.childNodes[0];
|
2723
2751
|
if (removeOnClose) modal.classList.add('remove-on-close');
|
@@ -2831,7 +2859,7 @@
|
|
2831
2859
|
if (typeof removeOnClose === 'undefined') removeOnClose = true;
|
2832
2860
|
if (typeof modal === 'string' && modal.indexOf('<') >= 0) {
|
2833
2861
|
var _modal = document.createElement('div');
|
2834
|
-
_modal.innerHTML =
|
2862
|
+
_modal.innerHTML = modal.trim();
|
2835
2863
|
if (_modal.childNodes.length > 0) {
|
2836
2864
|
modal = _modal.childNodes[0];
|
2837
2865
|
if (removeOnClose) modal.classList.add('remove-on-close');
|
@@ -3007,23 +3035,32 @@
|
|
3007
3035
|
************ Swipe panels ************
|
3008
3036
|
======================================================*/
|
3009
3037
|
app.initSwipePanels = function () {
|
3010
|
-
var panel
|
3011
|
-
if (
|
3012
|
-
|
3038
|
+
var panel, side;
|
3039
|
+
if (app.params.swipePanel) {
|
3040
|
+
panel = $('.panel.panel-' + app.params.swipePanel);
|
3041
|
+
side = app.params.swipePanel;
|
3042
|
+
if (panel.length === 0) return;
|
3043
|
+
}
|
3044
|
+
else {
|
3045
|
+
if (app.params.swipePanelOnlyClose) {
|
3046
|
+
if ($('.panel').length === 0) return;
|
3047
|
+
}
|
3048
|
+
else return;
|
3049
|
+
}
|
3050
|
+
|
3013
3051
|
var panelOverlay = $('.panel-overlay');
|
3014
|
-
var isTouched, isMoved, isScrolling, touchesStart = {}, touchStartTime, touchesDiff, translate, opened, panelWidth, effect, direction
|
3052
|
+
var isTouched, isMoved, isScrolling, touchesStart = {}, touchStartTime, touchesDiff, translate, opened, panelWidth, effect, direction;
|
3015
3053
|
var views = $('.' + app.params.viewsClass);
|
3016
|
-
side = app.params.swipePanel;
|
3017
3054
|
|
3018
3055
|
function handleTouchStart(e) {
|
3019
|
-
if (!app.allowPanelOpen || !app.params.swipePanel || isTouched) return;
|
3056
|
+
if (!app.allowPanelOpen || (!app.params.swipePanel && !app.params.swipePanelOnlyClose) || isTouched) return;
|
3020
3057
|
if ($('.modal-in, .photo-browser-in').length > 0) return;
|
3021
|
-
if (!app.params.swipePanelCloseOpposite) {
|
3058
|
+
if (!(app.params.swipePanelCloseOpposite || app.params.swipePanelOnlyClose)) {
|
3022
3059
|
if ($('.panel.active').length > 0 && !panel.hasClass('active')) return;
|
3023
3060
|
}
|
3024
3061
|
touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
|
3025
3062
|
touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
|
3026
|
-
if (app.params.swipePanelCloseOpposite) {
|
3063
|
+
if (app.params.swipePanelCloseOpposite || app.params.swipePanelOnlyClose) {
|
3027
3064
|
if ($('.panel.active').length > 0) {
|
3028
3065
|
side = $('.panel.active').hasClass('panel-left') ? 'left' : 'right';
|
3029
3066
|
}
|
@@ -3032,7 +3069,8 @@
|
|
3032
3069
|
}
|
3033
3070
|
}
|
3034
3071
|
panel = $('.panel.panel-' + side);
|
3035
|
-
|
3072
|
+
opened = panel.hasClass('active');
|
3073
|
+
if (app.params.swipePanelActiveArea && !opened) {
|
3036
3074
|
if (side === 'left') {
|
3037
3075
|
if (touchesStart.x > app.params.swipePanelActiveArea) return;
|
3038
3076
|
}
|
@@ -3102,10 +3140,11 @@
|
|
3102
3140
|
|
3103
3141
|
if (!isMoved) {
|
3104
3142
|
effect = panel.hasClass('panel-cover') ? 'cover' : 'reveal';
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3143
|
+
if (!opened) {
|
3144
|
+
panel.show();
|
3145
|
+
panelOverlay.show();
|
3146
|
+
}
|
3147
|
+
panelWidth = panel[0].offsetWidth;
|
3109
3148
|
panel.transition(0);
|
3110
3149
|
if (panel.find('.' + app.params.viewClass).length > 0) {
|
3111
3150
|
if (app.sizeNavbars) app.sizeNavbars(panel.find('.' + app.params.viewClass)[0]);
|
@@ -3241,8 +3280,8 @@
|
|
3241
3280
|
var messages = page.find('.messages');
|
3242
3281
|
if (messages.length === 0) return;
|
3243
3282
|
var pageContent = page.find('.page-content');
|
3244
|
-
if (!messages.hasClass('new-messages-first')) pageContent[0].scrollTop = messages.height() - pageContent.height();
|
3245
3283
|
if (messages.hasClass('messages-auto-layout')) app.updateMessagesLayout(messages);
|
3284
|
+
if (!messages.hasClass('new-messages-first')) pageContent[0].scrollTop = pageContent[0].scrollHeight - pageContent[0].offsetHeight;
|
3246
3285
|
};
|
3247
3286
|
app.addMessage = function (props) {
|
3248
3287
|
props = props || {};
|
@@ -3326,7 +3365,7 @@
|
|
3326
3365
|
var messages = messagesContent.find('.messages');
|
3327
3366
|
var newOnTop = messages.hasClass('new-messages-first');
|
3328
3367
|
var currentScroll = messagesContent[0].scrollTop;
|
3329
|
-
var newScroll = newOnTop ? 0 :
|
3368
|
+
var newScroll = newOnTop ? 0 : messagesContent[0].scrollHeight - messagesContent[0].offsetHeight;
|
3330
3369
|
if (newScroll === currentScroll) return;
|
3331
3370
|
messagesContent.scrollTop(newScroll, 300);
|
3332
3371
|
};
|
@@ -3345,7 +3384,7 @@
|
|
3345
3384
|
app.swipeoutOpenedEl.is(target[0]) ||
|
3346
3385
|
target.parents('.swipeout').is(app.swipeoutOpenedEl) ||
|
3347
3386
|
target.hasClass('modal-in') ||
|
3348
|
-
target.parents('.modal-in').length > 0 ||
|
3387
|
+
target.parents('.modal.modal-in').length > 0 ||
|
3349
3388
|
target.hasClass('modal-overlay')
|
3350
3389
|
)) {
|
3351
3390
|
app.swipeoutClose(app.swipeoutOpenedEl);
|
@@ -3385,12 +3424,12 @@
|
|
3385
3424
|
noFoldLeft = actionsLeft.hasClass('swipeout-actions-no-fold') || app.params.swipeoutActionsNoFold;
|
3386
3425
|
noFoldRight = actionsRight.hasClass('swipeout-actions-no-fold') || app.params.swipeoutActionsNoFold;
|
3387
3426
|
if (actionsLeft.length > 0) {
|
3388
|
-
actionsLeftWidth = actionsLeft.
|
3427
|
+
actionsLeftWidth = actionsLeft.outerWidth();
|
3389
3428
|
buttonsLeft = actionsLeft.children('a');
|
3390
3429
|
overswipeLeftButton = actionsLeft.find('.swipeout-overswipe');
|
3391
3430
|
}
|
3392
3431
|
if (actionsRight.length > 0) {
|
3393
|
-
actionsRightWidth = actionsRight.
|
3432
|
+
actionsRightWidth = actionsRight.outerWidth();
|
3394
3433
|
buttonsRight = actionsRight.children('a');
|
3395
3434
|
overswipeRightButton = actionsRight.find('.swipeout-overswipe');
|
3396
3435
|
}
|
@@ -3622,7 +3661,7 @@
|
|
3622
3661
|
el.trigger('open').addClass('swipeout-opened').removeClass('transitioning');
|
3623
3662
|
swipeOutActions.addClass('swipeout-actions-opened');
|
3624
3663
|
var buttons = swipeOutActions.children('a');
|
3625
|
-
var swipeOutActionsWidth = swipeOutActions.
|
3664
|
+
var swipeOutActionsWidth = swipeOutActions.outerWidth();
|
3626
3665
|
var translate = dir === 'right' ? -swipeOutActionsWidth : swipeOutActionsWidth;
|
3627
3666
|
var i;
|
3628
3667
|
if (buttons.length > 1) {
|
@@ -3653,7 +3692,7 @@
|
|
3653
3692
|
var swipeOutActions = el.find('.swipeout-actions-opened').removeClass('swipeout-actions-opened');
|
3654
3693
|
var noFold = swipeOutActions.hasClass('swipeout-actions-no-fold') || app.params.swipeoutActionsNoFold;
|
3655
3694
|
var buttons = swipeOutActions.children('a');
|
3656
|
-
var swipeOutActionsWidth = swipeOutActions.
|
3695
|
+
var swipeOutActionsWidth = swipeOutActions.outerWidth();
|
3657
3696
|
app.allowSwipeout = false;
|
3658
3697
|
el.trigger('close');
|
3659
3698
|
el.removeClass('swipeout-opened').addClass('transitioning');
|
@@ -3737,7 +3776,7 @@
|
|
3737
3776
|
sortingItems = sortingEl.parent().find('li');
|
3738
3777
|
sortableContainer = sortingEl.parents('.sortable');
|
3739
3778
|
e.preventDefault();
|
3740
|
-
app.
|
3779
|
+
app.allowPanelOpen = app.allowSwipeout = false;
|
3741
3780
|
}
|
3742
3781
|
function handleTouchMove(e) {
|
3743
3782
|
if (!isTouched || !sortingEl) return;
|
@@ -3785,7 +3824,7 @@
|
|
3785
3824
|
});
|
3786
3825
|
}
|
3787
3826
|
function handleTouchEnd(e) {
|
3788
|
-
app.
|
3827
|
+
app.allowPanelOpen = app.allowSwipeout = true;
|
3789
3828
|
if (!isTouched || !isMoved) {
|
3790
3829
|
isTouched = false;
|
3791
3830
|
isMoved = false;
|
@@ -3871,27 +3910,7 @@
|
|
3871
3910
|
view = view[0].f7View;
|
3872
3911
|
if (!view) return;
|
3873
3912
|
|
3874
|
-
//
|
3875
|
-
var select = smartSelect.find('select')[0];
|
3876
|
-
var $select = $(select);
|
3877
|
-
if (select.disabled || smartSelect.hasClass('disabled') || $select.hasClass('disabled')) {
|
3878
|
-
return;
|
3879
|
-
}
|
3880
|
-
var values = {};
|
3881
|
-
values.length = select.length;
|
3882
|
-
var option;
|
3883
|
-
for (var i = 0; i < select.length; i++) {
|
3884
|
-
option = $(select[i]);
|
3885
|
-
values[i] = {
|
3886
|
-
value: select[i].value,
|
3887
|
-
text: select[i].textContent.trim(),
|
3888
|
-
selected: select[i].selected,
|
3889
|
-
group: option.parent('optgroup')[0],
|
3890
|
-
image: option.attr('data-option-image') || $select.attr('data-option-image'),
|
3891
|
-
icon: option.attr('data-option-icon') || $select.attr('data-option-icon'),
|
3892
|
-
disabled: select[i].disabled
|
3893
|
-
};
|
3894
|
-
}
|
3913
|
+
// Parameters
|
3895
3914
|
var openIn = smartSelect.attr('data-open-in');
|
3896
3915
|
if (!openIn) openIn = app.params.smartSelectInPopup ? 'popup' : 'page';
|
3897
3916
|
|
@@ -3901,61 +3920,110 @@
|
|
3901
3920
|
var backOnSelect = smartSelect.attr('data-back-onselect') ? (smartSelect.attr('data-back-onselect') === 'true' ? true : false) : app.params.smartSelectBackOnSelect;
|
3902
3921
|
var formTheme = smartSelect.attr('data-form-theme') || app.params.smartSelectFormTheme;
|
3903
3922
|
var navbarTheme = smartSelect.attr('data-navbar-theme') || app.params.smartSelectNavbarTheme;
|
3923
|
+
var virtualList = smartSelect.attr('data-virtual-list') === 'true';
|
3924
|
+
var virtualListItemHeight = smartSelect.attr('data-virtual-list-height');
|
3904
3925
|
|
3905
|
-
//
|
3926
|
+
// Collect all options/values
|
3927
|
+
var select = smartSelect.find('select')[0];
|
3928
|
+
var $select = $(select);
|
3929
|
+
if (select.disabled || smartSelect.hasClass('disabled') || $select.hasClass('disabled')) {
|
3930
|
+
return;
|
3931
|
+
}
|
3932
|
+
var values = [];
|
3906
3933
|
var id = (new Date()).getTime();
|
3907
3934
|
var inputType = select.multiple ? 'checkbox' : 'radio';
|
3908
3935
|
var inputName = inputType + '-' + id;
|
3909
|
-
var
|
3910
|
-
var
|
3911
|
-
|
3912
|
-
if (
|
3913
|
-
|
3914
|
-
|
3915
|
-
|
3916
|
-
|
3917
|
-
|
3918
|
-
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3936
|
+
var option, optionHasMedia, optionImage, optionIcon, optionGroup, optionGroupLabel, optionPreviousGroup, optionShowGroupLabel, previousGroup;
|
3937
|
+
for (var i = 0; i < select.length; i++) {
|
3938
|
+
option = $(select[i]);
|
3939
|
+
if (option[0].disabled) continue;
|
3940
|
+
optionImage = option.attr('data-option-image') || $select.attr('data-option-image');
|
3941
|
+
optionIcon = option.attr('data-option-icon') || $select.attr('data-option-icon');
|
3942
|
+
optionHasMedia = optionImage || optionIcon || inputType === 'checkbox';
|
3943
|
+
optionGroup = option.parent('optgroup')[0];
|
3944
|
+
optionGroupLabel = optionGroup && optionGroup.label;
|
3945
|
+
optionShowGroupLabel = false;
|
3946
|
+
if (optionGroup) {
|
3947
|
+
if (optionGroup !== previousGroup) {
|
3948
|
+
optionShowGroupLabel = true;
|
3949
|
+
previousGroup = optionGroup;
|
3950
|
+
}
|
3951
|
+
}
|
3952
|
+
values.push({
|
3953
|
+
value: option[0].value,
|
3954
|
+
text: option[0].textContent.trim(),
|
3955
|
+
selected: option[0].selected,
|
3956
|
+
group: optionGroup,
|
3957
|
+
groupLabel: optionGroupLabel,
|
3958
|
+
showGroupLabel: optionShowGroupLabel,
|
3959
|
+
image: optionImage,
|
3960
|
+
icon: optionIcon,
|
3961
|
+
disabled: option[0].disabled,
|
3962
|
+
inputType: inputType,
|
3963
|
+
id: id,
|
3964
|
+
hasMedia: optionHasMedia,
|
3965
|
+
checkbox: inputType === 'checkbox',
|
3966
|
+
inputName: inputName,
|
3967
|
+
test: this
|
3968
|
+
});
|
3969
|
+
}
|
3970
|
+
|
3971
|
+
|
3972
|
+
// Item template/HTML
|
3973
|
+
if (!app._compiledTemplates.smartSelectItem) {
|
3974
|
+
app._compiledTemplates.smartSelectItem = t7.compile(app.params.smartSelectItemTemplate ||
|
3975
|
+
'{{#if showGroupLabel}}' +
|
3976
|
+
'<li class="item-divider">{{groupLabel}}</li>' +
|
3977
|
+
'{{/if}}' +
|
3925
3978
|
'<li>' +
|
3926
|
-
'<label class="label-
|
3927
|
-
'<input type="
|
3928
|
-
|
3979
|
+
'<label class="label-{{inputType}} item-content">' +
|
3980
|
+
'<input type="{{inputType}}" name="{{inputName}}" value="{{value}}" {{#if selected}}checked{{/if}}>' +
|
3981
|
+
'{{#if hasMedia}}' +
|
3982
|
+
'<div class="item-media">' +
|
3983
|
+
'{{#if checkbox}}<i class="icon icon-form-checkbox"></i>{{/if}}' +
|
3984
|
+
'{{#if icon}}<i class="icon {{icon}}"></i>{{/if}}' +
|
3985
|
+
'{{#if image}}<img src="{{image}}">{{/if}}' +
|
3986
|
+
'</div>' +
|
3987
|
+
'{{/if}}' +
|
3929
3988
|
'<div class="item-inner">' +
|
3930
|
-
'<div class="item-title">
|
3989
|
+
'<div class="item-title">{{text}}</div>' +
|
3931
3990
|
'</div>' +
|
3932
3991
|
'</label>' +
|
3933
|
-
'</li>'
|
3992
|
+
'</li>'
|
3993
|
+
);
|
3934
3994
|
}
|
3935
|
-
|
3936
|
-
|
3937
|
-
var
|
3938
|
-
|
3939
|
-
|
3940
|
-
|
3941
|
-
' <div class="center sliding">' + pageTitle + '</div>' +
|
3942
|
-
' </div>' +
|
3943
|
-
'</div>';
|
3944
|
-
|
3945
|
-
if (app.params.smartSelectNavbarTemplate) {
|
3946
|
-
if (!app._compiledTemplates.smartSelectNavbar) {
|
3947
|
-
app._compiledTemplates.smartSelectNavbar = t7.compile(app.params.smartSelectNavbarTemplate);
|
3995
|
+
var smartSelectItemTemplate = app._compiledTemplates.smartSelectItem;
|
3996
|
+
|
3997
|
+
var inputsHTML = '';
|
3998
|
+
if (!virtualList) {
|
3999
|
+
for (var j = 0; j < values.length; j++) {
|
4000
|
+
inputsHTML += smartSelectItemTemplate(values[j]);
|
3948
4001
|
}
|
3949
|
-
navbarHTML = app._compiledTemplates.smartSelectNavbar({
|
3950
|
-
pageTitle: pageTitle,
|
3951
|
-
backText: backText,
|
3952
|
-
openIn: openIn,
|
3953
|
-
inPopup: openIn === 'popup',
|
3954
|
-
inPage: openIn === 'page',
|
3955
|
-
id: id,
|
3956
|
-
inputType: inputType
|
3957
|
-
});
|
3958
4002
|
}
|
4003
|
+
|
4004
|
+
// Navbar HTML
|
4005
|
+
if (!app._compiledTemplates.smartSelectNavbar) {
|
4006
|
+
app._compiledTemplates.smartSelectNavbar = t7.compile(app.params.smartSelectNavbarTemplate ||
|
4007
|
+
'<div class="navbar {{#if navbarTheme}}theme-{{navbarTheme}}{{/if}}">' +
|
4008
|
+
'<div class="navbar-inner">' +
|
4009
|
+
'{{leftTemplate}}' +
|
4010
|
+
'<div class="center sliding">{{pageTitle}}</div>' +
|
4011
|
+
'</div>' +
|
4012
|
+
'</div>'
|
4013
|
+
);
|
4014
|
+
}
|
4015
|
+
var navbarHTML = app._compiledTemplates.smartSelectNavbar({
|
4016
|
+
pageTitle: pageTitle,
|
4017
|
+
backText: backText,
|
4018
|
+
closeText: closeText,
|
4019
|
+
openIn: openIn,
|
4020
|
+
navbarTheme: navbarTheme,
|
4021
|
+
inPopup: openIn === 'popup',
|
4022
|
+
inPage: openIn === 'page',
|
4023
|
+
leftTemplate: openIn === 'popup' ? app.params.smartSelectPopupCloseTemplate.replace(/{{closeText}}/g, closeText) : app.params.smartSelectBackTemplate.replace(/{{backText}}/g, backText)
|
4024
|
+
});
|
4025
|
+
|
4026
|
+
|
3959
4027
|
// Determine navbar layout type - static/fixed/through
|
3960
4028
|
var noNavbar = '', noToolbar = '', navbarLayout;
|
3961
4029
|
if (openIn === 'page') {
|
@@ -3998,9 +4066,9 @@
|
|
3998
4066
|
(useSearchbar ? searchbarHTML : '') +
|
3999
4067
|
' <div class="page-content">' +
|
4000
4068
|
(navbarLayout === 'static' ? navbarHTML : '') +
|
4001
|
-
' <div class="list-block smart-select-list-' + id + ' ' + (formTheme ? 'theme-' + formTheme : '') + '">' +
|
4069
|
+
' <div class="list-block ' + (virtualList ? 'virtual-list' : '') + ' smart-select-list-' + id + ' ' + (formTheme ? 'theme-' + formTheme : '') + '">' +
|
4002
4070
|
' <ul>' +
|
4003
|
-
inputsHTML +
|
4071
|
+
(virtualList ? '' : inputsHTML) +
|
4004
4072
|
' </ul>' +
|
4005
4073
|
' </div>' +
|
4006
4074
|
' </div>' +
|
@@ -4012,7 +4080,21 @@
|
|
4012
4080
|
|
4013
4081
|
// Event Listeners on new page
|
4014
4082
|
function handleInputs(container) {
|
4015
|
-
|
4083
|
+
if (virtualList) {
|
4084
|
+
var virtualListInstance = app.virtualList($(container).find('.virtual-list'), {
|
4085
|
+
items: values,
|
4086
|
+
template: smartSelectItemTemplate,
|
4087
|
+
height: virtualListItemHeight || undefined,
|
4088
|
+
searchByItem: function (query, index, item) {
|
4089
|
+
if (item.text.toLowerCase().indexOf(query.trim()) >=0 ) return true;
|
4090
|
+
return false;
|
4091
|
+
}
|
4092
|
+
});
|
4093
|
+
$(container).once(openIn === 'popup' ? 'closed': 'pageBeforeRemove', function () {
|
4094
|
+
if (virtualListInstance && virtualListInstance.destroy) virtualListInstance.destroy();
|
4095
|
+
});
|
4096
|
+
}
|
4097
|
+
$(container).on('change', 'input[name="' + inputName + '"]', function () {
|
4016
4098
|
var input = this;
|
4017
4099
|
var value = input.value;
|
4018
4100
|
var optionText = [];
|
@@ -4048,18 +4130,23 @@
|
|
4048
4130
|
handleInputs(page.container);
|
4049
4131
|
}
|
4050
4132
|
}
|
4051
|
-
|
4052
|
-
|
4133
|
+
|
4053
4134
|
// Load content
|
4054
4135
|
if (openIn === 'popup') {
|
4055
|
-
popup = app.popup(
|
4136
|
+
popup = app.popup(
|
4137
|
+
'<div class="popup smart-select-popup smart-select-popup-' + inputName + '">' +
|
4056
4138
|
'<div class="view navbar-fixed">' +
|
4057
4139
|
pageHTML +
|
4058
4140
|
'</div>' +
|
4059
|
-
'</div>'
|
4141
|
+
'</div>'
|
4142
|
+
);
|
4143
|
+
app.initPage($(popup).find('.page'));
|
4060
4144
|
handleInputs(popup);
|
4061
4145
|
}
|
4062
|
-
else
|
4146
|
+
else {
|
4147
|
+
$(document).on('pageInit', pageInit);
|
4148
|
+
view.router.load({content: pageHTML});
|
4149
|
+
}
|
4063
4150
|
};
|
4064
4151
|
|
4065
4152
|
/*===============================================================================
|
@@ -4102,7 +4189,7 @@
|
|
4102
4189
|
}
|
4103
4190
|
|
4104
4191
|
// Append <ul>
|
4105
|
-
vl.ul = vl.listBlock.children('ul');
|
4192
|
+
vl.ul = vl.params.ul ? $(vl.params.ul) : vl.listBlock.children('ul');
|
4106
4193
|
if (vl.ul.length === 0) {
|
4107
4194
|
vl.listBlock.append('<ul></ul>');
|
4108
4195
|
vl.ul = vl.listBlock.children('ul');
|
@@ -4158,7 +4245,7 @@
|
|
4158
4245
|
}
|
4159
4246
|
}
|
4160
4247
|
else {
|
4161
|
-
listHeight = items.length * vl.params.height;
|
4248
|
+
listHeight = items.length * vl.params.height / vl.params.cols;
|
4162
4249
|
rowsPerScreen = Math.ceil(pageHeight / vl.params.height);
|
4163
4250
|
rowsBefore = vl.params.rowsBefore || rowsPerScreen * 2;
|
4164
4251
|
rowsAfter = vl.params.rowsAfter || rowsPerScreen;
|
@@ -4174,13 +4261,15 @@
|
|
4174
4261
|
// Render items
|
4175
4262
|
vl.render = function (force) {
|
4176
4263
|
if (force) vl.lastRepaintY = null;
|
4177
|
-
var scrollTop = vl.pageContent[0].scrollTop;
|
4178
|
-
|
4264
|
+
// var scrollTop = vl.pageContent[0].scrollTop;
|
4265
|
+
var scrollTop = -(vl.listBlock[0].getBoundingClientRect().top + vl.pageContent[0].getBoundingClientRect().top);
|
4266
|
+
if (vl.lastRepaintY === null || Math.abs(scrollTop - vl.lastRepaintY) > maxBufferHeight || (!updatableScroll && (vl.pageContent[0].scrollTop + pageHeight >= vl.pageContent[0].scrollHeight))) {
|
4179
4267
|
vl.lastRepaintY = scrollTop;
|
4180
4268
|
}
|
4181
4269
|
else {
|
4182
4270
|
return;
|
4183
4271
|
}
|
4272
|
+
|
4184
4273
|
var items = vl.filteredItems || vl.items,
|
4185
4274
|
fromIndex, toIndex, heightBeforeFirstItem = 0, heightBeforeLastItem = 0;
|
4186
4275
|
if (dynamicHeight) {
|
@@ -4256,16 +4345,19 @@
|
|
4256
4345
|
// Append item to fragment
|
4257
4346
|
vl.fragment.appendChild(item);
|
4258
4347
|
|
4259
|
-
|
4260
|
-
|
4261
|
-
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4348
|
+
|
4349
|
+
}
|
4350
|
+
|
4351
|
+
// Update list height with not updatable scroll
|
4352
|
+
if (!updatableScroll) {
|
4353
|
+
if (dynamicHeight) {
|
4354
|
+
vl.ul[0].style.height = heightBeforeLastItem + 'px';
|
4355
|
+
}
|
4356
|
+
else {
|
4357
|
+
vl.ul[0].style.height = i * vl.params.height / vl.params.cols + 'px';
|
4267
4358
|
}
|
4268
4359
|
}
|
4360
|
+
|
4269
4361
|
|
4270
4362
|
// Update list html
|
4271
4363
|
if (vl.params.onBeforeClear) vl.params.onBeforeClear(vl, vl.fragment);
|
@@ -4492,7 +4584,7 @@
|
|
4492
4584
|
if (!eventsTarget.hasClass('pull-to-refresh-content')) {
|
4493
4585
|
eventsTarget = eventsTarget.find('.pull-to-refresh-content');
|
4494
4586
|
}
|
4495
|
-
if (eventsTarget.length === 0) return;
|
4587
|
+
if (!eventsTarget || eventsTarget.length === 0) return;
|
4496
4588
|
|
4497
4589
|
var isTouched, isMoved, touchesStart = {}, isScrolling, touchesDiff, touchStartTime, container, refresh = false, useTranslate = false, startTranslate = 0, translate, scrollTop, wasScrolled, layer;
|
4498
4590
|
var page = eventsTarget.hasClass('page') ? eventsTarget : eventsTarget.parents('.page');
|
@@ -4501,8 +4593,6 @@
|
|
4501
4593
|
if (page.hasClass('no-navbar')) hasNavbar = false;
|
4502
4594
|
if (!hasNavbar) eventsTarget.addClass('pull-to-refresh-no-navbar');
|
4503
4595
|
|
4504
|
-
if (eventsTarget)
|
4505
|
-
|
4506
4596
|
container = eventsTarget;
|
4507
4597
|
|
4508
4598
|
function handleTouchStart(e) {
|
@@ -4617,11 +4707,14 @@
|
|
4617
4707
|
|
4618
4708
|
// Detach Events on page remove
|
4619
4709
|
if (page.length === 0) return;
|
4620
|
-
function
|
4710
|
+
function destroyPullToRefresh() {
|
4621
4711
|
eventsTarget.off(app.touchEvents.start, handleTouchStart);
|
4622
4712
|
eventsTarget.off(app.touchEvents.move, handleTouchMove);
|
4623
4713
|
eventsTarget.off(app.touchEvents.end, handleTouchEnd);
|
4624
|
-
|
4714
|
+
}
|
4715
|
+
eventsTarget[0].f7DestroyPullToRefresh = destroyPullToRefresh;
|
4716
|
+
function detachEvents() {
|
4717
|
+
destroyPullToRefresh();
|
4625
4718
|
page.off('pageBeforeRemove', detachEvents);
|
4626
4719
|
}
|
4627
4720
|
page.on('pageBeforeRemove', detachEvents);
|
@@ -4648,6 +4741,13 @@
|
|
4648
4741
|
});
|
4649
4742
|
};
|
4650
4743
|
|
4744
|
+
app.destroyPullToRefresh = function (pageContainer) {
|
4745
|
+
pageContainer = $(pageContainer);
|
4746
|
+
var pullToRefreshContent = pageContainer.hasClass('pull-to-refresh-content') ? pageContainer : pageContainer.find('.pull-to-refresh-content');
|
4747
|
+
if (pullToRefreshContent.length === 0) return;
|
4748
|
+
if (pullToRefreshContent[0].f7DestroyPullToRefresh) pullToRefreshContent[0].f7DestroyPullToRefresh();
|
4749
|
+
};
|
4750
|
+
|
4651
4751
|
/* ===============================================================================
|
4652
4752
|
************ Infinite Scroll ************
|
4653
4753
|
=============================================================================== */
|
@@ -4880,9 +4980,10 @@
|
|
4880
4980
|
};
|
4881
4981
|
app.accordionOpen = function (item) {
|
4882
4982
|
item = $(item);
|
4883
|
-
var list = item.parents('.accordion-list');
|
4884
|
-
var content = item.
|
4885
|
-
|
4983
|
+
var list = item.parents('.accordion-list').eq(0);
|
4984
|
+
var content = item.children('.accordion-item-content');
|
4985
|
+
if (content.length === 0) content = item.find('.accordion-item-content');
|
4986
|
+
var expandedItem = list.length > 0 && item.parent().children('.accordion-item-expanded');
|
4886
4987
|
if (expandedItem.length > 0) {
|
4887
4988
|
app.accordionClose(expandedItem);
|
4888
4989
|
}
|
@@ -4904,7 +5005,8 @@
|
|
4904
5005
|
};
|
4905
5006
|
app.accordionClose = function (item) {
|
4906
5007
|
item = $(item);
|
4907
|
-
var content = item.
|
5008
|
+
var content = item.children('.accordion-item-content');
|
5009
|
+
if (content.length === 0) content = item.find('.accordion-item-content');
|
4908
5010
|
item.removeClass('accordion-item-expanded');
|
4909
5011
|
content.transition(0);
|
4910
5012
|
content.css('height', content[0].scrollHeight + 'px');
|
@@ -5378,7 +5480,8 @@
|
|
5378
5480
|
}
|
5379
5481
|
// Accordion
|
5380
5482
|
if (clicked.hasClass('accordion-item-toggle') || (clicked.hasClass('item-link') && clicked.parent().hasClass('accordion-item'))) {
|
5381
|
-
var accordionItem = clicked.
|
5483
|
+
var accordionItem = clicked.parent('.accordion-item');
|
5484
|
+
if (accordionItem.length === 0) accordionItem = clicked.parents('.accordion-item');
|
5382
5485
|
if (accordionItem.length === 0) accordionItem = clicked.parents('li');
|
5383
5486
|
app.accordionToggle(accordionItem);
|
5384
5487
|
}
|
@@ -5406,9 +5509,7 @@
|
|
5406
5509
|
}
|
5407
5510
|
}
|
5408
5511
|
if (!view) {
|
5409
|
-
|
5410
|
-
if (app.views[i].main) view = app.views[i];
|
5411
|
-
}
|
5512
|
+
if (app.mainView) view = app.mainView;
|
5412
5513
|
}
|
5413
5514
|
if (!view) return;
|
5414
5515
|
|
@@ -5715,10 +5816,7 @@
|
|
5715
5816
|
});
|
5716
5817
|
function handlePopState(e) {
|
5717
5818
|
if (blockPopstate) return;
|
5718
|
-
var mainView;
|
5719
|
-
for (var i = 0; i < app.views.length; i++) {
|
5720
|
-
if (app.views[i].main) mainView = app.views[i];
|
5721
|
-
}
|
5819
|
+
var mainView = app.mainView;
|
5722
5820
|
if (!mainView) return;
|
5723
5821
|
var state = e.state;
|
5724
5822
|
if (!state) {
|
@@ -5875,8 +5973,8 @@
|
|
5875
5973
|
}
|
5876
5974
|
}
|
5877
5975
|
// First/last
|
5878
|
-
s.isFirst = s.activeSlideIndex === 0;
|
5879
|
-
s.isLast = s.activeSlideIndex === s.slides.length - s.params.slidesPerView;
|
5976
|
+
s.isFirst = s.isBeginning = s.activeSlideIndex === 0;
|
5977
|
+
s.isLast = s.isEnd = s.activeSlideIndex === s.slides.length - s.params.slidesPerView;
|
5880
5978
|
};
|
5881
5979
|
|
5882
5980
|
s.updatePagination = function () {
|
@@ -6123,8 +6221,8 @@
|
|
6123
6221
|
if (typeof speed === 'undefined') speed = s.params.speed;
|
6124
6222
|
s.previousSlideIndex = s.activeSlideIndex;
|
6125
6223
|
s.activeSlideIndex = Math.round(index);
|
6126
|
-
s.isFirst = s.activeSlideIndex === 0;
|
6127
|
-
s.isLast = s.activeSlideIndex === s.slides.length - s.params.slidesPerView;
|
6224
|
+
s.isFirst = s.isBeginning = s.activeSlideIndex === 0;
|
6225
|
+
s.isLast = s.isEnd = s.activeSlideIndex === s.slides.length - s.params.slidesPerView;
|
6128
6226
|
s.onTransitionStart();
|
6129
6227
|
var translateX = isH ? translate * inverter : 0, translateY = isH ? 0 : translate;
|
6130
6228
|
if (speed === 0) {
|
@@ -6299,6 +6397,9 @@
|
|
6299
6397
|
else s.updateClasses();
|
6300
6398
|
s.attachEvents();
|
6301
6399
|
if (s.params.autoplay) s.startAutoplay();
|
6400
|
+
if (typeof s.params.onInit === 'function') {
|
6401
|
+
s.params.onInit();
|
6402
|
+
}
|
6302
6403
|
};
|
6303
6404
|
s.update = function () {
|
6304
6405
|
if (s.params.loop) s.createLoop();
|
@@ -6417,14 +6518,6 @@
|
|
6417
6518
|
|
6418
6519
|
pb.params = params;
|
6419
6520
|
|
6420
|
-
function findView() {
|
6421
|
-
var view;
|
6422
|
-
for (i = 0; i < app.views.length; i ++) {
|
6423
|
-
if (app.views[i].main) view = app.views[i];
|
6424
|
-
}
|
6425
|
-
return view;
|
6426
|
-
}
|
6427
|
-
|
6428
6521
|
var iconColor = pb.params.theme === 'dark' ? 'color-white' : '';
|
6429
6522
|
|
6430
6523
|
var navbarTemplate = pb.params.navbarTemplate ||
|
@@ -6540,7 +6633,7 @@
|
|
6540
6633
|
if (pb.params.type === 'page') {
|
6541
6634
|
$(document).on('pageBeforeInit', pb.onPageBeforeInit);
|
6542
6635
|
$(document).on('pageBeforeRemove', pb.onPageBeforeRemove);
|
6543
|
-
if (!pb.params.view) pb.params.view =
|
6636
|
+
if (!pb.params.view) pb.params.view = app.mainView;
|
6544
6637
|
pb.params.view.loadContent(htmlTemplate);
|
6545
6638
|
return;
|
6546
6639
|
}
|
@@ -7095,7 +7188,7 @@
|
|
7095
7188
|
list.prepend(item[0]);
|
7096
7189
|
container.show();
|
7097
7190
|
|
7098
|
-
var itemHeight = item.
|
7191
|
+
var itemHeight = item.outerHeight();
|
7099
7192
|
item.css('marginTop', -itemHeight + 'px');
|
7100
7193
|
item.transition(0);
|
7101
7194
|
|
@@ -7114,7 +7207,7 @@
|
|
7114
7207
|
if (item.hasClass('notification-item-removing')) return;
|
7115
7208
|
var container = $('.notifications');
|
7116
7209
|
|
7117
|
-
var itemHeight = item.
|
7210
|
+
var itemHeight = item.outerHeight();
|
7118
7211
|
item.css('height', itemHeight + 'px').transition(0);
|
7119
7212
|
var clientLeft = item[0].clientLeft;
|
7120
7213
|
|
@@ -7139,7 +7232,7 @@
|
|
7139
7232
|
if (!window.Template7) return;
|
7140
7233
|
Template7.templates = Template7.templates || app.params.templates || {};
|
7141
7234
|
Template7.data = Template7.data || app.params.template7Data || {};
|
7142
|
-
Template7.
|
7235
|
+
Template7.cache = Template7.cache || {};
|
7143
7236
|
|
7144
7237
|
app.templates = Template7.templates;
|
7145
7238
|
app.template7Data = Template7.data;
|
@@ -7235,7 +7328,7 @@
|
|
7235
7328
|
if (app.initSortable && app.params.sortable) app.initSortable();
|
7236
7329
|
|
7237
7330
|
// Init Live Swipe Panels
|
7238
|
-
if (app.initSwipePanels && app.params.swipePanel) app.initSwipePanels();
|
7331
|
+
if (app.initSwipePanels && (app.params.swipePanel || app.params.swipePanelOnlyClose)) app.initSwipePanels();
|
7239
7332
|
|
7240
7333
|
// App Init callback
|
7241
7334
|
if (app.params.onAppInit) app.params.onAppInit();
|
@@ -7276,9 +7369,32 @@
|
|
7276
7369
|
if (selector) {
|
7277
7370
|
// String
|
7278
7371
|
if (typeof selector === 'string') {
|
7279
|
-
var els
|
7280
|
-
|
7281
|
-
|
7372
|
+
var els, tempParent, html = selector.trim();
|
7373
|
+
if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
|
7374
|
+
var toCreate = 'div';
|
7375
|
+
if (html.indexOf('<li') === 0) toCreate = 'ul';
|
7376
|
+
if (html.indexOf('<tr') === 0) toCreate = 'tbody';
|
7377
|
+
if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
|
7378
|
+
if (html.indexOf('<tbody') === 0) toCreate = 'table';
|
7379
|
+
if (html.indexOf('<option') === 0) toCreate = 'select';
|
7380
|
+
tempParent = document.createElement(toCreate);
|
7381
|
+
tempParent.innerHTML = selector;
|
7382
|
+
for (i = 0; i < tempParent.childNodes.length; i++) {
|
7383
|
+
arr.push(tempParent.childNodes[i]);
|
7384
|
+
}
|
7385
|
+
}
|
7386
|
+
else {
|
7387
|
+
if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {
|
7388
|
+
// Pure ID selector
|
7389
|
+
els = [document.getElementById(selector.split('#')[1])];
|
7390
|
+
}
|
7391
|
+
else {
|
7392
|
+
// Other selectors
|
7393
|
+
els = (context || document).querySelectorAll(selector);
|
7394
|
+
}
|
7395
|
+
for (i = 0; i < els.length; i++) {
|
7396
|
+
if (els[i]) arr.push(els[i]);
|
7397
|
+
}
|
7282
7398
|
}
|
7283
7399
|
}
|
7284
7400
|
// Node/element
|
@@ -7330,14 +7446,26 @@
|
|
7330
7446
|
}
|
7331
7447
|
return this;
|
7332
7448
|
},
|
7333
|
-
attr: function (
|
7334
|
-
if (typeof
|
7335
|
-
|
7449
|
+
attr: function (attrs, value) {
|
7450
|
+
if (arguments.length === 1 && typeof attrs === 'string') {
|
7451
|
+
// Get attr
|
7452
|
+
if (this[0]) return this[0].getAttribute(attrs);
|
7336
7453
|
else return undefined;
|
7337
7454
|
}
|
7338
7455
|
else {
|
7456
|
+
// Set attrs
|
7339
7457
|
for (var i = 0; i < this.length; i++) {
|
7340
|
-
|
7458
|
+
if (arguments.length === 2) {
|
7459
|
+
// String
|
7460
|
+
this[i].setAttribute(attrs, value);
|
7461
|
+
}
|
7462
|
+
else {
|
7463
|
+
// Object
|
7464
|
+
for (var attrName in attrs) {
|
7465
|
+
this[i][attrName] = attrs[attrName];
|
7466
|
+
this[i].setAttribute(attrName, attrs[attrName]);
|
7467
|
+
}
|
7468
|
+
}
|
7341
7469
|
}
|
7342
7470
|
return this;
|
7343
7471
|
}
|
@@ -7347,14 +7475,25 @@
|
|
7347
7475
|
this[i].removeAttribute(attr);
|
7348
7476
|
}
|
7349
7477
|
},
|
7350
|
-
prop: function (
|
7351
|
-
if (typeof
|
7352
|
-
|
7478
|
+
prop: function (props, value) {
|
7479
|
+
if (arguments.length === 1 && typeof props === 'string') {
|
7480
|
+
// Get prop
|
7481
|
+
if (this[0]) return this[0][props];
|
7353
7482
|
else return undefined;
|
7354
7483
|
}
|
7355
7484
|
else {
|
7485
|
+
// Set props
|
7356
7486
|
for (var i = 0; i < this.length; i++) {
|
7357
|
-
|
7487
|
+
if (arguments.length === 2) {
|
7488
|
+
// String
|
7489
|
+
this[i][props] = value;
|
7490
|
+
}
|
7491
|
+
else {
|
7492
|
+
// Object
|
7493
|
+
for (var propName in props) {
|
7494
|
+
this[i][propName] = props[propName];
|
7495
|
+
}
|
7496
|
+
}
|
7358
7497
|
}
|
7359
7498
|
return this;
|
7360
7499
|
}
|
@@ -7542,17 +7681,16 @@
|
|
7542
7681
|
}
|
7543
7682
|
else {
|
7544
7683
|
if (this.length > 0) {
|
7545
|
-
return parseFloat(this.css('width'))
|
7684
|
+
return parseFloat(this.css('width'));
|
7546
7685
|
}
|
7547
7686
|
else {
|
7548
7687
|
return null;
|
7549
7688
|
}
|
7550
7689
|
}
|
7551
|
-
|
7552
7690
|
},
|
7553
|
-
outerWidth: function (
|
7691
|
+
outerWidth: function (includeMargins) {
|
7554
7692
|
if (this.length > 0) {
|
7555
|
-
if (
|
7693
|
+
if (includeMargins)
|
7556
7694
|
return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));
|
7557
7695
|
else
|
7558
7696
|
return this[0].offsetWidth;
|
@@ -7565,17 +7703,16 @@
|
|
7565
7703
|
}
|
7566
7704
|
else {
|
7567
7705
|
if (this.length > 0) {
|
7568
|
-
return
|
7706
|
+
return parseFloat(this.css('height'));
|
7569
7707
|
}
|
7570
7708
|
else {
|
7571
7709
|
return null;
|
7572
7710
|
}
|
7573
7711
|
}
|
7574
|
-
|
7575
7712
|
},
|
7576
|
-
outerHeight: function (
|
7713
|
+
outerHeight: function (includeMargins) {
|
7577
7714
|
if (this.length > 0) {
|
7578
|
-
if (
|
7715
|
+
if (includeMargins)
|
7579
7716
|
return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));
|
7580
7717
|
else
|
7581
7718
|
return this[0].offsetHeight;
|
@@ -7740,7 +7877,6 @@
|
|
7740
7877
|
while (tempDiv.firstChild) {
|
7741
7878
|
this[i].appendChild(tempDiv.firstChild);
|
7742
7879
|
}
|
7743
|
-
// this[i].insertAdjacentHTML('beforeend', newChild);
|
7744
7880
|
}
|
7745
7881
|
else if (newChild instanceof Dom7) {
|
7746
7882
|
for (j = 0; j < newChild.length; j++) {
|
@@ -8674,24 +8810,27 @@ window.Template7 = (function () {
|
|
8674
8810
|
}
|
8675
8811
|
function getCompileVar(name, ctx) {
|
8676
8812
|
var parents, variable, context;
|
8677
|
-
|
8678
|
-
|
8679
|
-
if (name.indexOf('this') === 0) variable = name.replace('this', ctx);
|
8680
|
-
else variable = ctx + '.' + name;
|
8813
|
+
if (name.indexOf('@global') >= 0) {
|
8814
|
+
variable = '(Template7.global && Template7.global.' + (name.split('@global.')[1]) + ')';
|
8681
8815
|
}
|
8682
|
-
else if (name.indexOf('
|
8683
|
-
|
8684
|
-
var newName = name.split('../')[name.split('../').length - 1];
|
8685
|
-
var newDepth = ctx.split('_')[1] - levelUp;
|
8686
|
-
variable = 'ctx_' + (newDepth >= 1 ? newDepth : 1) + '.' + newName;
|
8816
|
+
else if (name.indexOf('@') >= 0) {
|
8817
|
+
variable = '(data && data.' + name.replace('@', '') + ')';
|
8687
8818
|
}
|
8688
8819
|
else {
|
8689
|
-
|
8690
|
-
|
8691
|
-
|
8692
|
-
|
8820
|
+
if (name.indexOf('.') > 0) {
|
8821
|
+
if (name.indexOf('this') === 0) variable = name.replace('this', ctx);
|
8822
|
+
else variable = ctx + '.' + name;
|
8823
|
+
}
|
8824
|
+
else if (name.indexOf('../') === 0) {
|
8825
|
+
var levelUp = name.split('../').length - 1;
|
8826
|
+
var newName = name.split('../')[name.split('../').length - 1];
|
8827
|
+
var newDepth = ctx.split('_')[1] - levelUp;
|
8828
|
+
variable = 'ctx_' + (newDepth >= 1 ? newDepth : 1) + '.' + newName;
|
8829
|
+
}
|
8830
|
+
else {
|
8831
|
+
variable = name === 'this' ? ctx : ctx + '.' + name;
|
8832
|
+
}
|
8693
8833
|
}
|
8694
|
-
|
8695
8834
|
return variable;
|
8696
8835
|
}
|
8697
8836
|
function getCompiledArguments(contextArray, ctx) {
|
@@ -8819,7 +8958,7 @@ window.Template7 = (function () {
|
|
8819
8958
|
},
|
8820
8959
|
'join': function (context, options) {
|
8821
8960
|
if (isFunction(context)) { context = context.call(this); }
|
8822
|
-
return context.join(options.hash.delimeter);
|
8961
|
+
return context.join(options.hash.delimiter || options.hash.delimeter);
|
8823
8962
|
}
|
8824
8963
|
}
|
8825
8964
|
};
|