@valtimo/layout 4.15.2 → 4.16.0-next-main.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/app.css +4020 -1726
- package/assets/img/valtimo/favicons/manifest.json +17 -17
- package/assets/js/app.js +2617 -406
- package/bundles/valtimo-layout.umd.js +10 -9
- package/bundles/valtimo-layout.umd.js.map +1 -1
- package/bundles/valtimo-layout.umd.min.js +1 -1
- package/bundles/valtimo-layout.umd.min.js.map +1 -1
- package/esm2015/lib/layout-internal/layout-internal.component.js +3 -3
- package/esm2015/lib/layout-public/layout-public.component.js +3 -4
- package/esm2015/lib/layout.component.js +4 -2
- package/esm2015/lib/layout.module.js +4 -4
- package/esm2015/lib/layout.service.js +2 -2
- package/esm2015/public_api.js +1 -1
- package/esm2015/valtimo-layout.js +1 -1
- package/fesm2015/valtimo-layout.js +10 -9
- package/fesm2015/valtimo-layout.js.map +1 -1
- package/package.json +1 -4
- package/valtimo-layout.metadata.json +1 -1
package/assets/js/app.js
CHANGED
|
@@ -25,50 +25,50 @@ var App = (function () {
|
|
|
25
25
|
collapsibleSidebarCollapsedClass: 'be-collapsible-sidebar-collapsed',
|
|
26
26
|
openLeftSidebarOnClick: true,
|
|
27
27
|
transitionClass: 'be-animate',
|
|
28
|
-
openSidebarDelay: 400
|
|
28
|
+
openSidebarDelay: 400,
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
var colors = {};
|
|
32
32
|
var scrollers = {};
|
|
33
33
|
var body,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
wrapper,
|
|
35
|
+
topNavbar,
|
|
36
|
+
leftSidebar,
|
|
37
|
+
rightSidebar,
|
|
38
|
+
asideDiv,
|
|
39
|
+
notificationsDiv,
|
|
40
|
+
toggleLeftSidebarButton,
|
|
41
|
+
openSidebar;
|
|
42
42
|
|
|
43
43
|
//Perfect scrollbar variables
|
|
44
44
|
var ps_be_scroller_notifications,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
ps_left_sidebar,
|
|
46
|
+
ps_be_scroller_left_sidebar,
|
|
47
|
+
ps_sub_menu_scroller,
|
|
48
|
+
ps_chat_scroll,
|
|
49
|
+
ps_todo_scroll,
|
|
50
|
+
ps_settings_scroll,
|
|
51
|
+
ps_messages_scroll,
|
|
52
|
+
ps_aside_scroll;
|
|
53
53
|
|
|
54
54
|
//Get the template css colors into js vars
|
|
55
|
-
function getColor(
|
|
56
|
-
var tmp = $(
|
|
57
|
-
var color = tmp.css(
|
|
55
|
+
function getColor(c) {
|
|
56
|
+
var tmp = $('<div>', {class: c}).appendTo('body');
|
|
57
|
+
var color = tmp.css('background-color');
|
|
58
58
|
tmp.remove();
|
|
59
59
|
|
|
60
60
|
return color;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// Refresh scroller
|
|
64
|
-
function updateScroller(ps_object){
|
|
65
|
-
if(
|
|
64
|
+
function updateScroller(ps_object) {
|
|
65
|
+
if (typeof ps_object !== 'undefined') {
|
|
66
66
|
ps_object.update();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Destroy scroller
|
|
71
|
-
function destroyScroller(ps_object){
|
|
71
|
+
function destroyScroller(ps_object) {
|
|
72
72
|
if (ps_object) {
|
|
73
73
|
ps_object.destroy();
|
|
74
74
|
}
|
|
@@ -76,408 +76,439 @@ var App = (function () {
|
|
|
76
76
|
|
|
77
77
|
// Initialize scroller
|
|
78
78
|
function initScroller(domObject) {
|
|
79
|
-
if(
|
|
79
|
+
if (typeof domObject[0] !== 'undefined') {
|
|
80
80
|
return new PerfectScrollbar(domObject[0], {
|
|
81
|
-
wheelPropagation: false
|
|
81
|
+
wheelPropagation: false,
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
//Core private functions
|
|
87
|
-
function leftSidebarInit(){
|
|
88
|
-
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var lsToggle = $(".left-sidebar-toggle", leftSidebar);
|
|
87
|
+
function leftSidebarInit() {
|
|
88
|
+
var firstAnchor = $('.sidebar-elements > li > a', leftSidebar);
|
|
89
|
+
var anchor = $('.sidebar-elements li a', leftSidebar);
|
|
90
|
+
var lsc = $('.left-sidebar-scroll', leftSidebar);
|
|
91
|
+
var lsToggle = $('.left-sidebar-toggle', leftSidebar);
|
|
93
92
|
var openLeftSidebarOnClick = config.openLeftSidebarOnClick ? true : false;
|
|
94
93
|
|
|
95
94
|
// Collapsible sidebar toggle functionality
|
|
96
|
-
function toggleSideBar(){
|
|
97
|
-
var button = $(
|
|
98
|
-
|
|
99
|
-
button.on(
|
|
100
|
-
if(
|
|
101
|
-
wrapper.removeClass(
|
|
102
|
-
$(
|
|
103
|
-
$(
|
|
104
|
-
leftSidebar.trigger(
|
|
105
|
-
if (
|
|
106
|
-
ps_be_scroller_left_sidebar
|
|
95
|
+
function toggleSideBar() {
|
|
96
|
+
var button = $('.be-toggle-left-sidebar');
|
|
97
|
+
|
|
98
|
+
button.on('click', function () {
|
|
99
|
+
if (wrapper.hasClass(config.collapsibleSidebarCollapsedClass)) {
|
|
100
|
+
wrapper.removeClass(config.collapsibleSidebarCollapsedClass);
|
|
101
|
+
$('li.open', leftSidebar).removeClass('open');
|
|
102
|
+
$('li.active', leftSidebar).parents('.parent').addClass('active open');
|
|
103
|
+
leftSidebar.trigger('shown.left-sidebar.collapse');
|
|
104
|
+
if (
|
|
105
|
+
typeof ps_be_scroller_left_sidebar === 'undefined' ||
|
|
106
|
+
!ps_be_scroller_left_sidebar ||
|
|
107
|
+
!ps_be_scroller_left_sidebar.nodeName
|
|
108
|
+
) {
|
|
109
|
+
ps_be_scroller_left_sidebar = initScroller($('.be-scroller', leftSidebar));
|
|
107
110
|
}
|
|
108
111
|
destroyScroller(ps_be_scroller_left_sidebar);
|
|
109
112
|
// Destroy Perfect Scrollbar collapsed instance
|
|
110
|
-
if (typeof ps_sub_menu_scroller !==
|
|
113
|
+
if (typeof ps_sub_menu_scroller !== 'undefined') {
|
|
111
114
|
destroyScroller(ps_sub_menu_scroller);
|
|
112
115
|
}
|
|
113
116
|
} else {
|
|
114
|
-
wrapper.addClass(
|
|
115
|
-
$(
|
|
116
|
-
$(
|
|
117
|
-
leftSidebar.trigger(
|
|
117
|
+
wrapper.addClass(config.collapsibleSidebarCollapsedClass);
|
|
118
|
+
$('li.active', leftSidebar).parents('.parent').removeClass('open');
|
|
119
|
+
$('li.open', leftSidebar).removeClass('open');
|
|
120
|
+
leftSidebar.trigger('hidden.left-sidebar.collapse');
|
|
118
121
|
}
|
|
119
122
|
});
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
// Tooltip sidebar funcionality
|
|
123
|
-
function tooltipSidebar(){
|
|
124
|
-
var menu = $(
|
|
126
|
+
function tooltipSidebar() {
|
|
127
|
+
var menu = $('.sidebar-elements > li > a', leftSidebar);
|
|
125
128
|
|
|
126
|
-
for(var i = 0; i <= menu.length; i++
|
|
129
|
+
for (var i = 0; i <= menu.length; i++) {
|
|
127
130
|
var _self = menu[i];
|
|
128
|
-
var title = $(
|
|
131
|
+
var title = $('> span', _self).text();
|
|
129
132
|
|
|
130
133
|
$(_self).attr({
|
|
131
134
|
'data-toggle': 'tooltip',
|
|
132
135
|
'data-placement': 'right',
|
|
133
|
-
|
|
136
|
+
title: title,
|
|
134
137
|
});
|
|
135
138
|
|
|
136
139
|
$(_self).tooltip({
|
|
137
|
-
trigger: 'manual'
|
|
140
|
+
trigger: 'manual',
|
|
138
141
|
});
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
menu.on('mouseenter', function(){
|
|
142
|
-
if(!$.isSm() && wrapper.hasClass(config.collapsibleSidebarCollapsedClass)){
|
|
144
|
+
menu.on('mouseenter', function () {
|
|
145
|
+
if (!$.isSm() && wrapper.hasClass(config.collapsibleSidebarCollapsedClass)) {
|
|
143
146
|
$(this).tooltip('show');
|
|
144
147
|
}
|
|
145
148
|
});
|
|
146
149
|
|
|
147
|
-
menu.on('mouseleave', function(){
|
|
150
|
+
menu.on('mouseleave', function () {
|
|
148
151
|
$(this).tooltip('hide');
|
|
149
152
|
});
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
// Collapsed sidebar submenu title
|
|
153
|
-
function syncSubMenu(
|
|
156
|
+
function syncSubMenu(item) {
|
|
154
157
|
var elements;
|
|
155
158
|
|
|
156
|
-
if(
|
|
159
|
+
if (typeof item !== 'undefined') {
|
|
157
160
|
elements = item;
|
|
158
161
|
} else {
|
|
159
|
-
elements = $(
|
|
162
|
+
elements = $('.sidebar-elements > li', leftSidebar);
|
|
160
163
|
}
|
|
161
164
|
|
|
162
|
-
$.each(
|
|
163
|
-
var title = $(this).find(
|
|
164
|
-
var ul = $(this).find(
|
|
165
|
-
var subEls = $(
|
|
165
|
+
$.each(elements, function () {
|
|
166
|
+
var title = $(this).find('> a span').html();
|
|
167
|
+
var ul = $(this).find('> ul');
|
|
168
|
+
var subEls = $('> li', ul);
|
|
166
169
|
title = $('<li class="title">' + title + '</li>');
|
|
167
|
-
var subContainer = $(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
var subContainer = $(
|
|
171
|
+
'<li class="nav-items"><div class="be-scroller"><div class="content"><ul></ul></div></div></li>'
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
if (!ul.find('> li.title').length) {
|
|
175
|
+
ul.prepend(title);
|
|
176
|
+
subEls.appendTo(subContainer.find('.content ul'));
|
|
177
|
+
subContainer.appendTo(ul);
|
|
173
178
|
}
|
|
174
179
|
});
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
// Return boolean whether the sidebar is collapsed or not
|
|
178
|
-
function isCollapsed(){
|
|
179
|
-
return wrapper.hasClass(
|
|
183
|
+
function isCollapsed() {
|
|
184
|
+
return wrapper.hasClass(config.collapsibleSidebarCollapsedClass);
|
|
180
185
|
}
|
|
181
186
|
|
|
182
187
|
// Return true if the collapsible left sidebar is enabled
|
|
183
|
-
function isCollapsible(){
|
|
184
|
-
return wrapper.hasClass(
|
|
188
|
+
function isCollapsible() {
|
|
189
|
+
return wrapper.hasClass(config.collapsibleSidebarClass);
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
// Close submenu function
|
|
188
|
-
function closeSubMenu(
|
|
189
|
-
var target = $(
|
|
190
|
-
var li = $(
|
|
191
|
-
var openChildren = $(
|
|
193
|
+
function closeSubMenu(subMenu, event) {
|
|
194
|
+
var target = $(event.currentTarget);
|
|
195
|
+
var li = $(subMenu).parent();
|
|
196
|
+
var openChildren = $('li.open', li);
|
|
192
197
|
|
|
193
|
-
var clickOutside = !target.closest(
|
|
198
|
+
var clickOutside = !target.closest(leftSidebar).length;
|
|
194
199
|
var slideSpeed = config.leftSidebarSlideSpeed;
|
|
195
|
-
var isFirstLevel = target.parents().eq(
|
|
200
|
+
var isFirstLevel = target.parents().eq(1).hasClass('sidebar-elements');
|
|
196
201
|
|
|
197
202
|
// If left sidebar is collapsed, is not small device
|
|
198
203
|
// and the trigger element is first level
|
|
199
204
|
// or click outside the left sidebar
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
205
|
+
if (!$.isSm() && isCollapsed() && (isFirstLevel || clickOutside)) {
|
|
206
|
+
li.removeClass('open');
|
|
207
|
+
subMenu.removeClass('visible');
|
|
208
|
+
openChildren.removeClass('open').removeAttr('style');
|
|
209
|
+
} else {
|
|
210
|
+
// If not execute classic slide interaction
|
|
211
|
+
|
|
212
|
+
subMenu.slideUp({
|
|
213
|
+
duration: slideSpeed,
|
|
214
|
+
complete: function () {
|
|
215
|
+
li.removeClass('open');
|
|
216
|
+
$(this).removeAttr('style');
|
|
217
|
+
|
|
218
|
+
// Close opened child submenus
|
|
219
|
+
openChildren.removeClass('open').removeAttr('style');
|
|
220
|
+
if (wrapper.hasClass('be-fixed-sidebar') && !$.isSm()) {
|
|
221
|
+
updateScroller(ps_left_sidebar);
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
});
|
|
219
225
|
}
|
|
220
226
|
}
|
|
221
227
|
|
|
222
228
|
// Open submenu function
|
|
223
|
-
function openSubMenu(
|
|
224
|
-
var _el = $(
|
|
225
|
-
var li = $(
|
|
226
|
-
var subMenu = $(
|
|
229
|
+
function openSubMenu(anchor, event) {
|
|
230
|
+
var _el = $(anchor);
|
|
231
|
+
var li = $(_el).parent();
|
|
232
|
+
var subMenu = $(_el).next();
|
|
227
233
|
|
|
228
234
|
var slideSpeed = config.leftSidebarSlideSpeed;
|
|
229
|
-
var isFirstLevel = $(
|
|
235
|
+
var isFirstLevel = $(event.currentTarget).parents().eq(1).hasClass('sidebar-elements');
|
|
230
236
|
|
|
231
237
|
// Get the open sub menus
|
|
232
|
-
var openSubMenus = li.siblings(
|
|
238
|
+
var openSubMenus = li.siblings('.open');
|
|
233
239
|
|
|
234
240
|
// If there are open sub menus close them
|
|
235
|
-
if(
|
|
236
|
-
closeSubMenu(
|
|
241
|
+
if (openSubMenus) {
|
|
242
|
+
closeSubMenu($('> ul', openSubMenus), event);
|
|
237
243
|
}
|
|
238
244
|
|
|
239
245
|
// If left sidebar is collapsed, is not small device
|
|
240
246
|
// and the trigger element is first level
|
|
241
|
-
if (
|
|
242
|
-
li.addClass(
|
|
243
|
-
subMenu.addClass(
|
|
247
|
+
if (!$.isSm() && isCollapsed() && isFirstLevel) {
|
|
248
|
+
li.addClass('open');
|
|
249
|
+
subMenu.addClass('visible');
|
|
244
250
|
|
|
245
251
|
//Renew Perfect Scroller instance
|
|
246
|
-
if (typeof ps_sub_menu_scroller !==
|
|
252
|
+
if (typeof ps_sub_menu_scroller !== 'undefined') {
|
|
247
253
|
destroyScroller(ps_sub_menu_scroller);
|
|
248
254
|
}
|
|
249
|
-
if (
|
|
255
|
+
if (
|
|
256
|
+
typeof ps_sub_menu_scroller === 'undefined' ||
|
|
257
|
+
!ps_sub_menu_scroller ||
|
|
258
|
+
!ps_sub_menu_scroller.nodeName
|
|
259
|
+
) {
|
|
250
260
|
ps_sub_menu_scroller = initScroller(li.find('.be-scroller'));
|
|
251
261
|
}
|
|
252
262
|
|
|
253
263
|
$(window).resize(function () {
|
|
254
|
-
waitForFinalEvent(
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
264
|
+
waitForFinalEvent(
|
|
265
|
+
function () {
|
|
266
|
+
if (!$.isXs()) {
|
|
267
|
+
if (typeof ps_sub_menu_scroller !== 'undefined') {
|
|
268
|
+
updateScroller(ps_sub_menu_scroller);
|
|
269
|
+
}
|
|
258
270
|
}
|
|
271
|
+
},
|
|
272
|
+
500,
|
|
273
|
+
'am_check_phone_classes'
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
} else {
|
|
277
|
+
// If not execute classic slide interaction
|
|
278
|
+
|
|
279
|
+
subMenu.slideDown({
|
|
280
|
+
duration: slideSpeed,
|
|
281
|
+
complete: function () {
|
|
282
|
+
li.addClass('open');
|
|
283
|
+
$(this).removeAttr('style');
|
|
284
|
+
if (wrapper.hasClass('be-fixed-sidebar') && !$.isSm()) {
|
|
285
|
+
updateScroller(ps_left_sidebar);
|
|
259
286
|
}
|
|
260
|
-
},
|
|
287
|
+
},
|
|
261
288
|
});
|
|
262
|
-
|
|
263
|
-
} else { // If not execute classic slide interaction
|
|
264
|
-
|
|
265
|
-
subMenu.slideDown({ duration: slideSpeed, complete: function(){
|
|
266
|
-
li.addClass( 'open' );
|
|
267
|
-
$( this ).removeAttr( 'style' );
|
|
268
|
-
if( wrapper.hasClass("be-fixed-sidebar") && !$.isSm() ){
|
|
269
|
-
updateScroller(ps_left_sidebar);
|
|
270
|
-
}
|
|
271
|
-
}});
|
|
272
|
-
|
|
273
289
|
}
|
|
274
290
|
}
|
|
275
291
|
|
|
276
292
|
// Execute if collapsible sidebar is enabled
|
|
277
|
-
if (
|
|
293
|
+
if (isCollapsible()) {
|
|
278
294
|
/*Create sub menu elements*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if( !openLeftSidebarOnClick ){
|
|
295
|
+
syncSubMenu();
|
|
296
|
+
toggleSideBar();
|
|
297
|
+
tooltipSidebar();
|
|
284
298
|
|
|
299
|
+
if (!openLeftSidebarOnClick) {
|
|
285
300
|
/*Open sub-menu on hover*/
|
|
286
|
-
firstAnchor.on('mouseover',function(
|
|
287
|
-
if(
|
|
288
|
-
openSubMenu(
|
|
301
|
+
firstAnchor.on('mouseover', function (event) {
|
|
302
|
+
if (isCollapsed()) {
|
|
303
|
+
openSubMenu(this, event);
|
|
289
304
|
}
|
|
290
305
|
});
|
|
291
306
|
|
|
292
307
|
/*Open sub-menu on click (fix for touch devices)*/
|
|
293
|
-
firstAnchor.on('touchstart',function(
|
|
294
|
-
var anchor = $(
|
|
308
|
+
firstAnchor.on('touchstart', function (event) {
|
|
309
|
+
var anchor = $(this);
|
|
295
310
|
var li = anchor.parent();
|
|
296
311
|
var subMenu = anchor.next();
|
|
297
312
|
|
|
298
|
-
if(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
closeSubMenu( subMenu, event );
|
|
313
|
+
if (isCollapsed() && !$.isSm()) {
|
|
314
|
+
if (li.hasClass('open')) {
|
|
315
|
+
closeSubMenu(subMenu, event);
|
|
302
316
|
} else {
|
|
303
|
-
openSubMenu(
|
|
317
|
+
openSubMenu(this, event);
|
|
304
318
|
}
|
|
305
319
|
|
|
306
|
-
if(
|
|
320
|
+
if ($(this).next().is('ul')) {
|
|
307
321
|
event.preventDefault();
|
|
308
322
|
}
|
|
309
323
|
}
|
|
310
324
|
});
|
|
311
325
|
|
|
312
326
|
/*Sub-menu delay on mouse leave*/
|
|
313
|
-
firstAnchor.on('mouseleave',function(
|
|
314
|
-
var _self = $(
|
|
327
|
+
firstAnchor.on('mouseleave', function (event) {
|
|
328
|
+
var _self = $(this);
|
|
315
329
|
var _li = _self.parent();
|
|
316
|
-
var subMenu = _li.find(
|
|
317
|
-
|
|
318
|
-
if( !$.isSm() && isCollapsed() ){
|
|
330
|
+
var subMenu = _li.find('> ul');
|
|
319
331
|
|
|
332
|
+
if (!$.isSm() && isCollapsed()) {
|
|
320
333
|
//If mouse is over sub menu attach an additional mouseleave event to submenu
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
closeSubMenu( subMenu, event );
|
|
330
|
-
subMenu.off( 'mouseleave' );
|
|
334
|
+
if (subMenu.length > 0) {
|
|
335
|
+
setTimeout(function () {
|
|
336
|
+
if (subMenu.is(':hover')) {
|
|
337
|
+
subMenu.on('mouseleave', function () {
|
|
338
|
+
setTimeout(function () {
|
|
339
|
+
if (!_self.is(':hover')) {
|
|
340
|
+
closeSubMenu(subMenu, event);
|
|
341
|
+
subMenu.off('mouseleave');
|
|
331
342
|
}
|
|
332
343
|
}, 300);
|
|
333
344
|
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
closeSubMenu( subMenu, event );
|
|
345
|
+
} else {
|
|
346
|
+
closeSubMenu(subMenu, event);
|
|
337
347
|
}
|
|
338
348
|
}, 300);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
_li.removeClass( 'open' );
|
|
349
|
+
} else {
|
|
350
|
+
_li.removeClass('open');
|
|
342
351
|
}
|
|
343
352
|
}
|
|
344
353
|
});
|
|
345
354
|
}
|
|
346
355
|
|
|
347
356
|
/*Close sidebar on click outside*/
|
|
348
|
-
$(
|
|
349
|
-
if (
|
|
350
|
-
closeSubMenu(
|
|
357
|
+
$(document).on('mousedown touchstart', function (event) {
|
|
358
|
+
if (!$(event.target).closest(leftSidebar).length && !$.isSm()) {
|
|
359
|
+
closeSubMenu($('ul.visible', leftSidebar), event);
|
|
351
360
|
}
|
|
352
361
|
});
|
|
353
362
|
}
|
|
354
363
|
|
|
355
364
|
/*Open sub-menu functionality*/
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
365
|
+
anchor.on('click', function (event) {
|
|
366
|
+
var $el = $(this),
|
|
367
|
+
$open;
|
|
368
|
+
var $li = $el.parent();
|
|
369
|
+
var $subMenu = $el.next();
|
|
370
|
+
var isFirstLevel = $el.parents().eq(1).hasClass('sidebar-elements');
|
|
371
|
+
|
|
372
|
+
// Get the open menus
|
|
373
|
+
$open = $li.siblings('.open');
|
|
374
|
+
|
|
375
|
+
if ($li.hasClass('open')) {
|
|
376
|
+
closeSubMenu($subMenu, event);
|
|
377
|
+
} else {
|
|
378
|
+
openSubMenu(this, event);
|
|
379
|
+
}
|
|
370
380
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
381
|
+
//If current element has children stop link action
|
|
382
|
+
if ($el.next().is('ul')) {
|
|
383
|
+
event.preventDefault();
|
|
384
|
+
}
|
|
385
|
+
});
|
|
376
386
|
|
|
377
387
|
/*Calculate sidebar tree active & open classes*/
|
|
378
|
-
if (
|
|
379
|
-
$(
|
|
388
|
+
if (wrapper.hasClass(config.collapsibleSidebarCollapsedClass)) {
|
|
389
|
+
$('li.active', leftSidebar).parents('.parent').addClass('active');
|
|
380
390
|
} else {
|
|
381
|
-
$(
|
|
391
|
+
$('li.active', leftSidebar).parents('.parent').addClass('active open');
|
|
382
392
|
}
|
|
383
393
|
|
|
384
394
|
/* Add classes if top menu is present */
|
|
385
|
-
if(
|
|
386
|
-
wrapper
|
|
387
|
-
|
|
388
|
-
|
|
395
|
+
if (topNavbar.find('.container-fluid > .navbar-collapse').length && leftSidebar.length) {
|
|
396
|
+
wrapper
|
|
397
|
+
.addClass(config.offCanvasLeftSidebarClass)
|
|
398
|
+
.addClass(config.offCanvasLeftSidebarMobileClass);
|
|
399
|
+
wrapper.addClass(config.topHeaderMenuClass);
|
|
400
|
+
toggleLeftSidebarButton = $(
|
|
401
|
+
'<a class="nav-link be-toggle-left-sidebar" href="#"><span class="icon mdi mdi-menu"></span></a>'
|
|
402
|
+
);
|
|
389
403
|
$('.be-navbar-header', topNavbar).prepend(toggleLeftSidebarButton);
|
|
390
404
|
}
|
|
391
405
|
|
|
392
406
|
/*Scrollbar plugin init when left sidebar is fixed*/
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
407
|
+
if (wrapper.hasClass('be-fixed-sidebar')) {
|
|
408
|
+
if (!$.isSm() || wrapper.hasClass(config.offCanvasLeftSidebarClass)) {
|
|
409
|
+
if (
|
|
410
|
+
typeof ps_left_sidebar === 'undefined' ||
|
|
411
|
+
!ps_left_sidebar ||
|
|
412
|
+
!ps_left_sidebar.nodeName
|
|
413
|
+
) {
|
|
414
|
+
ps_left_sidebar = initScroller(lsc);
|
|
398
415
|
}
|
|
416
|
+
}
|
|
399
417
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
418
|
+
/*Update scrollbar height on window resize*/
|
|
419
|
+
$(window).resize(function () {
|
|
420
|
+
waitForFinalEvent(
|
|
421
|
+
function () {
|
|
422
|
+
if ($.isSm() && !wrapper.hasClass(config.offCanvasLeftSidebarClass)) {
|
|
404
423
|
destroyScroller(ps_left_sidebar);
|
|
405
424
|
} else {
|
|
406
|
-
if(
|
|
425
|
+
if (lsc.hasClass('ps')) {
|
|
407
426
|
updateScroller(ps_left_sidebar);
|
|
408
427
|
} else {
|
|
409
|
-
if (
|
|
428
|
+
if (
|
|
429
|
+
typeof ps_left_sidebar === 'undefined' ||
|
|
430
|
+
!ps_left_sidebar ||
|
|
431
|
+
!ps_left_sidebar.nodeName
|
|
432
|
+
) {
|
|
410
433
|
ps_left_sidebar = initScroller(lsc);
|
|
411
434
|
}
|
|
412
435
|
}
|
|
413
436
|
}
|
|
414
|
-
},
|
|
415
|
-
|
|
416
|
-
|
|
437
|
+
},
|
|
438
|
+
500,
|
|
439
|
+
'be_update_scroller'
|
|
440
|
+
);
|
|
441
|
+
});
|
|
442
|
+
}
|
|
417
443
|
|
|
418
444
|
/*Toggle sidebar on small devices*/
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
445
|
+
lsToggle.on('click', function (e) {
|
|
446
|
+
var spacer = $(this).next('.left-sidebar-spacer'),
|
|
447
|
+
toggleBtn = $(this);
|
|
448
|
+
var toggleSpacerMenu = $('.left-sidebar-spacer');
|
|
449
|
+
toggleBtn.toggleClass('open');
|
|
450
|
+
toggleSpacerMenu.toggleClass('open');
|
|
451
|
+
|
|
452
|
+
spacer.slideToggle(config.leftSidebarToggleSpeed, function () {
|
|
453
|
+
$(this).removeAttr('style').toggleClass('open');
|
|
428
454
|
});
|
|
429
455
|
|
|
456
|
+
e.preventDefault();
|
|
457
|
+
});
|
|
458
|
+
|
|
430
459
|
/*Off canvas menu*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
});
|
|
460
|
+
function leftSidebarOffCanvas() {
|
|
461
|
+
/*Open Sidebar with toggle button*/
|
|
462
|
+
toggleLeftSidebarButton.on('click', function (e) {
|
|
463
|
+
if (openSidebar && body.hasClass(config.openLeftSidebarClass)) {
|
|
464
|
+
body.removeClass(config.openLeftSidebarClass);
|
|
465
|
+
sidebarDelay();
|
|
466
|
+
} else {
|
|
467
|
+
body.addClass(config.openLeftSidebarClass + ' ' + config.transitionClass);
|
|
468
|
+
openSidebar = true;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
443
471
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
472
|
+
/*Close sidebar on click outside*/
|
|
473
|
+
$(document).on('mousedown touchstart', function (e) {
|
|
474
|
+
if (
|
|
475
|
+
!$(e.target).closest(leftSidebar).length &&
|
|
476
|
+
!$(e.target).closest(toggleLeftSidebarButton).length &&
|
|
477
|
+
body.hasClass(config.openLeftSidebarClass)
|
|
478
|
+
) {
|
|
479
|
+
body.removeClass(config.openLeftSidebarClass);
|
|
480
|
+
sidebarDelay();
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
452
484
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
485
|
+
// Left sidebar off-canvas
|
|
486
|
+
if (wrapper.hasClass(config.offCanvasLeftSidebarClass)) {
|
|
487
|
+
leftSidebarOffCanvas();
|
|
488
|
+
}
|
|
457
489
|
}
|
|
458
490
|
|
|
459
|
-
function rightSidebarInit(){
|
|
491
|
+
function rightSidebarInit() {
|
|
492
|
+
var rsChatScrollbar = $('.be-scroller-chat', rightSidebar);
|
|
493
|
+
var rsTodoScrollbar = $('.be-scroller-todo', rightSidebar);
|
|
494
|
+
var rsSettingsScrollbar = $('.be-scroller-settings', rightSidebar);
|
|
460
495
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
var rsSettingsScrollbar = $(".be-scroller-settings", rightSidebar);
|
|
464
|
-
|
|
465
|
-
function oSidebar(){
|
|
466
|
-
body.addClass( config.openRightSidebarClass + " " + config.transitionClass );
|
|
496
|
+
function oSidebar() {
|
|
497
|
+
body.addClass(config.openRightSidebarClass + ' ' + config.transitionClass);
|
|
467
498
|
openSidebar = true;
|
|
468
499
|
}
|
|
469
500
|
|
|
470
|
-
function cSidebar(){
|
|
471
|
-
body.removeClass(
|
|
501
|
+
function cSidebar() {
|
|
502
|
+
body.removeClass(config.openRightSidebarClass).addClass(config.transitionClass);
|
|
472
503
|
sidebarDelay();
|
|
473
504
|
}
|
|
474
505
|
|
|
475
|
-
if(
|
|
506
|
+
if (rightSidebar.length > 0) {
|
|
476
507
|
/*Open-Sidebar when click on topbar button*/
|
|
477
|
-
$('.be-toggle-right-sidebar').on(
|
|
478
|
-
if(
|
|
508
|
+
$('.be-toggle-right-sidebar').on('click', function (e) {
|
|
509
|
+
if (openSidebar && body.hasClass(config.openRightSidebarClass)) {
|
|
479
510
|
cSidebar();
|
|
480
|
-
}else if(
|
|
511
|
+
} else if (!openSidebar) {
|
|
481
512
|
oSidebar();
|
|
482
513
|
}
|
|
483
514
|
|
|
@@ -485,32 +516,51 @@ var App = (function () {
|
|
|
485
516
|
});
|
|
486
517
|
|
|
487
518
|
/*Close sidebar on click outside*/
|
|
488
|
-
$(
|
|
489
|
-
if (
|
|
519
|
+
$(document).on('mousedown touchstart', function (e) {
|
|
520
|
+
if (
|
|
521
|
+
!$(e.target).closest(rightSidebar).length &&
|
|
522
|
+
body.hasClass(config.openRightSidebarClass) &&
|
|
523
|
+
(config.closeRsOnClickOutside || $.isSm())
|
|
524
|
+
) {
|
|
490
525
|
cSidebar();
|
|
491
526
|
}
|
|
492
527
|
});
|
|
493
528
|
}
|
|
494
529
|
|
|
495
|
-
if (
|
|
530
|
+
if (
|
|
531
|
+
(typeof ps_chat_scroll === 'undefined' || !ps_chat_scroll || !ps_chat_scroll.nodeName) &&
|
|
532
|
+
rsChatScrollbar.length
|
|
533
|
+
) {
|
|
496
534
|
ps_chat_scroll = initScroller(rsChatScrollbar);
|
|
497
535
|
}
|
|
498
536
|
|
|
499
|
-
if (
|
|
537
|
+
if (
|
|
538
|
+
(typeof ps_todo_scroll === 'undefined' || !ps_todo_scroll || !ps_todo_scroll.nodeName) &&
|
|
539
|
+
rsTodoScrollbar.length
|
|
540
|
+
) {
|
|
500
541
|
ps_todo_scroll = initScroller(rsTodoScrollbar);
|
|
501
542
|
}
|
|
502
543
|
|
|
503
|
-
if (
|
|
544
|
+
if (
|
|
545
|
+
(typeof ps_settings_scroll === 'undefined' ||
|
|
546
|
+
!ps_settings_scroll ||
|
|
547
|
+
!ps_settings_scroll.nodeName) &&
|
|
548
|
+
rsSettingsScrollbar.length
|
|
549
|
+
) {
|
|
504
550
|
ps_settings_scroll = initScroller(rsSettingsScrollbar);
|
|
505
551
|
}
|
|
506
552
|
|
|
507
553
|
/*Update scrollbar height on window resize*/
|
|
508
554
|
$(window).resize(function () {
|
|
509
|
-
waitForFinalEvent(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
555
|
+
waitForFinalEvent(
|
|
556
|
+
function () {
|
|
557
|
+
updateScroller(ps_chat_scroll);
|
|
558
|
+
updateScroller(ps_todo_scroll);
|
|
559
|
+
updateScroller(ps_settings_scroll);
|
|
560
|
+
},
|
|
561
|
+
500,
|
|
562
|
+
'be_rs_update_scroller'
|
|
563
|
+
);
|
|
514
564
|
});
|
|
515
565
|
|
|
516
566
|
/*Update scrollbar when click on a tab*/
|
|
@@ -521,135 +571,147 @@ var App = (function () {
|
|
|
521
571
|
});
|
|
522
572
|
}
|
|
523
573
|
|
|
524
|
-
function sidebarDelay(){
|
|
574
|
+
function sidebarDelay() {
|
|
525
575
|
openSidebar = true;
|
|
526
|
-
setTimeout(function(){
|
|
576
|
+
setTimeout(function () {
|
|
527
577
|
openSidebar = false;
|
|
528
|
-
}, config.openSidebarDelay
|
|
578
|
+
}, config.openSidebarDelay);
|
|
529
579
|
}
|
|
530
580
|
|
|
531
|
-
function sidebarSwipe(){
|
|
581
|
+
function sidebarSwipe() {
|
|
532
582
|
/*Open sidedar on swipe*/
|
|
533
|
-
wrapper.swipe(
|
|
534
|
-
allowPageScroll:
|
|
583
|
+
wrapper.swipe({
|
|
584
|
+
allowPageScroll: 'vertical',
|
|
535
585
|
preventDefaultEvents: false,
|
|
536
586
|
fallbackToMouseEvents: false,
|
|
537
|
-
swipeLeft: function(e){
|
|
538
|
-
if(
|
|
539
|
-
body.addClass(
|
|
587
|
+
swipeLeft: function (e) {
|
|
588
|
+
if (!openSidebar && rightSidebar.length > 0) {
|
|
589
|
+
body.addClass(config.openRightSidebarClass + ' ' + config.transitionClass);
|
|
540
590
|
openSidebar = true;
|
|
541
591
|
}
|
|
542
592
|
},
|
|
543
|
-
threshold: config.swipeTreshold
|
|
593
|
+
threshold: config.swipeTreshold,
|
|
544
594
|
});
|
|
545
595
|
}
|
|
546
596
|
|
|
547
|
-
function chatWidget(){
|
|
548
|
-
var chat = $(
|
|
549
|
-
var contactsEl = $(
|
|
550
|
-
var conversationEl = $(
|
|
551
|
-
var messagesContainer = $(
|
|
552
|
-
var messagesList = $(
|
|
553
|
-
var messagesScroll = $(
|
|
554
|
-
var chatInputContainer = $(
|
|
555
|
-
var chatInput = $(
|
|
556
|
-
var chatInputSendButton = $(
|
|
557
|
-
|
|
558
|
-
function openChatWindow(){
|
|
559
|
-
if(
|
|
560
|
-
chat.addClass(
|
|
561
|
-
if (
|
|
597
|
+
function chatWidget() {
|
|
598
|
+
var chat = $('.be-right-sidebar .tab-chat');
|
|
599
|
+
var contactsEl = $('.chat-contacts', chat);
|
|
600
|
+
var conversationEl = $('.chat-window', chat);
|
|
601
|
+
var messagesContainer = $('.chat-messages', conversationEl);
|
|
602
|
+
var messagesList = $('.content ul', messagesContainer);
|
|
603
|
+
var messagesScroll = $('.be-scroller-messages', messagesContainer);
|
|
604
|
+
var chatInputContainer = $('.chat-input', conversationEl);
|
|
605
|
+
var chatInput = $('input', chatInputContainer);
|
|
606
|
+
var chatInputSendButton = $('.send-msg', chatInputContainer);
|
|
607
|
+
|
|
608
|
+
function openChatWindow() {
|
|
609
|
+
if (!chat.hasClass('chat-opened')) {
|
|
610
|
+
chat.addClass('chat-opened');
|
|
611
|
+
if (
|
|
612
|
+
typeof ps_messages_scroll === 'undefined' ||
|
|
613
|
+
!ps_messages_scroll ||
|
|
614
|
+
!ps_messages_scroll.nodeName
|
|
615
|
+
) {
|
|
562
616
|
ps_messages_scroll = initScroller(messagesScroll);
|
|
563
617
|
}
|
|
564
618
|
}
|
|
565
619
|
}
|
|
566
620
|
|
|
567
|
-
function closeChatWindow(){
|
|
568
|
-
if(
|
|
569
|
-
chat.removeClass(
|
|
621
|
+
function closeChatWindow() {
|
|
622
|
+
if (chat.hasClass('chat-opened')) {
|
|
623
|
+
chat.removeClass('chat-opened');
|
|
570
624
|
}
|
|
571
625
|
}
|
|
572
626
|
|
|
573
627
|
/*Open Conversation Window when click on chat user*/
|
|
574
|
-
$(
|
|
628
|
+
$('.user a', contactsEl).on('click', function (e) {
|
|
575
629
|
openChatWindow();
|
|
576
630
|
e.preventDefault();
|
|
577
631
|
});
|
|
578
632
|
|
|
579
633
|
/*Close chat conv window*/
|
|
580
|
-
$(
|
|
634
|
+
$('.title .return', conversationEl).on('click', function (e) {
|
|
581
635
|
closeChatWindow();
|
|
582
636
|
scrollerInit();
|
|
583
637
|
});
|
|
584
638
|
|
|
585
639
|
/*Send message*/
|
|
586
|
-
function sendMsg(msg, self){
|
|
587
|
-
var $message = $('<li class="' + (
|
|
640
|
+
function sendMsg(msg, self) {
|
|
641
|
+
var $message = $('<li class="' + (self ? 'self' : 'friend') + '"></li>');
|
|
588
642
|
|
|
589
|
-
if(
|
|
643
|
+
if (msg != '') {
|
|
590
644
|
$('<div class="msg">' + msg + '</div>').appendTo($message);
|
|
591
645
|
$message.appendTo(messagesList);
|
|
592
646
|
|
|
593
|
-
messagesScroll.stop().animate(
|
|
594
|
-
|
|
595
|
-
|
|
647
|
+
messagesScroll.stop().animate(
|
|
648
|
+
{
|
|
649
|
+
scrollTop: messagesScroll.prop('scrollHeight'),
|
|
650
|
+
},
|
|
651
|
+
900,
|
|
652
|
+
'swing'
|
|
653
|
+
);
|
|
596
654
|
|
|
597
655
|
updateScroller(ps_messages_scroll);
|
|
598
656
|
}
|
|
599
657
|
}
|
|
600
658
|
|
|
601
659
|
/*Send msg when click on 'send' button or press 'Enter'*/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
if(keycode == '13'){
|
|
607
|
-
sendMsg(msg, true);
|
|
608
|
-
$(this).val("");
|
|
609
|
-
}
|
|
610
|
-
event.stopPropagation();
|
|
611
|
-
});
|
|
660
|
+
chatInput.keypress(function (event) {
|
|
661
|
+
var keycode = event.keyCode ? event.keyCode : event.which;
|
|
662
|
+
var msg = $(this).val();
|
|
612
663
|
|
|
613
|
-
|
|
614
|
-
var msg = chatInput.val();
|
|
664
|
+
if (keycode == '13') {
|
|
615
665
|
sendMsg(msg, true);
|
|
616
|
-
|
|
617
|
-
}
|
|
666
|
+
$(this).val('');
|
|
667
|
+
}
|
|
668
|
+
event.stopPropagation();
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
chatInputSendButton.on('click', function () {
|
|
672
|
+
var msg = chatInput.val();
|
|
673
|
+
sendMsg(msg, true);
|
|
674
|
+
chatInput.val('');
|
|
675
|
+
});
|
|
618
676
|
}
|
|
619
677
|
|
|
620
|
-
function scrollerInit(){
|
|
621
|
-
if (
|
|
678
|
+
function scrollerInit() {
|
|
679
|
+
if (
|
|
680
|
+
typeof ps_be_scroller_notifications === 'undefined' ||
|
|
681
|
+
!ps_be_scroller_notifications ||
|
|
682
|
+
!ps_be_scroller_notifications.nodeName
|
|
683
|
+
) {
|
|
622
684
|
ps_be_scroller_notifications = initScroller(notificationsDiv);
|
|
623
685
|
}
|
|
624
686
|
}
|
|
625
687
|
|
|
626
|
-
function scrollTopButton(){
|
|
688
|
+
function scrollTopButton() {
|
|
627
689
|
var offset = 220;
|
|
628
690
|
var duration = 500;
|
|
629
691
|
var button = $('<div class="be-scroll-top"></div>');
|
|
630
|
-
button.appendTo(
|
|
692
|
+
button.appendTo('body');
|
|
631
693
|
|
|
632
|
-
$(window).on('scroll',function() {
|
|
633
|
-
if (
|
|
694
|
+
$(window).on('scroll', function () {
|
|
695
|
+
if ($(this).scrollTop() > offset) {
|
|
634
696
|
button.fadeIn(duration);
|
|
635
697
|
} else {
|
|
636
698
|
button.fadeOut(duration);
|
|
637
699
|
}
|
|
638
700
|
});
|
|
639
701
|
|
|
640
|
-
button.on('touchstart mouseup',function(
|
|
641
|
-
$(
|
|
702
|
+
button.on('touchstart mouseup', function (e) {
|
|
703
|
+
$('html, body').animate({scrollTop: 0}, duration);
|
|
642
704
|
e.preventDefault();
|
|
643
705
|
});
|
|
644
706
|
}
|
|
645
707
|
|
|
646
708
|
//Add and remove active class on left sidebar
|
|
647
|
-
function activeItemLeftSidebar(menu_item){
|
|
709
|
+
function activeItemLeftSidebar(menu_item) {
|
|
648
710
|
var firstAnchor = menu_item;
|
|
649
711
|
var li = $(firstAnchor).parent();
|
|
650
712
|
var menu = $(li).parents('li');
|
|
651
713
|
|
|
652
|
-
if(
|
|
714
|
+
if (!li.hasClass('active')) {
|
|
653
715
|
$('li.active', leftSidebar).removeClass('active');
|
|
654
716
|
$(menu).addClass('active');
|
|
655
717
|
$(li).addClass('active');
|
|
@@ -660,13 +722,17 @@ var App = (function () {
|
|
|
660
722
|
var pas = asideDiv;
|
|
661
723
|
ps_aside_scroll = initScroller(asideDiv);
|
|
662
724
|
$(window).resize(function () {
|
|
663
|
-
if(
|
|
725
|
+
if ($.isSm() && !wrapper.hasClass(config.offCanvasLeftSidebarClass)) {
|
|
664
726
|
destroyScroller(ps_aside_scroll);
|
|
665
727
|
} else {
|
|
666
|
-
if(
|
|
728
|
+
if (pas.hasClass('ps')) {
|
|
667
729
|
updateScroller(ps_aside_scroll);
|
|
668
730
|
} else {
|
|
669
|
-
if (
|
|
731
|
+
if (
|
|
732
|
+
typeof ps_aside_scroll === 'undefined' ||
|
|
733
|
+
!ps_aside_scroll ||
|
|
734
|
+
!ps_aside_scroll.nodeName
|
|
735
|
+
) {
|
|
670
736
|
ps_aside_scroll = initScroller(asideDiv);
|
|
671
737
|
}
|
|
672
738
|
}
|
|
@@ -679,10 +745,10 @@ var App = (function () {
|
|
|
679
745
|
var timers = {};
|
|
680
746
|
return function (callback, ms, uniqueId) {
|
|
681
747
|
if (!uniqueId) {
|
|
682
|
-
uniqueId =
|
|
748
|
+
uniqueId = 'x1x2x3x4';
|
|
683
749
|
}
|
|
684
750
|
if (timers[uniqueId]) {
|
|
685
|
-
clearTimeout
|
|
751
|
+
clearTimeout(timers[uniqueId]);
|
|
686
752
|
}
|
|
687
753
|
timers[uniqueId] = setTimeout(callback, ms);
|
|
688
754
|
};
|
|
@@ -696,77 +762,76 @@ var App = (function () {
|
|
|
696
762
|
|
|
697
763
|
//Init function
|
|
698
764
|
init: function (options) {
|
|
699
|
-
|
|
700
765
|
//Get the main elements when document is ready
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
766
|
+
body = $('body');
|
|
767
|
+
wrapper = $('.be-wrapper');
|
|
768
|
+
topNavbar = $('.be-top-header', wrapper);
|
|
769
|
+
leftSidebar = $('.be-left-sidebar', wrapper);
|
|
770
|
+
rightSidebar = $('.be-right-sidebar', wrapper);
|
|
771
|
+
asideDiv = $('.be-scroller-aside', wrapper);
|
|
772
|
+
toggleLeftSidebarButton = $('.be-toggle-left-sidebar', topNavbar);
|
|
773
|
+
notificationsDiv = $('.be-scroller-notifications', topNavbar);
|
|
774
|
+
openSidebar = false;
|
|
710
775
|
|
|
711
776
|
//Extends basic config with options
|
|
712
|
-
|
|
777
|
+
$.extend(config, options);
|
|
713
778
|
|
|
714
779
|
/*FastClick on mobile*/
|
|
715
|
-
|
|
780
|
+
FastClick.attach(document.body);
|
|
716
781
|
|
|
717
782
|
/*Left Sidebar*/
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
783
|
+
if (config.enableLeftSidebar) {
|
|
784
|
+
leftSidebarInit();
|
|
785
|
+
} else {
|
|
786
|
+
wrapper.addClass(config.disabledLeftSidebarClass);
|
|
787
|
+
}
|
|
723
788
|
|
|
724
789
|
/*Right Sidebar*/
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
790
|
+
if (rightSidebar.length) {
|
|
791
|
+
rightSidebarInit();
|
|
792
|
+
chatWidget();
|
|
793
|
+
}
|
|
729
794
|
|
|
730
795
|
/*Sidebars Swipe*/
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
796
|
+
if (config.enableSwipe) {
|
|
797
|
+
sidebarSwipe();
|
|
798
|
+
}
|
|
734
799
|
|
|
735
800
|
/*Scroll Top button*/
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
801
|
+
if (config.scrollTop) {
|
|
802
|
+
scrollTopButton();
|
|
803
|
+
}
|
|
739
804
|
|
|
740
805
|
/*Page Aside*/
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
806
|
+
if (asideDiv.length) {
|
|
807
|
+
initAsidePS();
|
|
808
|
+
}
|
|
744
809
|
|
|
745
810
|
/*Scroller plugin init*/
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
811
|
+
if (notificationsDiv.length) {
|
|
812
|
+
scrollerInit();
|
|
813
|
+
}
|
|
749
814
|
|
|
750
815
|
/*Get colors*/
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
816
|
+
colors.primary = getColor('clr-primary');
|
|
817
|
+
colors.success = getColor('clr-success');
|
|
818
|
+
colors.warning = getColor('clr-warning');
|
|
819
|
+
colors.danger = getColor('clr-danger');
|
|
820
|
+
colors.grey = getColor('clr-grey');
|
|
756
821
|
|
|
757
822
|
/*Get scrollers*/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
823
|
+
scrollers.be_scroller_notifications = ps_be_scroller_notifications;
|
|
824
|
+
scrollers.left_sidebar_scroll = ps_left_sidebar;
|
|
825
|
+
scrollers.be_left_sidebar_scroll = ps_be_scroller_left_sidebar;
|
|
826
|
+
scrollers.sub_menu_scroll = ps_sub_menu_scroller;
|
|
827
|
+
scrollers.chat_scroll = ps_chat_scroll;
|
|
828
|
+
scrollers.todo_scroll = ps_todo_scroll;
|
|
829
|
+
scrollers.settings_scroll = ps_settings_scroll;
|
|
830
|
+
scrollers.messages_scroll = ps_messages_scroll;
|
|
831
|
+
scrollers.aside_scroll = ps_aside_scroll;
|
|
832
|
+
scrollers.updateScroller = updateScroller;
|
|
833
|
+
scrollers.destroyScroller = destroyScroller;
|
|
834
|
+
scrollers.initScroller = initScroller;
|
|
770
835
|
|
|
771
836
|
/*Bind plugins on hidden elements*/
|
|
772
837
|
/*Dropdown shown event*/
|
|
@@ -775,45 +840,417 @@ var App = (function () {
|
|
|
775
840
|
});
|
|
776
841
|
|
|
777
842
|
/*Tooltips*/
|
|
778
|
-
|
|
843
|
+
$('[data-toggle="tooltip"]').tooltip();
|
|
779
844
|
|
|
780
845
|
/*Popover*/
|
|
781
|
-
|
|
846
|
+
$('[data-toggle="popover"]').popover();
|
|
782
847
|
|
|
783
848
|
/*Bootstrap modal scroll top fix*/
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
849
|
+
$('.modal').on('show.bs.modal', function () {
|
|
850
|
+
$('html').addClass('be-modal-open');
|
|
851
|
+
});
|
|
787
852
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
853
|
+
$('.modal').on('hidden.bs.modal', function () {
|
|
854
|
+
$('html').removeClass('be-modal-open');
|
|
855
|
+
});
|
|
791
856
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
}
|
|
857
|
+
/*Fixes the Sweetalert gap in the top header on boxed layout*/
|
|
858
|
+
if (typeof Swal == 'function' && wrapper.hasClass('be-boxed-layout')) {
|
|
859
|
+
var observer = new MutationObserver(function (mutationsList, observer) {
|
|
860
|
+
mutationsList.forEach(function (mutation) {
|
|
861
|
+
if (mutation.type == 'attributes' && mutation.attributeName == 'style') {
|
|
862
|
+
if (document.body.className.indexOf('swal2-shown') > 0) {
|
|
863
|
+
topNavbar.css({marginLeft: 'calc(-' + document.body.style.paddingRight + ' / 2)'});
|
|
864
|
+
} else {
|
|
865
|
+
topNavbar.css({marginLeft: '0'});
|
|
802
866
|
}
|
|
803
|
-
}
|
|
867
|
+
}
|
|
804
868
|
});
|
|
869
|
+
});
|
|
805
870
|
|
|
806
|
-
|
|
807
|
-
|
|
871
|
+
observer.observe(document.body, {attributes: true});
|
|
872
|
+
}
|
|
808
873
|
},
|
|
809
874
|
|
|
810
875
|
//Methods
|
|
811
|
-
activeItemLeftSidebar: activeItemLeftSidebar
|
|
876
|
+
activeItemLeftSidebar: activeItemLeftSidebar,
|
|
812
877
|
};
|
|
813
|
-
|
|
814
878
|
})();
|
|
815
879
|
|
|
816
|
-
function FastClick(o,
|
|
880
|
+
function FastClick(o, e) {
|
|
881
|
+
'use strict';
|
|
882
|
+
var t;
|
|
883
|
+
if (
|
|
884
|
+
((e = e || {}),
|
|
885
|
+
(this.trackingClick = !1),
|
|
886
|
+
(this.trackingClickStart = 0),
|
|
887
|
+
(this.targetElement = null),
|
|
888
|
+
(this.touchStartX = 0),
|
|
889
|
+
(this.touchStartY = 0),
|
|
890
|
+
(this.lastTouchIdentifier = 0),
|
|
891
|
+
(this.touchBoundary = e.touchBoundary || 10),
|
|
892
|
+
(this.layer = o),
|
|
893
|
+
(this.tapDelay = e.tapDelay || 200),
|
|
894
|
+
!FastClick.notNeeded(o))
|
|
895
|
+
) {
|
|
896
|
+
for (
|
|
897
|
+
var n = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'],
|
|
898
|
+
i = this,
|
|
899
|
+
r = 0,
|
|
900
|
+
s = n.length;
|
|
901
|
+
r < s;
|
|
902
|
+
r++
|
|
903
|
+
)
|
|
904
|
+
i[n[r]] = c(i[n[r]], i);
|
|
905
|
+
deviceIsAndroid &&
|
|
906
|
+
(o.addEventListener('mouseover', this.onMouse, !0),
|
|
907
|
+
o.addEventListener('mousedown', this.onMouse, !0),
|
|
908
|
+
o.addEventListener('mouseup', this.onMouse, !0)),
|
|
909
|
+
o.addEventListener('click', this.onClick, !0),
|
|
910
|
+
o.addEventListener('touchstart', this.onTouchStart, !1),
|
|
911
|
+
o.addEventListener('touchmove', this.onTouchMove, !1),
|
|
912
|
+
o.addEventListener('touchend', this.onTouchEnd, !1),
|
|
913
|
+
o.addEventListener('touchcancel', this.onTouchCancel, !1),
|
|
914
|
+
Event.prototype.stopImmediatePropagation ||
|
|
915
|
+
((o.removeEventListener = function (e, t, n) {
|
|
916
|
+
var i = Node.prototype.removeEventListener;
|
|
917
|
+
'click' === e ? i.call(o, e, t.hijacked || t, n) : i.call(o, e, t, n);
|
|
918
|
+
}),
|
|
919
|
+
(o.addEventListener = function (e, t, n) {
|
|
920
|
+
var i = Node.prototype.addEventListener;
|
|
921
|
+
'click' === e
|
|
922
|
+
? i.call(
|
|
923
|
+
o,
|
|
924
|
+
e,
|
|
925
|
+
t.hijacked ||
|
|
926
|
+
(t.hijacked = function (e) {
|
|
927
|
+
e.propagationStopped || t(e);
|
|
928
|
+
}),
|
|
929
|
+
n
|
|
930
|
+
)
|
|
931
|
+
: i.call(o, e, t, n);
|
|
932
|
+
})),
|
|
933
|
+
'function' == typeof o.onclick &&
|
|
934
|
+
((t = o.onclick),
|
|
935
|
+
o.addEventListener(
|
|
936
|
+
'click',
|
|
937
|
+
function (e) {
|
|
938
|
+
t(e);
|
|
939
|
+
},
|
|
940
|
+
!1
|
|
941
|
+
),
|
|
942
|
+
(o.onclick = null));
|
|
943
|
+
}
|
|
944
|
+
function c(e, t) {
|
|
945
|
+
return function () {
|
|
946
|
+
return e.apply(t, arguments);
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
var deviceIsAndroid = 0 < navigator.userAgent.indexOf('Android'),
|
|
951
|
+
deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent),
|
|
952
|
+
deviceIsIOS4 = deviceIsIOS && /OS 4_\d(_\d)?/.test(navigator.userAgent),
|
|
953
|
+
deviceIsIOSWithBadTarget = deviceIsIOS && /OS ([6-9]|\d{2})_\d/.test(navigator.userAgent),
|
|
954
|
+
deviceIsBlackBerry10 = 0 < navigator.userAgent.indexOf('BB10');
|
|
955
|
+
(FastClick.prototype.needsClick = function (e) {
|
|
956
|
+
'use strict';
|
|
957
|
+
switch (e.nodeName.toLowerCase()) {
|
|
958
|
+
case 'button':
|
|
959
|
+
case 'select':
|
|
960
|
+
case 'textarea':
|
|
961
|
+
if (e.disabled) return !0;
|
|
962
|
+
break;
|
|
963
|
+
case 'input':
|
|
964
|
+
if ((deviceIsIOS && 'file' === e.type) || e.disabled) return !0;
|
|
965
|
+
break;
|
|
966
|
+
case 'label':
|
|
967
|
+
case 'video':
|
|
968
|
+
return !0;
|
|
969
|
+
}
|
|
970
|
+
return /\bneedsclick\b/.test(e.className);
|
|
971
|
+
}),
|
|
972
|
+
(FastClick.prototype.needsFocus = function (e) {
|
|
973
|
+
'use strict';
|
|
974
|
+
switch (e.nodeName.toLowerCase()) {
|
|
975
|
+
case 'textarea':
|
|
976
|
+
return !0;
|
|
977
|
+
case 'select':
|
|
978
|
+
return !deviceIsAndroid;
|
|
979
|
+
case 'input':
|
|
980
|
+
switch (e.type) {
|
|
981
|
+
case 'button':
|
|
982
|
+
case 'checkbox':
|
|
983
|
+
case 'file':
|
|
984
|
+
case 'image':
|
|
985
|
+
case 'radio':
|
|
986
|
+
case 'submit':
|
|
987
|
+
return !1;
|
|
988
|
+
}
|
|
989
|
+
return !e.disabled && !e.readOnly;
|
|
990
|
+
default:
|
|
991
|
+
return /\bneedsfocus\b/.test(e.className);
|
|
992
|
+
}
|
|
993
|
+
}),
|
|
994
|
+
(FastClick.prototype.sendClick = function (e, t) {
|
|
995
|
+
'use strict';
|
|
996
|
+
var n, i, o, r;
|
|
997
|
+
document.activeElement && document.activeElement !== e && document.activeElement.blur(),
|
|
998
|
+
(r = t.changedTouches[0]),
|
|
999
|
+
(o = document.createEvent('MouseEvents')).initMouseEvent(
|
|
1000
|
+
'mousedown',
|
|
1001
|
+
!0,
|
|
1002
|
+
!0,
|
|
1003
|
+
window,
|
|
1004
|
+
1,
|
|
1005
|
+
r.screenX,
|
|
1006
|
+
r.screenY,
|
|
1007
|
+
r.clientX,
|
|
1008
|
+
r.clientY,
|
|
1009
|
+
!1,
|
|
1010
|
+
!1,
|
|
1011
|
+
!1,
|
|
1012
|
+
!1,
|
|
1013
|
+
0,
|
|
1014
|
+
null
|
|
1015
|
+
),
|
|
1016
|
+
(o.forwardedTouchEvent = !0),
|
|
1017
|
+
e.dispatchEvent(o),
|
|
1018
|
+
(i = document.createEvent('MouseEvents')).initMouseEvent(
|
|
1019
|
+
'mouseup',
|
|
1020
|
+
!0,
|
|
1021
|
+
!0,
|
|
1022
|
+
window,
|
|
1023
|
+
1,
|
|
1024
|
+
r.screenX,
|
|
1025
|
+
r.screenY,
|
|
1026
|
+
r.clientX,
|
|
1027
|
+
r.clientY,
|
|
1028
|
+
!1,
|
|
1029
|
+
!1,
|
|
1030
|
+
!1,
|
|
1031
|
+
!1,
|
|
1032
|
+
0,
|
|
1033
|
+
null
|
|
1034
|
+
),
|
|
1035
|
+
(i.forwardedTouchEvent = !0),
|
|
1036
|
+
e.dispatchEvent(i),
|
|
1037
|
+
(n = document.createEvent('MouseEvents')).initMouseEvent(
|
|
1038
|
+
this.determineEventType(e),
|
|
1039
|
+
!0,
|
|
1040
|
+
!0,
|
|
1041
|
+
window,
|
|
1042
|
+
1,
|
|
1043
|
+
r.screenX,
|
|
1044
|
+
r.screenY,
|
|
1045
|
+
r.clientX,
|
|
1046
|
+
r.clientY,
|
|
1047
|
+
!1,
|
|
1048
|
+
!1,
|
|
1049
|
+
!1,
|
|
1050
|
+
!1,
|
|
1051
|
+
0,
|
|
1052
|
+
null
|
|
1053
|
+
),
|
|
1054
|
+
(n.forwardedTouchEvent = !0),
|
|
1055
|
+
e.dispatchEvent(n);
|
|
1056
|
+
}),
|
|
1057
|
+
(FastClick.prototype.determineEventType = function (e) {
|
|
1058
|
+
'use strict';
|
|
1059
|
+
return deviceIsAndroid && 'select' === e.tagName.toLowerCase() ? 'mousedown' : 'click';
|
|
1060
|
+
}),
|
|
1061
|
+
(FastClick.prototype.focus = function (e) {
|
|
1062
|
+
'use strict';
|
|
1063
|
+
var t;
|
|
1064
|
+
deviceIsIOS && e.setSelectionRange && 0 !== e.type.indexOf('date') && 'time' !== e.type
|
|
1065
|
+
? ((t = e.value.length), e.setSelectionRange(t, t))
|
|
1066
|
+
: e.focus();
|
|
1067
|
+
}),
|
|
1068
|
+
(FastClick.prototype.updateScrollParent = function (e) {
|
|
1069
|
+
'use strict';
|
|
1070
|
+
var t, n;
|
|
1071
|
+
if (!(t = e.fastClickScrollParent) || !t.contains(e)) {
|
|
1072
|
+
n = e;
|
|
1073
|
+
do {
|
|
1074
|
+
if (n.scrollHeight > n.offsetHeight) {
|
|
1075
|
+
(t = n), (e.fastClickScrollParent = n);
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
n = n.parentElement;
|
|
1079
|
+
} while (n);
|
|
1080
|
+
}
|
|
1081
|
+
t && (t.fastClickLastScrollTop = t.scrollTop);
|
|
1082
|
+
}),
|
|
1083
|
+
(FastClick.prototype.getTargetElementFromEventTarget = function (e) {
|
|
1084
|
+
'use strict';
|
|
1085
|
+
return e.nodeType === Node.TEXT_NODE ? e.parentNode : e;
|
|
1086
|
+
}),
|
|
1087
|
+
(FastClick.prototype.onTouchStart = function (e) {
|
|
1088
|
+
'use strict';
|
|
1089
|
+
var t, n, i;
|
|
1090
|
+
if (1 < e.targetTouches.length) return !0;
|
|
1091
|
+
if (
|
|
1092
|
+
((t = this.getTargetElementFromEventTarget(e.target)), (n = e.targetTouches[0]), deviceIsIOS)
|
|
1093
|
+
) {
|
|
1094
|
+
if ((i = window.getSelection()).rangeCount && !i.isCollapsed) return !0;
|
|
1095
|
+
if (!deviceIsIOS4) {
|
|
1096
|
+
if (n.identifier && n.identifier === this.lastTouchIdentifier)
|
|
1097
|
+
return e.preventDefault(), !1;
|
|
1098
|
+
(this.lastTouchIdentifier = n.identifier), this.updateScrollParent(t);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
return (
|
|
1102
|
+
(this.trackingClick = !0),
|
|
1103
|
+
(this.trackingClickStart = e.timeStamp),
|
|
1104
|
+
(this.targetElement = t),
|
|
1105
|
+
(this.touchStartX = n.pageX),
|
|
1106
|
+
(this.touchStartY = n.pageY),
|
|
1107
|
+
e.timeStamp - this.lastClickTime < this.tapDelay && e.preventDefault(),
|
|
1108
|
+
!0
|
|
1109
|
+
);
|
|
1110
|
+
}),
|
|
1111
|
+
(FastClick.prototype.touchHasMoved = function (e) {
|
|
1112
|
+
'use strict';
|
|
1113
|
+
var t = e.changedTouches[0],
|
|
1114
|
+
n = this.touchBoundary;
|
|
1115
|
+
return Math.abs(t.pageX - this.touchStartX) > n || Math.abs(t.pageY - this.touchStartY) > n;
|
|
1116
|
+
}),
|
|
1117
|
+
(FastClick.prototype.onTouchMove = function (e) {
|
|
1118
|
+
'use strict';
|
|
1119
|
+
return (
|
|
1120
|
+
this.trackingClick &&
|
|
1121
|
+
((this.targetElement === this.getTargetElementFromEventTarget(e.target) &&
|
|
1122
|
+
!this.touchHasMoved(e)) ||
|
|
1123
|
+
((this.trackingClick = !1), (this.targetElement = null))),
|
|
1124
|
+
!0
|
|
1125
|
+
);
|
|
1126
|
+
}),
|
|
1127
|
+
(FastClick.prototype.findControl = function (e) {
|
|
1128
|
+
'use strict';
|
|
1129
|
+
return void 0 !== e.control
|
|
1130
|
+
? e.control
|
|
1131
|
+
: e.htmlFor
|
|
1132
|
+
? document.getElementById(e.htmlFor)
|
|
1133
|
+
: e.querySelector(
|
|
1134
|
+
'button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea'
|
|
1135
|
+
);
|
|
1136
|
+
}),
|
|
1137
|
+
(FastClick.prototype.onTouchEnd = function (e) {
|
|
1138
|
+
'use strict';
|
|
1139
|
+
var t,
|
|
1140
|
+
n,
|
|
1141
|
+
i,
|
|
1142
|
+
o,
|
|
1143
|
+
r,
|
|
1144
|
+
s = this.targetElement;
|
|
1145
|
+
if (!this.trackingClick) return !0;
|
|
1146
|
+
if (e.timeStamp - this.lastClickTime < this.tapDelay) return (this.cancelNextClick = !0);
|
|
1147
|
+
if (
|
|
1148
|
+
((this.cancelNextClick = !1),
|
|
1149
|
+
(this.lastClickTime = e.timeStamp),
|
|
1150
|
+
(n = this.trackingClickStart),
|
|
1151
|
+
(this.trackingClick = !1),
|
|
1152
|
+
(this.trackingClickStart = 0),
|
|
1153
|
+
deviceIsIOSWithBadTarget &&
|
|
1154
|
+
((r = e.changedTouches[0]),
|
|
1155
|
+
((s =
|
|
1156
|
+
document.elementFromPoint(r.pageX - window.pageXOffset, r.pageY - window.pageYOffset) ||
|
|
1157
|
+
s).fastClickScrollParent = this.targetElement.fastClickScrollParent)),
|
|
1158
|
+
'label' === (i = s.tagName.toLowerCase()))
|
|
1159
|
+
) {
|
|
1160
|
+
if ((t = this.findControl(s))) {
|
|
1161
|
+
if ((this.focus(s), deviceIsAndroid)) return !1;
|
|
1162
|
+
s = t;
|
|
1163
|
+
}
|
|
1164
|
+
} else if (this.needsFocus(s))
|
|
1165
|
+
return (
|
|
1166
|
+
100 < e.timeStamp - n || (deviceIsIOS && window.top !== window && 'input' === i)
|
|
1167
|
+
? (this.targetElement = null)
|
|
1168
|
+
: (this.focus(s),
|
|
1169
|
+
this.sendClick(s, e),
|
|
1170
|
+
(deviceIsIOS && 'select' === i) || ((this.targetElement = null), e.preventDefault())),
|
|
1171
|
+
!1
|
|
1172
|
+
);
|
|
1173
|
+
return (
|
|
1174
|
+
!(
|
|
1175
|
+
!deviceIsIOS ||
|
|
1176
|
+
deviceIsIOS4 ||
|
|
1177
|
+
!(o = s.fastClickScrollParent) ||
|
|
1178
|
+
o.fastClickLastScrollTop === o.scrollTop
|
|
1179
|
+
) || (this.needsClick(s) || (e.preventDefault(), this.sendClick(s, e)), !1)
|
|
1180
|
+
);
|
|
1181
|
+
}),
|
|
1182
|
+
(FastClick.prototype.onTouchCancel = function () {
|
|
1183
|
+
'use strict';
|
|
1184
|
+
(this.trackingClick = !1), (this.targetElement = null);
|
|
1185
|
+
}),
|
|
1186
|
+
(FastClick.prototype.onMouse = function (e) {
|
|
1187
|
+
'use strict';
|
|
1188
|
+
return (
|
|
1189
|
+
!this.targetElement ||
|
|
1190
|
+
!!e.forwardedTouchEvent ||
|
|
1191
|
+
!e.cancelable ||
|
|
1192
|
+
!(!this.needsClick(this.targetElement) || this.cancelNextClick) ||
|
|
1193
|
+
(e.stopImmediatePropagation ? e.stopImmediatePropagation() : (e.propagationStopped = !0),
|
|
1194
|
+
e.stopPropagation(),
|
|
1195
|
+
e.preventDefault(),
|
|
1196
|
+
!1)
|
|
1197
|
+
);
|
|
1198
|
+
}),
|
|
1199
|
+
(FastClick.prototype.onClick = function (e) {
|
|
1200
|
+
'use strict';
|
|
1201
|
+
var t;
|
|
1202
|
+
return this.trackingClick
|
|
1203
|
+
? ((this.targetElement = null), !(this.trackingClick = !1))
|
|
1204
|
+
: ('submit' === e.target.type && 0 === e.detail) ||
|
|
1205
|
+
((t = this.onMouse(e)) || (this.targetElement = null), t);
|
|
1206
|
+
}),
|
|
1207
|
+
(FastClick.prototype.destroy = function () {
|
|
1208
|
+
'use strict';
|
|
1209
|
+
var e = this.layer;
|
|
1210
|
+
deviceIsAndroid &&
|
|
1211
|
+
(e.removeEventListener('mouseover', this.onMouse, !0),
|
|
1212
|
+
e.removeEventListener('mousedown', this.onMouse, !0),
|
|
1213
|
+
e.removeEventListener('mouseup', this.onMouse, !0)),
|
|
1214
|
+
e.removeEventListener('click', this.onClick, !0),
|
|
1215
|
+
e.removeEventListener('touchstart', this.onTouchStart, !1),
|
|
1216
|
+
e.removeEventListener('touchmove', this.onTouchMove, !1),
|
|
1217
|
+
e.removeEventListener('touchend', this.onTouchEnd, !1),
|
|
1218
|
+
e.removeEventListener('touchcancel', this.onTouchCancel, !1);
|
|
1219
|
+
}),
|
|
1220
|
+
(FastClick.notNeeded = function (e) {
|
|
1221
|
+
'use strict';
|
|
1222
|
+
var t, n, i;
|
|
1223
|
+
if (void 0 === window.ontouchstart) return !0;
|
|
1224
|
+
if ((n = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1])) {
|
|
1225
|
+
if (!deviceIsAndroid) return !0;
|
|
1226
|
+
if ((t = document.querySelector('meta[name=viewport]'))) {
|
|
1227
|
+
if (-1 !== t.content.indexOf('user-scalable=no')) return !0;
|
|
1228
|
+
if (31 < n && document.documentElement.scrollWidth <= window.outerWidth) return !0;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
if (
|
|
1232
|
+
deviceIsBlackBerry10 &&
|
|
1233
|
+
10 <= (i = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/))[1] &&
|
|
1234
|
+
3 <= i[2] &&
|
|
1235
|
+
(t = document.querySelector('meta[name=viewport]'))
|
|
1236
|
+
) {
|
|
1237
|
+
if (-1 !== t.content.indexOf('user-scalable=no')) return !0;
|
|
1238
|
+
if (document.documentElement.scrollWidth <= window.outerWidth) return !0;
|
|
1239
|
+
}
|
|
1240
|
+
return 'none' === e.style.msTouchAction;
|
|
1241
|
+
}),
|
|
1242
|
+
(FastClick.attach = function (e, t) {
|
|
1243
|
+
'use strict';
|
|
1244
|
+
return new FastClick(e, t);
|
|
1245
|
+
}),
|
|
1246
|
+
'function' == typeof define && 'object' == typeof define.amd && define.amd
|
|
1247
|
+
? define(function () {
|
|
1248
|
+
'use strict';
|
|
1249
|
+
return FastClick;
|
|
1250
|
+
})
|
|
1251
|
+
: 'undefined' != typeof module && module.exports
|
|
1252
|
+
? ((module.exports = FastClick.attach), (module.exports.FastClick = FastClick))
|
|
1253
|
+
: (window.FastClick = FastClick);
|
|
817
1254
|
/*!
|
|
818
1255
|
* @fileOverview TouchSwipe - jQuery Plugin
|
|
819
1256
|
* @version 1.6.18
|
|
@@ -827,9 +1264,1783 @@ function FastClick(o,e){"use strict";var t;if(e=e||{},this.trackingClick=!1,this
|
|
|
827
1264
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
828
1265
|
*
|
|
829
1266
|
*/
|
|
830
|
-
!function(factory){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],factory):factory("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function($){"use strict";function init(options){return!options||void 0!==options.allowPageScroll||void 0===options.swipe&&void 0===options.swipeStatus||(options.allowPageScroll=NONE),void 0!==options.click&&void 0===options.tap&&(options.tap=options.click),options||(options={}),options=$.extend({},$.fn.swipe.defaults,options),this.each(function(){var $this=$(this),plugin=$this.data(PLUGIN_NS);plugin||(plugin=new TouchSwipe(this,options),$this.data(PLUGIN_NS,plugin))})}function TouchSwipe(element,options){function touchStart(jqEvent){if(!(getTouchInProgress()||$(jqEvent.target).closest(options.excludedElements,$element).length>0)){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(!event.pointerType||"mouse"!=event.pointerType||0!=options.fallbackToMouseEvents){var ret,touches=event.touches,evt=touches?touches[0]:event;return phase=PHASE_START,touches?fingerCount=touches.length:options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),distance=0,direction=null,currentDirection=null,pinchDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,maximumsMap=createMaximumsData(),cancelMultiFingerRelease(),createFingerData(0,evt),!touches||fingerCount===options.fingers||options.fingers===ALL_FINGERS||hasPinches()?(startTime=getTimeStamp(),2==fingerCount&&(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)),(options.swipeStatus||options.pinchStatus)&&(ret=triggerHandler(event,phase))):ret=!1,ret===!1?(phase=PHASE_CANCEL,triggerHandler(event,phase),ret):(options.hold&&(holdTimeout=setTimeout($.proxy(function(){$element.trigger("hold",[event.target]),options.hold&&(ret=options.hold.call($element,event,event.target))},this),options.longTapThreshold)),setTouchInProgress(!0),null)}}}function touchMove(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(phase!==PHASE_END&&phase!==PHASE_CANCEL&&!inMultiFingerRelease()){var ret,touches=event.touches,evt=touches?touches[0]:event,currentFinger=updateFingerData(evt);if(endTime=getTimeStamp(),touches&&(fingerCount=touches.length),options.hold&&clearTimeout(holdTimeout),phase=PHASE_MOVE,2==fingerCount&&(0==startTouchesDistance?(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)):(updateFingerData(touches[1]),endTouchesDistance=calculateTouchesDistance(fingerData[0].end,fingerData[1].end),pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)),pinchZoom=calculatePinchZoom(startTouchesDistance,endTouchesDistance),pinchDistance=Math.abs(startTouchesDistance-endTouchesDistance)),fingerCount===options.fingers||options.fingers===ALL_FINGERS||!touches||hasPinches()){if(direction=calculateDirection(currentFinger.start,currentFinger.end),currentDirection=calculateDirection(currentFinger.last,currentFinger.end),validateDefaultEvent(jqEvent,currentDirection),distance=calculateDistance(currentFinger.start,currentFinger.end),duration=calculateDuration(),setMaxDistance(direction,distance),ret=triggerHandler(event,phase),!options.triggerOnTouchEnd||options.triggerOnTouchLeave){var inBounds=!0;if(options.triggerOnTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}!options.triggerOnTouchEnd&&inBounds?phase=getNextPhase(PHASE_MOVE):options.triggerOnTouchLeave&&!inBounds&&(phase=getNextPhase(PHASE_END)),phase!=PHASE_CANCEL&&phase!=PHASE_END||triggerHandler(event,phase)}}else phase=PHASE_CANCEL,triggerHandler(event,phase);ret===!1&&(phase=PHASE_CANCEL,triggerHandler(event,phase))}}function touchEnd(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent,touches=event.touches;if(touches){if(touches.length&&!inMultiFingerRelease())return startMultiFingerRelease(event),!0;if(touches.length&&inMultiFingerRelease())return!0}return inMultiFingerRelease()&&(fingerCount=fingerCountAtRelease),endTime=getTimeStamp(),duration=calculateDuration(),didSwipeBackToCancel()||!validateSwipeDistance()?(phase=PHASE_CANCEL,triggerHandler(event,phase)):options.triggerOnTouchEnd||options.triggerOnTouchEnd===!1&&phase===PHASE_MOVE?(options.preventDefaultEvents!==!1&&jqEvent.cancelable!==!1&&jqEvent.preventDefault(),phase=PHASE_END,triggerHandler(event,phase)):!options.triggerOnTouchEnd&&hasTap()?(phase=PHASE_END,triggerHandlerForGesture(event,phase,TAP)):phase===PHASE_MOVE&&(phase=PHASE_CANCEL,triggerHandler(event,phase)),setTouchInProgress(!1),null}function touchCancel(){fingerCount=0,endTime=0,startTime=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,cancelMultiFingerRelease(),setTouchInProgress(!1)}function touchLeave(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;options.triggerOnTouchLeave&&(phase=getNextPhase(PHASE_END),triggerHandler(event,phase))}function removeListeners(){$element.off(START_EV,touchStart),$element.off(CANCEL_EV,touchCancel),$element.off(MOVE_EV,touchMove),$element.off(END_EV,touchEnd),LEAVE_EV&&$element.off(LEAVE_EV,touchLeave),setTouchInProgress(!1)}function getNextPhase(currentPhase){var nextPhase=currentPhase,validTime=validateSwipeTime(),validDistance=validateSwipeDistance(),didCancel=didSwipeBackToCancel();return!validTime||didCancel?nextPhase=PHASE_CANCEL:!validDistance||currentPhase!=PHASE_MOVE||options.triggerOnTouchEnd&&!options.triggerOnTouchLeave?!validDistance&¤tPhase==PHASE_END&&options.triggerOnTouchLeave&&(nextPhase=PHASE_CANCEL):nextPhase=PHASE_END,nextPhase}function triggerHandler(event,phase){var ret,touches=event.touches;return(didSwipe()||hasSwipes())&&(ret=triggerHandlerForGesture(event,phase,SWIPE)),(didPinch()||hasPinches())&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,PINCH)),didDoubleTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,DOUBLE_TAP):didLongTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,LONG_TAP):didTap()&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,TAP)),phase===PHASE_CANCEL&&touchCancel(event),phase===PHASE_END&&(touches?touches.length||touchCancel(event):touchCancel(event)),ret}function triggerHandlerForGesture(event,phase,gesture){var ret;if(gesture==SWIPE){if($element.trigger("swipeStatus",[phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection]),options.swipeStatus&&(ret=options.swipeStatus.call($element,event,phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection),ret===!1))return!1;if(phase==PHASE_END&&validateSwipe()){if(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),$element.trigger("swipe",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipe&&(ret=options.swipe.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection),ret===!1))return!1;switch(direction){case LEFT:$element.trigger("swipeLeft",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeLeft&&(ret=options.swipeLeft.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case RIGHT:$element.trigger("swipeRight",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeRight&&(ret=options.swipeRight.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case UP:$element.trigger("swipeUp",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeUp&&(ret=options.swipeUp.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case DOWN:$element.trigger("swipeDown",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeDown&&(ret=options.swipeDown.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection))}}}if(gesture==PINCH){if($element.trigger("pinchStatus",[phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchStatus&&(ret=options.pinchStatus.call($element,event,phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData),ret===!1))return!1;if(phase==PHASE_END&&validatePinch())switch(pinchDirection){case IN:$element.trigger("pinchIn",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchIn&&(ret=options.pinchIn.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData));break;case OUT:$element.trigger("pinchOut",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchOut&&(ret=options.pinchOut.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData))}}return gesture==TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),hasDoubleTap()&&!inDoubleTap()?(doubleTapStartTime=getTimeStamp(),singleTapTimeout=setTimeout($.proxy(function(){doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target))},this),options.doubleTapThreshold)):(doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target)))):gesture==DOUBLE_TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),doubleTapStartTime=null,$element.trigger("doubletap",[event.target]),options.doubleTap&&(ret=options.doubleTap.call($element,event,event.target))):gesture==LONG_TAP&&(phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),doubleTapStartTime=null,$element.trigger("longtap",[event.target]),options.longTap&&(ret=options.longTap.call($element,event,event.target)))),ret}function validateSwipeDistance(){var valid=!0;return null!==options.threshold&&(valid=distance>=options.threshold),valid}function didSwipeBackToCancel(){var cancelled=!1;return null!==options.cancelThreshold&&null!==direction&&(cancelled=getMaxDistance(direction)-distance>=options.cancelThreshold),cancelled}function validatePinchDistance(){return null!==options.pinchThreshold?pinchDistance>=options.pinchThreshold:!0}function validateSwipeTime(){var result;return result=options.maxTimeThreshold?!(duration>=options.maxTimeThreshold):!0}function validateDefaultEvent(jqEvent,direction){if(options.preventDefaultEvents!==!1)if(options.allowPageScroll===NONE)jqEvent.preventDefault();else{var auto=options.allowPageScroll===AUTO;switch(direction){case LEFT:(options.swipeLeft&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case RIGHT:(options.swipeRight&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case UP:(options.swipeUp&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case DOWN:(options.swipeDown&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case NONE:}}}function validatePinch(){var hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),hasCorrectDistance=validatePinchDistance();return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance}function hasPinches(){return!!(options.pinchStatus||options.pinchIn||options.pinchOut)}function didPinch(){return!(!validatePinch()||!hasPinches())}function validateSwipe(){var hasValidTime=validateSwipeTime(),hasValidDistance=validateSwipeDistance(),hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),didCancel=didSwipeBackToCancel(),valid=!didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;return valid}function hasSwipes(){return!!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown)}function didSwipe(){return!(!validateSwipe()||!hasSwipes())}function validateFingers(){return fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH}function validateEndPoint(){return 0!==fingerData[0].end.x}function hasTap(){return!!options.tap}function hasDoubleTap(){return!!options.doubleTap}function hasLongTap(){return!!options.longTap}function validateDoubleTap(){if(null==doubleTapStartTime)return!1;var now=getTimeStamp();return hasDoubleTap()&&now-doubleTapStartTime<=options.doubleTapThreshold}function inDoubleTap(){return validateDoubleTap()}function validateTap(){return(1===fingerCount||!SUPPORTS_TOUCH)&&(isNaN(distance)||distance<options.threshold)}function validateLongTap(){return duration>options.longTapThreshold&&DOUBLE_TAP_THRESHOLD>distance}function didTap(){return!(!validateTap()||!hasTap())}function didDoubleTap(){return!(!validateDoubleTap()||!hasDoubleTap())}function didLongTap(){return!(!validateLongTap()||!hasLongTap())}function startMultiFingerRelease(event){previousTouchEndTime=getTimeStamp(),fingerCountAtRelease=event.touches.length+1}function cancelMultiFingerRelease(){previousTouchEndTime=0,fingerCountAtRelease=0}function inMultiFingerRelease(){var withinThreshold=!1;if(previousTouchEndTime){var diff=getTimeStamp()-previousTouchEndTime;diff<=options.fingerReleaseThreshold&&(withinThreshold=!0)}return withinThreshold}function getTouchInProgress(){return!($element.data(PLUGIN_NS+"_intouch")!==!0)}function setTouchInProgress(val){$element&&(val===!0?($element.on(MOVE_EV,touchMove),$element.on(END_EV,touchEnd),LEAVE_EV&&$element.on(LEAVE_EV,touchLeave)):($element.off(MOVE_EV,touchMove,!1),$element.off(END_EV,touchEnd,!1),LEAVE_EV&&$element.off(LEAVE_EV,touchLeave,!1)),$element.data(PLUGIN_NS+"_intouch",val===!0))}function createFingerData(id,evt){var f={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return f.start.x=f.last.x=f.end.x=evt.pageX||evt.clientX,f.start.y=f.last.y=f.end.y=evt.pageY||evt.clientY,fingerData[id]=f,f}function updateFingerData(evt){var id=void 0!==evt.identifier?evt.identifier:0,f=getFingerData(id);return null===f&&(f=createFingerData(id,evt)),f.last.x=f.end.x,f.last.y=f.end.y,f.end.x=evt.pageX||evt.clientX,f.end.y=evt.pageY||evt.clientY,f}function getFingerData(id){return fingerData[id]||null}function setMaxDistance(direction,distance){direction!=NONE&&(distance=Math.max(distance,getMaxDistance(direction)),maximumsMap[direction].distance=distance)}function getMaxDistance(direction){return maximumsMap[direction]?maximumsMap[direction].distance:void 0}function createMaximumsData(){var maxData={};return maxData[LEFT]=createMaximumVO(LEFT),maxData[RIGHT]=createMaximumVO(RIGHT),maxData[UP]=createMaximumVO(UP),maxData[DOWN]=createMaximumVO(DOWN),maxData}function createMaximumVO(dir){return{direction:dir,distance:0}}function calculateDuration(){return endTime-startTime}function calculateTouchesDistance(startPoint,endPoint){var diffX=Math.abs(startPoint.x-endPoint.x),diffY=Math.abs(startPoint.y-endPoint.y);return Math.round(Math.sqrt(diffX*diffX+diffY*diffY))}function calculatePinchZoom(startDistance,endDistance){var percent=endDistance/startDistance*1;return percent.toFixed(2)}function calculatePinchDirection(){return 1>pinchZoom?OUT:IN}function calculateDistance(startPoint,endPoint){return Math.round(Math.sqrt(Math.pow(endPoint.x-startPoint.x,2)+Math.pow(endPoint.y-startPoint.y,2)))}function calculateAngle(startPoint,endPoint){var x=startPoint.x-endPoint.x,y=endPoint.y-startPoint.y,r=Math.atan2(y,x),angle=Math.round(180*r/Math.PI);return 0>angle&&(angle=360-Math.abs(angle)),angle}function calculateDirection(startPoint,endPoint){if(comparePoints(startPoint,endPoint))return NONE;var angle=calculateAngle(startPoint,endPoint);return 45>=angle&&angle>=0?LEFT:360>=angle&&angle>=315?LEFT:angle>=135&&225>=angle?RIGHT:angle>45&&135>angle?DOWN:UP}function getTimeStamp(){var now=new Date;return now.getTime()}function getbounds(el){el=$(el);var offset=el.offset(),bounds={left:offset.left,right:offset.left+el.outerWidth(),top:offset.top,bottom:offset.top+el.outerHeight()};return bounds}function isInBounds(point,bounds){return point.x>bounds.left&&point.x<bounds.right&&point.y>bounds.top&&point.y<bounds.bottom}function comparePoints(pointA,pointB){return pointA.x==pointB.x&&pointA.y==pointB.y}var options=$.extend({},options),useTouchEvents=SUPPORTS_TOUCH||SUPPORTS_POINTER||!options.fallbackToMouseEvents,START_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerDown":"pointerdown":"touchstart":"mousedown",MOVE_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerMove":"pointermove":"touchmove":"mousemove",END_EV=useTouchEvents?SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerUp":"pointerup":"touchend":"mouseup",LEAVE_EV=useTouchEvents?SUPPORTS_POINTER?"mouseleave":null:"mouseleave",CANCEL_EV=SUPPORTS_POINTER?SUPPORTS_POINTER_IE10?"MSPointerCancel":"pointercancel":"touchcancel",distance=0,direction=null,currentDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,pinchDirection=0,maximumsMap=null,$element=$(element),phase="start",fingerCount=0,fingerData={},startTime=0,endTime=0,previousTouchEndTime=0,fingerCountAtRelease=0,doubleTapStartTime=0,singleTapTimeout=null,holdTimeout=null;try{$element.on(START_EV,touchStart),$element.on(CANCEL_EV,touchCancel)}catch(e){$.error("events not supported "+START_EV+","+CANCEL_EV+" on jQuery.swipe")}this.enable=function(){return this.disable(),$element.on(START_EV,touchStart),$element.on(CANCEL_EV,touchCancel),$element},this.disable=function(){return removeListeners(),$element},this.destroy=function(){removeListeners(),$element.data(PLUGIN_NS,null),$element=null},this.option=function(property,value){if("object"==typeof property)options=$.extend(options,property);else if(void 0!==options[property]){if(void 0===value)return options[property];options[property]=value}else{if(!property)return options;$.error("Option "+property+" does not exist on jQuery.swipe.options")}return null}}var VERSION="1.6.18",LEFT="left",RIGHT="right",UP="up",DOWN="down",IN="in",OUT="out",NONE="none",AUTO="auto",SWIPE="swipe",PINCH="pinch",TAP="tap",DOUBLE_TAP="doubletap",LONG_TAP="longtap",HORIZONTAL="horizontal",VERTICAL="vertical",ALL_FINGERS="all",DOUBLE_TAP_THRESHOLD=10,PHASE_START="start",PHASE_MOVE="move",PHASE_END="end",PHASE_CANCEL="cancel",SUPPORTS_TOUCH="ontouchstart"in window,SUPPORTS_POINTER_IE10=window.navigator.msPointerEnabled&&!window.PointerEvent&&!SUPPORTS_TOUCH,SUPPORTS_POINTER=(window.PointerEvent||window.navigator.msPointerEnabled)&&!SUPPORTS_TOUCH,PLUGIN_NS="TouchSwipe",defaults={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:!0,triggerOnTouchLeave:!1,allowPageScroll:"auto",fallbackToMouseEvents:!0,excludedElements:".noSwipe",preventDefaultEvents:!0};$.fn.swipe=function(method){var $this=$(this),plugin=$this.data(PLUGIN_NS);if(plugin&&"string"==typeof method){if(plugin[method])return plugin[method].apply(plugin,Array.prototype.slice.call(arguments,1));$.error("Method "+method+" does not exist on jQuery.swipe")}else if(plugin&&"object"==typeof method)plugin.option.apply(plugin,arguments);else if(!(plugin||"object"!=typeof method&&method))return init.apply(this,arguments);return $this},$.fn.swipe.version=VERSION,$.fn.swipe.defaults=defaults,$.fn.swipe.phases={PHASE_START:PHASE_START,PHASE_MOVE:PHASE_MOVE,PHASE_END:PHASE_END,PHASE_CANCEL:PHASE_CANCEL},$.fn.swipe.directions={LEFT:LEFT,RIGHT:RIGHT,UP:UP,DOWN:DOWN,IN:IN,OUT:OUT},$.fn.swipe.pageScroll={NONE:NONE,HORIZONTAL:HORIZONTAL,VERTICAL:VERTICAL,AUTO:AUTO},$.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,FOUR:4,FIVE:5,ALL:ALL_FINGERS}});
|
|
1267
|
+
!(function (factory) {
|
|
1268
|
+
'function' == typeof define && define.amd && define.amd.jQuery
|
|
1269
|
+
? define(['jquery'], factory)
|
|
1270
|
+
: factory('undefined' != typeof module && module.exports ? require('jquery') : jQuery);
|
|
1271
|
+
})(function ($) {
|
|
1272
|
+
'use strict';
|
|
1273
|
+
function init(options) {
|
|
1274
|
+
return (
|
|
1275
|
+
!options ||
|
|
1276
|
+
void 0 !== options.allowPageScroll ||
|
|
1277
|
+
(void 0 === options.swipe && void 0 === options.swipeStatus) ||
|
|
1278
|
+
(options.allowPageScroll = NONE),
|
|
1279
|
+
void 0 !== options.click && void 0 === options.tap && (options.tap = options.click),
|
|
1280
|
+
options || (options = {}),
|
|
1281
|
+
(options = $.extend({}, $.fn.swipe.defaults, options)),
|
|
1282
|
+
this.each(function () {
|
|
1283
|
+
var $this = $(this),
|
|
1284
|
+
plugin = $this.data(PLUGIN_NS);
|
|
1285
|
+
plugin || ((plugin = new TouchSwipe(this, options)), $this.data(PLUGIN_NS, plugin));
|
|
1286
|
+
})
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
function TouchSwipe(element, options) {
|
|
1290
|
+
function touchStart(jqEvent) {
|
|
1291
|
+
if (
|
|
1292
|
+
!(
|
|
1293
|
+
getTouchInProgress() ||
|
|
1294
|
+
$(jqEvent.target).closest(options.excludedElements, $element).length > 0
|
|
1295
|
+
)
|
|
1296
|
+
) {
|
|
1297
|
+
var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent;
|
|
1298
|
+
if (
|
|
1299
|
+
!event.pointerType ||
|
|
1300
|
+
'mouse' != event.pointerType ||
|
|
1301
|
+
0 != options.fallbackToMouseEvents
|
|
1302
|
+
) {
|
|
1303
|
+
var ret,
|
|
1304
|
+
touches = event.touches,
|
|
1305
|
+
evt = touches ? touches[0] : event;
|
|
1306
|
+
return (
|
|
1307
|
+
(phase = PHASE_START),
|
|
1308
|
+
touches
|
|
1309
|
+
? (fingerCount = touches.length)
|
|
1310
|
+
: options.preventDefaultEvents !== !1 && jqEvent.preventDefault(),
|
|
1311
|
+
(distance = 0),
|
|
1312
|
+
(direction = null),
|
|
1313
|
+
(currentDirection = null),
|
|
1314
|
+
(pinchDirection = null),
|
|
1315
|
+
(duration = 0),
|
|
1316
|
+
(startTouchesDistance = 0),
|
|
1317
|
+
(endTouchesDistance = 0),
|
|
1318
|
+
(pinchZoom = 1),
|
|
1319
|
+
(pinchDistance = 0),
|
|
1320
|
+
(maximumsMap = createMaximumsData()),
|
|
1321
|
+
cancelMultiFingerRelease(),
|
|
1322
|
+
createFingerData(0, evt),
|
|
1323
|
+
!touches ||
|
|
1324
|
+
fingerCount === options.fingers ||
|
|
1325
|
+
options.fingers === ALL_FINGERS ||
|
|
1326
|
+
hasPinches()
|
|
1327
|
+
? ((startTime = getTimeStamp()),
|
|
1328
|
+
2 == fingerCount &&
|
|
1329
|
+
(createFingerData(1, touches[1]),
|
|
1330
|
+
(startTouchesDistance = endTouchesDistance =
|
|
1331
|
+
calculateTouchesDistance(fingerData[0].start, fingerData[1].start))),
|
|
1332
|
+
(options.swipeStatus || options.pinchStatus) &&
|
|
1333
|
+
(ret = triggerHandler(event, phase)))
|
|
1334
|
+
: (ret = !1),
|
|
1335
|
+
ret === !1
|
|
1336
|
+
? ((phase = PHASE_CANCEL), triggerHandler(event, phase), ret)
|
|
1337
|
+
: (options.hold &&
|
|
1338
|
+
(holdTimeout = setTimeout(
|
|
1339
|
+
$.proxy(function () {
|
|
1340
|
+
$element.trigger('hold', [event.target]),
|
|
1341
|
+
options.hold && (ret = options.hold.call($element, event, event.target));
|
|
1342
|
+
}, this),
|
|
1343
|
+
options.longTapThreshold
|
|
1344
|
+
)),
|
|
1345
|
+
setTouchInProgress(!0),
|
|
1346
|
+
null)
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function touchMove(jqEvent) {
|
|
1352
|
+
var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent;
|
|
1353
|
+
if (phase !== PHASE_END && phase !== PHASE_CANCEL && !inMultiFingerRelease()) {
|
|
1354
|
+
var ret,
|
|
1355
|
+
touches = event.touches,
|
|
1356
|
+
evt = touches ? touches[0] : event,
|
|
1357
|
+
currentFinger = updateFingerData(evt);
|
|
1358
|
+
if (
|
|
1359
|
+
((endTime = getTimeStamp()),
|
|
1360
|
+
touches && (fingerCount = touches.length),
|
|
1361
|
+
options.hold && clearTimeout(holdTimeout),
|
|
1362
|
+
(phase = PHASE_MOVE),
|
|
1363
|
+
2 == fingerCount &&
|
|
1364
|
+
(0 == startTouchesDistance
|
|
1365
|
+
? (createFingerData(1, touches[1]),
|
|
1366
|
+
(startTouchesDistance = endTouchesDistance =
|
|
1367
|
+
calculateTouchesDistance(fingerData[0].start, fingerData[1].start)))
|
|
1368
|
+
: (updateFingerData(touches[1]),
|
|
1369
|
+
(endTouchesDistance = calculateTouchesDistance(
|
|
1370
|
+
fingerData[0].end,
|
|
1371
|
+
fingerData[1].end
|
|
1372
|
+
)),
|
|
1373
|
+
(pinchDirection = calculatePinchDirection(fingerData[0].end, fingerData[1].end))),
|
|
1374
|
+
(pinchZoom = calculatePinchZoom(startTouchesDistance, endTouchesDistance)),
|
|
1375
|
+
(pinchDistance = Math.abs(startTouchesDistance - endTouchesDistance))),
|
|
1376
|
+
fingerCount === options.fingers ||
|
|
1377
|
+
options.fingers === ALL_FINGERS ||
|
|
1378
|
+
!touches ||
|
|
1379
|
+
hasPinches())
|
|
1380
|
+
) {
|
|
1381
|
+
if (
|
|
1382
|
+
((direction = calculateDirection(currentFinger.start, currentFinger.end)),
|
|
1383
|
+
(currentDirection = calculateDirection(currentFinger.last, currentFinger.end)),
|
|
1384
|
+
validateDefaultEvent(jqEvent, currentDirection),
|
|
1385
|
+
(distance = calculateDistance(currentFinger.start, currentFinger.end)),
|
|
1386
|
+
(duration = calculateDuration()),
|
|
1387
|
+
setMaxDistance(direction, distance),
|
|
1388
|
+
(ret = triggerHandler(event, phase)),
|
|
1389
|
+
!options.triggerOnTouchEnd || options.triggerOnTouchLeave)
|
|
1390
|
+
) {
|
|
1391
|
+
var inBounds = !0;
|
|
1392
|
+
if (options.triggerOnTouchLeave) {
|
|
1393
|
+
var bounds = getbounds(this);
|
|
1394
|
+
inBounds = isInBounds(currentFinger.end, bounds);
|
|
1395
|
+
}
|
|
1396
|
+
!options.triggerOnTouchEnd && inBounds
|
|
1397
|
+
? (phase = getNextPhase(PHASE_MOVE))
|
|
1398
|
+
: options.triggerOnTouchLeave && !inBounds && (phase = getNextPhase(PHASE_END)),
|
|
1399
|
+
(phase != PHASE_CANCEL && phase != PHASE_END) || triggerHandler(event, phase);
|
|
1400
|
+
}
|
|
1401
|
+
} else (phase = PHASE_CANCEL), triggerHandler(event, phase);
|
|
1402
|
+
ret === !1 && ((phase = PHASE_CANCEL), triggerHandler(event, phase));
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
function touchEnd(jqEvent) {
|
|
1406
|
+
var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent,
|
|
1407
|
+
touches = event.touches;
|
|
1408
|
+
if (touches) {
|
|
1409
|
+
if (touches.length && !inMultiFingerRelease()) return startMultiFingerRelease(event), !0;
|
|
1410
|
+
if (touches.length && inMultiFingerRelease()) return !0;
|
|
1411
|
+
}
|
|
1412
|
+
return (
|
|
1413
|
+
inMultiFingerRelease() && (fingerCount = fingerCountAtRelease),
|
|
1414
|
+
(endTime = getTimeStamp()),
|
|
1415
|
+
(duration = calculateDuration()),
|
|
1416
|
+
didSwipeBackToCancel() || !validateSwipeDistance()
|
|
1417
|
+
? ((phase = PHASE_CANCEL), triggerHandler(event, phase))
|
|
1418
|
+
: options.triggerOnTouchEnd || (options.triggerOnTouchEnd === !1 && phase === PHASE_MOVE)
|
|
1419
|
+
? (options.preventDefaultEvents !== !1 &&
|
|
1420
|
+
jqEvent.cancelable !== !1 &&
|
|
1421
|
+
jqEvent.preventDefault(),
|
|
1422
|
+
(phase = PHASE_END),
|
|
1423
|
+
triggerHandler(event, phase))
|
|
1424
|
+
: !options.triggerOnTouchEnd && hasTap()
|
|
1425
|
+
? ((phase = PHASE_END), triggerHandlerForGesture(event, phase, TAP))
|
|
1426
|
+
: phase === PHASE_MOVE && ((phase = PHASE_CANCEL), triggerHandler(event, phase)),
|
|
1427
|
+
setTouchInProgress(!1),
|
|
1428
|
+
null
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
function touchCancel() {
|
|
1432
|
+
(fingerCount = 0),
|
|
1433
|
+
(endTime = 0),
|
|
1434
|
+
(startTime = 0),
|
|
1435
|
+
(startTouchesDistance = 0),
|
|
1436
|
+
(endTouchesDistance = 0),
|
|
1437
|
+
(pinchZoom = 1),
|
|
1438
|
+
cancelMultiFingerRelease(),
|
|
1439
|
+
setTouchInProgress(!1);
|
|
1440
|
+
}
|
|
1441
|
+
function touchLeave(jqEvent) {
|
|
1442
|
+
var event = jqEvent.originalEvent ? jqEvent.originalEvent : jqEvent;
|
|
1443
|
+
options.triggerOnTouchLeave &&
|
|
1444
|
+
((phase = getNextPhase(PHASE_END)), triggerHandler(event, phase));
|
|
1445
|
+
}
|
|
1446
|
+
function removeListeners() {
|
|
1447
|
+
$element.off(START_EV, touchStart),
|
|
1448
|
+
$element.off(CANCEL_EV, touchCancel),
|
|
1449
|
+
$element.off(MOVE_EV, touchMove),
|
|
1450
|
+
$element.off(END_EV, touchEnd),
|
|
1451
|
+
LEAVE_EV && $element.off(LEAVE_EV, touchLeave),
|
|
1452
|
+
setTouchInProgress(!1);
|
|
1453
|
+
}
|
|
1454
|
+
function getNextPhase(currentPhase) {
|
|
1455
|
+
var nextPhase = currentPhase,
|
|
1456
|
+
validTime = validateSwipeTime(),
|
|
1457
|
+
validDistance = validateSwipeDistance(),
|
|
1458
|
+
didCancel = didSwipeBackToCancel();
|
|
1459
|
+
return (
|
|
1460
|
+
!validTime || didCancel
|
|
1461
|
+
? (nextPhase = PHASE_CANCEL)
|
|
1462
|
+
: !validDistance ||
|
|
1463
|
+
currentPhase != PHASE_MOVE ||
|
|
1464
|
+
(options.triggerOnTouchEnd && !options.triggerOnTouchLeave)
|
|
1465
|
+
? !validDistance &&
|
|
1466
|
+
currentPhase == PHASE_END &&
|
|
1467
|
+
options.triggerOnTouchLeave &&
|
|
1468
|
+
(nextPhase = PHASE_CANCEL)
|
|
1469
|
+
: (nextPhase = PHASE_END),
|
|
1470
|
+
nextPhase
|
|
1471
|
+
);
|
|
1472
|
+
}
|
|
1473
|
+
function triggerHandler(event, phase) {
|
|
1474
|
+
var ret,
|
|
1475
|
+
touches = event.touches;
|
|
1476
|
+
return (
|
|
1477
|
+
(didSwipe() || hasSwipes()) && (ret = triggerHandlerForGesture(event, phase, SWIPE)),
|
|
1478
|
+
(didPinch() || hasPinches()) &&
|
|
1479
|
+
ret !== !1 &&
|
|
1480
|
+
(ret = triggerHandlerForGesture(event, phase, PINCH)),
|
|
1481
|
+
didDoubleTap() && ret !== !1
|
|
1482
|
+
? (ret = triggerHandlerForGesture(event, phase, DOUBLE_TAP))
|
|
1483
|
+
: didLongTap() && ret !== !1
|
|
1484
|
+
? (ret = triggerHandlerForGesture(event, phase, LONG_TAP))
|
|
1485
|
+
: didTap() && ret !== !1 && (ret = triggerHandlerForGesture(event, phase, TAP)),
|
|
1486
|
+
phase === PHASE_CANCEL && touchCancel(event),
|
|
1487
|
+
phase === PHASE_END &&
|
|
1488
|
+
(touches ? touches.length || touchCancel(event) : touchCancel(event)),
|
|
1489
|
+
ret
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
function triggerHandlerForGesture(event, phase, gesture) {
|
|
1493
|
+
var ret;
|
|
1494
|
+
if (gesture == SWIPE) {
|
|
1495
|
+
if (
|
|
1496
|
+
($element.trigger('swipeStatus', [
|
|
1497
|
+
phase,
|
|
1498
|
+
direction || null,
|
|
1499
|
+
distance || 0,
|
|
1500
|
+
duration || 0,
|
|
1501
|
+
fingerCount,
|
|
1502
|
+
fingerData,
|
|
1503
|
+
currentDirection,
|
|
1504
|
+
]),
|
|
1505
|
+
options.swipeStatus &&
|
|
1506
|
+
((ret = options.swipeStatus.call(
|
|
1507
|
+
$element,
|
|
1508
|
+
event,
|
|
1509
|
+
phase,
|
|
1510
|
+
direction || null,
|
|
1511
|
+
distance || 0,
|
|
1512
|
+
duration || 0,
|
|
1513
|
+
fingerCount,
|
|
1514
|
+
fingerData,
|
|
1515
|
+
currentDirection
|
|
1516
|
+
)),
|
|
1517
|
+
ret === !1))
|
|
1518
|
+
)
|
|
1519
|
+
return !1;
|
|
1520
|
+
if (phase == PHASE_END && validateSwipe()) {
|
|
1521
|
+
if (
|
|
1522
|
+
(clearTimeout(singleTapTimeout),
|
|
1523
|
+
clearTimeout(holdTimeout),
|
|
1524
|
+
$element.trigger('swipe', [
|
|
1525
|
+
direction,
|
|
1526
|
+
distance,
|
|
1527
|
+
duration,
|
|
1528
|
+
fingerCount,
|
|
1529
|
+
fingerData,
|
|
1530
|
+
currentDirection,
|
|
1531
|
+
]),
|
|
1532
|
+
options.swipe &&
|
|
1533
|
+
((ret = options.swipe.call(
|
|
1534
|
+
$element,
|
|
1535
|
+
event,
|
|
1536
|
+
direction,
|
|
1537
|
+
distance,
|
|
1538
|
+
duration,
|
|
1539
|
+
fingerCount,
|
|
1540
|
+
fingerData,
|
|
1541
|
+
currentDirection
|
|
1542
|
+
)),
|
|
1543
|
+
ret === !1))
|
|
1544
|
+
)
|
|
1545
|
+
return !1;
|
|
1546
|
+
switch (direction) {
|
|
1547
|
+
case LEFT:
|
|
1548
|
+
$element.trigger('swipeLeft', [
|
|
1549
|
+
direction,
|
|
1550
|
+
distance,
|
|
1551
|
+
duration,
|
|
1552
|
+
fingerCount,
|
|
1553
|
+
fingerData,
|
|
1554
|
+
currentDirection,
|
|
1555
|
+
]),
|
|
1556
|
+
options.swipeLeft &&
|
|
1557
|
+
(ret = options.swipeLeft.call(
|
|
1558
|
+
$element,
|
|
1559
|
+
event,
|
|
1560
|
+
direction,
|
|
1561
|
+
distance,
|
|
1562
|
+
duration,
|
|
1563
|
+
fingerCount,
|
|
1564
|
+
fingerData,
|
|
1565
|
+
currentDirection
|
|
1566
|
+
));
|
|
1567
|
+
break;
|
|
1568
|
+
case RIGHT:
|
|
1569
|
+
$element.trigger('swipeRight', [
|
|
1570
|
+
direction,
|
|
1571
|
+
distance,
|
|
1572
|
+
duration,
|
|
1573
|
+
fingerCount,
|
|
1574
|
+
fingerData,
|
|
1575
|
+
currentDirection,
|
|
1576
|
+
]),
|
|
1577
|
+
options.swipeRight &&
|
|
1578
|
+
(ret = options.swipeRight.call(
|
|
1579
|
+
$element,
|
|
1580
|
+
event,
|
|
1581
|
+
direction,
|
|
1582
|
+
distance,
|
|
1583
|
+
duration,
|
|
1584
|
+
fingerCount,
|
|
1585
|
+
fingerData,
|
|
1586
|
+
currentDirection
|
|
1587
|
+
));
|
|
1588
|
+
break;
|
|
1589
|
+
case UP:
|
|
1590
|
+
$element.trigger('swipeUp', [
|
|
1591
|
+
direction,
|
|
1592
|
+
distance,
|
|
1593
|
+
duration,
|
|
1594
|
+
fingerCount,
|
|
1595
|
+
fingerData,
|
|
1596
|
+
currentDirection,
|
|
1597
|
+
]),
|
|
1598
|
+
options.swipeUp &&
|
|
1599
|
+
(ret = options.swipeUp.call(
|
|
1600
|
+
$element,
|
|
1601
|
+
event,
|
|
1602
|
+
direction,
|
|
1603
|
+
distance,
|
|
1604
|
+
duration,
|
|
1605
|
+
fingerCount,
|
|
1606
|
+
fingerData,
|
|
1607
|
+
currentDirection
|
|
1608
|
+
));
|
|
1609
|
+
break;
|
|
1610
|
+
case DOWN:
|
|
1611
|
+
$element.trigger('swipeDown', [
|
|
1612
|
+
direction,
|
|
1613
|
+
distance,
|
|
1614
|
+
duration,
|
|
1615
|
+
fingerCount,
|
|
1616
|
+
fingerData,
|
|
1617
|
+
currentDirection,
|
|
1618
|
+
]),
|
|
1619
|
+
options.swipeDown &&
|
|
1620
|
+
(ret = options.swipeDown.call(
|
|
1621
|
+
$element,
|
|
1622
|
+
event,
|
|
1623
|
+
direction,
|
|
1624
|
+
distance,
|
|
1625
|
+
duration,
|
|
1626
|
+
fingerCount,
|
|
1627
|
+
fingerData,
|
|
1628
|
+
currentDirection
|
|
1629
|
+
));
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if (gesture == PINCH) {
|
|
1634
|
+
if (
|
|
1635
|
+
($element.trigger('pinchStatus', [
|
|
1636
|
+
phase,
|
|
1637
|
+
pinchDirection || null,
|
|
1638
|
+
pinchDistance || 0,
|
|
1639
|
+
duration || 0,
|
|
1640
|
+
fingerCount,
|
|
1641
|
+
pinchZoom,
|
|
1642
|
+
fingerData,
|
|
1643
|
+
]),
|
|
1644
|
+
options.pinchStatus &&
|
|
1645
|
+
((ret = options.pinchStatus.call(
|
|
1646
|
+
$element,
|
|
1647
|
+
event,
|
|
1648
|
+
phase,
|
|
1649
|
+
pinchDirection || null,
|
|
1650
|
+
pinchDistance || 0,
|
|
1651
|
+
duration || 0,
|
|
1652
|
+
fingerCount,
|
|
1653
|
+
pinchZoom,
|
|
1654
|
+
fingerData
|
|
1655
|
+
)),
|
|
1656
|
+
ret === !1))
|
|
1657
|
+
)
|
|
1658
|
+
return !1;
|
|
1659
|
+
if (phase == PHASE_END && validatePinch())
|
|
1660
|
+
switch (pinchDirection) {
|
|
1661
|
+
case IN:
|
|
1662
|
+
$element.trigger('pinchIn', [
|
|
1663
|
+
pinchDirection || null,
|
|
1664
|
+
pinchDistance || 0,
|
|
1665
|
+
duration || 0,
|
|
1666
|
+
fingerCount,
|
|
1667
|
+
pinchZoom,
|
|
1668
|
+
fingerData,
|
|
1669
|
+
]),
|
|
1670
|
+
options.pinchIn &&
|
|
1671
|
+
(ret = options.pinchIn.call(
|
|
1672
|
+
$element,
|
|
1673
|
+
event,
|
|
1674
|
+
pinchDirection || null,
|
|
1675
|
+
pinchDistance || 0,
|
|
1676
|
+
duration || 0,
|
|
1677
|
+
fingerCount,
|
|
1678
|
+
pinchZoom,
|
|
1679
|
+
fingerData
|
|
1680
|
+
));
|
|
1681
|
+
break;
|
|
1682
|
+
case OUT:
|
|
1683
|
+
$element.trigger('pinchOut', [
|
|
1684
|
+
pinchDirection || null,
|
|
1685
|
+
pinchDistance || 0,
|
|
1686
|
+
duration || 0,
|
|
1687
|
+
fingerCount,
|
|
1688
|
+
pinchZoom,
|
|
1689
|
+
fingerData,
|
|
1690
|
+
]),
|
|
1691
|
+
options.pinchOut &&
|
|
1692
|
+
(ret = options.pinchOut.call(
|
|
1693
|
+
$element,
|
|
1694
|
+
event,
|
|
1695
|
+
pinchDirection || null,
|
|
1696
|
+
pinchDistance || 0,
|
|
1697
|
+
duration || 0,
|
|
1698
|
+
fingerCount,
|
|
1699
|
+
pinchZoom,
|
|
1700
|
+
fingerData
|
|
1701
|
+
));
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
return (
|
|
1705
|
+
gesture == TAP
|
|
1706
|
+
? (phase !== PHASE_CANCEL && phase !== PHASE_END) ||
|
|
1707
|
+
(clearTimeout(singleTapTimeout),
|
|
1708
|
+
clearTimeout(holdTimeout),
|
|
1709
|
+
hasDoubleTap() && !inDoubleTap()
|
|
1710
|
+
? ((doubleTapStartTime = getTimeStamp()),
|
|
1711
|
+
(singleTapTimeout = setTimeout(
|
|
1712
|
+
$.proxy(function () {
|
|
1713
|
+
(doubleTapStartTime = null),
|
|
1714
|
+
$element.trigger('tap', [event.target]),
|
|
1715
|
+
options.tap && (ret = options.tap.call($element, event, event.target));
|
|
1716
|
+
}, this),
|
|
1717
|
+
options.doubleTapThreshold
|
|
1718
|
+
)))
|
|
1719
|
+
: ((doubleTapStartTime = null),
|
|
1720
|
+
$element.trigger('tap', [event.target]),
|
|
1721
|
+
options.tap && (ret = options.tap.call($element, event, event.target))))
|
|
1722
|
+
: gesture == DOUBLE_TAP
|
|
1723
|
+
? (phase !== PHASE_CANCEL && phase !== PHASE_END) ||
|
|
1724
|
+
(clearTimeout(singleTapTimeout),
|
|
1725
|
+
clearTimeout(holdTimeout),
|
|
1726
|
+
(doubleTapStartTime = null),
|
|
1727
|
+
$element.trigger('doubletap', [event.target]),
|
|
1728
|
+
options.doubleTap && (ret = options.doubleTap.call($element, event, event.target)))
|
|
1729
|
+
: gesture == LONG_TAP &&
|
|
1730
|
+
((phase !== PHASE_CANCEL && phase !== PHASE_END) ||
|
|
1731
|
+
(clearTimeout(singleTapTimeout),
|
|
1732
|
+
(doubleTapStartTime = null),
|
|
1733
|
+
$element.trigger('longtap', [event.target]),
|
|
1734
|
+
options.longTap && (ret = options.longTap.call($element, event, event.target)))),
|
|
1735
|
+
ret
|
|
1736
|
+
);
|
|
1737
|
+
}
|
|
1738
|
+
function validateSwipeDistance() {
|
|
1739
|
+
var valid = !0;
|
|
1740
|
+
return null !== options.threshold && (valid = distance >= options.threshold), valid;
|
|
1741
|
+
}
|
|
1742
|
+
function didSwipeBackToCancel() {
|
|
1743
|
+
var cancelled = !1;
|
|
1744
|
+
return (
|
|
1745
|
+
null !== options.cancelThreshold &&
|
|
1746
|
+
null !== direction &&
|
|
1747
|
+
(cancelled = getMaxDistance(direction) - distance >= options.cancelThreshold),
|
|
1748
|
+
cancelled
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
function validatePinchDistance() {
|
|
1752
|
+
return null !== options.pinchThreshold ? pinchDistance >= options.pinchThreshold : !0;
|
|
1753
|
+
}
|
|
1754
|
+
function validateSwipeTime() {
|
|
1755
|
+
var result;
|
|
1756
|
+
return (result = options.maxTimeThreshold ? !(duration >= options.maxTimeThreshold) : !0);
|
|
1757
|
+
}
|
|
1758
|
+
function validateDefaultEvent(jqEvent, direction) {
|
|
1759
|
+
if (options.preventDefaultEvents !== !1)
|
|
1760
|
+
if (options.allowPageScroll === NONE) jqEvent.preventDefault();
|
|
1761
|
+
else {
|
|
1762
|
+
var auto = options.allowPageScroll === AUTO;
|
|
1763
|
+
switch (direction) {
|
|
1764
|
+
case LEFT:
|
|
1765
|
+
((options.swipeLeft && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) &&
|
|
1766
|
+
jqEvent.preventDefault();
|
|
1767
|
+
break;
|
|
1768
|
+
case RIGHT:
|
|
1769
|
+
((options.swipeRight && auto) || (!auto && options.allowPageScroll != HORIZONTAL)) &&
|
|
1770
|
+
jqEvent.preventDefault();
|
|
1771
|
+
break;
|
|
1772
|
+
case UP:
|
|
1773
|
+
((options.swipeUp && auto) || (!auto && options.allowPageScroll != VERTICAL)) &&
|
|
1774
|
+
jqEvent.preventDefault();
|
|
1775
|
+
break;
|
|
1776
|
+
case DOWN:
|
|
1777
|
+
((options.swipeDown && auto) || (!auto && options.allowPageScroll != VERTICAL)) &&
|
|
1778
|
+
jqEvent.preventDefault();
|
|
1779
|
+
break;
|
|
1780
|
+
case NONE:
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
function validatePinch() {
|
|
1785
|
+
var hasCorrectFingerCount = validateFingers(),
|
|
1786
|
+
hasEndPoint = validateEndPoint(),
|
|
1787
|
+
hasCorrectDistance = validatePinchDistance();
|
|
1788
|
+
return hasCorrectFingerCount && hasEndPoint && hasCorrectDistance;
|
|
1789
|
+
}
|
|
1790
|
+
function hasPinches() {
|
|
1791
|
+
return !!(options.pinchStatus || options.pinchIn || options.pinchOut);
|
|
1792
|
+
}
|
|
1793
|
+
function didPinch() {
|
|
1794
|
+
return !(!validatePinch() || !hasPinches());
|
|
1795
|
+
}
|
|
1796
|
+
function validateSwipe() {
|
|
1797
|
+
var hasValidTime = validateSwipeTime(),
|
|
1798
|
+
hasValidDistance = validateSwipeDistance(),
|
|
1799
|
+
hasCorrectFingerCount = validateFingers(),
|
|
1800
|
+
hasEndPoint = validateEndPoint(),
|
|
1801
|
+
didCancel = didSwipeBackToCancel(),
|
|
1802
|
+
valid =
|
|
1803
|
+
!didCancel && hasEndPoint && hasCorrectFingerCount && hasValidDistance && hasValidTime;
|
|
1804
|
+
return valid;
|
|
1805
|
+
}
|
|
1806
|
+
function hasSwipes() {
|
|
1807
|
+
return !!(
|
|
1808
|
+
options.swipe ||
|
|
1809
|
+
options.swipeStatus ||
|
|
1810
|
+
options.swipeLeft ||
|
|
1811
|
+
options.swipeRight ||
|
|
1812
|
+
options.swipeUp ||
|
|
1813
|
+
options.swipeDown
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
function didSwipe() {
|
|
1817
|
+
return !(!validateSwipe() || !hasSwipes());
|
|
1818
|
+
}
|
|
1819
|
+
function validateFingers() {
|
|
1820
|
+
return fingerCount === options.fingers || options.fingers === ALL_FINGERS || !SUPPORTS_TOUCH;
|
|
1821
|
+
}
|
|
1822
|
+
function validateEndPoint() {
|
|
1823
|
+
return 0 !== fingerData[0].end.x;
|
|
1824
|
+
}
|
|
1825
|
+
function hasTap() {
|
|
1826
|
+
return !!options.tap;
|
|
1827
|
+
}
|
|
1828
|
+
function hasDoubleTap() {
|
|
1829
|
+
return !!options.doubleTap;
|
|
1830
|
+
}
|
|
1831
|
+
function hasLongTap() {
|
|
1832
|
+
return !!options.longTap;
|
|
1833
|
+
}
|
|
1834
|
+
function validateDoubleTap() {
|
|
1835
|
+
if (null == doubleTapStartTime) return !1;
|
|
1836
|
+
var now = getTimeStamp();
|
|
1837
|
+
return hasDoubleTap() && now - doubleTapStartTime <= options.doubleTapThreshold;
|
|
1838
|
+
}
|
|
1839
|
+
function inDoubleTap() {
|
|
1840
|
+
return validateDoubleTap();
|
|
1841
|
+
}
|
|
1842
|
+
function validateTap() {
|
|
1843
|
+
return (
|
|
1844
|
+
(1 === fingerCount || !SUPPORTS_TOUCH) && (isNaN(distance) || distance < options.threshold)
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
function validateLongTap() {
|
|
1848
|
+
return duration > options.longTapThreshold && DOUBLE_TAP_THRESHOLD > distance;
|
|
1849
|
+
}
|
|
1850
|
+
function didTap() {
|
|
1851
|
+
return !(!validateTap() || !hasTap());
|
|
1852
|
+
}
|
|
1853
|
+
function didDoubleTap() {
|
|
1854
|
+
return !(!validateDoubleTap() || !hasDoubleTap());
|
|
1855
|
+
}
|
|
1856
|
+
function didLongTap() {
|
|
1857
|
+
return !(!validateLongTap() || !hasLongTap());
|
|
1858
|
+
}
|
|
1859
|
+
function startMultiFingerRelease(event) {
|
|
1860
|
+
(previousTouchEndTime = getTimeStamp()), (fingerCountAtRelease = event.touches.length + 1);
|
|
1861
|
+
}
|
|
1862
|
+
function cancelMultiFingerRelease() {
|
|
1863
|
+
(previousTouchEndTime = 0), (fingerCountAtRelease = 0);
|
|
1864
|
+
}
|
|
1865
|
+
function inMultiFingerRelease() {
|
|
1866
|
+
var withinThreshold = !1;
|
|
1867
|
+
if (previousTouchEndTime) {
|
|
1868
|
+
var diff = getTimeStamp() - previousTouchEndTime;
|
|
1869
|
+
diff <= options.fingerReleaseThreshold && (withinThreshold = !0);
|
|
1870
|
+
}
|
|
1871
|
+
return withinThreshold;
|
|
1872
|
+
}
|
|
1873
|
+
function getTouchInProgress() {
|
|
1874
|
+
return !($element.data(PLUGIN_NS + '_intouch') !== !0);
|
|
1875
|
+
}
|
|
1876
|
+
function setTouchInProgress(val) {
|
|
1877
|
+
$element &&
|
|
1878
|
+
(val === !0
|
|
1879
|
+
? ($element.on(MOVE_EV, touchMove),
|
|
1880
|
+
$element.on(END_EV, touchEnd),
|
|
1881
|
+
LEAVE_EV && $element.on(LEAVE_EV, touchLeave))
|
|
1882
|
+
: ($element.off(MOVE_EV, touchMove, !1),
|
|
1883
|
+
$element.off(END_EV, touchEnd, !1),
|
|
1884
|
+
LEAVE_EV && $element.off(LEAVE_EV, touchLeave, !1)),
|
|
1885
|
+
$element.data(PLUGIN_NS + '_intouch', val === !0));
|
|
1886
|
+
}
|
|
1887
|
+
function createFingerData(id, evt) {
|
|
1888
|
+
var f = {start: {x: 0, y: 0}, last: {x: 0, y: 0}, end: {x: 0, y: 0}};
|
|
1889
|
+
return (
|
|
1890
|
+
(f.start.x = f.last.x = f.end.x = evt.pageX || evt.clientX),
|
|
1891
|
+
(f.start.y = f.last.y = f.end.y = evt.pageY || evt.clientY),
|
|
1892
|
+
(fingerData[id] = f),
|
|
1893
|
+
f
|
|
1894
|
+
);
|
|
1895
|
+
}
|
|
1896
|
+
function updateFingerData(evt) {
|
|
1897
|
+
var id = void 0 !== evt.identifier ? evt.identifier : 0,
|
|
1898
|
+
f = getFingerData(id);
|
|
1899
|
+
return (
|
|
1900
|
+
null === f && (f = createFingerData(id, evt)),
|
|
1901
|
+
(f.last.x = f.end.x),
|
|
1902
|
+
(f.last.y = f.end.y),
|
|
1903
|
+
(f.end.x = evt.pageX || evt.clientX),
|
|
1904
|
+
(f.end.y = evt.pageY || evt.clientY),
|
|
1905
|
+
f
|
|
1906
|
+
);
|
|
1907
|
+
}
|
|
1908
|
+
function getFingerData(id) {
|
|
1909
|
+
return fingerData[id] || null;
|
|
1910
|
+
}
|
|
1911
|
+
function setMaxDistance(direction, distance) {
|
|
1912
|
+
direction != NONE &&
|
|
1913
|
+
((distance = Math.max(distance, getMaxDistance(direction))),
|
|
1914
|
+
(maximumsMap[direction].distance = distance));
|
|
1915
|
+
}
|
|
1916
|
+
function getMaxDistance(direction) {
|
|
1917
|
+
return maximumsMap[direction] ? maximumsMap[direction].distance : void 0;
|
|
1918
|
+
}
|
|
1919
|
+
function createMaximumsData() {
|
|
1920
|
+
var maxData = {};
|
|
1921
|
+
return (
|
|
1922
|
+
(maxData[LEFT] = createMaximumVO(LEFT)),
|
|
1923
|
+
(maxData[RIGHT] = createMaximumVO(RIGHT)),
|
|
1924
|
+
(maxData[UP] = createMaximumVO(UP)),
|
|
1925
|
+
(maxData[DOWN] = createMaximumVO(DOWN)),
|
|
1926
|
+
maxData
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
function createMaximumVO(dir) {
|
|
1930
|
+
return {direction: dir, distance: 0};
|
|
1931
|
+
}
|
|
1932
|
+
function calculateDuration() {
|
|
1933
|
+
return endTime - startTime;
|
|
1934
|
+
}
|
|
1935
|
+
function calculateTouchesDistance(startPoint, endPoint) {
|
|
1936
|
+
var diffX = Math.abs(startPoint.x - endPoint.x),
|
|
1937
|
+
diffY = Math.abs(startPoint.y - endPoint.y);
|
|
1938
|
+
return Math.round(Math.sqrt(diffX * diffX + diffY * diffY));
|
|
1939
|
+
}
|
|
1940
|
+
function calculatePinchZoom(startDistance, endDistance) {
|
|
1941
|
+
var percent = (endDistance / startDistance) * 1;
|
|
1942
|
+
return percent.toFixed(2);
|
|
1943
|
+
}
|
|
1944
|
+
function calculatePinchDirection() {
|
|
1945
|
+
return 1 > pinchZoom ? OUT : IN;
|
|
1946
|
+
}
|
|
1947
|
+
function calculateDistance(startPoint, endPoint) {
|
|
1948
|
+
return Math.round(
|
|
1949
|
+
Math.sqrt(Math.pow(endPoint.x - startPoint.x, 2) + Math.pow(endPoint.y - startPoint.y, 2))
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
function calculateAngle(startPoint, endPoint) {
|
|
1953
|
+
var x = startPoint.x - endPoint.x,
|
|
1954
|
+
y = endPoint.y - startPoint.y,
|
|
1955
|
+
r = Math.atan2(y, x),
|
|
1956
|
+
angle = Math.round((180 * r) / Math.PI);
|
|
1957
|
+
return 0 > angle && (angle = 360 - Math.abs(angle)), angle;
|
|
1958
|
+
}
|
|
1959
|
+
function calculateDirection(startPoint, endPoint) {
|
|
1960
|
+
if (comparePoints(startPoint, endPoint)) return NONE;
|
|
1961
|
+
var angle = calculateAngle(startPoint, endPoint);
|
|
1962
|
+
return 45 >= angle && angle >= 0
|
|
1963
|
+
? LEFT
|
|
1964
|
+
: 360 >= angle && angle >= 315
|
|
1965
|
+
? LEFT
|
|
1966
|
+
: angle >= 135 && 225 >= angle
|
|
1967
|
+
? RIGHT
|
|
1968
|
+
: angle > 45 && 135 > angle
|
|
1969
|
+
? DOWN
|
|
1970
|
+
: UP;
|
|
1971
|
+
}
|
|
1972
|
+
function getTimeStamp() {
|
|
1973
|
+
var now = new Date();
|
|
1974
|
+
return now.getTime();
|
|
1975
|
+
}
|
|
1976
|
+
function getbounds(el) {
|
|
1977
|
+
el = $(el);
|
|
1978
|
+
var offset = el.offset(),
|
|
1979
|
+
bounds = {
|
|
1980
|
+
left: offset.left,
|
|
1981
|
+
right: offset.left + el.outerWidth(),
|
|
1982
|
+
top: offset.top,
|
|
1983
|
+
bottom: offset.top + el.outerHeight(),
|
|
1984
|
+
};
|
|
1985
|
+
return bounds;
|
|
1986
|
+
}
|
|
1987
|
+
function isInBounds(point, bounds) {
|
|
1988
|
+
return (
|
|
1989
|
+
point.x > bounds.left &&
|
|
1990
|
+
point.x < bounds.right &&
|
|
1991
|
+
point.y > bounds.top &&
|
|
1992
|
+
point.y < bounds.bottom
|
|
1993
|
+
);
|
|
1994
|
+
}
|
|
1995
|
+
function comparePoints(pointA, pointB) {
|
|
1996
|
+
return pointA.x == pointB.x && pointA.y == pointB.y;
|
|
1997
|
+
}
|
|
1998
|
+
var options = $.extend({}, options),
|
|
1999
|
+
useTouchEvents = SUPPORTS_TOUCH || SUPPORTS_POINTER || !options.fallbackToMouseEvents,
|
|
2000
|
+
START_EV = useTouchEvents
|
|
2001
|
+
? SUPPORTS_POINTER
|
|
2002
|
+
? SUPPORTS_POINTER_IE10
|
|
2003
|
+
? 'MSPointerDown'
|
|
2004
|
+
: 'pointerdown'
|
|
2005
|
+
: 'touchstart'
|
|
2006
|
+
: 'mousedown',
|
|
2007
|
+
MOVE_EV = useTouchEvents
|
|
2008
|
+
? SUPPORTS_POINTER
|
|
2009
|
+
? SUPPORTS_POINTER_IE10
|
|
2010
|
+
? 'MSPointerMove'
|
|
2011
|
+
: 'pointermove'
|
|
2012
|
+
: 'touchmove'
|
|
2013
|
+
: 'mousemove',
|
|
2014
|
+
END_EV = useTouchEvents
|
|
2015
|
+
? SUPPORTS_POINTER
|
|
2016
|
+
? SUPPORTS_POINTER_IE10
|
|
2017
|
+
? 'MSPointerUp'
|
|
2018
|
+
: 'pointerup'
|
|
2019
|
+
: 'touchend'
|
|
2020
|
+
: 'mouseup',
|
|
2021
|
+
LEAVE_EV = useTouchEvents ? (SUPPORTS_POINTER ? 'mouseleave' : null) : 'mouseleave',
|
|
2022
|
+
CANCEL_EV = SUPPORTS_POINTER
|
|
2023
|
+
? SUPPORTS_POINTER_IE10
|
|
2024
|
+
? 'MSPointerCancel'
|
|
2025
|
+
: 'pointercancel'
|
|
2026
|
+
: 'touchcancel',
|
|
2027
|
+
distance = 0,
|
|
2028
|
+
direction = null,
|
|
2029
|
+
currentDirection = null,
|
|
2030
|
+
duration = 0,
|
|
2031
|
+
startTouchesDistance = 0,
|
|
2032
|
+
endTouchesDistance = 0,
|
|
2033
|
+
pinchZoom = 1,
|
|
2034
|
+
pinchDistance = 0,
|
|
2035
|
+
pinchDirection = 0,
|
|
2036
|
+
maximumsMap = null,
|
|
2037
|
+
$element = $(element),
|
|
2038
|
+
phase = 'start',
|
|
2039
|
+
fingerCount = 0,
|
|
2040
|
+
fingerData = {},
|
|
2041
|
+
startTime = 0,
|
|
2042
|
+
endTime = 0,
|
|
2043
|
+
previousTouchEndTime = 0,
|
|
2044
|
+
fingerCountAtRelease = 0,
|
|
2045
|
+
doubleTapStartTime = 0,
|
|
2046
|
+
singleTapTimeout = null,
|
|
2047
|
+
holdTimeout = null;
|
|
2048
|
+
try {
|
|
2049
|
+
$element.on(START_EV, touchStart), $element.on(CANCEL_EV, touchCancel);
|
|
2050
|
+
} catch (e) {
|
|
2051
|
+
$.error('events not supported ' + START_EV + ',' + CANCEL_EV + ' on jQuery.swipe');
|
|
2052
|
+
}
|
|
2053
|
+
(this.enable = function () {
|
|
2054
|
+
return (
|
|
2055
|
+
this.disable(),
|
|
2056
|
+
$element.on(START_EV, touchStart),
|
|
2057
|
+
$element.on(CANCEL_EV, touchCancel),
|
|
2058
|
+
$element
|
|
2059
|
+
);
|
|
2060
|
+
}),
|
|
2061
|
+
(this.disable = function () {
|
|
2062
|
+
return removeListeners(), $element;
|
|
2063
|
+
}),
|
|
2064
|
+
(this.destroy = function () {
|
|
2065
|
+
removeListeners(), $element.data(PLUGIN_NS, null), ($element = null);
|
|
2066
|
+
}),
|
|
2067
|
+
(this.option = function (property, value) {
|
|
2068
|
+
if ('object' == typeof property) options = $.extend(options, property);
|
|
2069
|
+
else if (void 0 !== options[property]) {
|
|
2070
|
+
if (void 0 === value) return options[property];
|
|
2071
|
+
options[property] = value;
|
|
2072
|
+
} else {
|
|
2073
|
+
if (!property) return options;
|
|
2074
|
+
$.error('Option ' + property + ' does not exist on jQuery.swipe.options');
|
|
2075
|
+
}
|
|
2076
|
+
return null;
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
var VERSION = '1.6.18',
|
|
2080
|
+
LEFT = 'left',
|
|
2081
|
+
RIGHT = 'right',
|
|
2082
|
+
UP = 'up',
|
|
2083
|
+
DOWN = 'down',
|
|
2084
|
+
IN = 'in',
|
|
2085
|
+
OUT = 'out',
|
|
2086
|
+
NONE = 'none',
|
|
2087
|
+
AUTO = 'auto',
|
|
2088
|
+
SWIPE = 'swipe',
|
|
2089
|
+
PINCH = 'pinch',
|
|
2090
|
+
TAP = 'tap',
|
|
2091
|
+
DOUBLE_TAP = 'doubletap',
|
|
2092
|
+
LONG_TAP = 'longtap',
|
|
2093
|
+
HORIZONTAL = 'horizontal',
|
|
2094
|
+
VERTICAL = 'vertical',
|
|
2095
|
+
ALL_FINGERS = 'all',
|
|
2096
|
+
DOUBLE_TAP_THRESHOLD = 10,
|
|
2097
|
+
PHASE_START = 'start',
|
|
2098
|
+
PHASE_MOVE = 'move',
|
|
2099
|
+
PHASE_END = 'end',
|
|
2100
|
+
PHASE_CANCEL = 'cancel',
|
|
2101
|
+
SUPPORTS_TOUCH = 'ontouchstart' in window,
|
|
2102
|
+
SUPPORTS_POINTER_IE10 =
|
|
2103
|
+
window.navigator.msPointerEnabled && !window.PointerEvent && !SUPPORTS_TOUCH,
|
|
2104
|
+
SUPPORTS_POINTER =
|
|
2105
|
+
(window.PointerEvent || window.navigator.msPointerEnabled) && !SUPPORTS_TOUCH,
|
|
2106
|
+
PLUGIN_NS = 'TouchSwipe',
|
|
2107
|
+
defaults = {
|
|
2108
|
+
fingers: 1,
|
|
2109
|
+
threshold: 75,
|
|
2110
|
+
cancelThreshold: null,
|
|
2111
|
+
pinchThreshold: 20,
|
|
2112
|
+
maxTimeThreshold: null,
|
|
2113
|
+
fingerReleaseThreshold: 250,
|
|
2114
|
+
longTapThreshold: 500,
|
|
2115
|
+
doubleTapThreshold: 200,
|
|
2116
|
+
swipe: null,
|
|
2117
|
+
swipeLeft: null,
|
|
2118
|
+
swipeRight: null,
|
|
2119
|
+
swipeUp: null,
|
|
2120
|
+
swipeDown: null,
|
|
2121
|
+
swipeStatus: null,
|
|
2122
|
+
pinchIn: null,
|
|
2123
|
+
pinchOut: null,
|
|
2124
|
+
pinchStatus: null,
|
|
2125
|
+
click: null,
|
|
2126
|
+
tap: null,
|
|
2127
|
+
doubleTap: null,
|
|
2128
|
+
longTap: null,
|
|
2129
|
+
hold: null,
|
|
2130
|
+
triggerOnTouchEnd: !0,
|
|
2131
|
+
triggerOnTouchLeave: !1,
|
|
2132
|
+
allowPageScroll: 'auto',
|
|
2133
|
+
fallbackToMouseEvents: !0,
|
|
2134
|
+
excludedElements: '.noSwipe',
|
|
2135
|
+
preventDefaultEvents: !0,
|
|
2136
|
+
};
|
|
2137
|
+
($.fn.swipe = function (method) {
|
|
2138
|
+
var $this = $(this),
|
|
2139
|
+
plugin = $this.data(PLUGIN_NS);
|
|
2140
|
+
if (plugin && 'string' == typeof method) {
|
|
2141
|
+
if (plugin[method])
|
|
2142
|
+
return plugin[method].apply(plugin, Array.prototype.slice.call(arguments, 1));
|
|
2143
|
+
$.error('Method ' + method + ' does not exist on jQuery.swipe');
|
|
2144
|
+
} else if (plugin && 'object' == typeof method) plugin.option.apply(plugin, arguments);
|
|
2145
|
+
else if (!(plugin || ('object' != typeof method && method))) return init.apply(this, arguments);
|
|
2146
|
+
return $this;
|
|
2147
|
+
}),
|
|
2148
|
+
($.fn.swipe.version = VERSION),
|
|
2149
|
+
($.fn.swipe.defaults = defaults),
|
|
2150
|
+
($.fn.swipe.phases = {
|
|
2151
|
+
PHASE_START: PHASE_START,
|
|
2152
|
+
PHASE_MOVE: PHASE_MOVE,
|
|
2153
|
+
PHASE_END: PHASE_END,
|
|
2154
|
+
PHASE_CANCEL: PHASE_CANCEL,
|
|
2155
|
+
}),
|
|
2156
|
+
($.fn.swipe.directions = {LEFT: LEFT, RIGHT: RIGHT, UP: UP, DOWN: DOWN, IN: IN, OUT: OUT}),
|
|
2157
|
+
($.fn.swipe.pageScroll = {NONE: NONE, HORIZONTAL: HORIZONTAL, VERTICAL: VERTICAL, AUTO: AUTO}),
|
|
2158
|
+
($.fn.swipe.fingers = {ONE: 1, TWO: 2, THREE: 3, FOUR: 4, FIVE: 5, ALL: ALL_FINGERS});
|
|
2159
|
+
});
|
|
831
2160
|
// TinyColor v1.4.1
|
|
832
2161
|
// https://github.com/bgrins/TinyColor
|
|
833
2162
|
// 2016-07-07, Brian Grinstead, MIT License
|
|
834
|
-
!function(a){function b(a,d){if(a=a?a:"",d=d||{},a instanceof b)return a;if(!(this instanceof b))return new b(a,d);var e=c(a);this._originalInput=a,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=P(100*this._a)/100,this._format=d.format||e.format,this._gradientType=d.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=e.ok,this._tc_id=O++}function c(a){var b={r:0,g:0,b:0},c=1,e=null,g=null,i=null,j=!1,k=!1;return"string"==typeof a&&(a=K(a)),"object"==typeof a&&(J(a.r)&&J(a.g)&&J(a.b)?(b=d(a.r,a.g,a.b),j=!0,k="%"===String(a.r).substr(-1)?"prgb":"rgb"):J(a.h)&&J(a.s)&&J(a.v)?(e=G(a.s),g=G(a.v),b=h(a.h,e,g),j=!0,k="hsv"):J(a.h)&&J(a.s)&&J(a.l)&&(e=G(a.s),i=G(a.l),b=f(a.h,e,i),j=!0,k="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=z(c),{ok:j,format:a.format||k,r:Q(255,R(b.r,0)),g:Q(255,R(b.g,0)),b:Q(255,R(b.b,0)),a:c}}function d(a,b,c){return{r:255*A(a,255),g:255*A(b,255),b:255*A(c,255)}}function e(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,l:h}}function f(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+6*(b-a)*(2/3-c):a}var e,f,g;if(a=A(a,360),b=A(b,100),c=A(c,100),0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function g(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,v:h}}function h(b,c,d){b=6*A(b,360),c=A(c,100),d=A(d,100);var e=a.floor(b),f=b-e,g=d*(1-c),h=d*(1-f*c),i=d*(1-(1-f)*c),j=e%6,k=[d,h,g,g,i,d][j],l=[i,d,d,h,g,g][j],m=[g,g,i,d,d,h][j];return{r:255*k,g:255*l,b:255*m}}function i(a,b,c,d){var e=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return d&&e[0].charAt(0)==e[0].charAt(1)&&e[1].charAt(0)==e[1].charAt(1)&&e[2].charAt(0)==e[2].charAt(1)?e[0].charAt(0)+e[1].charAt(0)+e[2].charAt(0):e.join("")}function j(a,b,c,d,e){var f=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16)),F(H(d))];return e&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function k(a,b,c,d){var e=[F(H(d)),F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return e.join("")}function l(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=B(d.s),b(d)}function m(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=B(d.s),b(d)}function n(a){return b(a).desaturate(100)}function o(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=B(d.l),b(d)}function p(a,c){c=0===c?0:c||10;var d=b(a).toRgb();return d.r=R(0,Q(255,d.r-P(255*-(c/100)))),d.g=R(0,Q(255,d.g-P(255*-(c/100)))),d.b=R(0,Q(255,d.b-P(255*-(c/100)))),b(d)}function q(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=B(d.l),b(d)}function r(a,c){var d=b(a).toHsl(),e=(d.h+c)%360;return d.h=0>e?360+e:e,b(d)}function s(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)}function t(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]}function u(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]}function v(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]}function w(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g}function x(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h}function y(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function z(a){return a=parseFloat(a),(isNaN(a)||0>a||a>1)&&(a=1),a}function A(b,c){D(b)&&(b="100%");var d=E(b);return b=Q(c,R(0,parseFloat(b))),d&&(b=parseInt(b*c,10)/100),a.abs(b-c)<1e-6?1:b%c/parseFloat(c)}function B(a){return Q(1,R(0,a))}function C(a){return parseInt(a,16)}function D(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function E(a){return"string"==typeof a&&-1!=a.indexOf("%")}function F(a){return 1==a.length?"0"+a:""+a}function G(a){return 1>=a&&(a=100*a+"%"),a}function H(b){return a.round(255*parseFloat(b)).toString(16)}function I(a){return C(a)/255}function J(a){return!!V.CSS_UNIT.exec(a)}function K(a){a=a.replace(M,"").replace(N,"").toLowerCase();var b=!1;if(T[a])a=T[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=V.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=V.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=V.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=V.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=V.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=V.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=V.hex8.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),a:I(c[4]),format:b?"name":"hex8"}:(c=V.hex6.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),format:b?"name":"hex"}:(c=V.hex4.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),a:I(c[4]+""+c[4]),format:b?"name":"hex8"}:(c=V.hex3.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),format:b?"name":"hex"}:!1}function L(a){var b,c;return a=a||{level:"AA",size:"small"},b=(a.level||"AA").toUpperCase(),c=(a.size||"small").toLowerCase(),"AA"!==b&&"AAA"!==b&&(b="AA"),"small"!==c&&"large"!==c&&(c="small"),{level:b,size:c}}var M=/^\s+/,N=/\s+$/,O=0,P=a.round,Q=a.min,R=a.max,S=a.random;b.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},getLuminance:function(){var b,c,d,e,f,g,h=this.toRgb();return b=h.r/255,c=h.g/255,d=h.b/255,e=.03928>=b?b/12.92:a.pow((b+.055)/1.055,2.4),f=.03928>=c?c/12.92:a.pow((c+.055)/1.055,2.4),g=.03928>=d?d/12.92:a.pow((d+.055)/1.055,2.4),.2126*e+.7152*f+.0722*g},setAlpha:function(a){return this._a=z(a),this._roundA=P(100*this._a)/100,this},toHsv:function(){var a=g(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=g(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=e(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.l);return 1==this._a?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHex:function(a){return i(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return j(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*A(this._r,255))+"%",g:P(100*A(this._g,255))+"%",b:P(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%)":"rgba("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:U[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var c="#"+k(this._r,this._g,this._b,this._a),d=c,e=this._gradientType?"GradientType = 1, ":"";if(a){var f=b(a);d="#"+k(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+e+"startColorstr="+c+",endColorstr="+d+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0,e=!b&&d&&("hex"===a||"hex6"===a||"hex3"===a||"hex4"===a||"hex8"===a||"name"===a);return e?"name"===a&&0===this._a?this.toName():this.toRgbString():("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),("hex"===a||"hex6"===a)&&(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex4"===a&&(c=this.toHex8String(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString())},clone:function(){return b(this.toString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(o,arguments)},brighten:function(){return this._applyModification(p,arguments)},darken:function(){return this._applyModification(q,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(n,arguments)},spin:function(){return this._applyModification(r,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(s,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(t,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&(d[e]="a"===e?a[e]:G(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return a&&c?b(a).toRgbString()==b(c).toRgbString():!1},b.random=function(){return b.fromRatio({r:S(),g:S(),b:S()})},b.mix=function(a,c,d){d=0===d?0:d||50;var e=b(a).toRgb(),f=b(c).toRgb(),g=d/100,h={r:(f.r-e.r)*g+e.r,g:(f.g-e.g)*g+e.g,b:(f.b-e.b)*g+e.b,a:(f.a-e.a)*g+e.a};return b(h)},b.readability=function(c,d){var e=b(c),f=b(d);return(a.max(e.getLuminance(),f.getLuminance())+.05)/(a.min(e.getLuminance(),f.getLuminance())+.05)},b.isReadable=function(a,c,d){var e,f,g=b.readability(a,c);switch(f=!1,e=L(d),e.level+e.size){case"AAsmall":case"AAAlarge":f=g>=4.5;break;case"AAlarge":f=g>=3;break;case"AAAsmall":f=g>=7}return f},b.mostReadable=function(a,c,d){var e,f,g,h,i=null,j=0;d=d||{},f=d.includeFallbackColors,g=d.level,h=d.size;for(var k=0;k<c.length;k++)e=b.readability(a,c[k]),e>j&&(j=e,i=b(c[k]));return b.isReadable(a,i,{level:g,size:h})||!f?i:(d.includeFallbackColors=!1,b.mostReadable(a,["#fff","#000"],d))};var T=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=b.hexNames=y(T),V=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hsva:new RegExp("hsva"+e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof module&&module.exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):window.tinycolor=b}(Math);
|
|
835
|
-
|
|
2163
|
+
!(function (a) {
|
|
2164
|
+
function b(a, d) {
|
|
2165
|
+
if (((a = a ? a : ''), (d = d || {}), a instanceof b)) return a;
|
|
2166
|
+
if (!(this instanceof b)) return new b(a, d);
|
|
2167
|
+
var e = c(a);
|
|
2168
|
+
(this._originalInput = a),
|
|
2169
|
+
(this._r = e.r),
|
|
2170
|
+
(this._g = e.g),
|
|
2171
|
+
(this._b = e.b),
|
|
2172
|
+
(this._a = e.a),
|
|
2173
|
+
(this._roundA = P(100 * this._a) / 100),
|
|
2174
|
+
(this._format = d.format || e.format),
|
|
2175
|
+
(this._gradientType = d.gradientType),
|
|
2176
|
+
this._r < 1 && (this._r = P(this._r)),
|
|
2177
|
+
this._g < 1 && (this._g = P(this._g)),
|
|
2178
|
+
this._b < 1 && (this._b = P(this._b)),
|
|
2179
|
+
(this._ok = e.ok),
|
|
2180
|
+
(this._tc_id = O++);
|
|
2181
|
+
}
|
|
2182
|
+
function c(a) {
|
|
2183
|
+
var b = {r: 0, g: 0, b: 0},
|
|
2184
|
+
c = 1,
|
|
2185
|
+
e = null,
|
|
2186
|
+
g = null,
|
|
2187
|
+
i = null,
|
|
2188
|
+
j = !1,
|
|
2189
|
+
k = !1;
|
|
2190
|
+
return (
|
|
2191
|
+
'string' == typeof a && (a = K(a)),
|
|
2192
|
+
'object' == typeof a &&
|
|
2193
|
+
(J(a.r) && J(a.g) && J(a.b)
|
|
2194
|
+
? ((b = d(a.r, a.g, a.b)),
|
|
2195
|
+
(j = !0),
|
|
2196
|
+
(k = '%' === String(a.r).substr(-1) ? 'prgb' : 'rgb'))
|
|
2197
|
+
: J(a.h) && J(a.s) && J(a.v)
|
|
2198
|
+
? ((e = G(a.s)), (g = G(a.v)), (b = h(a.h, e, g)), (j = !0), (k = 'hsv'))
|
|
2199
|
+
: J(a.h) &&
|
|
2200
|
+
J(a.s) &&
|
|
2201
|
+
J(a.l) &&
|
|
2202
|
+
((e = G(a.s)), (i = G(a.l)), (b = f(a.h, e, i)), (j = !0), (k = 'hsl')),
|
|
2203
|
+
a.hasOwnProperty('a') && (c = a.a)),
|
|
2204
|
+
(c = z(c)),
|
|
2205
|
+
{
|
|
2206
|
+
ok: j,
|
|
2207
|
+
format: a.format || k,
|
|
2208
|
+
r: Q(255, R(b.r, 0)),
|
|
2209
|
+
g: Q(255, R(b.g, 0)),
|
|
2210
|
+
b: Q(255, R(b.b, 0)),
|
|
2211
|
+
a: c,
|
|
2212
|
+
}
|
|
2213
|
+
);
|
|
2214
|
+
}
|
|
2215
|
+
function d(a, b, c) {
|
|
2216
|
+
return {r: 255 * A(a, 255), g: 255 * A(b, 255), b: 255 * A(c, 255)};
|
|
2217
|
+
}
|
|
2218
|
+
function e(a, b, c) {
|
|
2219
|
+
(a = A(a, 255)), (b = A(b, 255)), (c = A(c, 255));
|
|
2220
|
+
var d,
|
|
2221
|
+
e,
|
|
2222
|
+
f = R(a, b, c),
|
|
2223
|
+
g = Q(a, b, c),
|
|
2224
|
+
h = (f + g) / 2;
|
|
2225
|
+
if (f == g) d = e = 0;
|
|
2226
|
+
else {
|
|
2227
|
+
var i = f - g;
|
|
2228
|
+
switch (((e = h > 0.5 ? i / (2 - f - g) : i / (f + g)), f)) {
|
|
2229
|
+
case a:
|
|
2230
|
+
d = (b - c) / i + (c > b ? 6 : 0);
|
|
2231
|
+
break;
|
|
2232
|
+
case b:
|
|
2233
|
+
d = (c - a) / i + 2;
|
|
2234
|
+
break;
|
|
2235
|
+
case c:
|
|
2236
|
+
d = (a - b) / i + 4;
|
|
2237
|
+
}
|
|
2238
|
+
d /= 6;
|
|
2239
|
+
}
|
|
2240
|
+
return {h: d, s: e, l: h};
|
|
2241
|
+
}
|
|
2242
|
+
function f(a, b, c) {
|
|
2243
|
+
function d(a, b, c) {
|
|
2244
|
+
return (
|
|
2245
|
+
0 > c && (c += 1),
|
|
2246
|
+
c > 1 && (c -= 1),
|
|
2247
|
+
1 / 6 > c
|
|
2248
|
+
? a + 6 * (b - a) * c
|
|
2249
|
+
: 0.5 > c
|
|
2250
|
+
? b
|
|
2251
|
+
: 2 / 3 > c
|
|
2252
|
+
? a + 6 * (b - a) * (2 / 3 - c)
|
|
2253
|
+
: a
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
var e, f, g;
|
|
2257
|
+
if (((a = A(a, 360)), (b = A(b, 100)), (c = A(c, 100)), 0 === b)) e = f = g = c;
|
|
2258
|
+
else {
|
|
2259
|
+
var h = 0.5 > c ? c * (1 + b) : c + b - c * b,
|
|
2260
|
+
i = 2 * c - h;
|
|
2261
|
+
(e = d(i, h, a + 1 / 3)), (f = d(i, h, a)), (g = d(i, h, a - 1 / 3));
|
|
2262
|
+
}
|
|
2263
|
+
return {r: 255 * e, g: 255 * f, b: 255 * g};
|
|
2264
|
+
}
|
|
2265
|
+
function g(a, b, c) {
|
|
2266
|
+
(a = A(a, 255)), (b = A(b, 255)), (c = A(c, 255));
|
|
2267
|
+
var d,
|
|
2268
|
+
e,
|
|
2269
|
+
f = R(a, b, c),
|
|
2270
|
+
g = Q(a, b, c),
|
|
2271
|
+
h = f,
|
|
2272
|
+
i = f - g;
|
|
2273
|
+
if (((e = 0 === f ? 0 : i / f), f == g)) d = 0;
|
|
2274
|
+
else {
|
|
2275
|
+
switch (f) {
|
|
2276
|
+
case a:
|
|
2277
|
+
d = (b - c) / i + (c > b ? 6 : 0);
|
|
2278
|
+
break;
|
|
2279
|
+
case b:
|
|
2280
|
+
d = (c - a) / i + 2;
|
|
2281
|
+
break;
|
|
2282
|
+
case c:
|
|
2283
|
+
d = (a - b) / i + 4;
|
|
2284
|
+
}
|
|
2285
|
+
d /= 6;
|
|
2286
|
+
}
|
|
2287
|
+
return {h: d, s: e, v: h};
|
|
2288
|
+
}
|
|
2289
|
+
function h(b, c, d) {
|
|
2290
|
+
(b = 6 * A(b, 360)), (c = A(c, 100)), (d = A(d, 100));
|
|
2291
|
+
var e = a.floor(b),
|
|
2292
|
+
f = b - e,
|
|
2293
|
+
g = d * (1 - c),
|
|
2294
|
+
h = d * (1 - f * c),
|
|
2295
|
+
i = d * (1 - (1 - f) * c),
|
|
2296
|
+
j = e % 6,
|
|
2297
|
+
k = [d, h, g, g, i, d][j],
|
|
2298
|
+
l = [i, d, d, h, g, g][j],
|
|
2299
|
+
m = [g, g, i, d, d, h][j];
|
|
2300
|
+
return {r: 255 * k, g: 255 * l, b: 255 * m};
|
|
2301
|
+
}
|
|
2302
|
+
function i(a, b, c, d) {
|
|
2303
|
+
var e = [F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16))];
|
|
2304
|
+
return d &&
|
|
2305
|
+
e[0].charAt(0) == e[0].charAt(1) &&
|
|
2306
|
+
e[1].charAt(0) == e[1].charAt(1) &&
|
|
2307
|
+
e[2].charAt(0) == e[2].charAt(1)
|
|
2308
|
+
? e[0].charAt(0) + e[1].charAt(0) + e[2].charAt(0)
|
|
2309
|
+
: e.join('');
|
|
2310
|
+
}
|
|
2311
|
+
function j(a, b, c, d, e) {
|
|
2312
|
+
var f = [F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16)), F(H(d))];
|
|
2313
|
+
return e &&
|
|
2314
|
+
f[0].charAt(0) == f[0].charAt(1) &&
|
|
2315
|
+
f[1].charAt(0) == f[1].charAt(1) &&
|
|
2316
|
+
f[2].charAt(0) == f[2].charAt(1) &&
|
|
2317
|
+
f[3].charAt(0) == f[3].charAt(1)
|
|
2318
|
+
? f[0].charAt(0) + f[1].charAt(0) + f[2].charAt(0) + f[3].charAt(0)
|
|
2319
|
+
: f.join('');
|
|
2320
|
+
}
|
|
2321
|
+
function k(a, b, c, d) {
|
|
2322
|
+
var e = [F(H(d)), F(P(a).toString(16)), F(P(b).toString(16)), F(P(c).toString(16))];
|
|
2323
|
+
return e.join('');
|
|
2324
|
+
}
|
|
2325
|
+
function l(a, c) {
|
|
2326
|
+
c = 0 === c ? 0 : c || 10;
|
|
2327
|
+
var d = b(a).toHsl();
|
|
2328
|
+
return (d.s -= c / 100), (d.s = B(d.s)), b(d);
|
|
2329
|
+
}
|
|
2330
|
+
function m(a, c) {
|
|
2331
|
+
c = 0 === c ? 0 : c || 10;
|
|
2332
|
+
var d = b(a).toHsl();
|
|
2333
|
+
return (d.s += c / 100), (d.s = B(d.s)), b(d);
|
|
2334
|
+
}
|
|
2335
|
+
function n(a) {
|
|
2336
|
+
return b(a).desaturate(100);
|
|
2337
|
+
}
|
|
2338
|
+
function o(a, c) {
|
|
2339
|
+
c = 0 === c ? 0 : c || 10;
|
|
2340
|
+
var d = b(a).toHsl();
|
|
2341
|
+
return (d.l += c / 100), (d.l = B(d.l)), b(d);
|
|
2342
|
+
}
|
|
2343
|
+
function p(a, c) {
|
|
2344
|
+
c = 0 === c ? 0 : c || 10;
|
|
2345
|
+
var d = b(a).toRgb();
|
|
2346
|
+
return (
|
|
2347
|
+
(d.r = R(0, Q(255, d.r - P(255 * -(c / 100))))),
|
|
2348
|
+
(d.g = R(0, Q(255, d.g - P(255 * -(c / 100))))),
|
|
2349
|
+
(d.b = R(0, Q(255, d.b - P(255 * -(c / 100))))),
|
|
2350
|
+
b(d)
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
function q(a, c) {
|
|
2354
|
+
c = 0 === c ? 0 : c || 10;
|
|
2355
|
+
var d = b(a).toHsl();
|
|
2356
|
+
return (d.l -= c / 100), (d.l = B(d.l)), b(d);
|
|
2357
|
+
}
|
|
2358
|
+
function r(a, c) {
|
|
2359
|
+
var d = b(a).toHsl(),
|
|
2360
|
+
e = (d.h + c) % 360;
|
|
2361
|
+
return (d.h = 0 > e ? 360 + e : e), b(d);
|
|
2362
|
+
}
|
|
2363
|
+
function s(a) {
|
|
2364
|
+
var c = b(a).toHsl();
|
|
2365
|
+
return (c.h = (c.h + 180) % 360), b(c);
|
|
2366
|
+
}
|
|
2367
|
+
function t(a) {
|
|
2368
|
+
var c = b(a).toHsl(),
|
|
2369
|
+
d = c.h;
|
|
2370
|
+
return [b(a), b({h: (d + 120) % 360, s: c.s, l: c.l}), b({h: (d + 240) % 360, s: c.s, l: c.l})];
|
|
2371
|
+
}
|
|
2372
|
+
function u(a) {
|
|
2373
|
+
var c = b(a).toHsl(),
|
|
2374
|
+
d = c.h;
|
|
2375
|
+
return [
|
|
2376
|
+
b(a),
|
|
2377
|
+
b({h: (d + 90) % 360, s: c.s, l: c.l}),
|
|
2378
|
+
b({h: (d + 180) % 360, s: c.s, l: c.l}),
|
|
2379
|
+
b({h: (d + 270) % 360, s: c.s, l: c.l}),
|
|
2380
|
+
];
|
|
2381
|
+
}
|
|
2382
|
+
function v(a) {
|
|
2383
|
+
var c = b(a).toHsl(),
|
|
2384
|
+
d = c.h;
|
|
2385
|
+
return [b(a), b({h: (d + 72) % 360, s: c.s, l: c.l}), b({h: (d + 216) % 360, s: c.s, l: c.l})];
|
|
2386
|
+
}
|
|
2387
|
+
function w(a, c, d) {
|
|
2388
|
+
(c = c || 6), (d = d || 30);
|
|
2389
|
+
var e = b(a).toHsl(),
|
|
2390
|
+
f = 360 / d,
|
|
2391
|
+
g = [b(a)];
|
|
2392
|
+
for (e.h = (e.h - ((f * c) >> 1) + 720) % 360; --c; ) (e.h = (e.h + f) % 360), g.push(b(e));
|
|
2393
|
+
return g;
|
|
2394
|
+
}
|
|
2395
|
+
function x(a, c) {
|
|
2396
|
+
c = c || 6;
|
|
2397
|
+
for (var d = b(a).toHsv(), e = d.h, f = d.s, g = d.v, h = [], i = 1 / c; c--; )
|
|
2398
|
+
h.push(b({h: e, s: f, v: g})), (g = (g + i) % 1);
|
|
2399
|
+
return h;
|
|
2400
|
+
}
|
|
2401
|
+
function y(a) {
|
|
2402
|
+
var b = {};
|
|
2403
|
+
for (var c in a) a.hasOwnProperty(c) && (b[a[c]] = c);
|
|
2404
|
+
return b;
|
|
2405
|
+
}
|
|
2406
|
+
function z(a) {
|
|
2407
|
+
return (a = parseFloat(a)), (isNaN(a) || 0 > a || a > 1) && (a = 1), a;
|
|
2408
|
+
}
|
|
2409
|
+
function A(b, c) {
|
|
2410
|
+
D(b) && (b = '100%');
|
|
2411
|
+
var d = E(b);
|
|
2412
|
+
return (
|
|
2413
|
+
(b = Q(c, R(0, parseFloat(b)))),
|
|
2414
|
+
d && (b = parseInt(b * c, 10) / 100),
|
|
2415
|
+
a.abs(b - c) < 1e-6 ? 1 : (b % c) / parseFloat(c)
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
function B(a) {
|
|
2419
|
+
return Q(1, R(0, a));
|
|
2420
|
+
}
|
|
2421
|
+
function C(a) {
|
|
2422
|
+
return parseInt(a, 16);
|
|
2423
|
+
}
|
|
2424
|
+
function D(a) {
|
|
2425
|
+
return 'string' == typeof a && -1 != a.indexOf('.') && 1 === parseFloat(a);
|
|
2426
|
+
}
|
|
2427
|
+
function E(a) {
|
|
2428
|
+
return 'string' == typeof a && -1 != a.indexOf('%');
|
|
2429
|
+
}
|
|
2430
|
+
function F(a) {
|
|
2431
|
+
return 1 == a.length ? '0' + a : '' + a;
|
|
2432
|
+
}
|
|
2433
|
+
function G(a) {
|
|
2434
|
+
return 1 >= a && (a = 100 * a + '%'), a;
|
|
2435
|
+
}
|
|
2436
|
+
function H(b) {
|
|
2437
|
+
return a.round(255 * parseFloat(b)).toString(16);
|
|
2438
|
+
}
|
|
2439
|
+
function I(a) {
|
|
2440
|
+
return C(a) / 255;
|
|
2441
|
+
}
|
|
2442
|
+
function J(a) {
|
|
2443
|
+
return !!V.CSS_UNIT.exec(a);
|
|
2444
|
+
}
|
|
2445
|
+
function K(a) {
|
|
2446
|
+
a = a.replace(M, '').replace(N, '').toLowerCase();
|
|
2447
|
+
var b = !1;
|
|
2448
|
+
if (T[a]) (a = T[a]), (b = !0);
|
|
2449
|
+
else if ('transparent' == a) return {r: 0, g: 0, b: 0, a: 0, format: 'name'};
|
|
2450
|
+
var c;
|
|
2451
|
+
return (c = V.rgb.exec(a))
|
|
2452
|
+
? {r: c[1], g: c[2], b: c[3]}
|
|
2453
|
+
: (c = V.rgba.exec(a))
|
|
2454
|
+
? {r: c[1], g: c[2], b: c[3], a: c[4]}
|
|
2455
|
+
: (c = V.hsl.exec(a))
|
|
2456
|
+
? {h: c[1], s: c[2], l: c[3]}
|
|
2457
|
+
: (c = V.hsla.exec(a))
|
|
2458
|
+
? {h: c[1], s: c[2], l: c[3], a: c[4]}
|
|
2459
|
+
: (c = V.hsv.exec(a))
|
|
2460
|
+
? {h: c[1], s: c[2], v: c[3]}
|
|
2461
|
+
: (c = V.hsva.exec(a))
|
|
2462
|
+
? {h: c[1], s: c[2], v: c[3], a: c[4]}
|
|
2463
|
+
: (c = V.hex8.exec(a))
|
|
2464
|
+
? {r: C(c[1]), g: C(c[2]), b: C(c[3]), a: I(c[4]), format: b ? 'name' : 'hex8'}
|
|
2465
|
+
: (c = V.hex6.exec(a))
|
|
2466
|
+
? {r: C(c[1]), g: C(c[2]), b: C(c[3]), format: b ? 'name' : 'hex'}
|
|
2467
|
+
: (c = V.hex4.exec(a))
|
|
2468
|
+
? {
|
|
2469
|
+
r: C(c[1] + '' + c[1]),
|
|
2470
|
+
g: C(c[2] + '' + c[2]),
|
|
2471
|
+
b: C(c[3] + '' + c[3]),
|
|
2472
|
+
a: I(c[4] + '' + c[4]),
|
|
2473
|
+
format: b ? 'name' : 'hex8',
|
|
2474
|
+
}
|
|
2475
|
+
: (c = V.hex3.exec(a))
|
|
2476
|
+
? {
|
|
2477
|
+
r: C(c[1] + '' + c[1]),
|
|
2478
|
+
g: C(c[2] + '' + c[2]),
|
|
2479
|
+
b: C(c[3] + '' + c[3]),
|
|
2480
|
+
format: b ? 'name' : 'hex',
|
|
2481
|
+
}
|
|
2482
|
+
: !1;
|
|
2483
|
+
}
|
|
2484
|
+
function L(a) {
|
|
2485
|
+
var b, c;
|
|
2486
|
+
return (
|
|
2487
|
+
(a = a || {level: 'AA', size: 'small'}),
|
|
2488
|
+
(b = (a.level || 'AA').toUpperCase()),
|
|
2489
|
+
(c = (a.size || 'small').toLowerCase()),
|
|
2490
|
+
'AA' !== b && 'AAA' !== b && (b = 'AA'),
|
|
2491
|
+
'small' !== c && 'large' !== c && (c = 'small'),
|
|
2492
|
+
{level: b, size: c}
|
|
2493
|
+
);
|
|
2494
|
+
}
|
|
2495
|
+
var M = /^\s+/,
|
|
2496
|
+
N = /\s+$/,
|
|
2497
|
+
O = 0,
|
|
2498
|
+
P = a.round,
|
|
2499
|
+
Q = a.min,
|
|
2500
|
+
R = a.max,
|
|
2501
|
+
S = a.random;
|
|
2502
|
+
(b.prototype = {
|
|
2503
|
+
isDark: function () {
|
|
2504
|
+
return this.getBrightness() < 128;
|
|
2505
|
+
},
|
|
2506
|
+
isLight: function () {
|
|
2507
|
+
return !this.isDark();
|
|
2508
|
+
},
|
|
2509
|
+
isValid: function () {
|
|
2510
|
+
return this._ok;
|
|
2511
|
+
},
|
|
2512
|
+
getOriginalInput: function () {
|
|
2513
|
+
return this._originalInput;
|
|
2514
|
+
},
|
|
2515
|
+
getFormat: function () {
|
|
2516
|
+
return this._format;
|
|
2517
|
+
},
|
|
2518
|
+
getAlpha: function () {
|
|
2519
|
+
return this._a;
|
|
2520
|
+
},
|
|
2521
|
+
getBrightness: function () {
|
|
2522
|
+
var a = this.toRgb();
|
|
2523
|
+
return (299 * a.r + 587 * a.g + 114 * a.b) / 1e3;
|
|
2524
|
+
},
|
|
2525
|
+
getLuminance: function () {
|
|
2526
|
+
var b,
|
|
2527
|
+
c,
|
|
2528
|
+
d,
|
|
2529
|
+
e,
|
|
2530
|
+
f,
|
|
2531
|
+
g,
|
|
2532
|
+
h = this.toRgb();
|
|
2533
|
+
return (
|
|
2534
|
+
(b = h.r / 255),
|
|
2535
|
+
(c = h.g / 255),
|
|
2536
|
+
(d = h.b / 255),
|
|
2537
|
+
(e = 0.03928 >= b ? b / 12.92 : a.pow((b + 0.055) / 1.055, 2.4)),
|
|
2538
|
+
(f = 0.03928 >= c ? c / 12.92 : a.pow((c + 0.055) / 1.055, 2.4)),
|
|
2539
|
+
(g = 0.03928 >= d ? d / 12.92 : a.pow((d + 0.055) / 1.055, 2.4)),
|
|
2540
|
+
0.2126 * e + 0.7152 * f + 0.0722 * g
|
|
2541
|
+
);
|
|
2542
|
+
},
|
|
2543
|
+
setAlpha: function (a) {
|
|
2544
|
+
return (this._a = z(a)), (this._roundA = P(100 * this._a) / 100), this;
|
|
2545
|
+
},
|
|
2546
|
+
toHsv: function () {
|
|
2547
|
+
var a = g(this._r, this._g, this._b);
|
|
2548
|
+
return {h: 360 * a.h, s: a.s, v: a.v, a: this._a};
|
|
2549
|
+
},
|
|
2550
|
+
toHsvString: function () {
|
|
2551
|
+
var a = g(this._r, this._g, this._b),
|
|
2552
|
+
b = P(360 * a.h),
|
|
2553
|
+
c = P(100 * a.s),
|
|
2554
|
+
d = P(100 * a.v);
|
|
2555
|
+
return 1 == this._a
|
|
2556
|
+
? 'hsv(' + b + ', ' + c + '%, ' + d + '%)'
|
|
2557
|
+
: 'hsva(' + b + ', ' + c + '%, ' + d + '%, ' + this._roundA + ')';
|
|
2558
|
+
},
|
|
2559
|
+
toHsl: function () {
|
|
2560
|
+
var a = e(this._r, this._g, this._b);
|
|
2561
|
+
return {h: 360 * a.h, s: a.s, l: a.l, a: this._a};
|
|
2562
|
+
},
|
|
2563
|
+
toHslString: function () {
|
|
2564
|
+
var a = e(this._r, this._g, this._b),
|
|
2565
|
+
b = P(360 * a.h),
|
|
2566
|
+
c = P(100 * a.s),
|
|
2567
|
+
d = P(100 * a.l);
|
|
2568
|
+
return 1 == this._a
|
|
2569
|
+
? 'hsl(' + b + ', ' + c + '%, ' + d + '%)'
|
|
2570
|
+
: 'hsla(' + b + ', ' + c + '%, ' + d + '%, ' + this._roundA + ')';
|
|
2571
|
+
},
|
|
2572
|
+
toHex: function (a) {
|
|
2573
|
+
return i(this._r, this._g, this._b, a);
|
|
2574
|
+
},
|
|
2575
|
+
toHexString: function (a) {
|
|
2576
|
+
return '#' + this.toHex(a);
|
|
2577
|
+
},
|
|
2578
|
+
toHex8: function (a) {
|
|
2579
|
+
return j(this._r, this._g, this._b, this._a, a);
|
|
2580
|
+
},
|
|
2581
|
+
toHex8String: function (a) {
|
|
2582
|
+
return '#' + this.toHex8(a);
|
|
2583
|
+
},
|
|
2584
|
+
toRgb: function () {
|
|
2585
|
+
return {r: P(this._r), g: P(this._g), b: P(this._b), a: this._a};
|
|
2586
|
+
},
|
|
2587
|
+
toRgbString: function () {
|
|
2588
|
+
return 1 == this._a
|
|
2589
|
+
? 'rgb(' + P(this._r) + ', ' + P(this._g) + ', ' + P(this._b) + ')'
|
|
2590
|
+
: 'rgba(' + P(this._r) + ', ' + P(this._g) + ', ' + P(this._b) + ', ' + this._roundA + ')';
|
|
2591
|
+
},
|
|
2592
|
+
toPercentageRgb: function () {
|
|
2593
|
+
return {
|
|
2594
|
+
r: P(100 * A(this._r, 255)) + '%',
|
|
2595
|
+
g: P(100 * A(this._g, 255)) + '%',
|
|
2596
|
+
b: P(100 * A(this._b, 255)) + '%',
|
|
2597
|
+
a: this._a,
|
|
2598
|
+
};
|
|
2599
|
+
},
|
|
2600
|
+
toPercentageRgbString: function () {
|
|
2601
|
+
return 1 == this._a
|
|
2602
|
+
? 'rgb(' +
|
|
2603
|
+
P(100 * A(this._r, 255)) +
|
|
2604
|
+
'%, ' +
|
|
2605
|
+
P(100 * A(this._g, 255)) +
|
|
2606
|
+
'%, ' +
|
|
2607
|
+
P(100 * A(this._b, 255)) +
|
|
2608
|
+
'%)'
|
|
2609
|
+
: 'rgba(' +
|
|
2610
|
+
P(100 * A(this._r, 255)) +
|
|
2611
|
+
'%, ' +
|
|
2612
|
+
P(100 * A(this._g, 255)) +
|
|
2613
|
+
'%, ' +
|
|
2614
|
+
P(100 * A(this._b, 255)) +
|
|
2615
|
+
'%, ' +
|
|
2616
|
+
this._roundA +
|
|
2617
|
+
')';
|
|
2618
|
+
},
|
|
2619
|
+
toName: function () {
|
|
2620
|
+
return 0 === this._a
|
|
2621
|
+
? 'transparent'
|
|
2622
|
+
: this._a < 1
|
|
2623
|
+
? !1
|
|
2624
|
+
: U[i(this._r, this._g, this._b, !0)] || !1;
|
|
2625
|
+
},
|
|
2626
|
+
toFilter: function (a) {
|
|
2627
|
+
var c = '#' + k(this._r, this._g, this._b, this._a),
|
|
2628
|
+
d = c,
|
|
2629
|
+
e = this._gradientType ? 'GradientType = 1, ' : '';
|
|
2630
|
+
if (a) {
|
|
2631
|
+
var f = b(a);
|
|
2632
|
+
d = '#' + k(f._r, f._g, f._b, f._a);
|
|
2633
|
+
}
|
|
2634
|
+
return (
|
|
2635
|
+
'progid:DXImageTransform.Microsoft.gradient(' +
|
|
2636
|
+
e +
|
|
2637
|
+
'startColorstr=' +
|
|
2638
|
+
c +
|
|
2639
|
+
',endColorstr=' +
|
|
2640
|
+
d +
|
|
2641
|
+
')'
|
|
2642
|
+
);
|
|
2643
|
+
},
|
|
2644
|
+
toString: function (a) {
|
|
2645
|
+
var b = !!a;
|
|
2646
|
+
a = a || this._format;
|
|
2647
|
+
var c = !1,
|
|
2648
|
+
d = this._a < 1 && this._a >= 0,
|
|
2649
|
+
e =
|
|
2650
|
+
!b &&
|
|
2651
|
+
d &&
|
|
2652
|
+
('hex' === a ||
|
|
2653
|
+
'hex6' === a ||
|
|
2654
|
+
'hex3' === a ||
|
|
2655
|
+
'hex4' === a ||
|
|
2656
|
+
'hex8' === a ||
|
|
2657
|
+
'name' === a);
|
|
2658
|
+
return e
|
|
2659
|
+
? 'name' === a && 0 === this._a
|
|
2660
|
+
? this.toName()
|
|
2661
|
+
: this.toRgbString()
|
|
2662
|
+
: ('rgb' === a && (c = this.toRgbString()),
|
|
2663
|
+
'prgb' === a && (c = this.toPercentageRgbString()),
|
|
2664
|
+
('hex' === a || 'hex6' === a) && (c = this.toHexString()),
|
|
2665
|
+
'hex3' === a && (c = this.toHexString(!0)),
|
|
2666
|
+
'hex4' === a && (c = this.toHex8String(!0)),
|
|
2667
|
+
'hex8' === a && (c = this.toHex8String()),
|
|
2668
|
+
'name' === a && (c = this.toName()),
|
|
2669
|
+
'hsl' === a && (c = this.toHslString()),
|
|
2670
|
+
'hsv' === a && (c = this.toHsvString()),
|
|
2671
|
+
c || this.toHexString());
|
|
2672
|
+
},
|
|
2673
|
+
clone: function () {
|
|
2674
|
+
return b(this.toString());
|
|
2675
|
+
},
|
|
2676
|
+
_applyModification: function (a, b) {
|
|
2677
|
+
var c = a.apply(null, [this].concat([].slice.call(b)));
|
|
2678
|
+
return (this._r = c._r), (this._g = c._g), (this._b = c._b), this.setAlpha(c._a), this;
|
|
2679
|
+
},
|
|
2680
|
+
lighten: function () {
|
|
2681
|
+
return this._applyModification(o, arguments);
|
|
2682
|
+
},
|
|
2683
|
+
brighten: function () {
|
|
2684
|
+
return this._applyModification(p, arguments);
|
|
2685
|
+
},
|
|
2686
|
+
darken: function () {
|
|
2687
|
+
return this._applyModification(q, arguments);
|
|
2688
|
+
},
|
|
2689
|
+
desaturate: function () {
|
|
2690
|
+
return this._applyModification(l, arguments);
|
|
2691
|
+
},
|
|
2692
|
+
saturate: function () {
|
|
2693
|
+
return this._applyModification(m, arguments);
|
|
2694
|
+
},
|
|
2695
|
+
greyscale: function () {
|
|
2696
|
+
return this._applyModification(n, arguments);
|
|
2697
|
+
},
|
|
2698
|
+
spin: function () {
|
|
2699
|
+
return this._applyModification(r, arguments);
|
|
2700
|
+
},
|
|
2701
|
+
_applyCombination: function (a, b) {
|
|
2702
|
+
return a.apply(null, [this].concat([].slice.call(b)));
|
|
2703
|
+
},
|
|
2704
|
+
analogous: function () {
|
|
2705
|
+
return this._applyCombination(w, arguments);
|
|
2706
|
+
},
|
|
2707
|
+
complement: function () {
|
|
2708
|
+
return this._applyCombination(s, arguments);
|
|
2709
|
+
},
|
|
2710
|
+
monochromatic: function () {
|
|
2711
|
+
return this._applyCombination(x, arguments);
|
|
2712
|
+
},
|
|
2713
|
+
splitcomplement: function () {
|
|
2714
|
+
return this._applyCombination(v, arguments);
|
|
2715
|
+
},
|
|
2716
|
+
triad: function () {
|
|
2717
|
+
return this._applyCombination(t, arguments);
|
|
2718
|
+
},
|
|
2719
|
+
tetrad: function () {
|
|
2720
|
+
return this._applyCombination(u, arguments);
|
|
2721
|
+
},
|
|
2722
|
+
}),
|
|
2723
|
+
(b.fromRatio = function (a, c) {
|
|
2724
|
+
if ('object' == typeof a) {
|
|
2725
|
+
var d = {};
|
|
2726
|
+
for (var e in a) a.hasOwnProperty(e) && (d[e] = 'a' === e ? a[e] : G(a[e]));
|
|
2727
|
+
a = d;
|
|
2728
|
+
}
|
|
2729
|
+
return b(a, c);
|
|
2730
|
+
}),
|
|
2731
|
+
(b.equals = function (a, c) {
|
|
2732
|
+
return a && c ? b(a).toRgbString() == b(c).toRgbString() : !1;
|
|
2733
|
+
}),
|
|
2734
|
+
(b.random = function () {
|
|
2735
|
+
return b.fromRatio({r: S(), g: S(), b: S()});
|
|
2736
|
+
}),
|
|
2737
|
+
(b.mix = function (a, c, d) {
|
|
2738
|
+
d = 0 === d ? 0 : d || 50;
|
|
2739
|
+
var e = b(a).toRgb(),
|
|
2740
|
+
f = b(c).toRgb(),
|
|
2741
|
+
g = d / 100,
|
|
2742
|
+
h = {
|
|
2743
|
+
r: (f.r - e.r) * g + e.r,
|
|
2744
|
+
g: (f.g - e.g) * g + e.g,
|
|
2745
|
+
b: (f.b - e.b) * g + e.b,
|
|
2746
|
+
a: (f.a - e.a) * g + e.a,
|
|
2747
|
+
};
|
|
2748
|
+
return b(h);
|
|
2749
|
+
}),
|
|
2750
|
+
(b.readability = function (c, d) {
|
|
2751
|
+
var e = b(c),
|
|
2752
|
+
f = b(d);
|
|
2753
|
+
return (
|
|
2754
|
+
(a.max(e.getLuminance(), f.getLuminance()) + 0.05) /
|
|
2755
|
+
(a.min(e.getLuminance(), f.getLuminance()) + 0.05)
|
|
2756
|
+
);
|
|
2757
|
+
}),
|
|
2758
|
+
(b.isReadable = function (a, c, d) {
|
|
2759
|
+
var e,
|
|
2760
|
+
f,
|
|
2761
|
+
g = b.readability(a, c);
|
|
2762
|
+
switch (((f = !1), (e = L(d)), e.level + e.size)) {
|
|
2763
|
+
case 'AAsmall':
|
|
2764
|
+
case 'AAAlarge':
|
|
2765
|
+
f = g >= 4.5;
|
|
2766
|
+
break;
|
|
2767
|
+
case 'AAlarge':
|
|
2768
|
+
f = g >= 3;
|
|
2769
|
+
break;
|
|
2770
|
+
case 'AAAsmall':
|
|
2771
|
+
f = g >= 7;
|
|
2772
|
+
}
|
|
2773
|
+
return f;
|
|
2774
|
+
}),
|
|
2775
|
+
(b.mostReadable = function (a, c, d) {
|
|
2776
|
+
var e,
|
|
2777
|
+
f,
|
|
2778
|
+
g,
|
|
2779
|
+
h,
|
|
2780
|
+
i = null,
|
|
2781
|
+
j = 0;
|
|
2782
|
+
(d = d || {}), (f = d.includeFallbackColors), (g = d.level), (h = d.size);
|
|
2783
|
+
for (var k = 0; k < c.length; k++)
|
|
2784
|
+
(e = b.readability(a, c[k])), e > j && ((j = e), (i = b(c[k])));
|
|
2785
|
+
return b.isReadable(a, i, {level: g, size: h}) || !f
|
|
2786
|
+
? i
|
|
2787
|
+
: ((d.includeFallbackColors = !1), b.mostReadable(a, ['#fff', '#000'], d));
|
|
2788
|
+
});
|
|
2789
|
+
var T = (b.names = {
|
|
2790
|
+
aliceblue: 'f0f8ff',
|
|
2791
|
+
antiquewhite: 'faebd7',
|
|
2792
|
+
aqua: '0ff',
|
|
2793
|
+
aquamarine: '7fffd4',
|
|
2794
|
+
azure: 'f0ffff',
|
|
2795
|
+
beige: 'f5f5dc',
|
|
2796
|
+
bisque: 'ffe4c4',
|
|
2797
|
+
black: '000',
|
|
2798
|
+
blanchedalmond: 'ffebcd',
|
|
2799
|
+
blue: '00f',
|
|
2800
|
+
blueviolet: '8a2be2',
|
|
2801
|
+
brown: 'a52a2a',
|
|
2802
|
+
burlywood: 'deb887',
|
|
2803
|
+
burntsienna: 'ea7e5d',
|
|
2804
|
+
cadetblue: '5f9ea0',
|
|
2805
|
+
chartreuse: '7fff00',
|
|
2806
|
+
chocolate: 'd2691e',
|
|
2807
|
+
coral: 'ff7f50',
|
|
2808
|
+
cornflowerblue: '6495ed',
|
|
2809
|
+
cornsilk: 'fff8dc',
|
|
2810
|
+
crimson: 'dc143c',
|
|
2811
|
+
cyan: '0ff',
|
|
2812
|
+
darkblue: '00008b',
|
|
2813
|
+
darkcyan: '008b8b',
|
|
2814
|
+
darkgoldenrod: 'b8860b',
|
|
2815
|
+
darkgray: 'a9a9a9',
|
|
2816
|
+
darkgreen: '006400',
|
|
2817
|
+
darkgrey: 'a9a9a9',
|
|
2818
|
+
darkkhaki: 'bdb76b',
|
|
2819
|
+
darkmagenta: '8b008b',
|
|
2820
|
+
darkolivegreen: '556b2f',
|
|
2821
|
+
darkorange: 'ff8c00',
|
|
2822
|
+
darkorchid: '9932cc',
|
|
2823
|
+
darkred: '8b0000',
|
|
2824
|
+
darksalmon: 'e9967a',
|
|
2825
|
+
darkseagreen: '8fbc8f',
|
|
2826
|
+
darkslateblue: '483d8b',
|
|
2827
|
+
darkslategray: '2f4f4f',
|
|
2828
|
+
darkslategrey: '2f4f4f',
|
|
2829
|
+
darkturquoise: '00ced1',
|
|
2830
|
+
darkviolet: '9400d3',
|
|
2831
|
+
deeppink: 'ff1493',
|
|
2832
|
+
deepskyblue: '00bfff',
|
|
2833
|
+
dimgray: '696969',
|
|
2834
|
+
dimgrey: '696969',
|
|
2835
|
+
dodgerblue: '1e90ff',
|
|
2836
|
+
firebrick: 'b22222',
|
|
2837
|
+
floralwhite: 'fffaf0',
|
|
2838
|
+
forestgreen: '228b22',
|
|
2839
|
+
fuchsia: 'f0f',
|
|
2840
|
+
gainsboro: 'dcdcdc',
|
|
2841
|
+
ghostwhite: 'f8f8ff',
|
|
2842
|
+
gold: 'ffd700',
|
|
2843
|
+
goldenrod: 'daa520',
|
|
2844
|
+
gray: '808080',
|
|
2845
|
+
green: '008000',
|
|
2846
|
+
greenyellow: 'adff2f',
|
|
2847
|
+
grey: '808080',
|
|
2848
|
+
honeydew: 'f0fff0',
|
|
2849
|
+
hotpink: 'ff69b4',
|
|
2850
|
+
indianred: 'cd5c5c',
|
|
2851
|
+
indigo: '4b0082',
|
|
2852
|
+
ivory: 'fffff0',
|
|
2853
|
+
khaki: 'f0e68c',
|
|
2854
|
+
lavender: 'e6e6fa',
|
|
2855
|
+
lavenderblush: 'fff0f5',
|
|
2856
|
+
lawngreen: '7cfc00',
|
|
2857
|
+
lemonchiffon: 'fffacd',
|
|
2858
|
+
lightblue: 'add8e6',
|
|
2859
|
+
lightcoral: 'f08080',
|
|
2860
|
+
lightcyan: 'e0ffff',
|
|
2861
|
+
lightgoldenrodyellow: 'fafad2',
|
|
2862
|
+
lightgray: 'd3d3d3',
|
|
2863
|
+
lightgreen: '90ee90',
|
|
2864
|
+
lightgrey: 'd3d3d3',
|
|
2865
|
+
lightpink: 'ffb6c1',
|
|
2866
|
+
lightsalmon: 'ffa07a',
|
|
2867
|
+
lightseagreen: '20b2aa',
|
|
2868
|
+
lightskyblue: '87cefa',
|
|
2869
|
+
lightslategray: '789',
|
|
2870
|
+
lightslategrey: '789',
|
|
2871
|
+
lightsteelblue: 'b0c4de',
|
|
2872
|
+
lightyellow: 'ffffe0',
|
|
2873
|
+
lime: '0f0',
|
|
2874
|
+
limegreen: '32cd32',
|
|
2875
|
+
linen: 'faf0e6',
|
|
2876
|
+
magenta: 'f0f',
|
|
2877
|
+
maroon: '800000',
|
|
2878
|
+
mediumaquamarine: '66cdaa',
|
|
2879
|
+
mediumblue: '0000cd',
|
|
2880
|
+
mediumorchid: 'ba55d3',
|
|
2881
|
+
mediumpurple: '9370db',
|
|
2882
|
+
mediumseagreen: '3cb371',
|
|
2883
|
+
mediumslateblue: '7b68ee',
|
|
2884
|
+
mediumspringgreen: '00fa9a',
|
|
2885
|
+
mediumturquoise: '48d1cc',
|
|
2886
|
+
mediumvioletred: 'c71585',
|
|
2887
|
+
midnightblue: '191970',
|
|
2888
|
+
mintcream: 'f5fffa',
|
|
2889
|
+
mistyrose: 'ffe4e1',
|
|
2890
|
+
moccasin: 'ffe4b5',
|
|
2891
|
+
navajowhite: 'ffdead',
|
|
2892
|
+
navy: '000080',
|
|
2893
|
+
oldlace: 'fdf5e6',
|
|
2894
|
+
olive: '808000',
|
|
2895
|
+
olivedrab: '6b8e23',
|
|
2896
|
+
orange: 'ffa500',
|
|
2897
|
+
orangered: 'ff4500',
|
|
2898
|
+
orchid: 'da70d6',
|
|
2899
|
+
palegoldenrod: 'eee8aa',
|
|
2900
|
+
palegreen: '98fb98',
|
|
2901
|
+
paleturquoise: 'afeeee',
|
|
2902
|
+
palevioletred: 'db7093',
|
|
2903
|
+
papayawhip: 'ffefd5',
|
|
2904
|
+
peachpuff: 'ffdab9',
|
|
2905
|
+
peru: 'cd853f',
|
|
2906
|
+
pink: 'ffc0cb',
|
|
2907
|
+
plum: 'dda0dd',
|
|
2908
|
+
powderblue: 'b0e0e6',
|
|
2909
|
+
purple: '800080',
|
|
2910
|
+
rebeccapurple: '663399',
|
|
2911
|
+
red: 'f00',
|
|
2912
|
+
rosybrown: 'bc8f8f',
|
|
2913
|
+
royalblue: '4169e1',
|
|
2914
|
+
saddlebrown: '8b4513',
|
|
2915
|
+
salmon: 'fa8072',
|
|
2916
|
+
sandybrown: 'f4a460',
|
|
2917
|
+
seagreen: '2e8b57',
|
|
2918
|
+
seashell: 'fff5ee',
|
|
2919
|
+
sienna: 'a0522d',
|
|
2920
|
+
silver: 'c0c0c0',
|
|
2921
|
+
skyblue: '87ceeb',
|
|
2922
|
+
slateblue: '6a5acd',
|
|
2923
|
+
slategray: '708090',
|
|
2924
|
+
slategrey: '708090',
|
|
2925
|
+
snow: 'fffafa',
|
|
2926
|
+
springgreen: '00ff7f',
|
|
2927
|
+
steelblue: '4682b4',
|
|
2928
|
+
tan: 'd2b48c',
|
|
2929
|
+
teal: '008080',
|
|
2930
|
+
thistle: 'd8bfd8',
|
|
2931
|
+
tomato: 'ff6347',
|
|
2932
|
+
turquoise: '40e0d0',
|
|
2933
|
+
violet: 'ee82ee',
|
|
2934
|
+
wheat: 'f5deb3',
|
|
2935
|
+
white: 'fff',
|
|
2936
|
+
whitesmoke: 'f5f5f5',
|
|
2937
|
+
yellow: 'ff0',
|
|
2938
|
+
yellowgreen: '9acd32',
|
|
2939
|
+
}),
|
|
2940
|
+
U = (b.hexNames = y(T)),
|
|
2941
|
+
V = (function () {
|
|
2942
|
+
var a = '[-\\+]?\\d+%?',
|
|
2943
|
+
b = '[-\\+]?\\d*\\.\\d+%?',
|
|
2944
|
+
c = '(?:' + b + ')|(?:' + a + ')',
|
|
2945
|
+
d = '[\\s|\\(]+(' + c + ')[,|\\s]+(' + c + ')[,|\\s]+(' + c + ')\\s*\\)?',
|
|
2946
|
+
e =
|
|
2947
|
+
'[\\s|\\(]+(' + c + ')[,|\\s]+(' + c + ')[,|\\s]+(' + c + ')[,|\\s]+(' + c + ')\\s*\\)?';
|
|
2948
|
+
return {
|
|
2949
|
+
CSS_UNIT: new RegExp(c),
|
|
2950
|
+
rgb: new RegExp('rgb' + d),
|
|
2951
|
+
rgba: new RegExp('rgba' + e),
|
|
2952
|
+
hsl: new RegExp('hsl' + d),
|
|
2953
|
+
hsla: new RegExp('hsla' + e),
|
|
2954
|
+
hsv: new RegExp('hsv' + d),
|
|
2955
|
+
hsva: new RegExp('hsva' + e),
|
|
2956
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2957
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2958
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
2959
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
2960
|
+
};
|
|
2961
|
+
})();
|
|
2962
|
+
'undefined' != typeof module && module.exports
|
|
2963
|
+
? (module.exports = b)
|
|
2964
|
+
: 'function' == typeof define && define.amd
|
|
2965
|
+
? define(function () {
|
|
2966
|
+
return b;
|
|
2967
|
+
})
|
|
2968
|
+
: (window.tinycolor = b);
|
|
2969
|
+
})(Math);
|
|
2970
|
+
!(function (r) {
|
|
2971
|
+
var i = function (n) {
|
|
2972
|
+
var e, i;
|
|
2973
|
+
return (i = (e = r('<div/>', {class: n}).appendTo('body')).is(':visible')), e.remove(), i;
|
|
2974
|
+
};
|
|
2975
|
+
(r.isBreakpoint = function (n) {
|
|
2976
|
+
var e;
|
|
2977
|
+
switch (n) {
|
|
2978
|
+
case 'xs':
|
|
2979
|
+
e = 'd-block d-sm-none';
|
|
2980
|
+
break;
|
|
2981
|
+
case 'sm':
|
|
2982
|
+
e = 'd-none d-sm-block d-md-none';
|
|
2983
|
+
break;
|
|
2984
|
+
case 'md':
|
|
2985
|
+
e = 'd-none d-md-block d-lg-none';
|
|
2986
|
+
break;
|
|
2987
|
+
case 'lg':
|
|
2988
|
+
e = 'd-none d-lg-block d-xl-none';
|
|
2989
|
+
break;
|
|
2990
|
+
case 'xl':
|
|
2991
|
+
e = 'd-none d-xl-block';
|
|
2992
|
+
}
|
|
2993
|
+
return i(e);
|
|
2994
|
+
}),
|
|
2995
|
+
(r.isBreakpointUp = function (n) {
|
|
2996
|
+
var e;
|
|
2997
|
+
switch (n) {
|
|
2998
|
+
case 'xs':
|
|
2999
|
+
return !0;
|
|
3000
|
+
case 'sm':
|
|
3001
|
+
e = 'd-none d-sm-block';
|
|
3002
|
+
break;
|
|
3003
|
+
case 'md':
|
|
3004
|
+
e = 'd-none d-md-block';
|
|
3005
|
+
break;
|
|
3006
|
+
case 'lg':
|
|
3007
|
+
e = 'd-none d-lg-block';
|
|
3008
|
+
break;
|
|
3009
|
+
case 'xl':
|
|
3010
|
+
e = 'd-none d-xl-block';
|
|
3011
|
+
}
|
|
3012
|
+
return i(e);
|
|
3013
|
+
}),
|
|
3014
|
+
r.extend(r, {
|
|
3015
|
+
isXs: function () {
|
|
3016
|
+
return r.isBreakpoint('xs');
|
|
3017
|
+
},
|
|
3018
|
+
isSm: function () {
|
|
3019
|
+
return r.isBreakpoint('sm');
|
|
3020
|
+
},
|
|
3021
|
+
isMd: function () {
|
|
3022
|
+
return r.isBreakpoint('md');
|
|
3023
|
+
},
|
|
3024
|
+
isLg: function () {
|
|
3025
|
+
return r.isBreakpoint('lg');
|
|
3026
|
+
},
|
|
3027
|
+
isXl: function () {
|
|
3028
|
+
return r.isBreakpoint('xl');
|
|
3029
|
+
},
|
|
3030
|
+
isXsUp: function () {
|
|
3031
|
+
return r.isBreakpointUp('xs');
|
|
3032
|
+
},
|
|
3033
|
+
isSmUp: function () {
|
|
3034
|
+
return r.isBreakpointUp('sm');
|
|
3035
|
+
},
|
|
3036
|
+
isMdUp: function () {
|
|
3037
|
+
return r.isBreakpointUp('md');
|
|
3038
|
+
},
|
|
3039
|
+
isLgUp: function () {
|
|
3040
|
+
return r.isBreakpointUp('lg');
|
|
3041
|
+
},
|
|
3042
|
+
isXlUp: function () {
|
|
3043
|
+
return r.isBreakpointUp('xl');
|
|
3044
|
+
},
|
|
3045
|
+
});
|
|
3046
|
+
})(jQuery);
|