uikit-on-rails 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbfbb0284b1b444995744fdf2e2fa463cf81f4f1
4
- data.tar.gz: 1615104a0723f47a520c5c46b43017ab495834f9
3
+ metadata.gz: 9463f72bf33330b8ca5418152220cabdc828c96a
4
+ data.tar.gz: 1db431865553dcfeaf27b637ae33ca215fdbc166
5
5
  SHA512:
6
- metadata.gz: a0a557e6757a7e3b30780e6e8429942127889acfba14e83e87bc0fff89e97ff6f5cd4fd649976b23bd7c9ea4658656c6dafe42d60bcda963e8986b26568d4d32
7
- data.tar.gz: 844b6200c6a6a46bebfea5df5e54db04e29ae23a136018b8c4736dcc3a960b8014336ddf3303d0d814898926e2f0ad8598592f362992a6f21ad11bda79ff6ea0
6
+ metadata.gz: fb8c2e681430e6ce36cbaee345ed26ab7746cf5ee66be460d25bbe9a68dd0db42c49d0a8a10753fb9ebf9111951cc692955a18f7cc95da3a74ca19c997628db1
7
+ data.tar.gz: 69b75827b5634586e309d71f217e36fd444ee70659cb4c4fc1139a96e03dafc2ff5217859971d1bfabc20749f499eea1de81031c2da243b6d285f65671931197
@@ -1,7 +1,7 @@
1
1
  module Uikit
2
2
  module Sass
3
3
  module Rails
4
- VERSION = '1.5.1'
4
+ VERSION = '1.5.2'
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,3 @@
1
- //= require uikit/uikit
2
-
3
1
  // Core
4
2
  //= require 'uikit/core/core'
5
3
  //= require 'uikit/core/alert'
@@ -70,7 +70,7 @@
70
70
  var triggerevent = UI.support.touch ? "click" : "mouseenter";
71
71
 
72
72
  // init code
