uikit-sass-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/CHANGELOG.md +5 -0
  4. data/LICENSE.md +155 -0
  5. data/README.md +78 -0
  6. data/lib/uikit-sass-rails.rb +1 -0
  7. data/lib/uikit/sass/rails.rb +2 -0
  8. data/lib/uikit/sass/rails/engine.rb +12 -0
  9. data/lib/uikit/sass/rails/version.rb +7 -0
  10. data/uikit-sass-rails.gemspec +24 -0
  11. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  12. data/vendor/assets/fonts/fontawesome-webfont.svg +504 -0
  13. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  14. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  15. data/vendor/assets/javascripts/uikit.js +14 -0
  16. data/vendor/assets/javascripts/uikit/addons/autocomplete.js +306 -0
  17. data/vendor/assets/javascripts/uikit/addons/datepicker.js +365 -0
  18. data/vendor/assets/javascripts/uikit/addons/form-password.js +62 -0
  19. data/vendor/assets/javascripts/uikit/addons/form-select.js +62 -0
  20. data/vendor/assets/javascripts/uikit/addons/htmleditor.js +594 -0
  21. data/vendor/assets/javascripts/uikit/addons/nestable.js +574 -0
  22. data/vendor/assets/javascripts/uikit/addons/notify.js +177 -0
  23. data/vendor/assets/javascripts/uikit/addons/pagination.js +146 -0
  24. data/vendor/assets/javascripts/uikit/addons/search.js +90 -0
  25. data/vendor/assets/javascripts/uikit/addons/sortable.js +494 -0
  26. data/vendor/assets/javascripts/uikit/addons/sticky.js +130 -0
  27. data/vendor/assets/javascripts/uikit/addons/timepicker.js +163 -0
  28. data/vendor/assets/javascripts/uikit/addons/upload.js +239 -0
  29. data/vendor/assets/javascripts/uikit/uikit.js +2573 -0
  30. data/vendor/assets/stylesheets/extra/font-awesome.scss +16 -0
  31. data/vendor/assets/stylesheets/uikit.scss +5 -0
  32. data/vendor/assets/stylesheets/uikit/addons/uikit.addons.scss +1326 -0
  33. data/vendor/assets/stylesheets/uikit/addons/uikit.almost-flat.addons.scss +1423 -0
  34. data/vendor/assets/stylesheets/uikit/addons/uikit.gradient.addons.scss +1445 -0
  35. data/vendor/assets/stylesheets/uikit/almost-flat.scss +5 -0
  36. data/vendor/assets/stylesheets/uikit/gradient.scss +5 -0
  37. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +8207 -0
  38. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +8264 -0
  39. data/vendor/assets/stylesheets/uikit/uikit.scss +7874 -0
  40. metadata +100 -0
