1
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
(function(core) {
|
3
|
|
4
|
var uikit;
|
5
|
|
6
|
if (!window.jQuery) {
|
7
|
throw new Error('UIkit 2.x requires jQuery');
|
8
|
} else {
|
9
|
uikit = core(window.jQuery);
|
10
|
}
|
11
|
|
12
|
if (typeof define == 'function' && define.amd) { // AMD
|
13
|
|
14
|
define('uikit', function(){
|
15
|
|
16
|
uikit.load = function(res, req, onload, config) {
|
17
|
|
18
|
var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : '').replace(/\/+$/g, '');
|
19
|
|
20
|
if (!base) {
|
21
|
throw new Error('Please define base path to UIkit in the requirejs config.');
|
22
|
}
|
23
|
|
24
|
for (i = 0; i < resources.length; i += 1) {
|
25
|
var resource = resources[i].replace(/\./g, '/');
|
26
|
load.push(base+'/components/'+resource);
|
27
|
}
|
28
|
|
29
|
req(load, function() {
|
30
|
onload(uikit);
|
31
|
});
|
32
|
};
|
33
|
|
34
|
return uikit;
|
35
|
});
|
36
|
}
|
37
|
|
38
|
})(function($) {
|
39
|
|
40
|
"use strict";
|
41
|
|
42
|
if (window.UIkit2) {
|
43
|
return window.UIkit2;
|
44
|
}
|
45
|
|
46
|
var UI = {}, _UI = window.UIkit || undefined;
|
47
|
|
48
|
UI.version = '2.27.5';
|
49
|
|
50
|
UI.noConflict = function() {
|
51
|
// restore UIkit version
|
52
|
if (_UI) {
|
53
|
window.UIkit = _UI;
|
54
|
$.UIkit = _UI;
|
55
|
$.fn.uk = _UI.fn;
|
56
|
}
|
57
|
|
58
|
return UI;
|
59
|
};
|
60
|
|
61
|
window.UIkit2 = UI;
|
62
|
|
63
|
if (!_UI) {
|
64
|
window.UIkit = UI;
|
65
|
}
|
66
|
|
67
|
// cache jQuery
|
68
|
UI.$ = $;
|
69
|
|
70
|
UI.$doc = UI.$(document);
|
71
|
UI.$win = UI.$(window);
|
72
|
UI.$html = UI.$('html');
|
73
|
|
74
|
UI.support = {};
|
75
|
UI.support.transition = (function() {
|
76
|
|
77
|
var transitionEnd = (function() {
|
78
|
|
79
|
var element = document.body || document.documentElement,
|
80
|
transEndEventNames = {
|
81
|
WebkitTransition : 'webkitTransitionEnd',
|
82
|
MozTransition : 'transitionend',
|
83
|
OTransition : 'oTransitionEnd otransitionend',
|
84
|
transition : 'transitionend'
|
85
|
}, name;
|
86
|
|
87
|
for (name in transEndEventNames) {
|
88
|
if (element.style[name] !== undefined) return transEndEventNames[name];
|
89
|
}
|
90
|
}());
|
91
|
|
92
|
return transitionEnd && { end: transitionEnd };
|
93
|
})();
|
94
|
|
95
|
UI.support.animation = (function() {
|
96
|
|
97
|
var animationEnd = (function() {
|
98
|
|
99
|
var element = document.body || document.documentElement,
|
100
|
animEndEventNames = {
|
101
|
WebkitAnimation : 'webkitAnimationEnd',
|
102
|
MozAnimation : 'animationend',
|
103
|
OAnimation : 'oAnimationEnd oanimationend',
|
104
|
animation : 'animationend'
|
105
|
}, name;
|
106
|
|
107
|
for (name in animEndEventNames) {
|
108
|
if (element.style[name] !== undefined) return animEndEventNames[name];
|
109
|
}
|
110
|
}());
|
111
|
|
112
|
return animationEnd && { end: animationEnd };
|
113
|
})();
|
114
|
|
115
|
// requestAnimationFrame polyfill
|
116
|
//https://github.com/darius/requestAnimationFrame
|
117
|
(function() {
|
118
|
|
119
|
Date.now = Date.now || function() { return new Date().getTime(); };
|
120
|
|
121
|
var vendors = ['webkit', 'moz'];
|
122
|
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
|
123
|
var vp = vendors[i];
|
124
|
window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
|
125
|
window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
|
126
|
|| window[vp+'CancelRequestAnimationFrame']);
|
127
|
}
|
128
|
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
|
129
|
|| !window.requestAnimationFrame || !window.cancelAnimationFrame) {
|
130
|
var lastTime = 0;
|
131
|
window.requestAnimationFrame = function(callback) {
|
132
|
var now = Date.now();
|
133
|
var nextTime = Math.max(lastTime + 16, now);
|
134
|
return setTimeout(function() { callback(lastTime = nextTime); },
|
135
|
nextTime - now);
|
136
|
};
|
137
|
window.cancelAnimationFrame = clearTimeout;
|
138
|
}
|
139
|
}());
|
140
|
|
141
|
UI.support.touch = (
|
142
|
('ontouchstart' in document) ||
|
143
|
(window.DocumentTouch && document instanceof window.DocumentTouch) ||
|
144
|
(window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 0) || //IE 10
|
145
|
(window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 0) || //IE >=11
|
146
|
false
|
147
|
);
|
148
|
|
149
|
UI.support.mutationobserver = (window.MutationObserver || window.WebKitMutationObserver || null);
|
150
|
|
151
|
UI.Utils = {};
|
152
|
|
153
|
UI.Utils.isFullscreen = function() {
|
154
|
return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || document.fullscreenElement || false;
|
155
|
};
|
156
|
|
157
|
UI.Utils.str2json = function(str, notevil) {
|
158
|
try {
|
159
|
if (notevil) {
|
160
|
return JSON.parse(str
|
161
|
// wrap keys without quote with valid double quote
|
162
|
.replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';})
|
163
|
// replacing single quote wrapped ones to double quote
|
164
|
.replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
|
165
|
);
|
166
|
} else {
|
167
|
return (new Function('', 'var json = ' + str + '; return JSON.parse(JSON.stringify(json));'))();
|
168
|
}
|
169
|
} catch(e) { return false; }
|
170
|
};
|
171
|
|
172
|
UI.Utils.debounce = function(func, wait, immediate) {
|
173
|
var timeout;
|
174
|
return function() {
|
175
|
var context = this, args = arguments;
|
176
|
var later = function() {
|
177
|
timeout = null;
|
178
|
if (!immediate) func.apply(context, args);
|
179
|
};
|
180
|
var callNow = immediate && !timeout;
|
181
|
clearTimeout(timeout);
|
182
|
timeout = setTimeout(later, wait);
|
183
|
if (callNow) func.apply(context, args);
|
184
|
};
|
185
|
};
|
186
|
|
187
|
UI.Utils.throttle = function (func, limit) {
|
188
|
var wait = false;
|
189
|
return function () {
|
190
|
if (!wait) {
|
191
|
func.call();
|
192
|
wait = true;
|
193
|
setTimeout(function () {
|
194
|
wait = false;
|
195
|
}, limit);
|
196
|
}
|
197
|
}
|
198
|
};
|
199
|
|
200
|
UI.Utils.removeCssRules = function(selectorRegEx) {
|
201
|
var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
|
202
|
|
203
|
if(!selectorRegEx) return;
|
204
|
|
205
|
setTimeout(function(){
|
206
|
try {
|
207
|
_ref = document.styleSheets;
|
208
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
209
|
stylesheet = _ref[_i];
|
210
|
idxs = [];
|
211
|
stylesheet.cssRules = stylesheet.cssRules;
|
212
|
for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
|
213
|
if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
|
214
|
idxs.unshift(idx);
|
215
|
}
|
216
|
}
|
217
|
for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
|
218
|
stylesheet.deleteRule(idxs[_k]);
|
219
|
}
|
220
|
}
|
221
|
} catch (_error) {}
|
222
|
}, 0);
|
223
|
};
|
224
|
|
225
|
UI.Utils.isInView = function(element, options) {
|
226
|
|
227
|
var $element = $(element);
|
228
|
|
229
|
if (!$element.is(':visible')) {
|
230
|
return false;
|
231
|
}
|
232
|
|
233
|
var window_left = UI.$win.scrollLeft(), window_top = UI.$win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
|
234
|
|
235
|
options = $.extend({topoffset:0, leftoffset:0}, options);
|
236
|
|
237
|
if (top + $element.height() >= window_top && top - options.topoffset <= window_top + UI.$win.height() &&
|
238
|
left + $element.width() >= window_left && left - options.leftoffset <= window_left + UI.$win.width()) {
|
239
|
return true;
|
240
|
} else {
|
241
|
return false;
|
242
|
}
|
243
|
};
|
244
|
|
245
|
UI.Utils.checkDisplay = function(context, initanimation) {
|
246
|
|
247
|
var elements = UI.$('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document), animated;
|
248
|
|
249
|
if (context && !elements.length) {
|
250
|
elements = $(context);
|
251
|
}
|
252
|
|
253
|
elements.trigger('display.uk.check');
|
254
|
|
255
|
// fix firefox / IE animations
|
256
|
if (initanimation) {
|
257
|
|
258
|
if (typeof(initanimation)!='string') {
|
259
|
initanimation = '[class*="uk-animation-"]';
|
260
|
}
|
261
|
|
262
|
elements.find(initanimation).each(function(){
|
263
|
|
264
|
var ele = UI.$(this),
|
265
|
cls = ele.attr('class'),
|
266
|
anim = cls.match(/uk-animation-(.+)/);
|
267
|
|
268
|
ele.removeClass(anim[0]).width();
|
269
|
|
270
|
ele.addClass(anim[0]);
|
271
|
});
|
272
|
}
|
273
|
|
274
|
return elements;
|
275
|
};
|
276
|
|
277
|
UI.Utils.options = function(string) {
|
278
|
|
279
|
if ($.type(string)!='string') return string;
|
280
|
|
281
|
if (string.indexOf(':') != -1 && string.trim().substr(-1) != '}') {
|
282
|
string = '{'+string+'}';
|
283
|
}
|
284
|
|
285
|
var start = (string ? string.indexOf("{") : -1), options = {};
|
286
|
|
287
|
if (start != -1) {
|
288
|
try {
|
289
|
options = UI.Utils.str2json(string.substr(start));
|
290
|
} catch (e) {}
|
291
|
}
|
292
|
|
293
|
return options;
|
294
|
};
|
295
|
|
296
|
UI.Utils.animate = function(element, cls) {
|
297
|
|
298
|
var d = $.Deferred();
|
299
|
|
300
|
element = UI.$(element);
|
301
|
|
302
|
element.css('display', 'none').addClass(cls).one(UI.support.animation.end, function() {
|
303
|
element.removeClass(cls);
|
304
|
d.resolve();
|
305
|
});
|
306
|
|
307
|
element.css('display', '');
|
308
|
|
309
|
return d.promise();
|
310
|
};
|
311
|
|
312
|
UI.Utils.uid = function(prefix) {
|
313
|
return (prefix || 'id') + (new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
|
314
|
};
|
315
|
|
316
|
UI.Utils.template = function(str, data) {
|
317
|
|
318
|
var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
|
319
|
i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
|
320
|
|
321
|
while(i < tokens.length) {
|
322
|
|
323
|
toc = tokens[i];
|
324
|
|
325
|
if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
|
326
|
i = i + 1;
|
327
|
toc = tokens[i];
|
328
|
cmd = toc[0];
|
329
|
prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
|
330
|
|
331
|
switch(cmd) {
|
332
|
case '~':
|
333
|
output.push('for(var $i=0;$i<'+prop+'.length;$i++) { var $item = '+prop+'[$i];');
|
334
|
openblocks++;
|
335
|
break;
|
336
|
case ':':
|
337
|
output.push('for(var $key in '+prop+') { var $val = '+prop+'[$key];');
|
338
|
openblocks++;
|
339
|
break;
|
340
|
case '#':
|
341
|
output.push('if('+prop+') {');
|
342
|
openblocks++;
|
343
|
break;
|
344
|
case '^':
|
345
|
output.push('if(!'+prop+') {');
|
346
|
openblocks++;
|
347
|
break;
|
348
|
case '/':
|
349
|
output.push('}');
|
350
|
openblocks--;
|
351
|
break;
|
352
|
case '!':
|
353
|
output.push('__ret.push('+prop+');');
|
354
|
break;
|
355
|
default:
|
356
|
output.push('__ret.push(escape('+prop+'));');
|
357
|
break;
|
358
|
}
|
359
|
} else {
|
360
|
output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
|
361
|
}
|
362
|
i = i + 1;
|
363
|
}
|
364
|
|
365
|
fn = new Function('$data', [
|
366
|
'var __ret = [];',
|
367
|
'try {',
|
368
|
'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
|
369
|
'}catch(e){__ret = [e.message];}',
|
370
|
'return __ret.join("").replace(/\\n\\n/g, "\\n");',
|
371
|
"function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}"
|
372
|
].join("\n"));
|
373
|
|
374
|
return data ? fn(data) : fn;
|
375
|
};
|
376
|
|
377
|
UI.Utils.focus = function(element, extra) {
|
378
|
|
379
|
element = $(element);
|
380
|
|
381
|
if (!element.length) {
|
382
|
return element;
|
383
|
}
|
384
|
|
385
|
var autofocus = element.find('[autofocus]:first'), tabidx;
|
386
|
|
387
|
if (autofocus.length) {
|
388
|
return autofocus.focus();
|
389
|
}
|
390
|
|
391
|
autofocus = element.find(':input'+(extra && (','+extra) || '')).first();
|
392
|
|
393
|
if (autofocus.length) {
|
394
|
return autofocus.focus();
|
395
|
}
|
396
|
|
397
|
if (!element.attr('tabindex')) {
|
398
|
tabidx = 1000;
|
399
|
element.attr('tabindex', tabidx);
|
400
|
}
|
401
|
|
402
|
element[0].focus();
|
403
|
|
404
|
if (tabidx) {
|
405
|
element.attr('tabindex', '');
|
406
|
}
|
407
|
|
408
|
return element;
|
409
|
}
|
410
|
|
411
|
UI.Utils.events = {};
|
412
|
UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
|
413
|
|
414
|
// deprecated
|
415
|
|
416
|
UI.fn = function(command, options) {
|
417
|
|
418
|
var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
|
419
|
|
420
|
if (!UI[component]) {
|
421
|
$.error('UIkit component [' + component + '] does not exist.');
|
422
|
return this;
|
423
|
}
|
424
|
|
425
|
return this.each(function() {
|
426
|
var $this = $(this), data = $this.data(component);
|
427
|
if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
|
428
|
if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
|
429
|
});
|
430
|
};
|
431
|
|
432
|
$.UIkit = UI;
|
433
|
$.fn.uk = UI.fn;
|
434
|
|
435
|
UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left";
|
436
|
|
437
|
UI.components = {};
|
438
|
|
439
|
UI.component = function(name, def, override) {
|
440
|
|
441
|
if (UI.components[name] && !override) {
|
442
|
return UI.components[name];
|
443
|
}
|
444
|
|
445
|
var fn = function(element, options) {
|
446
|
|
447
|
var $this = this;
|
448
|
|
449
|
this.UIkit = UI;
|
450
|
this.element = element ? UI.$(element) : null;
|
451
|
this.options = $.extend(true, {}, this.defaults, options);
|
452
|
this.plugins = {};
|
453
|
|
454
|
if (this.element) {
|
455
|
this.element.data(name, this);
|
456
|
}
|
457
|
|
458
|
this.init();
|
459
|
|
460
|
(this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
|
461
|
|
462
|
if (fn.plugins[plugin].init) {
|
463
|
fn.plugins[plugin].init($this);
|
464
|
$this.plugins[plugin] = true;
|
465
|
}
|
466
|
|
467
|
});
|
468
|
|
469
|
this.trigger('init.uk.component', [name, this]);
|
470
|
|
471
|
return this;
|
472
|
};
|
473
|
|
474
|
fn.plugins = {};
|
475
|
|
476
|
$.extend(true, fn.prototype, {
|
477
|
|
478
|
defaults : {plugins: []},
|
479
|
|
480
|
boot: function(){},
|
481
|
init: function(){},
|
482
|
|
483
|
on: function(a1,a2,a3){
|
484
|
return UI.$(this.element || this).on(a1,a2,a3);
|
485
|
},
|
486
|
|
487
|
one: function(a1,a2,a3){
|
488
|
return UI.$(this.element || this).one(a1,a2,a3);
|
489
|
},
|
490
|
|
491
|
off: function(evt){
|
492
|
return UI.$(this.element || this).off(evt);
|
493
|
},
|
494
|
|
495
|
trigger: function(evt, params) {
|
496
|
return UI.$(this.element || this).trigger(evt, params);
|
497
|
},
|
498
|
|
499
|
find: function(selector) {
|
500
|
return UI.$(this.element ? this.element: []).find(selector);
|
501
|
},
|
502
|
|
503
|
proxy: function(obj, methods) {
|
504
|
|
505
|
var $this = this;
|
506
|
|
507
|
methods.split(' ').forEach(function(method) {
|
508
|
if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
|
509
|
});
|
510
|
},
|
511
|
|
512
|
mixin: function(obj, methods) {
|
513
|
|
514
|
var $this = this;
|
515
|
|
516
|
methods.split(' ').forEach(function(method) {
|
517
|
if (!$this[method]) $this[method] = obj[method].bind($this);
|
518
|
});
|
519
|
},
|
520
|
|
521
|
option: function() {
|
522
|
|
523
|
if (arguments.length == 1) {
|
524
|
return this.options[arguments[0]] || undefined;
|
525
|
} else if (arguments.length == 2) {
|
526
|
this.options[arguments[0]] = arguments[1];
|
527
|
}
|
528
|
}
|
529
|
|
530
|
}, def);
|
531
|
|
532
|
this.components[name] = fn;
|
533
|
|
534
|
this[name] = function() {
|
535
|
|
536
|
var element, options;
|
537
|
|
538
|
if (arguments.length) {
|
539
|
|
540
|
switch(arguments.length) {
|
541
|
case 1:
|
542
|
|
543
|
if (typeof arguments[0] === 'string' || arguments[0].nodeType || arguments[0] instanceof jQuery) {
|
544
|
element = $(arguments[0]);
|
545
|
} else {
|
546
|
options = arguments[0];
|
547
|
}
|
548
|
|
549
|
break;
|
550
|
case 2:
|
551
|
|
552
|
element = $(arguments[0]);
|
553
|
options = arguments[1];
|
554
|
break;
|
555
|
}
|
556
|
}
|
557
|
|
558
|
if (element && element.data(name)) {
|
559
|
return element.data(name);
|
560
|
}
|
561
|
|
562
|
return (new UI.components[name](element, options));
|
563
|
};
|
564
|
|
565
|
if (UI.domready) {
|
566
|
UI.component.boot(name);
|
567
|
}
|
568
|
|
569
|
return fn;
|
570
|
};
|
571
|
|
572
|
UI.plugin = function(component, name, def) {
|
573
|
this.components[component].plugins[name] = def;
|
574
|
};
|
575
|
|
576
|
UI.component.boot = function(name) {
|
577
|
|
578
|
if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) {
|
579
|
UI.components[name].prototype.boot.apply(UI, []);
|
580
|
UI.components[name].booted = true;
|
581
|
}
|
582
|
};
|
583
|
|
584
|
UI.component.bootComponents = function() {
|
585
|
|
586
|
for (var component in UI.components) {
|
587
|
UI.component.boot(component);
|
588
|
}
|
589
|
};
|
590
|
|
591
|
|
592
|
// DOM mutation save ready helper function
|
593
|
|
594
|
UI.domObservers = [];
|
595
|
UI.domready = false;
|
596
|
|
597
|
UI.ready = function(fn) {
|
598
|
|
599
|
UI.domObservers.push(fn);
|
600
|
|
601
|
if (UI.domready) {
|
602
|
fn(document);
|
603
|
}
|
604
|
};
|
605
|
|
606
|
UI.on = function(a1,a2,a3){
|
607
|
|
608
|
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
609
|
a2.apply(UI.$doc);
|
610
|
}
|
611
|
|
612
|
return UI.$doc.on(a1,a2,a3);
|
613
|
};
|
614
|
|
615
|
UI.one = function(a1,a2,a3){
|
616
|
|
617
|
if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
|
618
|
a2.apply(UI.$doc);
|
619
|
return UI.$doc;
|
620
|
}
|
621
|
|
622
|
return UI.$doc.one(a1,a2,a3);
|
623
|
};
|
624
|
|
625
|
UI.trigger = function(evt, params) {
|
626
|
return UI.$doc.trigger(evt, params);
|
627
|
};
|
628
|
|
629
|
UI.domObserve = function(selector, fn) {
|
630
|
|
631
|
if(!UI.support.mutationobserver) return;
|
632
|
|
633
|
fn = fn || function() {};
|
634
|
|
635
|
UI.$(selector).each(function() {
|
636
|
|
637
|
var element = this,
|
638
|
$element = UI.$(element);
|
639
|
|
640
|
if ($element.data('observer')) {
|
641
|
return;
|
642
|
}
|
643
|
|
644
|
try {
|
645
|
|
646
|
var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
|
647
|
fn.apply(element, [$element]);
|
648
|
$element.trigger('changed.uk.dom');
|
649
|
}, 50), {childList: true, subtree: true});
|
650
|
|
651
|
// pass in the target node, as well as the observer options
|
652
|
observer.observe(element, { childList: true, subtree: true });
|
653
|
|
654
|
$element.data('observer', observer);
|
655
|
|
656
|
} catch(e) {}
|
657
|
});
|
658
|
};
|
659
|
|
660
|
UI.init = function(root) {
|
661
|
|
662
|
root = root || document;
|
663
|
|
664
|
UI.domObservers.forEach(function(fn){
|
665
|
fn(root);
|
666
|
});
|
667
|
};
|
668
|
|
669
|
UI.on('domready.uk.dom', function(){
|
670
|
|
671
|
UI.init();
|
672
|
|
673
|
if (UI.domready) UI.Utils.checkDisplay();
|
674
|
});
|
675
|
|
676
|
document.addEventListener('DOMContentLoaded', function(){
|
677
|
|
678
|
var domReady = function() {
|
679
|
|
680
|
UI.$body = UI.$('body');
|
681
|
|
682
|
UI.trigger('beforeready.uk.dom');
|
683
|
|
684
|
UI.component.bootComponents();
|
685
|
|
686
|
// custom scroll observer
|
687
|
var rafToken = requestAnimationFrame((function(){
|
688
|
|
689
|
var memory = {dir: {x:0, y:0}, x: window.pageXOffset, y:window.pageYOffset};
|
690
|
|
691
|
var fn = function(){
|
692
|
// reading this (window.page[X|Y]Offset) causes a full page recalc of the layout in Chrome,
|
693
|
// so we only want to do this once
|
694
|
var wpxo = window.pageXOffset;
|
695
|
var wpyo = window.pageYOffset;
|
696
|
|
697
|
// Did the scroll position change since the last time we were here?
|
698
|
if (memory.x != wpxo || memory.y != wpyo) {
|
699
|
|
700
|
// Set the direction of the scroll and store the new position
|
701
|
if (wpxo != memory.x) {memory.dir.x = wpxo > memory.x ? 1:-1; } else { memory.dir.x = 0; }
|
702
|
if (wpyo != memory.y) {memory.dir.y = wpyo > memory.y ? 1:-1; } else { memory.dir.y = 0; }
|
703
|
|
704
|
memory.x = wpxo;
|
705
|
memory.y = wpyo;
|
706
|
|
707
|
// Trigger the scroll event, this could probably be sent using memory.clone() but this is
|
708
|
// more explicit and easier to see exactly what is being sent in the event.
|
709
|
UI.$doc.trigger('scrolling.uk.document', [{
|
710
|
dir: {x: memory.dir.x, y: memory.dir.y}, x: wpxo, y: wpyo
|
711
|
}]);
|
712
|
}
|
713
|
|
714
|
cancelAnimationFrame(rafToken);
|
715
|
rafToken = requestAnimationFrame(fn);
|
716
|
};
|
717
|
|
718
|
if (UI.support.touch) {
|
719
|
UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn);
|
720
|
}
|
721
|
|
722
|
if (memory.x || memory.y) fn();
|
723
|
|
724
|
return fn;
|
725
|
|
726
|
})());
|
727
|
|
728
|
// run component init functions on dom
|
729
|
UI.trigger('domready.uk.dom');
|
730
|
|
731
|
if (UI.support.touch) {
|
732
|
|
733
|
// remove css hover rules for touch devices
|
734
|
// UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
|
735
|
|
736
|
// viewport unit fix for uk-height-viewport - should be fixed in iOS 8
|
737
|
if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
|
738
|
|
739
|
UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
|
740
|
|
741
|
var fn = function() {
|
742
|
$('.uk-height-viewport').css('height', window.innerHeight);
|
743
|
return fn;
|
744
|
};
|
745
|
|
746
|
return fn();
|
747
|
|
748
|
})(), 100));
|
749
|
}
|
750
|
}
|
751
|
|
752
|
UI.trigger('afterready.uk.dom');
|
753
|
|
754
|
// mark that domready is left behind
|
755
|
UI.domready = true;
|
756
|
|
757
|
// auto init js components
|
758
|
if (UI.support.mutationobserver) {
|
759
|
|
760
|
var initFn = UI.Utils.debounce(function(){
|
761
|
requestAnimationFrame(function(){ UI.init(document.body);});
|
762
|
}, 10);
|
763
|
|
764
|
(new UI.support.mutationobserver(function(mutations) {
|
765
|
|
766
|
var init = false;
|
767
|
|
768
|
mutations.every(function(mutation){
|
769
|
|
770
|
if (mutation.type != 'childList') return true;
|
771
|
|
772
|
for (var i = 0, node; i < mutation.addedNodes.length; ++i) {
|
773
|
|
774
|
node = mutation.addedNodes[i];
|
775
|
|
776
|
if (node.outerHTML && node.outerHTML.indexOf('data-uk-') !== -1) {
|
777
|
return (init = true) && false;
|
778
|
}
|
779
|
}
|
780
|
return true;
|
781
|
});
|
782
|
|
783
|
if (init) initFn();
|
784
|
|
785
|
})).observe(document.body, {childList: true, subtree: true});
|
786
|
}
|
787
|
};
|
788
|
|
789
|
if (document.readyState == 'complete' || document.readyState == 'interactive') {
|
790
|
setTimeout(domReady);
|
791
|
}
|
792
|
|
793
|
return domReady;
|
794
|
|
795
|
}());
|
796
|
|
797
|
// add touch identifier class
|
798
|
UI.$html.addClass(UI.support.touch ? 'uk-touch' : 'uk-notouch');
|
799
|
|
800
|
// add uk-hover class on tap to support overlays on touch devices
|
801
|
if (UI.support.touch) {
|
802
|
|
803
|
var hoverset = false,
|
804
|
exclude,
|
805
|
hovercls = 'uk-hover',
|
806
|
selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover';
|
807
|
|
808
|
UI.$html.on('mouseenter touchstart MSPointerDown pointerdown', selector, function() {
|
809
|
|
810
|
if (hoverset) $('.'+hovercls).removeClass(hovercls);
|
811
|
|
812
|
hoverset = $(this).addClass(hovercls);
|
813
|
|
814
|
}).on('mouseleave touchend MSPointerUp pointerup', function(e) {
|
815
|
|
816
|
exclude = $(e.target).parents(selector);
|
817
|
|
818
|
if (hoverset) {
|
819
|
hoverset.not(exclude).removeClass(hovercls);
|
820
|
}
|
821
|
});
|
822
|
}
|
823
|
|
824
|
return UI;
|
825
|
});
|
826
|
|
827
|
// Based on Zeptos touch.js
|
828
|
// https://raw.github.com/madrobby/zepto/master/src/touch.js
|
829
|
// Zepto.js may be freely distributed under the MIT license.
|
830
|
|
831
|
;(function($){
|
832
|
|
833
|
if ($.fn.swipeLeft) {
|
834
|
return;
|
835
|
}
|
836
|
|
837
|
|
838
|
var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
|
839
|
var hasTouchEvents = 'ontouchstart' in window,
|
840
|
hasPointerEvents = window.PointerEvent,
|
841
|
hasTouch = hasTouchEvents
|
842
|
|| window.DocumentTouch && document instanceof DocumentTouch
|
843
|
|| navigator.msPointerEnabled && navigator.msMaxTouchPoints > 0 // IE 10
|
844
|
|| navigator.pointerEnabled && navigator.maxTouchPoints > 0; // IE >=11
|
845
|
|
846
|
function swipeDirection(x1, x2, y1, y2) {
|
847
|
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
|
848
|
}
|
849
|
|
850
|
function longTap() {
|
851
|
longTapTimeout = null;
|
852
|
if (touch.last) {
|
853
|
if ( touch.el !== undefined ) touch.el.trigger('longTap');
|
854
|
touch = {};
|
855
|
}
|
856
|
}
|
857
|
|
858
|
function cancelLongTap() {
|
859
|
if (longTapTimeout) clearTimeout(longTapTimeout);
|
860
|
longTapTimeout = null;
|
861
|
}
|
862
|
|
863
|
function cancelAll() {
|
864
|
if (touchTimeout) clearTimeout(touchTimeout);
|
865
|
if (tapTimeout) clearTimeout(tapTimeout);
|
866
|
if (swipeTimeout) clearTimeout(swipeTimeout);
|
867
|
if (longTapTimeout) clearTimeout(longTapTimeout);
|
868
|
touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
|
869
|
touch = {};
|
870
|
}
|
871
|
|
872
|
function isPrimaryTouch(event){
|
873
|
return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
|
874
|
}
|
875
|
|
876
|
$(function(){
|
877
|
var now, delta, deltaX = 0, deltaY = 0, firstTouch;
|
878
|
|
879
|
if ('MSGesture' in window) {
|
880
|
gesture = new MSGesture();
|
881
|
gesture.target = document.body;
|
882
|
}
|
883
|
|
884
|
$(document)
|
885
|
.on('MSGestureEnd gestureend', function(e){
|
886
|
|
887
|
var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
|
888
|
|
889
|
if (swipeDirectionFromVelocity && touch.el !== undefined) {
|
890
|
touch.el.trigger('swipe');
|
891
|
touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
|
892
|
}
|
893
|
})
|
894
|
// MSPointerDown: for IE10
|
895
|
// pointerdown: for IE11
|
896
|
.on('touchstart MSPointerDown pointerdown', function(e){
|
897
|
|
898
|
if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
|
899
|
|
900
|
firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
|
901
|
|
902
|
now = Date.now();
|
903
|
delta = now - (touch.last || now);
|
904
|
touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
|
905
|
|
906
|
if(touchTimeout) clearTimeout(touchTimeout);
|
907
|
|
908
|
touch.x1 = firstTouch.pageX;
|
909
|
touch.y1 = firstTouch.pageY;
|
910
|
|
911
|
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
|
912
|
|
913
|
touch.last = now;
|
914
|
longTapTimeout = setTimeout(longTap, longTapDelay);
|
915
|
|
916
|
// adds the current touch contact for IE gesture recognition
|
917
|
if (e.originalEvent && e.originalEvent.pointerId && gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
|
918
|
gesture.addPointer(e.originalEvent.pointerId);
|
919
|
}
|
920
|
|
921
|
})
|
922
|
// MSPointerMove: for IE10
|
923
|
// pointermove: for IE11
|
924
|
.on('touchmove MSPointerMove pointermove', function(e){
|
925
|
|
926
|
if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
|
927
|
|
928
|
firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
|
929
|
|
930
|
cancelLongTap();
|
931
|
touch.x2 = firstTouch.pageX;
|
932
|
touch.y2 = firstTouch.pageY;
|
933
|
|
934
|
deltaX += Math.abs(touch.x1 - touch.x2);
|
935
|
deltaY += Math.abs(touch.y1 - touch.y2);
|
936
|
})
|
937
|
// MSPointerUp: for IE10
|
938
|
// pointerup: for IE11
|
939
|
.on('touchend MSPointerUp pointerup', function(e){
|
940
|
|
941
|
if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
|
942
|
|
943
|
cancelLongTap();
|
944
|
|
945
|
// swipe
|
946
|
if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
|
947
|
|
948
|
swipeTimeout = setTimeout(function() {
|
949
|
if ( touch.el !== undefined ) {
|
950
|
touch.el.trigger('swipe');
|
951
|
touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
|
952
|
}
|
953
|
touch = {};
|
954
|
}, 0);
|
955
|
|
956
|
// normal tap
|
957
|
} else if ('last' in touch) {
|
958
|
|
959
|
// don't fire tap when delta position changed by more than 30 pixels,
|
960
|
// for instance when moving to a point and back to origin
|
961
|
if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
|
962
|
// delay by one tick so we can cancel the 'tap' event if 'scroll' fires
|
963
|
// ('tap' fires before 'scroll')
|
964
|
tapTimeout = setTimeout(function() {
|
965
|
|
966
|
// trigger universal 'tap' with the option to cancelTouch()
|
967
|
// (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
|
968
|
var event = $.Event('tap');
|
969
|
event.cancelTouch = cancelAll;
|
970
|
if ( touch.el !== undefined ) touch.el.trigger(event);
|
971
|
|
972
|
// trigger double tap immediately
|
973
|
if (touch.isDoubleTap) {
|
974
|
if ( touch.el !== undefined ) touch.el.trigger('doubleTap');
|
975
|
touch = {};
|
976
|
}
|
977
|
|
978
|
// trigger single tap after 250ms of inactivity
|
979
|
else {
|
980
|
touchTimeout = setTimeout(function(){
|
981
|
touchTimeout = null;
|
982
|
if ( touch.el !== undefined ) touch.el.trigger('singleTap');
|
983
|
touch = {};
|
984
|
}, 250);
|
985
|
}
|
986
|
}, 0);
|
987
|
} else {
|
988
|
touch = {};
|
989
|
}
|
990
|
deltaX = deltaY = 0;
|
991
|
}
|
992
|
})
|
993
|
// when the browser window loses focus,
|
994
|
// for example when a modal dialog is shown,
|
995
|
// cancel all ongoing events
|
996
|
.on('touchcancel MSPointerCancel pointercancel', function(e){
|
997
|
|
998
|
// Ignore pointercancel if the event supports touch events, to prevent pointercancel in swipe gesture
|
999
|
if ((e.type == 'touchcancel' && hasTouchEvents && hasTouch) || (!hasTouchEvents && e.type == 'pointercancel' && hasPointerEvents)) {
|
1000
|
cancelAll();
|
1001
|
}
|
1002
|
|
1003
|
});
|
1004
|
|
1005
|
// scrolling the window indicates intention of the user
|
1006
|
// to scroll, not tap or swipe, so cancel all ongoing events
|
1007
|
$(window).on('scroll', cancelAll);
|
1008
|
});
|
1009
|
|
1010
|
['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
|
1011
|
$.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
|
1012
|
});
|
1013
|
})(jQuery);
|
1014
|
|
1015
|
(function(UI) {
|
1016
|
|
1017
|
"use strict";
|
1018
|
|
1019
|
var stacks = [];
|
1020
|
|
1021
|
UI.component('stackMargin', {
|
1022
|
|
1023
|
defaults: {
|
1024
|
cls: 'uk-margin-small-top',
|
1025
|
rowfirst: false,
|
1026
|
observe: false
|
1027
|
},
|
1028
|
|
1029
|
boot: function() {
|
1030
|
|
1031
|
// init code
|
1032
|
UI.ready(function(context) {
|
1033
|
|
1034
|
UI.$('[data-uk-margin]', context).each(function() {
|
1035
|
|
1036
|
var ele = UI.$(this);
|
1037
|
|
1038
|
if (!ele.data('stackMargin')) {
|
1039
|
UI.stackMargin(ele, UI.Utils.options(ele.attr('data-uk-margin')));
|
1040
|
}
|
1041
|
});
|
1042
|
});
|
1043
|
},
|
1044
|
|
1045
|
init: function() {
|
1046
|
|
1047
|
var $this = this;
|
1048
|
|
1049
|
UI.$win.on('resize orientationchange', (function() {
|
1050
|
|
1051
|
var fn = function() {
|
1052
|
$this.process();
|
1053
|
};
|
1054
|
|
1055
|
UI.$(function() {
|
1056
|
fn();
|
1057
|
UI.$win.on('load', fn);
|
1058
|
});
|
1059
|
|
1060
|
return UI.Utils.debounce(fn, 20);
|
1061
|
})());
|
1062
|
|
1063
|
this.on('display.uk.check', function(e) {
|
1064
|
if (this.element.is(':visible')) this.process();
|
1065
|
}.bind(this));
|
1066
|
|
1067
|
if (this.options.observe) {
|
1068
|
|
1069
|
UI.domObserve(this.element, function(e) {
|
1070
|
if ($this.element.is(':visible')) $this.process();
|
1071
|
});
|
1072
|
}
|
1073
|
|
1074
|
stacks.push(this);
|
1075
|
},
|
1076
|
|
1077
|
process: function() {
|
1078
|
|
1079
|
var $this = this, columns = this.element.children();
|
1080
|
|
1081
|
UI.Utils.stackMargin(columns, this.options);
|
1082
|
|
1083
|
if (!this.options.rowfirst || !columns.length) {
|
1084
|
return this;
|
1085
|
}
|
1086
|
|
1087
|
// Mark first column elements
|
1088
|
var group = {}, minleft = false;
|
1089
|
|
1090
|
columns.removeClass(this.options.rowfirst).each(function(offset, $ele){
|
1091
|
|
1092
|
$ele = UI.$(this);
|
1093
|
|
1094
|
if (this.style.display != 'none') {
|
1095
|
offset = $ele.offset().left;
|
1096
|
((group[offset] = group[offset] || []) && group[offset]).push(this);
|
1097
|
minleft = minleft === false ? offset : Math.min(minleft, offset);
|
1098
|
}
|
1099
|
});
|
1100
|
|
1101
|
UI.$(group[minleft]).addClass(this.options.rowfirst);
|
1102
|
|
1103
|
return this;
|
1104
|
}
|
1105
|
|
1106
|
});
|
1107
|
|
1108
|
|
1109
|
// responsive element e.g. iframes
|
1110
|
|
1111
|
(function(){
|
1112
|
|
1113
|
var elements = [], check = function(ele) {
|
1114
|
|
1115
|
if (!ele.is(':visible')) return;
|
1116
|
|
1117
|
var width = ele.parent().width(),
|
1118
|
iwidth = ele.data('width'),
|
1119
|
ratio = (width / iwidth),
|
1120
|
height = Math.floor(ratio * ele.data('height'));
|
1121
|
|
1122
|
ele.css({height: (width < iwidth) ? height : ele.data('height')});
|
1123
|
};
|
1124
|
|
1125
|
UI.component('responsiveElement', {
|
1126
|
|
1127
|
defaults: {},
|
1128
|
|
1129
|
boot: function() {
|
1130
|
|
1131
|
// init code
|
1132
|
UI.ready(function(context) {
|
1133
|
|
1134
|
UI.$('iframe.uk-responsive-width, [data-uk-responsive]', context).each(function() {
|
1135
|
|
1136
|
var ele = UI.$(this), obj;
|
1137
|
|
1138
|
if (!ele.data('responsiveElement')) {
|
1139
|
obj = UI.responsiveElement(ele, {});
|
1140
|
}
|
1141
|
});
|
1142
|
});
|
1143
|
},
|
1144
|
|
1145
|
init: function() {
|
1146
|
|
1147
|
var ele = this.element;
|
1148
|
|
1149
|
if (ele.attr('width') && ele.attr('height')) {
|
1150
|
|
1151
|
ele.data({
|
1152
|
width : ele.attr('width'),
|
1153
|
height: ele.attr('height')
|
1154
|
}).on('display.uk.check', function(){
|
1155
|
check(ele);
|
1156
|
});
|
1157
|
|
1158
|
check(ele);
|
1159
|
|
1160
|
elements.push(ele);
|
1161
|
}
|
1162
|
}
|
1163
|
});
|
1164
|
|
1165
|
UI.$win.on('resize load', UI.Utils.debounce(function(){
|
1166
|
|
1167
|
elements.forEach(function(ele){
|
1168
|
check(ele);
|
1169
|
});
|
1170
|
|
1171
|
}, 15));
|
1172
|
|
1173
|
})();
|
1174
|
|
1175
|
|
1176
|
// helper
|
1177
|
|
1178
|
UI.Utils.stackMargin = function(elements, options) {
|
1179
|
|
1180
|
options = UI.$.extend({
|
1181
|
cls: 'uk-margin-small-top'
|
1182
|
}, options);
|
1183
|
|
1184
|
elements = UI.$(elements).removeClass(options.cls);
|
1185
|
|
1186
|
var min = false;
|
1187
|
|
1188
|
elements.each(function(offset, height, pos, $ele){
|
1189
|
|
1190
|
$ele = UI.$(this);
|
1191
|
|
1192
|
if ($ele.css('display') != 'none') {
|
1193
|
|
1194
|
offset = $ele.offset();
|
1195
|
height = $ele.outerHeight();
|
1196
|
pos = offset.top + height;
|
1197
|
|
1198
|
$ele.data({
|
1199
|
ukMarginPos: pos,
|
1200
|
ukMarginTop: offset.top
|
1201
|
});
|
1202
|
|
1203
|
if (min === false || (offset.top < min.top) ) {
|
1204
|
|
1205
|
min = {
|
1206
|
top : offset.top,
|
1207
|
left : offset.left,
|
1208
|
pos : pos
|
1209
|
};
|
1210
|
}
|
1211
|
}
|
1212
|
|
1213
|
}).each(function($ele) {
|
1214
|
|
1215
|
$ele = UI.$(this);
|
1216
|
|
1217
|
if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
|
1218
|
$ele.addClass(options.cls);
|
1219
|
}
|
1220
|
});
|
1221
|
};
|
1222
|
|
1223
|
UI.Utils.matchHeights = function(elements, options) {
|
1224
|
|
1225
|
elements = UI.$(elements).css('min-height', '');
|
1226
|
options = UI.$.extend({ row : true }, options);
|
1227
|
|
1228
|
var matchHeights = function(group){
|
1229
|
|
1230
|
if (group.length < 2) return;
|
1231
|
|
1232
|
var max = 0;
|
1233
|
|
1234
|
group.each(function() {
|
1235
|
max = Math.max(max, UI.$(this).outerHeight());
|
1236
|
}).each(function() {
|
1237
|
|
1238
|
var element = UI.$(this),
|
1239
|
height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
|
1240
|
|
1241
|
element.css('min-height', height + 'px');
|
1242
|
});
|
1243
|
};
|
1244
|
|
1245
|
if (options.row) {
|
1246
|
|
1247
|
elements.first().width(); // force redraw
|
1248
|
|
1249
|
setTimeout(function(){
|
1250
|
|
1251
|
var lastoffset = false, group = [];
|
1252
|
|
1253
|
elements.each(function() {
|
1254
|
|
1255
|
var ele = UI.$(this), offset = ele.offset().top;
|
1256
|
|
1257
|
if (offset != lastoffset && group.length) {
|
1258
|
|
1259
|
matchHeights(UI.$(group));
|
1260
|
group = [];
|
1261
|
offset = ele.offset().top;
|
1262
|
}
|
1263
|
|
1264
|
group.push(ele);
|
1265
|
lastoffset = offset;
|
1266
|
});
|
1267
|
|
1268
|
if (group.length) {
|
1269
|
matchHeights(UI.$(group));
|
1270
|
}
|
1271
|
|
1272
|
}, 0);
|
1273
|
|
1274
|
} else {
|
1275
|
matchHeights(elements);
|
1276
|
}
|
1277
|
};
|
1278
|
|
1279
|
(function(cacheSvgs){
|
1280
|
|
1281
|
UI.Utils.inlineSvg = function(selector, root) {
|
1282
|
|
1283
|
var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
|
1284
|
|
1285
|
var img = UI.$(this),
|
1286
|
src = img.attr('src');
|
1287
|
|
1288
|
if (!cacheSvgs[src]) {
|
1289
|
|
1290
|
var d = UI.$.Deferred();
|
1291
|
|
1292
|
UI.$.get(src, {nc: Math.random()}, function(data){
|
1293
|
d.resolve(UI.$(data).find('svg'));
|
1294
|
});
|
1295
|
|
1296
|
cacheSvgs[src] = d.promise();
|
1297
|
}
|
1298
|
|
1299
|
cacheSvgs[src].then(function(svg) {
|
1300
|
|
1301
|
var $svg = UI.$(svg).clone();
|
1302
|
|
1303
|
if (img.attr('id')) $svg.attr('id', img.attr('id'));
|
1304
|
if (img.attr('class')) $svg.attr('class', img.attr('class'));
|
1305
|
if (img.attr('style')) $svg.attr('style', img.attr('style'));
|
1306
|
|
1307
|
if (img.attr('width')) {
|
1308
|
$svg.attr('width', img.attr('width'));
|
1309
|
if (!img.attr('height')) $svg.removeAttr('height');
|
1310
|
}
|
1311
|
|
1312
|
if (img.attr('height')){
|
1313
|
$svg.attr('height', img.attr('height'));
|
1314
|
if (!img.attr('width')) $svg.removeAttr('width');
|
1315
|
}
|
1316
|
|
1317
|
img.replaceWith($svg);
|
1318
|
});
|
1319
|
});
|
1320
|
};
|
1321
|
|
1322
|
// init code
|
1323
|
UI.ready(function(context) {
|
1324
|
UI.Utils.inlineSvg('[data-uk-svg]', context);
|
1325
|
});
|
1326
|
|
1327
|
})({});
|
1328
|
|
1329
|
UI.Utils.getCssVar = function(name) {
|
1330
|
|
1331
|
/* usage in css: .var-name:before { content:"xyz" } */
|
1332
|
|
1333
|
var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
|
1334
|
|
1335
|
element.classList.add('var-'+name);
|
1336
|
|
1337
|
try {
|
1338
|
val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
|
1339
|
} catch (e) {
|
1340
|
val = undefined;
|
1341
|
}
|
1342
|
|
1343
|
doc.removeChild(element);
|
1344
|
|
1345
|
return val;
|
1346
|
}
|
1347
|
|
1348
|
})(UIkit2);
|
1349
|
|
1350
|
(function(UI) {
|
1351
|
|
1352
|
"use strict";
|
1353
|
|
1354
|
UI.component('smoothScroll', {
|
1355
|
|
1356
|
boot: function() {
|
1357
|
|
1358
|
// init code
|
1359
|
UI.$html.on('click.smooth-scroll.uikit', '[data-uk-smooth-scroll]', function(e) {
|
1360
|
var ele = UI.$(this);
|
1361
|
|
1362
|
if (!ele.data('smoothScroll')) {
|
1363
|
var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr('data-uk-smooth-scroll')));
|
1364
|
ele.trigger('click');
|
1365
|
}
|
1366
|
|
1367
|
return false;
|
1368
|
});
|
1369
|
},
|
1370
|
|
1371
|
init: function() {
|
1372
|
|
1373
|
var $this = this;
|
1374
|
|
1375
|
this.on('click', function(e) {
|
1376
|
e.preventDefault();
|
1377
|
scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$('body'), $this.options);
|
1378
|
});
|
1379
|
}
|
1380
|
});
|
1381
|
|
1382
|
function scrollToElement(ele, options) {
|
1383
|
|
1384
|
options = UI.$.extend({
|
1385
|
duration: 1000,
|
1386
|
transition: 'easeOutExpo',
|
1387
|
offset: 0,
|
1388
|
complete: function(){}
|
1389
|
}, options);
|
1390
|
|
1391
|
// get / set parameters
|
1392
|
var target = ele.offset().top - options.offset,
|
1393
|
docheight = UI.$doc.height(),
|
1394
|
winheight = window.innerHeight;
|
1395
|
|
1396
|
if ((target + winheight) > docheight) {
|
1397
|
target = docheight - winheight;
|
1398
|
}
|
1399
|
|
1400
|
// animate to target, fire callback when done
|
1401
|
UI.$('html,body').stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
|
1402
|
}
|
1403
|
|
1404
|
UI.Utils.scrollToElement = scrollToElement;
|
1405
|
|
1406
|
if (!UI.$.easing.easeOutExpo) {
|
1407
|
UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
|
1408
|
}
|
1409
|
|
1410
|
})(UIkit2);
|
1411
|
|
1412
|
(function(UI) {
|
1413
|
|
1414
|
"use strict";
|
1415
|
|
1416
|
var $win = UI.$win,
|
1417
|
$doc = UI.$doc,
|
1418
|
scrollspies = [],
|
1419
|
checkScrollSpy = function() {
|
1420
|
for(var i=0; i < scrollspies.length; i++) {
|
1421
|
window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
|
1422
|
}
|
1423
|
};
|
1424
|
|
1425
|
UI.component('scrollspy', {
|
1426
|
|
1427
|
defaults: {
|
1428
|
target : false,
|
1429
|
cls : 'uk-scrollspy-inview',
|
1430
|
initcls : 'uk-scrollspy-init-inview',
|
1431
|
topoffset : 0,
|
1432
|
leftoffset : 0,
|
1433
|
repeat : false,
|
1434
|
delay : 0
|
1435
|
},
|
1436
|
|
1437
|
boot: function() {
|
1438
|
|
1439
|
// listen to scroll and resize
|
1440
|
$doc.on('scrolling.uk.document', checkScrollSpy);
|
1441
|
$win.on('load resize orientationchange', UI.Utils.debounce(checkScrollSpy, 50));
|
1442
|
|
1443
|
// init code
|
1444
|
UI.ready(function(context) {
|
1445
|
|
1446
|
UI.$('[data-uk-scrollspy]', context).each(function() {
|
1447
|
|
1448
|
var element = UI.$(this);
|
1449
|
|
1450
|
if (!element.data('scrollspy')) {
|
1451
|
var obj = UI.scrollspy(element, UI.Utils.options(element.attr('data-uk-scrollspy')));
|
1452
|
}
|
1453
|
});
|
1454
|
});
|
1455
|
},
|
1456
|
|
1457
|
init: function() {
|
1458
|
|
1459
|
var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
|
1460
|
|
1461
|
var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
|
1462
|
delayIdx = elements.length === 1 ? 1 : 0,
|
1463
|
toggleclsIdx = 0;
|
1464
|
|
1465
|
elements.each(function(idx){
|
1466
|
|
1467
|
var element = UI.$(this),
|
1468
|
inviewstate = element.data('inviewstate'),
|
1469
|
inview = UI.Utils.isInView(element, $this.options),
|
1470
|
toggle = element.attr('data-uk-scrollspy-cls') || togglecls[toggleclsIdx].trim();
|
1471
|
|
1472
|
if (inview && !inviewstate && !element.data('scrollspy-idle')) {
|
1473
|
|
1474
|
if (!initinview) {
|
1475
|
element.addClass($this.options.initcls);
|
1476
|
$this.offset = element.offset();
|
1477
|
initinview = true;
|
1478
|
|
1479
|
element.trigger('init.uk.scrollspy');
|
1480
|
}
|
1481
|
|
1482
|
element.data('scrollspy-idle', setTimeout(function(){
|
1483
|
|
1484
|
element.addClass('uk-scrollspy-inview').toggleClass(toggle).width();
|
1485
|
element.trigger('inview.uk.scrollspy');
|
1486
|
|
1487
|
element.data('scrollspy-idle', false);
|
1488
|
element.data('inviewstate', true);
|
1489
|
|
1490
|
}, $this.options.delay * delayIdx));
|
1491
|
|
1492
|
delayIdx++;
|
1493
|
}
|
1494
|
|
1495
|
if (!inview && inviewstate && $this.options.repeat) {
|
1496
|
|
1497
|
if (element.data('scrollspy-idle')) {
|
1498
|
clearTimeout(element.data('scrollspy-idle'));
|
1499
|
element.data('scrollspy-idle', false);
|
1500
|
}
|
1501
|
|
1502
|
element.removeClass('uk-scrollspy-inview').toggleClass(toggle);
|
1503
|
element.data('inviewstate', false);
|
1504
|
|
1505
|
element.trigger('outview.uk.scrollspy');
|
1506
|
}
|
1507
|
|
1508
|
toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
|
1509
|
|
1510
|
});
|
1511
|
};
|
1512
|
|
1513
|
fn();
|
1514
|
|
1515
|
this.check = fn;
|
1516
|
|
1517
|
scrollspies.push(this);
|
1518
|
}
|
1519
|
});
|
1520
|
|
1521
|
|
1522
|
var scrollspynavs = [],
|
1523
|
checkScrollSpyNavs = function() {
|
1524
|
for(var i=0; i < scrollspynavs.length; i++) {
|
1525
|
window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
|
1526
|
}
|
1527
|
};
|
1528
|
|
1529
|
UI.component('scrollspynav', {
|
1530
|
|
1531
|
defaults: {
|
1532
|
cls : 'uk-active',
|
1533
|
closest : false,
|
1534
|
topoffset : 0,
|
1535
|
leftoffset : 0,
|
1536
|
smoothscroll : false
|
1537
|
},
|
1538
|
|
1539
|
boot: function() {
|
1540
|
|
1541
|
// listen to scroll and resize
|
1542
|
$doc.on('scrolling.uk.document', checkScrollSpyNavs);
|
1543
|
$win.on('resize orientationchange', UI.Utils.debounce(checkScrollSpyNavs, 50));
|
1544
|
|
1545
|
// init code
|
1546
|
UI.ready(function(context) {
|
1547
|
|
1548
|
UI.$('[data-uk-scrollspy-nav]', context).each(function() {
|
1549
|
|
1550
|
var element = UI.$(this);
|
1551
|
|
1552
|
if (!element.data('scrollspynav')) {
|
1553
|
var obj = UI.scrollspynav(element, UI.Utils.options(element.attr('data-uk-scrollspy-nav')));
|
1554
|
}
|
1555
|
});
|
1556
|
});
|
1557
|
},
|
1558
|
|
1559
|
init: function() {
|
1560
|
|
1561
|
var ids = [],
|
1562
|
links = this.find("a[href^='#']").each(function(){ if(this.getAttribute('href').trim()!=='#') ids.push(this.getAttribute('href')); }),
|
1563
|
targets = UI.$(ids.join(",")),
|
1564
|
|
1565
|
clsActive = this.options.cls,
|
1566
|
clsClosest = this.options.closest || this.options.closest;
|
1567
|
|
1568
|
var $this = this, inviews, fn = function(){
|
1569
|
|
1570
|
inviews = [];
|
1571
|
|
1572
|
for (var i=0 ; i < targets.length ; i++) {
|
1573
|
if (UI.Utils.isInView(targets.eq(i), $this.options)) {
|
1574
|
inviews.push(targets.eq(i));
|
1575
|
}
|
1576
|
}
|
1577
|
|
1578
|
if (inviews.length) {
|
1579
|
|
1580
|
var navitems,
|
1581
|
scrollTop = $win.scrollTop(),
|
1582
|
target = (function(){
|
1583
|
for(var i=0; i< inviews.length;i++){
|
1584
|
if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
|
1585
|
return inviews[i];
|
1586
|
}
|
1587
|
}
|
1588
|
})();
|
1589
|
|
1590
|
if (!target) return;
|
1591
|
|
1592
|
if ($this.options.closest) {
|
1593
|
links.blur().closest(clsClosest).removeClass(clsActive);
|
1594
|
navitems = links.filter("a[href='#"+target.attr('id')+"']").closest(clsClosest).addClass(clsActive);
|
1595
|
} else {
|
1596
|
navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
|
1597
|
}
|
1598
|
|
1599
|
$this.element.trigger('inview.uk.scrollspynav', [target, navitems]);
|
1600
|
}
|
1601
|
};
|
1602
|
|
1603
|
if (this.options.smoothscroll && UI.smoothScroll) {
|
1604
|
links.each(function(){
|
1605
|
UI.smoothScroll(this, $this.options.smoothscroll);
|
1606
|
});
|
1607
|
}
|
1608
|
|
1609
|
fn();
|
1610
|
|
1611
|
this.element.data('scrollspynav', this);
|
1612
|
|
1613
|
this.check = fn;
|
1614
|
scrollspynavs.push(this);
|
1615
|
|
1616
|
}
|
1617
|
});
|
1618
|
|
1619
|
})(UIkit2);
|
1620
|
|
1621
|
(function(UI){
|
1622
|
|
1623
|
"use strict";
|
1624
|
|
1625
|
var toggles = [];
|
1626
|
|
1627
|
UI.component('toggle', {
|
1628
|
|
1629
|
defaults: {
|
1630
|
target : false,
|
1631
|
cls : 'uk-hidden',
|
1632
|
animation : false,
|
1633
|
duration : 200
|
1634
|
},
|
1635
|
|
1636
|
boot: function(){
|
1637
|
|
1638
|
// init code
|
1639
|
UI.ready(function(context) {
|
1640
|
|
1641
|
UI.$('[data-uk-toggle]', context).each(function() {
|
1642
|
var ele = UI.$(this);
|
1643
|
|
1644
|
if (!ele.data('toggle')) {
|
1645
|
var obj = UI.toggle(ele, UI.Utils.options(ele.attr('data-uk-toggle')));
|
1646
|
}
|
1647
|
});
|
1648
|
|
1649
|
setTimeout(function(){
|
1650
|
|
1651
|
toggles.forEach(function(toggle){
|
1652
|
toggle.getToggles();
|
1653
|
});
|
1654
|
|
1655
|
}, 0);
|
1656
|
});
|
1657
|
},
|
1658
|
|
1659
|
init: function() {
|
1660
|
|
1661
|
var $this = this;
|
1662
|
|
1663
|
this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
|
1664
|
|
1665
|
this.on('click', function(e) {
|
1666
|
|
1667
|
if ($this.element.is('a[href="#"]')) {
|
1668
|
e.preventDefault();
|
1669
|
}
|
1670
|
|
1671
|
$this.toggle();
|
1672
|
});
|
1673
|
|
1674
|
toggles.push(this);
|
1675
|
},
|
1676
|
|
1677
|
toggle: function() {
|
1678
|
|
1679
|
this.getToggles();
|
1680
|
|
1681
|
if(!this.totoggle.length) return;
|
1682
|
|
1683
|
if (this.options.animation && UI.support.animation) {
|
1684
|
|
1685
|
var $this = this, animations = this.options.animation.split(',');
|
1686
|
|
1687
|
if (animations.length == 1) {
|
1688
|
animations[1] = animations[0];
|
1689
|
}
|
1690
|
|
1691
|
animations[0] = animations[0].trim();
|
1692
|
animations[1] = animations[1].trim();
|
1693
|
|
1694
|
this.totoggle.css('animation-duration', this.options.duration+'ms');
|
1695
|
|
1696
|
this.totoggle.each(function(){
|
1697
|
|
1698
|
var ele = UI.$(this);
|
1699
|
|
1700
|
if (ele.hasClass($this.options.cls)) {
|
1701
|
|
1702
|
ele.toggleClass($this.options.cls);
|
1703
|
|
1704
|
UI.Utils.animate(ele, animations[0]).then(function(){
|
1705
|
ele.css('animation-duration', '');
|
1706
|
UI.Utils.checkDisplay(ele);
|
1707
|
});
|
1708
|
|
1709
|
} else {
|
1710
|
|
1711
|
UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
|
1712
|
ele.toggleClass($this.options.cls).css('animation-duration', '');
|
1713
|
UI.Utils.checkDisplay(ele);
|
1714
|
});
|
1715
|
|
1716
|
}
|
1717
|
|
1718
|
});
|
1719
|
|
1720
|
} else {
|
1721
|
this.totoggle.toggleClass(this.options.cls);
|
1722
|
UI.Utils.checkDisplay(this.totoggle);
|
1723
|
}
|
1724
|
|
1725
|
this.updateAria();
|
1726
|
|
1727
|
},
|
1728
|
|
1729
|
getToggles: function() {
|
1730
|
this.totoggle = this.options.target ? UI.$(this.options.target):[];
|
1731
|
this.updateAria();
|
1732
|
},
|
1733
|
|
1734
|
updateAria: function() {
|
1735
|
if (this.aria && this.totoggle.length) {
|
1736
|
this.totoggle.not('[aria-hidden]').each(function(){
|
1737
|
UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
|
1738
|
});
|
1739
|
}
|
1740
|
}
|
1741
|
});
|
1742
|
|
1743
|
})(UIkit2);
|
1744
|
|
1745
|
(function(UI) {
|
1746
|
|
1747
|
"use strict";
|
1748
|
|
1749
|
UI.component('alert', {
|
1750
|
|
1751
|
defaults: {
|
1752
|
fade: true,
|
1753
|
duration: 200,
|
1754
|
trigger: '.uk-alert-close'
|
1755
|
},
|
1756
|
|
1757
|
boot: function() {
|
1758
|
|
1759
|
// init code
|
1760
|
UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) {
|
1761
|
|
1762
|
var ele = UI.$(this);
|
1763
|
|
1764
|
if (!ele.data('alert')) {
|
1765
|
|
1766
|
var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert')));
|
1767
|
|
1768
|
if (UI.$(e.target).is(alert.options.trigger)) {
|
1769
|
e.preventDefault();
|
1770
|
alert.close();
|
1771
|
}
|
1772
|
}
|
1773
|
});
|
1774
|
},
|
1775
|
|
1776
|
init: function() {
|
1777
|
|
1778
|
var $this = this;
|
1779
|
|
1780
|
this.on('click', this.options.trigger, function(e) {
|
1781
|
e.preventDefault();
|
1782
|
$this.close();
|
1783
|
});
|
1784
|
},
|
1785
|
|
1786
|
close: function() {
|
1787
|
|
1788
|
var element = this.trigger('close.uk.alert'),
|
1789
|
removeElement = function () {
|
1790
|
this.trigger('closed.uk.alert').remove();
|
1791
|
}.bind(this);
|
1792
|
|
1793
|
if (this.options.fade) {
|
1794
|
element.css('overflow', 'hidden').css("max-height", element.height()).animate({
|
1795
|
height : 0,
|
1796
|
opacity : 0,
|
1797
|
paddingTop : 0,
|
1798
|
paddingBottom : 0,
|
1799
|
marginTop : 0,
|
1800
|
marginBottom : 0
|
1801
|
}, this.options.duration, removeElement);
|
1802
|
} else {
|
1803
|
removeElement();
|
1804
|
}
|
1805
|
}
|
1806
|
|
1807
|
});
|
1808
|
|
1809
|
})(UIkit2);
|
1810
|
|
1811
|
(function(UI) {
|
1812
|
|
1813
|
"use strict";
|
1814
|
|
1815
|
UI.component('buttonRadio', {
|
1816
|
|
1817
|
defaults: {
|
1818
|
activeClass: 'uk-active',
|
1819
|
target: '.uk-button'
|
1820
|
},
|
1821
|
|
1822
|
boot: function() {
|
1823
|
|
1824
|
// init code
|
1825
|
UI.$html.on('click.buttonradio.uikit', '[data-uk-button-radio]', function(e) {
|
1826
|
|
1827
|
var ele = UI.$(this);
|
1828
|
|
1829
|
if (!ele.data('buttonRadio')) {
|
1830
|
|
1831
|
var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr('data-uk-button-radio'))),
|
1832
|
target = UI.$(e.target);
|
1833
|
|
1834
|
if (target.is(obj.options.target)) {
|
1835
|
target.trigger('click');
|
1836
|
}
|
1837
|
}
|
1838
|
});
|
1839
|
},
|
1840
|
|
1841
|
init: function() {
|
1842
|
|
1843
|
var $this = this;
|
1844
|
|
1845
|
// Init ARIA
|
1846
|
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
1847
|
|
1848
|
this.on('click', this.options.target, function(e) {
|
1849
|
|
1850
|
var ele = UI.$(this);
|
1851
|
|
1852
|
if (ele.is('a[href="#"]')) e.preventDefault();
|
1853
|
|
1854
|
$this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
|
1855
|
ele.addClass($this.options.activeClass);
|
1856
|
|
1857
|
// Update ARIA
|
1858
|
$this.find($this.options.target).not(ele).attr('aria-checked', 'false');
|
1859
|
ele.attr('aria-checked', 'true');
|
1860
|
|
1861
|
$this.trigger('change.uk.button', [ele]);
|
1862
|
});
|
1863
|
|
1864
|
},
|
1865
|
|
1866
|
getSelected: function() {
|
1867
|
return this.find('.' + this.options.activeClass);
|
1868
|
}
|
1869
|
});
|
1870
|
|
1871
|
UI.component('buttonCheckbox', {
|
1872
|
|
1873
|
defaults: {
|
1874
|
activeClass: 'uk-active',
|
1875
|
target: '.uk-button'
|
1876
|
},
|
1877
|
|
1878
|
boot: function() {
|
1879
|
|
1880
|
UI.$html.on('click.buttoncheckbox.uikit', '[data-uk-button-checkbox]', function(e) {
|
1881
|
var ele = UI.$(this);
|
1882
|
|
1883
|
if (!ele.data('buttonCheckbox')) {
|
1884
|
|
1885
|
var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr('data-uk-button-checkbox'))),
|
1886
|
target = UI.$(e.target);
|
1887
|
|
1888
|
if (target.is(obj.options.target)) {
|
1889
|
target.trigger('click');
|
1890
|
}
|
1891
|
}
|
1892
|
});
|
1893
|
},
|
1894
|
|
1895
|
init: function() {
|
1896
|
|
1897
|
var $this = this;
|
1898
|
|
1899
|
// Init ARIA
|
1900
|
this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
|
1901
|
|
1902
|
this.on('click', this.options.target, function(e) {
|
1903
|
var ele = UI.$(this);
|
1904
|
|
1905
|
if (ele.is('a[href="#"]')) e.preventDefault();
|
1906
|
|
1907
|
ele.toggleClass($this.options.activeClass).blur();
|
1908
|
|
1909
|
// Update ARIA
|
1910
|
ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
|
1911
|
|
1912
|
$this.trigger('change.uk.button', [ele]);
|
1913
|
});
|
1914
|
|
1915
|
},
|
1916
|
|
1917
|
getSelected: function() {
|
1918
|
return this.find('.' + this.options.activeClass);
|
1919
|
}
|
1920
|
});
|
1921
|
|
1922
|
|
1923
|
UI.component('button', {
|
1924
|
|
1925
|
defaults: {},
|
1926
|
|
1927
|
boot: function() {
|
1928
|
|
1929
|
UI.$html.on('click.button.uikit', '[data-uk-button]', function(e) {
|
1930
|
var ele = UI.$(this);
|
1931
|
|
1932
|
if (!ele.data('button')) {
|
1933
|
|
1934
|
var obj = UI.button(ele, UI.Utils.options(ele.attr('data-uk-button')));
|
1935
|
ele.trigger('click');
|
1936
|
}
|
1937
|
});
|
1938
|
},
|
1939
|
|
1940
|
init: function() {
|
1941
|
|
1942
|
var $this = this;
|
1943
|
|
1944
|
// Init ARIA
|
1945
|
this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
|
1946
|
|
1947
|
this.on('click', function(e) {
|
1948
|
|
1949
|
if ($this.element.is('a[href="#"]')) e.preventDefault();
|
1950
|
|
1951
|
$this.toggle();
|
1952
|
$this.trigger('change.uk.button', [$this.element.blur().hasClass('uk-active')]);
|
1953
|
});
|
1954
|
|
1955
|
},
|
1956
|
|
1957
|
toggle: function() {
|
1958
|
this.element.toggleClass('uk-active');
|
1959
|
|
1960
|
// Update ARIA
|
1961
|
this.element.attr('aria-pressed', this.element.hasClass('uk-active'));
|
1962
|
}
|
1963
|
});
|
1964
|
|
1965
|
})(UIkit2);
|
1966
|
|
1967
|
(function(UI) {
|
1968
|
|
1969
|
"use strict";
|
1970
|
|
1971
|
var active = false, hoverIdle, flips = {
|
1972
|
x: {
|
1973
|
'bottom-left' : 'bottom-right',
|
1974
|
'bottom-right' : 'bottom-left',
|
1975
|
'bottom-center' : 'bottom-center',
|
1976
|
'top-left' : 'top-right',
|
1977
|
'top-right' : 'top-left',
|
1978
|
'top-center' : 'top-center',
|
1979
|
'left-top' : 'right-top',
|
1980
|
'left-bottom' : 'right-bottom',
|
1981
|
'left-center' : 'right-center',
|
1982
|
'right-top' : 'left-top',
|
1983
|
'right-bottom' : 'left-bottom',
|
1984
|
'right-center' : 'left-center'
|
1985
|
},
|
1986
|
y: {
|
1987
|
'bottom-left' : 'top-left',
|
1988
|
'bottom-right' : 'top-right',
|
1989
|
'bottom-center' : 'top-center',
|
1990
|
'top-left' : 'bottom-left',
|
1991
|
'top-right' : 'bottom-right',
|
1992
|
'top-center' : 'bottom-center',
|
1993
|
'left-top' : 'left-bottom',
|
1994
|
'left-bottom' : 'left-top',
|
1995
|
'left-center' : 'left-center',
|
1996
|
'right-top' : 'right-bottom',
|
1997
|
'right-bottom' : 'right-top',
|
1998
|
'right-center' : 'right-center'
|
1999
|
},
|
2000
|
xy: {
|
2001
|
'bottom-left' : 'top-right',
|
2002
|
'bottom-right' : 'top-left',
|
2003
|
'bottom-center' : 'top-center',
|
2004
|
'top-left' : 'bottom-right',
|
2005
|
'top-right' : 'bottom-left',
|
2006
|
'top-center' : 'bottom-center',
|
2007
|
'left-top' : 'right-bottom',
|
2008
|
'left-bottom' : 'right-top',
|
2009
|
'left-center' : 'right-center',
|
2010
|
'right-top' : 'left-bottom',
|
2011
|
'right-bottom' : 'left-top',
|
2012
|
'right-center' : 'left-center'
|
2013
|
}
|
2014
|
};
|
2015
|
|
2016
|
UI.component('dropdown', {
|
2017
|
|
2018
|
defaults: {
|
2019
|
mode : 'hover',
|
2020
|
pos : 'bottom-left',
|
2021
|
offset : 0,
|
2022
|
remaintime : 800,
|
2023
|
justify : false,
|
2024
|
boundary : UI.$win,
|
2025
|
delay : 0,
|
2026
|
dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
|
2027
|
hoverDelayIdle : 250,
|
2028
|
preventflip : false
|
2029
|
},
|
2030
|
|
2031
|
remainIdle: false,
|
2032
|
|
2033
|
boot: function() {
|
2034
|
|
2035
|
var triggerevent = UI.support.touch ? 'click' : 'mouseenter';
|
2036
|
|
2037
|
// init code
|
2038
|
UI.$html.on(triggerevent+'.dropdown.uikit focus pointerdown', '[data-uk-dropdown]', function(e) {
|
2039
|
|
2040
|
var ele = UI.$(this);
|
2041
|
|
2042
|
if (!ele.data('dropdown')) {
|
2043
|
|
2044
|
var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr('data-uk-dropdown')));
|
2045
|
|
2046
|
if (e.type=='click' || (e.type=='mouseenter' && dropdown.options.mode=='hover')) {
|
2047
|
dropdown.element.trigger(triggerevent);
|
2048
|
}
|
2049
|
|
2050
|
if (dropdown.dropdown.length) {
|
2051
|
e.preventDefault();
|
2052
|
}
|
2053
|
}
|
2054
|
});
|
2055
|
},
|
2056
|
|
2057
|
init: function() {
|
2058
|
|
2059
|
var $this = this;
|
2060
|
|
2061
|
this.dropdown = this.find(this.options.dropdownSelector);
|
2062
|
this.offsetParent = this.dropdown.parents().filter(function() {
|
2063
|
return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
|
2064
|
}).slice(0,1);
|
2065
|
|
2066
|
if (!this.offsetParent.length) {
|
2067
|
this.offsetParent = this.element;
|
2068
|
}
|
2069
|
|
2070
|
this.centered = this.dropdown.hasClass('uk-dropdown-center');
|
2071
|
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
2072
|
|
2073
|
this.boundary = UI.$(this.options.boundary);
|
2074
|
|
2075
|
if (!this.boundary.length) {
|
2076
|
this.boundary = UI.$win;
|
2077
|
}
|
2078
|
|
2079
|
// legacy DEPRECATED!
|
2080
|
if (this.dropdown.hasClass('uk-dropdown-up')) {
|
2081
|
this.options.pos = 'top-left';
|
2082
|
}
|
2083
|
if (this.dropdown.hasClass('uk-dropdown-flip')) {
|
2084
|
this.options.pos = this.options.pos.replace('left','right');
|
2085
|
}
|
2086
|
if (this.dropdown.hasClass('uk-dropdown-center')) {
|
2087
|
this.options.pos = this.options.pos.replace(/(left|right)/,'center');
|
2088
|
}
|
2089
|
//-- end legacy
|
2090
|
|
2091
|
// Init ARIA
|
2092
|
this.element.attr('aria-haspopup', 'true');
|
2093
|
this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
|
2094
|
this.dropdown.attr('aria-hidden', 'true');
|
2095
|
|
2096
|
if (this.options.mode == 'click' || UI.support.touch) {
|
2097
|
|
2098
|
this.on('click.uk.dropdown', function(e) {
|
2099
|
|
2100
|
var $target = UI.$(e.target);
|
2101
|
|
2102
|
if (!$target.parents($this.options.dropdownSelector).length) {
|
2103
|
|
2104
|
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(':visible')) ){
|
2105
|
e.preventDefault();
|
2106
|
}
|
2107
|
|
2108
|
$target.blur();
|
2109
|
}
|
2110
|
|
2111
|
if (!$this.element.hasClass('uk-open')) {
|
2112
|
|
2113
|
$this.show();
|
2114
|
|
2115
|
} else {
|
2116
|
|
2117
|
if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
|
2118
|
$this.hide();
|
2119
|
}
|
2120
|
}
|
2121
|
});
|
2122
|
|
2123
|
} else {
|
2124
|
|
2125
|
this.on('mouseenter', function(e) {
|
2126
|
|
2127
|
$this.trigger('pointerenter.uk.dropdown', [$this]);
|
2128
|
|
2129
|
if ($this.remainIdle) {
|
2130
|
clearTimeout($this.remainIdle);
|
2131
|
}
|
2132
|
|
2133
|
if (hoverIdle) {
|
2134
|
clearTimeout(hoverIdle);
|
2135
|
}
|
2136
|
|
2137
|
if (active && active == $this) {
|
2138
|
return;
|
2139
|
}
|
2140
|
|
2141
|
// pseudo manuAim
|
2142
|
if (active && active != $this) {
|
2143
|
|
2144
|
hoverIdle = setTimeout(function() {
|
2145
|
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
2146
|
}, $this.options.hoverDelayIdle);
|
2147
|
|
2148
|
} else {
|
2149
|
|
2150
|
hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
|
2151
|
}
|
2152
|
|
2153
|
}).on('mouseleave', function() {
|
2154
|
|
2155
|
if (hoverIdle) {
|
2156
|
clearTimeout(hoverIdle);
|
2157
|
}
|
2158
|
|
2159
|
$this.remainIdle = setTimeout(function() {
|
2160
|
if (active && active == $this) $this.hide();
|
2161
|
}, $this.options.remaintime);
|
2162
|
|
2163
|
$this.trigger('pointerleave.uk.dropdown', [$this]);
|
2164
|
|
2165
|
}).on('click', function(e){
|
2166
|
|
2167
|
var $target = UI.$(e.target);
|
2168
|
|
2169
|
if ($this.remainIdle) {
|
2170
|
clearTimeout($this.remainIdle);
|
2171
|
}
|
2172
|
|
2173
|
if (active && active == $this) {
|
2174
|
if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
|
2175
|
$this.hide();
|
2176
|
}
|
2177
|
return;
|
2178
|
}
|
2179
|
|
2180
|
if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
|
2181
|
e.preventDefault();
|
2182
|
}
|
2183
|
|
2184
|
$this.show();
|
2185
|
});
|
2186
|
}
|
2187
|
},
|
2188
|
|
2189
|
show: function(){
|
2190
|
|
2191
|
UI.$html.off('click.outer.dropdown');
|
2192
|
|
2193
|
if (active && active != this) {
|
2194
|
active.hide(true);
|
2195
|
}
|
2196
|
|
2197
|
if (hoverIdle) {
|
2198
|
clearTimeout(hoverIdle);
|
2199
|
}
|
2200
|
|
2201
|
this.trigger('beforeshow.uk.dropdown', [this]);
|
2202
|
|
2203
|
this.checkDimensions();
|
2204
|
this.element.addClass('uk-open');
|
2205
|
|
2206
|
// Update ARIA
|
2207
|
this.element.attr('aria-expanded', 'true');
|
2208
|
this.dropdown.attr('aria-hidden', 'false');
|
2209
|
|
2210
|
this.trigger('show.uk.dropdown', [this]);
|
2211
|
|
2212
|
UI.Utils.checkDisplay(this.dropdown, true);
|
2213
|
UI.Utils.focus(this.dropdown);
|
2214
|
active = this;
|
2215
|
|
2216
|
this.registerOuterClick();
|
2217
|
},
|
2218
|
|
2219
|
hide: function(force) {
|
2220
|
|
2221
|
this.trigger('beforehide.uk.dropdown', [this, force]);
|
2222
|
|
2223
|
this.element.removeClass('uk-open');
|
2224
|
|
2225
|
if (this.remainIdle) {
|
2226
|
clearTimeout(this.remainIdle);
|
2227
|
}
|
2228
|
|
2229
|
this.remainIdle = false;
|
2230
|
|
2231
|
// Update ARIA
|
2232
|
this.element.attr('aria-expanded', 'false');
|
2233
|
this.dropdown.attr('aria-hidden', 'true');
|
2234
|
|
2235
|
this.trigger('hide.uk.dropdown', [this, force]);
|
2236
|
|
2237
|
if (active == this) active = false;
|
2238
|
},
|
2239
|
|
2240
|
registerOuterClick: function(){
|
2241
|
|
2242
|
var $this = this;
|
2243
|
|
2244
|
UI.$html.off('click.outer.dropdown');
|
2245
|
|
2246
|
setTimeout(function() {
|
2247
|
|
2248
|
UI.$html.on('click.outer.dropdown', function(e) {
|
2249
|
|
2250
|
if (hoverIdle) {
|
2251
|
clearTimeout(hoverIdle);
|
2252
|
}
|
2253
|
|
2254
|
var $target = UI.$(e.target);
|
2255
|
|
2256
|
if (active == $this && !$this.element.find(e.target).length) {
|
2257
|
$this.hide(true);
|
2258
|
UI.$html.off('click.outer.dropdown');
|
2259
|
}
|
2260
|
});
|
2261
|
}, 10);
|
2262
|
},
|
2263
|
|
2264
|
checkDimensions: function() {
|
2265
|
|
2266
|
if (!this.dropdown.length) return;
|
2267
|
|
2268
|
// reset
|
2269
|
this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack uk-dropdown-autoflip').css({
|
2270
|
topLeft :'',
|
2271
|
left :'',
|
2272
|
marginLeft :'',
|
2273
|
marginRight :''
|
2274
|
});
|
2275
|
|
2276
|
if (this.justified && this.justified.length) {
|
2277
|
this.dropdown.css('min-width', '');
|
2278
|
}
|
2279
|
|
2280
|
var $this = this,
|
2281
|
pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
|
2282
|
posoffset = this.options.offset,
|
2283
|
dropdown = this.dropdown,
|
2284
|
offset = dropdown.show().offset() || {left: 0, top: 0},
|
2285
|
width = dropdown.outerWidth(),
|
2286
|
height = dropdown.outerHeight(),
|
2287
|
boundarywidth = this.boundary.width(),
|
2288
|
boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
|
2289
|
dpos = this.options.pos;
|
2290
|
|
2291
|
var variants = {
|
2292
|
'bottom-left' : {top: 0 + pos.height + posoffset, left: 0},
|
2293
|
'bottom-right' : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
|
2294
|
'bottom-center' : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
|
2295
|
'top-left' : {top: 0 - height - posoffset, left: 0},
|
2296
|
'top-right' : {top: 0 - height - posoffset, left: 0 + pos.width - width},
|
2297
|
'top-center' : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
|
2298
|
'left-top' : {top: 0, left: 0 - width - posoffset},
|
2299
|
'left-bottom' : {top: 0 + pos.height - height, left: 0 - width - posoffset},
|
2300
|
'left-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
|
2301
|
'right-top' : {top: 0, left: 0 + pos.width + posoffset},
|
2302
|
'right-bottom' : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
|
2303
|
'right-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
|
2304
|
},
|
2305
|
css = {},
|
2306
|
pp;
|
2307
|
|
2308
|
pp = dpos.split('-');
|
2309
|
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
2310
|
|
2311
|
// justify dropdown
|
2312
|
if (this.justified && this.justified.length) {
|
2313
|
justify(dropdown.css({left:0}), this.justified, boundarywidth);
|
2314
|
} else {
|
2315
|
|
2316
|
if (this.options.preventflip !== true) {
|
2317
|
|
2318
|
var fdpos;
|
2319
|
|
2320
|
switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
|
2321
|
case "x":
|
2322
|
if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
|
2323
|
break;
|
2324
|
case "y":
|
2325
|
if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
|
2326
|
break;
|
2327
|
case "xy":
|
2328
|
if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
|
2329
|
break;
|
2330
|
}
|
2331
|
|
2332
|
if (fdpos) {
|
2333
|
|
2334
|
pp = fdpos.split('-');
|
2335
|
css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
|
2336
|
dropdown.addClass('uk-dropdown-autoflip');
|
2337
|
|
2338
|
// check flipped
|
2339
|
if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
|
2340
|
pp = dpos.split('-');
|
2341
|
css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
|
2342
|
}
|
2343
|
}
|
2344
|
}
|
2345
|
}
|
2346
|
|
2347
|
if (width > boundarywidth) {
|
2348
|
dropdown.addClass('uk-dropdown-stack');
|
2349
|
this.trigger('stack.uk.dropdown', [this]);
|
2350
|
}
|
2351
|
|
2352
|
dropdown.css(css).css('display', '').addClass('uk-dropdown-'+pp[0]);
|
2353
|
},
|
2354
|
|
2355
|
checkBoundary: function(left, top, width, height, boundarywidth) {
|
2356
|
|
2357
|
var axis = "";
|
2358
|
|
2359
|
if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
|
2360
|
axis += "x";
|
2361
|
}
|
2362
|
|
2363
|
if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
|
2364
|
axis += "y";
|
2365
|
}
|
2366
|
|
2367
|
return axis;
|
2368
|
}
|
2369
|
});
|
2370
|
|
2371
|
|
2372
|
UI.component('dropdownOverlay', {
|
2373
|
|
2374
|
defaults: {
|
2375
|
justify : false,
|
2376
|
cls : '',
|
2377
|
duration: 200
|
2378
|
},
|
2379
|
|
2380
|
boot: function() {
|
2381
|
|
2382
|
// init code
|
2383
|
UI.ready(function(context) {
|
2384
|
|
2385
|
UI.$('[data-uk-dropdown-overlay]', context).each(function() {
|
2386
|
var ele = UI.$(this);
|
2387
|
|
2388
|
if (!ele.data('dropdownOverlay')) {
|
2389
|
UI.dropdownOverlay(ele, UI.Utils.options(ele.attr('data-uk-dropdown-overlay')));
|
2390
|
}
|
2391
|
});
|
2392
|
});
|
2393
|
},
|
2394
|
|
2395
|
init: function() {
|
2396
|
|
2397
|
var $this = this;
|
2398
|
|
2399
|
this.justified = this.options.justify ? UI.$(this.options.justify) : false;
|
2400
|
this.overlay = this.element.find('uk-dropdown-overlay');
|
2401
|
|
2402
|
if (!this.overlay.length) {
|
2403
|
this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
|
2404
|
}
|
2405
|
|
2406
|
this.overlay.addClass(this.options.cls);
|
2407
|
|
2408
|
this.on({
|
2409
|
|
2410
|
'beforeshow.uk.dropdown': function(e, dropdown) {
|
2411
|
$this.dropdown = dropdown;
|
2412
|
|
2413
|
if ($this.justified && $this.justified.length) {
|
2414
|
justify($this.overlay.css({display:'block', marginLeft:'', marginRight:''}), $this.justified, $this.justified.outerWidth());
|
2415
|
}
|
2416
|
},
|
2417
|
|
2418
|
'show.uk.dropdown': function(e, dropdown) {
|
2419
|
|
2420
|
var h = $this.dropdown.dropdown.outerHeight(true);
|
2421
|
|
2422
|
$this.dropdown.element.removeClass('uk-open');
|
2423
|
|
2424
|
$this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
|
2425
|
|
2426
|
$this.dropdown.dropdown.css('visibility', '');
|
2427
|
$this.dropdown.element.addClass('uk-open');
|
2428
|
|
2429
|
UI.Utils.checkDisplay($this.dropdown.dropdown, true);
|
2430
|
});
|
2431
|
|
2432
|
$this.pointerleave = false;
|
2433
|
},
|
2434
|
|
2435
|
'hide.uk.dropdown': function() {
|
2436
|
$this.overlay.stop().animate({height: 0}, $this.options.duration);
|
2437
|
},
|
2438
|
|
2439
|
'pointerenter.uk.dropdown': function(e, dropdown) {
|
2440
|
clearTimeout($this.remainIdle);
|
2441
|
},
|
2442
|
|
2443
|
'pointerleave.uk.dropdown': function(e, dropdown) {
|
2444
|
$this.pointerleave = true;
|
2445
|
}
|
2446
|
});
|
2447
|
|
2448
|
|
2449
|
this.overlay.on({
|
2450
|
|
2451
|
'mouseenter': function() {
|
2452
|
if ($this.remainIdle) {
|
2453
|
clearTimeout($this.dropdown.remainIdle);
|
2454
|
clearTimeout($this.remainIdle);
|
2455
|
}
|
2456
|
},
|
2457
|
|
2458
|
'mouseleave': function(){
|
2459
|
|
2460
|
if ($this.pointerleave && active) {
|
2461
|
|
2462
|
$this.remainIdle = setTimeout(function() {
|
2463
|
if(active) active.hide();
|
2464
|
}, active.options.remaintime);
|
2465
|
}
|
2466
|
}
|
2467
|
})
|
2468
|
}
|
2469
|
|
2470
|
});
|
2471
|
|
2472
|
|
2473
|
function justify(ele, justifyTo, boundarywidth, offset) {
|
2474
|
|
2475
|
ele = UI.$(ele);
|
2476
|
justifyTo = UI.$(justifyTo);
|
2477
|
boundarywidth = boundarywidth || window.innerWidth;
|
2478
|
offset = offset || ele.offset();
|
2479
|
|
2480
|
if (justifyTo.length) {
|
2481
|
|
2482
|
var jwidth = justifyTo.outerWidth();
|
2483
|
|
2484
|
ele.css('min-width', jwidth);
|
2485
|
|
2486
|
if (UI.langdirection == 'right') {
|
2487
|
|
2488
|
var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
|
2489
|
right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
|
2490
|
|
2491
|
ele.css('margin-right', right1 - right2);
|
2492
|
|
2493
|
} else {
|
2494
|
ele.css('margin-left', justifyTo.offset().left - offset.left);
|
2495
|
}
|
2496
|
}
|
2497
|
}
|
2498
|
|
2499
|
})(UIkit2);
|
2500
|
|
2501
|
(function(UI) {
|
2502
|
|
2503
|
"use strict";
|
2504
|
|
2505
|
var grids = [];
|
2506
|
|
2507
|
UI.component('gridMatchHeight', {
|
2508
|
|
2509
|
defaults: {
|
2510
|
target : false,
|
2511
|
row : true,
|
2512
|
ignorestacked : false,
|
2513
|
observe : false
|
2514
|
},
|
2515
|
|
2516
|
boot: function() {
|
2517
|
|
2518
|
// init code
|
2519
|
UI.ready(function(context) {
|
2520
|
|
2521
|
UI.$('[data-uk-grid-match]', context).each(function() {
|
2522
|
var grid = UI.$(this), obj;
|
2523
|
|
2524
|
if (!grid.data('gridMatchHeight')) {
|
2525
|
obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match')));
|
2526
|
}
|
2527
|
});
|
2528
|
});
|
2529
|
},
|
2530
|
|
2531
|
init: function() {
|
2532
|
|
2533
|
var $this = this;
|
2534
|
|
2535
|
this.columns = this.element.children();
|
2536
|
this.elements = this.options.target ? this.find(this.options.target) : this.columns;
|
2537
|
|
2538
|
if (!this.columns.length) return;
|
2539
|
|
2540
|
UI.$win.on('load resize orientationchange', (function() {
|
2541
|
|
2542
|
var fn = function() {
|
2543
|
if ($this.element.is(':visible')) $this.match();
|
2544
|
};
|
2545
|
|
2546
|
UI.$(function() { fn(); });
|
2547
|
|
2548
|
return UI.Utils.debounce(fn, 50);
|
2549
|
})());
|
2550
|
|
2551
|
if (this.options.observe) {
|
2552
|
|
2553
|
UI.domObserve(this.element, function(e) {
|
2554
|
if ($this.element.is(':visible')) $this.match();
|
2555
|
});
|
2556
|
}
|
2557
|
|
2558
|
this.on('display.uk.check', function(e) {
|
2559
|
if(this.element.is(':visible')) this.match();
|
2560
|
}.bind(this));
|
2561
|
|
2562
|
grids.push(this);
|
2563
|
},
|
2564
|
|
2565
|
match: function() {
|
2566
|
|
2567
|
var firstvisible = this.columns.filter(':visible:first');
|
2568
|
|
2569
|
if (!firstvisible.length) return;
|
2570
|
|
2571
|
var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
|
2572
|
|
2573
|
if (stacked && !this.options.ignorestacked) {
|
2574
|
this.revert();
|
2575
|
} else {
|
2576
|
UI.Utils.matchHeights(this.elements, this.options);
|
2577
|
}
|
2578
|
|
2579
|
return this;
|
2580
|
},
|
2581
|
|
2582
|
revert: function() {
|
2583
|
this.elements.css('min-height', '');
|
2584
|
return this;
|
2585
|
}
|
2586
|
});
|
2587
|
|
2588
|
UI.component('gridMargin', {
|
2589
|
|
2590
|
defaults: {
|
2591
|
cls : 'uk-grid-margin',
|
2592
|
rowfirst : 'uk-row-first'
|
2593
|
},
|
2594
|
|
2595
|
boot: function() {
|
2596
|
|
2597
|
// init code
|
2598
|
UI.ready(function(context) {
|
2599
|
|
2600
|
UI.$('[data-uk-grid-margin]', context).each(function() {
|
2601
|
var grid = UI.$(this), obj;
|
2602
|
|
2603
|
if (!grid.data('gridMargin')) {
|
2604
|
obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin')));
|
2605
|
}
|
2606
|
});
|
2607
|
});
|
2608
|
},
|
2609
|
|
2610
|
init: function() {
|
2611
|
|
2612
|
var stackMargin = UI.stackMargin(this.element, this.options);
|
2613
|
}
|
2614
|
});
|
2615
|
|
2616
|
})(UIkit2);
|
2617
|
|
2618
|
(function(UI) {
|
2619
|
|
2620
|
"use strict";
|
2621
|
|
2622
|
var active = false, activeCount = 0, $html = UI.$html, body;
|
2623
|
|
2624
|
UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
|
2625
|
UI.$('.uk-modal.uk-open').each(function(){
|
2626
|
return UI.$(this).data('modal') && UI.$(this).data('modal').resize();
|
2627
|
});
|
2628
|
}, 150));
|
2629
|
|
2630
|
UI.component('modal', {
|
2631
|
|
2632
|
defaults: {
|
2633
|
keyboard: true,
|
2634
|
bgclose: true,
|
2635
|
minScrollHeight: 150,
|
2636
|
center: false,
|
2637
|
modal: true
|
2638
|
},
|
2639
|
|
2640
|
scrollable: false,
|
2641
|
transition: false,
|
2642
|
hasTransitioned: true,
|
2643
|
|
2644
|
init: function() {
|
2645
|
|
2646
|
if (!body) body = UI.$('body');
|
2647
|
|
2648
|
if (!this.element.length) return;
|
2649
|
|
2650
|
var $this = this;
|
2651
|
|
2652
|
this.paddingdir = 'padding-' + (UI.langdirection == 'left' ? 'right':'left');
|
2653
|
this.dialog = this.find('.uk-modal-dialog');
|
2654
|
|
2655
|
this.active = false;
|
2656
|
|
2657
|
// Update ARIA
|
2658
|
this.element.attr('aria-hidden', this.element.hasClass('uk-open'));
|
2659
|
|
2660
|
this.on('click', '.uk-modal-close', function(e) {
|
2661
|
|
2662
|
e.preventDefault();
|
2663
|
|
2664
|
var modal = UI.$(e.target).closest('.uk-modal');
|
2665
|
if (modal[0] === $this.element[0]) $this.hide();
|
2666
|
|
2667
|
}).on('click', function(e) {
|
2668
|
|
2669
|
var target = UI.$(e.target);
|
2670
|
|
2671
|
if (target[0] == $this.element[0] && $this.options.bgclose) {
|
2672
|
$this.hide();
|
2673
|
}
|
2674
|
});
|
2675
|
|
2676
|
UI.domObserve(this.element, function(e) { $this.resize(); });
|
2677
|
},
|
2678
|
|
2679
|
toggle: function() {
|
2680
|
return this[this.isActive() ? 'hide' : 'show']();
|
2681
|
},
|
2682
|
|
2683
|
show: function() {
|
2684
|
|
2685
|
if (!this.element.length) return;
|
2686
|
|
2687
|
var $this = this;
|
2688
|
|
2689
|
if (this.isActive()) return;
|
2690
|
|
2691
|
if (this.options.modal && active) {
|
2692
|
active.hide(true);
|
2693
|
}
|
2694
|
|
2695
|
this.element.removeClass('uk-open').show();
|
2696
|
this.resize(true);
|
2697
|
|
2698
|
if (this.options.modal) {
|
2699
|
active = this;
|
2700
|
}
|
2701
|
|
2702
|
this.active = true;
|
2703
|
|
2704
|
activeCount++;
|
2705
|
|
2706
|
if (UI.support.transition) {
|
2707
|
this.hasTransitioned = false;
|
2708
|
this.element.one(UI.support.transition.end, function(){
|
2709
|
$this.hasTransitioned = true;
|
2710
|
UI.Utils.focus($this.dialog, 'a[href]');
|
2711
|
}).addClass('uk-open');
|
2712
|
} else {
|
2713
|
this.element.addClass('uk-open');
|
2714
|
UI.Utils.focus(this.dialog, 'a[href]');
|
2715
|
}
|
2716
|
|
2717
|
$html.addClass('uk-modal-page').height(); // force browser engine redraw
|
2718
|
|
2719
|
// Update ARIA
|
2720
|
this.element.attr('aria-hidden', 'false');
|
2721
|
|
2722
|
this.element.trigger('show.uk.modal');
|
2723
|
|
2724
|
UI.Utils.checkDisplay(this.dialog, true);
|
2725
|
|
2726
|
return this;
|
2727
|
},
|
2728
|
|
2729
|
hide: function(force) {
|
2730
|
|
2731
|
if (!force && UI.support.transition && this.hasTransitioned) {
|
2732
|
|
2733
|
var $this = this;
|
2734
|
|
2735
|
this.one(UI.support.transition.end, function() {
|
2736
|
$this._hide();
|
2737
|
}).removeClass('uk-open');
|
2738
|
|
2739
|
} else {
|
2740
|
|
2741
|
this._hide();
|
2742
|
}
|
2743
|
|
2744
|
return this;
|
2745
|
},
|
2746
|
|
2747
|
resize: function(force) {
|
2748
|
|
2749
|
if (!this.isActive() && !force) return;
|
2750
|
|
2751
|
var bodywidth = body.width();
|
2752
|
|
2753
|
this.scrollbarwidth = window.innerWidth - bodywidth;
|
2754
|
|
2755
|
body.css(this.paddingdir, this.scrollbarwidth);
|
2756
|
|
2757
|
this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
|
2758
|
|
2759
|
if (!this.updateScrollable() && this.options.center) {
|
2760
|
|
2761
|
var dh = this.dialog.outerHeight(),
|
2762
|
pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
|
2763
|
|
2764
|
if ((dh + pad) < window.innerHeight) {
|
2765
|
this.dialog.css({top: (window.innerHeight/2 - dh/2) - pad });
|
2766
|
} else {
|
2767
|
this.dialog.css({top: ''});
|
2768
|
}
|
2769
|
}
|
2770
|
},
|
2771
|
|
2772
|
updateScrollable: function() {
|
2773
|
|
2774
|
// has scrollable?
|
2775
|
var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
|
2776
|
|
2777
|
if (scrollable.length) {
|
2778
|
|
2779
|
scrollable.css('height', 0);
|
2780
|
|
2781
|
var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)),
|
2782
|
dh = this.dialog.outerHeight(),
|
2783
|
wh = window.innerHeight,
|
2784
|
h = wh - 2*(offset < 20 ? 20:offset) - dh;
|
2785
|
|
2786
|
scrollable.css({
|
2787
|
maxHeight: (h < this.options.minScrollHeight ? '':h),
|
2788
|
height:''
|
2789
|
});
|
2790
|
|
2791
|
return true;
|
2792
|
}
|
2793
|
|
2794
|
return false;
|
2795
|
},
|
2796
|
|
2797
|
_hide: function() {
|
2798
|
|
2799
|
this.active = false;
|
2800
|
if (activeCount > 0) activeCount--;
|
2801
|
else activeCount = 0;
|
2802
|
|
2803
|
this.element.hide().removeClass('uk-open');
|
2804
|
|
2805
|
// Update ARIA
|
2806
|
this.element.attr('aria-hidden', 'true');
|
2807
|
|
2808
|
if (!activeCount) {
|
2809
|
$html.removeClass('uk-modal-page');
|
2810
|
body.css(this.paddingdir, "");
|
2811
|
}
|
2812
|
|
2813
|
if (active===this) active = false;
|
2814
|
|
2815
|
this.trigger('hide.uk.modal');
|
2816
|
},
|
2817
|
|
2818
|
isActive: function() {
|
2819
|
return this.element.hasClass('uk-open');
|
2820
|
}
|
2821
|
|
2822
|
});
|
2823
|
|
2824
|
UI.component('modalTrigger', {
|
2825
|
|
2826
|
boot: function() {
|
2827
|
|
2828
|
// init code
|
2829
|
UI.$html.on('click.modal.uikit', '[data-uk-modal]', function(e) {
|
2830
|
|
2831
|
var ele = UI.$(this);
|
2832
|
|
2833
|
if (ele.is('a')) {
|
2834
|
e.preventDefault();
|
2835
|
}
|
2836
|
|
2837
|
if (!ele.data('modalTrigger')) {
|
2838
|
var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr('data-uk-modal')));
|
2839
|
modal.show();
|
2840
|
}
|
2841
|
|
2842
|
});
|
2843
|
|
2844
|
// close modal on esc button
|
2845
|
UI.$html.on('keydown.modal.uikit', function (e) {
|
2846
|
|
2847
|
if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
|
2848
|
e.preventDefault();
|
2849
|
active.hide();
|
2850
|
}
|
2851
|
});
|
2852
|
},
|
2853
|
|
2854
|
init: function() {
|
2855
|
|
2856
|
var $this = this;
|
2857
|
|
2858
|
this.options = UI.$.extend({
|
2859
|
target: $this.element.is('a') ? $this.element.attr('href') : false
|
2860
|
}, this.options);
|
2861
|
|
2862
|
this.modal = UI.modal(this.options.target, this.options);
|
2863
|
|
2864
|
this.on("click", function(e) {
|
2865
|
e.preventDefault();
|
2866
|
$this.show();
|
2867
|
});
|
2868
|
|
2869
|
//methods
|
2870
|
this.proxy(this.modal, 'show hide isActive');
|
2871
|
}
|
2872
|
});
|
2873
|
|
2874
|
UI.modal.dialog = function(content, options) {
|
2875
|
|
2876
|
var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo('body'), options);
|
2877
|
|
2878
|
modal.on('hide.uk.modal', function(){
|
2879
|
if (modal.persist) {
|
2880
|
modal.persist.appendTo(modal.persist.data('modalPersistParent'));
|
2881
|
modal.persist = false;
|
2882
|
}
|
2883
|
modal.element.remove();
|
2884
|
});
|
2885
|
|
2886
|
setContent(content, modal);
|
2887
|
|
2888
|
return modal;
|
2889
|
};
|
2890
|
|
2891
|
UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
2892
|
|
2893
|
UI.modal.alert = function(content, options) {
|
2894
|
|
2895
|
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
|
2896
|
|
2897
|
var modal = UI.modal.dialog(([
|
2898
|
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
2899
|
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
|
2900
|
]).join(""), options);
|
2901
|
|
2902
|
modal.on('show.uk.modal', function(){
|
2903
|
setTimeout(function(){
|
2904
|
modal.element.find('button:first').focus();
|
2905
|
}, 50);
|
2906
|
});
|
2907
|
|
2908
|
return modal.show();
|
2909
|
};
|
2910
|
|
2911
|
UI.modal.confirm = function(content, onconfirm, oncancel) {
|
2912
|
|
2913
|
var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {};
|
2914
|
|
2915
|
onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
|
2916
|
oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){};
|
2917
|
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options);
|
2918
|
|
2919
|
var modal = UI.modal.dialog(([
|
2920
|
'<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
|
2921
|
'<div class="uk-modal-footer uk-text-right"><button class="uk-button js-modal-confirm-cancel">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+options.labels.Ok+'</button></div>'
|
2922
|
]).join(""), options);
|
2923
|
|
2924
|
modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){
|
2925
|
UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel();
|
2926
|
modal.hide();
|
2927
|
});
|
2928
|
|
2929
|
modal.on('show.uk.modal', function(){
|
2930
|
setTimeout(function(){
|
2931
|
modal.element.find('.js-modal-confirm').focus();
|
2932
|
}, 50);
|
2933
|
});
|
2934
|
|
2935
|
return modal.show();
|
2936
|
};
|
2937
|
|
2938
|
UI.modal.prompt = function(text, value, onsubmit, options) {
|
2939
|
|
2940
|
onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
|
2941
|
options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
|
2942
|
|
2943
|
var modal = UI.modal.dialog(([
|
2944
|
text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
|
2945
|
'<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
|
2946
|
'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-modal-close">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-ok">'+options.labels.Ok+'</button></div>'
|
2947
|
]).join(""), options),
|
2948
|
|
2949
|
input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
|
2950
|
if (e.keyCode == 13) {
|
2951
|
modal.element.find('.js-modal-ok').trigger('click');
|
2952
|
}
|
2953
|
});
|
2954
|
|
2955
|
modal.element.find('.js-modal-ok').on('click', function(){
|
2956
|
if (onsubmit(input.val())!==false){
|
2957
|
modal.hide();
|
2958
|
}
|
2959
|
});
|
2960
|
|
2961
|
return modal.show();
|
2962
|
};
|
2963
|
|
2964
|
UI.modal.blockUI = function(content, options) {
|
2965
|
|
2966
|
var modal = UI.modal.dialog(([
|
2967
|
'<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
|
2968
|
]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
|
2969
|
|
2970
|
modal.content = modal.element.find('.uk-modal-content:first');
|
2971
|
|
2972
|
return modal.show();
|
2973
|
};
|
2974
|
|
2975
|
UI.modal.labels = {
|
2976
|
Ok: 'Ok',
|
2977
|
Cancel: 'Cancel'
|
2978
|
};
|
2979
|
|
2980
|
// helper functions
|
2981
|
function setContent(content, modal){
|
2982
|
|
2983
|
if(!modal) return;
|
2984
|
|
2985
|
if (typeof content === 'object') {
|
2986
|
|
2987
|
// convert DOM object to a jQuery object
|
2988
|
content = content instanceof jQuery ? content : UI.$(content);
|
2989
|
|
2990
|
if(content.parent().length) {
|
2991
|
modal.persist = content;
|
2992
|
modal.persist.data('modalPersistParent', content.parent());
|
2993
|
}
|
2994
|
}else if (typeof content === 'string' || typeof content === 'number') {
|
2995
|
// just insert the data as innerHTML
|
2996
|
content = UI.$('<div></div>').html(content);
|
2997
|
}else {
|
2998
|
// unsupported data type!
|
2999
|
content = UI.$('<div></div>').html('UIkit2.modal Error: Unsupported data type: ' + typeof content);
|
3000
|
}
|
3001
|
|
3002
|
content.appendTo(modal.element.find('.uk-modal-dialog'));
|
3003
|
|
3004
|
return modal;
|
3005
|
}
|
3006
|
|
3007
|
})(UIkit2);
|
3008
|
|
3009
|
(function(UI) {
|
3010
|
|
3011
|
"use strict";
|
3012
|
|
3013
|
UI.component('nav', {
|
3014
|
|
3015
|
defaults: {
|
3016
|
toggle: '>li.uk-parent > a[href="#"]',
|
3017
|
lists: '>li.uk-parent > ul',
|
3018
|
multiple: false
|
3019
|
},
|
3020
|
|
3021
|
boot: function() {
|
3022
|
|
3023
|
// init code
|
3024
|
UI.ready(function(context) {
|
3025
|
|
3026
|
UI.$('[data-uk-nav]', context).each(function() {
|
3027
|
var nav = UI.$(this);
|
3028
|
|
3029
|
if (!nav.data('nav')) {
|
3030
|
var obj = UI.nav(nav, UI.Utils.options(nav.attr('data-uk-nav')));
|
3031
|
}
|
3032
|
});
|
3033
|
});
|
3034
|
},
|
3035
|
|
3036
|
init: function() {
|
3037
|
|
3038
|
var $this = this;
|
3039
|
|
3040
|
this.on('click.uk.nav', this.options.toggle, function(e) {
|
3041
|
e.preventDefault();
|
3042
|
var ele = UI.$(this);
|
3043
|
$this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
|
3044
|
});
|
3045
|
|
3046
|
this.update();
|
3047
|
|
3048
|
UI.domObserve(this.element, function(e) {
|
3049
|
if ($this.element.find($this.options.lists).not('[role]').length) {
|
3050
|
$this.update();
|
3051
|
}
|
3052
|
});
|
3053
|
},
|
3054
|
|
3055
|
update: function() {
|
3056
|
|
3057
|
var $this = this;
|
3058
|
|
3059
|
this.find(this.options.lists).each(function() {
|
3060
|
|
3061
|
var $ele = UI.$(this).attr('role', 'menu'),
|
3062
|
parent = $ele.closest('li'),
|
3063
|
active = parent.hasClass("uk-active");
|
3064
|
|
3065
|
if (!parent.data('list-container')) {
|
3066
|
$ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
|
3067
|
parent.data('list-container', $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
|
3068
|
}
|
3069
|
|
3070
|
// Init ARIA
|
3071
|
parent.attr('aria-expanded', parent.hasClass("uk-open"));
|
3072
|
|
3073
|
if (active) $this.open(parent, true);
|
3074
|
});
|
3075
|
},
|
3076
|
|
3077
|
open: function(li, noanimation) {
|
3078
|
|
3079
|
var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container');
|
3080
|
|
3081
|
if (!this.options.multiple) {
|
3082
|
|
3083
|
element.children('.uk-open').not(li).each(function() {
|
3084
|
|
3085
|
var ele = UI.$(this);
|
3086
|
|
3087
|
if (ele.data('list-container')) {
|
3088
|
ele.data('list-container').stop().animate({height: 0}, function() {
|
3089
|
UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden');
|
3090
|
});
|
3091
|
}
|
3092
|
});
|
3093
|
}
|
3094
|
|
3095
|
$li.toggleClass('uk-open');
|
3096
|
|
3097
|
// Update ARIA
|
3098
|
$li.attr('aria-expanded', $li.hasClass('uk-open'));
|
3099
|
|
3100
|
if ($container) {
|
3101
|
|
3102
|
if ($li.hasClass('uk-open')) {
|
3103
|
$container.removeClass('uk-hidden');
|
3104
|
}
|
3105
|
|
3106
|
if (noanimation) {
|
3107
|
|
3108
|
$container.stop().height($li.hasClass('uk-open') ? 'auto' : 0);
|
3109
|
|
3110
|
if (!$li.hasClass('uk-open')) {
|
3111
|
$container.addClass('uk-hidden');
|
3112
|
}
|
3113
|
|
3114
|
this.trigger('display.uk.check');
|
3115
|
|
3116
|
} else {
|
3117
|
|
3118
|
$container.stop().animate({
|
3119
|
height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0)
|
3120
|
}, function() {
|
3121
|
|
3122
|
if (!$li.hasClass('uk-open')) {
|
3123
|
$container.addClass('uk-hidden');
|
3124
|
} else {
|
3125
|
$container.css('height', '');
|
3126
|
}
|
3127
|
|
3128
|
$this.trigger('display.uk.check');
|
3129
|
});
|
3130
|
}
|
3131
|
}
|
3132
|
}
|
3133
|
});
|
3134
|
|
3135
|
|
3136
|
// helper
|
3137
|
|
3138
|
function getHeight(ele) {
|
3139
|
|
3140
|
var $ele = UI.$(ele), height = 'auto';
|
3141
|
|
3142
|
if ($ele.is(':visible')) {
|
3143
|
height = $ele.outerHeight();
|
3144
|
} else {
|
3145
|
|
3146
|
var tmp = {
|
3147
|
position: $ele.css('position'),
|
3148
|
visibility: $ele.css('visibility'),
|
3149
|
display: $ele.css('display')
|
3150
|
};
|
3151
|
|
3152
|
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
3153
|
|
3154
|
$ele.css(tmp); // reset element
|
3155
|
}
|
3156
|
|
3157
|
return height;
|
3158
|
}
|
3159
|
|
3160
|
})(UIkit2);
|
3161
|
|
3162
|
(function(UI) {
|
3163
|
|
3164
|
"use strict";
|
3165
|
|
3166
|
var scrollpos = {x: window.scrollX, y: window.scrollY},
|
3167
|
$win = UI.$win,
|
3168
|
$doc = UI.$doc,
|
3169
|
$html = UI.$html,
|
3170
|
Offcanvas = {
|
3171
|
|
3172
|
show: function(element, options) {
|
3173
|
|
3174
|
element = UI.$(element);
|
3175
|
|
3176
|
if (!element.length) return;
|
3177
|
|
3178
|
options = UI.$.extend({mode: 'push'}, options);
|
3179
|
|
3180
|
var $body = UI.$('body'),
|
3181
|
bar = element.find('.uk-offcanvas-bar:first'),
|
3182
|
rtl = (UI.langdirection == 'right'),
|
3183
|
flip = bar.hasClass('uk-offcanvas-bar-flip') ? -1:1,
|
3184
|
dir = flip * (rtl ? -1 : 1),
|
3185
|
|
3186
|
scrollbarwidth = window.innerWidth - $body.width();
|
3187
|
|
3188
|
scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
|
3189
|
|
3190
|
bar.attr('mode', options.mode);
|
3191
|
element.addClass('uk-active');
|
3192
|
|
3193
|
$body.css({width: window.innerWidth - scrollbarwidth, height: window.innerHeight}).addClass('uk-offcanvas-page');
|
3194
|
|
3195
|
if (options.mode == 'push' || options.mode == 'reveal') {
|
3196
|
$body.css((rtl ? 'margin-right' : 'margin-left'), (rtl ? -1 : 1) * (bar.outerWidth() * dir));
|
3197
|
}
|
3198
|
|
3199
|
if (options.mode == 'reveal') {
|
3200
|
bar.css('clip', 'rect(0, '+bar.outerWidth()+'px, 100vh, 0)');
|
3201
|
}
|
3202
|
|
3203
|
$html.css('margin-top', scrollpos.y * -1).width(); // .width() - force redraw
|
3204
|
|
3205
|
|
3206
|
bar.addClass('uk-offcanvas-bar-show');
|
3207
|
|
3208
|
this._initElement(element);
|
3209
|
|
3210
|
bar.trigger('show.uk.offcanvas', [element, bar]);
|
3211
|
|
3212
|
// Update ARIA
|
3213
|
element.attr('aria-hidden', 'false');
|
3214
|
},
|
3215
|
|
3216
|
hide: function(force) {
|
3217
|
|
3218
|
var $body = UI.$('body'),
|
3219
|
panel = UI.$('.uk-offcanvas.uk-active'),
|
3220
|
rtl = (UI.langdirection == 'right'),
|
3221
|
bar = panel.find('.uk-offcanvas-bar:first'),
|
3222
|
finalize = function() {
|
3223
|
$body.removeClass('uk-offcanvas-page').css({width: '', height: '', marginLeft: '', marginRight: ''});
|
3224
|
panel.removeClass('uk-active');
|
3225
|
|
3226
|
bar.removeClass('uk-offcanvas-bar-show');
|
3227
|
$html.css('margin-top', '');
|
3228
|
window.scrollTo(scrollpos.x, scrollpos.y);
|
3229
|
bar.trigger('hide.uk.offcanvas', [panel, bar]);
|
3230
|
|
3231
|
// Update ARIA
|
3232
|
panel.attr('aria-hidden', 'true');
|
3233
|
};
|
3234
|
|
3235
|
if (!panel.length) return;
|
3236
|
if (bar.attr('mode') == 'none') force = true;
|
3237
|
|
3238
|
if (UI.support.transition && !force) {
|
3239
|
|
3240
|
$body.one(UI.support.transition.end, function() {
|
3241
|
finalize();
|
3242
|
}).css((rtl ? 'margin-right' : 'margin-left'), '');
|
3243
|
|
3244
|
if (bar.attr('mode') == 'reveal') {
|
3245
|
bar.css('clip', '');
|
3246
|
}
|
3247
|
|
3248
|
setTimeout(function(){
|
3249
|
bar.removeClass('uk-offcanvas-bar-show');
|
3250
|
}, 0);
|
3251
|
|
3252
|
} else {
|
3253
|
finalize();
|
3254
|
}
|
3255
|
},
|
3256
|
|
3257
|
_initElement: function(element) {
|
3258
|
|
3259
|
if (element.data('OffcanvasInit')) return;
|
3260
|
|
3261
|
element.on('click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas', function(e) {
|
3262
|
|
3263
|
var target = UI.$(e.target);
|
3264
|
|
3265
|
if (e.type.match(/swipe/)) {
|
3266
|
if (target.parents('.uk-offcanvas-bar:first').length) return;
|
3267
|
} else {
|
3268
|
|
3269
|
if (!target.hasClass('uk-offcanvas-close')) {
|
3270
|
if (target.hasClass('uk-offcanvas-bar')) return;
|
3271
|
if (target.parents('.uk-offcanvas-bar:first').length) return;
|
3272
|
}
|
3273
|
}
|
3274
|
|
3275
|
e.stopImmediatePropagation();
|
3276
|
Offcanvas.hide();
|
3277
|
});
|
3278
|
|
3279
|
element.on('click', 'a[href*="#"]', function(e){
|
3280
|
|
3281
|
var link = UI.$(this),
|
3282
|
href = link.attr('href');
|
3283
|
|
3284
|
if (href == '#') {
|
3285
|
return;
|
3286
|
}
|
3287
|
|
3288
|
UI.$doc.one('hide.uk.offcanvas', function() {
|
3289
|
|
3290
|
var target;
|
3291
|
|
3292
|
try {
|
3293
|
target = UI.$(link[0].hash);
|
3294
|
} catch (e){
|
3295
|
target = '';
|
3296
|
}
|
3297
|
|
3298
|
if (!target.length) {
|
3299
|
target = UI.$('[name="'+link[0].hash.replace('#','')+'"]');
|
3300
|
}
|
3301
|
|
3302
|
if (target.length && UI.Utils.scrollToElement) {
|
3303
|
UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
|
3304
|
} else {
|
3305
|
window.location.href = href;
|
3306
|
}
|
3307
|
});
|
3308
|
|
3309
|
Offcanvas.hide();
|
3310
|
});
|
3311
|
|
3312
|
element.data('OffcanvasInit', true);
|
3313
|
}
|
3314
|
};
|
3315
|
|
3316
|
UI.component('offcanvasTrigger', {
|
3317
|
|
3318
|
boot: function() {
|
3319
|
|
3320
|
// init code
|
3321
|
$html.on('click.offcanvas.uikit', '[data-uk-offcanvas]', function(e) {
|
3322
|
|
3323
|
e.preventDefault();
|
3324
|
|
3325
|
var ele = UI.$(this);
|
3326
|
|
3327
|
if (!ele.data('offcanvasTrigger')) {
|
3328
|
var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr('data-uk-offcanvas')));
|
3329
|
ele.trigger("click");
|
3330
|
}
|
3331
|
});
|
3332
|
|
3333
|
$html.on('keydown.uk.offcanvas', function(e) {
|
3334
|
|
3335
|
if (e.keyCode === 27) { // ESC
|
3336
|
Offcanvas.hide();
|
3337
|
}
|
3338
|
});
|
3339
|
},
|
3340
|
|
3341
|
init: function() {
|
3342
|
|
3343
|
var $this = this;
|
3344
|
|
3345
|
this.options = UI.$.extend({
|
3346
|
target: $this.element.is('a') ? $this.element.attr('href') : false,
|
3347
|
mode: 'push'
|
3348
|
}, this.options);
|
3349
|
|
3350
|
this.on('click', function(e) {
|
3351
|
e.preventDefault();
|
3352
|
Offcanvas.show($this.options.target, $this.options);
|
3353
|
});
|
3354
|
}
|
3355
|
});
|
3356
|
|
3357
|
UI.offcanvas = Offcanvas;
|
3358
|
|
3359
|
})(UIkit2);
|
3360
|
|
3361
|
(function(UI) {
|
3362
|
|
3363
|
"use strict";
|
3364
|
|
3365
|
var Animations;
|
3366
|
|
3367
|
UI.component('switcher', {
|
3368
|
|
3369
|
defaults: {
|
3370
|
connect : false,
|
3371
|
toggle : '>*',
|
3372
|
active : 0,
|
3373
|
animation : false,
|
3374
|
duration : 200,
|
3375
|
swiping : true
|
3376
|
},
|
3377
|
|
3378
|
animating: false,
|
3379
|
|
3380
|
boot: function() {
|
3381
|
|
3382
|
// init code
|
3383
|
UI.ready(function(context) {
|
3384
|
|
3385
|
UI.$('[data-uk-switcher]', context).each(function() {
|
3386
|
var switcher = UI.$(this);
|
3387
|
|
3388
|
if (!switcher.data('switcher')) {
|
3389
|
var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr('data-uk-switcher')));
|
3390
|
}
|
3391
|
});
|
3392
|
});
|
3393
|
},
|
3394
|
|
3395
|
init: function() {
|
3396
|
|
3397
|
var $this = this;
|
3398
|
|
3399
|
this.on('click.uk.switcher', this.options.toggle, function(e) {
|
3400
|
e.preventDefault();
|
3401
|
$this.show(this);
|
3402
|
});
|
3403
|
|
3404
|
if (!this.options.connect) {
|
3405
|
return;
|
3406
|
}
|
3407
|
|
3408
|
this.connect = UI.$(this.options.connect);
|
3409
|
|
3410
|
if (!this.connect.length) {
|
3411
|
return;
|
3412
|
}
|
3413
|
|
3414
|
this.connect.on('click.uk.switcher', '[data-uk-switcher-item]', function(e) {
|
3415
|
|
3416
|
e.preventDefault();
|
3417
|
|
3418
|
var item = UI.$(this).attr('data-uk-switcher-item');
|
3419
|
|
3420
|
if ($this.index == item) return;
|
3421
|
|
3422
|
switch(item) {
|
3423
|
case 'next':
|
3424
|
case 'previous':
|
3425
|
$this.show($this.index + (item=='next' ? 1:-1));
|
3426
|
break;
|
3427
|
default:
|
3428
|
$this.show(parseInt(item, 10));
|
3429
|
}
|
3430
|
});
|
3431
|
|
3432
|
if (this.options.swiping) {
|
3433
|
|
3434
|
this.connect.on('swipeRight swipeLeft', function(e) {
|
3435
|
e.preventDefault();
|
3436
|
if (!window.getSelection().toString()) {
|
3437
|
$this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
|
3438
|
}
|
3439
|
});
|
3440
|
}
|
3441
|
|
3442
|
this.update();
|
3443
|
},
|
3444
|
|
3445
|
update: function() {
|
3446
|
|
3447
|
this.connect.children().removeClass('uk-active').attr('aria-hidden', 'true');
|
3448
|
|
3449
|
var toggles = this.find(this.options.toggle),
|
3450
|
active = toggles.filter('.uk-active');
|
3451
|
|
3452
|
if (active.length) {
|
3453
|
this.show(active, false);
|
3454
|
} else {
|
3455
|
|
3456
|
if (this.options.active===false) return;
|
3457
|
|
3458
|
active = toggles.eq(this.options.active);
|
3459
|
this.show(active.length ? active : toggles.eq(0), false);
|
3460
|
}
|
3461
|
|
3462
|
// Init ARIA for toggles
|
3463
|
toggles.not(active).attr('aria-expanded', 'false');
|
3464
|
active.attr('aria-expanded', 'true');
|
3465
|
},
|
3466
|
|
3467
|
show: function(tab, animate) {
|
3468
|
|
3469
|
if (this.animating) {
|
3470
|
return;
|
3471
|
}
|
3472
|
|
3473
|
var toggles = this.find(this.options.toggle);
|
3474
|
|
3475
|
if (isNaN(tab)) {
|
3476
|
tab = UI.$(tab);
|
3477
|
} else {
|
3478
|
tab = tab < 0 ? toggles.length-1 : tab;
|
3479
|
tab = toggles.eq(toggles[tab] ? tab : 0);
|
3480
|
}
|
3481
|
|
3482
|
var $this = this,
|
3483
|
active = UI.$(tab),
|
3484
|
animation = Animations[this.options.animation] || function(current, next) {
|
3485
|
|
3486
|
if (!$this.options.animation) {
|
3487
|
return Animations.none.apply($this);
|
3488
|
}
|
3489
|
|
3490
|
var anim = $this.options.animation.split(',');
|
3491
|
|
3492
|
if (anim.length == 1) {
|
3493
|
anim[1] = anim[0];
|
3494
|
}
|
3495
|
|
3496
|
anim[0] = anim[0].trim();
|
3497
|
anim[1] = anim[1].trim();
|
3498
|
|
3499
|
return coreAnimation.apply($this, [anim, current, next]);
|
3500
|
};
|
3501
|
|
3502
|
if (animate===false || !UI.support.animation) {
|
3503
|
animation = Animations.none;
|
3504
|
}
|
3505
|
|
3506
|
if (active.hasClass("uk-disabled")) return;
|
3507
|
|
3508
|
// Update ARIA for Toggles
|
3509
|
toggles.attr('aria-expanded', 'false');
|
3510
|
active.attr('aria-expanded', 'true');
|
3511
|
|
3512
|
toggles.filter(".uk-active").removeClass("uk-active");
|
3513
|
active.addClass("uk-active");
|
3514
|
|
3515
|
if (this.options.connect && this.connect.length) {
|
3516
|
|
3517
|
this.index = this.find(this.options.toggle).index(active);
|
3518
|
|
3519
|
if (this.index == -1 ) {
|
3520
|
this.index = 0;
|
3521
|
}
|
3522
|
|
3523
|
this.connect.each(function() {
|
3524
|
|
3525
|
var container = UI.$(this),
|
3526
|
children = UI.$(container.children()),
|
3527
|
current = UI.$(children.filter('.uk-active')),
|
3528
|
next = UI.$(children.eq($this.index));
|
3529
|
|
3530
|
$this.animating = true;
|
3531
|
|
3532
|
animation.apply($this, [current, next]).then(function(){
|
3533
|
|
3534
|
current.removeClass("uk-active");
|
3535
|
next.addClass("uk-active");
|
3536
|
|
3537
|
// Update ARIA for connect
|
3538
|
current.attr('aria-hidden', 'true');
|
3539
|
next.attr('aria-hidden', 'false');
|
3540
|
|
3541
|
UI.Utils.checkDisplay(next, true);
|
3542
|
|
3543
|
$this.animating = false;
|
3544
|
|
3545
|
});
|
3546
|
});
|
3547
|
}
|
3548
|
|
3549
|
this.trigger("show.uk.switcher", [active]);
|
3550
|
}
|
3551
|
});
|
3552
|
|
3553
|
Animations = {
|
3554
|
|
3555
|
'none': function() {
|
3556
|
var d = UI.$.Deferred();
|
3557
|
d.resolve();
|
3558
|
return d.promise();
|
3559
|
},
|
3560
|
|
3561
|
'fade': function(current, next) {
|
3562
|
return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
|
3563
|
},
|
3564
|
|
3565
|
'slide-bottom': function(current, next) {
|
3566
|
return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
|
3567
|
},
|
3568
|
|
3569
|
'slide-top': function(current, next) {
|
3570
|
return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
|
3571
|
},
|
3572
|
|
3573
|
'slide-vertical': function(current, next, dir) {
|
3574
|
|
3575
|
var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
|
3576
|
|
3577
|
if (current && current.index() > next.index()) {
|
3578
|
anim.reverse();
|
3579
|
}
|
3580
|
|
3581
|
return coreAnimation.apply(this, [anim, current, next]);
|
3582
|
},
|
3583
|
|
3584
|
'slide-left': function(current, next) {
|
3585
|
return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
|
3586
|
},
|
3587
|
|
3588
|
'slide-right': function(current, next) {
|
3589
|
return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
|
3590
|
},
|
3591
|
|
3592
|
'slide-horizontal': function(current, next, dir) {
|
3593
|
|
3594
|
var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
|
3595
|
|
3596
|
if (current && current.index() > next.index()) {
|
3597
|
anim.reverse();
|
3598
|
}
|
3599
|
|
3600
|
return coreAnimation.apply(this, [anim, current, next]);
|
3601
|
},
|
3602
|
|
3603
|
'scale': function(current, next) {
|
3604
|
return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
|
3605
|
}
|
3606
|
};
|
3607
|
|
3608
|
UI.switcher.animations = Animations;
|
3609
|
|
3610
|
|
3611
|
// helpers
|
3612
|
|
3613
|
function coreAnimation(cls, current, next) {
|
3614
|
|
3615
|
var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
|
3616
|
|
3617
|
if (next[0]===current[0]) {
|
3618
|
d.resolve();
|
3619
|
return d.promise();
|
3620
|
}
|
3621
|
|
3622
|
if (typeof(cls) == 'object') {
|
3623
|
clsIn = cls[0];
|
3624
|
clsOut = cls[1] || cls[0];
|
3625
|
}
|
3626
|
|
3627
|
UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS
|
3628
|
|
3629
|
release = function() {
|
3630
|
|
3631
|
if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
|
3632
|
|
3633
|
next.addClass(clsIn).one(UI.support.animation.end, function() {
|
3634
|
|
3635
|
setTimeout(function () {
|
3636
|
next.removeClass(''+clsIn+'').css({opacity:'', display:''});
|
3637
|
}, 0);
|
3638
|
|
3639
|
d.resolve();
|
3640
|
|
3641
|
UI.$body.css('overflow-x', '');
|
3642
|
|
3643
|
if (current) current.css({opacity:'', display:''});
|
3644
|
|
3645
|
}.bind(this)).show();
|
3646
|
};
|
3647
|
|
3648
|
next.css('animation-duration', this.options.duration+'ms');
|
3649
|
|
3650
|
if (current && current.length) {
|
3651
|
|
3652
|
current.css('animation-duration', this.options.duration+'ms');
|
3653
|
|
3654
|
current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
|
3655
|
release();
|
3656
|
}.bind(this)).css('display', '');
|
3657
|
|
3658
|
} else {
|
3659
|
next.addClass('uk-active');
|
3660
|
release();
|
3661
|
}
|
3662
|
|
3663
|
return d.promise();
|
3664
|
}
|
3665
|
|
3666
|
})(UIkit2);
|
3667
|
|
3668
|
(function(UI) {
|
3669
|
|
3670
|
"use strict";
|
3671
|
|
3672
|
UI.component('tab', {
|
3673
|
|
3674
|
defaults: {
|
3675
|
target : '>li:not(.uk-tab-responsive, .uk-disabled)',
|
3676
|
connect : false,
|
3677
|
active : 0,
|
3678
|
animation : false,
|
3679
|
duration : 200,
|
3680
|
swiping : true
|
3681
|
},
|
3682
|
|
3683
|
boot: function() {
|
3684
|
|
3685
|
// init code
|
3686
|
UI.ready(function(context) {
|
3687
|
|
3688
|
UI.$('[data-uk-tab]', context).each(function() {
|
3689
|
|
3690
|
var tab = UI.$(this);
|
3691
|
|
3692
|
if (!tab.data('tab')) {
|
3693
|
var obj = UI.tab(tab, UI.Utils.options(tab.attr('data-uk-tab')));
|
3694
|
}
|
3695
|
});
|
3696
|
});
|
3697
|
},
|
3698
|
|
3699
|
init: function() {
|
3700
|
|
3701
|
var $this = this;
|
3702
|
|
3703
|
this.current = false;
|
3704
|
|
3705
|
this.on('click.uk.tab', this.options.target, function(e) {
|
3706
|
|
3707
|
e.preventDefault();
|
3708
|
|
3709
|
if ($this.switcher && $this.switcher.animating) {
|
3710
|
return;
|
3711
|
}
|
3712
|
|
3713
|
var current = $this.find($this.options.target).not(this);
|
3714
|
|
3715
|
current.removeClass('uk-active').blur();
|
3716
|
|
3717
|
$this.trigger('change.uk.tab', [UI.$(this).addClass('uk-active'), $this.current]);
|
3718
|
|
3719
|
$this.current = UI.$(this);
|
3720
|
|
3721
|
// Update ARIA
|
3722
|
if (!$this.options.connect) {
|
3723
|
current.attr('aria-expanded', 'false');
|
3724
|
UI.$(this).attr('aria-expanded', 'true');
|
3725
|
}
|
3726
|
});
|
3727
|
|
3728
|
if (this.options.connect) {
|
3729
|
this.connect = UI.$(this.options.connect);
|
3730
|
}
|
3731
|
|
3732
|
// init responsive tab
|
3733
|
this.responsivetab = UI.$('<li class="uk-tab-responsive uk-active"><a></a></li>').append('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>');
|
3734
|
|
3735
|
this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
|
3736
|
this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
|
3737
|
this.responsivetab.caption = this.responsivetab.find('a:first');
|
3738
|
|
3739
|
if (this.element.hasClass('uk-tab-bottom')) this.responsivetab.dropdown.addClass('uk-dropdown-up');
|
3740
|
|
3741
|
// handle click
|
3742
|
this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
|
3743
|
|
3744
|
e.preventDefault();
|
3745
|
e.stopPropagation();
|
3746
|
|
3747
|
var link = UI.$(this);
|
3748
|
|
3749
|
$this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
|
3750
|
});
|
3751
|
|
3752
|
this.on('show.uk.switcher change.uk.tab', function(e, tab) {
|
3753
|
$this.responsivetab.caption.html(tab.text());
|
3754
|
});
|
3755
|
|
3756
|
this.element.append(this.responsivetab);
|
3757
|
|
3758
|
// init UIkit components
|
3759
|
if (this.options.connect) {
|
3760
|
|
3761
|
this.switcher = UI.switcher(this.element, {
|
3762
|
toggle : '>li:not(.uk-tab-responsive)',
|
3763
|
connect : this.options.connect,
|
3764
|
active : this.options.active,
|
3765
|
animation : this.options.animation,
|
3766
|
duration : this.options.duration,
|
3767
|
swiping : this.options.swiping
|
3768
|
});
|
3769
|
}
|
3770
|
|
3771
|
UI.dropdown(this.responsivetab, {mode: 'click', preventflip: 'y'});
|
3772
|
|
3773
|
// init
|
3774
|
$this.trigger('change.uk.tab', [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
|
3775
|
|
3776
|
this.check();
|
3777
|
|
3778
|
UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
|
3779
|
if ($this.element.is(':visible')) $this.check();
|
3780
|
}, 100));
|
3781
|
|
3782
|
this.on('display.uk.check', function(){
|
3783
|
if ($this.element.is(':visible')) $this.check();
|
3784
|
});
|
3785
|
},
|
3786
|
|
3787
|
check: function() {
|
3788
|
|
3789
|
var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
|
3790
|
|
3791
|
if (!children.length) {
|
3792
|
this.responsivetab.addClass('uk-hidden');
|
3793
|
return;
|
3794
|
}
|
3795
|
|
3796
|
var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
|
3797
|
doresponsive = false,
|
3798
|
item, link, clone;
|
3799
|
|
3800
|
this.responsivetab.lst.empty();
|
3801
|
|
3802
|
children.each(function(){
|
3803
|
|
3804
|
if (UI.$(this).offset().top > top) {
|
3805
|
doresponsive = true;
|
3806
|
}
|
3807
|
});
|
3808
|
|
3809
|
if (doresponsive) {
|
3810
|
|
3811
|
for (var i = 0; i < children.length; i++) {
|
3812
|
|
3813
|
item = UI.$(children.eq(i));
|
3814
|
link = item.find('a');
|
3815
|
|
3816
|
if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
|
3817
|
|
3818
|
if (!item.hasClass('uk-disabled')) {
|
3819
|
|
3820
|
clone = UI.$(item[0].outerHTML);
|
3821
|
clone.find('a').data('index', i);
|
3822
|
|
3823
|
this.responsivetab.lst.append(clone);
|
3824
|
}
|
3825
|
|
3826
|
item.addClass('uk-hidden');
|
3827
|
}
|
3828
|
}
|
3829
|
}
|
3830
|
|
3831
|
this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
|
3832
|
}
|
3833
|
});
|
3834
|
|
3835
|
})(UIkit2);
|
3836
|
|
3837
|
(function(UI){
|
3838
|
|
3839
|
"use strict";
|
3840
|
|
3841
|
UI.component('cover', {
|
3842
|
|
3843
|
defaults: {
|
3844
|
automute : true
|
3845
|
},
|
3846
|
|
3847
|
boot: function() {
|
3848
|
|
3849
|
// auto init
|
3850
|
UI.ready(function(context) {
|
3851
|
|
3852
|
UI.$('[data-uk-cover]', context).each(function(){
|
3853
|
|
3854
|
var ele = UI.$(this);
|
3855
|
|
3856
|
if(!ele.data('cover')) {
|
3857
|
var plugin = UI.cover(ele, UI.Utils.options(ele.attr('data-uk-cover')));
|
3858
|
}
|
3859
|
});
|
3860
|
});
|
3861
|
},
|
3862
|
|
3863
|
init: function() {
|
3864
|
|
3865
|
this.parent = this.element.parent();
|
3866
|
|
3867
|
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
3868
|
this.check();
|
3869
|
}.bind(this), 100));
|
3870
|
|
3871
|
this.on('display.uk.check', function(e) {
|
3872
|
if (this.element.is(':visible')) this.check();
|
3873
|
}.bind(this));
|
3874
|
|
3875
|
this.check();
|
3876
|
|
3877
|
if (this.element.is('iframe') && this.options.automute) {
|
3878
|
|
3879
|
var src = this.element.attr('src');
|
3880
|
|
3881
|
this.element.attr('src', '').on('load', function(){
|
3882
|
this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
3883
|
}).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
|
3884
|
}
|
3885
|
},
|
3886
|
|
3887
|
check: function() {
|
3888
|
|
3889
|
this.element.css({ width : '', height : '' });
|
3890
|
|
3891
|
this.dimension = {w: this.element.width(), h: this.element.height()};
|
3892
|
|
3893
|
if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
|
3894
|
this.dimension.w = this.element.attr('width');
|
3895
|
}
|
3896
|
|
3897
|
if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
|
3898
|
this.dimension.h = this.element.attr('height');
|
3899
|
}
|
3900
|
|
3901
|
this.ratio = this.dimension.w / this.dimension.h;
|
3902
|
|
3903
|
var w = this.parent.width(), h = this.parent.height(), width, height;
|
3904
|
|
3905
|
// if element height < parent height (gap underneath)
|
3906
|
if ((w / this.ratio) < h) {
|
3907
|
|
3908
|
width = Math.ceil(h * this.ratio);
|
3909
|
height = h;
|
3910
|
|
3911
|
// element width < parent width (gap to right)
|
3912
|
} else {
|
3913
|
|
3914
|
width = w;
|
3915
|
height = Math.ceil(w / this.ratio);
|
3916
|
}
|
3917
|
|
3918
|
this.element.css({ width : width, height : height });
|
3919
|
}
|
3920
|
});
|
3921
|
|
3922
|
})(UIkit2);
|
3923
|
|
3924
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
3925
|
(function(addon) {
|
3926
|
var component;
|
3927
|
|
3928
|
if (window.UIkit2) {
|
3929
|
component = addon(UIkit2);
|
3930
|
}
|
3931
|
|
3932
|
if (typeof define == 'function' && define.amd) {
|
3933
|
define('uikit-accordion', ['uikit'], function(){
|
3934
|
return component || addon(UIkit2);
|
3935
|
});
|
3936
|
}
|
3937
|
})(function(UI){
|
3938
|
|
3939
|
"use strict";
|
3940
|
|
3941
|
UI.component('accordion', {
|
3942
|
|
3943
|
defaults: {
|
3944
|
showfirst : true,
|
3945
|
collapse : true,
|
3946
|
animate : true,
|
3947
|
easing : 'swing',
|
3948
|
duration : 300,
|
3949
|
toggle : '.uk-accordion-title',
|
3950
|
containers : '.uk-accordion-content',
|
3951
|
clsactive : 'uk-active'
|
3952
|
},
|
3953
|
|
3954
|
boot: function() {
|
3955
|
|
3956
|
// init code
|
3957
|
UI.ready(function(context) {
|
3958
|
|
3959
|
setTimeout(function(){
|
3960
|
|
3961
|
UI.$('[data-uk-accordion]', context).each(function(){
|
3962
|
|
3963
|
var ele = UI.$(this);
|
3964
|
|
3965
|
if (!ele.data('accordion')) {
|
3966
|
UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
|
3967
|
}
|
3968
|
});
|
3969
|
|
3970
|
}, 0);
|
3971
|
});
|
3972
|
},
|
3973
|
|
3974
|
init: function() {
|
3975
|
|
3976
|
var $this = this;
|
3977
|
|
3978
|
this.element.on('click.uk.accordion', this.options.toggle, function(e) {
|
3979
|
|
3980
|
e.preventDefault();
|
3981
|
|
3982
|
$this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
|
3983
|
});
|
3984
|
|
3985
|
this.update(true);
|
3986
|
|
3987
|
UI.domObserve(this.element, function(e) {
|
3988
|
if ($this.element.children($this.options.containers).length) {
|
3989
|
$this.update();
|
3990
|
}
|
3991
|
});
|
3992
|
},
|
3993
|
|
3994
|
toggleItem: function(wrapper, animated, collapse) {
|
3995
|
|
3996
|
var $this = this;
|
3997
|
|
3998
|
wrapper.data('toggle').toggleClass(this.options.clsactive);
|
3999
|
wrapper.data('content').toggleClass(this.options.clsactive);
|
4000
|
|
4001
|
var active = wrapper.data('toggle').hasClass(this.options.clsactive);
|
4002
|
|
4003
|
if (collapse) {
|
4004
|
this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
|
4005
|
this.content.not(wrapper.data('content')).removeClass(this.options.clsactive)
|
4006
|
.parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
|
4007
|
}
|
4008
|
|
4009
|
wrapper.stop().css('overflow', 'hidden');
|
4010
|
|
4011
|
if (animated) {
|
4012
|
|
4013
|
wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
|
4014
|
|
4015
|
if (active) {
|
4016
|
wrapper.css({'overflow': '', 'height': 'auto'});
|
4017
|
UI.Utils.checkDisplay(wrapper.data('content'));
|
4018
|
}
|
4019
|
|
4020
|
$this.trigger('display.uk.check');
|
4021
|
}});
|
4022
|
|
4023
|
} else {
|
4024
|
|
4025
|
wrapper.height(active ? 'auto' : 0);
|
4026
|
|
4027
|
if (active) {
|
4028
|
wrapper.css({'overflow': ''});
|
4029
|
UI.Utils.checkDisplay(wrapper.data('content'));
|
4030
|
}
|
4031
|
|
4032
|
this.trigger('display.uk.check');
|
4033
|
}
|
4034
|
|
4035
|
// Update ARIA
|
4036
|
wrapper.attr('aria-expanded', active);
|
4037
|
|
4038
|
this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
|
4039
|
},
|
4040
|
|
4041
|
update: function(init) {
|
4042
|
|
4043
|
var $this = this, $content, $wrapper, $toggle;
|
4044
|
|
4045
|
this.toggle = this.find(this.options.toggle);
|
4046
|
this.content = this.find(this.options.containers);
|
4047
|
|
4048
|
this.content.each(function(index) {
|
4049
|
|
4050
|
$content = UI.$(this);
|
4051
|
|
4052
|
if ($content.parent().data('wrapper')) {
|
4053
|
$wrapper = $content.parent();
|
4054
|
} else {
|
4055
|
$wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
|
4056
|
|
4057
|
// Init ARIA
|
4058
|
$wrapper.attr('aria-expanded', 'false');
|
4059
|
}
|
4060
|
|
4061
|
$toggle = $this.toggle.eq(index);
|
4062
|
|
4063
|
$wrapper.data('toggle', $toggle);
|
4064
|
$wrapper.data('content', $content);
|
4065
|
$toggle.data('wrapper', $wrapper);
|
4066
|
$content.data('wrapper', $wrapper);
|
4067
|
});
|
4068
|
|
4069
|
this.element.trigger('update.uk.accordion', [this]);
|
4070
|
|
4071
|
if (init && this.options.showfirst) {
|
4072
|
this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
|
4073
|
}
|
4074
|
}
|
4075
|
|
4076
|
});
|
4077
|
|
4078
|
// helper
|
4079
|
|
4080
|
function getHeight(ele) {
|
4081
|
|
4082
|
var $ele = UI.$(ele), height = "auto";
|
4083
|
|
4084
|
if ($ele.is(":visible")) {
|
4085
|
height = $ele.outerHeight();
|
4086
|
} else {
|
4087
|
|
4088
|
var tmp = {
|
4089
|
position : $ele.css('position'),
|
4090
|
visibility : $ele.css('visibility'),
|
4091
|
display : $ele.css('display')
|
4092
|
};
|
4093
|
|
4094
|
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
4095
|
|
4096
|
$ele.css(tmp); // reset element
|
4097
|
}
|
4098
|
|
4099
|
return height;
|
4100
|
}
|
4101
|
|
4102
|
return UI.accordion;
|
4103
|
});
|
4104
|
|
4105
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
4106
|
(function(addon) {
|
4107
|
|
4108
|
var component;
|
4109
|
|
4110
|
if (window.UIkit2) {
|
4111
|
component = addon(UIkit2);
|
4112
|
}
|
4113
|
|
4114
|
if (typeof define == 'function' && define.amd) {
|
4115
|
define('uikit-autocomplete', ['uikit'], function(){
|
4116
|
return component || addon(UIkit2);
|
4117
|
});
|
4118
|
}
|
4119
|
|
4120
|
})(function(UI){
|
4121
|
|
4122
|
"use strict";
|
4123
|
|
4124
|
var active;
|
4125
|
|
4126
|
UI.component('autocomplete', {
|
4127
|
|
4128
|
defaults: {
|
4129
|
minLength: 3,
|
4130
|
param: 'search',
|
4131
|
method: 'post',
|
4132
|
delay: 300,
|
4133
|
loadingClass: 'uk-loading',
|
4134
|
flipDropdown: false,
|
4135
|
skipClass: 'uk-skip',
|
4136
|
hoverClass: 'uk-active',
|
4137
|
source: null,
|
4138
|
renderer: null,
|
4139
|
|
4140
|
// template
|
4141
|
|
4142
|
template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
|
4143
|
},
|
4144
|
|
4145
|
visible : false,
|
4146
|
value : null,
|
4147
|
selected : null,
|
4148
|
|
4149
|
boot: function() {
|
4150
|
|
4151
|
// init code
|
4152
|
UI.$html.on('focus.autocomplete.uikit', '[data-uk-autocomplete]', function(e) {
|
4153
|
|
4154
|
var ele = UI.$(this);
|
4155
|
|
4156
|
if (!ele.data('autocomplete')) {
|
4157
|
UI.autocomplete(ele, UI.Utils.options(ele.attr('data-uk-autocomplete')));
|
4158
|
}
|
4159
|
});
|
4160
|
|
4161
|
// register outer click for autocompletes
|
4162
|
UI.$html.on('click.autocomplete.uikit', function(e) {
|
4163
|
if (active && e.target!=active.input[0]) active.hide();
|
4164
|
});
|
4165
|
},
|
4166
|
|
4167
|
init: function() {
|
4168
|
|
4169
|
var $this = this,
|
4170
|
select = false,
|
4171
|
trigger = UI.Utils.debounce(function(e) {
|
4172
|
|
4173
|
if (select) {
|
4174
|
return (select = false);
|
4175
|
}
|
4176
|
|
4177
|
$this.handle();
|
4178
|
}, this.options.delay);
|
4179
|
|
4180
|
|
4181
|
this.dropdown = this.find('.uk-dropdown');
|
4182
|
this.template = this.find('script[type="text/autocomplete"]').html();
|
4183
|
this.template = UI.Utils.template(this.template || this.options.template);
|
4184
|
this.input = this.find("input:first").attr("autocomplete", "off");
|
4185
|
|
4186
|
if (!this.dropdown.length) {
|
4187
|
this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
|
4188
|
}
|
4189
|
|
4190
|
if (this.options.flipDropdown) {
|
4191
|
this.dropdown.addClass('uk-dropdown-flip');
|
4192
|
}
|
4193
|
|
4194
|
this.dropdown.attr('aria-expanded', 'false');
|
4195
|
|
4196
|
this.input.on({
|
4197
|
|
4198
|
keydown: function(e) {
|
4199
|
|
4200
|
if (e && e.which && !e.shiftKey && $this.visible) {
|
4201
|
|
4202
|
switch (e.which) {
|
4203
|
case 13: // enter
|
4204
|
select = true;
|
4205
|
|
4206
|
if ($this.selected) {
|
4207
|
e.preventDefault();
|
4208
|
$this.select();
|
4209
|
}
|
4210
|
break;
|
4211
|
case 38: // up
|
4212
|
e.preventDefault();
|
4213
|
$this.pick('prev', true);
|
4214
|
break;
|
4215
|
case 40: // down
|
4216
|
e.preventDefault();
|
4217
|
$this.pick('next', true);
|
4218
|
break;
|
4219
|
case 27:
|
4220
|
case 9: // esc, tab
|
4221
|
$this.hide();
|
4222
|
break;
|
4223
|
default:
|
4224
|
break;
|
4225
|
}
|
4226
|
}
|
4227
|
|
4228
|
},
|
4229
|
|
4230
|
keyup: trigger
|
4231
|
});
|
4232
|
|
4233
|
this.dropdown.on('click', '.uk-autocomplete-results > *', function(){
|
4234
|
$this.select();
|
4235
|
});
|
4236
|
|
4237
|
this.dropdown.on('mouseover', '.uk-autocomplete-results > *', function(){
|
4238
|
$this.pick(UI.$(this));
|
4239
|
});
|
4240
|
|
4241
|
this.triggercomplete = trigger;
|
4242
|
},
|
4243
|
|
4244
|
handle: function() {
|
4245
|
|
4246
|
var $this = this, old = this.value;
|
4247
|
|
4248
|
this.value = this.input.val();
|
4249
|
|
4250
|
if (this.value.length < this.options.minLength) return this.hide();
|
4251
|
|
4252
|
if (this.value != old) {
|
4253
|
$this.request();
|
4254
|
}
|
4255
|
|
4256
|
return this;
|
4257
|
},
|
4258
|
|
4259
|
pick: function(item, scrollinview) {
|
4260
|
|
4261
|
var $this = this,
|
4262
|
items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
|
4263
|
selected = false;
|
4264
|
|
4265
|
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
4266
|
selected = item;
|
4267
|
} else if (item == 'next' || item == 'prev') {
|
4268
|
|
4269
|
if (this.selected) {
|
4270
|
var index = items.index(this.selected);
|
4271
|
|
4272
|
if (item == 'next') {
|
4273
|
selected = items.eq(index + 1 < items.length ? index + 1 : 0);
|
4274
|
} else {
|
4275
|
selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
|
4276
|
}
|
4277
|
|
4278
|
} else {
|
4279
|
selected = items[(item == 'next') ? 'first' : 'last']();
|
4280
|
}
|
4281
|
|
4282
|
selected = UI.$(selected);
|
4283
|
}
|
4284
|
|
4285
|
if (selected && selected.length) {
|
4286
|
this.selected = selected;
|
4287
|
items.removeClass(this.options.hoverClass);
|
4288
|
this.selected.addClass(this.options.hoverClass);
|
4289
|
|
4290
|
// jump to selected if not in view
|
4291
|
if (scrollinview) {
|
4292
|
|
4293
|
var top = selected.position().top,
|
4294
|
scrollTop = $this.dropdown.scrollTop(),
|
4295
|
dpheight = $this.dropdown.height();
|
4296
|
|
4297
|
if (top > dpheight || top < 0) {
|
4298
|
$this.dropdown.scrollTop(scrollTop + top);
|
4299
|
}
|
4300
|
}
|
4301
|
}
|
4302
|
},
|
4303
|
|
4304
|
select: function() {
|
4305
|
|
4306
|
if(!this.selected) return;
|
4307
|
|
4308
|
var data = this.selected.data();
|
4309
|
|
4310
|
this.trigger('selectitem.uk.autocomplete', [data, this]);
|
4311
|
|
4312
|
if (data.value) {
|
4313
|
this.input.val(data.value).trigger('change');
|
4314
|
}
|
4315
|
|
4316
|
this.hide();
|
4317
|
},
|
4318
|
|
4319
|
show: function() {
|
4320
|
|
4321
|
if (this.visible) return;
|
4322
|
|
4323
|
this.visible = true;
|
4324
|
this.element.addClass('uk-open');
|
4325
|
|
4326
|
if (active && active!==this) {
|
4327
|
active.hide();
|
4328
|
}
|
4329
|
|
4330
|
active = this;
|
4331
|
|
4332
|
// Update aria
|
4333
|
this.dropdown.attr('aria-expanded', 'true');
|
4334
|
|
4335
|
return this;
|
4336
|
},
|
4337
|
|
4338
|
hide: function() {
|
4339
|
if (!this.visible) return;
|
4340
|
this.visible = false;
|
4341
|
this.element.removeClass('uk-open');
|
4342
|
|
4343
|
if (active === this) {
|
4344
|
active = false;
|
4345
|
}
|
4346
|
|
4347
|
// Update aria
|
4348
|
this.dropdown.attr('aria-expanded', 'false');
|
4349
|
|
4350
|
return this;
|
4351
|
},
|
4352
|
|
4353
|
request: function() {
|
4354
|
|
4355
|
var $this = this,
|
4356
|
release = function(data) {
|
4357
|
|
4358
|
if(data) {
|
4359
|
$this.render(data);
|
4360
|
}
|
4361
|
|
4362
|
$this.element.removeClass($this.options.loadingClass);
|
4363
|
};
|
4364
|
|
4365
|
this.element.addClass(this.options.loadingClass);
|
4366
|
|
4367
|
if (this.options.source) {
|
4368
|
|
4369
|
var source = this.options.source;
|
4370
|
|
4371
|
switch(typeof(this.options.source)) {
|
4372
|
case 'function':
|
4373
|
|
4374
|
this.options.source.apply(this, [release]);
|
4375
|
|
4376
|
break;
|
4377
|
|
4378
|
case 'object':
|
4379
|
|
4380
|
if(source.length) {
|
4381
|
|
4382
|
var items = [];
|
4383
|
|
4384
|
source.forEach(function(item){
|
4385
|
if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
|
4386
|
items.push(item);
|
4387
|
}
|
4388
|
});
|
4389
|
|
4390
|
release(items);
|
4391
|
}
|
4392
|
|
4393
|
break;
|
4394
|
|
4395
|
case 'string':
|
4396
|
|
4397
|
var params ={};
|
4398
|
|
4399
|
params[this.options.param] = this.value;
|
4400
|
|
4401
|
UI.$.ajax({
|
4402
|
url: this.options.source,
|
4403
|
data: params,
|
4404
|
type: this.options.method,
|
4405
|
dataType: 'json'
|
4406
|
}).done(function(json) {
|
4407
|
release(json || []);
|
4408
|
});
|
4409
|
|
4410
|
break;
|
4411
|
|
4412
|
default:
|
4413
|
release(null);
|
4414
|
}
|
4415
|
|
4416
|
} else {
|
4417
|
this.element.removeClass($this.options.loadingClass);
|
4418
|
}
|
4419
|
},
|
4420
|
|
4421
|
render: function(data) {
|
4422
|
|
4423
|
this.dropdown.empty();
|
4424
|
|
4425
|
this.selected = false;
|
4426
|
|
4427
|
if (this.options.renderer) {
|
4428
|
|
4429
|
this.options.renderer.apply(this, [data]);
|
4430
|
|
4431
|
} else if(data && data.length) {
|
4432
|
|
4433
|
this.dropdown.append(this.template({items:data}));
|
4434
|
this.show();
|
4435
|
|
4436
|
this.trigger('show.uk.autocomplete');
|
4437
|
}
|
4438
|
|
4439
|
return this;
|
4440
|
}
|
4441
|
});
|
4442
|
|
4443
|
return UI.autocomplete;
|
4444
|
});
|
4445
|
|
4446
|
/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
4447
|
// removed moment_js from core
|
4448
|
// customized by tzd
|
4449
|
|
4450
|
(function(addon) {
|
4451
|
|
4452
|
var component;
|
4453
|
|
4454
|
if (window.UIkit) {
|
4455
|
component = addon(UIkit);
|
4456
|
}
|
4457
|
|
4458
|
if (typeof define == "function" && define.amd) {
|
4459
|
define("uikit-datepicker", ["uikit"], function(){
|
4460
|
return component || addon(UIkit);
|
4461
|
});
|
4462
|
}
|
4463
|
|
4464
|
})(function(UI){
|
4465
|
|
4466
|
"use strict";
|
4467
|
|
4468
|
// Datepicker
|
4469
|
|
4470
|
var active = false, dropdown;
|
4471
|
|
4472
|
UI.component('datepicker', {
|
4473
|
|
4474
|
defaults: {
|
4475
|
mobile: false,
|
4476
|
weekstart: 1,
|
4477
|
i18n: {
|
4478
|
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
4479
|
weekdays : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
4480
|
},
|
4481
|
format: "DD.MM.YYYY",
|
4482
|
offsettop: 5,
|
4483
|
maxDate: false,
|
4484
|
minDate: false,
|
4485
|
pos: 'auto',
|
4486
|
addClass: '',
|
4487
|
template: function(data, opts) {
|
4488
|
|
4489
|
var content = '', i;
|
4490
|
|
4491
|
content += '<div class="uk-datepicker-nav uk-clearfix">';
|
4492
|
content += '<a href="" class="uk-datepicker-previous"></a>';
|
4493
|
content += '<a href="" class="uk-datepicker-next"></a>';
|
4494
|
|
4495
|
if (UI.formSelect) {
|
4496
|
|
4497
|
var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
|
4498
|
|
4499
|
for (i=0;i<opts.i18n.months.length;i++) {
|
4500
|
if(i==data.month) {
|
4501
|
options.push('<option value="'+i+'" selected>'+opts.i18n.months[i]+'</option>');
|
4502
|
} else {
|
4503
|
options.push('<option value="'+i+'">'+opts.i18n.months[i]+'</option>');
|
4504
|
}
|
4505
|
}
|
4506
|
|
4507
|
months = '<span class="uk-form-select">'+ opts.i18n.months[data.month] + '<select class="update-picker-month">'+options.join('')+'</select></span>';
|
4508
|
|
4509
|
// --
|
4510
|
|
4511
|
options = [];
|
4512
|
|
4513
|
minYear = data.minDate ? data.minDate.year() : currentyear - 50;
|
4514
|
maxYear = data.maxDate ? data.maxDate.year() : currentyear + 20;
|
4515
|
|
4516
|
for (i=minYear;i<=maxYear;i++) {
|
4517
|
if (i == data.year) {
|
4518
|
options.push('<option value="'+i+'" selected>'+i+'</option>');
|
4519
|
} else {
|
4520
|
options.push('<option value="'+i+'">'+i+'</option>');
|
4521
|
}
|
4522
|
}
|
4523
|
|
4524
|
years = '<span class="uk-form-select">'+ data.year + '<select class="update-picker-year">'+options.join('')+'</select></span>';
|
4525
|
|
4526
|
content += '<div class="uk-datepicker-heading">'+ months + ' ' + years +'</div>';
|
4527
|
|
4528
|
} else {
|
4529
|
content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
|
4530
|
}
|
4531
|
|
4532
|
content += '</div>';
|
4533
|
|
4534
|
content += '<table class="uk-datepicker-table">';
|
4535
|
content += '<thead>';
|
4536
|
for(i = 0; i < data.weekdays.length; i++) {
|
4537
|
if (data.weekdays[i]) {
|
4538
|
content += '<th>'+data.weekdays[i]+'</th>';
|
4539
|
}
|
4540
|
}
|
4541
|
content += '</thead>';
|
4542
|
|
4543
|
content += '<tbody>';
|
4544
|
for(i = 0; i < data.days.length; i++) {
|
4545
|
if (data.days[i] && data.days[i].length){
|
4546
|
content += '<tr>';
|
4547
|
for(var d = 0; d < data.days[i].length; d++) {
|
4548
|
if (data.days[i][d]) {
|
4549
|
var day = data.days[i][d],
|
4550
|
cls = [];
|
4551
|
|
4552
|
if(!day.inmonth) cls.push("uk-datepicker-table-muted");
|
4553
|
if(day.selected) cls.push("uk-active");
|
4554
|
if(day.disabled) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
|
4555
|
|
4556
|
content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
|
4557
|
}
|
4558
|
}
|
4559
|
content += '</tr>';
|
4560
|
}
|
4561
|
}
|
4562
|
content += '</tbody>';
|
4563
|
|
4564
|
content += '</table>';
|
4565
|
|
4566
|
return content;
|
4567
|
}
|
4568
|
},
|
4569
|
|
4570
|
boot: function() {
|
4571
|
|
4572
|
UI.$win.on("resize orientationchange", function() {
|
4573
|
|
4574
|
if (active) {
|
4575
|
active.hide();
|
4576
|
}
|
4577
|
});
|
4578
|
|
4579
|
// init code
|
4580
|
UI.$html.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
|
4581
|
|
4582
|
var ele = UI.$(this);
|
4583
|
|
4584
|
if (!ele.data("datepicker")) {
|
4585
|
e.preventDefault();
|
4586
|
UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
|
4587
|
ele.trigger("focus");
|
4588
|
}
|
4589
|
});
|
4590
|
|
4591
|
UI.$html.on("click focus", '*', function(e) {
|
4592
|
|
4593
|
var target = UI.$(e.target);
|
4594
|
|
4595
|
if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
|
4596
|
active.hide();
|
4597
|
}
|
4598
|
});
|
4599
|
},
|
4600
|
|
4601
|
init: function() {
|
4602
|
|
4603
|
// use native datepicker on touch devices
|
4604
|
if (UI.support.touch && this.element.attr('type')=='date' && !this.options.mobile) {
|
4605
|
return;
|
4606
|
}
|
4607
|
|
4608
|
var $this = this;
|
4609
|
|
4610
|
this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
|
4611
|
|
4612
|
this.on("click focus", function(){
|
4613
|
if (active!==$this) $this.pick(this.value ? this.value:($this.options.minDate ? $this.options.minDate :''));
|
4614
|
}).on("change", function(){
|
4615
|
if ($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
|
4616
|
$this.element.val(moment().format($this.options.format));
|
4617
|
}
|
4618
|
});
|
4619
|
|
4620
|
// init dropdown
|
4621
|
if (!dropdown) {
|
4622
|
|
4623
|
dropdown = UI.$('<div class="uk-dropdown uk-datepicker '+$this.options.addClass+'"></div>');
|
4624
|
|
4625
|
dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
|
4626
|
|
4627
|
e.stopPropagation();
|
4628
|
e.preventDefault();
|
4629
|
|
4630
|
var ele = UI.$(this);
|
4631
|
|
4632
|
if (ele.hasClass('uk-datepicker-date-disabled')) return false;
|
4633
|
|
4634
|
if (ele.is('[data-date]')) {
|
4635
|
active.current = moment(ele.data("date"));
|
4636
|
active.element.val(active.current.isValid() ? active.current.format(active.options.format) : null).trigger("change");
|
4637
|
dropdown.removeClass('uk-dropdown-shown');
|
4638
|
setTimeout(function() {
|
4639
|
dropdown.removeClass('uk-dropdown-active')
|
4640
|
},280);
|
4641
|
active.hide();
|
4642
|
} else {
|
4643
|
active.add((ele.hasClass("uk-datepicker-next") ? 1:-1), "months");
|
4644
|
}
|
4645
|
});
|
4646
|
|
4647
|
dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
|
4648
|
|
4649
|
var select = UI.$(this);
|
4650
|
active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
|
4651
|
});
|
4652
|
|
4653
|
dropdown.appendTo("body");
|
4654
|
}
|
4655
|
},
|
4656
|
|
4657
|
pick: function(initdate) {
|
4658
|
|
4659
|
var offset = this.element.offset(),
|
4660
|
offset_left = parseInt(offset.left),
|
4661
|
offset_top = parseInt(offset.top),
|
4662
|
css = {
|
4663
|
'left': offset_left,
|
4664
|
'right': ""
|
4665
|
};
|
4666
|
|
4667
|
this.current = isNaN(initdate) ? moment(initdate, this.options.format):moment();
|
4668
|
this.initdate = this.current.format("YYYY-MM-DD");
|
4669
|
|
4670
|
this.update();
|
4671
|
|
4672
|
// check if datepicker input is in modal
|
4673
|
if(($(this.element[0]).closest('.ui-dialog').length || $(this.element[0]).closest('.uk-modal').length) && !dropdown.hasClass('dropdown-modal')) {
|
4674
|
dropdown.addClass('dropdown-modal');
|
4675
|
}
|
4676
|
|
4677
|
if (UI.langdirection == 'right' || ( window.innerWidth - offset_left - dropdown.outerWidth() < 0 ) ) {
|
4678
|
css.right = (window.innerWidth - (window.innerWidth - $('body').width())) - (css.left + this.element.outerWidth());
|
4679
|
css.left = "";
|
4680
|
}
|
4681
|
|
4682
|
var posTop = (offset_top - this.element.outerHeight() + this.element.height()) - this.options.offsettop - dropdown.outerHeight(),
|
4683
|
posBottom = offset_top + this.element.outerHeight() + this.options.offsettop;
|
4684
|
|
4685
|
css.top = posBottom;
|
4686
|
|
4687
|
if (this.options.pos == 'top') {
|
4688
|
css.top = posTop;
|
4689
|
dropdown.addClass('dp-top');
|
4690
|
} else if(this.options.pos == 'auto' && (window.innerHeight - posBottom - dropdown.outerHeight() + UI.$win.scrollTop() < 0 && posTop >= 0) ) {
|
4691
|
css.top = posTop;
|
4692
|
dropdown.addClass('dp-top');
|
4693
|
}
|
4694
|
|
4695
|
css.minWidth = dropdown.actual('outerWidth');
|
4696
|
|
4697
|
dropdown.css(css).addClass('uk-dropdown-active uk-dropdown-shown');
|
4698
|
|
4699
|
|
4700
|
this.trigger('show.uk.datepicker');
|
4701
|
|
4702
|
active = this;
|
4703
|
},
|
4704
|
|
4705
|
add: function(unit, value) {
|
4706
|
this.current.add(unit, value);
|
4707
|
this.update();
|
4708
|
},
|
4709
|
|
4710
|
setMonth: function(month) {
|
4711
|
this.current.month(month);
|
4712
|
this.update();
|
4713
|
},
|
4714
|
|
4715
|
setYear: function(year) {
|
4716
|
this.current.year(year);
|
4717
|
this.update();
|
4718
|
},
|
4719
|
|
4720
|
update: function() {
|
4721
|
|
4722
|
var data = this.getRows(this.current.year(), this.current.month()),
|
4723
|
tpl = this.options.template(data, this.options);
|
4724
|
|
4725
|
dropdown.html(tpl);
|
4726
|
|
4727
|
this.trigger('update.uk.datepicker');
|
4728
|
},
|
4729
|
|
4730
|
getRows: function(year, month) {
|
4731
|
|
4732
|
var opts = this.options,
|
4733
|
now = moment().format('YYYY-MM-DD'),
|
4734
|
days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
|
4735
|
before = new Date(year, month, 1, 12).getDay(),
|
4736
|
data = {"month":month, "year":year,"weekdays":[],"days":[], "maxDate": false, "minDate": false},
|
4737
|
row = [];
|
4738
|
|
4739
|
// We need these to be midday to avoid issues from DST transition protection.
|
4740
|
if (opts.maxDate!==false){
|
4741
|
data.maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format).startOf('day').hours(12) : moment().add(opts.maxDate, 'days').startOf('day').hours(12);
|
4742
|
}
|
4743
|
|
4744
|
if (opts.minDate!==false){
|
4745
|
data.minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format).startOf('day').hours(12) : moment().add(opts.minDate-1, 'days').startOf('day').hours(12);
|
4746
|
}
|
4747
|
|
4748
|
data.weekdays = (function(){
|
4749
|
|
4750
|
for (var i=0, arr=[]; i < 7; i++) {
|
4751
|
|
4752
|
var day = i + (opts.weekstart || 0);
|
4753
|
|
4754
|
while (day >= 7) {
|
4755
|
day -= 7;
|
4756
|
}
|
4757
|
|
4758
|
arr.push(opts.i18n.weekdays[day]);
|
4759
|
}
|
4760
|
|
4761
|
return arr;
|
4762
|
})();
|
4763
|
|
4764
|
if (opts.weekstart && opts.weekstart > 0) {
|
4765
|
before -= opts.weekstart;
|
4766
|
if (before < 0) {
|
4767
|
before += 7;
|
4768
|
}
|
4769
|
}
|
4770
|
|
4771
|
var cells = days + before, after = cells;
|
4772
|
|
4773
|
while(after > 7) { after -= 7; }
|
4774
|
|
4775
|
cells += 7 - after;
|
4776
|
|
4777
|
var day, isDisabled, isSelected, isToday, isInMonth;
|
4778
|
|
4779
|
for (var i = 0, r = 0; i < cells; i++) {
|
4780
|
|
4781
|
day = new Date(year, month, 1 + (i - before), 12);
|
4782
|
isDisabled = (data.minDate && data.minDate > day) || (data.maxDate && day > data.maxDate);
|
4783
|
isInMonth = !(i < before || i >= (days + before));
|
4784
|
|
4785
|
day = moment(day);
|
4786
|
|
4787
|
isSelected = this.initdate == day.format("YYYY-MM-DD");
|
4788
|
isToday = now == day.format("YYYY-MM-DD");
|
4789
|
|
4790
|
row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
|
4791
|
|
4792
|
if (++r === 7) {
|
4793
|
data.days.push(row);
|
4794
|
row = [];
|
4795
|
r = 0;
|
4796
|
}
|
4797
|
}
|
4798
|
|
4799
|
return data;
|
4800
|
},
|
4801
|
|
4802
|
hide: function() {
|
4803
|
|
4804
|
if (active && active === this) {
|
4805
|
dropdown.removeClass('uk-dropdown-shown');
|
4806
|
setTimeout(function() {
|
4807
|
dropdown.removeClass('uk-dropdown-active dp-top')
|
4808
|
},280);
|
4809
|
active = false;
|
4810
|
this.trigger('hide.uk.datepicker');
|
4811
|
}
|
4812
|
}
|
4813
|
});
|
4814
|
|
4815
|
UI.Utils.moment = moment();
|
4816
|
|
4817
|
return UI.datepicker;
|
4818
|
});
|
4819
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
4820
|
(function(addon) {
|
4821
|
|
4822
|
var component;
|
4823
|
|
4824
|
if (window.UIkit2) {
|
4825
|
component = addon(UIkit2);
|
4826
|
}
|
4827
|
|
4828
|
if (typeof define == 'function' && define.amd) {
|
4829
|
define('uikit-form-password', ['uikit'], function(){
|
4830
|
return component || addon(UIkit2);
|
4831
|
});
|
4832
|
}
|
4833
|
|
4834
|
})(function(UI){
|
4835
|
|
4836
|
"use strict";
|
4837
|
|
4838
|
UI.component('formPassword', {
|
4839
|
|
4840
|
defaults: {
|
4841
|
lblShow: 'Show',
|
4842
|
lblHide: 'Hide'
|
4843
|
},
|
4844
|
|
4845
|
boot: function() {
|
4846
|
// init code
|
4847
|
UI.$html.on('click.formpassword.uikit', '[data-uk-form-password]', function(e) {
|
4848
|
|
4849
|
var ele = UI.$(this);
|
4850
|
|
4851
|
if (!ele.data('formPassword')) {
|
4852
|
|
4853
|
e.preventDefault();
|
4854
|
|
4855
|
UI.formPassword(ele, UI.Utils.options(ele.attr('data-uk-form-password')));
|
4856
|
ele.trigger('click');
|
4857
|
}
|
4858
|
});
|
4859
|
},
|
4860
|
|
4861
|
init: function() {
|
4862
|
|
4863
|
var $this = this;
|
4864
|
|
4865
|
this.on('click', function(e) {
|
4866
|
|
4867
|
e.preventDefault();
|
4868
|
|
4869
|
if($this.input.length) {
|
4870
|
var type = $this.input.attr('type');
|
4871
|
$this.input.attr('type', type=='text' ? 'password':'text');
|
4872
|
$this.element.html($this.options[type=='text' ? 'lblShow':'lblHide']);
|
4873
|
}
|
4874
|
});
|
4875
|
|
4876
|
this.input = this.element.next('input').length ? this.element.next('input') : this.element.prev('input');
|
4877
|
this.element.html(this.options[this.input.is('[type="password"]') ? 'lblShow':'lblHide']);
|
4878
|
|
4879
|
|
4880
|
this.element.data('formPassword', this);
|
4881
|
}
|
4882
|
});
|
4883
|
|
4884
|
return UI.formPassword;
|
4885
|
});
|
4886
|
|
4887
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
4888
|
(function(addon) {
|
4889
|
|
4890
|
var component;
|
4891
|
|
4892
|
if (window.UIkit2) {
|
4893
|
component = addon(UIkit2);
|
4894
|
}
|
4895
|
|
4896
|
if (typeof define == 'function' && define.amd) {
|
4897
|
define('uikit-form-select', ['uikit'], function(){
|
4898
|
return component || addon(UIkit2);
|
4899
|
});
|
4900
|
}
|
4901
|
|
4902
|
})(function(UI){
|
4903
|
|
4904
|
"use strict";
|
4905
|
|
4906
|
UI.component('formSelect', {
|
4907
|
|
4908
|
defaults: {
|
4909
|
target: '>span:first',
|
4910
|
activeClass: 'uk-active'
|
4911
|
},
|
4912
|
|
4913
|
boot: function() {
|
4914
|
// init code
|
4915
|
UI.ready(function(context) {
|
4916
|
|
4917
|
UI.$('[data-uk-form-select]', context).each(function(){
|
4918
|
|
4919
|
var ele = UI.$(this);
|
4920
|
|
4921
|
if (!ele.data('formSelect')) {
|
4922
|
UI.formSelect(ele, UI.Utils.options(ele.attr('data-uk-form-select')));
|
4923
|
}
|
4924
|
});
|
4925
|
});
|
4926
|
},
|
4927
|
|
4928
|
init: function() {
|
4929
|
|
4930
|
var $this = this;
|
4931
|
|
4932
|
this.target = this.find(this.options.target);
|
4933
|
this.select = this.find('select');
|
4934
|
|
4935
|
// init + on change event
|
4936
|
this.select.on({
|
4937
|
|
4938
|
change: (function(){
|
4939
|
|
4940
|
var select = $this.select[0], fn = function(){
|
4941
|
|
4942
|
try {
|
4943
|
|
4944
|
if($this.options.target === 'input') {
|
4945
|
$this.target.val(select.options[select.selectedIndex].text);
|
4946
|
} else {
|
4947
|
$this.target.text(select.options[select.selectedIndex].text);
|
4948
|
}
|
4949
|
|
4950
|
} catch(e) {}
|
4951
|
|
4952
|
$this.element[$this.select.val() ? 'addClass':'removeClass']($this.options.activeClass);
|
4953
|
|
4954
|
return fn;
|
4955
|
};
|
4956
|
|
4957
|
return fn();
|
4958
|
})(),
|
4959
|
|
4960
|
focus: function(){ $this.target.addClass('uk-focus') },
|
4961
|
blur: function(){ $this.target.removeClass('uk-focus') },
|
4962
|
mouseenter: function(){ $this.target.addClass('uk-hover') },
|
4963
|
mouseleave: function(){ $this.target.removeClass('uk-hover') }
|
4964
|
});
|
4965
|
|
4966
|
this.element.data("formSelect", this);
|
4967
|
}
|
4968
|
});
|
4969
|
|
4970
|
return UI.formSelect;
|
4971
|
});
|
4972
|
|
4973
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
4974
|
(function(addon) {
|
4975
|
|
4976
|
var component;
|
4977
|
|
4978
|
if (window.UIkit2) {
|
4979
|
component = addon(UIkit2);
|
4980
|
}
|
4981
|
|
4982
|
if (typeof define == 'function' && define.amd) {
|
4983
|
define('uikit-grid', ['uikit'], function(){
|
4984
|
return component || addon(UIkit2);
|
4985
|
});
|
4986
|
}
|
4987
|
|
4988
|
})(function(UI){
|
4989
|
|
4990
|
"use strict";
|
4991
|
|
4992
|
UI.component('grid', {
|
4993
|
|
4994
|
defaults: {
|
4995
|
colwidth : 'auto',
|
4996
|
animation : true,
|
4997
|
duration : 300,
|
4998
|
gutter : 0,
|
4999
|
controls : false,
|
5000
|
filter : false,
|
5001
|
origin : UI.langdirection
|
5002
|
},
|
5003
|
|
5004
|
boot: function() {
|
5005
|
|
5006
|
// init code
|
5007
|
UI.ready(function(context) {
|
5008
|
|
5009
|
UI.$('[data-uk-grid]', context).each(function(){
|
5010
|
|
5011
|
var ele = UI.$(this);
|
5012
|
|
5013
|
if(!ele.data('grid')) {
|
5014
|
UI.grid(ele, UI.Utils.options(ele.attr('data-uk-grid')));
|
5015
|
}
|
5016
|
});
|
5017
|
});
|
5018
|
},
|
5019
|
|
5020
|
init: function() {
|
5021
|
|
5022
|
var $this = this, gutter = String(this.options.gutter).trim().split(' ');
|
5023
|
|
5024
|
this.gutterv = parseInt(gutter[0], 10);
|
5025
|
this.gutterh = parseInt((gutter[1] || gutter[0]), 10);
|
5026
|
|
5027
|
// make sure parent element has the right position property
|
5028
|
this.element.css({'position': 'relative'});
|
5029
|
|
5030
|
this.controls = null;
|
5031
|
this.origin = this.options.origin;
|
5032
|
|
5033
|
if (this.options.controls) {
|
5034
|
|
5035
|
this.controls = UI.$(this.options.controls);
|
5036
|
|
5037
|
// filter
|
5038
|
this.controls.on('click', '[data-uk-filter]', function(e){
|
5039
|
e.preventDefault();
|
5040
|
$this.filter(UI.$(this).attr('data-uk-filter'));
|
5041
|
});
|
5042
|
|
5043
|
// sort
|
5044
|
this.controls.on('click', '[data-uk-sort]', function(e){
|
5045
|
e.preventDefault();
|
5046
|
var cmd = UI.$(this).attr('data-uk-sort').split(':');
|
5047
|
$this.sort(cmd[0], cmd[1]);
|
5048
|
});
|
5049
|
}
|
5050
|
|
5051
|
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
|
5052
|
|
5053
|
if ($this.currentfilter) {
|
5054
|
$this.filter($this.currentfilter);
|
5055
|
} else {
|
5056
|
this.update();
|
5057
|
}
|
5058
|
|
5059
|
}.bind(this), 100));
|
5060
|
|
5061
|
this.on('display.uk.check', function(){
|
5062
|
if ($this.element.is(':visible')) $this.update();
|
5063
|
});
|
5064
|
|
5065
|
UI.domObserve(this.element, function(e) {
|
5066
|
$this.update();
|
5067
|
});
|
5068
|
|
5069
|
if (this.options.filter !== false) {
|
5070
|
this.filter(this.options.filter);
|
5071
|
} else {
|
5072
|
this.update();
|
5073
|
}
|
5074
|
},
|
5075
|
|
5076
|
_prepareElements: function() {
|
5077
|
|
5078
|
var children = this.element.children().not('[data-grid-prepared]'), css;
|
5079
|
|
5080
|
// exit if no already prepared elements found
|
5081
|
if (!children.length) {
|
5082
|
return;
|
5083
|
}
|
5084
|
|
5085
|
css = {
|
5086
|
position : 'absolute',
|
5087
|
boxSizing : 'border-box',
|
5088
|
width : this.options.colwidth == 'auto' ? '' : this.options.colwidth
|
5089
|
};
|
5090
|
|
5091
|
if (this.options.gutter) {
|
5092
|
|
5093
|
css['padding-'+this.origin] = this.gutterh;
|
5094
|
css['padding-bottom'] = this.gutterv;
|
5095
|
|
5096
|
this.element.css('margin-'+this.origin, this.gutterh * -1);
|
5097
|
}
|
5098
|
|
5099
|
children.attr('data-grid-prepared', 'true').css(css);
|
5100
|
},
|
5101
|
|
5102
|
update: function(elements) {
|
5103
|
|
5104
|
var $this = this;
|
5105
|
|
5106
|
this._prepareElements();
|
5107
|
|
5108
|
elements = elements || this.element.children(':visible');
|
5109
|
|
5110
|
var children = elements,
|
5111
|
maxwidth = this.element.width() + (2*this.gutterh) + 2,
|
5112
|
left = 0,
|
5113
|
top = 0,
|
5114
|
positions = [],
|
5115
|
|
5116
|
item, width, height, pos, posi, i, z, max, size;
|
5117
|
|
5118
|
this.trigger('beforeupdate.uk.grid', [children]);
|
5119
|
|
5120
|
children.each(function(index){
|
5121
|
|
5122
|
item = UI.$(this);
|
5123
|
size = this.getBoundingClientRect();
|
5124
|
width = size.width;
|
5125
|
height = size.height;
|
5126
|
left = 0;
|
5127
|
top = 0;
|
5128
|
|
5129
|
for (i=0,max=positions.length;i<max;i++) {
|
5130
|
|
5131
|
pos = positions[i];
|
5132
|
|
5133
|
if (left <= pos.aX) { left = pos.aX; }
|
5134
|
if (maxwidth < (left + width)) { left = 0; }
|
5135
|
if (top <= pos.aY) { top = pos.aY; }
|
5136
|
}
|
5137
|
|
5138
|
posi = {
|
5139
|
ele : item,
|
5140
|
top : top,
|
5141
|
width : width,
|
5142
|
height : height,
|
5143
|
aY : (top + height),
|
5144
|
aX : (left + width)
|
5145
|
};
|
5146
|
|
5147
|
posi[$this.origin] = left;
|
5148
|
|
5149
|
positions.push(posi);
|
5150
|
});
|
5151
|
|
5152
|
var posPrev, maxHeight = 0, positionto;
|
5153
|
|
5154
|
// fix top
|
5155
|
for (i=0,max=positions.length;i<max;i++) {
|
5156
|
|
5157
|
pos = positions[i];
|
5158
|
top = 0;
|
5159
|
|
5160
|
for (z=0;z<i;z++) {
|
5161
|
|
5162
|
posPrev = positions[z];
|
5163
|
|
5164
|
// (posPrev.left + 1) fixex 1px bug when using % based widths
|
5165
|
if (pos[this.origin] < posPrev.aX && (posPrev[this.origin] +1) < pos.aX) {
|
5166
|
top = posPrev.aY;
|
5167
|
}
|
5168
|
}
|
5169
|
|
5170
|
pos.top = top;
|
5171
|
pos.aY = top + pos.height;
|
5172
|
|
5173
|
maxHeight = Math.max(maxHeight, pos.aY);
|
5174
|
}
|
5175
|
|
5176
|
maxHeight = maxHeight - this.gutterv;
|
5177
|
|
5178
|
if (this.options.animation) {
|
5179
|
|
5180
|
this.element.stop().animate({'height': maxHeight}, 100);
|
5181
|
|
5182
|
positions.forEach(function(pos){
|
5183
|
|
5184
|
positionto = {"top": pos.top, opacity: 1};
|
5185
|
positionto[$this.origin] = pos[$this.origin];
|
5186
|
|
5187
|
pos.ele.stop().animate(positionto, this.options.duration);
|
5188
|
}.bind(this));
|
5189
|
|
5190
|
} else {
|
5191
|
|
5192
|
this.element.css('height', maxHeight);
|
5193
|
|
5194
|
positions.forEach(function(pos){
|
5195
|
positionto = {"top": pos.top, opacity: 1};
|
5196
|
positionto[$this.origin] = pos[$this.origin];
|
5197
|
pos.ele.css(positionto);
|
5198
|
}.bind(this));
|
5199
|
}
|
5200
|
|
5201
|
// make sure to trigger possible scrollpies etc.
|
5202
|
setTimeout(function() {
|
5203
|
UI.$doc.trigger('scrolling.uk.document');
|
5204
|
}, 2 * this.options.duration * (this.options.animation ? 1:0));
|
5205
|
|
5206
|
this.trigger('afterupdate.uk.grid', [children]);
|
5207
|
},
|
5208
|
|
5209
|
filter: function(filter) {
|
5210
|
|
5211
|
this.currentfilter = filter;
|
5212
|
|
5213
|
filter = filter || [];
|
5214
|
|
5215
|
if (typeof(filter) === 'number') {
|
5216
|
filter = filter.toString();
|
5217
|
}
|
5218
|
|
5219
|
if (typeof(filter) === 'string') {
|
5220
|
filter = filter.split(/,/).map(function(item){ return item.trim(); });
|
5221
|
}
|
5222
|
|
5223
|
var $this = this, children = this.element.children(), elements = {"visible": [], "hidden": []}, visible, hidden;
|
5224
|
|
5225
|
children.each(function(index){
|
5226
|
|
5227
|
var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
|
5228
|
|
5229
|
if (f) {
|
5230
|
|
5231
|
f = f.split(/,/).map(function(item){ return item.trim(); });
|
5232
|
|
5233
|
filter.forEach(function(item){
|
5234
|
if (f.indexOf(item) > -1) infilter = true;
|
5235
|
});
|
5236
|
}
|
5237
|
|
5238
|
elements[infilter ? "visible":"hidden"].push(ele);
|
5239
|
});
|
5240
|
|
5241
|
// convert to jQuery collections
|
5242
|
elements.hidden = UI.$(elements.hidden).map(function () {return this[0];});
|
5243
|
elements.visible = UI.$(elements.visible).map(function () {return this[0];});
|
5244
|
|
5245
|
elements.hidden.attr('aria-hidden', 'true').filter(':visible').fadeOut(this.options.duration);
|
5246
|
elements.visible.attr('aria-hidden', 'false').filter(':hidden').css('opacity', 0).show();
|
5247
|
|
5248
|
$this.update(elements.visible);
|
5249
|
|
5250
|
if (this.controls && this.controls.length) {
|
5251
|
this.controls.find('[data-uk-filter]').removeClass('uk-active').filter('[data-uk-filter="'+filter+'"]').addClass('uk-active');
|
5252
|
}
|
5253
|
},
|
5254
|
|
5255
|
sort: function(by, order){
|
5256
|
|
5257
|
order = order || 1;
|
5258
|
|
5259
|
// covert from string (asc|desc) to number
|
5260
|
if (typeof(order) === 'string') {
|
5261
|
order = order.toLowerCase() == 'desc' ? -1 : 1;
|
5262
|
}
|
5263
|
|
5264
|
var elements = this.element.children();
|
5265
|
|
5266
|
elements.sort(function(a, b){
|
5267
|
|
5268
|
a = UI.$(a);
|
5269
|
b = UI.$(b);
|
5270
|
|
5271
|
return (b.data(by) || '') < (a.data(by) || '') ? order : (order*-1);
|
5272
|
|
5273
|
}).appendTo(this.element);
|
5274
|
|
5275
|
this.update(elements.filter(':visible'));
|
5276
|
|
5277
|
if (this.controls && this.controls.length) {
|
5278
|
this.controls.find('[data-uk-sort]').removeClass('uk-active').filter('[data-uk-sort="'+by+':'+(order == -1 ? 'desc':'asc')+'"]').addClass('uk-active');
|
5279
|
}
|
5280
|
}
|
5281
|
});
|
5282
|
|
5283
|
});
|
5284
|
|
5285
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
5286
|
(function(addon) {
|
5287
|
|
5288
|
var component;
|
5289
|
|
5290
|
if (window.UIkit2) {
|
5291
|
component = addon(UIkit2);
|
5292
|
}
|
5293
|
|
5294
|
if (typeof define == 'function' && define.amd) { // AMD
|
5295
|
define('uikit-lightbox', ['uikit'], function(){
|
5296
|
return component || addon(UIkit2);
|
5297
|
});
|
5298
|
}
|
5299
|
|
5300
|
})(function(UI){
|
5301
|
|
5302
|
"use strict";
|
5303
|
|
5304
|
var modal, cache = {};
|
5305
|
|
5306
|
UI.component('lightbox', {
|
5307
|
|
5308
|
defaults: {
|
5309
|
allowfullscreen : true,
|
5310
|
duration : 400,
|
5311
|
group : false,
|
5312
|
keyboard : true
|
5313
|
},
|
5314
|
|
5315
|
index : 0,
|
5316
|
items : false,
|
5317
|
|
5318
|
boot: function() {
|
5319
|
|
5320
|
UI.$html.on('click', '[data-uk-lightbox]', function(e){
|
5321
|
|
5322
|
e.preventDefault();
|
5323
|
|
5324
|
var link = UI.$(this);
|
5325
|
|
5326
|
if (!link.data('lightbox')) {
|
5327
|
|
5328
|
UI.lightbox(link, UI.Utils.options(link.attr('data-uk-lightbox')));
|
5329
|
}
|
5330
|
|
5331
|
link.data('lightbox').show(link);
|
5332
|
});
|
5333
|
|
5334
|
// keyboard navigation
|
5335
|
UI.$doc.on('keyup', function(e) {
|
5336
|
|
5337
|
if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
|
5338
|
|
5339
|
e.preventDefault();
|
5340
|
|
5341
|
switch(e.keyCode) {
|
5342
|
case 37:
|
5343
|
modal.lightbox.previous();
|
5344
|
break;
|
5345
|
case 39:
|
5346
|
modal.lightbox.next();
|
5347
|
break;
|
5348
|
}
|
5349
|
}
|
5350
|
});
|
5351
|
},
|
5352
|
|
5353
|
init: function() {
|
5354
|
|
5355
|
var siblings = [];
|
5356
|
|
5357
|
this.index = 0;
|
5358
|
this.siblings = [];
|
5359
|
|
5360
|
if (this.element && this.element.length) {
|
5361
|
|
5362
|
var domSiblings = this.options.group ? UI.$('[data-uk-lightbox*="'+this.options.group+'"]') : this.element;
|
5363
|
|
5364
|
domSiblings.each(function() {
|
5365
|
|
5366
|
var ele = UI.$(this);
|
5367
|
|
5368
|
siblings.push({
|
5369
|
source : ele.attr('href'),
|
5370
|
title : ele.attr('data-title') || ele.attr('title'),
|
5371
|
type : ele.attr("data-lightbox-type") || 'auto',
|
5372
|
link : ele
|
5373
|
});
|
5374
|
});
|
5375
|
|
5376
|
this.index = domSiblings.index(this.element);
|
5377
|
this.siblings = siblings;
|
5378
|
|
5379
|
} else if (this.options.group && this.options.group.length) {
|
5380
|
this.siblings = this.options.group;
|
5381
|
}
|
5382
|
|
5383
|
this.trigger('lightbox-init', [this]);
|
5384
|
},
|
5385
|
|
5386
|
show: function(index) {
|
5387
|
|
5388
|
this.modal = getModal(this);
|
5389
|
|
5390
|
// stop previous animation
|
5391
|
this.modal.dialog.stop();
|
5392
|
this.modal.content.stop();
|
5393
|
|
5394
|
var $this = this, promise = UI.$.Deferred(), data, item;
|
5395
|
|
5396
|
index = index || 0;
|
5397
|
|
5398
|
// index is a jQuery object or DOM element
|
5399
|
if (typeof(index) == 'object') {
|
5400
|
|
5401
|
this.siblings.forEach(function(s, idx){
|
5402
|
|
5403
|
if (index[0] === s.link[0]) {
|
5404
|
index = idx;
|
5405
|
}
|
5406
|
});
|
5407
|
}
|
5408
|
|
5409
|
// fix index if needed
|
5410
|
if ( index < 0 ) {
|
5411
|
index = this.siblings.length - index;
|
5412
|
} else if (!this.siblings[index]) {
|
5413
|
index = 0;
|
5414
|
}
|
5415
|
|
5416
|
item = this.siblings[index];
|
5417
|
|
5418
|
data = {
|
5419
|
lightbox : $this,
|
5420
|
source : item.source,
|
5421
|
type : item.type,
|
5422
|
index : index,
|
5423
|
promise : promise,
|
5424
|
title : item.title,
|
5425
|
item : item,
|
5426
|
meta : {
|
5427
|
content : '',
|
5428
|
width : null,
|
5429
|
height : null
|
5430
|
}
|
5431
|
};
|
5432
|
|
5433
|
this.index = index;
|
5434
|
|
5435
|
this.modal.content.empty();
|
5436
|
|
5437
|
if (!this.modal.is(':visible')) {
|
5438
|
this.modal.content.css({width:'', height:''}).empty();
|
5439
|
this.modal.modal.show();
|
5440
|
}
|
5441
|
|
5442
|
this.modal.loader.removeClass('uk-hidden');
|
5443
|
|
5444
|
promise.promise().done(function() {
|
5445
|
|
5446
|
$this.data = data;
|
5447
|
$this.fitSize(data);
|
5448
|
|
5449
|
}).fail(function(){
|
5450
|
|
5451
|
data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
|
5452
|
data.meta.width = 400;
|
5453
|
data.meta.height = 300;
|
5454
|
|
5455
|
$this.data = data;
|
5456
|
$this.fitSize(data);
|
5457
|
});
|
5458
|
|
5459
|
$this.trigger('showitem.uk.lightbox', [data]);
|
5460
|
},
|
5461
|
|
5462
|
fitSize: function() {
|
5463
|
|
5464
|
var $this = this,
|
5465
|
data = this.data,
|
5466
|
pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
|
5467
|
dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
|
5468
|
dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
|
5469
|
dpad = dpadTop + dpadBot,
|
5470
|
content = data.meta.content,
|
5471
|
duration = $this.options.duration;
|
5472
|
|
5473
|
if (this.siblings.length > 1) {
|
5474
|
|
5475
|
content = [
|
5476
|
content,
|
5477
|
'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
|
5478
|
'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
|
5479
|
].join('');
|
5480
|
}
|
5481
|
|
5482
|
// calculate width
|
5483
|
var tmp = UI.$('<div> </div>').css({
|
5484
|
opacity : 0,
|
5485
|
position : 'absolute',
|
5486
|
top : 0,
|
5487
|
left : 0,
|
5488
|
width : '100%',
|
5489
|
maxWidth : $this.modal.dialog.css('max-width'),
|
5490
|
padding : $this.modal.dialog.css('padding'),
|
5491
|
margin : $this.modal.dialog.css('margin')
|
5492
|
}), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
|
5493
|
|
5494
|
tmp.appendTo('body').width();
|
5495
|
|
5496
|
maxwidth = tmp.width();
|
5497
|
maxheight = window.innerHeight - dpad;
|
5498
|
|
5499
|
tmp.remove();
|
5500
|
|
5501
|
this.modal.dialog.find('.uk-modal-caption').remove();
|
5502
|
|
5503
|
if (data.title) {
|
5504
|
this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
|
5505
|
maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
|
5506
|
}
|
5507
|
|
5508
|
if (maxwidth < data.meta.width) {
|
5509
|
|
5510
|
h = Math.floor( h * (maxwidth / w) );
|
5511
|
w = maxwidth;
|
5512
|
}
|
5513
|
|
5514
|
if (maxheight < h) {
|
5515
|
|
5516
|
h = Math.floor(maxheight);
|
5517
|
w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
|
5518
|
}
|
5519
|
|
5520
|
this.modal.content.css('opacity', 0).width(w).html(content);
|
5521
|
|
5522
|
if (data.type == 'iframe') {
|
5523
|
this.modal.content.find('iframe:first').height(h);
|
5524
|
}
|
5525
|
|
5526
|
var dh = h + pad,
|
5527
|
t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
|
5528
|
|
5529
|
if (t < 0) { t = 0; }
|
5530
|
|
5531
|
this.modal.closer.addClass('uk-hidden');
|
5532
|
|
5533
|
if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
|
5534
|
duration = 0;
|
5535
|
}
|
5536
|
|
5537
|
this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
|
5538
|
$this.modal.loader.addClass('uk-hidden');
|
5539
|
$this.modal.content.css({width:''}).animate({opacity: 1}, function() {
|
5540
|
$this.modal.closer.removeClass('uk-hidden');
|
5541
|
});
|
5542
|
|
5543
|
$this.modal.data({mwidth: w, mheight: h});
|
5544
|
});
|
5545
|
},
|
5546
|
|
5547
|
next: function() {
|
5548
|
this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
|
5549
|
},
|
5550
|
|
5551
|
previous: function() {
|
5552
|
this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
|
5553
|
}
|
5554
|
});
|
5555
|
|
5556
|
|
5557
|
// Plugins
|
5558
|
|
5559
|
UI.plugin('lightbox', 'image', {
|
5560
|
|
5561
|
init: function(lightbox) {
|
5562
|
|
5563
|
lightbox.on('showitem.uk.lightbox', function(e, data){
|
5564
|
|
5565
|
if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
|
5566
|
|
5567
|
var resolve = function(source, width, height) {
|
5568
|
|
5569
|
data.meta = {
|
5570
|
content : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
|
5571
|
width : width,
|
5572
|
height : height
|
5573
|
};
|
5574
|
|
5575
|
data.type = 'image';
|
5576
|
|
5577
|
data.promise.resolve();
|
5578
|
};
|
5579
|
|
5580
|
if (!cache[data.source]) {
|
5581
|
|
5582
|
var img = new Image();
|
5583
|
|
5584
|
img.onerror = function(){
|
5585
|
data.promise.reject('Loading image failed');
|
5586
|
};
|
5587
|
|
5588
|
img.onload = function(){
|
5589
|
cache[data.source] = {width: img.width, height: img.height};
|
5590
|
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
5591
|
};
|
5592
|
|
5593
|
img.src = data.source;
|
5594
|
|
5595
|
} else {
|
5596
|
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
5597
|
}
|
5598
|
}
|
5599
|
});
|
5600
|
}
|
5601
|
});
|
5602
|
|
5603
|
UI.plugin('lightbox', 'youtube', {
|
5604
|
|
5605
|
init: function(lightbox) {
|
5606
|
|
5607
|
var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
|
5608
|
youtubeRegExpShort = /youtu\.be\/(.*)/;
|
5609
|
|
5610
|
|
5611
|
lightbox.on('showitem.uk.lightbox', function(e, data){
|
5612
|
|
5613
|
var id, matches, resolve = function(id, width, height) {
|
5614
|
|
5615
|
data.meta = {
|
5616
|
content: '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
5617
|
width: width,
|
5618
|
height: height
|
5619
|
};
|
5620
|
|
5621
|
data.type = 'iframe';
|
5622
|
|
5623
|
data.promise.resolve();
|
5624
|
};
|
5625
|
|
5626
|
if (matches = data.source.match(youtubeRegExp)) {
|
5627
|
id = matches[2];
|
5628
|
}
|
5629
|
|
5630
|
if (matches = data.source.match(youtubeRegExpShort)) {
|
5631
|
id = matches[1];
|
5632
|
}
|
5633
|
|
5634
|
if (id) {
|
5635
|
|
5636
|
if(!cache[id]) {
|
5637
|
|
5638
|
var img = new Image(), lowres = false;
|
5639
|
|
5640
|
img.onerror = function(){
|
5641
|
cache[id] = {width:640, height:320};
|
5642
|
resolve(id, cache[id].width, cache[id].height);
|
5643
|
};
|
5644
|
|
5645
|
img.onload = function(){
|
5646
|
//youtube default 404 thumb, fall back to lowres
|
5647
|
if (img.width == 120 && img.height == 90) {
|
5648
|
if (!lowres) {
|
5649
|
lowres = true;
|
5650
|
img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
|
5651
|
} else {
|
5652
|
cache[id] = {width: 640, height: 320};
|
5653
|
resolve(id, cache[id].width, cache[id].height);
|
5654
|
}
|
5655
|
} else {
|
5656
|
cache[id] = {width: img.width, height: img.height};
|
5657
|
resolve(id, img.width, img.height);
|
5658
|
}
|
5659
|
};
|
5660
|
|
5661
|
img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
|
5662
|
|
5663
|
} else {
|
5664
|
resolve(id, cache[id].width, cache[id].height);
|
5665
|
}
|
5666
|
|
5667
|
e.stopImmediatePropagation();
|
5668
|
}
|
5669
|
});
|
5670
|
}
|
5671
|
});
|
5672
|
|
5673
|
|
5674
|
UI.plugin('lightbox', 'vimeo', {
|
5675
|
|
5676
|
init: function(lightbox) {
|
5677
|
|
5678
|
var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
|
5679
|
|
5680
|
|
5681
|
lightbox.on('showitem.uk.lightbox', function(e, data){
|
5682
|
|
5683
|
var id, resolve = function(id, width, height) {
|
5684
|
|
5685
|
data.meta = {
|
5686
|
content: '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
5687
|
width: width,
|
5688
|
height: height
|
5689
|
};
|
5690
|
|
5691
|
data.type = 'iframe';
|
5692
|
|
5693
|
data.promise.resolve();
|
5694
|
};
|
5695
|
|
5696
|
if (matches = data.source.match(regex)) {
|
5697
|
|
5698
|
id = matches[2];
|
5699
|
|
5700
|
if(!cache[id]) {
|
5701
|
|
5702
|
UI.$.ajax({
|
5703
|
type : 'GET',
|
5704
|
url : '//vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
|
5705
|
jsonp : 'callback',
|
5706
|
dataType : 'jsonp',
|
5707
|
success : function(data) {
|
5708
|
cache[id] = {width:data.width, height:data.height};
|
5709
|
resolve(id, cache[id].width, cache[id].height);
|
5710
|
}
|
5711
|
});
|
5712
|
|
5713
|
} else {
|
5714
|
resolve(id, cache[id].width, cache[id].height);
|
5715
|
}
|
5716
|
|
5717
|
e.stopImmediatePropagation();
|
5718
|
}
|
5719
|
});
|
5720
|
}
|
5721
|
});
|
5722
|
|
5723
|
UI.plugin('lightbox', 'video', {
|
5724
|
|
5725
|
init: function(lightbox) {
|
5726
|
|
5727
|
lightbox.on('showitem.uk.lightbox', function(e, data){
|
5728
|
|
5729
|
|
5730
|
var resolve = function(source, width, height) {
|
5731
|
|
5732
|
data.meta = {
|
5733
|
content: '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
|
5734
|
width: width,
|
5735
|
height: height
|
5736
|
};
|
5737
|
|
5738
|
data.type = 'video';
|
5739
|
|
5740
|
data.promise.resolve();
|
5741
|
};
|
5742
|
|
5743
|
if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
|
5744
|
|
5745
|
if (!cache[data.source]) {
|
5746
|
|
5747
|
var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
|
5748
|
|
5749
|
var idle = setInterval(function() {
|
5750
|
|
5751
|
if (vid[0].videoWidth) {
|
5752
|
clearInterval(idle);
|
5753
|
cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
|
5754
|
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
5755
|
vid.remove();
|
5756
|
}
|
5757
|
|
5758
|
}, 20);
|
5759
|
|
5760
|
} else {
|
5761
|
resolve(data.source, cache[data.source].width, cache[data.source].height);
|
5762
|
}
|
5763
|
}
|
5764
|
});
|
5765
|
}
|
5766
|
});
|
5767
|
|
5768
|
|
5769
|
UI.plugin('lightbox', 'iframe', {
|
5770
|
|
5771
|
init: function (lightbox) {
|
5772
|
|
5773
|
lightbox.on('showitem.uk.lightbox', function (e, data) {
|
5774
|
|
5775
|
var resolve = function (source, width, height) {
|
5776
|
|
5777
|
data.meta = {
|
5778
|
content: '<iframe class="uk-responsive-width" src="' + source + '" width="' + width + '" height="' + height + '"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
|
5779
|
width: width,
|
5780
|
height: height
|
5781
|
};
|
5782
|
|
5783
|
data.type = 'iframe';
|
5784
|
|
5785
|
data.promise.resolve();
|
5786
|
};
|
5787
|
|
5788
|
if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) {
|
5789
|
resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600));
|
5790
|
}
|
5791
|
});
|
5792
|
|
5793
|
}
|
5794
|
});
|
5795
|
|
5796
|
function getModal(lightbox) {
|
5797
|
|
5798
|
if (modal) {
|
5799
|
modal.lightbox = lightbox;
|
5800
|
return modal;
|
5801
|
}
|
5802
|
|
5803
|
// init lightbox container
|
5804
|
modal = UI.$([
|
5805
|
'<div class="uk-modal">',
|
5806
|
'<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2 - 200)+'px;">',
|
5807
|
'<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>',
|
5808
|
'<div class="uk-lightbox-content"></div>',
|
5809
|
'<div class="uk-modal-spinner uk-hidden"></div>',
|
5810
|
'</div>',
|
5811
|
'</div>'
|
5812
|
].join('')).appendTo('body');
|
5813
|
|
5814
|
modal.dialog = modal.find('.uk-modal-dialog:first');
|
5815
|
modal.content = modal.find('.uk-lightbox-content:first');
|
5816
|
modal.loader = modal.find('.uk-modal-spinner:first');
|
5817
|
modal.closer = modal.find('.uk-close.uk-close-alt');
|
5818
|
modal.modal = UI.modal(modal, {modal:false});
|
5819
|
|
5820
|
// next / previous
|
5821
|
modal.on('swipeRight swipeLeft', function(e) {
|
5822
|
modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
|
5823
|
}).on('click', '[data-lightbox-previous], [data-lightbox-next]', function(e){
|
5824
|
e.preventDefault();
|
5825
|
modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
|
5826
|
});
|
5827
|
|
5828
|
// destroy content on modal hide
|
5829
|
modal.on('hide.uk.modal', function(e) {
|
5830
|
modal.content.html('');
|
5831
|
});
|
5832
|
|
5833
|
var resizeCache = {w: window.innerWidth, h:window.innerHeight};
|
5834
|
|
5835
|
UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
|
5836
|
|
5837
|
if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) {
|
5838
|
modal.lightbox.fitSize();
|
5839
|
}
|
5840
|
|
5841
|
resizeCache = {w: window.innerWidth, h:window.innerHeight};
|
5842
|
|
5843
|
}, 100));
|
5844
|
|
5845
|
modal.lightbox = lightbox;
|
5846
|
|
5847
|
return modal;
|
5848
|
}
|
5849
|
|
5850
|
UI.lightbox.create = function(items, options) {
|
5851
|
|
5852
|
if (!items) return;
|
5853
|
|
5854
|
var group = [], o;
|
5855
|
|
5856
|
items.forEach(function(item) {
|
5857
|
|
5858
|
group.push(UI.$.extend({
|
5859
|
source : '',
|
5860
|
title : '',
|
5861
|
type : 'auto',
|
5862
|
link : false
|
5863
|
}, (typeof(item) == 'string' ? {'source': item} : item)));
|
5864
|
});
|
5865
|
|
5866
|
o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
|
5867
|
|
5868
|
return o;
|
5869
|
};
|
5870
|
|
5871
|
return UI.lightbox;
|
5872
|
});
|
5873
|
|
5874
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
5875
|
/*
|
5876
|
* Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
5877
|
*/
|
5878
|
(function(addon) {
|
5879
|
|
5880
|
var component;
|
5881
|
|
5882
|
if (window.UIkit2) {
|
5883
|
component = addon(UIkit2);
|
5884
|
}
|
5885
|
|
5886
|
if (typeof define == 'function' && define.amd) {
|
5887
|
define('uikit-nestable', ['uikit'], function(){
|
5888
|
return component || addon(UIkit2);
|
5889
|
});
|
5890
|
}
|
5891
|
|
5892
|
})(function(UI) {
|
5893
|
|
5894
|
"use strict";
|
5895
|
|
5896
|
var hasTouch = 'ontouchstart' in window || 'MSGesture' in window || window.PointerEvent,
|
5897
|
html = UI.$html,
|
5898
|
touchedlists = [],
|
5899
|
$win = UI.$win,
|
5900
|
draggingElement;
|
5901
|
|
5902
|
var eStart = hasTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointerdown':'touchstart') : 'mousedown',
|
5903
|
eMove = hasTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointermove':'touchmove') : 'mousemove',
|
5904
|
eEnd = hasTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointerup':'touchend') : 'mouseup',
|
5905
|
eCancel = hasTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointercancel':'touchcancel') : 'mouseup';
|
5906
|
|
5907
|
|
5908
|
UI.component('nestable', {
|
5909
|
|
5910
|
defaults: {
|
5911
|
listBaseClass : 'uk-nestable',
|
5912
|
listClass : 'uk-nestable-list',
|
5913
|
listItemClass : 'uk-nestable-item',
|
5914
|
dragClass : 'uk-nestable-dragged',
|
5915
|
movingClass : 'uk-nestable-moving',
|
5916
|
noChildrenClass : 'uk-nestable-nochildren',
|
5917
|
emptyClass : 'uk-nestable-empty',
|
5918
|
handleClass : '',
|
5919
|
collapsedClass : 'uk-collapsed',
|
5920
|
placeholderClass: 'uk-nestable-placeholder',
|
5921
|
noDragClass : 'uk-nestable-nodrag',
|
5922
|
group : false,
|
5923
|
maxDepth : 10,
|
5924
|
threshold : 20,
|
5925
|
idlethreshold : 10,
|
5926
|
},
|
5927
|
|
5928
|
boot: function() {
|
5929
|
|
5930
|
// adjust document scrolling
|
5931
|
UI.$html.on('mousemove touchmove', function(e) {
|
5932
|
|
5933
|
if (draggingElement) {
|
5934
|
|
5935
|
var top = draggingElement.offset().top;
|
5936
|
|
5937
|
if (top < UI.$win.scrollTop()) {
|
5938
|
UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
|
5939
|
} else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
|
5940
|
UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
|
5941
|
}
|
5942
|
}
|
5943
|
});
|
5944
|
|
5945
|
// init code
|
5946
|
UI.ready(function(context) {
|
5947
|
|
5948
|
UI.$("[data-uk-nestable]", context).each(function(){
|
5949
|
|
5950
|
var ele = UI.$(this);
|
5951
|
|
5952
|
if (!ele.data("nestable")) {
|
5953
|
UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
|
5954
|
}
|
5955
|
});
|
5956
|
});
|
5957
|
},
|
5958
|
|
5959
|
init: function() {
|
5960
|
|
5961
|
var $this = this;
|
5962
|
|
5963
|
Object.keys(this.options).forEach(function(key){
|
5964
|
|
5965
|
if(String(key).indexOf('Class')!=-1) {
|
5966
|
$this.options['_'+key] = '.' + $this.options[key];
|
5967
|
}
|
5968
|
});
|
5969
|
|
5970
|
this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass);
|
5971
|
|
5972
|
this.checkEmptyList();
|
5973
|
|
5974
|
this.reset();
|
5975
|
this.element.data('nestable-group', this.options.group || UI.Utils.uid('nestable-group'));
|
5976
|
|
5977
|
this.find(this.options._listItemClass).each(function() {
|
5978
|
$this.setParent(UI.$(this));
|
5979
|
});
|
5980
|
|
5981
|
this.on('click', '[data-nestable-action]', function(e) {
|
5982
|
|
5983
|
if ($this.dragEl || (!hasTouch && e.button !== 0)) {
|
5984
|
return;
|
5985
|
}
|
5986
|
|
5987
|
e.preventDefault();
|
5988
|
|
5989
|
var target = UI.$(e.currentTarget),
|
5990
|
action = target.data('nestableAction'),
|
5991
|
item = target.closest($this.options._listItemClass);
|
5992
|
|
5993
|
if (action === 'collapse') {
|
5994
|
$this.collapseItem(item);
|
5995
|
}
|
5996
|
if (action === 'expand') {
|
5997
|
$this.expandItem(item);
|
5998
|
}
|
5999
|
if (action === 'toggle') {
|
6000
|
$this.toggleItem(item);
|
6001
|
}
|
6002
|
});
|
6003
|
|
6004
|
var onStartEvent = function(e) {
|
6005
|
|
6006
|
var handle = UI.$(e.target),
|
6007
|
link = handle.is('a[href]') ? handle:handle.parents('a[href]');
|
6008
|
|
6009
|
if (e.target === $this.element[0]) {
|
6010
|
return;
|
6011
|
}
|
6012
|
|
6013
|
if (handle.is($this.options._noDragClass) || handle.closest($this.options._noDragClass).length) {
|
6014
|
return;
|
6015
|
}
|
6016
|
|
6017
|
if (handle.is('[data-nestable-action]') || handle.closest('[data-nestable-action]').length) {
|
6018
|
return;
|
6019
|
}
|
6020
|
|
6021
|
if ($this.options.handleClass && !handle.hasClass($this.options.handleClass)) {
|
6022
|
|
6023
|
if ($this.options.handleClass) {
|
6024
|
handle = handle.closest($this.options._handleClass);
|
6025
|
}
|
6026
|
}
|
6027
|
|
6028
|
if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches && e.touches.length !== 1)) {
|
6029
|
return;
|
6030
|
}
|
6031
|
|
6032
|
if (e.originalEvent && e.originalEvent.touches) {
|
6033
|
e = evt.originalEvent.touches[0];
|
6034
|
}
|
6035
|
|
6036
|
$this.delayMove = function(evt) {
|
6037
|
|
6038
|
link = false;
|
6039
|
|
6040
|
evt.preventDefault();
|
6041
|
$this.dragStart(e);
|
6042
|
$this.trigger('start.uk.nestable', [$this]);
|
6043
|
|
6044
|
$this.delayMove = false;
|
6045
|
};
|
6046
|
|
6047
|
$this.delayMove.x = parseInt(e.pageX, 10);
|
6048
|
$this.delayMove.y = parseInt(e.pageY, 10);
|
6049
|
$this.delayMove.threshold = $this.options.idlethreshold;
|
6050
|
|
6051
|
if (link.length && eEnd == 'touchend') {
|
6052
|
|
6053
|
$this.one(eEnd, function(){
|
6054
|
if (link && link.attr('href').trim()) {
|
6055
|
location.href = link.attr('href');
|
6056
|
}
|
6057
|
});
|
6058
|
}
|
6059
|
|
6060
|
e.preventDefault();
|
6061
|
};
|
6062
|
|
6063
|
var onMoveEvent = function(e) {
|
6064
|
|
6065
|
if (e.originalEvent && e.originalEvent.touches) {
|
6066
|
e = e.originalEvent.touches[0];
|
6067
|
}
|
6068
|
|
6069
|
if ($this.delayMove && (Math.abs(e.pageX - $this.delayMove.x) > $this.delayMove.threshold || Math.abs(e.pageY - $this.delayMove.y) > $this.delayMove.threshold)) {
|
6070
|
|
6071
|
if (!window.getSelection().toString()) {
|
6072
|
$this.delayMove(e);
|
6073
|
} else {
|
6074
|
$this.delayMove = false;
|
6075
|
}
|
6076
|
}
|
6077
|
|
6078
|
if ($this.dragEl) {
|
6079
|
e.preventDefault();
|
6080
|
$this.dragMove(e);
|
6081
|
$this.trigger('move.uk.nestable', [$this]);
|
6082
|
}
|
6083
|
};
|
6084
|
|
6085
|
var onEndEvent = function(e) {
|
6086
|
|
6087
|
if ($this.dragEl) {
|
6088
|
e.preventDefault();
|
6089
|
$this.dragStop(hasTouch && e.touches ? e.touches[0] : e);
|
6090
|
}
|
6091
|
|
6092
|
draggingElement = false;
|
6093
|
$this.delayMove = false;
|
6094
|
};
|
6095
|
|
6096
|
if (hasTouch) {
|
6097
|
this.element[0].addEventListener(eStart, onStartEvent, false);
|
6098
|
window.addEventListener(eMove, onMoveEvent, false);
|
6099
|
window.addEventListener(eEnd, onEndEvent, false);
|
6100
|
window.addEventListener(eCancel, onEndEvent, false);
|
6101
|
} else {
|
6102
|
this.on(eStart, onStartEvent);
|
6103
|
$win.on(eMove, onMoveEvent);
|
6104
|
$win.on(eEnd, onEndEvent);
|
6105
|
}
|
6106
|
|
6107
|
},
|
6108
|
|
6109
|
serialize: function() {
|
6110
|
|
6111
|
var data,
|
6112
|
depth = 0,
|
6113
|
list = this,
|
6114
|
step = function(level, depth) {
|
6115
|
|
6116
|
var array = [ ], items = level.children(list.options._listItemClass);
|
6117
|
|
6118
|
items.each(function() {
|
6119
|
|
6120
|
var li = UI.$(this),
|
6121
|
item = {}, attribute,
|
6122
|
sub = li.children(list.options._listClass);
|
6123
|
|
6124
|
for (var i = 0, attr, val; i < li[0].attributes.length; i++) {
|
6125
|
attribute = li[0].attributes[i];
|
6126
|
if (attribute.name.indexOf('data-') === 0) {
|
6127
|
attr = attribute.name.substr(5);
|
6128
|
val = UI.Utils.str2json(attribute.value);
|
6129
|
item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
|
6130
|
}
|
6131
|
}
|
6132
|
|
6133
|
if (sub.length) {
|
6134
|
item.children = step(sub, depth + 1);
|
6135
|
}
|
6136
|
|
6137
|
array.push(item);
|
6138
|
|
6139
|
});
|
6140
|
return array;
|
6141
|
};
|
6142
|
|
6143
|
data = step(list.element, depth);
|
6144
|
|
6145
|
return data;
|
6146
|
},
|
6147
|
|
6148
|
list: function(options) {
|
6149
|
|
6150
|
var data = [],
|
6151
|
list = this,
|
6152
|
depth = 0,
|
6153
|
step = function(level, depth, parent) {
|
6154
|
|
6155
|
var items = level.children(options._listItemClass);
|
6156
|
|
6157
|
items.each(function(index) {
|
6158
|
var li = UI.$(this),
|
6159
|
item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
|
6160
|
sub = li.children(options._listClass);
|
6161
|
|
6162
|
data.push(item);
|
6163
|
|
6164
|
if (sub.length) {
|
6165
|
step(sub, depth + 1, li.data(options.idProperty || 'id'));
|
6166
|
}
|
6167
|
});
|
6168
|
};
|
6169
|
|
6170
|
options = UI.$.extend({}, list.options, options);
|
6171
|
|
6172
|
step(list.element, depth);
|
6173
|
|
6174
|
return data;
|
6175
|
},
|
6176
|
|
6177
|
reset: function() {
|
6178
|
|
6179
|
this.mouse = {
|
6180
|
offsetX : 0,
|
6181
|
offsetY : 0,
|
6182
|
startX : 0,
|
6183
|
startY : 0,
|
6184
|
lastX : 0,
|
6185
|
lastY : 0,
|
6186
|
nowX : 0,
|
6187
|
nowY : 0,
|
6188
|
distX : 0,
|
6189
|
distY : 0,
|
6190
|
dirAx : 0,
|
6191
|
dirX : 0,
|
6192
|
dirY : 0,
|
6193
|
lastDirX : 0,
|
6194
|
lastDirY : 0,
|
6195
|
distAxX : 0,
|
6196
|
distAxY : 0
|
6197
|
};
|
6198
|
this.moving = false;
|
6199
|
this.dragEl = null;
|
6200
|
this.dragRootEl = null;
|
6201
|
this.dragDepth = 0;
|
6202
|
this.hasNewRoot = false;
|
6203
|
this.pointEl = null;
|
6204
|
|
6205
|
for (var i=0; i<touchedlists.length; i++) {
|
6206
|
this.checkEmptyList(touchedlists[i]);
|
6207
|
}
|
6208
|
|
6209
|
touchedlists = [];
|
6210
|
},
|
6211
|
|
6212
|
toggleItem: function(li) {
|
6213
|
this[li.hasClass(this.options.collapsedClass) ? 'expandItem':'collapseItem'](li);
|
6214
|
},
|
6215
|
|
6216
|
expandItem: function(li) {
|
6217
|
li.removeClass(this.options.collapsedClass);
|
6218
|
},
|
6219
|
|
6220
|
collapseItem: function(li) {
|
6221
|
var lists = li.children(this.options._listClass);
|
6222
|
if (lists.length) {
|
6223
|
li.addClass(this.options.collapsedClass);
|
6224
|
}
|
6225
|
},
|
6226
|
|
6227
|
expandAll: function() {
|
6228
|
var list = this;
|
6229
|
this.find(list.options._listItemClass).each(function() {
|
6230
|
list.expandItem(UI.$(this));
|
6231
|
});
|
6232
|
},
|
6233
|
|
6234
|
collapseAll: function() {
|
6235
|
var list = this;
|
6236
|
this.find(list.options._listItemClass).each(function() {
|
6237
|
list.collapseItem(UI.$(this));
|
6238
|
});
|
6239
|
},
|
6240
|
|
6241
|
setParent: function(li) {
|
6242
|
|
6243
|
if (li.children(this.options._listClass).length) {
|
6244
|
li.addClass('uk-parent');
|
6245
|
}
|
6246
|
},
|
6247
|
|
6248
|
unsetParent: function(li) {
|
6249
|
li.removeClass('uk-parent '+this.options.collapsedClass);
|
6250
|
li.children(this.options._listClass).remove();
|
6251
|
},
|
6252
|
|
6253
|
dragStart: function(e) {
|
6254
|
|
6255
|
var mouse = this.mouse,
|
6256
|
target = UI.$(e.target),
|
6257
|
dragItem = target.closest(this.options._listItemClass),
|
6258
|
offset = dragItem.offset();
|
6259
|
|
6260
|
this.placeEl = dragItem;
|
6261
|
|
6262
|
mouse.offsetX = e.pageX - offset.left;
|
6263
|
mouse.offsetY = e.pageY - offset.top;
|
6264
|
|
6265
|
mouse.startX = mouse.lastX = offset.left;
|
6266
|
mouse.startY = mouse.lastY = offset.top;
|
6267
|
|
6268
|
this.dragRootEl = this.element;
|
6269
|
|
6270
|
this.dragEl = UI.$('<ul></ul>').addClass(this.options.listClass + ' ' + this.options.dragClass).append(dragItem.clone());
|
6271
|
this.dragEl.css('width', dragItem.width());
|
6272
|
this.placeEl.addClass(this.options.placeholderClass);
|
6273
|
|
6274
|
draggingElement = this.dragEl;
|
6275
|
|
6276
|
this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
|
6277
|
|
6278
|
UI.$body.append(this.dragEl);
|
6279
|
|
6280
|
this.dragEl.css({
|
6281
|
left : offset.left,
|
6282
|
top : offset.top
|
6283
|
});
|
6284
|
|
6285
|
// total depth of dragging item
|
6286
|
var i, depth, items = this.dragEl.find(this.options._listItemClass);
|
6287
|
|
6288
|
for (i = 0; i < items.length; i++) {
|
6289
|
depth = UI.$(items[i]).parents(this.options._listClass+','+this.options._listBaseClass).length;
|
6290
|
if (depth > this.dragDepth) {
|
6291
|
this.dragDepth = depth;
|
6292
|
}
|
6293
|
}
|
6294
|
|
6295
|
html.addClass(this.options.movingClass);
|
6296
|
},
|
6297
|
|
6298
|
dragStop: function(e) {
|
6299
|
|
6300
|
var el = UI.$(this.placeEl),
|
6301
|
root = this.placeEl.parents(this.options._listBaseClass+':first');
|
6302
|
|
6303
|
this.placeEl.removeClass(this.options.placeholderClass);
|
6304
|
this.dragEl.remove();
|
6305
|
|
6306
|
if (this.element[0] !== root[0]) {
|
6307
|
|
6308
|
root.trigger('change.uk.nestable',[root.data('nestable'), el, 'added']);
|
6309
|
this.element.trigger('change.uk.nestable', [this, el, 'removed']);
|
6310
|
|
6311
|
} else {
|
6312
|
this.element.trigger('change.uk.nestable',[this, el, "moved"]);
|
6313
|
}
|
6314
|
|
6315
|
this.trigger('stop.uk.nestable', [this, el]);
|
6316
|
|
6317
|
this.reset();
|
6318
|
|
6319
|
html.removeClass(this.options.movingClass);
|
6320
|
},
|
6321
|
|
6322
|
dragMove: function(e) {
|
6323
|
var list, parent, prev, next, depth,
|
6324
|
opt = this.options,
|
6325
|
mouse = this.mouse,
|
6326
|
maxDepth = this.dragRootEl ? this.dragRootEl.data('nestable').options.maxDepth : opt.maxDepth;
|
6327
|
|
6328
|
this.dragEl.css({
|
6329
|
left : e.pageX - mouse.offsetX,
|
6330
|
top : e.pageY - mouse.offsetY
|
6331
|
});
|
6332
|
|
6333
|
// mouse position last events
|
6334
|
mouse.lastX = mouse.nowX;
|
6335
|
mouse.lastY = mouse.nowY;
|
6336
|
// mouse position this events
|
6337
|
mouse.nowX = e.pageX;
|
6338
|
mouse.nowY = e.pageY;
|
6339
|
// distance mouse moved between events
|
6340
|
mouse.distX = mouse.nowX - mouse.lastX;
|
6341
|
mouse.distY = mouse.nowY - mouse.lastY;
|
6342
|
// direction mouse was moving
|
6343
|
mouse.lastDirX = mouse.dirX;
|
6344
|
mouse.lastDirY = mouse.dirY;
|
6345
|
// direction mouse is now moving (on both axis)
|
6346
|
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
|
6347
|
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
|
6348
|
// axis mouse is now moving on
|
6349
|
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
|
6350
|
|
6351
|
// do nothing on first move
|
6352
|
if (!mouse.moving) {
|
6353
|
mouse.dirAx = newAx;
|
6354
|
mouse.moving = true;
|
6355
|
return;
|
6356
|
}
|
6357
|
|
6358
|
// calc distance moved on this axis (and direction)
|
6359
|
if (mouse.dirAx !== newAx) {
|
6360
|
mouse.distAxX = 0;
|
6361
|
mouse.distAxY = 0;
|
6362
|
} else {
|
6363
|
mouse.distAxX += Math.abs(mouse.distX);
|
6364
|
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
|
6365
|
mouse.distAxX = 0;
|
6366
|
}
|
6367
|
mouse.distAxY += Math.abs(mouse.distY);
|
6368
|
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
|
6369
|
mouse.distAxY = 0;
|
6370
|
}
|
6371
|
}
|
6372
|
mouse.dirAx = newAx;
|
6373
|
|
6374
|
/**
|
6375
|
* move horizontal
|
6376
|
*/
|
6377
|
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
|
6378
|
// reset move distance on x-axis for new phase
|
6379
|
mouse.distAxX = 0;
|
6380
|
prev = this.placeEl.prev('li');
|
6381
|
|
6382
|
// increase horizontal level if previous sibling exists, is not collapsed, and does not have a 'no children' class
|
6383
|
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
|
6384
|
|
6385
|
// cannot increase level when item above is collapsed
|
6386
|
list = prev.find(opt._listClass).last();
|
6387
|
|
6388
|
// check if depth limit has reached
|
6389
|
depth = this.placeEl.parents(opt._listClass+','+opt._listBaseClass).length;
|
6390
|
|
6391
|
if (depth + this.dragDepth <= maxDepth) {
|
6392
|
|
6393
|
// create new sub-level if one doesn't exist
|
6394
|
if (!list.length) {
|
6395
|
list = UI.$('<ul/>').addClass(opt.listClass);
|
6396
|
list.append(this.placeEl);
|
6397
|
prev.append(list);
|
6398
|
this.setParent(prev);
|
6399
|
} else {
|
6400
|
// else append to next level up
|
6401
|
list = prev.children(opt._listClass).last();
|
6402
|
list.append(this.placeEl);
|
6403
|
}
|
6404
|
}
|
6405
|
}
|
6406
|
|
6407
|
// decrease horizontal level
|
6408
|
if (mouse.distX < 0) {
|
6409
|
|
6410
|
// we cannot decrease the level if an item precedes the current one
|
6411
|
next = this.placeEl.next(opt._listItemClass);
|
6412
|
if (!next.length) {
|
6413
|
|
6414
|
// get parent ul of the list item
|
6415
|
var parentUl = this.placeEl.closest([opt._listBaseClass, opt._listClass].join(','));
|
6416
|
// try to get the li surrounding the ul
|
6417
|
var surroundingLi = parentUl.closest(opt._listItemClass);
|
6418
|
|
6419
|
// if the ul is inside of a li (meaning it is nested)
|
6420
|
if (surroundingLi.length) {
|
6421
|
// we can decrease the horizontal level
|
6422
|
surroundingLi.after(this.placeEl);
|
6423
|
// if the previous parent ul is now empty
|
6424
|
if (!parentUl.children().length) {
|
6425
|
this.unsetParent(surroundingLi);
|
6426
|
}
|
6427
|
}
|
6428
|
}
|
6429
|
}
|
6430
|
}
|
6431
|
|
6432
|
var isEmpty = false;
|
6433
|
|
6434
|
// find list item under cursor
|
6435
|
var pointX = e.pageX - (window.pageXOffset || document.scrollLeft || 0),
|
6436
|
pointY = e.pageY - (window.pageYOffset || document.documentElement.scrollTop);
|
6437
|
this.pointEl = UI.$(document.elementFromPoint(pointX, pointY));
|
6438
|
|
6439
|
if (opt.handleClass && this.pointEl.hasClass(opt.handleClass)) {
|
6440
|
|
6441
|
this.pointEl = this.pointEl.closest(opt._listItemClass);
|
6442
|
|
6443
|
} else {
|
6444
|
|
6445
|
var nestableitem = this.pointEl.closest(opt._listItemClass);
|
6446
|
|
6447
|
if (nestableitem.length) {
|
6448
|
this.pointEl = nestableitem;
|
6449
|
}
|
6450
|
}
|
6451
|
|
6452
|
if (this.placeEl.find(this.pointEl).length) {
|
6453
|
return;
|
6454
|
}
|
6455
|
|
6456
|
if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
|
6457
|
isEmpty = true;
|
6458
|
this.checkEmptyList(this.pointEl);
|
6459
|
} else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listItemClass)) {
|
6460
|
return;
|
6461
|
}
|
6462
|
|
6463
|
// find parent list of item under cursor
|
6464
|
var pointElRoot = this.element,
|
6465
|
tmpRoot = this.pointEl.closest(this.options._listBaseClass),
|
6466
|
isNewRoot = pointElRoot[0] != tmpRoot[0];
|
6467
|
|
6468
|
/**
|
6469
|
* move vertical
|
6470
|
*/
|
6471
|
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
6472
|
|
6473
|
// check if groups match if dragging over new root
|
6474
|
if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
|
6475
|
return;
|
6476
|
} else {
|
6477
|
touchedlists.push(pointElRoot);
|
6478
|
}
|
6479
|
|
6480
|
// check depth limit
|
6481
|
depth = this.dragDepth - 1 + this.pointEl.parents(opt._listClass+','+opt._listBaseClass).length;
|
6482
|
|
6483
|
if (depth > maxDepth) {
|
6484
|
return;
|
6485
|
}
|
6486
|
|
6487
|
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
|
6488
|
|
6489
|
parent = this.placeEl.parent();
|
6490
|
|
6491
|
if (isEmpty) {
|
6492
|
this.pointEl.append(this.placeEl);
|
6493
|
} else if (before) {
|
6494
|
this.pointEl.before(this.placeEl);
|
6495
|
} else {
|
6496
|
this.pointEl.after(this.placeEl);
|
6497
|
}
|
6498
|
|
6499
|
if (!parent.children().length) {
|
6500
|
if (!parent.data('nestable')) this.unsetParent(parent.parent());
|
6501
|
}
|
6502
|
|
6503
|
this.checkEmptyList(this.dragRootEl);
|
6504
|
this.checkEmptyList(pointElRoot);
|
6505
|
|
6506
|
// parent root list has changed
|
6507
|
if (isNewRoot) {
|
6508
|
this.dragRootEl = tmpRoot;
|
6509
|
this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
|
6510
|
}
|
6511
|
}
|
6512
|
},
|
6513
|
|
6514
|
checkEmptyList: function(list) {
|
6515
|
|
6516
|
list = list ? UI.$(list) : this.element;
|
6517
|
|
6518
|
if (this.options.emptyClass) {
|
6519
|
list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
|
6520
|
}
|
6521
|
}
|
6522
|
|
6523
|
});
|
6524
|
|
6525
|
return UI.nestable;
|
6526
|
});
|
6527
|
|
6528
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
6529
|
(function(addon) {
|
6530
|
|
6531
|
var component;
|
6532
|
|
6533
|
if (window.UIkit2) {
|
6534
|
component = addon(UIkit2);
|
6535
|
}
|
6536
|
|
6537
|
if (typeof define == 'function' && define.amd) {
|
6538
|
define('uikit-notify', ['uikit'], function(){
|
6539
|
return component || addon(UIkit2);
|
6540
|
});
|
6541
|
}
|
6542
|
|
6543
|
})(function(UI){
|
6544
|
|
6545
|
"use strict";
|
6546
|
|
6547
|
var containers = {},
|
6548
|
messages = {},
|
6549
|
|
6550
|
notify = function(options){
|
6551
|
|
6552
|
if (UI.$.type(options) == 'string') {
|
6553
|
options = { message: options };
|
6554
|
}
|
6555
|
|
6556
|
if (arguments[1]) {
|
6557
|
options = UI.$.extend(options, UI.$.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
|
6558
|
}
|
6559
|
|
6560
|
return (new Message(options)).show();
|
6561
|
},
|
6562
|
closeAll = function(group, instantly){
|
6563
|
|
6564
|
var id;
|
6565
|
|
6566
|
if (group) {
|
6567
|
for(id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
|
6568
|
} else {
|
6569
|
for(id in messages) { messages[id].close(instantly); }
|
6570
|
}
|
6571
|
};
|
6572
|
|
6573
|
var Message = function(options){
|
6574
|
|
6575
|
this.options = UI.$.extend({}, Message.defaults, options);
|
6576
|
|
6577
|
this.uuid = UI.Utils.uid('notifymsg');
|
6578
|
this.element = UI.$([
|
6579
|
|
6580
|
'<div class="uk-notify-message">',
|
6581
|
'<a class="uk-close"></a>',
|
6582
|
'<div></div>',
|
6583
|
'</div>'
|
6584
|
|
6585
|
].join('')).data("notifyMessage", this);
|
6586
|
|
6587
|
this.content(this.options.message);
|
6588
|
|
6589
|
// status
|
6590
|
if (this.options.status) {
|
6591
|
this.element.addClass('uk-notify-message-'+this.options.status);
|
6592
|
this.currentstatus = this.options.status;
|
6593
|
}
|
6594
|
|
6595
|
this.group = this.options.group;
|
6596
|
|
6597
|
messages[this.uuid] = this;
|
6598
|
|
6599
|
if(!containers[this.options.pos]) {
|
6600
|
containers[this.options.pos] = UI.$('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
|
6601
|
|
6602
|
var message = UI.$(this).data('notifyMessage');
|
6603
|
|
6604
|
message.element.trigger('manualclose.uk.notify', [message]);
|
6605
|
message.close();
|
6606
|
});
|
6607
|
}
|
6608
|
};
|
6609
|
|
6610
|
|
6611
|
UI.$.extend(Message.prototype, {
|
6612
|
|
6613
|
uuid: false,
|
6614
|
element: false,
|
6615
|
timout: false,
|
6616
|
currentstatus: "",
|
6617
|
group: false,
|
6618
|
|
6619
|
show: function() {
|
6620
|
|
6621
|
if (this.element.is(':visible')) return;
|
6622
|
|
6623
|
var $this = this;
|
6624
|
|
6625
|
containers[this.options.pos].show().prepend(this.element);
|
6626
|
|
6627
|
var marginbottom = parseInt(this.element.css('margin-bottom'), 10);
|
6628
|
|
6629
|
this.element.css({opacity:0, marginTop: -1*this.element.outerHeight(), marginBottom:0}).animate({opacity:1, marginTop:0, marginBottom:marginbottom}, function(){
|
6630
|
|
6631
|
if ($this.options.timeout) {
|
6632
|
|
6633
|
var closefn = function(){ $this.close(); };
|
6634
|
|
6635
|
$this.timeout = setTimeout(closefn, $this.options.timeout);
|
6636
|
|
6637
|
$this.element.hover(
|
6638
|
function() { clearTimeout($this.timeout); },
|
6639
|
function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
|
6640
|
);
|
6641
|
}
|
6642
|
|
6643
|
});
|
6644
|
|
6645
|
return this;
|
6646
|
},
|
6647
|
|
6648
|
close: function(instantly) {
|
6649
|
|
6650
|
var $this = this,
|
6651
|
finalize = function(){
|
6652
|
$this.element.remove();
|
6653
|
|
6654
|
if (!containers[$this.options.pos].children().length) {
|
6655
|
containers[$this.options.pos].hide();
|
6656
|
}
|
6657
|
|
6658
|
$this.options.onClose.apply($this, []);
|
6659
|
$this.element.trigger('close.uk.notify', [$this]);
|
6660
|
|
6661
|
delete messages[$this.uuid];
|
6662
|
};
|
6663
|
|
6664
|
if (this.timeout) clearTimeout(this.timeout);
|
6665
|
|
6666
|
if (instantly) {
|
6667
|
finalize();
|
6668
|
} else {
|
6669
|
this.element.animate({opacity:0, marginTop: -1* this.element.outerHeight(), marginBottom:0}, function(){
|
6670
|
finalize();
|
6671
|
});
|
6672
|
}
|
6673
|
},
|
6674
|
|
6675
|
content: function(html){
|
6676
|
|
6677
|
var container = this.element.find(">div");
|
6678
|
|
6679
|
if(!html) {
|
6680
|
return container.html();
|
6681
|
}
|
6682
|
|
6683
|
container.html(html);
|
6684
|
|
6685
|
return this;
|
6686
|
},
|
6687
|
|
6688
|
status: function(status) {
|
6689
|
|
6690
|
if (!status) {
|
6691
|
return this.currentstatus;
|
6692
|
}
|
6693
|
|
6694
|
this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
|
6695
|
|
6696
|
this.currentstatus = status;
|
6697
|
|
6698
|
return this;
|
6699
|
}
|
6700
|
});
|
6701
|
|
6702
|
Message.defaults = {
|
6703
|
message: "",
|
6704
|
status: "",
|
6705
|
timeout: 5000,
|
6706
|
group: null,
|
6707
|
pos: 'top-center',
|
6708
|
onClose: function() {}
|
6709
|
};
|
6710
|
|
6711
|
UI.notify = notify;
|
6712
|
UI.notify.message = Message;
|
6713
|
UI.notify.closeAll = closeAll;
|
6714
|
|
6715
|
return notify;
|
6716
|
});
|
6717
|
|
6718
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
6719
|
(function(addon) {
|
6720
|
|
6721
|
var component;
|
6722
|
|
6723
|
if (window.UIkit2) {
|
6724
|
component = addon(UIkit2);
|
6725
|
}
|
6726
|
|
6727
|
if (typeof define == 'function' && define.amd) {
|
6728
|
define('uikit-slideshow', ['uikit'], function() {
|
6729
|
return component || addon(UIkit2);
|
6730
|
});
|
6731
|
}
|
6732
|
|
6733
|
})(function(UI) {
|
6734
|
|
6735
|
"use strict";
|
6736
|
|
6737
|
var Animations, playerId = 0;
|
6738
|
|
6739
|
UI.component('slideshow', {
|
6740
|
|
6741
|
defaults: {
|
6742
|
animation : 'fade',
|
6743
|
duration : 500,
|
6744
|
height : 'auto',
|
6745
|
start : 0,
|
6746
|
autoplay : false,
|
6747
|
autoplayInterval : 7000,
|
6748
|
videoautoplay : true,
|
6749
|
videomute : true,
|
6750
|
slices : 15,
|
6751
|
pauseOnHover : true,
|
6752
|
kenburns : false,
|
6753
|
kenburnsanimations : [
|
6754
|
'uk-animation-middle-left',
|
6755
|
'uk-animation-top-right',
|
6756
|
'uk-animation-bottom-left',
|
6757
|
'uk-animation-top-center',
|
6758
|
'', // middle-center
|
6759
|
'uk-animation-bottom-right'
|
6760
|
]
|
6761
|
},
|
6762
|
|
6763
|
current : false,
|
6764
|
interval : null,
|
6765
|
hovering : false,
|
6766
|
|
6767
|
boot: function() {
|
6768
|
|
6769
|
// init code
|
6770
|
UI.ready(function(context) {
|
6771
|
|
6772
|
UI.$('[data-uk-slideshow]', context).each(function() {
|
6773
|
|
6774
|
var slideshow = UI.$(this);
|
6775
|
|
6776
|
if (!slideshow.data('slideshow')) {
|
6777
|
UI.slideshow(slideshow, UI.Utils.options(slideshow.attr('data-uk-slideshow')));
|
6778
|
}
|
6779
|
});
|
6780
|
});
|
6781
|
},
|
6782
|
|
6783
|
init: function() {
|
6784
|
|
6785
|
var $this = this;
|
6786
|
|
6787
|
this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow:first'));
|
6788
|
this.current = this.options.start;
|
6789
|
this.animating = false;
|
6790
|
|
6791
|
this.fixFullscreen = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && this.container.hasClass('uk-slideshow-fullscreen'); // viewport unit fix for height:100vh - should be fixed in iOS 8
|
6792
|
|
6793
|
if (this.options.kenburns) {
|
6794
|
|
6795
|
this.kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
|
6796
|
|
6797
|
if (!String(this.kbanimduration).match(/(ms|s)$/)) {
|
6798
|
this.kbanimduration += 'ms';
|
6799
|
}
|
6800
|
|
6801
|
if (typeof(this.options.kenburnsanimations) == 'string') {
|
6802
|
this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
|
6803
|
}
|
6804
|
}
|
6805
|
|
6806
|
this.update();
|
6807
|
|
6808
|
this.on('click.uk.slideshow', '[data-uk-slideshow-item]', function(e) {
|
6809
|
|
6810
|
e.preventDefault();
|
6811
|
|
6812
|
var slide = UI.$(this).attr('data-uk-slideshow-item');
|
6813
|
|
6814
|
if ($this.current == slide) return;
|
6815
|
|
6816
|
switch(slide) {
|
6817
|
case 'next':
|
6818
|
case 'previous':
|
6819
|
$this[slide=='next' ? 'next':'previous']();
|
6820
|
break;
|
6821
|
default:
|
6822
|
$this.show(parseInt(slide, 10));
|
6823
|
}
|
6824
|
|
6825
|
$this.stop();
|
6826
|
});
|
6827
|
|
6828
|
UI.$win.on("resize load", UI.Utils.debounce(function() {
|
6829
|
$this.resize();
|
6830
|
|
6831
|
if ($this.fixFullscreen) {
|
6832
|
$this.container.css('height', window.innerHeight);
|
6833
|
$this.slides.css('height', window.innerHeight);
|
6834
|
}
|
6835
|
}, 100));
|
6836
|
|
6837
|
// chrome image load fix
|
6838
|
setTimeout(function(){
|
6839
|
$this.resize();
|
6840
|
}, 80);
|
6841
|
|
6842
|
// Set autoplay
|
6843
|
if (this.options.autoplay) {
|
6844
|
this.start();
|
6845
|
}
|
6846
|
|
6847
|
if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
|
6848
|
this.playmedia(this.slides.eq(this.current).data('media'));
|
6849
|
}
|
6850
|
|
6851
|
if (this.options.kenburns) {
|
6852
|
this.applyKenBurns(this.slides.eq(this.current));
|
6853
|
}
|
6854
|
|
6855
|
this.container.on({
|
6856
|
mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
|
6857
|
mouseleave: function() { $this.hovering = false; }
|
6858
|
});
|
6859
|
|
6860
|
this.on('swipeRight swipeLeft', function(e) {
|
6861
|
$this[e.type=='swipeLeft' ? 'next' : 'previous']();
|
6862
|
});
|
6863
|
|
6864
|
this.on('display.uk.check', function(){
|
6865
|
if ($this.element.is(':visible')) {
|
6866
|
|
6867
|
$this.resize();
|
6868
|
|
6869
|
if ($this.fixFullscreen) {
|
6870
|
$this.container.css('height', window.innerHeight);
|
6871
|
$this.slides.css('height', window.innerHeight);
|
6872
|
}
|
6873
|
}
|
6874
|
});
|
6875
|
|
6876
|
UI.domObserve(this.element, function(e) {
|
6877
|
if ($this.container.children(':not([data-slideshow-slide])').not('.uk-slideshow-ghost').length) {
|
6878
|
$this.update(true);
|
6879
|
}
|
6880
|
});
|
6881
|
},
|
6882
|
|
6883
|
update: function(resize) {
|
6884
|
|
6885
|
var $this = this, canvas, processed = 0;
|
6886
|
|
6887
|
this.slides = this.container.children();
|
6888
|
this.slidesCount = this.slides.length;
|
6889
|
|
6890
|
if (!this.slides.eq(this.current).length) {
|
6891
|
this.current = 0;
|
6892
|
}
|
6893
|
|
6894
|
this.slides.each(function(index) {
|
6895
|
|
6896
|
var slide = UI.$(this);
|
6897
|
|
6898
|
if (slide.data('processed')) {
|
6899
|
return;
|
6900
|
}
|
6901
|
|
6902
|
var media = slide.children('img,video,iframe').eq(0), type = 'html';
|
6903
|
|
6904
|
slide.data('media', media);
|
6905
|
slide.data('sizer', media);
|
6906
|
|
6907
|
if (media.length) {
|
6908
|
|
6909
|
var placeholder;
|
6910
|
|
6911
|
type = media[0].nodeName.toLowerCase();
|
6912
|
|
6913
|
switch(media[0].nodeName) {
|
6914
|
case 'IMG':
|
6915
|
|
6916
|
var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
|
6917
|
|
6918
|
if (media.attr('width') && media.attr('height')) {
|
6919
|
placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')});
|
6920
|
media.replaceWith(placeholder);
|
6921
|
media = placeholder;
|
6922
|
placeholder = undefined;
|
6923
|
}
|
6924
|
|
6925
|
media.css({width: '100%',height: 'auto', opacity:0});
|
6926
|
slide.prepend(cover).data('cover', cover);
|
6927
|
break;
|
6928
|
|
6929
|
case 'IFRAME':
|
6930
|
|
6931
|
var src = media[0].src, iframeId = 'sw-'+(++playerId);
|
6932
|
|
6933
|
media
|
6934
|
.attr('src', '').on('load', function(){
|
6935
|
|
6936
|
if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
|
6937
|
$this.pausemedia(media);
|
6938
|
}
|
6939
|
|
6940
|
if ($this.options.videomute) {
|
6941
|
|
6942
|
$this.mutemedia(media);
|
6943
|
|
6944
|
var inv = setInterval((function(ic) {
|
6945
|
return function() {
|
6946
|
$this.mutemedia(media);
|
6947
|
if (++ic >= 4) clearInterval(inv);
|
6948
|
}
|
6949
|
})(0), 250);
|
6950
|
}
|
6951
|
|
6952
|
})
|
6953
|
.data('slideshow', $this) // add self-reference for the vimeo-ready listener
|
6954
|
.attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
|
6955
|
.attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
|
6956
|
.addClass('uk-position-absolute');
|
6957
|
|
6958
|
// disable pointer events
|
6959
|
if(!UI.support.touch) media.css('pointer-events', 'none');
|
6960
|
|
6961
|
placeholder = true;
|
6962
|
|
6963
|
if (UI.cover) {
|
6964
|
UI.cover(media);
|
6965
|
media.attr('data-uk-cover', '{}');
|
6966
|
}
|
6967
|
|
6968
|
break;
|
6969
|
|
6970
|
case 'VIDEO':
|
6971
|
media.addClass('uk-cover-object uk-position-absolute');
|
6972
|
placeholder = true;
|
6973
|
|
6974
|
if ($this.options.videomute) $this.mutemedia(media);
|
6975
|
}
|
6976
|
|
6977
|
if (placeholder) {
|
6978
|
|
6979
|
canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
|
6980
|
var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
|
6981
|
|
6982
|
slide.prepend(img);
|
6983
|
slide.data('sizer', img);
|
6984
|
}
|
6985
|
|
6986
|
} else {
|
6987
|
slide.data('sizer', slide);
|
6988
|
}
|
6989
|
|
6990
|
if ($this.hasKenBurns(slide)) {
|
6991
|
|
6992
|
slide.data('cover').css({
|
6993
|
'-webkit-animation-duration': $this.kbanimduration,
|
6994
|
'animation-duration': $this.kbanimduration
|
6995
|
});
|
6996
|
}
|
6997
|
|
6998
|
slide.data('processed', ++processed);
|
6999
|
slide.attr('data-slideshow-slide', type);
|
7000
|
});
|
7001
|
|
7002
|
if (processed) {
|
7003
|
|
7004
|
this.triggers = this.find('[data-uk-slideshow-item]');
|
7005
|
|
7006
|
// Set start slide
|
7007
|
this.slides.attr('aria-hidden', 'true').removeClass('uk-active').eq(this.current).addClass('uk-active').attr('aria-hidden', 'false');
|
7008
|
this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass('uk-active');
|
7009
|
}
|
7010
|
|
7011
|
if (resize && processed) {
|
7012
|
this.resize();
|
7013
|
}
|
7014
|
},
|
7015
|
|
7016
|
resize: function() {
|
7017
|
|
7018
|
if (this.container.hasClass('uk-slideshow-fullscreen')) return;
|
7019
|
|
7020
|
var height = this.options.height;
|
7021
|
|
7022
|
if (this.options.height === 'auto') {
|
7023
|
|
7024
|
height = 0;
|
7025
|
|
7026
|
this.slides.css('height', '').each(function() {
|
7027
|
height = Math.max(height, UI.$(this).height());
|
7028
|
});
|
7029
|
}
|
7030
|
|
7031
|
this.container.css('height', height);
|
7032
|
this.slides.css('height', height);
|
7033
|
},
|
7034
|
|
7035
|
show: function(index, direction) {
|
7036
|
|
7037
|
if (this.animating || this.current == index) return;
|
7038
|
|
7039
|
this.animating = true;
|
7040
|
|
7041
|
var $this = this,
|
7042
|
current = this.slides.eq(this.current),
|
7043
|
next = this.slides.eq(index),
|
7044
|
dir = direction ? direction : this.current < index ? 1 : -1,
|
7045
|
currentmedia = current.data('media'),
|
7046
|
animation = Animations[this.options.animation] ? this.options.animation : 'fade',
|
7047
|
nextmedia = next.data('media'),
|
7048
|
finalize = function() {
|
7049
|
|
7050
|
if (!$this.animating) return;
|
7051
|
|
7052
|
if (currentmedia && currentmedia.is('video,iframe')) {
|
7053
|
$this.pausemedia(currentmedia);
|
7054
|
}
|
7055
|
|
7056
|
if (nextmedia && nextmedia.is('video,iframe')) {
|
7057
|
$this.playmedia(nextmedia);
|
7058
|
}
|
7059
|
|
7060
|
next.addClass('uk-active').attr('aria-hidden', 'false');
|
7061
|
current.removeClass('uk-active').attr('aria-hidden', 'true');
|
7062
|
|
7063
|
$this.animating = false;
|
7064
|
$this.current = index;
|
7065
|
|
7066
|
UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
|
7067
|
|
7068
|
$this.trigger('show.uk.slideshow', [next, current, $this]);
|
7069
|
};
|
7070
|
|
7071
|
$this.applyKenBurns(next);
|
7072
|
|
7073
|
// animation fallback
|
7074
|
if (!UI.support.animation) {
|
7075
|
animation = 'none';
|
7076
|
}
|
7077
|
|
7078
|
current = UI.$(current);
|
7079
|
next = UI.$(next);
|
7080
|
|
7081
|
$this.trigger('beforeshow.uk.slideshow', [next, current, $this]);
|
7082
|
|
7083
|
Animations[animation].apply(this, [current, next, dir]).then(finalize);
|
7084
|
|
7085
|
$this.triggers.removeClass('uk-active');
|
7086
|
$this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
|
7087
|
},
|
7088
|
|
7089
|
applyKenBurns: function(slide) {
|
7090
|
|
7091
|
if (!this.hasKenBurns(slide)) {
|
7092
|
return;
|
7093
|
}
|
7094
|
|
7095
|
var animations = this.options.kenburnsanimations,
|
7096
|
index = this.kbindex || 0;
|
7097
|
|
7098
|
|
7099
|
slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
|
7100
|
slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
|
7101
|
|
7102
|
this.kbindex = animations[index + 1] ? (index+1):0;
|
7103
|
},
|
7104
|
|
7105
|
hasKenBurns: function(slide) {
|
7106
|
return (this.options.kenburns && slide.data('cover'));
|
7107
|
},
|
7108
|
|
7109
|
next: function() {
|
7110
|
this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1);
|
7111
|
},
|
7112
|
|
7113
|
previous: function() {
|
7114
|
this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1);
|
7115
|
},
|
7116
|
|
7117
|
start: function() {
|
7118
|
|
7119
|
this.stop();
|
7120
|
|
7121
|
var $this = this;
|
7122
|
|
7123
|
this.interval = setInterval(function() {
|
7124
|
if (!$this.hovering) $this.next();
|
7125
|
}, this.options.autoplayInterval);
|
7126
|
|
7127
|
},
|
7128
|
|
7129
|
stop: function() {
|
7130
|
if (this.interval) clearInterval(this.interval);
|
7131
|
},
|
7132
|
|
7133
|
playmedia: function(media) {
|
7134
|
|
7135
|
if (!(media && media[0])) return;
|
7136
|
|
7137
|
switch(media[0].nodeName) {
|
7138
|
case 'VIDEO':
|
7139
|
|
7140
|
if (!this.options.videomute) {
|
7141
|
media[0].muted = false;
|
7142
|
}
|
7143
|
|
7144
|
media[0].play();
|
7145
|
break;
|
7146
|
case 'IFRAME':
|
7147
|
|
7148
|
if (!this.options.videomute) {
|
7149
|
media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
|
7150
|
}
|
7151
|
|
7152
|
media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
|
7153
|
break;
|
7154
|
}
|
7155
|
},
|
7156
|
|
7157
|
pausemedia: function(media) {
|
7158
|
|
7159
|
switch(media[0].nodeName) {
|
7160
|
case 'VIDEO':
|
7161
|
media[0].pause();
|
7162
|
break;
|
7163
|
case 'IFRAME':
|
7164
|
media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
|
7165
|
break;
|
7166
|
}
|
7167
|
},
|
7168
|
|
7169
|
mutemedia: function(media) {
|
7170
|
|
7171
|
switch(media[0].nodeName) {
|
7172
|
case 'VIDEO':
|
7173
|
media[0].muted = true;
|
7174
|
break;
|
7175
|
case 'IFRAME':
|
7176
|
media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
|
7177
|
break;
|
7178
|
}
|
7179
|
}
|
7180
|
});
|
7181
|
|
7182
|
Animations = {
|
7183
|
|
7184
|
'none': function() {
|
7185
|
|
7186
|
var d = UI.$.Deferred();
|
7187
|
d.resolve();
|
7188
|
return d.promise();
|
7189
|
},
|
7190
|
|
7191
|
'scroll': function(current, next, dir) {
|
7192
|
|
7193
|
var d = UI.$.Deferred();
|
7194
|
|
7195
|
current.css('animation-duration', this.options.duration+'ms');
|
7196
|
next.css('animation-duration', this.options.duration+'ms');
|
7197
|
|
7198
|
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
7199
|
|
7200
|
current.css('opacity', 0).removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
|
7201
|
next.removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
|
7202
|
d.resolve();
|
7203
|
|
7204
|
}.bind(this));
|
7205
|
|
7206
|
current.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
|
7207
|
next.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
|
7208
|
next.width(); // force redraw
|
7209
|
|
7210
|
return d.promise();
|
7211
|
},
|
7212
|
|
7213
|
'swipe': function(current, next, dir) {
|
7214
|
|
7215
|
var d = UI.$.Deferred();
|
7216
|
|
7217
|
current.css('animation-duration', this.options.duration+'ms');
|
7218
|
next.css('animation-duration', this.options.duration+'ms');
|
7219
|
|
7220
|
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
7221
|
|
7222
|
current.css('opacity', 0).removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
|
7223
|
next.removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
|
7224
|
d.resolve();
|
7225
|
|
7226
|
}.bind(this));
|
7227
|
|
7228
|
current.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
|
7229
|
next.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
|
7230
|
next.width(); // force redraw
|
7231
|
|
7232
|
return d.promise();
|
7233
|
},
|
7234
|
|
7235
|
'scale': function(current, next, dir) {
|
7236
|
|
7237
|
var d = UI.$.Deferred();
|
7238
|
|
7239
|
current.css('animation-duration', this.options.duration+'ms');
|
7240
|
next.css('animation-duration', this.options.duration+'ms');
|
7241
|
|
7242
|
next.css('opacity', 1);
|
7243
|
|
7244
|
current.one(UI.support.animation.end, function() {
|
7245
|
|
7246
|
current.css('opacity', 0).removeClass('uk-slideshow-scale-out');
|
7247
|
d.resolve();
|
7248
|
|
7249
|
}.bind(this));
|
7250
|
|
7251
|
current.addClass('uk-slideshow-scale-out');
|
7252
|
current.width(); // force redraw
|
7253
|
|
7254
|
return d.promise();
|
7255
|
},
|
7256
|
|
7257
|
'fade': function(current, next, dir) {
|
7258
|
|
7259
|
var d = UI.$.Deferred();
|
7260
|
|
7261
|
current.css('animation-duration', this.options.duration+'ms');
|
7262
|
next.css('animation-duration', this.options.duration+'ms');
|
7263
|
|
7264
|
next.css('opacity', 1);
|
7265
|
|
7266
|
// for plain text content slides - looks smoother
|
7267
|
if (!(next.data('cover') || next.data('placeholder'))) {
|
7268
|
|
7269
|
next.css('opacity', 1).one(UI.support.animation.end, function() {
|
7270
|
next.removeClass('uk-slideshow-fade-in');
|
7271
|
}).addClass('uk-slideshow-fade-in');
|
7272
|
}
|
7273
|
|
7274
|
current.one(UI.support.animation.end, function() {
|
7275
|
|
7276
|
current.css('opacity', 0).removeClass('uk-slideshow-fade-out');
|
7277
|
d.resolve();
|
7278
|
|
7279
|
}.bind(this));
|
7280
|
|
7281
|
current.addClass('uk-slideshow-fade-out');
|
7282
|
current.width(); // force redraw
|
7283
|
|
7284
|
return d.promise();
|
7285
|
}
|
7286
|
};
|
7287
|
|
7288
|
UI.slideshow.animations = Animations;
|
7289
|
|
7290
|
// Listen for messages from the vimeo player
|
7291
|
window.addEventListener('message', function onMessageReceived(e) {
|
7292
|
|
7293
|
var data = e.data, iframe;
|
7294
|
|
7295
|
if (typeof(data) == 'string') {
|
7296
|
|
7297
|
try {
|
7298
|
data = JSON.parse(data);
|
7299
|
} catch(err) {
|
7300
|
data = {};
|
7301
|
}
|
7302
|
}
|
7303
|
|
7304
|
if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
|
7305
|
iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
|
7306
|
|
7307
|
if (iframe.length) {
|
7308
|
iframe.data('slideshow').mutemedia(iframe);
|
7309
|
}
|
7310
|
}
|
7311
|
}, false);
|
7312
|
|
7313
|
});
|
7314
|
|
7315
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
7316
|
(function(addon) {
|
7317
|
|
7318
|
var component;
|
7319
|
|
7320
|
if (window.UIkit2) {
|
7321
|
component = addon(UIkit2);
|
7322
|
}
|
7323
|
|
7324
|
if (typeof define == 'function' && define.amd) {
|
7325
|
define('uikit-slider', ['uikit'], function(){
|
7326
|
return component || addon(UIkit2);
|
7327
|
});
|
7328
|
}
|
7329
|
|
7330
|
})(function(UI){
|
7331
|
|
7332
|
"use strict";
|
7333
|
|
7334
|
var dragging, delayIdle, anchor, dragged, store = {};
|
7335
|
|
7336
|
UI.component('slider', {
|
7337
|
|
7338
|
defaults: {
|
7339
|
center : false,
|
7340
|
threshold : 10,
|
7341
|
infinite : true,
|
7342
|
autoplay : false,
|
7343
|
autoplayInterval : 7000,
|
7344
|
pauseOnHover : true,
|
7345
|
activecls : 'uk-active'
|
7346
|
},
|
7347
|
|
7348
|
boot: function() {
|
7349
|
|
7350
|
// init code
|
7351
|
UI.ready(function(context) {
|
7352
|
|
7353
|
setTimeout(function(){
|
7354
|
|
7355
|
UI.$('[data-uk-slider]', context).each(function(){
|
7356
|
|
7357
|
var ele = UI.$(this);
|
7358
|
|
7359
|
if (!ele.data('slider')) {
|
7360
|
UI.slider(ele, UI.Utils.options(ele.attr('data-uk-slider')));
|
7361
|
}
|
7362
|
});
|
7363
|
|
7364
|
}, 0);
|
7365
|
});
|
7366
|
},
|
7367
|
|
7368
|
init: function() {
|
7369
|
|
7370
|
var $this = this;
|
7371
|
|
7372
|
this.container = this.element.find('.uk-slider');
|
7373
|
this.focus = 0;
|
7374
|
|
7375
|
UI.$win.on('resize load', UI.Utils.debounce(function() {
|
7376
|
$this.update(true);
|
7377
|
}, 100));
|
7378
|
|
7379
|
this.on('click.uk.slider', '[data-uk-slider-item]', function(e) {
|
7380
|
|
7381
|
e.preventDefault();
|
7382
|
|
7383
|
var item = UI.$(this).attr('data-uk-slider-item');
|
7384
|
|
7385
|
if ($this.focus == item) return;
|
7386
|
|
7387
|
// stop autoplay
|
7388
|
$this.stop();
|
7389
|
|
7390
|
switch(item) {
|
7391
|
case 'next':
|
7392
|
case 'previous':
|
7393
|
$this[item=='next' ? 'next':'previous']();
|
7394
|
break;
|
7395
|
default:
|
7396
|
$this.updateFocus(parseInt(item, 10));
|
7397
|
}
|
7398
|
});
|
7399
|
|
7400
|
this.container.on({
|
7401
|
|
7402
|
'touchstart mousedown': function(evt) {
|
7403
|
|
7404
|
if (evt.originalEvent && evt.originalEvent.touches) {
|
7405
|
evt = evt.originalEvent.touches[0];
|
7406
|
}
|
7407
|
|
7408
|
// ignore right click button
|
7409
|
if (evt.button && evt.button==2 || !$this.active) {
|
7410
|
return;
|
7411
|
}
|
7412
|
|
7413
|
// stop autoplay
|
7414
|
$this.stop();
|
7415
|
|
7416
|
anchor = UI.$(evt.target).is('a') ? UI.$(evt.target) : UI.$(evt.target).parents('a:first');
|
7417
|
dragged = false;
|
7418
|
|
7419
|
if (anchor.length) {
|
7420
|
|
7421
|
anchor.one('click', function(e){
|
7422
|
if (dragged) e.preventDefault();
|
7423
|
});
|
7424
|
}
|
7425
|
|
7426
|
delayIdle = function(e) {
|
7427
|
|
7428
|
dragged = true;
|
7429
|
dragging = $this;
|
7430
|
store = {
|
7431
|
touchx : parseInt(e.pageX, 10),
|
7432
|
dir : 1,
|
7433
|
focus : $this.focus,
|
7434
|
base : $this.options.center ? 'center':'area'
|
7435
|
};
|
7436
|
|
7437
|
if (e.originalEvent && e.originalEvent.touches) {
|
7438
|
e = e.originalEvent.touches[0];
|
7439
|
}
|
7440
|
|
7441
|
dragging.element.data({
|
7442
|
'pointer-start': {x: parseInt(e.pageX, 10), y: parseInt(e.pageY, 10)},
|
7443
|
'pointer-pos-start': $this.pos
|
7444
|
});
|
7445
|
|
7446
|
$this.container.addClass('uk-drag');
|
7447
|
|
7448
|
delayIdle = false;
|
7449
|
};
|
7450
|
|
7451
|
delayIdle.x = parseInt(evt.pageX, 10);
|
7452
|
delayIdle.threshold = $this.options.threshold;
|
7453
|
|
7454
|
},
|
7455
|
|
7456
|
mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
|
7457
|
mouseleave: function() { $this.hovering = false; }
|
7458
|
});
|
7459
|
|
7460
|
this.update(true);
|
7461
|
|
7462
|
this.on('display.uk.check', function(){
|
7463
|
if ($this.element.is(":visible")) {
|
7464
|
$this.update(true);
|
7465
|
}
|
7466
|
});
|
7467
|
|
7468
|
// prevent dragging links + images
|
7469
|
this.element.find('a,img').attr('draggable', 'false');
|
7470
|
|
7471
|
// Set autoplay
|
7472
|
if (this.options.autoplay) {
|
7473
|
this.start();
|
7474
|
}
|
7475
|
|
7476
|
UI.domObserve(this.element, function(e) {
|
7477
|
if ($this.element.children(':not([data-slider-slide])').length) {
|
7478
|
$this.update(true);
|
7479
|
}
|
7480
|
});
|
7481
|
|
7482
|
},
|
7483
|
|
7484
|
update: function(focus) {
|
7485
|
|
7486
|
var $this = this, pos = 0, maxheight = 0, item, width, cwidth, size;
|
7487
|
|
7488
|
this.items = this.container.children().filter(':visible');
|
7489
|
this.vp = this.element[0].getBoundingClientRect().width;
|
7490
|
|
7491
|
this.container.css({'min-width': '', 'min-height': ''});
|
7492
|
|
7493
|
this.items.each(function(idx){
|
7494
|
|
7495
|
item = UI.$(this).attr('data-slider-slide', idx);
|
7496
|
size = item.css({'left': '', 'width':''})[0].getBoundingClientRect();
|
7497
|
width = size.width;
|
7498
|
cwidth = item.width();
|
7499
|
maxheight = Math.max(maxheight, size.height);
|
7500
|
|
7501
|
item.css({'left': pos, 'width':width}).data({'idx':idx, 'left': pos, 'width': width, 'cwidth':cwidth, 'area': (pos+width), 'center':(pos - ($this.vp/2 - cwidth/2))});
|
7502
|
|
7503
|
pos += width;
|
7504
|
});
|
7505
|
|
7506
|
this.container.css({'min-width': pos, 'min-height': maxheight});
|
7507
|
|
7508
|
if (this.options.infinite && (pos <= (2*this.vp) || this.items.length < 5) && !this.itemsResized) {
|
7509
|
|
7510
|
// fill with cloned items
|
7511
|
this.container.children().each(function(idx){
|
7512
|
$this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
|
7513
|
}).each(function(idx){
|
7514
|
$this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
|
7515
|
});
|
7516
|
|
7517
|
this.itemsResized = true;
|
7518
|
|
7519
|
return this.update();
|
7520
|
}
|
7521
|
|
7522
|
this.cw = pos;
|
7523
|
this.pos = 0;
|
7524
|
this.active = pos >= this.vp;
|
7525
|
|
7526
|
this.container.css({
|
7527
|
'-ms-transform': '',
|
7528
|
'-webkit-transform': '',
|
7529
|
'transform': ''
|
7530
|
});
|
7531
|
|
7532
|
if (focus) this.updateFocus(this.focus);
|
7533
|
},
|
7534
|
|
7535
|
updatePos: function(pos) {
|
7536
|
this.pos = pos;
|
7537
|
this.container.css({
|
7538
|
'-ms-transform': 'translateX('+pos+'px)',
|
7539
|
'-webkit-transform': 'translateX('+pos+'px)',
|
7540
|
'transform': 'translateX('+pos+'px)'
|
7541
|
});
|
7542
|
},
|
7543
|
|
7544
|
updateFocus: function(idx, dir) {
|
7545
|
|
7546
|
if (!this.active) {
|
7547
|
return;
|
7548
|
}
|
7549
|
|
7550
|
dir = dir || (idx > this.focus ? 1:-1);
|
7551
|
|
7552
|
var item = this.items.eq(idx), area, i;
|
7553
|
|
7554
|
if (this.options.infinite) {
|
7555
|
this.infinite(idx, dir);
|
7556
|
}
|
7557
|
|
7558
|
if (this.options.center) {
|
7559
|
|
7560
|
this.updatePos(item.data('center')*-1);
|
7561
|
|
7562
|
this.items.filter('.'+this.options.activecls).removeClass(this.options.activecls);
|
7563
|
item.addClass(this.options.activecls);
|
7564
|
|
7565
|
} else {
|
7566
|
|
7567
|
if (this.options.infinite) {
|
7568
|
|
7569
|
this.updatePos(item.data('left')*-1);
|
7570
|
|
7571
|
} else {
|
7572
|
|
7573
|
area = 0;
|
7574
|
|
7575
|
for (i=idx;i<this.items.length;i++) {
|
7576
|
area += this.items.eq(i).data('width');
|
7577
|
}
|
7578
|
|
7579
|
|
7580
|
if (area > this.vp) {
|
7581
|
|
7582
|
this.updatePos(item.data('left')*-1);
|
7583
|
|
7584
|
} else {
|
7585
|
|
7586
|
if (dir == 1) {
|
7587
|
|
7588
|
area = 0;
|
7589
|
|
7590
|
for (i=this.items.length-1;i>=0;i--) {
|
7591
|
|
7592
|
area += this.items.eq(i).data('width');
|
7593
|
|
7594
|
if (area == this.vp) {
|
7595
|
idx = i;
|
7596
|
break;
|
7597
|
}
|
7598
|
|
7599
|
if (area > this.vp) {
|
7600
|
idx = (i < this.items.length-1) ? i+1 : i;
|
7601
|
break;
|
7602
|
}
|
7603
|
}
|
7604
|
|
7605
|
if (area > this.vp) {
|
7606
|
this.updatePos((this.container.width() - this.vp) * -1);
|
7607
|
} else {
|
7608
|
this.updatePos(this.items.eq(idx).data('left')*-1);
|
7609
|
}
|
7610
|
}
|
7611
|
}
|
7612
|
}
|
7613
|
}
|
7614
|
|
7615
|
// mark elements
|
7616
|
var left = this.items.eq(idx).data('left');
|
7617
|
|
7618
|
this.items.removeClass('uk-slide-before uk-slide-after').each(function(i){
|
7619
|
if (i!==idx) {
|
7620
|
UI.$(this).addClass(UI.$(this).data('left') < left ? 'uk-slide-before':'uk-slide-after');
|
7621
|
}
|
7622
|
});
|
7623
|
|
7624
|
this.focus = idx;
|
7625
|
|
7626
|
this.trigger('focusitem.uk.slider', [idx,this.items.eq(idx),this]);
|
7627
|
},
|
7628
|
|
7629
|
next: function() {
|
7630
|
|
7631
|
var focus = this.items[this.focus + 1] ? (this.focus + 1) : (this.options.infinite ? 0:this.focus);
|
7632
|
|
7633
|
this.updateFocus(focus, 1);
|
7634
|
},
|
7635
|
|
7636
|
previous: function() {
|
7637
|
|
7638
|
var focus = this.items[this.focus - 1] ? (this.focus - 1) : (this.options.infinite ? (this.items[this.focus - 1] ? this.items-1:this.items.length-1):this.focus);
|
7639
|
|
7640
|
this.updateFocus(focus, -1);
|
7641
|
},
|
7642
|
|
7643
|
start: function() {
|
7644
|
|
7645
|
this.stop();
|
7646
|
|
7647
|
var $this = this;
|
7648
|
|
7649
|
this.interval = setInterval(function() {
|
7650
|
if (!$this.hovering) $this.next();
|
7651
|
}, this.options.autoplayInterval);
|
7652
|
|
7653
|
},
|
7654
|
|
7655
|
stop: function() {
|
7656
|
if (this.interval) clearInterval(this.interval);
|
7657
|
},
|
7658
|
|
7659
|
infinite: function(baseidx, direction) {
|
7660
|
|
7661
|
var $this = this, item = this.items.eq(baseidx), i, z = baseidx, move = [], area = 0;
|
7662
|
|
7663
|
if (direction == 1) {
|
7664
|
|
7665
|
|
7666
|
for (i=0;i<this.items.length;i++) {
|
7667
|
|
7668
|
if (z != baseidx) {
|
7669
|
area += this.items.eq(z).data('width');
|
7670
|
move.push(this.items.eq(z));
|
7671
|
}
|
7672
|
|
7673
|
if (area > this.vp) {
|
7674
|
break;
|
7675
|
}
|
7676
|
|
7677
|
z = z+1 == this.items.length ? 0:z+1;
|
7678
|
}
|
7679
|
|
7680
|
if (move.length) {
|
7681
|
|
7682
|
move.forEach(function(itm){
|
7683
|
|
7684
|
var left = item.data('area');
|
7685
|
|
7686
|
itm.css({'left': left}).data({
|
7687
|
left : left,
|
7688
|
area : (left+itm.data('width')),
|
7689
|
center: (left - ($this.vp/2 - itm.data('cwidth')/2))
|
7690
|
});
|
7691
|
|
7692
|
item = itm;
|
7693
|
});
|
7694
|
}
|
7695
|
|
7696
|
|
7697
|
} else {
|
7698
|
|
7699
|
for (i=this.items.length-1;i >-1 ;i--) {
|
7700
|
|
7701
|
area += this.items.eq(z).data('width');
|
7702
|
|
7703
|
if (z != baseidx) {
|
7704
|
move.push(this.items.eq(z));
|
7705
|
}
|
7706
|
|
7707
|
if (area > this.vp) {
|
7708
|
break;
|
7709
|
}
|
7710
|
|
7711
|
z = z-1 == -1 ? this.items.length-1:z-1;
|
7712
|
}
|
7713
|
|
7714
|
if (move.length) {
|
7715
|
|
7716
|
move.forEach(function(itm){
|
7717
|
|
7718
|
var left = item.data('left') - itm.data('width');
|
7719
|
|
7720
|
itm.css({'left': left}).data({
|
7721
|
left : left,
|
7722
|
area : (left+itm.data('width')),
|
7723
|
center: (left - ($this.vp/2 - itm.data('cwidth')/2))
|
7724
|
});
|
7725
|
|
7726
|
item = itm;
|
7727
|
});
|
7728
|
}
|
7729
|
}
|
7730
|
}
|
7731
|
});
|
7732
|
|
7733
|
// handle dragging
|
7734
|
UI.$doc.on('mousemove.uk.slider touchmove.uk.slider', function(e) {
|
7735
|
|
7736
|
if (e.originalEvent && e.originalEvent.touches) {
|
7737
|
e = e.originalEvent.touches[0];
|
7738
|
}
|
7739
|
|
7740
|
if (delayIdle && Math.abs(e.pageX - delayIdle.x) > delayIdle.threshold) {
|
7741
|
|
7742
|
if (!window.getSelection().toString()) {
|
7743
|
delayIdle(e);
|
7744
|
} else {
|
7745
|
dragging = delayIdle = false;
|
7746
|
}
|
7747
|
}
|
7748
|
|
7749
|
if (!dragging) {
|
7750
|
return;
|
7751
|
}
|
7752
|
|
7753
|
var x, xDiff, pos, dir, focus, item, next, diff, i, z, itm;
|
7754
|
|
7755
|
if (e.clientX || e.clientY) {
|
7756
|
x = e.clientX;
|
7757
|
} else if (e.pageX || e.pageY) {
|
7758
|
x = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft;
|
7759
|
}
|
7760
|
|
7761
|
focus = store.focus;
|
7762
|
xDiff = x - dragging.element.data('pointer-start').x;
|
7763
|
pos = dragging.element.data('pointer-pos-start') + xDiff;
|
7764
|
dir = x > dragging.element.data('pointer-start').x ? -1:1;
|
7765
|
item = dragging.items.eq(store.focus);
|
7766
|
|
7767
|
if (dir == 1) {
|
7768
|
|
7769
|
diff = item.data('left') + Math.abs(xDiff);
|
7770
|
|
7771
|
for (i=0,z=store.focus;i<dragging.items.length;i++) {
|
7772
|
|
7773
|
itm = dragging.items.eq(z);
|
7774
|
|
7775
|
if (z != store.focus && itm.data('left') < diff && itm.data('area') > diff) {
|
7776
|
focus = z;
|
7777
|
break;
|
7778
|
}
|
7779
|
|
7780
|
z = z+1 == dragging.items.length ? 0:z+1;
|
7781
|
}
|
7782
|
|
7783
|
} else {
|
7784
|
|
7785
|
diff = item.data('left') - Math.abs(xDiff);
|
7786
|
|
7787
|
for (i=0,z=store.focus;i<dragging.items.length;i++) {
|
7788
|
|
7789
|
itm = dragging.items.eq(z);
|
7790
|
|
7791
|
if (z != store.focus && itm.data('area') <= item.data('left') && itm.data('center') < diff) {
|
7792
|
focus = z;
|
7793
|
break;
|
7794
|
}
|
7795
|
|
7796
|
z = z-1 == -1 ? dragging.items.length-1:z-1;
|
7797
|
}
|
7798
|
}
|
7799
|
|
7800
|
if (dragging.options.infinite && focus!=store._focus) {
|
7801
|
dragging.infinite(focus, dir);
|
7802
|
}
|
7803
|
|
7804
|
dragging.updatePos(pos);
|
7805
|
|
7806
|
store.dir = dir;
|
7807
|
store._focus = focus;
|
7808
|
store.touchx = parseInt(e.pageX, 10);
|
7809
|
store.diff = diff;
|
7810
|
});
|
7811
|
|
7812
|
UI.$doc.on('mouseup.uk.slider touchend.uk.slider', function(e) {
|
7813
|
|
7814
|
if (dragging) {
|
7815
|
|
7816
|
dragging.container.removeClass('uk-drag');
|
7817
|
|
7818
|
// TODO is this needed?
|
7819
|
dragging.items.eq(store.focus);
|
7820
|
|
7821
|
var itm, focus = false, i, z;
|
7822
|
|
7823
|
if (store.dir == 1) {
|
7824
|
|
7825
|
for (i=0,z=store.focus;i<dragging.items.length;i++) {
|
7826
|
|
7827
|
itm = dragging.items.eq(z);
|
7828
|
|
7829
|
if (z != store.focus && itm.data('left') > store.diff) {
|
7830
|
focus = z;
|
7831
|
break;
|
7832
|
}
|
7833
|
|
7834
|
z = z+1 == dragging.items.length ? 0:z+1;
|
7835
|
}
|
7836
|
if (!dragging.options.infinite && !focus) {
|
7837
|
focus = dragging.items.length;
|
7838
|
}
|
7839
|
|
7840
|
} else {
|
7841
|
|
7842
|
for (i=0,z=store.focus;i<dragging.items.length;i++) {
|
7843
|
|
7844
|
itm = dragging.items.eq(z);
|
7845
|
|
7846
|
if (z != store.focus && itm.data('left') < store.diff) {
|
7847
|
focus = z;
|
7848
|
break;
|
7849
|
}
|
7850
|
|
7851
|
z = z-1 == -1 ? dragging.items.length-1:z-1;
|
7852
|
}
|
7853
|
if (!dragging.options.infinite && !focus) {
|
7854
|
focus = 0
|
7855
|
}
|
7856
|
}
|
7857
|
|
7858
|
dragging.updateFocus(focus!==false ? focus:store._focus);
|
7859
|
|
7860
|
}
|
7861
|
|
7862
|
dragging = delayIdle = false;
|
7863
|
});
|
7864
|
|
7865
|
return UI.slider;
|
7866
|
});
|
7867
|
|
7868
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
7869
|
/*
|
7870
|
* Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
|
7871
|
*/
|
7872
|
(function(addon) {
|
7873
|
|
7874
|
var component;
|
7875
|
|
7876
|
if (window.UIkit2) {
|
7877
|
component = addon(UIkit2);
|
7878
|
}
|
7879
|
|
7880
|
if (typeof define == 'function' && define.amd) {
|
7881
|
define('uikit-sortable', ['uikit'], function(){
|
7882
|
return component || addon(UIkit2);
|
7883
|
});
|
7884
|
}
|
7885
|
|
7886
|
})(function(UI){
|
7887
|
|
7888
|
"use strict";
|
7889
|
|
7890
|
var supportsTouch = ('ontouchstart' in window || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
|
7891
|
draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement, startEvent;
|
7892
|
|
7893
|
var POINTER_DOWN = supportsTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointerdown':'touchstart') : 'mousedown',
|
7894
|
POINTER_MOVE = supportsTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointermove':'touchmove') : 'mousemove',
|
7895
|
POINTER_UP = supportsTouch ? ('MSGesture' in window || window.PointerEvent ? 'pointerup':'touchend') : 'mouseup';
|
7896
|
|
7897
|
|
7898
|
function closestSortable(ele) {
|
7899
|
|
7900
|
ele = UI.$(ele);
|
7901
|
|
7902
|
do {
|
7903
|
if (ele.data('sortable')) {
|
7904
|
return ele;
|
7905
|
}
|
7906
|
ele = UI.$(ele).parent();
|
7907
|
} while(ele.length);
|
7908
|
|
7909
|
return ele;
|
7910
|
}
|
7911
|
|
7912
|
UI.component('sortable', {
|
7913
|
|
7914
|
defaults: {
|
7915
|
|
7916
|
animation : 150,
|
7917
|
threshold : 10,
|
7918
|
|
7919
|
childClass : 'uk-sortable-item',
|
7920
|
placeholderClass : 'uk-sortable-placeholder',
|
7921
|
overClass : 'uk-sortable-over',
|
7922
|
draggingClass : 'uk-sortable-dragged',
|
7923
|
dragMovingClass : 'uk-sortable-moving',
|
7924
|
baseClass : 'uk-sortable',
|
7925
|
noDragClass : 'uk-sortable-nodrag',
|
7926
|
emptyClass : 'uk-sortable-empty',
|
7927
|
dragCustomClass : '',
|
7928
|
handleClass : false,
|
7929
|
group : false,
|
7930
|
|
7931
|
stop : function() {},
|
7932
|
start : function() {},
|
7933
|
change : function() {}
|
7934
|
},
|
7935
|
|
7936
|
boot: function() {
|
7937
|
|
7938
|
// auto init
|
7939
|
UI.ready(function(context) {
|
7940
|
|
7941
|
UI.$('[data-uk-sortable]', context).each(function(){
|
7942
|
|
7943
|
var ele = UI.$(this);
|
7944
|
|
7945
|
if(!ele.data('sortable')) {
|
7946
|
UI.sortable(ele, UI.Utils.options(ele.attr('data-uk-sortable')));
|
7947
|
}
|
7948
|
});
|
7949
|
});
|
7950
|
|
7951
|
UI.$html.on(POINTER_MOVE, function(e) {
|
7952
|
|
7953
|
if (delayIdle) {
|
7954
|
|
7955
|
var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e;
|
7956
|
|
7957
|
if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) {
|
7958
|
delayIdle.apply(src);
|
7959
|
}
|
7960
|
}
|
7961
|
|
7962
|
if (draggingPlaceholder) {
|
7963
|
|
7964
|
if (!moving) {
|
7965
|
moving = true;
|
7966
|
draggingPlaceholder.show();
|
7967
|
|
7968
|
draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
|
7969
|
draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
|
7970
|
|
7971
|
UI.$html.addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
|
7972
|
}
|
7973
|
|
7974
|
var offset = draggingPlaceholder.data('mouse-offset'),
|
7975
|
ev = e.originalEvent.touches && e.originalEvent.touches[0] || e.originalEvent,
|
7976
|
left = parseInt(ev.pageX, 10) + offset.left,
|
7977
|
top = parseInt(ev.pageY, 10) + offset.top;
|
7978
|
|
7979
|
draggingPlaceholder.css({left: left, top: top });
|
7980
|
|
7981
|
// adjust document scrolling
|
7982
|
|
7983
|
if (top + (draggingPlaceholder.height()/3) > document.body.offsetHeight) {
|
7984
|
return;
|
7985
|
}
|
7986
|
|
7987
|
if (top < UI.$win.scrollTop()) {
|
7988
|
UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/3));
|
7989
|
} else if ( (top + (draggingPlaceholder.height()/3)) > (window.innerHeight + UI.$win.scrollTop()) ) {
|
7990
|
UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/3));
|
7991
|
}
|
7992
|
}
|
7993
|
});
|
7994
|
|
7995
|
UI.$html.on(POINTER_UP, function(e) {
|
7996
|
|
7997
|
delayIdle = clickedlink = false;
|
7998
|
|
7999
|
// dragging?
|
8000
|
if (!currentlyDraggingElement || !draggingPlaceholder) {
|
8001
|
// completely reset dragging attempt. will cause weird delay behavior elsewise
|
8002
|
currentlyDraggingElement = draggingPlaceholder = null;
|
8003
|
return;
|
8004
|
}
|
8005
|
|
8006
|
// inside or outside of sortable?
|
8007
|
var sortable = closestSortable(currentlyDraggingElement),
|
8008
|
component = draggingPlaceholder.$sortable,
|
8009
|
ev = { type: e.type };
|
8010
|
|
8011
|
if (sortable[0]) {
|
8012
|
component.dragDrop(ev, component.element);
|
8013
|
}
|
8014
|
component.dragEnd(ev, component.element);
|
8015
|
});
|
8016
|
},
|
8017
|
|
8018
|
init: function() {
|
8019
|
|
8020
|
var $this = this,
|
8021
|
element = this.element[0];
|
8022
|
|
8023
|
touchedlists = [];
|
8024
|
|
8025
|
this.checkEmptyList();
|
8026
|
|
8027
|
this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group'));
|
8028
|
|
8029
|
var handleDragStart = delegate(function(e) {
|
8030
|
|
8031
|
if (e.data && e.data.sortable) {
|
8032
|
return;
|
8033
|
}
|
8034
|
|
8035
|
var $target = UI.$(e.target),
|
8036
|
$link = $target.is('a[href]') ? $target:$target.parents('a[href]');
|
8037
|
|
8038
|
if ($target.is(':input')) {
|
8039
|
return;
|
8040
|
}
|
8041
|
|
8042
|
if ($this.options.handleClass) {
|
8043
|
var handle = $target.hasClass($this.options.handleClass) ? $target : $target.closest('.'+$this.options.handleClass, $this.element);
|
8044
|
if (!handle.length) return;
|
8045
|
}
|
8046
|
|
8047
|
e.preventDefault();
|
8048
|
|
8049
|
if ($link.length) {
|
8050
|
|
8051
|
$link.one('click', function(e){
|
8052
|
e.preventDefault();
|
8053
|
}).one(POINTER_UP, function(){
|
8054
|
|
8055
|
if (!moved) {
|
8056
|
$link.trigger('click');
|
8057
|
if (supportsTouch && $link.attr('href').trim()) {
|
8058
|
location.href = $link.attr('href');
|
8059
|
}
|
8060
|
}
|
8061
|
});
|
8062
|
}
|
8063
|
|
8064
|
e.data = e.data || {};
|
8065
|
|
8066
|
e.data.sortable = element;
|
8067
|
|
8068
|
return $this.dragStart(e, this);
|
8069
|
});
|
8070
|
|
8071
|
var handleDragEnter = delegate(UI.Utils.debounce(function(e) {
|
8072
|
return $this.dragEnter(e, this);
|
8073
|
}), 40);
|
8074
|
|
8075
|
var handleDragLeave = delegate(function(e) {
|
8076
|
|
8077
|
// Prevent dragenter on a child from allowing a dragleave on the container
|
8078
|
var previousCounter = $this.dragenterData(this);
|
8079
|
$this.dragenterData(this, previousCounter - 1);
|
8080
|
|
8081
|
// This is a fix for child elements firing dragenter before the parent fires dragleave
|
8082
|
if (!$this.dragenterData(this)) {
|
8083
|
UI.$(this).removeClass($this.options.overClass);
|
8084
|
$this.dragenterData(this, false);
|
8085
|
}
|
8086
|
});
|
8087
|
|
8088
|
var handleTouchMove = delegate(function(e) {
|
8089
|
|
8090
|
if (!currentlyDraggingElement ||
|
8091
|
currentlyDraggingElement === this ||
|
8092
|
currentlyDraggingTarget === this) {
|
8093
|
return true;
|
8094
|
}
|
8095
|
|
8096
|
$this.element.children().removeClass($this.options.overClass);
|
8097
|
currentlyDraggingTarget = this;
|
8098
|
|
8099
|
$this.moveElementNextTo(currentlyDraggingElement, this);
|
8100
|
|
8101
|
return prevent(e);
|
8102
|
});
|
8103
|
|
8104
|
// Bind/unbind standard mouse/touch events as a polyfill.
|
8105
|
function addDragHandlers() {
|
8106
|
|
8107
|
if (supportsTouch && startEvent.touches && startEvent.touches.length) {
|
8108
|
element.addEventListener(POINTER_MOVE, handleTouchMove, false);
|
8109
|
} else {
|
8110
|
element.addEventListener('mouseover', handleDragEnter, false);
|
8111
|
element.addEventListener('mouseout', handleDragLeave, false);
|
8112
|
}
|
8113
|
|
8114
|
// document.addEventListener("selectstart", prevent, false);
|
8115
|
}
|
8116
|
|
8117
|
function removeDragHandlers() {
|
8118
|
if (supportsTouch && startEvent.touches && startEvent.touches.length) {
|
8119
|
element.removeEventListener(POINTER_MOVE, handleTouchMove, false);
|
8120
|
} else {
|
8121
|
element.removeEventListener('mouseover', handleDragEnter, false);
|
8122
|
element.removeEventListener('mouseout', handleDragLeave, false);
|
8123
|
}
|
8124
|
|
8125
|
// document.removeEventListener("selectstart", prevent, false);
|
8126
|
}
|
8127
|
|
8128
|
this.addDragHandlers = addDragHandlers;
|
8129
|
this.removeDragHandlers = removeDragHandlers;
|
8130
|
|
8131
|
function handleDragMove(e) {
|
8132
|
|
8133
|
if (!currentlyDraggingElement) {
|
8134
|
return;
|
8135
|
}
|
8136
|
|
8137
|
$this.dragMove(e, $this);
|
8138
|
}
|
8139
|
|
8140
|
function delegate(fn) {
|
8141
|
|
8142
|
return function(e) {
|
8143
|
|
8144
|
var touch, target, context;
|
8145
|
|
8146
|
startEvent = e;
|
8147
|
|
8148
|
if (e) {
|
8149
|
touch = e.touches && e.touches[0] || e;
|
8150
|
target = touch.target || e.target;
|
8151
|
|
8152
|
// Fix event.target for a touch event
|
8153
|
if (supportsTouch && document.elementFromPoint) {
|
8154
|
|
8155
|
var _target = document.elementFromPoint(touch.pageX - document.body.scrollLeft, touch.pageY - document.body.scrollTop);
|
8156
|
|
8157
|
if (_target) {
|
8158
|
target = _target;
|
8159
|
}
|
8160
|
}
|
8161
|
|
8162
|
overElement = UI.$(target);
|
8163
|
}
|
8164
|
|
8165
|
if (UI.$(target).hasClass('.'+$this.options.childClass)) {
|
8166
|
fn.apply(target, [e]);
|
8167
|
} else if (target !== element) {
|
8168
|
|
8169
|
// If a child is initiating the event or ending it, then use the container as context for the callback.
|
8170
|
context = moveUpToChildNode(element, target);
|
8171
|
|
8172
|
if (context) {
|
8173
|
fn.apply(context, [e]);
|
8174
|
}
|
8175
|
}
|
8176
|
};
|
8177
|
}
|
8178
|
|
8179
|
window.addEventListener(POINTER_MOVE, handleDragMove, false);
|
8180
|
element.addEventListener(POINTER_DOWN, handleDragStart, false);
|
8181
|
},
|
8182
|
|
8183
|
dragStart: function(e, elem) {
|
8184
|
|
8185
|
moved = false;
|
8186
|
moving = false;
|
8187
|
dragging = false;
|
8188
|
|
8189
|
var $this = this,
|
8190
|
target = UI.$(e.target);
|
8191
|
|
8192
|
if (!supportsTouch && e.button==2) {
|
8193
|
return;
|
8194
|
}
|
8195
|
|
8196
|
if (target.is('.'+$this.options.noDragClass)) {
|
8197
|
return;
|
8198
|
}
|
8199
|
|
8200
|
var noDragParent = target.closest('.'+$this.options.noDragClass);
|
8201
|
|
8202
|
if (noDragParent.length && this.element.find(noDragParent[0]).length) {
|
8203
|
return;
|
8204
|
}
|
8205
|
|
8206
|
// prevent dragging if taget is a form field
|
8207
|
if (target.is(':input')) {
|
8208
|
return;
|
8209
|
}
|
8210
|
|
8211
|
currentlyDraggingElement = elem;
|
8212
|
|
8213
|
// init drag placeholder
|
8214
|
if (draggingPlaceholder) {
|
8215
|
draggingPlaceholder.remove();
|
8216
|
}
|
8217
|
|
8218
|
var $current = UI.$(currentlyDraggingElement), offset = $current.offset(), ev = e.touches && e.touches[0] || e;
|
8219
|
|
8220
|
delayIdle = {
|
8221
|
|
8222
|
pos : { x:ev.pageX, y:ev.pageY },
|
8223
|
threshold : $this.options.handleClass ? 1 : $this.options.threshold,
|
8224
|
apply : function(evt) {
|
8225
|
|
8226
|
draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
|
8227
|
display : 'none',
|
8228
|
top : offset.top,
|
8229
|
left : offset.left,
|
8230
|
width : $current.width(),
|
8231
|
height : $current.height(),
|
8232
|
padding : $current.css('padding')
|
8233
|
}).data({
|
8234
|
'mouse-offset': {
|
8235
|
left : offset.left - parseInt(ev.pageX, 10),
|
8236
|
top : offset.top - parseInt(ev.pageY, 10)
|
8237
|
},
|
8238
|
origin : $this.element,
|
8239
|
index : $current.index()
|
8240
|
}).append($current.html()).appendTo('body');
|
8241
|
|
8242
|
draggingPlaceholder.$current = $current;
|
8243
|
draggingPlaceholder.$sortable = $this;
|
8244
|
|
8245
|
$current.data({
|
8246
|
'start-list': $current.parent(),
|
8247
|
'start-index': $current.index(),
|
8248
|
'sortable-group': $this.options.group
|
8249
|
});
|
8250
|
|
8251
|
$this.addDragHandlers();
|
8252
|
|
8253
|
$this.options.start(this, currentlyDraggingElement);
|
8254
|
$this.trigger('start.uk.sortable', [$this, currentlyDraggingElement, draggingPlaceholder]);
|
8255
|
|
8256
|
moved = true;
|
8257
|
delayIdle = false;
|
8258
|
}
|
8259
|
};
|
8260
|
},
|
8261
|
|
8262
|
dragMove: function(e, elem) {
|
8263
|
|
8264
|
overElement = UI.$(document.elementFromPoint(e.pageX - (document.body.scrollLeft || document.scrollLeft || 0), e.pageY - (document.body.scrollTop || document.documentElement.scrollTop || 0)));
|
8265
|
|
8266
|
var overRoot = overElement.closest('.'+this.options.baseClass),
|
8267
|
groupOver = overRoot.data('sortable-group'),
|
8268
|
$current = UI.$(currentlyDraggingElement),
|
8269
|
currentRoot = $current.parent(),
|
8270
|
groupCurrent = $current.data('sortable-group'),
|
8271
|
overChild;
|
8272
|
|
8273
|
if (overRoot[0] !== currentRoot[0] && groupCurrent !== undefined && groupOver === groupCurrent) {
|
8274
|
|
8275
|
overRoot.data('sortable').addDragHandlers();
|
8276
|
|
8277
|
touchedlists.push(overRoot);
|
8278
|
overRoot.children().addClass(this.options.childClass);
|
8279
|
|
8280
|
// swap root
|
8281
|
if (overRoot.children().length > 0) {
|
8282
|
overChild = overElement.closest('.'+this.options.childClass);
|
8283
|
|
8284
|
if (overChild.length) {
|
8285
|
overChild.before($current);
|
8286
|
} else {
|
8287
|
overRoot.append($current);
|
8288
|
}
|
8289
|
|
8290
|
} else { // empty list
|
8291
|
overElement.append($current);
|
8292
|
}
|
8293
|
|
8294
|
UI.$doc.trigger('mouseover');
|
8295
|
}
|
8296
|
|
8297
|
this.checkEmptyList();
|
8298
|
this.checkEmptyList(currentRoot);
|
8299
|
},
|
8300
|
|
8301
|
dragEnter: function(e, elem) {
|
8302
|
|
8303
|
if (!currentlyDraggingElement || currentlyDraggingElement === elem) {
|
8304
|
return true;
|
8305
|
}
|
8306
|
|
8307
|
var previousCounter = this.dragenterData(elem);
|
8308
|
|
8309
|
this.dragenterData(elem, previousCounter + 1);
|
8310
|
|
8311
|
// Prevent dragenter on a child from allowing a dragleave on the container
|
8312
|
if (previousCounter === 0) {
|
8313
|
|
8314
|
var currentlist = UI.$(elem).parent(),
|
8315
|
startlist = UI.$(currentlyDraggingElement).data('start-list');
|
8316
|
|
8317
|
if (currentlist[0] !== startlist[0]) {
|
8318
|
|
8319
|
var groupOver = currentlist.data('sortable-group'),
|
8320
|
groupCurrent = UI.$(currentlyDraggingElement).data('sortable-group');
|
8321
|
|
8322
|
if ((groupOver || groupCurrent) && (groupOver != groupCurrent)) {
|
8323
|
return false;
|
8324
|
}
|
8325
|
}
|
8326
|
|
8327
|
UI.$(elem).addClass(this.options.overClass);
|
8328
|
this.moveElementNextTo(currentlyDraggingElement, elem);
|
8329
|
}
|
8330
|
|
8331
|
return false;
|
8332
|
},
|
8333
|
|
8334
|
dragEnd: function(e, elem) {
|
8335
|
|
8336
|
var $this = this;
|
8337
|
|
8338
|
// avoid triggering event twice
|
8339
|
if (currentlyDraggingElement) {
|
8340
|
// TODO: trigger on right element?
|
8341
|
this.options.stop(elem);
|
8342
|
this.trigger('stop.uk.sortable', [this]);
|
8343
|
}
|
8344
|
|
8345
|
currentlyDraggingElement = null;
|
8346
|
currentlyDraggingTarget = null;
|
8347
|
|
8348
|
touchedlists.push(this.element);
|
8349
|
touchedlists.forEach(function(el, i) {
|
8350
|
UI.$(el).children().each(function() {
|
8351
|
if (this.nodeType === 1) {
|
8352
|
UI.$(this).removeClass($this.options.overClass)
|
8353
|
.removeClass($this.options.placeholderClass)
|
8354
|
.removeClass($this.options.childClass);
|
8355
|
$this.dragenterData(this, false);
|
8356
|
}
|
8357
|
});
|
8358
|
});
|
8359
|
|
8360
|
touchedlists = [];
|
8361
|
|
8362
|
UI.$html.removeClass(this.options.dragMovingClass);
|
8363
|
|
8364
|
this.removeDragHandlers();
|
8365
|
|
8366
|
if (draggingPlaceholder) {
|
8367
|
draggingPlaceholder.remove();
|
8368
|
draggingPlaceholder = null;
|
8369
|
}
|
8370
|
},
|
8371
|
|
8372
|
dragDrop: function(e, elem) {
|
8373
|
|
8374
|
if (e.type === 'drop') {
|
8375
|
|
8376
|
if (e.stopPropagation) {
|
8377
|
e.stopPropagation();
|
8378
|
}
|
8379
|
|
8380
|
if (e.preventDefault) {
|
8381
|
e.preventDefault();
|
8382
|
}
|
8383
|
}
|
8384
|
|
8385
|
this.triggerChangeEvents();
|
8386
|
},
|
8387
|
|
8388
|
triggerChangeEvents: function() {
|
8389
|
|
8390
|
// trigger events once
|
8391
|
if (!currentlyDraggingElement) return;
|
8392
|
|
8393
|
var $current = UI.$(currentlyDraggingElement),
|
8394
|
oldRoot = draggingPlaceholder.data('origin'),
|
8395
|
newRoot = $current.closest('.'+this.options.baseClass),
|
8396
|
triggers = [],
|
8397
|
el = UI.$(currentlyDraggingElement);
|
8398
|
|
8399
|
// events depending on move inside lists or across lists
|
8400
|
if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) {
|
8401
|
triggers.push({sortable: this, mode: 'moved'});
|
8402
|
} else if (oldRoot[0] != newRoot[0]) {
|
8403
|
triggers.push({sortable: UI.$(newRoot).data('sortable'), mode: 'added'}, {sortable: UI.$(oldRoot).data('sortable'), mode: 'removed'});
|
8404
|
}
|
8405
|
|
8406
|
triggers.forEach(function (trigger, i) {
|
8407
|
if (trigger.sortable) {
|
8408
|
trigger.sortable.element.trigger('change.uk.sortable', [trigger.sortable, el, trigger.mode]);
|
8409
|
}
|
8410
|
});
|
8411
|
},
|
8412
|
|
8413
|
dragenterData: function(element, val) {
|
8414
|
|
8415
|
element = UI.$(element);
|
8416
|
|
8417
|
if (arguments.length == 1) {
|
8418
|
return parseInt(element.data('child-dragenter'), 10) || 0;
|
8419
|
} else if (!val) {
|
8420
|
element.removeData('child-dragenter');
|
8421
|
} else {
|
8422
|
element.data('child-dragenter', Math.max(0, val));
|
8423
|
}
|
8424
|
},
|
8425
|
|
8426
|
moveElementNextTo: function(element, elementToMoveNextTo) {
|
8427
|
|
8428
|
dragging = true;
|
8429
|
|
8430
|
var $this = this,
|
8431
|
list = UI.$(element).parent().css('min-height', ''),
|
8432
|
next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
|
8433
|
children = list.children(),
|
8434
|
count = children.length;
|
8435
|
|
8436
|
if (!$this.options.animation) {
|
8437
|
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
8438
|
UI.Utils.checkDisplay($this.element.parent());
|
8439
|
return;
|
8440
|
}
|
8441
|
|
8442
|
list.css('min-height', list.height());
|
8443
|
|
8444
|
children.stop().each(function(){
|
8445
|
var ele = UI.$(this),
|
8446
|
offset = ele.position();
|
8447
|
|
8448
|
offset.width = ele.width();
|
8449
|
|
8450
|
ele.data('offset-before', offset);
|
8451
|
});
|
8452
|
|
8453
|
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
8454
|
|
8455
|
UI.Utils.checkDisplay($this.element.parent());
|
8456
|
|
8457
|
children = list.children().each(function() {
|
8458
|
var ele = UI.$(this);
|
8459
|
ele.data('offset-after', ele.position());
|
8460
|
}).each(function() {
|
8461
|
var ele = UI.$(this),
|
8462
|
before = ele.data('offset-before');
|
8463
|
ele.css({position:'absolute', top:before.top, left:before.left, minWidth:before.width });
|
8464
|
});
|
8465
|
|
8466
|
children.each(function(){
|
8467
|
|
8468
|
var ele = UI.$(this),
|
8469
|
before = ele.data('offset-before'),
|
8470
|
offset = ele.data('offset-after');
|
8471
|
|
8472
|
ele.css('pointer-events', 'none').width();
|
8473
|
|
8474
|
setTimeout(function(){
|
8475
|
ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
|
8476
|
ele.css({position:'',top:'', left:'', minWidth: '', 'pointer-events':''}).removeClass($this.options.overClass).removeData('child-dragenter');
|
8477
|
count--;
|
8478
|
if (!count) {
|
8479
|
list.css('min-height', '');
|
8480
|
UI.Utils.checkDisplay($this.element.parent());
|
8481
|
}
|
8482
|
});
|
8483
|
}, 0);
|
8484
|
});
|
8485
|
},
|
8486
|
|
8487
|
serialize: function() {
|
8488
|
|
8489
|
var data = [], item, attribute;
|
8490
|
|
8491
|
this.element.children().each(function(j, child) {
|
8492
|
item = {};
|
8493
|
for (var i = 0, attr, val; i < child.attributes.length; i++) {
|
8494
|
attribute = child.attributes[i];
|
8495
|
if (attribute.name.indexOf('data-') === 0) {
|
8496
|
attr = attribute.name.substr(5);
|
8497
|
val = UI.Utils.str2json(attribute.value);
|
8498
|
item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
|
8499
|
}
|
8500
|
}
|
8501
|
data.push(item);
|
8502
|
});
|
8503
|
|
8504
|
return data;
|
8505
|
},
|
8506
|
|
8507
|
checkEmptyList: function(list) {
|
8508
|
|
8509
|
list = list ? UI.$(list) : this.element;
|
8510
|
|
8511
|
if (this.options.emptyClass) {
|
8512
|
list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
|
8513
|
}
|
8514
|
}
|
8515
|
});
|
8516
|
|
8517
|
// helpers
|
8518
|
|
8519
|
function isBelow(el1, el2) {
|
8520
|
|
8521
|
var parent = el1.parentNode;
|
8522
|
|
8523
|
if (el2.parentNode != parent) {
|
8524
|
return false;
|
8525
|
}
|
8526
|
|
8527
|
var cur = el1.previousSibling;
|
8528
|
|
8529
|
while (cur && cur.nodeType !== 9) {
|
8530
|
if (cur === el2) {
|
8531
|
return true;
|
8532
|
}
|
8533
|
cur = cur.previousSibling;
|
8534
|
}
|
8535
|
|
8536
|
return false;
|
8537
|
}
|
8538
|
|
8539
|
function moveUpToChildNode(parent, child) {
|
8540
|
var cur = child;
|
8541
|
if (cur == parent) { return null; }
|
8542
|
|
8543
|
while (cur) {
|
8544
|
if (cur.parentNode === parent) {
|
8545
|
return cur;
|
8546
|
}
|
8547
|
|
8548
|
cur = cur.parentNode;
|
8549
|
if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
|
8550
|
break;
|
8551
|
}
|
8552
|
}
|
8553
|
return null;
|
8554
|
}
|
8555
|
|
8556
|
function prevent(e) {
|
8557
|
if (e.stopPropagation) {
|
8558
|
e.stopPropagation();
|
8559
|
}
|
8560
|
if (e.preventDefault) {
|
8561
|
e.preventDefault();
|
8562
|
}
|
8563
|
e.returnValue = false;
|
8564
|
}
|
8565
|
|
8566
|
return UI.sortable;
|
8567
|
});
|
8568
|
|
8569
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
8570
|
(function(addon) {
|
8571
|
|
8572
|
var component;
|
8573
|
|
8574
|
if (window.UIkit2) {
|
8575
|
component = addon(UIkit2);
|
8576
|
}
|
8577
|
|
8578
|
if (typeof define == 'function' && define.amd) {
|
8579
|
define('uikit-sticky', ['uikit'], function(){
|
8580
|
return component || addon(UIkit2);
|
8581
|
});
|
8582
|
}
|
8583
|
|
8584
|
})(function(UI){
|
8585
|
|
8586
|
"use strict";
|
8587
|
|
8588
|
var $win = UI.$win,
|
8589
|
$doc = UI.$doc,
|
8590
|
sticked = [],
|
8591
|
direction = 1;
|
8592
|
|
8593
|
UI.component('sticky', {
|
8594
|
|
8595
|
defaults: {
|
8596
|
top : 0,
|
8597
|
bottom : 0,
|
8598
|
animation : '',
|
8599
|
clsinit : 'uk-sticky-init',
|
8600
|
clsactive : 'uk-active',
|
8601
|
clsinactive : '',
|
8602
|
getWidthFrom : '',
|
8603
|
showup : false,
|
8604
|
boundary : false,
|
8605
|
media : false,
|
8606
|
target : false,
|
8607
|
disabled : false
|
8608
|
},
|
8609
|
|
8610
|
boot: function() {
|
8611
|
|
8612
|
// should be more efficient than using $win.scroll(checkscrollposition):
|
8613
|
UI.$doc.on('scrolling.uk.document', function(e, data) {
|
8614
|
if (!data || !data.dir) return;
|
8615
|
direction = data.dir.y;
|
8616
|
checkscrollposition();
|
8617
|
});
|
8618
|
|
8619
|
UI.$win.on('resize orientationchange', UI.Utils.debounce(function() {
|
8620
|
|
8621
|
if (!sticked.length) return;
|
8622
|
|
8623
|
for (var i = 0; i < sticked.length; i++) {
|
8624
|
sticked[i].reset(true);
|
8625
|
sticked[i].self.computeWrapper();
|
8626
|
}
|
8627
|
|
8628
|
checkscrollposition();
|
8629
|
}, 100));
|
8630
|
|
8631
|
// init code
|
8632
|
UI.ready(function(context) {
|
8633
|
|
8634
|
setTimeout(function(){
|
8635
|
|
8636
|
UI.$('[data-uk-sticky]', context).each(function(){
|
8637
|
|
8638
|
var $ele = UI.$(this);
|
8639
|
|
8640
|
if (!$ele.data('sticky')) {
|
8641
|
UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
|
8642
|
}
|
8643
|
});
|
8644
|
|
8645
|
checkscrollposition();
|
8646
|
}, 0);
|
8647
|
});
|
8648
|
},
|
8649
|
|
8650
|
init: function() {
|
8651
|
|
8652
|
var boundary = this.options.boundary, boundtoparent;
|
8653
|
|
8654
|
this.wrapper = this.element.wrap('<div class="uk-sticky-placeholder"></div>').parent();
|
8655
|
this.computeWrapper();
|
8656
|
this.wrapper.css({
|
8657
|
'margin-top' : this.element.css('margin-top'),
|
8658
|
'margin-bottom' : this.element.css('margin-bottom'),
|
8659
|
'margin-left' : this.element.css('margin-left'),
|
8660
|
'margin-right' : this.element.css('margin-right')
|
8661
|
})
|
8662
|
this.element.css('margin', 0);
|
8663
|
|
8664
|
if (boundary) {
|
8665
|
|
8666
|
if (boundary === true || boundary[0] === '!') {
|
8667
|
|
8668
|
boundary = boundary === true ? this.wrapper.parent() : this.wrapper.closest(boundary.substr(1));
|
8669
|
boundtoparent = true;
|
8670
|
|
8671
|
} else if (typeof boundary === "string") {
|
8672
|
boundary = UI.$(boundary);
|
8673
|
}
|
8674
|
}
|
8675
|
|
8676
|
this.sticky = {
|
8677
|
self : this,
|
8678
|
options : this.options,
|
8679
|
element : this.element,
|
8680
|
currentTop : null,
|
8681
|
wrapper : this.wrapper,
|
8682
|
init : false,
|
8683
|
getWidthFrom : UI.$(this.options.getWidthFrom || this.wrapper),
|
8684
|
boundary : boundary,
|
8685
|
boundtoparent : boundtoparent,
|
8686
|
top : 0,
|
8687
|
calcTop : function() {
|
8688
|
|
8689
|
var top = this.options.top;
|
8690
|
|
8691
|
// dynamic top parameter
|
8692
|
if (this.options.top && typeof(this.options.top) == 'string') {
|
8693
|
|
8694
|
// e.g. 50vh
|
8695
|
if (this.options.top.match(/^(-|)(\d+)vh$/)) {
|
8696
|
top = window.innerHeight * parseInt(this.options.top, 10)/100;
|
8697
|
// e.g. #elementId, or .class-1,class-2,.class-3 (first found is used)
|
8698
|
} else {
|
8699
|
|
8700
|
var topElement = UI.$(this.options.top).first();
|
8701
|
|
8702
|
if (topElement.length && topElement.is(':visible')) {
|
8703
|
top = -1 * ((topElement.offset().top + topElement.outerHeight()) - this.wrapper.offset().top);
|
8704
|
}
|
8705
|
}
|
8706
|
|
8707
|
}
|
8708
|
|
8709
|
this.top = top;
|
8710
|
},
|
8711
|
|
8712
|
reset: function(force) {
|
8713
|
|
8714
|
this.calcTop();
|
8715
|
|
8716
|
var finalize = function() {
|
8717
|
this.element.css({position:'', top:'', width:'', left:'', margin:'0'});
|
8718
|
this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
|
8719
|
this.element.addClass(this.options.clsinactive);
|
8720
|
this.element.trigger('inactive.uk.sticky');
|
8721
|
|
8722
|
this.currentTop = null;
|
8723
|
this.animate = false;
|
8724
|
|
8725
|
}.bind(this);
|
8726
|
|
8727
|
|
8728
|
if (!force && this.options.animation && UI.support.animation && !UI.Utils.isInView(this.wrapper)) {
|
8729
|
|
8730
|
this.animate = true;
|
8731
|
|
8732
|
this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
|
8733
|
finalize();
|
8734
|
}).width(); // force redraw
|
8735
|
|
8736
|
this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
|
8737
|
} else {
|
8738
|
finalize();
|
8739
|
}
|
8740
|
},
|
8741
|
|
8742
|
check: function() {
|
8743
|
|
8744
|
if (this.options.disabled) {
|
8745
|
return false;
|
8746
|
}
|
8747
|
|
8748
|
if (this.options.media) {
|
8749
|
|
8750
|
switch(typeof(this.options.media)) {
|
8751
|
case 'number':
|
8752
|
if (window.innerWidth < this.options.media) {
|
8753
|
return false;
|
8754
|
}
|
8755
|
break;
|
8756
|
case 'string':
|
8757
|
if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
|
8758
|
return false;
|
8759
|
}
|
8760
|
break;
|
8761
|
}
|
8762
|
}
|
8763
|
|
8764
|
var scrollTop = $win.scrollTop(),
|
8765
|
documentHeight = $doc.height(),
|
8766
|
dwh = documentHeight - window.innerHeight,
|
8767
|
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
8768
|
elementTop = this.wrapper.offset().top,
|
8769
|
etse = elementTop - this.top - extra,
|
8770
|
active = (scrollTop >= etse);
|
8771
|
|
8772
|
if (active && this.options.showup) {
|
8773
|
|
8774
|
// set inactiv if scrolling down
|
8775
|
if (direction == 1) {
|
8776
|
active = false;
|
8777
|
}
|
8778
|
|
8779
|
// set inactive when wrapper is still in view
|
8780
|
if (direction == -1 && !this.element.hasClass(this.options.clsactive) && UI.Utils.isInView(this.wrapper)) {
|
8781
|
active = false;
|
8782
|
}
|
8783
|
}
|
8784
|
|
8785
|
return active;
|
8786
|
}
|
8787
|
};
|
8788
|
|
8789
|
this.sticky.calcTop();
|
8790
|
|
8791
|
sticked.push(this.sticky);
|
8792
|
},
|
8793
|
|
8794
|
update: function() {
|
8795
|
checkscrollposition(this.sticky);
|
8796
|
},
|
8797
|
|
8798
|
enable: function() {
|
8799
|
this.options.disabled = false;
|
8800
|
this.update();
|
8801
|
},
|
8802
|
|
8803
|
disable: function(force) {
|
8804
|
this.options.disabled = true;
|
8805
|
this.sticky.reset(force);
|
8806
|
},
|
8807
|
|
8808
|
computeWrapper: function() {
|
8809
|
|
8810
|
this.wrapper.css({
|
8811
|
'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
|
8812
|
'float' : this.element.css('float') != 'none' ? this.element.css('float') : ''
|
8813
|
});
|
8814
|
|
8815
|
if (this.element.css('position') == 'fixed') {
|
8816
|
this.element.css({
|
8817
|
width: this.sticky.getWidthFrom.length ? this.sticky.getWidthFrom.width() : this.element.width()
|
8818
|
});
|
8819
|
}
|
8820
|
}
|
8821
|
});
|
8822
|
|
8823
|
function checkscrollposition(direction) {
|
8824
|
|
8825
|
var stickies = arguments.length ? arguments : sticked;
|
8826
|
|
8827
|
if (!stickies.length || $win.scrollTop() < 0) return;
|
8828
|
|
8829
|
var scrollTop = $win.scrollTop(),
|
8830
|
documentHeight = $doc.height(),
|
8831
|
windowHeight = $win.height(),
|
8832
|
dwh = documentHeight - windowHeight,
|
8833
|
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
8834
|
newTop, containerBottom, stickyHeight, sticky;
|
8835
|
|
8836
|
for (var i = 0; i < stickies.length; i++) {
|
8837
|
|
8838
|
sticky = stickies[i];
|
8839
|
|
8840
|
if (!sticky.element.is(':visible') || sticky.animate) {
|
8841
|
continue;
|
8842
|
}
|
8843
|
|
8844
|
if (!sticky.check()) {
|
8845
|
|
8846
|
if (sticky.currentTop !== null) {
|
8847
|
sticky.reset();
|
8848
|
}
|
8849
|
|
8850
|
} else {
|
8851
|
|
8852
|
if (sticky.top < 0) {
|
8853
|
newTop = 0;
|
8854
|
} else {
|
8855
|
stickyHeight = sticky.element.outerHeight();
|
8856
|
newTop = documentHeight - stickyHeight - sticky.top - sticky.options.bottom - scrollTop - extra;
|
8857
|
newTop = newTop < 0 ? newTop + sticky.top : sticky.top;
|
8858
|
}
|
8859
|
|
8860
|
if (sticky.boundary && sticky.boundary.length) {
|
8861
|
|
8862
|
var bTop = sticky.boundary.offset().top;
|
8863
|
|
8864
|
if (sticky.boundtoparent) {
|
8865
|
containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
|
8866
|
} else {
|
8867
|
containerBottom = documentHeight - bTop;
|
8868
|
}
|
8869
|
|
8870
|
newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
|
8871
|
}
|
8872
|
|
8873
|
|
8874
|
if (sticky.currentTop != newTop) {
|
8875
|
|
8876
|
sticky.element.css({
|
8877
|
position : 'fixed',
|
8878
|
top : newTop,
|
8879
|
width : sticky.getWidthFrom.length ? sticky.getWidthFrom.width() : sticky.element.width()
|
8880
|
});
|
8881
|
|
8882
|
if (!sticky.init) {
|
8883
|
|
8884
|
sticky.element.addClass(sticky.options.clsinit);
|
8885
|
|
8886
|
if (location.hash && scrollTop > 0 && sticky.options.target) {
|
8887
|
|
8888
|
var $target = UI.$(location.hash);
|
8889
|
|
8890
|
if ($target.length) {
|
8891
|
|
8892
|
setTimeout((function($target, sticky){
|
8893
|
|
8894
|
return function() {
|
8895
|
|
8896
|
sticky.element.width(); // force redraw
|
8897
|
|
8898
|
var offset = $target.offset(),
|
8899
|
maxoffset = offset.top + $target.outerHeight(),
|
8900
|
stickyOffset = sticky.element.offset(),
|
8901
|
stickyHeight = sticky.element.outerHeight(),
|
8902
|
stickyMaxOffset = stickyOffset.top + stickyHeight;
|
8903
|
|
8904
|
if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
|
8905
|
scrollTop = offset.top - stickyHeight - sticky.options.target;
|
8906
|
window.scrollTo(0, scrollTop);
|
8907
|
}
|
8908
|
};
|
8909
|
|
8910
|
})($target, sticky), 0);
|
8911
|
}
|
8912
|
}
|
8913
|
}
|
8914
|
|
8915
|
sticky.element.addClass(sticky.options.clsactive).removeClass(sticky.options.clsinactive);
|
8916
|
sticky.element.trigger('active.uk.sticky');
|
8917
|
sticky.element.css('margin', '');
|
8918
|
|
8919
|
if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) {
|
8920
|
sticky.element.addClass(sticky.options.animation);
|
8921
|
}
|
8922
|
|
8923
|
sticky.currentTop = newTop;
|
8924
|
}
|
8925
|
}
|
8926
|
|
8927
|
sticky.init = true;
|
8928
|
}
|
8929
|
}
|
8930
|
|
8931
|
return UI.sticky;
|
8932
|
});
|
8933
|
|
8934
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
8935
|
(function(addon) {
|
8936
|
var component;
|
8937
|
|
8938
|
if (window.UIkit2) {
|
8939
|
component = addon(UIkit2);
|
8940
|
}
|
8941
|
|
8942
|
if (typeof define == 'function' && define.amd) {
|
8943
|
define('uikit-tooltip', ['uikit'], function(){
|
8944
|
return component || addon(UIkit2);
|
8945
|
});
|
8946
|
}
|
8947
|
|
8948
|
})(function(UI){
|
8949
|
|
8950
|
"use strict";
|
8951
|
|
8952
|
var $tooltip, // tooltip container
|
8953
|
tooltipdelay, checkIdle;
|
8954
|
|
8955
|
UI.component('tooltip', {
|
8956
|
|
8957
|
defaults: {
|
8958
|
offset: 5,
|
8959
|
pos: 'top',
|
8960
|
animation: false,
|
8961
|
delay: 0, // in miliseconds
|
8962
|
cls: '',
|
8963
|
activeClass: 'uk-active',
|
8964
|
src: function(ele) {
|
8965
|
var title = ele.attr('title');
|
8966
|
|
8967
|
if (title !== undefined) {
|
8968
|
ele.data('cached-title', title).removeAttr('title');
|
8969
|
}
|
8970
|
|
8971
|
return ele.data("cached-title");
|
8972
|
}
|
8973
|
},
|
8974
|
|
8975
|
tip: '',
|
8976
|
|
8977
|
boot: function() {
|
8978
|
|
8979
|
// init code
|
8980
|
UI.$html.on('mouseenter.tooltip.uikit focus.tooltip.uikit', '[data-uk-tooltip]', function(e) {
|
8981
|
var ele = UI.$(this);
|
8982
|
|
8983
|
if (!ele.data('tooltip')) {
|
8984
|
UI.tooltip(ele, UI.Utils.options(ele.attr('data-uk-tooltip')));
|
8985
|
ele.trigger('mouseenter');
|
8986
|
}
|
8987
|
});
|
8988
|
},
|
8989
|
|
8990
|
init: function() {
|
8991
|
|
8992
|
var $this = this;
|
8993
|
|
8994
|
if (!$tooltip) {
|
8995
|
$tooltip = UI.$('<div class="uk-tooltip"></div>').appendTo("body");
|
8996
|
}
|
8997
|
|
8998
|
this.on({
|
8999
|
focus : function(e) { $this.show(); },
|
9000
|
blur : function(e) { $this.hide(); },
|
9001
|
mouseenter : function(e) { $this.show(); },
|
9002
|
mouseleave : function(e) { $this.hide(); }
|
9003
|
});
|
9004
|
},
|
9005
|
|
9006
|
show: function() {
|
9007
|
|
9008
|
this.tip = typeof(this.options.src) === 'function' ? this.options.src(this.element) : this.options.src;
|
9009
|
|
9010
|
if (tooltipdelay) clearTimeout(tooltipdelay);
|
9011
|
if (checkIdle) clearInterval(checkIdle);
|
9012
|
|
9013
|
if (typeof(this.tip) === 'string' ? !this.tip.length:true) return;
|
9014
|
|
9015
|
$tooltip.stop().css({top: -2000, visibility: 'hidden'}).removeClass(this.options.activeClass).show();
|
9016
|
$tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
|
9017
|
|
9018
|
var $this = this,
|
9019
|
pos = UI.$.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
|
9020
|
width = $tooltip[0].offsetWidth,
|
9021
|
height = $tooltip[0].offsetHeight,
|
9022
|
offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
|
9023
|
position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
|
9024
|
tmppos = position.split("-"),
|
9025
|
tcss = {
|
9026
|
display : 'none',
|
9027
|
visibility : 'visible',
|
9028
|
top : (pos.top + pos.height + height),
|
9029
|
left : pos.left
|
9030
|
};
|
9031
|
|
9032
|
|
9033
|
// prevent strange position
|
9034
|
// when tooltip is in offcanvas etc.
|
9035
|
if (UI.$html.css('position')=='fixed' || UI.$body.css('position')=='fixed'){
|
9036
|
var bodyoffset = UI.$('body').offset(),
|
9037
|
htmloffset = UI.$('html').offset(),
|
9038
|
docoffset = {top: (htmloffset.top + bodyoffset.top), left: (htmloffset.left + bodyoffset.left)};
|
9039
|
|
9040
|
pos.left -= docoffset.left;
|
9041
|
pos.top -= docoffset.top;
|
9042
|
}
|
9043
|
|
9044
|
|
9045
|
if ((tmppos[0] == 'left' || tmppos[0] == 'right') && UI.langdirection == 'right') {
|
9046
|
tmppos[0] = tmppos[0] == 'left' ? 'right' : 'left';
|
9047
|
}
|
9048
|
|
9049
|
var variants = {
|
9050
|
bottom : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
|
9051
|
top : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
|
9052
|
left : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
|
9053
|
right : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
|
9054
|
};
|
9055
|
|
9056
|
UI.$.extend(tcss, variants[tmppos[0]]);
|
9057
|
|
9058
|
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
|
9059
|
|
9060
|
var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
|
9061
|
|
9062
|
if(boundary) {
|
9063
|
|
9064
|
switch(boundary) {
|
9065
|
case 'x':
|
9066
|
|
9067
|
if (tmppos.length == 2) {
|
9068
|
position = tmppos[0]+"-"+(tcss.left < 0 ? 'left': 'right');
|
9069
|
} else {
|
9070
|
position = tcss.left < 0 ? 'right': 'left';
|
9071
|
}
|
9072
|
|
9073
|
break;
|
9074
|
|
9075
|
case 'y':
|
9076
|
if (tmppos.length == 2) {
|
9077
|
position = (tcss.top < 0 ? 'bottom': 'top')+'-'+tmppos[1];
|
9078
|
} else {
|
9079
|
position = (tcss.top < 0 ? 'bottom': 'top');
|
9080
|
}
|
9081
|
|
9082
|
break;
|
9083
|
|
9084
|
case 'xy':
|
9085
|
if (tmppos.length == 2) {
|
9086
|
position = (tcss.top < 0 ? 'bottom': 'top')+'-'+(tcss.left < 0 ? 'left': 'right');
|
9087
|
} else {
|
9088
|
position = tcss.left < 0 ? 'right': 'left';
|
9089
|
}
|
9090
|
|
9091
|
break;
|
9092
|
|
9093
|
}
|
9094
|
|
9095
|
tmppos = position.split('-');
|
9096
|
|
9097
|
UI.$.extend(tcss, variants[tmppos[0]]);
|
9098
|
|
9099
|
if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
|
9100
|
}
|
9101
|
|
9102
|
|
9103
|
tcss.left -= UI.$body.position().left;
|
9104
|
|
9105
|
tooltipdelay = setTimeout(function(){
|
9106
|
|
9107
|
$tooltip.css(tcss).attr('class', ['uk-tooltip', 'uk-tooltip-'+position, $this.options.cls].join(' '));
|
9108
|
|
9109
|
if ($this.options.animation) {
|
9110
|
$tooltip.css({opacity: 0, display: 'block'}).addClass($this.options.activeClass).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
|
9111
|
} else {
|
9112
|
$tooltip.show().addClass($this.options.activeClass);
|
9113
|
}
|
9114
|
|
9115
|
tooltipdelay = false;
|
9116
|
|
9117
|
// close tooltip if element was removed or hidden
|
9118
|
checkIdle = setInterval(function(){
|
9119
|
if(!$this.element.is(':visible')) $this.hide();
|
9120
|
}, 150);
|
9121
|
|
9122
|
}, parseInt(this.options.delay, 10) || 0);
|
9123
|
},
|
9124
|
|
9125
|
hide: function() {
|
9126
|
|
9127
|
if (this.element.is('input') && this.element[0]===document.activeElement) return;
|
9128
|
|
9129
|
if (tooltipdelay) clearTimeout(tooltipdelay);
|
9130
|
if (checkIdle) clearInterval(checkIdle);
|
9131
|
|
9132
|
$tooltip.stop();
|
9133
|
|
9134
|
if (this.options.animation) {
|
9135
|
|
9136
|
var $this = this;
|
9137
|
|
9138
|
$tooltip.fadeOut(parseInt(this.options.animation, 10) || 400, function(){
|
9139
|
$tooltip.removeClass($this.options.activeClass)
|
9140
|
});
|
9141
|
|
9142
|
} else {
|
9143
|
$tooltip.hide().removeClass(this.options.activeClass);
|
9144
|
}
|
9145
|
},
|
9146
|
|
9147
|
content: function() {
|
9148
|
return this.tip;
|
9149
|
},
|
9150
|
|
9151
|
checkBoundary: function(left, top, width, height) {
|
9152
|
|
9153
|
var axis = "";
|
9154
|
|
9155
|
if(left < 0 || ((left - UI.$win.scrollLeft())+width) > window.innerWidth) {
|
9156
|
axis += "x";
|
9157
|
}
|
9158
|
|
9159
|
if(top < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
|
9160
|
axis += "y";
|
9161
|
}
|
9162
|
|
9163
|
return axis;
|
9164
|
}
|
9165
|
});
|
9166
|
|
9167
|
return UI.tooltip;
|
9168
|
});
|
9169
|
|
9170
|
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
9171
|
(function(addon) {
|
9172
|
|
9173
|
var component;
|
9174
|
|
9175
|
if (window.UIkit) {
|
9176
|
component = addon(UIkit);
|
9177
|
}
|
9178
|
|
9179
|
if (typeof define == "function" && define.amd) {
|
9180
|
define("uikit-timepicker", ["uikit"], function(){
|
9181
|
return component || addon(UIkit);
|
9182
|
});
|
9183
|
}
|
9184
|
|
9185
|
})(function(UI){
|
9186
|
|
9187
|
"use strict";
|
9188
|
|
9189
|
|
9190
|
UI.component('timepicker', {
|
9191
|
|
9192
|
defaults: {
|
9193
|
format : '24h',
|
9194
|
delay : 0,
|
9195
|
start : 0,
|
9196
|
end : 24
|
9197
|
},
|
9198
|
|
9199
|
boot: function() {
|
9200
|
|
9201
|
// init code
|
9202
|
UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
|
9203
|
|
9204
|
var ele = UI.$(this);
|
9205
|
|
9206
|
if (!ele.data("timepicker")) {
|
9207
|
var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
|
9208
|
|
9209
|
setTimeout(function(){
|
9210
|
obj.autocomplete.input.focus();
|
9211
|
}, 40);
|
9212
|
}
|
9213
|
});
|
9214
|
},
|
9215
|
|
9216
|
init: function() {
|
9217
|
|
9218
|
var $this = this, times = getTimeRange(this.options.start, this.options.end), container;
|
9219
|
|
9220
|
this.options.minLength = 0;
|
9221
|
this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a class="needsclick">{{$item.value}}</a></li>{{/items}}</ul>';
|
9222
|
|
9223
|
this.options.source = function(release) {
|
9224
|
release(times[$this.options.format] || times['12h']);
|
9225
|
};
|
9226
|
|
9227
|
if (this.element.is('input')) {
|
9228
|
this.element.wrap('<div class="uk-autocomplete"></div>');
|
9229
|
container = this.element.parent();
|
9230
|
} else {
|
9231
|
container = this.element.addClass('uk-autocomplete');
|
9232
|
}
|
9233
|
|
9234
|
this.autocomplete = UI.autocomplete(container, this.options);
|
9235
|
this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
|
9236
|
|
9237
|
this.autocomplete.on('show.uk.autocomplete', function() {
|
9238
|
|
9239
|
var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
|
9240
|
|
9241
|
setTimeout(function(){
|
9242
|
$this.autocomplete.pick(selected, true);
|
9243
|
}, 10);
|
9244
|
});
|
9245
|
|
9246
|
this.autocomplete.input.on('focus', function(){
|
9247
|
|
9248
|
$this.autocomplete.value = Math.random();
|
9249
|
$this.autocomplete.triggercomplete();
|
9250
|
|
9251
|
}).on('blur', UI.Utils.debounce(function() {
|
9252
|
$this.checkTime();
|
9253
|
}, 100));
|
9254
|
|
9255
|
this.element.data("timepicker", this);
|
9256
|
},
|
9257
|
|
9258
|
checkTime: function() {
|
9259
|
|
9260
|
var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
|
9261
|
|
9262
|
if (this.options.format == '12h') {
|
9263
|
arr = time.split(' ');
|
9264
|
timeArray = arr[0].split(':');
|
9265
|
meridian = arr[1];
|
9266
|
} else {
|
9267
|
timeArray = time.split(':');
|
9268
|
}
|
9269
|
|
9270
|
hour = parseInt(timeArray[0], 10);
|
9271
|
minute = parseInt(timeArray[1], 10);
|
9272
|
|
9273
|
if (isNaN(hour)) hour = 0;
|
9274
|
if (isNaN(minute)) minute = 0;
|
9275
|
|
9276
|
if (this.options.format == '12h') {
|
9277
|
if (hour > 12) {
|
9278
|
hour = 12;
|
9279
|
} else if (hour < 0) {
|
9280
|
hour = 12;
|
9281
|
}
|
9282
|
|
9283
|
if (meridian === 'am' || meridian === 'a') {
|
9284
|
meridian = 'AM';
|
9285
|
} else if (meridian === 'pm' || meridian === 'p') {
|
9286
|
meridian = 'PM';
|
9287
|
}
|
9288
|
|
9289
|
if (meridian !== 'AM' && meridian !== 'PM') {
|
9290
|
meridian = 'AM';
|
9291
|
}
|
9292
|
|
9293
|
} else {
|
9294
|
|
9295
|
if (hour >= 24) {
|
9296
|
hour = 23;
|
9297
|
} else if (hour < 0) {
|
9298
|
hour = 0;
|
9299
|
}
|
9300
|
}
|
9301
|
|
9302
|
if (minute < 0) {
|
9303
|
minute = 0;
|
9304
|
} else if (minute >= 60) {
|
9305
|
minute = 0;
|
9306
|
}
|
9307
|
|
9308
|
this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
|
9309
|
},
|
9310
|
|
9311
|
formatTime: function(hour, minute, meridian) {
|
9312
|
hour = hour < 10 ? '0' + hour : hour;
|
9313
|
minute = minute < 10 ? '0' + minute : minute;
|
9314
|
return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
|
9315
|
}
|
9316
|
});
|
9317
|
|
9318
|
// helper
|
9319
|
|
9320
|
function getTimeRange(start, end) {
|
9321
|
|
9322
|
start = start || 0;
|
9323
|
end = end || 24;
|
9324
|
|
9325
|
var times = {'12h':[], '24h':[]}, i, h;
|
9326
|
|
9327
|
for (i = start, h=''; i<end; i++) {
|
9328
|
|
9329
|
h = ''+i;
|
9330
|
|
9331
|
if (i<10) h = '0'+h;
|
9332
|
|
9333
|
times['24h'].push({value: (h+':00')});
|
9334
|
times['24h'].push({value: (h+':30')});
|
9335
|
|
9336
|
if (i === 0) {
|
9337
|
h = 12;
|
9338
|
times['12h'].push({value: (h+':00 AM')});
|
9339
|
times['12h'].push({value: (h+':30 AM')});
|
9340
|
}
|
9341
|
|
9342
|
if (i > 0 && i<13 && i!==12) {
|
9343
|
times['12h'].push({value: (h+':00 AM')});
|
9344
|
times['12h'].push({value: (h+':30 AM')});
|
9345
|
}
|
9346
|
|
9347
|
if (i >= 12) {
|
9348
|
|
9349
|
h = h-12;
|
9350
|
if (h === 0) h = 12;
|
9351
|
if (h < 10) h = '0'+String(h);
|
9352
|
|
9353
|
times['12h'].push({value: (h+':00 PM')});
|
9354
|
times['12h'].push({value: (h+':30 PM')});
|
9355
|
}
|
9356
|
}
|
9357
|
|
9358
|
return times;
|
9359
|
}
|
9360
|
|
9361
|
});
|
9362
|
|
9363
|
/*! UIkit 2.27.5 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
9364
|
(function(addon) {
|
9365
|
|
9366
|
var component;
|
9367
|
|
9368
|
if (window.UIkit2) {
|
9369
|
component = addon(UIkit2);
|
9370
|
}
|
9371
|
|
9372
|
if (typeof define == 'function' && define.amd) {
|
9373
|
define('uikit-upload', ['uikit'], function(){
|
9374
|
return component || addon(UIkit2);
|
9375
|
});
|
9376
|
}
|
9377
|
|
9378
|
})(function(UI){
|
9379
|
|
9380
|
"use strict";
|
9381
|
|
9382
|
UI.component('uploadSelect', {
|
9383
|
|
9384
|
init: function() {
|
9385
|
|
9386
|
var $this = this;
|
9387
|
|
9388
|
this.on('change', function() {
|
9389
|
xhrupload($this.element[0].files, $this.options);
|
9390
|
var twin = $this.element.clone(true).data('uploadSelect', $this);
|
9391
|
$this.element.replaceWith(twin);
|
9392
|
$this.element = twin;
|
9393
|
});
|
9394
|
}
|
9395
|
});
|
9396
|
|
9397
|
UI.component('uploadDrop', {
|
9398
|
|
9399
|
defaults: {
|
9400
|
'dragoverClass': 'uk-dragover'
|
9401
|
},
|
9402
|
|
9403
|
init: function() {
|
9404
|
|
9405
|
var $this = this, hasdragCls = false;
|
9406
|
|
9407
|
this.on('drop', function(e){
|
9408
|
|
9409
|
if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) {
|
9410
|
|
9411
|
e.stopPropagation();
|
9412
|
e.preventDefault();
|
9413
|
|
9414
|
$this.element.removeClass($this.options.dragoverClass);
|
9415
|
$this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]);
|
9416
|
|
9417
|
xhrupload(e.originalEvent.dataTransfer.files, $this.options);
|
9418
|
}
|
9419
|
|
9420
|
}).on('dragenter', function(e){
|
9421
|
e.stopPropagation();
|
9422
|
e.preventDefault();
|
9423
|
}).on('dragover', function(e){
|
9424
|
e.stopPropagation();
|
9425
|
e.preventDefault();
|
9426
|
|
9427
|
if (!hasdragCls) {
|
9428
|
$this.element.addClass($this.options.dragoverClass);
|
9429
|
hasdragCls = true;
|
9430
|
}
|
9431
|
}).on('dragleave', function(e){
|
9432
|
e.stopPropagation();
|
9433
|
e.preventDefault();
|
9434
|
$this.element.removeClass($this.options.dragoverClass);
|
9435
|
hasdragCls = false;
|
9436
|
});
|
9437
|
}
|
9438
|
});
|
9439
|
|
9440
|
|
9441
|
UI.support.ajaxupload = (function() {
|
9442
|
|
9443
|
function supportFileAPI() {
|
9444
|
var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
|
9445
|
}
|
9446
|
|
9447
|
function supportAjaxUploadProgressEvents() {
|
9448
|
var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
|
9449
|
}
|
9450
|
|
9451
|
function supportFormData() {
|
9452
|
return !! window.FormData;
|
9453
|
}
|
9454
|
|
9455
|
return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
|
9456
|
})();
|
9457
|
|
9458
|
|
9459
|
function xhrupload(files, settings) {
|
9460
|
|
9461
|
if (!UI.support.ajaxupload){
|
9462
|
return this;
|
9463
|
}
|
9464
|
|
9465
|
settings = UI.$.extend({}, xhrupload.defaults, settings);
|
9466
|
|
9467
|
if (!files.length){
|
9468
|
return;
|
9469
|
}
|
9470
|
|
9471
|
if (settings.allow !== '*.*') {
|
9472
|
|
9473
|
for(var i=0,file;file=files[i];i++) {
|
9474
|
|
9475
|
if(!matchName(settings.allow, file.name)) {
|
9476
|
|
9477
|
if(typeof(settings.notallowed) == 'string') {
|
9478
|
alert(settings.notallowed);
|
9479
|
} else {
|
9480
|
settings.notallowed(file, settings);
|
9481
|
}
|
9482
|
return;
|
9483
|
}
|
9484
|
}
|
9485
|
}
|
9486
|
|
9487
|
var complete = settings.complete;
|
9488
|
|
9489
|
if (settings.single){
|
9490
|
|
9491
|
var count = files.length,
|
9492
|
uploaded = 0,
|
9493
|
allow = true;
|
9494
|
|
9495
|
settings.beforeAll(files);
|
9496
|
|
9497
|
settings.complete = function(response, xhr){
|
9498
|
|
9499
|
uploaded = uploaded + 1;
|
9500
|
|
9501
|
complete(response, xhr);
|
9502
|
|
9503
|
if (settings.filelimit && uploaded >= settings.filelimit){
|
9504
|
allow = false;
|
9505
|
}
|
9506
|
|
9507
|
if (allow && uploaded<count){
|
9508
|
upload([files[uploaded]], settings);
|
9509
|
} else {
|
9510
|
settings.allcomplete(response, xhr);
|
9511
|
}
|
9512
|
};
|
9513
|
|
9514
|
upload([files[0]], settings);
|
9515
|
|
9516
|
} else {
|
9517
|
|
9518
|
settings.complete = function(response, xhr){
|
9519
|
complete(response, xhr);
|
9520
|
settings.allcomplete(response, xhr);
|
9521
|
};
|
9522
|
|
9523
|
upload(files, settings);
|
9524
|
}
|
9525
|
|
9526
|
function upload(files, settings){
|
9527
|
|
9528
|
// upload all at once
|
9529
|
var formData = new FormData(), xhr = new XMLHttpRequest();
|
9530
|
|
9531
|
if (settings.before(settings, files)===false) return;
|
9532
|
|
9533
|
for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
|
9534
|
for (var p in settings.params) { formData.append(p, settings.params[p]); }
|
9535
|
|
9536
|
// Add any event handlers here...
|
9537
|
xhr.upload.addEventListener('progress', function(e){
|
9538
|
var percent = (e.loaded / e.total)*100;
|
9539
|
settings.progress(percent, e);
|
9540
|
}, false);
|
9541
|
|
9542
|
xhr.addEventListener('loadstart', function(e){ settings.loadstart(e); }, false);
|
9543
|
xhr.addEventListener('load', function(e){ settings.load(e); }, false);
|
9544
|
xhr.addEventListener('loadend', function(e){ settings.loadend(e); }, false);
|
9545
|
xhr.addEventListener('error', function(e){ settings.error(e); }, false);
|
9546
|
xhr.addEventListener('abort', function(e){ settings.abort(e); }, false);
|
9547
|
|
9548
|
xhr.open(settings.method, settings.action, true);
|
9549
|
|
9550
|
if (settings.type=='json') {
|
9551
|
xhr.setRequestHeader('Accept', 'application/json');
|
9552
|
}
|
9553
|
|
9554
|
for (var h in settings.headers) {
|
9555
|
xhr.setRequestHeader(h, settings.headers[h]);
|
9556
|
}
|
9557
|
|
9558
|
xhr.onreadystatechange = function() {
|
9559
|
|
9560
|
settings.readystatechange(xhr);
|
9561
|
|
9562
|
if (xhr.readyState==4){
|
9563
|
|
9564
|
var response = xhr.responseText;
|
9565
|
|
9566
|
if (settings.type=='json') {
|
9567
|
try {
|
9568
|
response = UI.$.parseJSON(response);
|
9569
|
} catch(e) {
|
9570
|
response = false;
|
9571
|
}
|
9572
|
}
|
9573
|
|
9574
|
settings.complete(response, xhr);
|
9575
|
}
|
9576
|
};
|
9577
|
settings.beforeSend(xhr);
|
9578
|
xhr.send(formData);
|
9579
|
}
|
9580
|
}
|
9581
|
|
9582
|
xhrupload.defaults = {
|
9583
|
action: '',
|
9584
|
single: true,
|
9585
|
method: 'POST',
|
9586
|
param : 'files[]',
|
9587
|
params: {},
|
9588
|
allow : '*.*',
|
9589
|
type : 'text',
|
9590
|
filelimit: false,
|
9591
|
headers: {},
|
9592
|
|
9593
|
// events
|
9594
|
before : function(o){},
|
9595
|
beforeSend : function(xhr){},
|
9596
|
beforeAll : function(){},
|
9597
|
loadstart : function(){},
|
9598
|
load : function(){},
|
9599
|
loadend : function(){},
|
9600
|
error : function(){},
|
9601
|
abort : function(){},
|
9602
|
progress : function(){},
|
9603
|
complete : function(){},
|
9604
|
allcomplete : function(){},
|
9605
|
readystatechange: function(){},
|
9606
|
notallowed : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
|
9607
|
};
|
9608
|
|
9609
|
function matchName(pattern, path) {
|
9610
|
|
9611
|
var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
|
9612
|
replace(/\*\*/g, '(\\/[^\\/]+)*').
|
9613
|
replace(/\*/g, '[^\\/]+').
|
9614
|
replace(/((?!\\))\?/g, '$1.') + '$';
|
9615
|
|
9616
|
parsedPattern = '^' + parsedPattern + '$';
|
9617
|
|
9618
|
return (path.match(new RegExp(parsedPattern, 'i')) !== null);
|
9619
|
}
|
9620
|
|
9621
|
UI.Utils.xhrupload = xhrupload;
|
9622
|
|
9623
|
return xhrupload;
|
9624
|
});
|
9625
|
|
9626
|
// http://getuikit.com/docs/documentation_javascript.html#js-override
|
9627
|
|
9628
|
if (typeof UIkit !== 'undefined') {
|
9629
|
|
9630
|
var $body = $('body');
|
9631
|
|
9632
|
UIkit.on('beforeready.uk.dom', function () {
|
9633
|
|
9634
|
// accrodion
|
9635
|
if (typeof UIkit.components.accordion !== "undefined") { // check if accordion component is defined
|
9636
|
$.extend(UIkit.components.accordion.prototype.defaults, {
|
9637
|
easing: $.bez([ 0.35,0,0.25,1 ]),
|
9638
|
duration: 200
|
9639
|
});
|
9640
|
}
|
9641
|
|
9642
|
// dropdown
|
9643
|
if (typeof UIkit.components.dropdown.prototype !== "undefined") { // check if dropdown component is defined
|
9644
|
|
9645
|
$.extend(UIkit.components.dropdown.prototype.defaults, {
|
9646
|
remaintime: 150,
|
9647
|
delay: 50
|
9648
|
});
|
9649
|
|
9650
|
(function() {
|
9651
|
var old_show_function = UIkit.components.dropdown.prototype.show;
|
9652
|
|
9653
|
UIkit.components.dropdown.prototype.show = function() {
|
9654
|
|
9655
|
this.dropdown
|
9656
|
.css({
|
9657
|
'min-width': this.dropdown.outerWidth()
|
9658
|
})
|
9659
|
.addClass('uk-dropdown-active uk-dropdown-shown');
|
9660
|
|
9661
|
return old_show_function.apply(this, arguments);
|
9662
|
}
|
9663
|
})();
|
9664
|
|
9665
|
(function() {
|
9666
|
var old_hide_function = UIkit.components.dropdown.prototype.hide;
|
9667
|
|
9668
|
UIkit.components.dropdown.prototype.hide = function() {
|
9669
|
|
9670
|
var this_dropdown = this.dropdown;
|
9671
|
|
9672
|
this_dropdown.removeClass('uk-dropdown-shown');
|
9673
|
|
9674
|
var dropdown_timeout = setTimeout(function() {
|
9675
|
this_dropdown.removeClass('uk-dropdown-active')
|
9676
|
},280);
|
9677
|
|
9678
|
return old_hide_function.apply(this, arguments);
|
9679
|
}
|
9680
|
})();
|
9681
|
|
9682
|
}
|
9683
|
|
9684
|
// modal
|
9685
|
if (typeof UIkit.components.modal !== "undefined") { // check if modal component is defined
|
9686
|
$.extend(UIkit.components.modal.prototype.defaults, {
|
9687
|
center: true
|
9688
|
});
|
9689
|
|
9690
|
UIkit.modal.dialog.template = '<div class="uk-modal uk-modal-dialog-replace"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
9691
|
$body
|
9692
|
.on('show.uk.modal', '.uk-modal-dialog-replace', function () {
|
9693
|
// customize uikit dialog
|
9694
|
setTimeout(function () {
|
9695
|
var dialogReplace = $('.uk-modal-dialog-replace');
|
9696
|
if (dialogReplace.find('.uk-button-primary').length) {
|
9697
|
var actionBtn = dialogReplace.find('.uk-button-primary').toggleClass('uk-button-primary md-btn-flat-primary');
|
9698
|
if (actionBtn.next('button')) {
|
9699
|
actionBtn.next('button').after(actionBtn);
|
9700
|
}
|
9701
|
}
|
9702
|
if (dialogReplace.find('.uk-button').length) {
|
9703
|
dialogReplace.find('.uk-button').toggleClass('uk-button md-btn md-btn-flat');
|
9704
|
}
|
9705
|
if (dialogReplace.find('.uk-margin-small-top').length) {
|
9706
|
dialogReplace.find('.uk-margin-small-top').toggleClass('uk-margin-small-top uk-margin-top');
|
9707
|
}
|
9708
|
if (dialogReplace.find('input.uk-width-1-1').length) {
|
9709
|
dialogReplace.find('input.uk-width-1-1').toggleClass('uk-width-1-1 md-input');
|
9710
|
// reinitialize md inputs
|
9711
|
altair_md.inputs();
|
9712
|
}
|
9713
|
if (dialogReplace.find('.uk-form').length) {
|
9714
|
dialogReplace.find('.uk-form').removeClass('uk-form');
|
9715
|
}
|
9716
|
}, 50)
|
9717
|
});
|
9718
|
}
|
9719
|
|
9720
|
// tabs
|
9721
|
if (typeof UIkit.components.tab !== "undefined") { // check if tab component is defined
|
9722
|
$.extend(UIkit.components.tab.prototype.defaults, {
|
9723
|
swiping: false
|
9724
|
});
|
9725
|
}
|
9726
|
|
9727
|
// tooltip
|
9728
|
if (typeof UIkit.components.tooltip !== "undefined") { // check if tooltip component is defined
|
9729
|
$.extend(UIkit.components.tooltip.prototype.defaults, {
|
9730
|
animation: UIkit.support.touch ? false : 280,
|
9731
|
offset: 8
|
9732
|
});
|
9733
|
}
|
9734
|
|
9735
|
|
9736
|
// sortable
|
9737
|
if (typeof UIkit.components.sortable !== "undefined") { // check if sortable component is defined
|
9738
|
if(Modernizr.touch) {
|
9739
|
$('[data-uk-sortable]').children().addClass('needsclick');
|
9740
|
}
|
9741
|
}
|
9742
|
|
9743
|
});
|
9744
|
}
|