73
- UI.$html.on(triggerevent+".dropdown.uikit focus", "[data-uk-dropdown]", function(e) {
73
+ UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
74
74
 
75
75
  var ele = UI.$(this);
76
76
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uikit-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Boehs
@@ -86,7 +86,6 @@ files:
86
86
  - vendor/assets/javascripts/uikit/core/toggle.js
87
87
  - vendor/assets/javascripts/uikit/core/touch.js
88
88
  - vendor/assets/javascripts/uikit/core/utility.js
89
- - vendor/assets/javascripts/uikit/uikit.js
90
89
  - vendor/assets/stylesheets/extra/font-awesome.scss
91
90
  - vendor/assets/stylesheets/uikit.scss
92
91
  - vendor/assets/stylesheets/uikit/components/accordion.scss
@@ -1,3905 +0,0 @@
1
- /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
- (function(core) {
3
-
4
- if (typeof define == "function" && define.amd) { // AMD
5
-
6
- define("uikit", function(){
7
-
8
- var uikit = window.UIkit || core(window, window.jQuery, window.document);
9
-
10
- uikit.load = function(res, req, onload, config) {
11
-
12
- var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, "");
13
-
14
- if (!base) {
15
- throw new Error( "Please define base path to UIkit in the requirejs config." );
16
- }
17
-
18
- for (i = 0; i < resources.length; i += 1) {
19
- var resource = resources[i].replace(/\./g, '/');
20
- load.push(base+'/components/'+resource);
21
- }
22
-
23
- req(load, function() {
24
- onload(uikit);
25
- });
26
- };
27
-
28
- return uikit;
29
- });
30
- }
31
-
32
- if (!window.jQuery) {
33
- throw new Error( "UIkit requires jQuery" );
34
- }
35
-
36
- if (window && window.jQuery) {
37
- core(window, window.jQuery, window.document);
38
- }
39
-
40
-
41
- })(function(global, $, doc) {
42
-
43
- "use strict";
44
-
45
- var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
46
-
47
- UI.version = '2.27.1';
48
-
49
- UI.noConflict = function() {
50
- // restore UIkit version
51
- if (_UI) {
52
- global.UIkit = _UI;
53
- $.UIkit = _UI;
54
- $.fn.uk = _UI.fn;
55
- }
56
-
57
- return UI;
58
- };
59
-
60
- UI.prefix = function(str) {
61
- return str;
62
- };
63
-
64
- // cache jQuery
65
- UI.$ = $;
66
-
67
- UI.$doc = UI.$(document);
68
- UI.$win = UI.$(window);
69
- UI.$html = UI.$('html');
70
-
71
- UI.support = {};
72
- UI.support.transition = (function() {
73
-
74
- var transitionEnd = (function() {
75
-
76
- var element = doc.body || doc.documentElement,
77
- transEndEventNames = {
78
- WebkitTransition : 'webkitTransitionEnd',
79
- MozTransition : 'transitionend',
80
- OTransition : 'oTransitionEnd otransitionend',
81
- transition : 'transitionend'
82
- }, name;
83
-
84
- for (name in transEndEventNames) {
85
- if (element.style[name] !== undefined) return transEndEventNames[name];
86
- }
87
- }());
88
-
89
- return transitionEnd && { end: transitionEnd };
90
- })();
91
-
92
- UI.support.animation = (function() {
93
-
94
- var animationEnd = (function() {
95
-
96
- var element = doc.body || doc.documentElement,
97
- animEndEventNames = {
98
- WebkitAnimation : 'webkitAnimationEnd',
99
- MozAnimation : 'animationend',
100
- OAnimation : 'oAnimationEnd oanimationend',
101
- animation : 'animationend'
102
- }, name;
103
-
104
- for (name in animEndEventNames) {
105
- if (element.style[name] !== undefined) return animEndEventNames[name];
106
- }
107
- }());
108
-
109
- return animationEnd && { end: animationEnd };
110
- })();
111
-
112
- // requestAnimationFrame polyfill
113
- //https://github.com/darius/requestAnimationFrame
114
- (function() {
115
-
116
- Date.now = Date.now || function() { return new Date().getTime(); };
117
-
118
- var vendors = ['webkit', 'moz'];
119
- for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
120
- var vp = vendors[i];
121
- window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
122
- window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
123
- || window[vp+'CancelRequestAnimationFrame']);
124
- }
125
- if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
126
- || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
127
- var lastTime = 0;
128
- window.requestAnimationFrame = function(callback) {
129
- var now = Date.now();
130
- var nextTime = Math.max(lastTime + 16, now);
131
- return setTimeout(function() { callback(lastTime = nextTime); },
132
- nextTime - now);
133
- };
134
- window.cancelAnimationFrame = clearTimeout;
135
- }
136
- }());
137
-
138
- UI.support.touch = (
139
- ('ontouchstart' in document) ||
140
- (global.DocumentTouch && document instanceof global.DocumentTouch) ||
141
- (global.navigator.msPointerEnabled && global.navigator.msMaxTouchPoints > 0) || //IE 10
142
- (global.navigator.pointerEnabled && global.navigator.maxTouchPoints > 0) || //IE >=11
143
- false
144
- );
145
-
146
- UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || null);
147
-
148
- UI.Utils = {};
149
-
150
- UI.Utils.isFullscreen = function() {
151
- return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || document.fullscreenElement || false;
152
- };
153
-
154
- UI.Utils.str2json = function(str, notevil) {
155
- try {
156
- if (notevil) {
157
- return JSON.parse(str
158
- // wrap keys without quote with valid double quote
159
- .replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';})
160
- // replacing single quote wrapped ones to double quote
161
- .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
162
- );
163
- } else {
164
- return (new Function("", "var json = " + str + "; return JSON.parse(JSON.stringify(json));"))();
165
- }
166
- } catch(e) { return false; }
167
- };
168
-
169
- UI.Utils.debounce = function(func, wait, immediate) {
170
- var timeout;
171
- return function() {
172
- var context = this, args = arguments;
173
- var later = function() {
174
- timeout = null;
175
- if (!immediate) func.apply(context, args);
176
- };
177
- var callNow = immediate && !timeout;
178
- clearTimeout(timeout);
179
- timeout = setTimeout(later, wait);
180
- if (callNow) func.apply(context, args);
181
- };
182
- };
183
-
184
- UI.Utils.throttle = function (func, limit) {
185
- var wait = false;
186
- return function () {
187
- if (!wait) {
188
- func.call();
189
- wait = true;
190
- setTimeout(function () {
191
- wait = false;
192
- }, limit);
193
- }
194
- }
195
- };
196
-
197
- UI.Utils.removeCssRules = function(selectorRegEx) {
198
- var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
199
-
200
- if(!selectorRegEx) return;
201
-
202
- setTimeout(function(){
203
- try {
204
- _ref = document.styleSheets;
205
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
206
- stylesheet = _ref[_i];
207
- idxs = [];
208
- stylesheet.cssRules = stylesheet.cssRules;
209
- for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
210
- if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
211
- idxs.unshift(idx);
212
- }
213
- }
214
- for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
215
- stylesheet.deleteRule(idxs[_k]);
216
- }
217
- }
218
- } catch (_error) {}
219
- }, 0);
220
- };
221
-
222
- UI.Utils.isInView = function(element, options) {
223
-
224
- var $element = $(element);
225
-
226
- if (!$element.is(':visible')) {
227
- return false;
228
- }
229
-
230
- var window_left = UI.$win.scrollLeft(), window_top = UI.$win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
231
-
232
- options = $.extend({topoffset:0, leftoffset:0}, options);
233
-
234
- if (top + $element.height() >= window_top && top - options.topoffset <= window_top + UI.$win.height() &&
235
- left + $element.width() >= window_left && left - options.leftoffset <= window_left + UI.$win.width()) {
236
- return true;
237
- } else {
238
- return false;
239
- }
240
- };
241
-
242
- UI.Utils.checkDisplay = function(context, initanimation) {
243
-
244
- var elements = UI.$('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document), animated;
245
-
246
- if (context && !elements.length) {
247
- elements = $(context);
248
- }
249
-
250
- elements.trigger('display.uk.check');
251
-
252
- // fix firefox / IE animations
253
- if (initanimation) {
254
-
255
- if (typeof(initanimation)!='string') {
256
- initanimation = '[class*="uk-animation-"]';
257
- }
258
-
259
- elements.find(initanimation).each(function(){
260
-
261
- var ele = UI.$(this),
262
- cls = ele.attr('class'),
263
- anim = cls.match(/uk-animation-(.+)/);
264
-
265
- ele.removeClass(anim[0]).width();
266
-
267
- ele.addClass(anim[0]);
268
- });
269
- }
270
-
271
- return elements;
272
- };
273
-
274
- UI.Utils.options = function(string) {
275
-
276
- if ($.type(string)!='string') return string;
277
-
278
- if (string.indexOf(':') != -1 && string.trim().substr(-1) != '}') {
279
- string = '{'+string+'}';
280
- }
281
-
282
- var start = (string ? string.indexOf("{") : -1), options = {};
283
-
284
- if (start != -1) {
285
- try {
286
- options = UI.Utils.str2json(string.substr(start));
287
- } catch (e) {}
288
- }
289
-
290
- return options;
291
- };
292
-
293
- UI.Utils.animate = function(element, cls) {
294
-
295
- var d = $.Deferred();
296
-
297
- element = UI.$(element);
298
-
299
- element.css('display', 'none').addClass(cls).one(UI.support.animation.end, function() {
300
- element.removeClass(cls);
301
- d.resolve();
302
- });
303
-
304
- element.css('display', '');
305
-
306
- return d.promise();
307
- };
308
-
309
- UI.Utils.uid = function(prefix) {
310
- return (prefix || 'id') + (new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
311
- };
312
-
313
- UI.Utils.template = function(str, data) {
314
-
315
- var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
316
- i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
317
-
318
- while(i < tokens.length) {
319
-
320
- toc = tokens[i];
321
-
322
- if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
323
- i = i + 1;
324
- toc = tokens[i];
325
- cmd = toc[0];
326
- prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
327
-
328
- switch(cmd) {
329
- case '~':
330
- output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
331
- openblocks++;
332
- break;
333
- case ':':
334
- output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
335
- openblocks++;
336
- break;
337
- case '#':
338
- output.push("if("+prop+") {");
339
- openblocks++;
340
- break;
341
- case '^':
342
- output.push("if(!"+prop+") {");
343
- openblocks++;
344
- break;
345
- case '/':
346
- output.push("}");
347
- openblocks--;
348
- break;
349
- case '!':
350
- output.push("__ret.push("+prop+");");
351
- break;
352
- default:
353
- output.push("__ret.push(escape("+prop+"));");
354
- break;
355
- }
356
- } else {
357
- output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
358
- }
359
- i = i + 1;
360
- }
361
-
362
- fn = new Function('$data', [
363
- 'var __ret = [];',
364
- 'try {',
365
- 'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
366
- '}catch(e){__ret = [e.message];}',
367
- 'return __ret.join("").replace(/\\n\\n/g, "\\n");',
368
- "function escape(html) { return String(html).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"
369
- ].join("\n"));
370
-
371
- return data ? fn(data) : fn;
372
- };
373
-
374
- UI.Utils.focus = function(element, extra) {
375
-
376
- element = $(element);
377
-
378
- if (!element.length) {
379
- return element;
380
- }
381
-
382
- var autofocus = element.find('[autofocus]:first'), tabidx;
383
-
384
- if (autofocus.length) {
385
- return autofocus.focus();
386
- }
387
-
388
- autofocus = element.find(':input'+(extra && (','+extra) || '')).first();
389
-
390
- if (autofocus.length) {
391
- return autofocus.focus();
392
- }
393
-
394
- if (!element.attr('tabindex')) {
395
- tabidx = 1000;
396
- element.attr('tabindex', tabidx);
397
- }
398
-
399
- element[0].focus();
400
-
401
- if (tabidx) {
402
- element.attr('tabindex', '');
403
- }
404
-
405
- return element;
406
- }
407
-
408
- UI.Utils.events = {};
409
- UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
410
-
411
- global.UIkit = UI;
412
-
413
- // deprecated
414
-
415
- UI.fn = function(command, options) {
416
-
417
- var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
418
-
419
- if (!UI[component]) {
420
- $.error("UIkit component [" + component + "] does not exist.");
421
- return this;
422
- }
423
-
424
- return this.each(function() {
425
- var $this = $(this), data = $this.data(component);
426
- if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
427
- if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
428
- });
429
- };
430
-
431
- $.UIkit = UI;
432
- $.fn.uk = UI.fn;
433
-
434
- UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left";
435
-
436
- UI.components = {};
437
-
438
- UI.component = function(name, def) {
439
-
440
- var fn = function(element, options) {
441
-
442
- var $this = this;
443
-
444
- this.UIkit = UI;
445
- this.element = element ? UI.$(element) : null;
446
- this.options = $.extend(true, {}, this.defaults, options);
447
- this.plugins = {};
448
-
449
- if (this.element) {
450
- this.element.data(name, this);
451
- }
452
-
453
- this.init();
454
-
455
- (this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
456
-
457
- if (fn.plugins[plugin].init) {
458
- fn.plugins[plugin].init($this);
459
- $this.plugins[plugin] = true;
460
- }
461
-
462
- });
463
-
464
- this.trigger('init.uk.component', [name, this]);
465
-
466
- return this;
467
- };
468
-
469
- fn.plugins = {};
470
-
471
- $.extend(true, fn.prototype, {
472
-
473
- defaults : {plugins: []},
474
-
475
- boot: function(){},
476
- init: function(){},
477
-
478
- on: function(a1,a2,a3){
479
- return UI.$(this.element || this).on(a1,a2,a3);
480
- },
481
-
482
- one: function(a1,a2,a3){
483
- return UI.$(this.element || this).one(a1,a2,a3);
484
- },
485
-
486
- off: function(evt){
487
- return UI.$(this.element || this).off(evt);
488
- },
489
-
490
- trigger: function(evt, params) {
491
- return UI.$(this.element || this).trigger(evt, params);
492
- },
493
-
494
- find: function(selector) {
495
- return UI.$(this.element ? this.element: []).find(selector);
496
- },
497
-
498
- proxy: function(obj, methods) {
499
-
500
- var $this = this;
501
-
502
- methods.split(' ').forEach(function(method) {
503
- if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
504
- });
505
- },
506
-
507
- mixin: function(obj, methods) {
508
-
509
- var $this = this;
510
-
511
- methods.split(' ').forEach(function(method) {
512
- if (!$this[method]) $this[method] = obj[method].bind($this);
513
- });
514
- },
515
-
516
- option: function() {
517
-
518
- if (arguments.length == 1) {
519
- return this.options[arguments[0]] || undefined;
520
- } else if (arguments.length == 2) {
521
- this.options[arguments[0]] = arguments[1];
522
- }
523
- }
524
-
525
- }, def);
526
-
527
- this.components[name] = fn;
528
-
529
- this[name] = function() {
530
-
531
- var element, options;
532
-
533
- if (arguments.length) {
534
-
535
- switch(arguments.length) {
536
- case 1:
537
-
538
- if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
539
- element = $(arguments[0]);
540
- } else {
541
- options = arguments[0];
542
- }
543
-
544
- break;
545
- case 2:
546
-
547
- element = $(arguments[0]);
548
- options = arguments[1];
549
- break;
550
- }
551
- }
552
-
553
- if (element && element.data(name)) {
554
- return element.data(name);
555
- }
556
-
557
- return (new UI.components[name](element, options));
558
- };
559
-
560
- if (UI.domready) {
561
- UI.component.boot(name);
562
- }
563
-
564
- return fn;
565
- };
566
-
567
- UI.plugin = function(component, name, def) {
568
- this.components[component].plugins[name] = def;
569
- };
570
-
571
- UI.component.boot = function(name) {
572
-
573
- if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) {
574
- UI.components[name].prototype.boot.apply(UI, []);
575
- UI.components[name].booted = true;
576
- }
577
- };
578
-
579
- UI.component.bootComponents = function() {
580
-
581
- for (var component in UI.components) {
582
- UI.component.boot(component);
583
- }
584
- };
585
-
586
-
587
- // DOM mutation save ready helper function
588
-
589
- UI.domObservers = [];
590
- UI.domready = false;
591
-
592
- UI.ready = function(fn) {
593
-
594
- UI.domObservers.push(fn);
595
-
596
- if (UI.domready) {
597
- fn(document);
598
- }
599
- };
600
-
601
- UI.on = function(a1,a2,a3){
602
-
603
- if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
604
- a2.apply(UI.$doc);
605
- }
606
-
607
- return UI.$doc.on(a1,a2,a3);
608
- };
609
-
610
- UI.one = function(a1,a2,a3){
611
-
612
- if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
613
- a2.apply(UI.$doc);
614
- return UI.$doc;
615
- }
616
-
617
- return UI.$doc.one(a1,a2,a3);
618
- };
619
-
620
- UI.trigger = function(evt, params) {
621
- return UI.$doc.trigger(evt, params);
622
- };
623
-
624
- UI.domObserve = function(selector, fn) {
625
-
626
- if(!UI.support.mutationobserver) return;
627
-
628
- fn = fn || function() {};
629
-
630
- UI.$(selector).each(function() {
631
-
632
- var element = this,
633
- $element = UI.$(element);
634
-
635
- if ($element.data('observer')) {
636
- return;
637
- }
638
-
639
- try {
640
-
641
- var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
642
- fn.apply(element, [$element]);
643
- $element.trigger('changed.uk.dom');
644
- }, 50), {childList: true, subtree: true});
645
-
646
- // pass in the target node, as well as the observer options
647
- observer.observe(element, { childList: true, subtree: true });
648
-
649
- $element.data('observer', observer);
650
-
651
- } catch(e) {}
652
- });
653
- };
654
-
655
- UI.init = function(root) {
656
-
657
- root = root || document;
658
-
659
- UI.domObservers.forEach(function(fn){
660
- fn(root);
661
- });
662
- };
663
-
664
- UI.on('domready.uk.dom', function(){
665
-
666
- UI.init();
667
-
668
- if (UI.domready) UI.Utils.checkDisplay();
669
- });
670
-
671
- document.addEventListener('DOMContentLoaded', function(){
672
-
673
- var domReady = function() {
674
-
675
- UI.$body = UI.$('body');
676
-
677
- UI.trigger('beforeready.uk.dom');
678
-
679
- UI.component.bootComponents();
680
-
681
- // custom scroll observer
682
- var rafToken = requestAnimationFrame((function(){
683
-
684
- var memory = {dir: {x:0, y:0}, x: window.pageXOffset, y:window.pageYOffset};
685
-
686
- var fn = function(){
687
- // reading this (window.page[X|Y]Offset) causes a full page recalc of the layout in Chrome,
688
- // so we only want to do this once
689
- var wpxo = window.pageXOffset;
690
- var wpyo = window.pageYOffset;
691
-
692
- // Did the scroll position change since the last time we were here?
693
- if (memory.x != wpxo || memory.y != wpyo) {
694
-
695
- // Set the direction of the scroll and store the new position
696
- if (wpxo != memory.x) {memory.dir.x = wpxo > memory.x ? 1:-1; } else { memory.dir.x = 0; }
697
- if (wpyo != memory.y) {memory.dir.y = wpyo > memory.y ? 1:-1; } else { memory.dir.y = 0; }
698
-
699
- memory.x = wpxo;
700
- memory.y = wpyo;
701
-
702
- // Trigger the scroll event, this could probably be sent using memory.clone() but this is
703
- // more explicit and easier to see exactly what is being sent in the event.
704
- UI.$doc.trigger('scrolling.uk.document', [{
705
- dir: {x: memory.dir.x, y: memory.dir.y}, x: wpxo, y: wpyo
706
- }]);
707
- }
708
-
709
- cancelAnimationFrame(rafToken);
710
- rafToken = requestAnimationFrame(fn);
711
- };
712
-
713
- if (UI.support.touch) {
714
- UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn);
715
- }
716
-
717
- if (memory.x || memory.y) fn();
718
-
719
- return fn;
720
-
721
- })());
722
-
723
- // run component init functions on dom
724
- UI.trigger('domready.uk.dom');
725
-
726
- if (UI.support.touch) {
727
-
728
- // remove css hover rules for touch devices
729
- // UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
730
-
731
- // viewport unit fix for uk-height-viewport - should be fixed in iOS 8
732
- if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
733
-
734
- UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
735
-
736
- var fn = function() {
737
- $('.uk-height-viewport').css('height', window.innerHeight);
738
- return fn;
739
- };
740
-
741
- return fn();
742
-
743
- })(), 100));
744
- }
745
- }
746
-
747
- UI.trigger('afterready.uk.dom');
748
-
749
- // mark that domready is left behind
750
- UI.domready = true;
751
-
752
- // auto init js components
753
- if (UI.support.mutationobserver) {
754
-
755
- var initFn = UI.Utils.debounce(function(){
756
- requestAnimationFrame(function(){ UI.init(document.body);});
757
- }, 10);
758
-
759
- (new UI.support.mutationobserver(function(mutations) {
760
-
761
- var init = false;
762
-
763
- mutations.every(function(mutation){
764
-
765
- if (mutation.type != 'childList') return true;
766
-
767
- for (var i = 0, node; i < mutation.addedNodes.length; ++i) {
768
-
769
- node = mutation.addedNodes[i];
770
-
771
- if (node.outerHTML && node.outerHTML.indexOf('data-uk-') !== -1) {
772
- return (init = true) && false;
773
- }
774
- }
775
- return true;
776
- });
777
-
778
- if (init) initFn();
779
-
780
- })).observe(document.body, {childList: true, subtree: true});
781
- }
782
- };
783
-
784
- if (document.readyState == 'complete' || document.readyState == 'interactive') {
785
- setTimeout(domReady);
786
- }
787
-
788
- return domReady;
789
-
790
- }());
791
-
792
- // add touch identifier class
793
- UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
794
-
795
- // add uk-hover class on tap to support overlays on touch devices
796
- if (UI.support.touch) {
797
-
798
- var hoverset = false,
799
- exclude,
800
- hovercls = 'uk-hover',
801
- selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover';
802
-
803
- UI.$html.on('mouseenter touchstart MSPointerDown pointerdown', selector, function() {
804
-
805
- if (hoverset) $('.'+hovercls).removeClass(hovercls);
806
-
807
- hoverset = $(this).addClass(hovercls);
808
-
809
- }).on('mouseleave touchend MSPointerUp pointerup', function(e) {
810
-
811
- exclude = $(e.target).parents(selector);
812
-
813
- if (hoverset) {
814
- hoverset.not(exclude).removeClass(hovercls);
815
- }
816
- });
817
- }
818
-
819
- return UI;
820
- });
821
-
822
- // Based on Zeptos touch.js
823
- // https://raw.github.com/madrobby/zepto/master/src/touch.js
824
- // Zepto.js may be freely distributed under the MIT license.
825
-
826
- ;(function($){
827
-
828
- if ($.fn.swipeLeft) {
829
- return;
830
- }
831
-
832
-
833
- var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
834
-
835
- function swipeDirection(x1, x2, y1, y2) {
836
- return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
837
- }
838
-
839
- function longTap() {
840
- longTapTimeout = null;
841
- if (touch.last) {
842
- if ( touch.el !== undefined ) touch.el.trigger('longTap');
843
- touch = {};
844
- }
845
- }
846
-
847
- function cancelLongTap() {
848
- if (longTapTimeout) clearTimeout(longTapTimeout);
849
- longTapTimeout = null;
850
- }
851
-
852
- function cancelAll() {
853
- if (touchTimeout) clearTimeout(touchTimeout);
854
- if (tapTimeout) clearTimeout(tapTimeout);
855
- if (swipeTimeout) clearTimeout(swipeTimeout);
856
- if (longTapTimeout) clearTimeout(longTapTimeout);
857
- touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
858
- touch = {};
859
- }
860
-
861
- function isPrimaryTouch(event){
862
- return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
863
- }
864
-
865
- $(function(){
866
- var now, delta, deltaX = 0, deltaY = 0, firstTouch;
867
-
868
- if ('MSGesture' in window) {
869
- gesture = new MSGesture();
870
- gesture.target = document.body;
871
- }
872
-
873
- $(document)
874
- .on('MSGestureEnd gestureend', function(e){
875
-
876
- var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
877
-
878
- if (swipeDirectionFromVelocity && touch.el !== undefined) {
879
- touch.el.trigger('swipe');
880
- touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
881
- }
882
- })
883
- // MSPointerDown: for IE10
884
- // pointerdown: for IE11
885
- .on('touchstart MSPointerDown pointerdown', function(e){
886
-
887
- if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
888
-
889
- firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
890
-
891
- now = Date.now();
892
- delta = now - (touch.last || now);
893
- touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
894
-
895
- if(touchTimeout) clearTimeout(touchTimeout);
896
-
897
- touch.x1 = firstTouch.pageX;
898
- touch.y1 = firstTouch.pageY;
899
-
900
- if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
901
-
902
- touch.last = now;
903
- longTapTimeout = setTimeout(longTap, longTapDelay);
904
-
905
- // adds the current touch contact for IE gesture recognition
906
- if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
907
- gesture.addPointer(e.originalEvent.pointerId);
908
- }
909
-
910
- })
911
- // MSPointerMove: for IE10
912
- // pointermove: for IE11
913
- .on('touchmove MSPointerMove pointermove', function(e){
914
-
915
- if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
916
-
917
- firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
918
-
919
- cancelLongTap();
920
- touch.x2 = firstTouch.pageX;
921
- touch.y2 = firstTouch.pageY;
922
-
923
- deltaX += Math.abs(touch.x1 - touch.x2);
924
- deltaY += Math.abs(touch.y1 - touch.y2);
925
- })
926
- // MSPointerUp: for IE10
927
- // pointerup: for IE11
928
- .on('touchend MSPointerUp pointerup', function(e){
929
-
930
- if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
931
-
932
- cancelLongTap();
933
-
934
- // swipe
935
- if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
936
-
937
- swipeTimeout = setTimeout(function() {
938
- if ( touch.el !== undefined ) {
939
- touch.el.trigger('swipe');
940
- touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
941
- }
942
- touch = {};
943
- }, 0);
944
-
945
- // normal tap
946
- } else if ('last' in touch) {
947
-
948
- // don't fire tap when delta position changed by more than 30 pixels,
949
- // for instance when moving to a point and back to origin
950
- if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
951
- // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
952
- // ('tap' fires before 'scroll')
953
- tapTimeout = setTimeout(function() {
954
-
955
- // trigger universal 'tap' with the option to cancelTouch()
956
- // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
957
- var event = $.Event('tap');
958
- event.cancelTouch = cancelAll;
959
- if ( touch.el !== undefined ) touch.el.trigger(event);
960
-
961
- // trigger double tap immediately
962
- if (touch.isDoubleTap) {
963
- if ( touch.el !== undefined ) touch.el.trigger('doubleTap');
964
- touch = {};
965
- }
966
-
967
- // trigger single tap after 250ms of inactivity
968
- else {
969
- touchTimeout = setTimeout(function(){
970
- touchTimeout = null;
971
- if ( touch.el !== undefined ) touch.el.trigger('singleTap');
972
- touch = {};
973
- }, 250);
974
- }
975
- }, 0);
976
- } else {
977
- touch = {};
978
- }
979
- deltaX = deltaY = 0;
980
- }
981
- })
982
- // when the browser window loses focus,
983
- // for example when a modal dialog is shown,
984
- // cancel all ongoing events
985
- .on('touchcancel MSPointerCancel pointercancel', cancelAll);
986
-
987
- // scrolling the window indicates intention of the user
988
- // to scroll, not tap or swipe, so cancel all ongoing events
989
- $(window).on('scroll', cancelAll);
990
- });
991
-
992
- ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
993
- $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
994
- });
995
- })(jQuery);
996
-
997
- (function(UI) {
998
-
999
- "use strict";
1000
-
1001
- var stacks = [];
1002
-
1003
- UI.component('stackMargin', {
1004
-
1005
- defaults: {
1006
- cls: 'uk-margin-small-top',
1007
- rowfirst: false,
1008
- observe: false
1009
- },
1010
-
1011
- boot: function() {
1012
-
1013
- // init code
1014
- UI.ready(function(context) {
1015
-
1016
- UI.$("[data-uk-margin]", context).each(function() {
1017
-
1018
- var ele = UI.$(this);
1019
-
1020
- if (!ele.data("stackMargin")) {
1021
- UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
1022
- }
1023
- });
1024
- });
1025
- },
1026
-
1027
- init: function() {
1028
-
1029
- var $this = this;
1030
-
1031
- UI.$win.on('resize orientationchange', (function() {
1032
-
1033
- var fn = function() {
1034
- $this.process();
1035
- };
1036
-
1037
- UI.$(function() {
1038
- fn();
1039
- UI.$win.on("load", fn);
1040
- });
1041
-
1042
- return UI.Utils.debounce(fn, 20);
1043
- })());
1044
-
1045
- this.on("display.uk.check", function(e) {
1046
- if (this.element.is(":visible")) this.process();
1047
- }.bind(this));
1048
-
1049
- if (this.options.observe) {
1050
-
1051
- UI.domObserve(this.element, function(e) {
1052
- if ($this.element.is(":visible")) $this.process();
1053
- });
1054
- }
1055
-
1056
- stacks.push(this);
1057
- },
1058
-
1059
- process: function() {
1060
-
1061
- var $this = this, columns = this.element.children();
1062
-
1063
- UI.Utils.stackMargin(columns, this.options);
1064
-
1065
- if (!this.options.rowfirst || !columns.length) {
1066
- return this;
1067
- }
1068
-
1069
- // Mark first column elements
1070
- var group = {}, minleft = false;
1071
-
1072
- columns.removeClass(this.options.rowfirst).each(function(offset, $ele){
1073
-
1074
- $ele = UI.$(this);
1075
-
1076
- if (this.style.display != 'none') {
1077
- offset = $ele.offset().left;
1078
- ((group[offset] = group[offset] || []) && group[offset]).push(this);
1079
- minleft = minleft === false ? offset : Math.min(minleft, offset);
1080
- }
1081
- });
1082
-
1083
- UI.$(group[minleft]).addClass(this.options.rowfirst);
1084
-
1085
- return this;
1086
- }
1087
-
1088
- });
1089
-
1090
-
1091
- // responsive element e.g. iframes
1092
-
1093
- (function(){
1094
-
1095
- var elements = [], check = function(ele) {
1096
-
1097
- if (!ele.is(':visible')) return;
1098
-
1099
- var width = ele.parent().width(),
1100
- iwidth = ele.data('width'),
1101
- ratio = (width / iwidth),
1102
- height = Math.floor(ratio * ele.data('height'));
1103
-
1104
- ele.css({'height': (width < iwidth) ? height : ele.data('height')});
1105
- };
1106
-
1107
- UI.component('responsiveElement', {
1108
-
1109
- defaults: {},
1110
-
1111
- boot: function() {
1112
-
1113
- // init code
1114
- UI.ready(function(context) {
1115
-
1116
- UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
1117
-
1118
- var ele = UI.$(this), obj;
1119
-
1120
- if (!ele.data("responsiveElement")) {
1121
- obj = UI.responsiveElement(ele, {});
1122
- }
1123
- });
1124
- });
1125
- },
1126
-
1127
- init: function() {
1128
-
1129
- var ele = this.element;
1130
-
1131
- if (ele.attr('width') && ele.attr('height')) {
1132
-
1133
- ele.data({
1134
-
1135
- 'width' : ele.attr('width'),
1136
- 'height': ele.attr('height')
1137
-
1138
- }).on('display.uk.check', function(){
1139
- check(ele);
1140
- });
1141
-
1142
- check(ele);
1143
-
1144
- elements.push(ele);
1145
- }
1146
- }
1147
- });
1148
-
1149
- UI.$win.on('resize load', UI.Utils.debounce(function(){
1150
-
1151
- elements.forEach(function(ele){
1152
- check(ele);
1153
- });
1154
-
1155
- }, 15));
1156
-
1157
- })();
1158
-
1159
-
1160
-
1161
- // helper
1162
-
1163
- UI.Utils.stackMargin = function(elements, options) {
1164
-
1165
- options = UI.$.extend({
1166
- cls: 'uk-margin-small-top'
1167
- }, options);
1168
-
1169
- elements = UI.$(elements).removeClass(options.cls);
1170
-
1171
- var min = false;
1172
-
1173
- elements.each(function(offset, height, pos, $ele){
1174
-
1175
- $ele = UI.$(this);
1176
-
1177
- if ($ele.css('display') != 'none') {
1178
-
1179
- offset = $ele.offset();
1180
- height = $ele.outerHeight();
1181
- pos = offset.top + height;
1182
-
1183
- $ele.data({
1184
- 'ukMarginPos': pos,
1185
- 'ukMarginTop': offset.top
1186
- });
1187
-
1188
- if (min === false || (offset.top < min.top) ) {
1189
-
1190
- min = {
1191
- top : offset.top,
1192
- left : offset.left,
1193
- pos : pos
1194
- };
1195
- }
1196
- }
1197
-
1198
- }).each(function($ele) {
1199
-
1200
- $ele = UI.$(this);
1201
-
1202
- if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
1203
- $ele.addClass(options.cls);
1204
- }
1205
- });
1206
- };
1207
-
1208
- UI.Utils.matchHeights = function(elements, options) {
1209
-
1210
- elements = UI.$(elements).css('min-height', '');
1211
- options = UI.$.extend({ row : true }, options);
1212
-
1213
- var matchHeights = function(group){
1214
-
1215
- if (group.length < 2) return;
1216
-
1217
- var max = 0;
1218
-
1219
- group.each(function() {
1220
- max = Math.max(max, UI.$(this).outerHeight());
1221
- }).each(function() {
1222
-
1223
- var element = UI.$(this),
1224
- height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
1225
-
1226
- element.css('min-height', height + 'px');
1227
- });
1228
- };
1229
-
1230
- if (options.row) {
1231
-
1232
- elements.first().width(); // force redraw
1233
-
1234
- setTimeout(function(){
1235
-
1236
- var lastoffset = false, group = [];
1237
-
1238
- elements.each(function() {
1239
-
1240
- var ele = UI.$(this), offset = ele.offset().top;
1241
-
1242
- if (offset != lastoffset && group.length) {
1243
-
1244
- matchHeights(UI.$(group));
1245
- group = [];
1246
- offset = ele.offset().top;
1247
- }
1248
-
1249
- group.push(ele);
1250
- lastoffset = offset;
1251
- });
1252
-
1253
- if (group.length) {
1254
- matchHeights(UI.$(group));
1255
- }
1256
-
1257
- }, 0);
1258
-
1259
- } else {
1260
- matchHeights(elements);
1261
- }
1262
- };
1263
-
1264
- (function(cacheSvgs){
1265
-
1266
- UI.Utils.inlineSvg = function(selector, root) {
1267
-
1268
- var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
1269
-
1270
- var img = UI.$(this),
1271
- src = img.attr('src');
1272
-
1273
- if (!cacheSvgs[src]) {
1274
-
1275
- var d = UI.$.Deferred();
1276
-
1277
- UI.$.get(src, {nc: Math.random()}, function(data){
1278
- d.resolve(UI.$(data).find('svg'));
1279
- });
1280
-
1281
- cacheSvgs[src] = d.promise();
1282
- }
1283
-
1284
- cacheSvgs[src].then(function(svg) {
1285
-
1286
- var $svg = UI.$(svg).clone();
1287
-
1288
- if (img.attr('id')) $svg.attr('id', img.attr('id'));
1289
- if (img.attr('class')) $svg.attr('class', img.attr('class'));
1290
- if (img.attr('style')) $svg.attr('style', img.attr('style'));
1291
-
1292
- if (img.attr('width')) {
1293
- $svg.attr('width', img.attr('width'));
1294
- if (!img.attr('height')) $svg.removeAttr('height');
1295
- }
1296
-
1297
- if (img.attr('height')){
1298
- $svg.attr('height', img.attr('height'));
1299
- if (!img.attr('width')) $svg.removeAttr('width');
1300
- }
1301
-
1302
- img.replaceWith($svg);
1303
- });
1304
- });
1305
- };
1306
-
1307
- // init code
1308
- UI.ready(function(context) {
1309
- UI.Utils.inlineSvg('[data-uk-svg]', context);
1310
- });
1311
-
1312
- })({});
1313
-
1314
- UI.Utils.getCssVar = function(name) {
1315
-
1316
- /* usage in css: .var-name:before { content:"xyz" } */
1317
-
1318
- var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
1319
-
1320
- element.classList.add('var-'+name);
1321
-
1322
- try {
1323
- val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
1324
- } catch (e) {
1325
- val = undefined;
1326
- }
1327
-
1328
- doc.removeChild(element);
1329
-
1330
- return val;
1331
- }
1332
-
1333
- })(UIkit);
1334
-
1335
- (function(UI) {
1336
-
1337
- "use strict";
1338
-
1339
- UI.component('smoothScroll', {
1340
-
1341
- boot: function() {
1342
-
1343
- // init code
1344
- UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
1345
- var ele = UI.$(this);
1346
-
1347
- if (!ele.data("smoothScroll")) {
1348
- var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
1349
- ele.trigger("click");
1350
- }
1351
-
1352
- return false;
1353
- });
1354
- },
1355
-
1356
- init: function() {
1357
-
1358
- var $this = this;
1359
-
1360
- this.on("click", function(e) {
1361
- e.preventDefault();
1362
- scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
1363
- });
1364
- }
1365
- });
1366
-
1367
- function scrollToElement(ele, options) {
1368
-
1369
- options = UI.$.extend({
1370
- duration: 1000,
1371
- transition: 'easeOutExpo',
1372
- offset: 0,
1373
- complete: function(){}
1374
- }, options);
1375
-
1376
- // get / set parameters
1377
- var target = ele.offset().top - options.offset,
1378
- docheight = UI.$doc.height(),
1379
- winheight = window.innerHeight;
1380
-
1381
- if ((target + winheight) > docheight) {
1382
- target = docheight - winheight;
1383
- }
1384
-
1385
- // animate to target, fire callback when done
1386
- UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
1387
- }
1388
-
1389
- UI.Utils.scrollToElement = scrollToElement;
1390
-
1391
- if (!UI.$.easing.easeOutExpo) {
1392
- UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
1393
- }
1394
-
1395
- })(UIkit);
1396
-
1397
- (function(UI) {
1398
-
1399
- "use strict";
1400
-
1401
- var $win = UI.$win,
1402
- $doc = UI.$doc,
1403
- scrollspies = [],
1404
- checkScrollSpy = function() {
1405
- for(var i=0; i < scrollspies.length; i++) {
1406
- window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
1407
- }
1408
- };
1409
-
1410
- UI.component('scrollspy', {
1411
-
1412
- defaults: {
1413
- target : false,
1414
- cls : "uk-scrollspy-inview",
1415
- initcls : "uk-scrollspy-init-inview",
1416
- topoffset : 0,
1417
- leftoffset : 0,
1418
- repeat : false,
1419
- delay : 0
1420
- },
1421
-
1422
- boot: function() {
1423
-
1424
- // listen to scroll and resize
1425
- $doc.on("scrolling.uk.document", checkScrollSpy);
1426
- $win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
1427
-
1428
- // init code
1429
- UI.ready(function(context) {
1430
-
1431
- UI.$("[data-uk-scrollspy]", context).each(function() {
1432
-
1433
- var element = UI.$(this);
1434
-
1435
- if (!element.data("scrollspy")) {
1436
- var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
1437
- }
1438
- });
1439
- });
1440
- },
1441
-
1442
- init: function() {
1443
-
1444
- var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
1445
-
1446
- var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
1447
- delayIdx = elements.length === 1 ? 1 : 0,
1448
- toggleclsIdx = 0;
1449
-
1450
- elements.each(function(idx){
1451
-
1452
- var element = UI.$(this),
1453
- inviewstate = element.data('inviewstate'),
1454
- inview = UI.Utils.isInView(element, $this.options),
1455
- toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
1456
-
1457
- if (inview && !inviewstate && !element.data('scrollspy-idle')) {
1458
-
1459
- if (!initinview) {
1460
- element.addClass($this.options.initcls);
1461
- $this.offset = element.offset();
1462
- initinview = true;
1463
-
1464
- element.trigger("init.uk.scrollspy");
1465
- }
1466
-
1467
- element.data('scrollspy-idle', setTimeout(function(){
1468
-
1469
- element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
1470
- element.trigger("inview.uk.scrollspy");
1471
-
1472
- element.data('scrollspy-idle', false);
1473
- element.data('inviewstate', true);
1474
-
1475
- }, $this.options.delay * delayIdx));
1476
-
1477
- delayIdx++;
1478
- }
1479
-
1480
- if (!inview && inviewstate && $this.options.repeat) {
1481
-
1482
- if (element.data('scrollspy-idle')) {
1483
- clearTimeout(element.data('scrollspy-idle'));
1484
- element.data('scrollspy-idle', false);
1485
- }
1486
-
1487
- element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
1488
- element.data('inviewstate', false);
1489
-
1490
- element.trigger("outview.uk.scrollspy");
1491
- }
1492
-
1493
- toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
1494
-
1495
- });
1496
- };
1497
-
1498
- fn();
1499
-
1500
- this.check = fn;
1501
-
1502
- scrollspies.push(this);
1503
- }
1504
- });
1505
-
1506
-
1507
- var scrollspynavs = [],
1508
- checkScrollSpyNavs = function() {
1509
- for(var i=0; i < scrollspynavs.length; i++) {
1510
- window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
1511
- }
1512
- };
1513
-
1514
- UI.component('scrollspynav', {
1515
-
1516
- defaults: {
1517
- "cls" : 'uk-active',
1518
- "closest" : false,
1519
- "topoffset" : 0,
1520
- "leftoffset" : 0,
1521
- "smoothscroll" : false
1522
- },
1523
-
1524
- boot: function() {
1525
-
1526
- // listen to scroll and resize
1527
- $doc.on("scrolling.uk.document", checkScrollSpyNavs);
1528
- $win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
1529
-
1530
- // init code
1531
- UI.ready(function(context) {
1532
-
1533
- UI.$("[data-uk-scrollspy-nav]", context).each(function() {
1534
-
1535
- var element = UI.$(this);
1536
-
1537
- if (!element.data("scrollspynav")) {
1538
- var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
1539
- }
1540
- });
1541
- });
1542
- },
1543
-
1544
- init: function() {
1545
-
1546
- var ids = [],
1547
- links = this.find("a[href^='#']").each(function(){ if(this.getAttribute("href").trim()!=='#') ids.push(this.getAttribute("href")); }),
1548
- targets = UI.$(ids.join(",")),
1549
-
1550
- clsActive = this.options.cls,
1551
- clsClosest = this.options.closest || this.options.closest;
1552
-
1553
- var $this = this, inviews, fn = function(){
1554
-
1555
- inviews = [];
1556
-
1557
- for (var i=0 ; i < targets.length ; i++) {
1558
- if (UI.Utils.isInView(targets.eq(i), $this.options)) {
1559
- inviews.push(targets.eq(i));
1560
- }
1561
- }
1562
-
1563
- if (inviews.length) {
1564
-
1565
- var navitems,
1566
- scrollTop = $win.scrollTop(),
1567
- target = (function(){
1568
- for(var i=0; i< inviews.length;i++){
1569
- if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
1570
- return inviews[i];
1571
- }
1572
- }
1573
- })();
1574
-
1575
- if (!target) return;
1576
-
1577
- if ($this.options.closest) {
1578
- links.blur().closest(clsClosest).removeClass(clsActive);
1579
- navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
1580
- } else {
1581
- navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
1582
- }
1583
-
1584
- $this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
1585
- }
1586
- };
1587
-
1588
- if (this.options.smoothscroll && UI.smoothScroll) {
1589
- links.each(function(){
1590
- UI.smoothScroll(this, $this.options.smoothscroll);
1591
- });
1592
- }
1593
-
1594
- fn();
1595
-
1596
- this.element.data("scrollspynav", this);
1597
-
1598
- this.check = fn;
1599
- scrollspynavs.push(this);
1600
-
1601
- }
1602
- });
1603
-
1604
- })(UIkit);
1605
-
1606
- (function(UI){
1607
-
1608
- "use strict";
1609
-
1610
- var toggles = [];
1611
-
1612
- UI.component('toggle', {
1613
-
1614
- defaults: {
1615
- target : false,
1616
- cls : 'uk-hidden',
1617
- animation : false,
1618
- duration : 200
1619
- },
1620
-
1621
- boot: function(){
1622
-
1623
- // init code
1624
- UI.ready(function(context) {
1625
-
1626
- UI.$("[data-uk-toggle]", context).each(function() {
1627
- var ele = UI.$(this);
1628
-
1629
- if (!ele.data("toggle")) {
1630
- var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
1631
- }
1632
- });
1633
-
1634
- setTimeout(function(){
1635
-
1636
- toggles.forEach(function(toggle){
1637
- toggle.getToggles();
1638
- });
1639
-
1640
- }, 0);
1641
- });
1642
- },
1643
-
1644
- init: function() {
1645
-
1646
- var $this = this;
1647
-
1648
- this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
1649
-
1650
- this.on("click", function(e) {
1651
-
1652
- if ($this.element.is('a[href="#"]')) {
1653
- e.preventDefault();
1654
- }
1655
-
1656
- $this.toggle();
1657
- });
1658
-
1659
- toggles.push(this);
1660
- },
1661
-
1662
- toggle: function() {
1663
-
1664
- this.getToggles();
1665
-
1666
- if(!this.totoggle.length) return;
1667
-
1668
- if (this.options.animation && UI.support.animation) {
1669
-
1670
- var $this = this, animations = this.options.animation.split(',');
1671
-
1672
- if (animations.length == 1) {
1673
- animations[1] = animations[0];
1674
- }
1675
-
1676
- animations[0] = animations[0].trim();
1677
- animations[1] = animations[1].trim();
1678
-
1679
- this.totoggle.css('animation-duration', this.options.duration+'ms');
1680
-
1681
- this.totoggle.each(function(){
1682
-
1683
- var ele = UI.$(this);
1684
-
1685
- if (ele.hasClass($this.options.cls)) {
1686
-
1687
- ele.toggleClass($this.options.cls);
1688
-
1689
- UI.Utils.animate(ele, animations[0]).then(function(){
1690
- ele.css('animation-duration', '');
1691
- UI.Utils.checkDisplay(ele);
1692
- });
1693
-
1694
- } else {
1695
-
1696
- UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
1697
- ele.toggleClass($this.options.cls).css('animation-duration', '');
1698
- UI.Utils.checkDisplay(ele);
1699
- });
1700
-
1701
- }
1702
-
1703
- });
1704
-
1705
- } else {
1706
- this.totoggle.toggleClass(this.options.cls);
1707
- UI.Utils.checkDisplay(this.totoggle);
1708
- }
1709
-
1710
- this.updateAria();
1711
-
1712
- },
1713
-
1714
- getToggles: function() {
1715
- this.totoggle = this.options.target ? UI.$(this.options.target):[];
1716
- this.updateAria();
1717
- },
1718
-
1719
- updateAria: function() {
1720
- if (this.aria && this.totoggle.length) {
1721
- this.totoggle.not('[aria-hidden]').each(function(){
1722
- UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
1723
- });
1724
- }
1725
- }
1726
- });
1727
-
1728
- })(UIkit);
1729
-
1730
- (function(UI) {
1731
-
1732
- "use strict";
1733
-
1734
- UI.component('alert', {
1735
-
1736
- defaults: {
1737
- fade: true,
1738
- duration: 200,
1739
- trigger: '.uk-alert-close'
1740
- },
1741
-
1742
- boot: function() {
1743
-
1744
- // init code
1745
- UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
1746
-
1747
- var ele = UI.$(this);
1748
-
1749
- if (!ele.data("alert")) {
1750
-
1751
- var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
1752
-
1753
- if (UI.$(e.target).is(alert.options.trigger)) {
1754
- e.preventDefault();
1755
- alert.close();
1756
- }
1757
- }
1758
- });
1759
- },
1760
-
1761
- init: function() {
1762
-
1763
- var $this = this;
1764
-
1765
- this.on("click", this.options.trigger, function(e) {
1766
- e.preventDefault();
1767
- $this.close();
1768
- });
1769
- },
1770
-
1771
- close: function() {
1772
-
1773
- var element = this.trigger("close.uk.alert"),
1774
- removeElement = function () {
1775
- this.trigger("closed.uk.alert").remove();
1776
- }.bind(this);
1777
-
1778
- if (this.options.fade) {
1779
- element.css("overflow", "hidden").css("max-height", element.height()).animate({
1780
- "height" : 0,
1781
- "opacity" : 0,
1782
- "padding-top" : 0,
1783
- "padding-bottom" : 0,
1784
- "margin-top" : 0,
1785
- "margin-bottom" : 0
1786
- }, this.options.duration, removeElement);
1787
- } else {
1788
- removeElement();
1789
- }
1790
- }
1791
-
1792
- });
1793
-
1794
- })(UIkit);
1795
-
1796
- (function(UI) {
1797
-
1798
- "use strict";
1799
-
1800
- UI.component('buttonRadio', {
1801
-
1802
- defaults: {
1803
- activeClass: 'uk-active',
1804
- target: '.uk-button'
1805
- },
1806
-
1807
- boot: function() {
1808
-
1809
- // init code
1810
- UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
1811
-
1812
- var ele = UI.$(this);
1813
-
1814
- if (!ele.data("buttonRadio")) {
1815
-
1816
- var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
1817
- target = UI.$(e.target);
1818
-
1819
- if (target.is(obj.options.target)) {
1820
- target.trigger("click");
1821
- }
1822
- }
1823
- });
1824
- },
1825
-
1826
- init: function() {
1827
-
1828
- var $this = this;
1829
-
1830
- // Init ARIA
1831
- this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1832
-
1833
- this.on("click", this.options.target, function(e) {
1834
-
1835
- var ele = UI.$(this);
1836
-
1837
- if (ele.is('a[href="#"]')) e.preventDefault();
1838
-
1839
- $this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
1840
- ele.addClass($this.options.activeClass);
1841
-
1842
- // Update ARIA
1843
- $this.find($this.options.target).not(ele).attr('aria-checked', 'false');
1844
- ele.attr('aria-checked', 'true');
1845
-
1846
- $this.trigger("change.uk.button", [ele]);
1847
- });
1848
-
1849
- },
1850
-
1851
- getSelected: function() {
1852
- return this.find('.' + this.options.activeClass);
1853
- }
1854
- });
1855
-
1856
- UI.component('buttonCheckbox', {
1857
-
1858
- defaults: {
1859
- activeClass: 'uk-active',
1860
- target: '.uk-button'
1861
- },
1862
-
1863
- boot: function() {
1864
-
1865
- UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
1866
- var ele = UI.$(this);
1867
-
1868
- if (!ele.data("buttonCheckbox")) {
1869
-
1870
- var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
1871
- target = UI.$(e.target);
1872
-
1873
- if (target.is(obj.options.target)) {
1874
- target.trigger("click");
1875
- }
1876
- }
1877
- });
1878
- },
1879
-
1880
- init: function() {
1881
-
1882
- var $this = this;
1883
-
1884
- // Init ARIA
1885
- this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1886
-
1887
- this.on("click", this.options.target, function(e) {
1888
- var ele = UI.$(this);
1889
-
1890
- if (ele.is('a[href="#"]')) e.preventDefault();
1891
-
1892
- ele.toggleClass($this.options.activeClass).blur();
1893
-
1894
- // Update ARIA
1895
- ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
1896
-
1897
- $this.trigger("change.uk.button", [ele]);
1898
- });
1899
-
1900
- },
1901
-
1902
- getSelected: function() {
1903
- return this.find('.' + this.options.activeClass);
1904
- }
1905
- });
1906
-
1907
-
1908
- UI.component('button', {
1909
-
1910
- defaults: {},
1911
-
1912
- boot: function() {
1913
-
1914
- UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
1915
- var ele = UI.$(this);
1916
-
1917
- if (!ele.data("button")) {
1918
-
1919
- var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
1920
- ele.trigger("click");
1921
- }
1922
- });
1923
- },
1924
-
1925
- init: function() {
1926
-
1927
- var $this = this;
1928
-
1929
- // Init ARIA
1930
- this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1931
-
1932
- this.on("click", function(e) {
1933
-
1934
- if ($this.element.is('a[href="#"]')) e.preventDefault();
1935
-
1936
- $this.toggle();
1937
- $this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
1938
- });
1939
-
1940
- },
1941
-
1942
- toggle: function() {
1943
- this.element.toggleClass("uk-active");
1944
-
1945
- // Update ARIA
1946
- this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1947
- }
1948
- });
1949
-
1950
- })(UIkit);
1951
-
1952
- (function(UI) {
1953
-
1954
- "use strict";
1955
-
1956
- var active = false, hoverIdle, flips = {
1957
- x: {
1958
- "bottom-left" : 'bottom-right',
1959
- "bottom-right" : 'bottom-left',
1960
- "bottom-center" : 'bottom-center',
1961
- "top-left" : 'top-right',
1962
- "top-right" : 'top-left',
1963
- "top-center" : 'top-center',
1964
- "left-top" : 'right-top',
1965
- "left-bottom" : 'right-bottom',
1966
- "left-center" : 'right-center',
1967
- "right-top" : 'left-top',
1968
- "right-bottom" : 'left-bottom',
1969
- "right-center" : 'left-center'
1970
- },
1971
- y: {
1972
- "bottom-left" : 'top-left',
1973
- "bottom-right" : 'top-right',
1974
- "bottom-center" : 'top-center',
1975
- "top-left" : 'bottom-left',
1976
- "top-right" : 'bottom-right',
1977
- "top-center" : 'bottom-center',
1978
- "left-top" : 'left-bottom',
1979
- "left-bottom" : 'left-top',
1980
- "left-center" : 'left-center',
1981
- "right-top" : 'right-bottom',
1982
- "right-bottom" : 'right-top',
1983
- "right-center" : 'right-center'
1984
- },
1985
- xy: {
1986
- "bottom-left" : 'top-right',
1987
- "bottom-right" : 'top-left',
1988
- "bottom-center" : 'top-center',
1989
- "top-left" : 'bottom-right',
1990
- "top-right" : 'bottom-left',
1991
- "top-center" : 'bottom-center',
1992
- "left-top" : 'right-bottom',
1993
- "left-bottom" : 'right-top',
1994
- "left-center" : 'right-center',
1995
- "right-top" : 'left-bottom',
1996
- "right-bottom" : 'left-top',
1997
- "right-center" : 'left-center'
1998
- }
1999
- };
2000
-
2001
- UI.component('dropdown', {
2002
-
2003
- defaults: {
2004
- mode : 'hover',
2005
- pos : 'bottom-left',
2006
- offset : 0,
2007
- remaintime : 800,
2008
- justify : false,
2009
- boundary : UI.$win,
2010
- delay : 0,
2011
- dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
2012
- hoverDelayIdle : 250,
2013
- preventflip : false
2014
- },
2015
-
2016
- remainIdle: false,
2017
-
2018
- boot: function() {
2019
-
2020
- var triggerevent = UI.support.touch ? "click" : "mouseenter";
2021
-
2022
- // init code
2023
- UI.$html.on(triggerevent+".dropdown.uikit focus", "[data-uk-dropdown]", function(e) {
2024
-
2025
- var ele = UI.$(this);
2026
-
2027
- if (!ele.data("dropdown")) {
2028
-
2029
- var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
2030
-
2031
- if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
2032
- dropdown.element.trigger(triggerevent);
2033
- }
2034
-
2035
- if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
2036
- e.preventDefault();
2037
- }
2038
- }
2039
- });
2040
- },
2041
-
2042
- init: function() {
2043
-
2044
- var $this = this;
2045
-
2046
- this.dropdown = this.find(this.options.dropdownSelector);
2047
- this.offsetParent = this.dropdown.parents().filter(function() {
2048
- return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
2049
- }).slice(0,1);
2050
-
2051
- this.centered = this.dropdown.hasClass('uk-dropdown-center');
2052
- this.justified = this.options.justify ? UI.$(this.options.justify) : false;
2053
-
2054
- this.boundary = UI.$(this.options.boundary);
2055
-
2056
- if (!this.boundary.length) {
2057
- this.boundary = UI.$win;
2058
- }
2059
-
2060
- // legacy DEPRECATED!
2061
- if (this.dropdown.hasClass('uk-dropdown-up')) {
2062
- this.options.pos = 'top-left';
2063
- }
2064
- if (this.dropdown.hasClass('uk-dropdown-flip')) {
2065
- this.options.pos = this.options.pos.replace('left','right');
2066
- }
2067
- if (this.dropdown.hasClass('uk-dropdown-center')) {
2068
- this.options.pos = this.options.pos.replace(/(left|right)/,'center');
2069
- }
2070
- //-- end legacy
2071
-
2072
- // Init ARIA
2073
- this.element.attr('aria-haspopup', 'true');
2074
- this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
2075
- this.dropdown.attr('aria-hidden', 'true');
2076
-
2077
- if (this.options.mode == "click" || UI.support.touch) {
2078
-
2079
- this.on("click.uk.dropdown", function(e) {
2080
-
2081
- var $target = UI.$(e.target);
2082
-
2083
- if (!$target.parents($this.options.dropdownSelector).length) {
2084
-
2085
- if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
2086
- e.preventDefault();
2087
- }
2088
-
2089
- $target.blur();
2090
- }
2091
-
2092
- if (!$this.element.hasClass('uk-open')) {
2093
-
2094
- $this.show();
2095
-
2096
- } else {
2097
-
2098
- if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2099
- $this.hide();
2100
- }
2101
- }
2102
- });
2103
-
2104
- } else {
2105
-
2106
- this.on("mouseenter", function(e) {
2107
-
2108
- $this.trigger('pointerenter.uk.dropdown', [$this]);
2109
-
2110
- if ($this.remainIdle) {
2111
- clearTimeout($this.remainIdle);
2112
- }
2113
-
2114
- if (hoverIdle) {
2115
- clearTimeout(hoverIdle);
2116
- }
2117
-
2118
- if (active && active == $this) {
2119
- return;
2120
- }
2121
-
2122
- // pseudo manuAim
2123
- if (active && active != $this) {
2124
-
2125
- hoverIdle = setTimeout(function() {
2126
- hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2127
- }, $this.options.hoverDelayIdle);
2128
-
2129
- } else {
2130
-
2131
- hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2132
- }
2133
-
2134
- }).on("mouseleave", function() {
2135
-
2136
- if (hoverIdle) {
2137
- clearTimeout(hoverIdle);
2138
- }
2139
-
2140
- $this.remainIdle = setTimeout(function() {
2141
- if (active && active == $this) $this.hide();
2142
- }, $this.options.remaintime);
2143
-
2144
- $this.trigger('pointerleave.uk.dropdown', [$this]);
2145
-
2146
- }).on("click", function(e){
2147
-
2148
- var $target = UI.$(e.target);
2149
-
2150
- if ($this.remainIdle) {
2151
- clearTimeout($this.remainIdle);
2152
- }
2153
-
2154
- if (active && active == $this) {
2155
- if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2156
- $this.hide();
2157
- }
2158
- return;
2159
- }
2160
-
2161
- if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
2162
- e.preventDefault();
2163
- }
2164
-
2165
- $this.show();
2166
- });
2167
- }
2168
- },
2169
-
2170
- show: function(){
2171
-
2172
- UI.$html.off("click.outer.dropdown");
2173
-
2174
- if (active && active != this) {
2175
- active.hide(true);
2176
- }
2177
-
2178
- if (hoverIdle) {
2179
- clearTimeout(hoverIdle);
2180
- }
2181
-
2182
- this.trigger('beforeshow.uk.dropdown', [this]);
2183
-
2184
- this.checkDimensions();
2185
- this.element.addClass('uk-open');
2186
-
2187
- // Update ARIA
2188
- this.element.attr('aria-expanded', 'true');
2189
- this.dropdown.attr('aria-hidden', 'false');
2190
-
2191
- this.trigger('show.uk.dropdown', [this]);
2192
-
2193
- UI.Utils.checkDisplay(this.dropdown, true);
2194
- UI.Utils.focus(this.dropdown);
2195
- active = this;
2196
-
2197
- this.registerOuterClick();
2198
- },
2199
-
2200
- hide: function(force) {
2201
-
2202
- this.trigger('beforehide.uk.dropdown', [this, force]);
2203
-
2204
- this.element.removeClass('uk-open');
2205
-
2206
- if (this.remainIdle) {
2207
- clearTimeout(this.remainIdle);
2208
- }
2209
-
2210
- this.remainIdle = false;
2211
-
2212
- // Update ARIA
2213
- this.element.attr('aria-expanded', 'false');
2214
- this.dropdown.attr('aria-hidden', 'true');
2215
-
2216
- this.trigger('hide.uk.dropdown', [this, force]);
2217
-
2218
- if (active == this) active = false;
2219
- },
2220
-
2221
- registerOuterClick: function(){
2222
-
2223
- var $this = this;
2224
-
2225
- UI.$html.off("click.outer.dropdown");
2226
-
2227
- setTimeout(function() {
2228
-
2229
- UI.$html.on("click.outer.dropdown", function(e) {
2230
-
2231
- if (hoverIdle) {
2232
- clearTimeout(hoverIdle);
2233
- }
2234
-
2235
- var $target = UI.$(e.target);
2236
-
2237
- if (active == $this && !$this.element.find(e.target).length) {
2238
- $this.hide(true);
2239
- UI.$html.off("click.outer.dropdown");
2240
- }
2241
- });
2242
- }, 10);
2243
- },
2244
-
2245
- checkDimensions: function() {
2246
-
2247
- if (!this.dropdown.length) return;
2248
-
2249
- // reset
2250
- this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
2251
- 'top-left':'',
2252
- 'left':'',
2253
- 'margin-left' :'',
2254
- 'margin-right':''
2255
- });
2256
-
2257
- if (this.justified && this.justified.length) {
2258
- this.dropdown.css("min-width", "");
2259
- }
2260
-
2261
- var $this = this,
2262
- pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
2263
- posoffset = this.options.offset,
2264
- dropdown = this.dropdown,
2265
- offset = dropdown.show().offset() || {left: 0, top: 0},
2266
- width = dropdown.outerWidth(),
2267
- height = dropdown.outerHeight(),
2268
- boundarywidth = this.boundary.width(),
2269
- boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
2270
- dpos = this.options.pos;
2271
-
2272
- var variants = {
2273
- "bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
2274
- "bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
2275
- "bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
2276
- "top-left" : {top: 0 - height - posoffset, left: 0},
2277
- "top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
2278
- "top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
2279
- "left-top" : {top: 0, left: 0 - width - posoffset},
2280
- "left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
2281
- "left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
2282
- "right-top" : {top: 0, left: 0 + pos.width + posoffset},
2283
- "right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
2284
- "right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
2285
- },
2286
- css = {},
2287
- pp;
2288
-
2289
- pp = dpos.split('-');
2290
- css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2291
-
2292
- // justify dropdown
2293
- if (this.justified && this.justified.length) {
2294
- justify(dropdown.css({left:0}), this.justified, boundarywidth);
2295
- } else {
2296
-
2297
- if (this.options.preventflip !== true) {
2298
-
2299
- var fdpos;
2300
-
2301
- switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2302
- case "x":
2303
- if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
2304
- break;
2305
- case "y":
2306
- if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
2307
- break;
2308
- case "xy":
2309
- if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
2310
- break;
2311
- }
2312
-
2313
- if (fdpos) {
2314
-
2315
- pp = fdpos.split('-');
2316
- css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
2317
-
2318
- // check flipped
2319
- if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2320
- pp = dpos.split('-');
2321
- css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2322
- }
2323
- }
2324
- }
2325
- }
2326
-
2327
- if (width > boundarywidth) {
2328
- dropdown.addClass("uk-dropdown-stack");
2329
- this.trigger('stack.uk.dropdown', [this]);
2330
- }
2331
-
2332
- dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
2333
- },
2334
-
2335
- checkBoundary: function(left, top, width, height, boundarywidth) {
2336
-
2337
- var axis = "";
2338
-
2339
- if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
2340
- axis += "x";
2341
- }
2342
-
2343
- if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
2344
- axis += "y";
2345
- }
2346
-
2347
- return axis;
2348
- }
2349
- });
2350
-
2351
-
2352
- UI.component('dropdownOverlay', {
2353
-
2354
- defaults: {
2355
- justify : false,
2356
- cls : '',
2357
- duration: 200
2358
- },
2359
-
2360
- boot: function() {
2361
-
2362
- // init code
2363
- UI.ready(function(context) {
2364
-
2365
- UI.$("[data-uk-dropdown-overlay]", context).each(function() {
2366
- var ele = UI.$(this);
2367
-
2368
- if (!ele.data("dropdownOverlay")) {
2369
- UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
2370
- }
2371
- });
2372
- });
2373
- },
2374
-
2375
- init: function() {
2376
-
2377
- var $this = this;
2378
-
2379
- this.justified = this.options.justify ? UI.$(this.options.justify) : false;
2380
- this.overlay = this.element.find('uk-dropdown-overlay');
2381
-
2382
- if (!this.overlay.length) {
2383
- this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
2384
- }
2385
-
2386
- this.overlay.addClass(this.options.cls);
2387
-
2388
- this.on({
2389
-
2390
- 'beforeshow.uk.dropdown': function(e, dropdown) {
2391
- $this.dropdown = dropdown;
2392
-
2393
- if ($this.justified && $this.justified.length) {
2394
- justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
2395
- }
2396
- },
2397
-
2398
- 'show.uk.dropdown': function(e, dropdown) {
2399
-
2400
- var h = $this.dropdown.dropdown.outerHeight(true);
2401
-
2402
- $this.dropdown.element.removeClass('uk-open');
2403
-
2404
- $this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
2405
-
2406
- $this.dropdown.dropdown.css('visibility', '');
2407
- $this.dropdown.element.addClass('uk-open');
2408
-
2409
- UI.Utils.checkDisplay($this.dropdown.dropdown, true);
2410
- });
2411
-
2412
- $this.pointerleave = false;
2413
- },
2414
-
2415
- 'hide.uk.dropdown': function() {
2416
- $this.overlay.stop().animate({height: 0}, $this.options.duration);
2417
- },
2418
-
2419
- 'pointerenter.uk.dropdown': function(e, dropdown) {
2420
- clearTimeout($this.remainIdle);
2421
- },
2422
-
2423
- 'pointerleave.uk.dropdown': function(e, dropdown) {
2424
- $this.pointerleave = true;
2425
- }
2426
- });
2427
-
2428
-
2429
- this.overlay.on({
2430
-
2431
- 'mouseenter': function() {
2432
- if ($this.remainIdle) {
2433
- clearTimeout($this.dropdown.remainIdle);
2434
- clearTimeout($this.remainIdle);
2435
- }
2436
- },
2437
-
2438
- 'mouseleave': function(){
2439
-
2440
- if ($this.pointerleave && active) {
2441
-
2442
- $this.remainIdle = setTimeout(function() {
2443
- if(active) active.hide();
2444
- }, active.options.remaintime);
2445
- }
2446
- }
2447
- })
2448
- }
2449
-
2450
- });
2451
-
2452
-
2453
- function justify(ele, justifyTo, boundarywidth, offset) {
2454
-
2455
- ele = UI.$(ele);
2456
- justifyTo = UI.$(justifyTo);
2457
- boundarywidth = boundarywidth || window.innerWidth;
2458
- offset = offset || ele.offset();
2459
-
2460
- if (justifyTo.length) {
2461
-
2462
- var jwidth = justifyTo.outerWidth();
2463
-
2464
- ele.css("min-width", jwidth);
2465
-
2466
- if (UI.langdirection == 'right') {
2467
-
2468
- var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
2469
- right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
2470
-
2471
- ele.css("margin-right", right1 - right2);
2472
-
2473
- } else {
2474
- ele.css("margin-left", justifyTo.offset().left - offset.left);
2475
- }
2476
- }
2477
- }
2478
-
2479
- })(UIkit);
2480
-
2481
- (function(UI) {
2482
-
2483
- "use strict";
2484
-
2485
- var grids = [];
2486
-
2487
- UI.component('gridMatchHeight', {
2488
-
2489
- defaults: {
2490
- target : false,
2491
- row : true,
2492
- ignorestacked : false,
2493
- observe : false
2494
- },
2495
-
2496
- boot: function() {
2497
-
2498
- // init code
2499
- UI.ready(function(context) {
2500
-
2501
- UI.$("[data-uk-grid-match]", context).each(function() {
2502
- var grid = UI.$(this), obj;
2503
-
2504
- if (!grid.data("gridMatchHeight")) {
2505
- obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
2506
- }
2507
- });
2508
- });
2509
- },
2510
-
2511
- init: function() {
2512
-
2513
- var $this = this;
2514
-
2515
- this.columns = this.element.children();
2516
- this.elements = this.options.target ? this.find(this.options.target) : this.columns;
2517
-
2518
- if (!this.columns.length) return;
2519
-
2520
- UI.$win.on('load resize orientationchange', (function() {
2521
-
2522
- var fn = function() {
2523
- if ($this.element.is(":visible")) $this.match();
2524
- };
2525
-
2526
- UI.$(function() { fn(); });
2527
-
2528
- return UI.Utils.debounce(fn, 50);
2529
- })());
2530
-
2531
- if (this.options.observe) {
2532
-
2533
- UI.domObserve(this.element, function(e) {
2534
- if ($this.element.is(":visible")) $this.match();
2535
- });
2536
- }
2537
-
2538
- this.on("display.uk.check", function(e) {
2539
- if(this.element.is(":visible")) this.match();
2540
- }.bind(this));
2541
-
2542
- grids.push(this);
2543
- },
2544
-
2545
- match: function() {
2546
-
2547
- var firstvisible = this.columns.filter(":visible:first");
2548
-
2549
- if (!firstvisible.length) return;
2550
-
2551
- var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
2552
-
2553
- if (stacked && !this.options.ignorestacked) {
2554
- this.revert();
2555
- } else {
2556
- UI.Utils.matchHeights(this.elements, this.options);
2557
- }
2558
-
2559
- return this;
2560
- },
2561
-
2562
- revert: function() {
2563
- this.elements.css('min-height', '');
2564
- return this;
2565
- }
2566
- });
2567
-
2568
- UI.component('gridMargin', {
2569
-
2570
- defaults: {
2571
- cls : 'uk-grid-margin',
2572
- rowfirst : 'uk-row-first'
2573
- },
2574
-
2575
- boot: function() {
2576
-
2577
- // init code
2578
- UI.ready(function(context) {
2579
-
2580
- UI.$("[data-uk-grid-margin]", context).each(function() {
2581
- var grid = UI.$(this), obj;
2582
-
2583
- if (!grid.data("gridMargin")) {
2584
- obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
2585
- }
2586
- });
2587
- });
2588
- },
2589
-
2590
- init: function() {
2591
-
2592
- var stackMargin = UI.stackMargin(this.element, this.options);
2593
- }
2594
- });
2595
-
2596
- })(UIkit);
2597
-
2598
- (function(UI) {
2599
-
2600
- "use strict";
2601
-
2602
- var active = false, activeCount = 0, $html = UI.$html, body;
2603
-
2604
- UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
2605
- UI.$('.uk-modal.uk-open').each(function(){
2606
- return UI.$(this).data('modal') && UI.$(this).data('modal').resize();
2607
- });
2608
- }, 150));
2609
-
2610
- UI.component('modal', {
2611
-
2612
- defaults: {
2613
- keyboard: true,
2614
- bgclose: true,
2615
- minScrollHeight: 150,
2616
- center: false,
2617
- modal: true
2618
- },
2619
-
2620
- scrollable: false,
2621
- transition: false,
2622
- hasTransitioned: true,
2623
-
2624
- init: function() {
2625
-
2626
- if (!body) body = UI.$('body');
2627
-
2628
- if (!this.element.length) return;
2629
-
2630
- var $this = this;
2631
-
2632
- this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
2633
- this.dialog = this.find(".uk-modal-dialog");
2634
-
2635
- this.active = false;
2636
-
2637
- // Update ARIA
2638
- this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
2639
-
2640
- this.on("click", ".uk-modal-close", function(e) {
2641
- e.preventDefault();
2642
- $this.hide();
2643
- }).on("click", function(e) {
2644
-
2645
- var target = UI.$(e.target);
2646
-
2647
- if (target[0] == $this.element[0] && $this.options.bgclose) {
2648
- $this.hide();
2649
- }
2650
- });
2651
-
2652
- UI.domObserve(this.element, function(e) { $this.resize(); });
2653
- },
2654
-
2655
- toggle: function() {
2656
- return this[this.isActive() ? "hide" : "show"]();
2657
- },
2658
-
2659
- show: function() {
2660
-
2661
- if (!this.element.length) return;
2662
-
2663
- var $this = this;
2664
-
2665
- if (this.isActive()) return;
2666
-
2667
- if (this.options.modal && active) {
2668
- active.hide(true);
2669
- }
2670
-
2671
- this.element.removeClass("uk-open").show();
2672
- this.resize(true);
2673
-
2674
- if (this.options.modal) {
2675
- active = this;
2676
- }
2677
-
2678
- this.active = true;
2679
-
2680
- activeCount++;
2681
-
2682
- if (UI.support.transition) {
2683
- this.hasTransitioned = false;
2684
- this.element.one(UI.support.transition.end, function(){
2685
- $this.hasTransitioned = true;
2686
- UI.Utils.focus($this.dialog, 'a[href]');
2687
- }).addClass("uk-open");
2688
- } else {
2689
- this.element.addClass("uk-open");
2690
- UI.Utils.focus(this.dialog, 'a[href]');
2691
- }
2692
-
2693
- $html.addClass("uk-modal-page").height(); // force browser engine redraw
2694
-
2695
- // Update ARIA
2696
- this.element.attr('aria-hidden', 'false');
2697
-
2698
- this.element.trigger("show.uk.modal");
2699
-
2700
- UI.Utils.checkDisplay(this.dialog, true);
2701
-
2702
- return this;
2703
- },
2704
-
2705
- hide: function(force) {
2706
-
2707
- if (!force && UI.support.transition && this.hasTransitioned) {
2708
-
2709
- var $this = this;
2710
-
2711
- this.one(UI.support.transition.end, function() {
2712
- $this._hide();
2713
- }).removeClass("uk-open");
2714
-
2715
- } else {
2716
-
2717
- this._hide();
2718
- }
2719
-
2720
- return this;
2721
- },
2722
-
2723
- resize: function(force) {
2724
-
2725
- if (!this.isActive() && !force) return;
2726
-
2727
- var bodywidth = body.width();
2728
-
2729
- this.scrollbarwidth = window.innerWidth - bodywidth;
2730
-
2731
- body.css(this.paddingdir, this.scrollbarwidth);
2732
-
2733
- this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
2734
-
2735
- if (!this.updateScrollable() && this.options.center) {
2736
-
2737
- var dh = this.dialog.outerHeight(),
2738
- pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
2739
-
2740
- if ((dh + pad) < window.innerHeight) {
2741
- this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
2742
- } else {
2743
- this.dialog.css({'top': ''});
2744
- }
2745
- }
2746
- },
2747
-
2748
- updateScrollable: function() {
2749
-
2750
- // has scrollable?
2751
- var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
2752
-
2753
- if (scrollable.length) {
2754
-
2755
- scrollable.css('height', 0);
2756
-
2757
- var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)),
2758
- dh = this.dialog.outerHeight(),
2759
- wh = window.innerHeight,
2760
- h = wh - 2*(offset < 20 ? 20:offset) - dh;
2761
-
2762
- scrollable.css({
2763
- 'max-height': (h < this.options.minScrollHeight ? '':h),
2764
- 'height':''
2765
- });
2766
-
2767
- return true;
2768
- }
2769
-
2770
- return false;
2771
- },
2772
-
2773
- _hide: function() {
2774
-
2775
- this.active = false;
2776
- if (activeCount > 0) activeCount--;
2777
- else activeCount = 0;
2778
-
2779
- this.element.hide().removeClass('uk-open');
2780
-
2781
- // Update ARIA
2782
- this.element.attr('aria-hidden', 'true');
2783
-
2784
- if (!activeCount) {
2785
- $html.removeClass('uk-modal-page');
2786
- body.css(this.paddingdir, "");
2787
- }
2788
-
2789
- if (active===this) active = false;
2790
-
2791
- this.trigger('hide.uk.modal');
2792
- },
2793
-
2794
- isActive: function() {
2795
- return this.element.hasClass('uk-open');
2796
- }
2797
-
2798
- });
2799
-
2800
- UI.component('modalTrigger', {
2801
-
2802
- boot: function() {
2803
-
2804
- // init code
2805
- UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
2806
-
2807
- var ele = UI.$(this);
2808
-
2809
- if (ele.is("a")) {
2810
- e.preventDefault();
2811
- }
2812
-
2813
- if (!ele.data("modalTrigger")) {
2814
- var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
2815
- modal.show();
2816
- }
2817
-
2818
- });
2819
-
2820
- // close modal on esc button
2821
- UI.$html.on('keydown.modal.uikit', function (e) {
2822
-
2823
- if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
2824
- e.preventDefault();
2825
- active.hide();
2826
- }
2827
- });
2828
- },
2829
-
2830
- init: function() {
2831
-
2832
- var $this = this;
2833
-
2834
- this.options = UI.$.extend({
2835
- "target": $this.element.is("a") ? $this.element.attr("href") : false
2836
- }, this.options);
2837
-
2838
- this.modal = UI.modal(this.options.target, this.options);
2839
-
2840
- this.on("click", function(e) {
2841
- e.preventDefault();
2842
- $this.show();
2843
- });
2844
-
2845
- //methods
2846
- this.proxy(this.modal, "show hide isActive");
2847
- }
2848
- });
2849
-
2850
- UI.modal.dialog = function(content, options) {
2851
-
2852
- var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
2853
-
2854
- modal.on("hide.uk.modal", function(){
2855
- if (modal.persist) {
2856
- modal.persist.appendTo(modal.persist.data("modalPersistParent"));
2857
- modal.persist = false;
2858
- }
2859
- modal.element.remove();
2860
- });
2861
-
2862
- setContent(content, modal);
2863
-
2864
- return modal;
2865
- };
2866
-
2867
- UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
2868
-
2869
- UI.modal.alert = function(content, options) {
2870
-
2871
- options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2872
-
2873
- var modal = UI.modal.dialog(([
2874
- '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2875
- '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
2876
- ]).join(""), options);
2877
-
2878
- modal.on('show.uk.modal', function(){
2879
- setTimeout(function(){
2880
- modal.element.find('button:first').focus();
2881
- }, 50);
2882
- });
2883
-
2884
- return modal.show();
2885
- };
2886
-
2887
- UI.modal.confirm = function(content, onconfirm, oncancel) {
2888
-
2889
- var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {};
2890
-
2891
- onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
2892
- oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){};
2893
- options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options);
2894
-
2895
- var modal = UI.modal.dialog(([
2896
- '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2897
- '<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>'
2898
- ]).join(""), options);
2899
-
2900
- modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){
2901
- UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel();
2902
- modal.hide();
2903
- });
2904
-
2905
- modal.on('show.uk.modal', function(){
2906
- setTimeout(function(){
2907
- modal.element.find('.js-modal-confirm').focus();
2908
- }, 50);
2909
- });
2910
-
2911
- return modal.show();
2912
- };
2913
-
2914
- UI.modal.prompt = function(text, value, onsubmit, options) {
2915
-
2916
- onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
2917
- options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2918
-
2919
- var modal = UI.modal.dialog(([
2920
- text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
2921
- '<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
2922
- '<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>'
2923
- ]).join(""), options),
2924
-
2925
- input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
2926
- if (e.keyCode == 13) {
2927
- modal.element.find(".js-modal-ok").trigger('click');
2928
- }
2929
- });
2930
-
2931
- modal.element.find(".js-modal-ok").on("click", function(){
2932
- if (onsubmit(input.val())!==false){
2933
- modal.hide();
2934
- }
2935
- });
2936
-
2937
- return modal.show();
2938
- };
2939
-
2940
- UI.modal.blockUI = function(content, options) {
2941
-
2942
- var modal = UI.modal.dialog(([
2943
- '<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
2944
- ]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
2945
-
2946
- modal.content = modal.element.find('.uk-modal-content:first');
2947
-
2948
- return modal.show();
2949
- };
2950
-
2951
-
2952
- UI.modal.labels = {
2953
- 'Ok': 'Ok',
2954
- 'Cancel': 'Cancel'
2955
- };
2956
-
2957
-
2958
- // helper functions
2959
- function setContent(content, modal){
2960
-
2961
- if(!modal) return;
2962
-
2963
- if (typeof content === 'object') {
2964
-
2965
- // convert DOM object to a jQuery object
2966
- content = content instanceof jQuery ? content : UI.$(content);
2967
-
2968
- if(content.parent().length) {
2969
- modal.persist = content;
2970
- modal.persist.data("modalPersistParent", content.parent());
2971
- }
2972
- }else if (typeof content === 'string' || typeof content === 'number') {
2973
- // just insert the data as innerHTML
2974
- content = UI.$('<div></div>').html(content);
2975
- }else {
2976
- // unsupported data type!
2977
- content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
2978
- }
2979
-
2980
- content.appendTo(modal.element.find('.uk-modal-dialog'));
2981
-
2982
- return modal;
2983
- }
2984
-
2985
- })(UIkit);
2986
-
2987
- (function(UI) {
2988
-
2989
- "use strict";
2990
-
2991
- UI.component('nav', {
2992
-
2993
- defaults: {
2994
- toggle: ">li.uk-parent > a[href='#']",
2995
- lists: ">li.uk-parent > ul",
2996
- multiple: false
2997
- },
2998
-
2999
- boot: function() {
3000
-
3001
- // init code
3002
- UI.ready(function(context) {
3003
-
3004
- UI.$("[data-uk-nav]", context).each(function() {
3005
- var nav = UI.$(this);
3006
-
3007
- if (!nav.data("nav")) {
3008
- var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
3009
- }
3010
- });
3011
- });
3012
- },
3013
-
3014
- init: function() {
3015
-
3016
- var $this = this;
3017
-
3018
- this.on("click.uk.nav", this.options.toggle, function(e) {
3019
- e.preventDefault();
3020
- var ele = UI.$(this);
3021
- $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
3022
- });
3023
-
3024
- this.update();
3025
-
3026
- UI.domObserve(this.element, function(e) {
3027
- if ($this.element.find($this.options.lists).not('[role]').length) {
3028
- $this.update();
3029
- }
3030
- });
3031
- },
3032
-
3033
- update: function() {
3034
-
3035
- var $this = this;
3036
-
3037
- this.find(this.options.lists).each(function() {
3038
-
3039
- var $ele = UI.$(this).attr('role', 'menu'),
3040
- parent = $ele.closest('li'),
3041
- active = parent.hasClass("uk-active");
3042
-
3043
- if (!parent.data('list-container')) {
3044
- $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
3045
- parent.data('list-container', $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
3046
- }
3047
-
3048
- // Init ARIA
3049
- parent.attr('aria-expanded', parent.hasClass("uk-open"));
3050
-
3051
- if (active) $this.open(parent, true);
3052
- });
3053
- },
3054
-
3055
- open: function(li, noanimation) {
3056
-
3057
- var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container');
3058
-
3059
- if (!this.options.multiple) {
3060
-
3061
- element.children('.uk-open').not(li).each(function() {
3062
-
3063
- var ele = UI.$(this);
3064
-
3065
- if (ele.data('list-container')) {
3066
- ele.data('list-container').stop().animate({height: 0}, function() {
3067
- UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden');
3068
- });
3069
- }
3070
- });
3071
- }
3072
-
3073
- $li.toggleClass('uk-open');
3074
-
3075
- // Update ARIA
3076
- $li.attr('aria-expanded', $li.hasClass('uk-open'));
3077
-
3078
- if ($container) {
3079
-
3080
- if ($li.hasClass('uk-open')) {
3081
- $container.removeClass('uk-hidden');
3082
- }
3083
-
3084
- if (noanimation) {
3085
-
3086
- $container.stop().height($li.hasClass('uk-open') ? 'auto' : 0);
3087
-
3088
- if (!$li.hasClass('uk-open')) {
3089
- $container.addClass('uk-hidden');
3090
- }
3091
-
3092
- this.trigger('display.uk.check');
3093
-
3094
- } else {
3095
-
3096
- $container.stop().animate({
3097
- height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0)
3098
- }, function() {
3099
-
3100
- if (!$li.hasClass('uk-open')) {
3101
- $container.addClass('uk-hidden');
3102
- } else {
3103
- $container.css('height', '');
3104
- }
3105
-
3106
- $this.trigger('display.uk.check');
3107
- });
3108
- }
3109
- }
3110
- }
3111
- });
3112
-
3113
-
3114
- // helper
3115
-
3116
- function getHeight(ele) {
3117
-
3118
- var $ele = UI.$(ele), height = "auto";
3119
-
3120
- if ($ele.is(":visible")) {
3121
- height = $ele.outerHeight();
3122
- } else {
3123
- var tmp = {
3124
- position: $ele.css("position"),
3125
- visibility: $ele.css("visibility"),
3126
- display: $ele.css("display")
3127
- };
3128
-
3129
- height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
3130
-
3131
- $ele.css(tmp); // reset element
3132
- }
3133
-
3134
- return height;
3135
- }
3136
-
3137
- })(UIkit);
3138
-
3139
- (function(UI) {
3140
-
3141
- "use strict";
3142
-
3143
- var scrollpos = {x: window.scrollX, y: window.scrollY},
3144
- $win = UI.$win,
3145
- $doc = UI.$doc,
3146
- $html = UI.$html,
3147
- Offcanvas = {
3148
-
3149
- show: function(element, options) {
3150
-
3151
- element = UI.$(element);
3152
-
3153
- if (!element.length) return;
3154
-
3155
- options = UI.$.extend({mode: 'push'}, options);
3156
-
3157
- var $body = UI.$('body'),
3158
- bar = element.find('.uk-offcanvas-bar:first'),
3159
- rtl = (UI.langdirection == 'right'),
3160
- flip = bar.hasClass('uk-offcanvas-bar-flip') ? -1:1,
3161
- dir = flip * (rtl ? -1 : 1),
3162
-
3163
- scrollbarwidth = window.innerWidth - $body.width();
3164
-
3165
- scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
3166
-
3167
- bar.attr('mode', options.mode);
3168
- element.addClass("uk-active");
3169
-
3170
- $body.css({width: window.innerWidth - scrollbarwidth, height: window.innerHeight}).addClass("uk-offcanvas-page");
3171
-
3172
- if (options.mode == 'push' || options.mode == 'reveal') {
3173
- $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir));
3174
- }
3175
-
3176
- if (options.mode == 'reveal') {
3177
- bar.css('clip', 'rect(0, '+bar.outerWidth()+'px, 100vh, 0)');
3178
- }
3179
-
3180
- $html.css('margin-top', scrollpos.y * -1).width(); // .width() - force redraw
3181
-
3182
-
3183
- bar.addClass("uk-offcanvas-bar-show");
3184
-
3185
- this._initElement(element);
3186
-
3187
- bar.trigger('show.uk.offcanvas', [element, bar]);
3188
-
3189
- // Update ARIA
3190
- element.attr('aria-hidden', 'false');
3191
- },
3192
-
3193
- hide: function(force) {
3194
-
3195
- var $body = UI.$('body'),
3196
- panel = UI.$(".uk-offcanvas.uk-active"),
3197
- rtl = (UI.langdirection == "right"),
3198
- bar = panel.find(".uk-offcanvas-bar:first"),
3199
- finalize = function() {
3200
- $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
3201
- panel.removeClass("uk-active");
3202
-
3203
- bar.removeClass("uk-offcanvas-bar-show");
3204
- $html.css('margin-top', '');
3205
- window.scrollTo(scrollpos.x, scrollpos.y);
3206
- bar.trigger('hide.uk.offcanvas', [panel, bar]);
3207
-
3208
- // Update ARIA
3209
- panel.attr('aria-hidden', 'true');
3210
- };
3211
-
3212
- if (!panel.length) return;
3213
- if (bar.attr('mode') == 'none') force = true;
3214
-
3215
- if (UI.support.transition && !force) {
3216
-
3217
- $body.one(UI.support.transition.end, function() {
3218
- finalize();
3219
- }).css((rtl ? 'margin-right' : 'margin-left'), '');
3220
-
3221
- if (bar.attr('mode') == 'reveal') {
3222
- bar.css('clip', '');
3223
- }
3224
-
3225
- setTimeout(function(){
3226
- bar.removeClass('uk-offcanvas-bar-show');
3227
- }, 0);
3228
-
3229
- } else {
3230
- finalize();
3231
- }
3232
- },
3233
-
3234
- _initElement: function(element) {
3235
-
3236
- if (element.data('OffcanvasInit')) return;
3237
-
3238
- element.on('click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas', function(e) {
3239
-
3240
- var target = UI.$(e.target);
3241
-
3242
- if (!e.type.match(/swipe/)) {
3243
-
3244
- if (!target.hasClass('uk-offcanvas-close')) {
3245
- if (target.hasClass('uk-offcanvas-bar')) return;
3246
- if (target.parents('.uk-offcanvas-bar:first').length) return;
3247
- }
3248
- }
3249
-
3250
- e.stopImmediatePropagation();
3251
- Offcanvas.hide();
3252
- });
3253
-
3254
- element.on('click', "a[href*='#']", function(e){
3255
-
3256
- var link = UI.$(this),
3257
- href = link.attr('href');
3258
-
3259
- if (href == '#') {
3260
- return;
3261
- }
3262
-
3263
- UI.$doc.one('hide.uk.offcanvas', function() {
3264
-
3265
- var target;
3266
-
3267
- try {
3268
- target = UI.$(link[0].hash);
3269
- } catch (e){
3270
- target = '';
3271
- }
3272
-
3273
- if (!target.length) {
3274
- target = UI.$('[name="'+link[0].hash.replace('#','')+'"]');
3275
- }
3276
-
3277
- if (target.length && UI.Utils.scrollToElement) {
3278
- UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
3279
- } else {
3280
- window.location.href = href;
3281
- }
3282
- });
3283
-
3284
- Offcanvas.hide();
3285
- });
3286
-
3287
- element.data('OffcanvasInit', true);
3288
- }
3289
- };
3290
-
3291
- UI.component('offcanvasTrigger', {
3292
-
3293
- boot: function() {
3294
-
3295
- // init code
3296
- $html.on('click.offcanvas.uikit', '[data-uk-offcanvas]', function(e) {
3297
-
3298
- e.preventDefault();
3299
-
3300
- var ele = UI.$(this);
3301
-
3302
- if (!ele.data('offcanvasTrigger')) {
3303
- var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr('data-uk-offcanvas')));
3304
- ele.trigger("click");
3305
- }
3306
- });
3307
-
3308
- $html.on('keydown.uk.offcanvas', function(e) {
3309
-
3310
- if (e.keyCode === 27) { // ESC
3311
- Offcanvas.hide();
3312
- }
3313
- });
3314
- },
3315
-
3316
- init: function() {
3317
-
3318
- var $this = this;
3319
-
3320
- this.options = UI.$.extend({
3321
- target: $this.element.is('a') ? $this.element.attr('href') : false,
3322
- mode: 'push'
3323
- }, this.options);
3324
-
3325
- this.on('click', function(e) {
3326
- e.preventDefault();
3327
- Offcanvas.show($this.options.target, $this.options);
3328
- });
3329
- }
3330
- });
3331
-
3332
- UI.offcanvas = Offcanvas;
3333
-
3334
- })(UIkit);
3335
-
3336
- (function(UI) {
3337
-
3338
- "use strict";
3339
-
3340
- var Animations;
3341
-
3342
- UI.component('switcher', {
3343
-
3344
- defaults: {
3345
- connect : false,
3346
- toggle : ">*",
3347
- active : 0,
3348
- animation : false,
3349
- duration : 200,
3350
- swiping : true
3351
- },
3352
-
3353
- animating: false,
3354
-
3355
- boot: function() {
3356
-
3357
- // init code
3358
- UI.ready(function(context) {
3359
-
3360
- UI.$("[data-uk-switcher]", context).each(function() {
3361
- var switcher = UI.$(this);
3362
-
3363
- if (!switcher.data("switcher")) {
3364
- var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
3365
- }
3366
- });
3367
- });
3368
- },
3369
-
3370
- init: function() {
3371
-
3372
- var $this = this;
3373
-
3374
- this.on('click.uk.switcher', this.options.toggle, function(e) {
3375
- e.preventDefault();
3376
- $this.show(this);
3377
- });
3378
-
3379
- if (!this.options.connect) {
3380
- return;
3381
- }
3382
-
3383
- this.connect = UI.$(this.options.connect);
3384
-
3385
- if (!this.connect.length) {
3386
- return;
3387
- }
3388
-
3389
- this.connect.on('click.uk.switcher', '[data-uk-switcher-item]', function(e) {
3390
-
3391
- e.preventDefault();
3392
-
3393
- var item = UI.$(this).attr('data-uk-switcher-item');
3394
-
3395
- if ($this.index == item) return;
3396
-
3397
- switch(item) {
3398
- case 'next':
3399
- case 'previous':
3400
- $this.show($this.index + (item=='next' ? 1:-1));
3401
- break;
3402
- default:
3403
- $this.show(parseInt(item, 10));
3404
- }
3405
- });
3406
-
3407
- if (this.options.swiping) {
3408
-
3409
- this.connect.on('swipeRight swipeLeft', function(e) {
3410
- e.preventDefault();
3411
- if (!window.getSelection().toString()) {
3412
- $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
3413
- }
3414
- });
3415
- }
3416
-
3417
- this.update();
3418
- },
3419
-
3420
- update: function() {
3421
-
3422
- this.connect.children().removeClass('uk-active').attr('aria-hidden', 'true');
3423
-
3424
- var toggles = this.find(this.options.toggle),
3425
- active = toggles.filter(".uk-active");
3426
-
3427
- if (active.length) {
3428
- this.show(active, false);
3429
- } else {
3430
-
3431
- if (this.options.active===false) return;
3432
-
3433
- active = toggles.eq(this.options.active);
3434
- this.show(active.length ? active : toggles.eq(0), false);
3435
- }
3436
-
3437
- // Init ARIA for toggles
3438
- toggles.not(active).attr('aria-expanded', 'false');
3439
- active.attr('aria-expanded', 'true');
3440
- },
3441
-
3442
- show: function(tab, animate) {
3443
-
3444
- if (this.animating) {
3445
- return;
3446
- }
3447
-
3448
- if (isNaN(tab)) {
3449
- tab = UI.$(tab);
3450
- } else {
3451
-
3452
- var toggles = this.find(this.options.toggle);
3453
-
3454
- tab = tab < 0 ? toggles.length-1 : tab;
3455
- tab = toggles.eq(toggles[tab] ? tab : 0);
3456
- }
3457
-
3458
- var $this = this,
3459
- toggles = this.find(this.options.toggle),
3460
- active = UI.$(tab),
3461
- animation = Animations[this.options.animation] || function(current, next) {
3462
-
3463
- if (!$this.options.animation) {
3464
- return Animations.none.apply($this);
3465
- }
3466
-
3467
- var anim = $this.options.animation.split(',');
3468
-
3469
- if (anim.length == 1) {
3470
- anim[1] = anim[0];
3471
- }
3472
-
3473
- anim[0] = anim[0].trim();
3474
- anim[1] = anim[1].trim();
3475
-
3476
- return coreAnimation.apply($this, [anim, current, next]);
3477
- };
3478
-
3479
- if (animate===false || !UI.support.animation) {
3480
- animation = Animations.none;
3481
- }
3482
-
3483
- if (active.hasClass("uk-disabled")) return;
3484
-
3485
- // Update ARIA for Toggles
3486
- toggles.attr('aria-expanded', 'false');
3487
- active.attr('aria-expanded', 'true');
3488
-
3489
- toggles.filter(".uk-active").removeClass("uk-active");
3490
- active.addClass("uk-active");
3491
-
3492
- if (this.options.connect && this.connect.length) {
3493
-
3494
- this.index = this.find(this.options.toggle).index(active);
3495
-
3496
- if (this.index == -1 ) {
3497
- this.index = 0;
3498
- }
3499
-
3500
- this.connect.each(function() {
3501
-
3502
- var container = UI.$(this),
3503
- children = UI.$(container.children()),
3504
- current = UI.$(children.filter('.uk-active')),
3505
- next = UI.$(children.eq($this.index));
3506
-
3507
- $this.animating = true;
3508
-
3509
- animation.apply($this, [current, next]).then(function(){
3510
-
3511
- current.removeClass("uk-active");
3512
- next.addClass("uk-active");
3513
-
3514
- // Update ARIA for connect
3515
- current.attr('aria-hidden', 'true');
3516
- next.attr('aria-hidden', 'false');
3517
-
3518
- UI.Utils.checkDisplay(next, true);
3519
-
3520
- $this.animating = false;
3521
-
3522
- });
3523
- });
3524
- }
3525
-
3526
- this.trigger("show.uk.switcher", [active]);
3527
- }
3528
- });
3529
-
3530
- Animations = {
3531
-
3532
- 'none': function() {
3533
- var d = UI.$.Deferred();
3534
- d.resolve();
3535
- return d.promise();
3536
- },
3537
-
3538
- 'fade': function(current, next) {
3539
- return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
3540
- },
3541
-
3542
- 'slide-bottom': function(current, next) {
3543
- return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
3544
- },
3545
-
3546
- 'slide-top': function(current, next) {
3547
- return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
3548
- },
3549
-
3550
- 'slide-vertical': function(current, next, dir) {
3551
-
3552
- var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
3553
-
3554
- if (current && current.index() > next.index()) {
3555
- anim.reverse();
3556
- }
3557
-
3558
- return coreAnimation.apply(this, [anim, current, next]);
3559
- },
3560
-
3561
- 'slide-left': function(current, next) {
3562
- return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
3563
- },
3564
-
3565
- 'slide-right': function(current, next) {
3566
- return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
3567
- },
3568
-
3569
- 'slide-horizontal': function(current, next, dir) {
3570
-
3571
- var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
3572
-
3573
- if (current && current.index() > next.index()) {
3574
- anim.reverse();
3575
- }
3576
-
3577
- return coreAnimation.apply(this, [anim, current, next]);
3578
- },
3579
-
3580
- 'scale': function(current, next) {
3581
- return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
3582
- }
3583
- };
3584
-
3585
- UI.switcher.animations = Animations;
3586
-
3587
-
3588
- // helpers
3589
-
3590
- function coreAnimation(cls, current, next) {
3591
-
3592
- var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
3593
-
3594
- if (next[0]===current[0]) {
3595
- d.resolve();
3596
- return d.promise();
3597
- }
3598
-
3599
- if (typeof(cls) == 'object') {
3600
- clsIn = cls[0];
3601
- clsOut = cls[1] || cls[0];
3602
- }
3603
-
3604
- UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS
3605
-
3606
- release = function() {
3607
-
3608
- if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
3609
-
3610
- next.addClass(clsIn).one(UI.support.animation.end, function() {
3611
-
3612
- setTimeout(function () {
3613
- next.removeClass(''+clsIn+'').css({opacity:'', display:''});
3614
- }, 0);
3615
-
3616
- d.resolve();
3617
-
3618
- UI.$body.css('overflow-x', '');
3619
-
3620
- if (current) current.css({opacity:'', display:''});
3621
-
3622
- }.bind(this)).show();
3623
- };
3624
-
3625
- next.css('animation-duration', this.options.duration+'ms');
3626
-
3627
- if (current && current.length) {
3628
-
3629
- current.css('animation-duration', this.options.duration+'ms');
3630
-
3631
- current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
3632
- release();
3633
- }.bind(this)).css('display', '');
3634
-
3635
- } else {
3636
- next.addClass('uk-active');
3637
- release();
3638
- }
3639
-
3640
- return d.promise();
3641
- }
3642
-
3643
- })(UIkit);
3644
-
3645
- (function(UI) {
3646
-
3647
- "use strict";
3648
-
3649
- UI.component('tab', {
3650
-
3651
- defaults: {
3652
- target : '>li:not(.uk-tab-responsive, .uk-disabled)',
3653
- connect : false,
3654
- active : 0,
3655
- animation : false,
3656
- duration : 200,
3657
- swiping : true
3658
- },
3659
-
3660
- boot: function() {
3661
-
3662
- // init code
3663
- UI.ready(function(context) {
3664
-
3665
- UI.$("[data-uk-tab]", context).each(function() {
3666
-
3667
- var tab = UI.$(this);
3668
-
3669
- if (!tab.data("tab")) {
3670
- var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
3671
- }
3672
- });
3673
- });
3674
- },
3675
-
3676
- init: function() {
3677
-
3678
- var $this = this;
3679
-
3680
- this.current = false;
3681
-
3682
- this.on("click.uk.tab", this.options.target, function(e) {
3683
-
3684
- e.preventDefault();
3685
-
3686
- if ($this.switcher && $this.switcher.animating) {
3687
- return;
3688
- }
3689
-
3690
- var current = $this.find($this.options.target).not(this);
3691
-
3692
- current.removeClass("uk-active").blur();
3693
-
3694
- $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
3695
-
3696
- $this.current = UI.$(this);
3697
-
3698
- // Update ARIA
3699
- if (!$this.options.connect) {
3700
- current.attr('aria-expanded', 'false');
3701
- UI.$(this).attr('aria-expanded', 'true');
3702
- }
3703
- });
3704
-
3705
- if (this.options.connect) {
3706
- this.connect = UI.$(this.options.connect);
3707
- }
3708
-
3709
- // init responsive tab
3710
- 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>');
3711
-
3712
- this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
3713
- this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
3714
- this.responsivetab.caption = this.responsivetab.find('a:first');
3715
-
3716
- if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
3717
-
3718
- // handle click
3719
- this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
3720
-
3721
- e.preventDefault();
3722
- e.stopPropagation();
3723
-
3724
- var link = UI.$(this);
3725
-
3726
- $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
3727
- });
3728
-
3729
- this.on('show.uk.switcher change.uk.tab', function(e, tab) {
3730
- $this.responsivetab.caption.html(tab.text());
3731
- });
3732
-
3733
- this.element.append(this.responsivetab);
3734
-
3735
- // init UIkit components
3736
- if (this.options.connect) {
3737
- this.switcher = UI.switcher(this.element, {
3738
- 'toggle' : '>li:not(.uk-tab-responsive)',
3739
- 'connect' : this.options.connect,
3740
- 'active' : this.options.active,
3741
- 'animation' : this.options.animation,
3742
- 'duration' : this.options.duration,
3743
- 'swiping' : this.options.swiping
3744
- });
3745
- }
3746
-
3747
- UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"});
3748
-
3749
- // init
3750
- $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
3751
-
3752
- this.check();
3753
-
3754
- UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
3755
- if ($this.element.is(":visible")) $this.check();
3756
- }, 100));
3757
-
3758
- this.on('display.uk.check', function(){
3759
- if ($this.element.is(":visible")) $this.check();
3760
- });
3761
- },
3762
-
3763
- check: function() {
3764
-
3765
- var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
3766
-
3767
- if (!children.length) {
3768
- this.responsivetab.addClass('uk-hidden');
3769
- return;
3770
- }
3771
-
3772
- var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
3773
- doresponsive = false,
3774
- item, link, clone;
3775
-
3776
- this.responsivetab.lst.empty();
3777
-
3778
- children.each(function(){
3779
-
3780
- if (UI.$(this).offset().top > top) {
3781
- doresponsive = true;
3782
- }
3783
- });
3784
-
3785
- if (doresponsive) {
3786
-
3787
- for (var i = 0; i < children.length; i++) {
3788
-
3789
- item = UI.$(children.eq(i));
3790
- link = item.find('a');
3791
-
3792
- if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
3793
-
3794
- if (!item.hasClass('uk-disabled')) {
3795
-
3796
- clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" ');
3797
-
3798
- this.responsivetab.lst.append(clone);
3799
- }
3800
-
3801
- item.addClass('uk-hidden');
3802
- }
3803
- }
3804
- }
3805
-
3806
- this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
3807
- }
3808
- });
3809
-
3810
- })(UIkit);
3811
-
3812
- (function(UI){
3813
-
3814
- "use strict";
3815
-
3816
- UI.component('cover', {
3817
-
3818
- defaults: {
3819
- automute : true
3820
- },
3821
-
3822
- boot: function() {
3823
-
3824
- // auto init
3825
- UI.ready(function(context) {
3826
-
3827
- UI.$("[data-uk-cover]", context).each(function(){
3828
-
3829
- var ele = UI.$(this);
3830
-
3831
- if(!ele.data("cover")) {
3832
- var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
3833
- }
3834
- });
3835
- });
3836
- },
3837
-
3838
- init: function() {
3839
-
3840
- this.parent = this.element.parent();
3841
-
3842
- UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
3843
- this.check();
3844
- }.bind(this), 100));
3845
-
3846
- this.on("display.uk.check", function(e) {
3847
- if(this.element.is(":visible")) this.check();
3848
- }.bind(this));
3849
-
3850
- this.check();
3851
-
3852
- if (this.element.is('iframe') && this.options.automute) {
3853
-
3854
- var src = this.element.attr('src');
3855
-
3856
- this.element.attr('src', '').on('load', function(){
3857
-
3858
- this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
3859
-
3860
- }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
3861
- }
3862
- },
3863
-
3864
- check: function() {
3865
-
3866
- this.element.css({
3867
- width : '',
3868
- height : ''
3869
- });
3870
-
3871
- this.dimension = {w: this.element.width(), h: this.element.height()};
3872
-
3873
- if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
3874
- this.dimension.w = this.element.attr('width');
3875
- }
3876
-
3877
- if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
3878
- this.dimension.h = this.element.attr('height');
3879
- }
3880
-
3881
- this.ratio = this.dimension.w / this.dimension.h;
3882
-
3883
- var w = this.parent.width(), h = this.parent.height(), width, height;
3884
-
3885
- // if element height < parent height (gap underneath)
3886
- if ((w / this.ratio) < h) {
3887
-
3888
- width = Math.ceil(h * this.ratio);
3889
- height = h;
3890
-
3891
- // element width < parent width (gap to right)
3892
- } else {
3893
-
3894
- width = w;
3895
- height = Math.ceil(w / this.ratio);
3896
- }
3897
-
3898
- this.element.css({
3899
- 'width' : width,
3900
- 'height' : height
3901
- });
3902
- }
3903
- });
3904
-
3905
- })(UIkit);