@@ -0,0 +1,2573 @@
1
+ /*! UIkit 2.8.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+
3
+ (function(core) {
4
+
5
+ if (typeof define == "function" && define.amd) { // AMD
6
+ define("uikit", function(){
7
+
8
+ var 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+'/js/addons/'+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 = $.UIkit || {}, $html = $("html"), $win = $(window), $doc = $(document);
46
+
47
+ if (UI.fn) {
48
+ return UI;
49
+ }
50
+
51
+ UI.version = '2.8.0';
52
+ UI.$doc = $doc;
53
+ UI.$win = $win;
54
+
55
+ UI.fn = function(command, options) {
56
+
57
+ var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
58
+
59
+ if (!UI[component]) {
60
+ $.error("UIkit component [" + component + "] does not exist.");
61
+ return this;
62
+ }
63
+
64
+ return this.each(function() {
65
+ var $this = $(this), data = $this.data(component);
66
+ if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
67
+ if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
68
+ });
69
+ };
70
+
71
+
72
+ UI.support = {};
73
+ UI.support.transition = (function() {
74
+
75
+ var transitionEnd = (function() {
76
+
77
+ var element = doc.body || doc.documentElement,
78
+ transEndEventNames = {
79
+ WebkitTransition: 'webkitTransitionEnd',
80
+ MozTransition: 'transitionend',
81
+ OTransition: 'oTransitionEnd otransitionend',
82
+ transition: 'transitionend'
83
+ }, name;
84
+
85
+ for (name in transEndEventNames) {
86
+ if (element.style[name] !== undefined) return transEndEventNames[name];
87
+ }
88
+ }());
89
+
90
+ return transitionEnd && { end: transitionEnd };
91
+ })();
92
+
93
+ UI.support.animation = (function() {
94
+
95
+ var animationEnd = (function() {
96
+
97
+ var element = doc.body || doc.documentElement,
98
+ animEndEventNames = {
99
+ WebkitAnimation: 'webkitAnimationEnd',
100
+ MozAnimation: 'animationend',
101
+ OAnimation: 'oAnimationEnd oanimationend',
102
+ animation: 'animationend'
103
+ }, name;
104
+
105
+ for (name in animEndEventNames) {
106
+ if (element.style[name] !== undefined) return animEndEventNames[name];
107
+ }
108
+ }());
109
+
110
+ return animationEnd && { end: animationEnd };
111
+ })();
112
+
113
+ UI.support.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function(callback){ setTimeout(callback, 1000/60); };
114
+ UI.support.touch = (
115
+ ('ontouchstart' in window && navigator.userAgent.toLowerCase().match(/mobile|tablet/)) ||
116
+ (global.DocumentTouch && document instanceof global.DocumentTouch) ||
117
+ (global.navigator['msPointerEnabled'] && global.navigator['msMaxTouchPoints'] > 0) || //IE 10
118
+ (global.navigator['pointerEnabled'] && global.navigator['maxTouchPoints'] > 0) || //IE >=11
119
+ false
120
+ );
121
+ UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || global.MozMutationObserver || null);
122
+
123
+ UI.Utils = {};
124
+
125
+ UI.Utils.debounce = function(func, wait, immediate) {
126
+ var timeout;
127
+ return function() {
128
+ var context = this, args = arguments;
129
+ var later = function() {
130
+ timeout = null;
131
+ if (!immediate) func.apply(context, args);
132
+ };
133
+ var callNow = immediate && !timeout;
134
+ clearTimeout(timeout);
135
+ timeout = setTimeout(later, wait);
136
+ if (callNow) func.apply(context, args);
137
+ };
138
+ };
139
+
140
+ UI.Utils.removeCssRules = function(selectorRegEx) {
141
+ var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
142
+
143
+ if(!selectorRegEx) return;
144
+
145
+ setTimeout(function(){
146
+ try {
147
+ _ref = document.styleSheets;
148
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
149
+ stylesheet = _ref[_i];
150
+ idxs = [];
151
+ stylesheet.cssRules = stylesheet.cssRules;
152
+ for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
153
+ if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
154
+ idxs.unshift(idx);
155
+ }
156
+ }
157
+ for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
158
+ stylesheet.deleteRule(idxs[_k]);
159
+ }
160
+ }
161
+ } catch (_error) {}
162
+ }, 0);
163
+ };
164
+
165
+ UI.Utils.isInView = function(element, options) {
166
+
167
+ var $element = $(element);
168
+
169
+ if (!$element.is(':visible')) {
170
+ return false;
171
+ }
172
+
173
+ var window_left = $win.scrollLeft(), window_top = $win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
174
+
175
+ options = $.extend({topoffset:0, leftoffset:0}, options);
176
+
177
+ if (top + $element.height() >= window_top && top - options.topoffset <= window_top + $win.height() &&
178
+ left + $element.width() >= window_left && left - options.leftoffset <= window_left + $win.width()) {
179
+ return true;
180
+ } else {
181
+ return false;
182
+ }
183
+ };
184
+
185
+ UI.Utils.options = function(string) {
186
+
187
+ if ($.isPlainObject(string)) return string;
188
+
189
+ var start = (string ? string.indexOf("{") : -1), options = {};
190
+
191
+ if (start != -1) {
192
+ try {
193
+ options = (new Function("", "var json = " + string.substr(start) + "; return JSON.parse(JSON.stringify(json));"))();
194
+ } catch (e) {}
195
+ }
196
+
197
+ return options;
198
+ };
199
+
200
+ UI.Utils.template = function(str, data) {
201
+
202
+ var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
203
+ i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
204
+
205
+ while(i < tokens.length) {
206
+
207
+ toc = tokens[i];
208
+
209
+ if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
210
+ i = i + 1;
211
+ toc = tokens[i];
212
+ cmd = toc[0];
213
+ prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
214
+
215
+ switch(cmd) {
216
+ case '~':
217
+ output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
218
+ openblocks++;
219
+ break;
220
+ case ':':
221
+ output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
222
+ openblocks++;
223
+ break;
224
+ case '#':
225
+ output.push("if("+prop+") {");
226
+ openblocks++;
227
+ break;
228
+ case '^':
229
+ output.push("if(!"+prop+") {");
230
+ openblocks++;
231
+ break;
232
+ case '/':
233
+ output.push("}");
234
+ openblocks--;
235
+ break;
236
+ case '!':
237
+ output.push("__ret.push("+prop+");");
238
+ break;
239
+ default:
240
+ output.push("__ret.push(escape("+prop+"));");
241
+ break;
242
+ }
243
+ } else {
244
+ output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
245
+ }
246
+ i = i + 1;
247
+ }
248
+
249
+ fn = [
250
+ 'var __ret = [];',
251
+ 'try {',
252
+ 'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
253
+ '}catch(e){__ret = [e.message];}',
254
+ 'return __ret.join("").replace(/\\n\\n/g, "\\n");',
255
+ "function escape(html) { return String(html).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"
256
+ ].join("\n");
257
+
258
+ var func = new Function('$data', fn);
259
+ return data ? func(data) : func;
260
+ };
261
+
262
+ UI.Utils.events = {};
263
+ UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
264
+
265
+ $.UIkit = UI;
266
+ $.fn.uk = UI.fn;
267
+
268
+ $.UIkit.langdirection = $html.attr("dir") == "rtl" ? "right" : "left";
269
+
270
+ $(function(){
271
+
272
+ $doc.trigger("uk-domready");
273
+
274
+ // custom scroll observer
275
+ setInterval((function(){
276
+
277
+ var memory = {x: window.scrollX, y:window.scrollY};
278
+
279
+ var fn = function(){
280
+
281
+ if (memory.x != window.scrollX || memory.y != window.scrollY) {
282
+ memory = {x: window.scrollX, y:window.scrollY};
283
+ $doc.trigger('uk-scroll', [memory]);
284
+ }
285
+ };
286
+
287
+ if ($.UIkit.support.touch) {
288
+ $doc.on('touchmove touchend MSPointerMove MSPointerUp', fn);
289
+ }
290
+
291
+ if(memory.x || memory.y) fn();
292
+
293
+ return fn;
294
+
295
+ })(), 15);
296
+
297
+
298
+ // Check for dom modifications
299
+ if(!UI.support.mutationobserver) return;
300
+
301
+ try{
302
+
303
+ var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
304
+ $doc.trigger("uk-domready");
305
+ }, 150));
306
+
307
+ // pass in the target node, as well as the observer options
308
+ observer.observe(document.body, { childList: true, subtree: true });
309
+
310
+ } catch(e) {}
311
+
312
+ // remove css hover rules for touch devices
313
+ if (UI.support.touch) {
314
+ UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
315
+ }
316
+ });
317
+
318
+ // add touch identifier class
319
+ $html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
320
+
321
+ // add uk-hover class on tap to support overlays on touch devices
322
+ if (UI.support.touch) {
323
+
324
+ var hoverset = false, selector = '.uk-overlay, .uk-overlay-toggle, .uk-has-hover', exclude;
325
+
326
+ $doc.on('touchstart MSPointerDown', selector, function() {
327
+
328
+ if(hoverset) $('.uk-hover').removeClass('uk-hover');
329
+
330
+ hoverset = $(this).addClass('uk-hover');
331
+
332
+ }).on('touchend MSPointerUp', function(e) {
333
+
334
+ exclude = $(e.target).parents(selector);
335
+
336
+ if (hoverset) hoverset.not(exclude).removeClass('uk-hover');
337
+ });
338
+ }
339
+
340
+ return UI;
341
+ });
342
+
343
+ /**
344
+ * Promises/A+ spec. polyfill
345
+ * promiscuous - https://github.com/RubenVerborgh/promiscuous
346
+ * @license MIT
347
+ * Ruben Verborgh
348
+ */
349
+
350
+ (function(global){
351
+
352
+ global.Promise = global.Promise || (function (func, obj) {
353
+
354
+ // Type checking utility function
355
+ function is(type, item) { return (typeof item)[0] == type; }
356
+
357
+ // Creates a promise, calling callback(resolve, reject), ignoring other parameters.
358
+ function Promise(callback, handler) {
359
+ // The `handler` variable points to the function that will
360
+ // 1) handle a .then(resolved, rejected) call
361
+ // 2) handle a resolve or reject call (if the first argument === `is`)
362
+ // Before 2), `handler` holds a queue of callbacks.
363
+ // After 2), `handler` is a finalized .then handler.
364
+ handler = function pendingHandler(resolved, rejected, value, queue, then, i) {
365
+ queue = pendingHandler.q;
366
+
367
+ // Case 1) handle a .then(resolved, rejected) call
368
+ if (resolved != is) {
369
+ return Promise(function (resolve, reject) {
370
+ queue.push({ p: this, r: resolve, j: reject, 1: resolved, 0: rejected });
371
+ });
372
+ }
373
+
374
+ // Case 2) handle a resolve or reject call
375
+ // (`resolved` === `is` acts as a sentinel)
376
+ // The actual function signature is
377
+ // .re[ject|solve](<is>, success, value)
378
+
379
+ // Check if the value is a promise and try to obtain its `then` method
380
+ if (value && (is(func, value) | is(obj, value))) {
381
+ try { then = value.then; }
382
+ catch (reason) { rejected = 0; value = reason; }
383
+ }
384
+ // If the value is a promise, take over its state
385
+ if (is(func, then)) {
386
+ var valueHandler = function (resolved) {
387
+ return function (value) { return then && (then = 0, pendingHandler(is, resolved, value)); };
388
+ };
389
+ try { then.call(value, valueHandler(1), rejected = valueHandler(0)); }
390
+ catch (reason) { rejected(reason); }
391
+ }
392
+ // The value is not a promise; handle resolve/reject
393
+ else {
394
+ // Replace this handler with a finalized resolved/rejected handler
395
+ handler = function (Resolved, Rejected) {
396
+ // If the Resolved or Rejected parameter is not a function,
397
+ // return the original promise (now stored in the `callback` variable)
398
+ if (!is(func, (Resolved = rejected ? Resolved : Rejected))) return callback;
399
+ // Otherwise, return a finalized promise, transforming the value with the function
400
+ return Promise(function (resolve, reject) { finalize(this, resolve, reject, value, Resolved); });
401
+ };
402
+ // Resolve/reject pending callbacks
403
+ i = 0;
404
+ while (i < queue.length) {
405
+ then = queue[i++];
406
+ // If no callback, just resolve/reject the promise
407
+ if (!is(func, resolved = then[rejected])) {
408
+ (rejected ? then.r : then.j)(value);
409
+ // Otherwise, resolve/reject the promise with the result of the callback
410
+ } else {
411
+ finalize(then.p, then.r, then.j, value, resolved);
412
+ }
413
+ }
414
+ }
415
+ };
416
+
417
+ // The queue of pending callbacks; garbage-collected when handler is resolved/rejected
418
+ handler.q = [];
419
+
420
+ // Create and return the promise (reusing the callback variable)
421
+ callback.call(callback = {
422
+ then: function (resolved, rejected) { return handler(resolved, rejected); },
423
+ catch: function (rejected) { return handler(0, rejected); }
424
+ },
425
+ function (value) { handler(is, 1, value); },
426
+ function (reason) { handler(is, 0, reason); }
427
+ );
428
+
429
+ return callback;
430
+ }
431
+
432
+ // Finalizes the promise by resolving/rejecting it with the transformed value
433
+ function finalize(promise, resolve, reject, value, transform) {
434
+ setTimeout(function () {
435
+ try {
436
+ // Transform the value through and check whether it's a promise
437
+ value = transform(value);
438
+ transform = value && (is(obj, value) | is(func, value)) && value.then;
439
+ // Return the result if it's not a promise
440
+ if (!is(func, transform))
441
+ resolve(value);
442
+ // If it's a promise, make sure it's not circular
443
+ else if (value == promise)
444
+ reject(TypeError());
445
+ // Take over the promise's state
446
+ else
447
+ transform.call(value, resolve, reject);
448
+ }
449
+ catch (error) { reject(error); }
450
+ }, 0);
451
+ }
452
+
453
+ // Creates a resolved promise
454
+ Promise.resolve = ResolvedPromise;
455
+ function ResolvedPromise(value) { return Promise(function (resolve) { resolve(value); }); }
456
+
457
+ // Creates a rejected promise
458
+ Promise.reject = function (reason) { return Promise(function (resolve, reject) { reject(reason); }); };
459
+
460
+ // Transforms an array of promises into a promise for an array
461
+ Promise.all = function (promises) {
462
+ return Promise(function (resolve, reject, count, values) {
463
+ // Array of collected values
464
+ values = [];
465
+ // Resolve immediately if there are no promises
466
+ count = promises.length || resolve(values);
467
+ // Transform all elements (`map` is shorter than `forEach`)
468
+ promises.map(function (promise, index) {
469
+ ResolvedPromise(promise).then(
470
+ // Store the value and resolve if it was the last
471
+ function (value) {
472
+ values[index] = value;
473
+ count = count -1;
474
+ if(!count) resolve(values);
475
+ },
476
+ // Reject if one element fails
477
+ reject);
478
+ });
479
+ });
480
+ };
481
+
482
+ return Promise;
483
+ })('f', 'o');
484
+ })(this);
485
+
486
+ (function($, UI) {
487
+
488
+ "use strict";
489
+
490
+ UI.components = {};
491
+
492
+ UI.component = function(name, def) {
493
+
494
+ var fn = function(element, options) {
495
+
496
+ var $this = this;
497
+
498
+ this.element = element ? $(element) : null;
499
+ this.options = $.extend(true, {}, this.defaults, options);
500
+ this.plugins = {};
501
+
502
+ if (this.element) {
503
+ this.element.data(name, this);
504
+ }
505
+
506
+ this.init();
507
+
508
+ (this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
509
+
510
+ if (fn.plugins[plugin].init) {
511
+ fn.plugins[plugin].init($this);
512
+ $this.plugins[plugin] = true;
513
+ }
514
+
515
+ });
516
+
517
+ this.trigger('init', [this]);
518
+ };
519
+
520
+ fn.plugins = {};
521
+
522
+ $.extend(true, fn.prototype, {
523
+
524
+ defaults : {plugins: []},
525
+
526
+ init: function(){},
527
+
528
+ on: function(){
529
+ return $(this.element || this).on.apply(this.element || this, arguments);
530
+ },
531
+
532
+ one: function(){
533
+ return $(this.element || this).one.apply(this.element || this, arguments);
534
+ },
535
+
536
+ off: function(evt){
537
+ return $(this.element || this).off(evt);
538
+ },
539
+
540
+ trigger: function(evt, params) {
541
+ return $(this.element || this).trigger(evt, params);
542
+ },
543
+
544
+ find: function(selector) {
545
+ return this.element ? this.element.find(selector) : $([]);
546
+ },
547
+
548
+ proxy: function(obj, methods) {
549
+
550
+ var $this = this;
551
+
552
+ methods.split(' ').forEach(function(method) {
553
+ if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
554
+ });
555
+ },
556
+
557
+ mixin: function(obj, methods) {
558
+
559
+ var $this = this;
560
+
561
+ methods.split(' ').forEach(function(method) {
562
+ if (!$this[method]) $this[method] = obj[method].bind($this);
563
+ });
564
+ },
565
+
566
+ }, def);
567
+
568
+ this.components[name] = fn;
569
+
570
+ this[name] = function() {
571
+
572
+ var element, options;
573
+
574
+ if(arguments.length) {
575
+ switch(arguments.length) {
576
+ case 1:
577
+
578
+ if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
579
+ element = $(arguments[0]);
580
+ } else {
581
+ options = arguments[0];
582
+ }
583
+
584
+ break;
585
+ case 2:
586
+
587
+ element = $(arguments[0]);
588
+ options = arguments[1];
589
+ break;
590
+ }
591
+ }
592
+
593
+ if (element && element.data(name)) {
594
+ return element.data(name);
595
+ }
596
+
597
+ return (new UI.components[name](element, options));
598
+ };
599
+
600
+ return fn;
601
+ };
602
+
603
+ UI.plugin = function(component, name, def) {
604
+ this.components[component].plugins[name] = def;
605
+ };
606
+
607
+ })(jQuery, jQuery.UIkit);
608
+
609
+ (function($, UI) {
610
+
611
+ "use strict";
612
+
613
+ var win = $(window), event = 'resize orientationchange', stacks = [];
614
+
615
+ UI.component('stackMargin', {
616
+
617
+ defaults: {
618
+ 'cls': 'uk-margin-small-top'
619
+ },
620
+
621
+ init: function() {
622
+
623
+ var $this = this;
624
+
625
+ this.columns = this.element.children();
626
+
627
+ if (!this.columns.length) return;
628
+
629
+ win.on(event, (function() {
630
+ var fn = function() {
631
+ $this.process();
632
+ };
633
+
634
+ $(function() {
635
+ fn();
636
+ win.on("load", fn);
637
+ });
638
+
639
+ return UI.Utils.debounce(fn, 150);
640
+ })());
641
+
642
+ $(document).on("uk-domready", function(e) {
643
+ $this.columns = $this.element.children();
644
+ $this.process();
645
+ });
646
+
647
+ stacks.push(this);
648
+ },
649
+
650
+ process: function() {
651
+
652
+ var $this = this;
653
+
654
+ this.revert();
655
+
656
+ var skip = false,
657
+ firstvisible = this.columns.filter(":visible:first"),
658
+ offset = firstvisible.length ? firstvisible.offset().top : false;
659
+
660
+ if (offset === false) return;
661
+
662
+ this.columns.each(function() {
663
+
664
+ var column = $(this);
665
+
666
+ if (column.is(":visible")) {
667
+
668
+ if (skip) {
669
+ column.addClass($this.options.cls);
670
+ } else {
671
+ if (column.offset().top != offset) {
672
+ column.addClass($this.options.cls);
673
+ skip = true;
674
+ }
675
+ }
676
+ }
677
+ });
678
+
679
+ return this;
680
+ },
681
+
682
+ revert: function() {
683
+ this.columns.removeClass(this.options.cls);
684
+ return this;
685
+ }
686
+ });
687
+
688
+ // init code
689
+ $(document).on("uk-domready", function(e) {
690
+ $("[data-uk-margin]").each(function() {
691
+ var ele = $(this), obj;
692
+
693
+ if (!ele.data("stackMargin")) {
694
+ obj = UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
695
+ }
696
+ });
697
+ });
698
+
699
+
700
+ $(document).on("uk-check-display", function(e) {
701
+ stacks.forEach(function(item) {
702
+ if(item.element.is(":visible")) item.process();
703
+ });
704
+ });
705
+
706
+ })(jQuery, jQuery.UIkit);
707
+
708
+ // Based on Zeptos touch.js
709
+ // https://raw.github.com/madrobby/zepto/master/src/touch.js
710
+ // Zepto.js may be freely distributed under the MIT license.
711
+
712
+ ;(function($){
713
+ var touch = {},
714
+ touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,
715
+ longTapDelay = 750,
716
+ gesture;
717
+
718
+ function swipeDirection(x1, x2, y1, y2) {
719
+ return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
720
+ }
721
+
722
+ function longTap() {
723
+ longTapTimeout = null;
724
+ if (touch.last) {
725
+ touch.el.trigger('longTap');
726
+ touch = {};
727
+ }
728
+ }
729
+
730
+ function cancelLongTap() {
731
+ if (longTapTimeout) clearTimeout(longTapTimeout);
732
+ longTapTimeout = null;
733
+ }
734
+
735
+ function cancelAll() {
736
+ if (touchTimeout) clearTimeout(touchTimeout);
737
+ if (tapTimeout) clearTimeout(tapTimeout);
738
+ if (swipeTimeout) clearTimeout(swipeTimeout);
739
+ if (longTapTimeout) clearTimeout(longTapTimeout);
740
+ touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
741
+ touch = {};
742
+ }
743
+
744
+ function isPrimaryTouch(event){
745
+ return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
746
+ }
747
+
748
+ $(function(){
749
+ var now, delta, deltaX = 0, deltaY = 0, firstTouch;
750
+
751
+ if ('MSGesture' in window) {
752
+ gesture = new MSGesture();
753
+ gesture.target = document.body;
754
+ }
755
+
756
+ $(document)
757
+ .bind('MSGestureEnd', function(e){
758
+ var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
759
+
760
+ if (swipeDirectionFromVelocity) {
761
+ touch.el.trigger('swipe');
762
+ touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
763
+ }
764
+ })
765
+ .on('touchstart MSPointerDown', function(e){
766
+
767
+ if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
768
+
769
+ firstTouch = e.type == 'MSPointerDown' ? e : e.originalEvent.touches[0];
770
+
771
+ now = Date.now();
772
+ delta = now - (touch.last || now);
773
+ touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
774
+
775
+ if(touchTimeout) clearTimeout(touchTimeout);
776
+
777
+ touch.x1 = firstTouch.pageX;
778
+ touch.y1 = firstTouch.pageY;
779
+
780
+ if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
781
+
782
+ touch.last = now;
783
+ longTapTimeout = setTimeout(longTap, longTapDelay);
784
+
785
+ // adds the current touch contact for IE gesture recognition
786
+ if (gesture && e.type == 'MSPointerDown') gesture.addPointer(e.originalEvent.pointerId);
787
+ })
788
+ .on('touchmove MSPointerMove', function(e){
789
+
790
+ if(e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
791
+
792
+ firstTouch = e.type == 'MSPointerMove' ? e : e.originalEvent.touches[0];
793
+
794
+ cancelLongTap();
795
+ touch.x2 = firstTouch.pageX;
796
+ touch.y2 = firstTouch.pageY;
797
+
798
+ deltaX += Math.abs(touch.x1 - touch.x2);
799
+ deltaY += Math.abs(touch.y1 - touch.y2);
800
+ })
801
+ .on('touchend MSPointerUp', function(e){
802
+
803
+ if(e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
804
+
805
+ cancelLongTap();
806
+
807
+ // swipe
808
+ if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
809
+
810
+ swipeTimeout = setTimeout(function() {
811
+ touch.el.trigger('swipe');
812
+ touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
813
+ touch = {};
814
+ }, 0);
815
+
816
+ // normal tap
817
+ } else if ('last' in touch) {
818
+
819
+ // don't fire tap when delta position changed by more than 30 pixels,
820
+ // for instance when moving to a point and back to origin
821
+ if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
822
+ // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
823
+ // ('tap' fires before 'scroll')
824
+ tapTimeout = setTimeout(function() {
825
+
826
+ // trigger universal 'tap' with the option to cancelTouch()
827
+ // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
828
+ var event = $.Event('tap');
829
+ event.cancelTouch = cancelAll;
830
+ touch.el.trigger(event);
831
+
832
+ // trigger double tap immediately
833
+ if (touch.isDoubleTap) {
834
+ touch.el.trigger('doubleTap');
835
+ touch = {};
836
+ }
837
+
838
+ // trigger single tap after 250ms of inactivity
839
+ else {
840
+ touchTimeout = setTimeout(function(){
841
+ touchTimeout = null;
842
+ touch.el.trigger('singleTap');
843
+ touch = {};
844
+ }, 250);
845
+ }
846
+ }, 0);
847
+ } else {
848
+ touch = {};
849
+ }
850
+ deltaX = deltaY = 0;
851
+ }
852
+ })
853
+ // when the browser window loses focus,
854
+ // for example when a modal dialog is shown,
855
+ // cancel all ongoing events
856
+ .on('touchcancel MSPointerCancel', cancelAll);
857
+
858
+ // scrolling the window indicates intention of the user
859
+ // to scroll, not tap or swipe, so cancel all ongoing events
860
+ $(window).on('scroll', cancelAll);
861
+ });
862
+
863
+ ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
864
+ $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
865
+ });
866
+ })(jQuery);
867
+
868
+ (function($, UI) {
869
+
870
+ "use strict";
871
+
872
+ UI.component('alert', {
873
+
874
+ defaults: {
875
+ "fade": true,
876
+ "duration": 200,
877
+ "trigger": ".uk-alert-close"
878
+ },
879
+
880
+ init: function() {
881
+
882
+ var $this = this;
883
+
884
+ this.on("click", this.options.trigger, function(e) {
885
+ e.preventDefault();
886
+ $this.close();
887
+ });
888
+ },
889
+
890
+ close: function() {
891
+
892
+ var element = this.trigger("close");
893
+
894
+ if (this.options.fade) {
895
+ element.css("overflow", "hidden").css("max-height", element.height()).animate({
896
+ "height": 0,
897
+ "opacity": 0,
898
+ "padding-top": 0,
899
+ "padding-bottom": 0,
900
+ "margin-top": 0,
901
+ "margin-bottom": 0
902
+ }, this.options.duration, removeElement);
903
+ } else {
904
+ removeElement();
905
+ }
906
+
907
+ function removeElement() {
908
+ element.trigger("closed").remove();
909
+ }
910
+ }
911
+
912
+ });
913
+
914
+ // init code
915
+ $(document).on("click.alert.uikit", "[data-uk-alert]", function(e) {
916
+
917
+ var ele = $(this);
918
+
919
+ if (!ele.data("alert")) {
920
+
921
+ var alert = UI.alert(ele, UI.Utils.options(ele.data("uk-alert")));
922
+
923
+ if ($(e.target).is(ele.data("alert").options.trigger)) {
924
+ e.preventDefault();
925
+ alert.close();
926
+ }
927
+ }
928
+ });
929
+
930
+ })(jQuery, jQuery.UIkit);
931
+
932
+ (function($, UI) {
933
+
934
+ "use strict";
935
+
936
+ UI.component('buttonRadio', {
937
+
938
+ defaults: {
939
+ "target": ".uk-button"
940
+ },
941
+
942
+ init: function() {
943
+
944
+ var $this = this;
945
+
946
+ this.on("click", this.options.target, function(e) {
947
+
948
+ if ($(this).is('a[href="#"]')) e.preventDefault();
949
+
950
+ $this.find($this.options.target).not(this).removeClass("uk-active").blur();
951
+ $this.trigger("change", [$(this).addClass("uk-active")]);
952
+ });
953
+
954
+ },
955
+
956
+ getSelected: function() {
957
+ this.find(".uk-active");
958
+ }
959
+ });
960
+
961
+ UI.component('buttonCheckbox', {
962
+
963
+ defaults: {
964
+ "target": ".uk-button"
965
+ },
966
+
967
+ init: function() {
968
+
969
+ var $this = this;
970
+
971
+ this.on("click", this.options.target, function(e) {
972
+
973
+ if ($(this).is('a[href="#"]')) e.preventDefault();
974
+
975
+ $this.trigger("change", [$(this).toggleClass("uk-active").blur()]);
976
+ });
977
+
978
+ },
979
+
980
+ getSelected: function() {
981
+ this.find(".uk-active");
982
+ }
983
+ });
984
+
985
+
986
+ UI.component('button', {
987
+
988
+ defaults: {},
989
+
990
+ init: function() {
991
+
992
+ var $this = this;
993
+
994
+ this.on("click", function(e) {
995
+
996
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
997
+
998
+ $this.toggle();
999
+ $this.trigger("change", [$element.blur().hasClass("uk-active")]);
1000
+ });
1001
+
1002
+ },
1003
+
1004
+ toggle: function() {
1005
+ this.element.toggleClass("uk-active");
1006
+ }
1007
+ });
1008
+
1009
+
1010
+ // init code
1011
+ $(document).on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
1012
+ var ele = $(this);
1013
+
1014
+ if (!ele.data("buttonRadio")) {
1015
+ var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio")));
1016
+
1017
+ if ($(e.target).is(obj.options.target)) {
1018
+ $(e.target).trigger("click");
1019
+ }
1020
+ }
1021
+ });
1022
+
1023
+ $(document).on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
1024
+ var ele = $(this);
1025
+
1026
+ if (!ele.data("buttonCheckbox")) {
1027
+
1028
+ var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), target=$(e.target);
1029
+
1030
+ if (target.is(obj.options.target)) {
1031
+ ele.trigger("change", [target.toggleClass("uk-active").blur()]);
1032
+ }
1033
+ }
1034
+ });
1035
+
1036
+ $(document).on("click.button.uikit", "[data-uk-button]", function(e) {
1037
+ var ele = $(this);
1038
+
1039
+ if (!ele.data("button")) {
1040
+
1041
+ var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
1042
+ ele.trigger("click");
1043
+ }
1044
+ });
1045
+
1046
+ })(jQuery, jQuery.UIkit);
1047
+
1048
+ (function($, UI) {
1049
+
1050
+ "use strict";
1051
+
1052
+ var active = false, hoverIdle;
1053
+
1054
+ UI.component('dropdown', {
1055
+
1056
+ defaults: {
1057
+ 'mode' : 'hover',
1058
+ 'remaintime' : 800,
1059
+ 'justify' : false,
1060
+ 'boundary' : $(window),
1061
+ 'delay' : 0
1062
+ },
1063
+
1064
+ remainIdle: false,
1065
+
1066
+ init: function() {
1067
+
1068
+ var $this = this;
1069
+
1070
+ this.dropdown = this.find(".uk-dropdown");
1071
+
1072
+ this.centered = this.dropdown.hasClass("uk-dropdown-center");
1073
+ this.justified = this.options.justify ? $(this.options.justify) : false;
1074
+
1075
+ this.boundary = $(this.options.boundary);
1076
+ this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
1077
+
1078
+ if(!this.boundary.length) {
1079
+ this.boundary = $(window);
1080
+ }
1081
+
1082
+ if (this.options.mode == "click" || UI.support.touch) {
1083
+
1084
+ this.on("click", function(e) {
1085
+
1086
+ var $target = $(e.target);
1087
+
1088
+ if (!$target.parents(".uk-dropdown").length) {
1089
+
1090
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1091
+ e.preventDefault();
1092
+ }
1093
+
1094
+ $target.blur();
1095
+ }
1096
+
1097
+ if (!$this.element.hasClass("uk-open")) {
1098
+
1099
+ $this.show();
1100
+
1101
+ } else {
1102
+
1103
+ if ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length) {
1104
+ $this.element.removeClass("uk-open");
1105
+ active = false;
1106
+ }
1107
+ }
1108
+ });
1109
+
1110
+ } else {
1111
+
1112
+ this.on("mouseenter", function(e) {
1113
+
1114
+ if ($this.remainIdle) {
1115
+ clearTimeout($this.remainIdle);
1116
+ }
1117
+
1118
+ if (hoverIdle) {
1119
+ clearTimeout(hoverIdle);
1120
+ }
1121
+
1122
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
1123
+
1124
+ }).on("mouseleave", function() {
1125
+
1126
+ if (hoverIdle) {
1127
+ clearTimeout(hoverIdle);
1128
+ }
1129
+
1130
+ $this.remainIdle = setTimeout(function() {
1131
+
1132
+ $this.element.removeClass("uk-open");
1133
+ $this.remainIdle = false;
1134
+
1135
+ if (active && active[0] == $this.element[0]) active = false;
1136
+
1137
+ }, $this.options.remaintime);
1138
+
1139
+ }).on("click", function(e){
1140
+
1141
+ var $target = $(e.target);
1142
+
1143
+ if ($this.remainIdle) {
1144
+ clearTimeout($this.remainIdle);
1145
+ }
1146
+
1147
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
1148
+ e.preventDefault();
1149
+ }
1150
+
1151
+ $this.show();
1152
+ });
1153
+ }
1154
+ },
1155
+
1156
+ show: function(){
1157
+
1158
+ if (active && active[0] != this.element[0]) {
1159
+ active.removeClass("uk-open");
1160
+ }
1161
+
1162
+ if (hoverIdle) {
1163
+ clearTimeout(hoverIdle);
1164
+ }
1165
+
1166
+ this.checkDimensions();
1167
+ this.element.addClass("uk-open");
1168
+ this.trigger('uk.dropdown.show', [this]);
1169
+ active = this.element;
1170
+
1171
+ this.registerOuterClick();
1172
+ },
1173
+
1174
+ registerOuterClick: function(){
1175
+
1176
+ var $this = this;
1177
+
1178
+ $(document).off("click.outer.dropdown");
1179
+
1180
+ setTimeout(function() {
1181
+ $(document).on("click.outer.dropdown", function(e) {
1182
+
1183
+ if (hoverIdle) {
1184
+ clearTimeout(hoverIdle);
1185
+ }
1186
+
1187
+ var $target = $(e.target);
1188
+
1189
+ if (active && active[0] == $this.element[0] && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
1190
+ active.removeClass("uk-open");
1191
+ $(document).off("click.outer.dropdown");
1192
+ }
1193
+ });
1194
+ }, 10);
1195
+ },
1196
+
1197
+ checkDimensions: function() {
1198
+
1199
+ if(!this.dropdown.length) return;
1200
+
1201
+ if (this.justified && this.justified.length) {
1202
+ this.dropdown.css("min-width", "");
1203
+ }
1204
+
1205
+ var $this = this,
1206
+ dropdown = this.dropdown.css("margin-" + $.UIkit.langdirection, ""),
1207
+ offset = dropdown.show().offset(),
1208
+ width = dropdown.outerWidth(),
1209
+ boundarywidth = this.boundary.width(),
1210
+ boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
1211
+
1212
+ // centered dropdown
1213
+ if (this.centered) {
1214
+ dropdown.css("margin-" + $.UIkit.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
1215
+ offset = dropdown.offset();
1216
+
1217
+ // reset dropdown
1218
+ if ((width + offset.left) > boundarywidth || offset.left < 0) {
1219
+ dropdown.css("margin-" + $.UIkit.langdirection, "");
1220
+ offset = dropdown.offset();
1221
+ }
1222
+ }
1223
+
1224
+ // justify dropdown
1225
+ if (this.justified && this.justified.length) {
1226
+
1227
+ var jwidth = this.justified.outerWidth();
1228
+
1229
+ dropdown.css("min-width", jwidth);
1230
+
1231
+ if ($.UIkit.langdirection == 'right') {
1232
+
1233
+ var right1 = boundarywidth - (this.justified.offset().left + jwidth),
1234
+ right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
1235
+
1236
+ dropdown.css("margin-right", right1 - right2);
1237
+
1238
+ } else {
1239
+ dropdown.css("margin-left", this.justified.offset().left - offset.left);
1240
+ }
1241
+
1242
+ offset = dropdown.offset();
1243
+
1244
+ }
1245
+
1246
+ if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
1247
+ dropdown.addClass("uk-dropdown-flip");
1248
+ offset = dropdown.offset();
1249
+ }
1250
+
1251
+ if ((offset.left-boundaryoffset) < 0) {
1252
+
1253
+ dropdown.addClass("uk-dropdown-stack");
1254
+
1255
+ if (dropdown.hasClass("uk-dropdown-flip")) {
1256
+
1257
+ if (!this.flipped) {
1258
+ dropdown.removeClass("uk-dropdown-flip");
1259
+ offset = dropdown.offset();
1260
+ dropdown.addClass("uk-dropdown-flip");
1261
+ }
1262
+
1263
+ setTimeout(function(){
1264
+
1265
+ if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
1266
+ dropdown.removeClass("uk-dropdown-flip");
1267
+ }
1268
+ }, 0);
1269
+ }
1270
+
1271
+ this.trigger('uk.dropdown.stack', [this]);
1272
+ }
1273
+
1274
+ dropdown.css("display", "");
1275
+ }
1276
+
1277
+ });
1278
+
1279
+ var triggerevent = UI.support.touch ? "click" : "mouseenter";
1280
+
1281
+ // init code
1282
+ $(document).on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
1283
+ var ele = $(this);
1284
+
1285
+ if (!ele.data("dropdown")) {
1286
+
1287
+ var dropdown = UI.dropdown(ele, UI.Utils.options(ele.data("uk-dropdown")));
1288
+
1289
+ if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
1290
+ dropdown.element.trigger(triggerevent);
1291
+ }
1292
+
1293
+ if(dropdown.element.find('.uk-dropdown').length) {
1294
+ e.preventDefault();
1295
+ }
1296
+ }
1297
+ });
1298
+
1299
+ })(jQuery, jQuery.UIkit);
1300
+
1301
+ (function($, UI) {
1302
+
1303
+ "use strict";
1304
+
1305
+ var win = $(window), event = 'resize orientationchange', grids = [];
1306
+
1307
+ UI.component('gridMatchHeight', {
1308
+
1309
+ defaults: {
1310
+ "target" : false,
1311
+ "row" : true
1312
+ },
1313
+
1314
+ init: function() {
1315
+
1316
+ var $this = this;
1317
+
1318
+ this.columns = this.element.children();
1319
+ this.elements = this.options.target ? this.find(this.options.target) : this.columns;
1320
+
1321
+ if (!this.columns.length) return;
1322
+
1323
+ win.on(event, (function() {
1324
+ var fn = function() {
1325
+ $this.match();
1326
+ };
1327
+
1328
+ $(function() {
1329
+ fn();
1330
+ win.on("load", fn);
1331
+ });
1332
+
1333
+ return UI.Utils.debounce(fn, 150);
1334
+ })());
1335
+
1336
+ $(document).on("uk-domready", function(e) {
1337
+ $this.columns = $this.element.children();
1338
+ $this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
1339
+ $this.match();
1340
+ });
1341
+
1342
+ grids.push(this);
1343
+ },
1344
+
1345
+ match: function() {
1346
+
1347
+ this.revert();
1348
+
1349
+ var firstvisible = this.columns.filter(":visible:first");
1350
+
1351
+ if (!firstvisible.length) return;
1352
+
1353
+ var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100 ? true : false,
1354
+ max = 0,
1355
+ $this = this;
1356
+
1357
+ if (stacked) return;
1358
+
1359
+ if(this.options.row) {
1360
+
1361
+ this.element.width(); // force redraw
1362
+
1363
+ setTimeout(function(){
1364
+
1365
+ var lastoffset = false, group = [];
1366
+
1367
+ $this.elements.each(function(i) {
1368
+ var ele = $(this), offset = ele.offset().top;
1369
+
1370
+ if(offset != lastoffset && group.length) {
1371
+
1372
+ $this.matchHeights($(group));
1373
+ group = [];
1374
+ offset = ele.offset().top;
1375
+ }
1376
+
1377
+ group.push(ele);
1378
+ lastoffset = offset;
1379
+ });
1380
+
1381
+ if(group.length) {
1382
+ $this.matchHeights($(group));
1383
+ }
1384
+
1385
+ }, 0);
1386
+
1387
+ } else {
1388
+
1389
+ this.matchHeights(this.elements);
1390
+ }
1391
+
1392
+ return this;
1393
+ },
1394
+
1395
+ revert: function() {
1396
+ this.elements.css('min-height', '');
1397
+ return this;
1398
+ },
1399
+
1400
+ matchHeights: function(elements){
1401
+
1402
+ if(elements.length < 2) return;
1403
+
1404
+ var max = 0;
1405
+
1406
+ elements.each(function() {
1407
+ max = Math.max(max, $(this).outerHeight());
1408
+ }).each(function(i) {
1409
+
1410
+ var element = $(this),
1411
+ height = max - (element.outerHeight() - element.height());
1412
+
1413
+ element.css('min-height', height + 'px');
1414
+ });
1415
+ }
1416
+ });
1417
+
1418
+ UI.component('gridMargin', {
1419
+
1420
+ defaults: {
1421
+ "cls": "uk-grid-margin"
1422
+ },
1423
+
1424
+ init: function() {
1425
+
1426
+ var $this = this;
1427
+
1428
+ var stackMargin = UI.stackMargin(this.element, this.options);
1429
+ }
1430
+ });
1431
+
1432
+
1433
+ // init code
1434
+ $(document).on("uk-domready", function(e) {
1435
+ $("[data-uk-grid-match],[data-uk-grid-margin]").each(function() {
1436
+ var grid = $(this), obj;
1437
+
1438
+ if (grid.is("[data-uk-grid-match]") && !grid.data("gridMatchHeight")) {
1439
+ obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
1440
+ }
1441
+
1442
+ if (grid.is("[data-uk-grid-margin]") && !grid.data("gridMargin")) {
1443
+ obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
1444
+ }
1445
+ });
1446
+ });
1447
+
1448
+ $(document).on("uk-check-display", function(e) {
1449
+ grids.forEach(function(item) {
1450
+ if(item.element.is(":visible")) item.match();
1451
+ });
1452
+ });
1453
+
1454
+ })(jQuery, jQuery.UIkit);
1455
+
1456
+ (function($, UI, $win) {
1457
+
1458
+ "use strict";
1459
+
1460
+ var active = false, $html = $('html'), body;
1461
+
1462
+ UI.component('modal', {
1463
+
1464
+ defaults: {
1465
+ keyboard: true,
1466
+ bgclose: true,
1467
+ minScrollHeight: 150
1468
+ },
1469
+
1470
+ scrollable: false,
1471
+ transition: false,
1472
+
1473
+ init: function() {
1474
+
1475
+ if (!body) body = $('body');
1476
+
1477
+ var $this = this;
1478
+
1479
+ this.transition = UI.support.transition;
1480
+ this.dialog = this.find(".uk-modal-dialog");
1481
+
1482
+ this.on("click", ".uk-modal-close", function(e) {
1483
+ e.preventDefault();
1484
+ $this.hide();
1485
+
1486
+ }).on("click", function(e) {
1487
+
1488
+ var target = $(e.target);
1489
+
1490
+ if (target[0] == $this.element[0] && $this.options.bgclose) {
1491
+ $this.hide();
1492
+ }
1493
+
1494
+ });
1495
+
1496
+ },
1497
+
1498
+ toggle: function() {
1499
+ return this[this.isActive() ? "hide" : "show"]();
1500
+ },
1501
+
1502
+ show: function() {
1503
+
1504
+ var $this = this;
1505
+
1506
+ if (this.isActive()) return;
1507
+ if (active) active.hide(true);
1508
+
1509
+ this.element.removeClass("uk-open").show();
1510
+ this.resize();
1511
+
1512
+ active = this;
1513
+ $html.addClass("uk-modal-page").height(); // force browser engine redraw
1514
+
1515
+ this.element.addClass("uk-open").trigger("uk.modal.show");
1516
+
1517
+ $(document).trigger("uk-check-display");
1518
+
1519
+ return this;
1520
+ },
1521
+
1522
+ hide: function(force) {
1523
+
1524
+ if (!this.isActive()) return;
1525
+
1526
+ if (!force && UI.support.transition) {
1527
+
1528
+ var $this = this;
1529
+
1530
+ this.one(UI.support.transition.end, function() {
1531
+ $this._hide();
1532
+ }).removeClass("uk-open");
1533
+
1534
+ } else {
1535
+
1536
+ this._hide();
1537
+ }
1538
+
1539
+ return this;
1540
+ },
1541
+
1542
+ resize: function() {
1543
+
1544
+ var paddingdir = "padding-" + (UI.langdirection == 'left' ? "left":"right"),
1545
+ margindir = "margin-" + (UI.langdirection == 'left' ? "left":"right"),
1546
+ bodywidth = body.width();
1547
+
1548
+ this.scrollbarwidth = window.innerWidth - bodywidth;
1549
+
1550
+ $html.css(margindir, this.scrollbarwidth * -1);
1551
+
1552
+ this.element.css(paddingdir, "");
1553
+
1554
+ if (this.dialog.offset().left > this.scrollbarwidth) {
1555
+ this.element.css(paddingdir, this.scrollbarwidth - (this.element[0].scrollHeight==window.innerHeight ? 0:this.scrollbarwidth ));
1556
+ }
1557
+
1558
+ this.updateScrollable();
1559
+
1560
+ },
1561
+
1562
+ updateScrollable: function() {
1563
+
1564
+ // has scrollable?
1565
+
1566
+ var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
1567
+
1568
+ if (scrollable) {
1569
+
1570
+ scrollable.css("height", 0);
1571
+
1572
+ var offset = Math.abs(parseInt(this.dialog.css("margin-top"), 10)),
1573
+ dh = this.dialog.outerHeight(),
1574
+ wh = window.innerHeight,
1575
+ h = wh - 2*(offset < 20 ? 20:offset) - dh;
1576
+
1577
+ scrollable.css("height", h < this.options.minScrollHeight ? "":h);
1578
+ }
1579
+ },
1580
+
1581
+ _hide: function() {
1582
+
1583
+ this.element.hide().removeClass("uk-open");
1584
+
1585
+ $html.removeClass("uk-modal-page").css("margin-" + (UI.langdirection == 'left' ? "left":"right"), "");
1586
+
1587
+ if(active===this) active = false;
1588
+
1589
+ this.trigger("uk.modal.hide");
1590
+ },
1591
+
1592
+ isActive: function() {
1593
+ return (active == this);
1594
+ }
1595
+
1596
+ });
1597
+
1598
+ UI.component('modalTrigger', {
1599
+
1600
+ init: function() {
1601
+
1602
+ var $this = this;
1603
+
1604
+ this.options = $.extend({
1605
+ "target": $this.element.is("a") ? $this.element.attr("href") : false
1606
+ }, this.options);
1607
+
1608
+ this.modal = UI.modal(this.options.target, this.options);
1609
+
1610
+ this.on("click", function(e) {
1611
+ e.preventDefault();
1612
+ $this.show();
1613
+ });
1614
+
1615
+ //methods
1616
+ this.proxy(this.modal, "show hide isActive");
1617
+ }
1618
+ });
1619
+
1620
+ UI.modal.dialog = function(content, options) {
1621
+
1622
+ var modal = UI.modal($(UI.modal.dialog.template).appendTo("body"), options);
1623
+
1624
+ modal.on("uk.modal.hide", function(){
1625
+ if (modal.persist) {
1626
+ modal.persist.appendTo(modal.persist.data("modalPersistParent"));
1627
+ modal.persist = false;
1628
+ }
1629
+ modal.element.remove();
1630
+ });
1631
+
1632
+ setContent(content, modal);
1633
+
1634
+ return modal;
1635
+ };
1636
+
1637
+ UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog"></div></div>';
1638
+
1639
+ UI.modal.alert = function(content, options) {
1640
+
1641
+ UI.modal.dialog(([
1642
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1643
+ '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary uk-modal-close">Ok</button></div>'
1644
+ ]).join(""), $.extend({bgclose:false, keyboard:false}, options)).show();
1645
+ };
1646
+
1647
+ UI.modal.confirm = function(content, onconfirm, options) {
1648
+
1649
+ onconfirm = $.isFunction(onconfirm) ? onconfirm : function(){};
1650
+
1651
+ var modal = UI.modal.dialog(([
1652
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
1653
+ '<div class="uk-modal-buttons"><button class="uk-button uk-button-primary js-modal-confirm">Ok</button> <button class="uk-button uk-modal-close">Cancel</button></div>'
1654
+ ]).join(""), $.extend({bgclose:false, keyboard:false}, options));
1655
+
1656
+ modal.element.find(".js-modal-confirm").on("click", function(){
1657
+ onconfirm();
1658
+ modal.hide();
1659
+ });
1660
+
1661
+ modal.show();
1662
+ };
1663
+
1664
+ // init code
1665
+ $(document).on("click.modal.uikit", "[data-uk-modal]", function(e) {
1666
+
1667
+ var ele = $(this);
1668
+
1669
+ if(ele.is("a")) {
1670
+ e.preventDefault();
1671
+ }
1672
+
1673
+ if (!ele.data("modalTrigger")) {
1674
+ var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
1675
+ modal.show();
1676
+ }
1677
+
1678
+ });
1679
+
1680
+ // close modal on esc button
1681
+ $(document).on('keydown.modal.uikit', function (e) {
1682
+
1683
+ if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
1684
+ e.preventDefault();
1685
+ active.hide();
1686
+ }
1687
+ });
1688
+
1689
+ $win.on("resize orientationchange", UI.Utils.debounce(function(){
1690
+ if(active) active.resize();
1691
+ }, 150));
1692
+
1693
+
1694
+ // helper functions
1695
+ function setContent(content, modal){
1696
+
1697
+ if(!modal) return;
1698
+
1699
+ if (typeof content === 'object') {
1700
+
1701
+ // convert DOM object to a jQuery object
1702
+ content = content instanceof jQuery ? content : $(content);
1703
+
1704
+ if(content.parent().length) {
1705
+ modal.persist = content;
1706
+ modal.persist.data("modalPersistParent", content.parent());
1707
+ }
1708
+ }else if (typeof content === 'string' || typeof content === 'number') {
1709
+ // just insert the data as innerHTML
1710
+ content = $('<div></div>').html(content);
1711
+ }else {
1712
+ // unsupported data type!
1713
+ content = $('<div></div>').html('$.UIkitt.modal Error: Unsupported data type: ' + typeof content);
1714
+ }
1715
+
1716
+ content.appendTo(modal.element.find('.uk-modal-dialog'));
1717
+
1718
+ return modal;
1719
+ }
1720
+
1721
+ })(jQuery, jQuery.UIkit, jQuery(window));
1722
+
1723
+ (function($, UI) {
1724
+
1725
+ "use strict";
1726
+
1727
+ var scrollpos = {x: window.scrollX, y: window.scrollY},
1728
+ $win = $(window),
1729
+ $doc = $(document),
1730
+ $html = $('html'),
1731
+ Offcanvas = {
1732
+
1733
+ show: function(element) {
1734
+
1735
+ element = $(element);
1736
+
1737
+ if (!element.length) return;
1738
+
1739
+ var $body = $('body'),
1740
+ winwidth = $win.width(),
1741
+ bar = element.find(".uk-offcanvas-bar:first"),
1742
+ rtl = ($.UIkit.langdirection == "right"),
1743
+ flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
1744
+ dir = flip * (rtl ? -1 : 1);
1745
+
1746
+ scrollpos = {x: window.scrollX, y: window.scrollY};
1747
+
1748
+ element.addClass("uk-active");
1749
+
1750
+ $body.css({"width": window.innerWidth, "height": $win.height()}).addClass("uk-offcanvas-page");
1751
+ $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
1752
+
1753
+ $html.css('margin-top', scrollpos.y * -1);
1754
+
1755
+ bar.addClass("uk-offcanvas-bar-show");
1756
+
1757
+ element.off(".ukoffcanvas").on("click.ukoffcanvas swipeRight.ukoffcanvas swipeLeft.ukoffcanvas", function(e) {
1758
+
1759
+ var target = $(e.target);
1760
+
1761
+ if (!e.type.match(/swipe/)) {
1762
+
1763
+ if (!target.hasClass("uk-offcanvas-close")) {
1764
+ if (target.hasClass("uk-offcanvas-bar")) return;
1765
+ if (target.parents(".uk-offcanvas-bar:first").length) return;
1766
+ }
1767
+ }
1768
+
1769
+ e.stopImmediatePropagation();
1770
+ Offcanvas.hide();
1771
+ });
1772
+
1773
+ $doc.on('keydown.ukoffcanvas', function(e) {
1774
+ if (e.keyCode === 27) { // ESC
1775
+ Offcanvas.hide();
1776
+ }
1777
+ });
1778
+ },
1779
+
1780
+ hide: function(force) {
1781
+
1782
+ var $body = $('body'),
1783
+ panel = $(".uk-offcanvas.uk-active"),
1784
+ rtl = ($.UIkit.langdirection == "right"),
1785
+ bar = panel.find(".uk-offcanvas-bar:first");
1786
+
1787
+ if (!panel.length) return;
1788
+
1789
+ if ($.UIkit.support.transition && !force) {
1790
+
1791
+ $body.one($.UIkit.support.transition.end, function() {
1792
+ $body.removeClass("uk-offcanvas-page").css({"width": "", "height": ""});
1793
+ panel.removeClass("uk-active");
1794
+ $html.css('margin-top', '');
1795
+ window.scrollTo(scrollpos.x, scrollpos.y);
1796
+ }).css((rtl ? "margin-right" : "margin-left"), "");
1797
+
1798
+ setTimeout(function(){
1799
+ bar.removeClass("uk-offcanvas-bar-show");
1800
+ }, 0);
1801
+
1802
+ } else {
1803
+ $body.removeClass("uk-offcanvas-page").css({"width": "", "height": ""});
1804
+ panel.removeClass("uk-active");
1805
+ bar.removeClass("uk-offcanvas-bar-show");
1806
+ $html.css('margin-top', '');
1807
+ window.scrollTo(scrollpos.x, scrollpos.y);
1808
+ }
1809
+
1810
+ panel.off(".ukoffcanvas");
1811
+ $doc.off(".ukoffcanvas");
1812
+ }
1813
+ };
1814
+
1815
+ UI.component('offcanvasTrigger', {
1816
+
1817
+ init: function() {
1818
+
1819
+ var $this = this;
1820
+
1821
+ this.options = $.extend({
1822
+ "target": $this.element.is("a") ? $this.element.attr("href") : false
1823
+ }, this.options);
1824
+
1825
+ this.on("click", function(e) {
1826
+ e.preventDefault();
1827
+ Offcanvas.show($this.options.target);
1828
+ });
1829
+ }
1830
+ });
1831
+
1832
+ UI.offcanvas = Offcanvas;
1833
+
1834
+ // init code
1835
+ $doc.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
1836
+
1837
+ e.preventDefault();
1838
+
1839
+ var ele = $(this);
1840
+
1841
+ if (!ele.data("offcanvasTrigger")) {
1842
+ var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
1843
+ ele.trigger("click");
1844
+ }
1845
+ });
1846
+
1847
+ })(jQuery, jQuery.UIkit);
1848
+
1849
+ (function($, UI) {
1850
+
1851
+ "use strict";
1852
+
1853
+ UI.component('nav', {
1854
+
1855
+ defaults: {
1856
+ "toggle": ">li.uk-parent > a[href='#']",
1857
+ "lists": ">li.uk-parent > ul",
1858
+ "multiple": false
1859
+ },
1860
+
1861
+ init: function() {
1862
+
1863
+ var $this = this;
1864
+
1865
+ this.on("click", this.options.toggle, function(e) {
1866
+ e.preventDefault();
1867
+ var ele = $(this);
1868
+ $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
1869
+ });
1870
+
1871
+ this.find(this.options.lists).each(function() {
1872
+ var $ele = $(this),
1873
+ parent = $ele.parent(),
1874
+ active = parent.hasClass("uk-active");
1875
+
1876
+ $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
1877
+ parent.data("list-container", $ele.parent());
1878
+
1879
+ if (active) $this.open(parent, true);
1880
+ });
1881
+
1882
+ },
1883
+
1884
+ open: function(li, noanimation) {
1885
+
1886
+ var element = this.element, $li = $(li);
1887
+
1888
+ if (!this.options.multiple) {
1889
+
1890
+ element.children(".uk-open").not(li).each(function() {
1891
+ if ($(this).data("list-container")) {
1892
+ $(this).data("list-container").stop().animate({height: 0}, function() {
1893
+ $(this).parent().removeClass("uk-open");
1894
+ });
1895
+ }
1896
+ });
1897
+ }
1898
+
1899
+ $li.toggleClass("uk-open");
1900
+
1901
+ if ($li.data("list-container")) {
1902
+ if (noanimation) {
1903
+ $li.data('list-container').stop().height($li.hasClass("uk-open") ? "auto" : 0);
1904
+ } else {
1905
+ $li.data('list-container').stop().animate({
1906
+ height: ($li.hasClass("uk-open") ? getHeight($li.data('list-container').find('ul:first')) : 0)
1907
+ });
1908
+ }
1909
+ }
1910
+ }
1911
+ });
1912
+
1913
+
1914
+ // helper
1915
+
1916
+ function getHeight(ele) {
1917
+ var $ele = $(ele), height = "auto";
1918
+
1919
+ if ($ele.is(":visible")) {
1920
+ height = $ele.outerHeight();
1921
+ } else {
1922
+ var tmp = {
1923
+ position: $ele.css("position"),
1924
+ visibility: $ele.css("visibility"),
1925
+ display: $ele.css("display")
1926
+ };
1927
+
1928
+ height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
1929
+
1930
+ $ele.css(tmp); // reset element
1931
+ }
1932
+
1933
+ return height;
1934
+ }
1935
+
1936
+ // init code
1937
+ $(document).on("uk-domready", function(e) {
1938
+ $("[data-uk-nav]").each(function() {
1939
+ var nav = $(this);
1940
+
1941
+ if (!nav.data("nav")) {
1942
+ var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
1943
+ }
1944
+ });
1945
+ });
1946
+
1947
+ })(jQuery, jQuery.UIkit);
1948
+
1949
+ (function($, UI, $win) {
1950
+
1951
+ "use strict";
1952
+
1953
+ var $tooltip, // tooltip container
1954
+ tooltipdelay;
1955
+
1956
+ UI.component('tooltip', {
1957
+
1958
+ defaults: {
1959
+ "offset": 5,
1960
+ "pos": "top",
1961
+ "animation": false,
1962
+ "delay": 0, // in miliseconds
1963
+ "src": function() { return this.attr("title"); }
1964
+ },
1965
+
1966
+ tip: "",
1967
+
1968
+ init: function() {
1969
+
1970
+ var $this = this;
1971
+
1972
+ if (!$tooltip) {
1973
+ $tooltip = $('<div class="uk-tooltip"></div>').appendTo("body");
1974
+ }
1975
+
1976
+ this.on({
1977
+ "focus" : function(e) { $this.show(); },
1978
+ "blur" : function(e) { $this.hide(); },
1979
+ "mouseenter": function(e) { $this.show(); },
1980
+ "mouseleave": function(e) { $this.hide(); }
1981
+ });
1982
+
1983
+ this.tip = typeof(this.options.src) === "function" ? this.options.src.call(this.element) : this.options.src;
1984
+
1985
+ // disable title attribute
1986
+ this.element.attr("data-cached-title", this.element.attr("title")).attr("title", "");
1987
+ },
1988
+
1989
+ show: function() {
1990
+
1991
+ if (tooltipdelay) clearTimeout(tooltipdelay);
1992
+ if (!this.tip.length) return;
1993
+
1994
+ $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).show();
1995
+ $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
1996
+
1997
+ var $this = this,
1998
+ bodyoffset = $('body').offset(),
1999
+ pos = $.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
2000
+ width = $tooltip[0].offsetWidth,
2001
+ height = $tooltip[0].offsetHeight,
2002
+ offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
2003
+ position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
2004
+ tmppos = position.split("-"),
2005
+ tcss = {
2006
+ "display": "none",
2007
+ "visibility": "visible",
2008
+ "top": (pos.top + pos.height + height),
2009
+ "left": pos.left
2010
+ };
2011
+
2012
+ // prevent strange position
2013
+ // when tooltip is in offcanvas etc.
2014
+ pos.left -= bodyoffset.left;
2015
+ pos.top -= bodyoffset.top;
2016
+
2017
+ if ((tmppos[0] == "left" || tmppos[0] == "right") && $.UIkit.langdirection == 'right') {
2018
+ tmppos[0] = tmppos[0] == "left" ? "right" : "left";
2019
+ }
2020
+
2021
+ var variants = {
2022
+ "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
2023
+ "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
2024
+ "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
2025
+ "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
2026
+ };
2027
+
2028
+ $.extend(tcss, variants[tmppos[0]]);
2029
+
2030
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
2031
+
2032
+ var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
2033
+
2034
+ if(boundary) {
2035
+
2036
+ switch(boundary) {
2037
+ case "x":
2038
+
2039
+ if (tmppos.length == 2) {
2040
+ position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
2041
+ } else {
2042
+ position = tcss.left < 0 ? "right": "left";
2043
+ }
2044
+
2045
+ break;
2046
+
2047
+ case "y":
2048
+ if (tmppos.length == 2) {
2049
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
2050
+ } else {
2051
+ position = (tcss.top < 0 ? "bottom": "top");
2052
+ }
2053
+
2054
+ break;
2055
+
2056
+ case "xy":
2057
+ if (tmppos.length == 2) {
2058
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
2059
+ } else {
2060
+ position = tcss.left < 0 ? "right": "left";
2061
+ }
2062
+
2063
+ break;
2064
+
2065
+ }
2066
+
2067
+ tmppos = position.split("-");
2068
+
2069
+ $.extend(tcss, variants[tmppos[0]]);
2070
+
2071
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
2072
+ }
2073
+
2074
+
2075
+ tcss.left -= $("body").position().left;
2076
+
2077
+ tooltipdelay = setTimeout(function(){
2078
+
2079
+ $tooltip.css(tcss).attr("class", "uk-tooltip uk-tooltip-" + position);
2080
+
2081
+ if ($this.options.animation) {
2082
+ $tooltip.css({opacity: 0, display: 'block'}).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
2083
+ } else {
2084
+ $tooltip.show();
2085
+ }
2086
+
2087
+ tooltipdelay = false;
2088
+ }, parseInt(this.options.delay, 10) || 0);
2089
+ },
2090
+
2091
+ hide: function() {
2092
+ if(this.element.is("input") && this.element[0]===document.activeElement) return;
2093
+
2094
+ if(tooltipdelay) clearTimeout(tooltipdelay);
2095
+
2096
+ $tooltip.stop();
2097
+
2098
+ if (this.options.animation) {
2099
+ $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400);
2100
+ } else {
2101
+ $tooltip.hide();
2102
+ }
2103
+ },
2104
+
2105
+ content: function() {
2106
+ return this.tip;
2107
+ },
2108
+
2109
+ checkBoundary: function(left, top, width, height) {
2110
+
2111
+ var axis = "";
2112
+
2113
+ if(left < 0 || ((left-$win.scrollLeft())+width) > window.innerWidth) {
2114
+ axis += "x";
2115
+ }
2116
+
2117
+ if(top < 0 || ((top-$win.scrollTop())+height) > window.innerHeight) {
2118
+ axis += "y";
2119
+ }
2120
+
2121
+ return axis;
2122
+ }
2123
+ });
2124
+
2125
+
2126
+ // init code
2127
+ $(document).on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
2128
+ var ele = $(this);
2129
+
2130
+ if (!ele.data("tooltip")) {
2131
+ var obj = UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
2132
+ ele.trigger("mouseenter");
2133
+ }
2134
+ });
2135
+
2136
+ })(jQuery, jQuery.UIkit, jQuery(window));
2137
+
2138
+ (function($, UI) {
2139
+
2140
+ "use strict";
2141
+
2142
+ UI.component('switcher', {
2143
+
2144
+ defaults: {
2145
+ connect : false,
2146
+ toggle : ">*",
2147
+ active : 0
2148
+ },
2149
+
2150
+ init: function() {
2151
+
2152
+ var $this = this;
2153
+
2154
+ this.on("click", this.options.toggle, function(e) {
2155
+ e.preventDefault();
2156
+ $this.show(this);
2157
+ });
2158
+
2159
+ if (this.options.connect) {
2160
+
2161
+ this.connect = $(this.options.connect).find(".uk-active").removeClass(".uk-active").end();
2162
+
2163
+ var toggles = this.find(this.options.toggle),
2164
+ active = toggles.filter(".uk-active");
2165
+
2166
+ if (active.length) {
2167
+ this.show(active);
2168
+ } else {
2169
+ active = toggles.eq(this.options.active);
2170
+ this.show(active.length ? active : toggles.eq(0));
2171
+ }
2172
+ }
2173
+
2174
+ },
2175
+
2176
+ show: function(tab) {
2177
+
2178
+ tab = isNaN(tab) ? $(tab) : this.find(this.options.toggle).eq(tab);
2179
+
2180
+ var active = tab;
2181
+
2182
+ if (active.hasClass("uk-disabled")) return;
2183
+
2184
+ this.find(this.options.toggle).filter(".uk-active").removeClass("uk-active");
2185
+ active.addClass("uk-active");
2186
+
2187
+ if (this.options.connect && this.connect.length) {
2188
+
2189
+ var index = this.find(this.options.toggle).index(active);
2190
+
2191
+ this.connect.children().removeClass("uk-active").eq(index).addClass("uk-active");
2192
+ }
2193
+
2194
+ this.trigger("uk.switcher.show", [active]);
2195
+ $(document).trigger("uk-check-display");
2196
+ }
2197
+ });
2198
+
2199
+
2200
+ // init code
2201
+ $(document).on("uk-domready", function(e) {
2202
+ $("[data-uk-switcher]").each(function() {
2203
+ var switcher = $(this);
2204
+
2205
+ if (!switcher.data("switcher")) {
2206
+ var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
2207
+ }
2208
+ });
2209
+ });
2210
+
2211
+ })(jQuery, jQuery.UIkit);
2212
+
2213
+ (function($, UI) {
2214
+
2215
+ "use strict";
2216
+
2217
+
2218
+ UI.component('tab', {
2219
+
2220
+ defaults: {
2221
+ connect: false,
2222
+ active: 0
2223
+ },
2224
+
2225
+ init: function() {
2226
+
2227
+ var $this = this;
2228
+
2229
+ this.on("click", this.options.target, function(e) {
2230
+ e.preventDefault();
2231
+ $this.find($this.options.target).not(this).removeClass("uk-active").blur();
2232
+ $this.trigger("change", [$(this).addClass("uk-active")]);
2233
+ });
2234
+
2235
+
2236
+ if (this.options.connect) {
2237
+ this.connect = $(this.options.connect);
2238
+ }
2239
+
2240
+ if (location.hash && location.hash.match(/^#[a-z0-9_-]+$/)) {
2241
+ var active = this.element.children().filter(window.location.hash);
2242
+
2243
+ if (active.length) {
2244
+ this.element.children().removeClass('uk-active').filter(active).addClass("uk-active");
2245
+ }
2246
+ }
2247
+
2248
+ var mobiletab = $('<li class="uk-tab-responsive uk-active"><a href="javascript:void(0);"></a></li>'),
2249
+ caption = mobiletab.find("a:first"),
2250
+ dropdown = $('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>'),
2251
+ ul = dropdown.find("ul");
2252
+
2253
+ caption.html(this.find("li.uk-active:first").find("a").text());
2254
+
2255
+ if (this.element.hasClass("uk-tab-bottom")) dropdown.addClass("uk-dropdown-up");
2256
+ if (this.element.hasClass("uk-tab-flip")) dropdown.addClass("uk-dropdown-flip");
2257
+
2258
+ this.find("a").each(function(i) {
2259
+
2260
+ var tab = $(this).parent(),
2261
+ item = $('<li><a href="javascript:void(0);">' + tab.text() + '</a></li>').on("click", function(e) {
2262
+ $this.element.data("switcher").show(i);
2263
+ });
2264
+
2265
+ if (!$(this).parents(".uk-disabled:first").length) ul.append(item);
2266
+ });
2267
+
2268
+ this.element.uk("switcher", {"toggle": ">li:not(.uk-tab-responsive)", "connect": this.options.connect, "active": this.options.active});
2269
+
2270
+ mobiletab.append(dropdown).uk("dropdown", {"mode": "click"});
2271
+
2272
+ this.element.append(mobiletab).data({
2273
+ "dropdown": mobiletab.data("dropdown"),
2274
+ "mobilecaption": caption
2275
+ }).on("uk.switcher.show", function(e, tab) {
2276
+ mobiletab.addClass("uk-active");
2277
+ caption.html(tab.find("a").text());
2278
+ });
2279
+
2280
+ }
2281
+ });
2282
+
2283
+ $(document).on("uk-domready", function(e) {
2284
+
2285
+ $("[data-uk-tab]").each(function() {
2286
+ var tab = $(this);
2287
+
2288
+ if (!tab.data("tab")) {
2289
+ var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
2290
+ }
2291
+ });
2292
+ });
2293
+
2294
+ })(jQuery, jQuery.UIkit);
2295
+
2296
+ (function($, UI) {
2297
+
2298
+ "use strict";
2299
+
2300
+ var $win = $(window),
2301
+ $doc = $(document),
2302
+ scrollspies = [],
2303
+ checkScrollSpy = function() {
2304
+ for(var i=0; i < scrollspies.length; i++) {
2305
+ UI.support.requestAnimationFrame.apply(window, [scrollspies[i].check]);
2306
+ }
2307
+ };
2308
+
2309
+ UI.component('scrollspy', {
2310
+
2311
+ defaults: {
2312
+ "cls" : "uk-scrollspy-inview",
2313
+ "initcls" : "uk-scrollspy-init-inview",
2314
+ "topoffset" : 0,
2315
+ "leftoffset" : 0,
2316
+ "repeat" : false,
2317
+ "delay" : 0
2318
+ },
2319
+
2320
+ init: function() {
2321
+
2322
+ var $this = this, idle, inviewstate, initinview,
2323
+ fn = function(){
2324
+
2325
+ var inview = UI.Utils.isInView($this.element, $this.options);
2326
+
2327
+ if(inview && !inviewstate) {
2328
+
2329
+ if(idle) clearTimeout(idle);
2330
+
2331
+ if(!initinview) {
2332
+ $this.element.addClass($this.options.initcls);
2333
+ $this.offset = $this.element.offset();
2334
+ initinview = true;
2335
+
2336
+ $this.trigger("uk.scrollspy.init");
2337
+ }
2338
+
2339
+ idle = setTimeout(function(){
2340
+
2341
+ if(inview) {
2342
+ $this.element.addClass("uk-scrollspy-inview").addClass($this.options.cls).width();
2343
+ }
2344
+ }, $this.options.delay);
2345
+
2346
+ inviewstate = true;
2347
+ $this.trigger("uk.scrollspy.inview");
2348
+ }
2349
+
2350
+ if (!inview && inviewstate && $this.options.repeat) {
2351
+ $this.element.removeClass("uk-scrollspy-inview").removeClass($this.options.cls);
2352
+ inviewstate = false;
2353
+
2354
+ $this.trigger("uk.scrollspy.outview");
2355
+ }
2356
+ };
2357
+
2358
+ fn();
2359
+
2360
+ this.check = fn;
2361
+ scrollspies.push(this);
2362
+ }
2363
+ });
2364
+
2365
+
2366
+ var scrollspynavs = [],
2367
+ checkScrollSpyNavs = function() {
2368
+ for(var i=0; i < scrollspynavs.length; i++) {
2369
+ UI.support.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
2370
+ }
2371
+ };
2372
+
2373
+ UI.component('scrollspynav', {
2374
+
2375
+ defaults: {
2376
+ "cls" : 'uk-active',
2377
+ "closest" : false,
2378
+ "topoffset" : 0,
2379
+ "leftoffset" : 0,
2380
+ "smoothscroll" : false
2381
+ },
2382
+
2383
+ init: function() {
2384
+
2385
+ var ids = [],
2386
+ links = this.find("a[href^='#']").each(function(){ ids.push($(this).attr("href")); }),
2387
+ targets = $(ids.join(","));
2388
+
2389
+ var $this = this, inviews, fn = function(){
2390
+
2391
+ inviews = [];
2392
+
2393
+ for(var i=0 ; i < targets.length ; i++) {
2394
+ if(UI.Utils.isInView(targets.eq(i), $this.options)) {
2395
+ inviews.push(targets.eq(i));
2396
+ }
2397
+ }
2398
+
2399
+ if(inviews.length) {
2400
+
2401
+ var scrollTop = $win.scrollTop(),
2402
+ target = (function(){
2403
+ for(var i=0; i< inviews.length;i++){
2404
+ if(inviews[i].offset().top >= scrollTop){
2405
+ return inviews[i];
2406
+ }
2407
+ }
2408
+ })();
2409
+
2410
+ if(!target) return;
2411
+
2412
+ if($this.options.closest) {
2413
+ links.closest($this.options.closest).removeClass($this.options.cls).end().filter("a[href='#"+target.attr("id")+"']").closest($this.options.closest).addClass($this.options.cls);
2414
+ } else {
2415
+ links.removeClass($this.options.cls).filter("a[href='#"+target.attr("id")+"']").addClass($this.options.cls);
2416
+ }
2417
+ }
2418
+ };
2419
+
2420
+ if(this.options.smoothscroll && UI["smoothScroll"]) {
2421
+ links.each(function(){
2422
+ UI.smoothScroll(this, $this.options.smoothscroll);
2423
+ });
2424
+ }
2425
+
2426
+ fn();
2427
+
2428
+ this.element.data("scrollspynav", this);
2429
+
2430
+ this.check = fn;
2431
+ scrollspynavs.push(this);
2432
+
2433
+ }
2434
+ });
2435
+
2436
+
2437
+ var fnCheck = function(){
2438
+ checkScrollSpy();
2439
+ checkScrollSpyNavs();
2440
+ };
2441
+
2442
+ // listen to scroll and resize
2443
+ $doc.on("uk-scroll", fnCheck);
2444
+ $win.on("resize orientationchange", UI.Utils.debounce(fnCheck, 50));
2445
+
2446
+ // init code
2447
+ $doc.on("uk-domready", function(e) {
2448
+ $("[data-uk-scrollspy]").each(function() {
2449
+
2450
+ var element = $(this);
2451
+
2452
+ if (!element.data("scrollspy")) {
2453
+ var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
2454
+ }
2455
+ });
2456
+
2457
+ $("[data-uk-scrollspy-nav]").each(function() {
2458
+
2459
+ var element = $(this);
2460
+
2461
+ if (!element.data("scrollspynav")) {
2462
+ var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
2463
+ }
2464
+ });
2465
+ });
2466
+
2467
+ })(jQuery, jQuery.UIkit);
2468
+
2469
+ (function($, UI) {
2470
+
2471
+ "use strict";
2472
+
2473
+ UI.component('smoothScroll', {
2474
+
2475
+ defaults: {
2476
+ duration: 1000,
2477
+ transition: 'easeOutExpo',
2478
+ offset: 0,
2479
+ complete: function(){}
2480
+ },
2481
+
2482
+ init: function() {
2483
+
2484
+ var $this = this;
2485
+
2486
+ this.on("click", function(e) {
2487
+
2488
+ // get / set parameters
2489
+ var ele = ($(this.hash).length ? $(this.hash) : $("body")),
2490
+ target = ele.offset().top - $this.options.offset,
2491
+ docheight = $(document).height(),
2492
+ winheight = $(window).height(),
2493
+ eleheight = ele.outerHeight();
2494
+
2495
+ if ((target + winheight) > docheight) {
2496
+ target = docheight - winheight;
2497
+ }
2498
+
2499
+ // animate to target, fire callback when done
2500
+ $("html,body").stop().animate({scrollTop: target}, $this.options.duration, $this.options.transition).promise().done($this.options.complete);
2501
+
2502
+ // cancel default click action
2503
+ return false;
2504
+ });
2505
+
2506
+ }
2507
+ });
2508
+
2509
+ if (!$.easing['easeOutExpo']) {
2510
+ $.easing['easeOutExpo'] = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
2511
+ }
2512
+
2513
+ // init code
2514
+ $(document).on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
2515
+ var ele = $(this);
2516
+
2517
+ if (!ele.data("smoothScroll")) {
2518
+ var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
2519
+ ele.trigger("click");
2520
+ }
2521
+
2522
+ return false;
2523
+ });
2524
+
2525
+ })(jQuery, jQuery.UIkit);
2526
+
2527
+
2528
+ (function(global, $, UI){
2529
+
2530
+
2531
+ UI.component('toggle', {
2532
+
2533
+ defaults: {
2534
+ target: false,
2535
+ cls: 'uk-hidden'
2536
+ },
2537
+
2538
+ init: function() {
2539
+
2540
+ var $this = this;
2541
+
2542
+ this.totoggle = this.options.target ? $(this.options.target):[];
2543
+
2544
+ this.on("click", function(e) {
2545
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
2546
+ $this.toggle();
2547
+ });
2548
+ },
2549
+
2550
+ toggle: function() {
2551
+
2552
+ if(!this.totoggle.length) return;
2553
+
2554
+ this.totoggle.toggleClass(this.options.cls);
2555
+
2556
+ if(this.options.cls == 'uk-hidden') {
2557
+ $(document).trigger("uk-check-display");
2558
+ }
2559
+ }
2560
+ });
2561
+
2562
+ $(document).on("uk-domready", function(e) {
2563
+
2564
+ $("[data-uk-toggle]").each(function() {
2565
+ var ele = $(this);
2566
+
2567
+ if (!ele.data("toggle")) {
2568
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
2569
+ }
2570
+ });
2571
+ });
2572
+
2573
+ })(this, jQuery, jQuery.UIkit);