rails-uikit-sass 2.27.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +43 -0
  4. data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
  5. data/lib/rails-uikit-sass.rb +12 -0
  6. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  8. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  9. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  10. data/vendor/assets/javascripts/components/accordion.js +180 -0
  11. data/vendor/assets/javascripts/components/accordion.min.js +2 -0
  12. data/vendor/assets/javascripts/components/autocomplete.js +340 -0
  13. data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
  14. data/vendor/assets/javascripts/components/datepicker.js +3167 -0
  15. data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
  16. data/vendor/assets/javascripts/components/form-password.js +67 -0
  17. data/vendor/assets/javascripts/components/form-password.min.js +2 -0
  18. data/vendor/assets/javascripts/components/form-select.js +85 -0
  19. data/vendor/assets/javascripts/components/form-select.min.js +2 -0
  20. data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
  21. data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
  22. data/vendor/assets/javascripts/components/grid.js +540 -0
  23. data/vendor/assets/javascripts/components/grid.min.js +2 -0
  24. data/vendor/assets/javascripts/components/htmleditor.js +679 -0
  25. data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
  26. data/vendor/assets/javascripts/components/lightbox.js +588 -0
  27. data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
  28. data/vendor/assets/javascripts/components/nestable.js +653 -0
  29. data/vendor/assets/javascripts/components/nestable.min.js +2 -0
  30. data/vendor/assets/javascripts/components/notify.js +189 -0
  31. data/vendor/assets/javascripts/components/notify.min.js +2 -0
  32. data/vendor/assets/javascripts/components/pagination.js +147 -0
  33. data/vendor/assets/javascripts/components/pagination.min.js +2 -0
  34. data/vendor/assets/javascripts/components/parallax.js +462 -0
  35. data/vendor/assets/javascripts/components/parallax.min.js +2 -0
  36. data/vendor/assets/javascripts/components/search.js +92 -0
  37. data/vendor/assets/javascripts/components/search.min.js +2 -0
  38. data/vendor/assets/javascripts/components/slider.js +552 -0
  39. data/vendor/assets/javascripts/components/slider.min.js +2 -0
  40. data/vendor/assets/javascripts/components/slideset.js +523 -0
  41. data/vendor/assets/javascripts/components/slideset.min.js +2 -0
  42. data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
  43. data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
  44. data/vendor/assets/javascripts/components/slideshow.js +596 -0
  45. data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
  46. data/vendor/assets/javascripts/components/sortable.js +688 -0
  47. data/vendor/assets/javascripts/components/sortable.min.js +2 -0
  48. data/vendor/assets/javascripts/components/sticky.js +364 -0
  49. data/vendor/assets/javascripts/components/sticky.min.js +2 -0
  50. data/vendor/assets/javascripts/components/timepicker.js +192 -0
  51. data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
  52. data/vendor/assets/javascripts/components/tooltip.js +235 -0
  53. data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
  54. data/vendor/assets/javascripts/components/upload.js +262 -0
  55. data/vendor/assets/javascripts/components/upload.min.js +2 -0
  56. data/vendor/assets/javascripts/core/alert.js +66 -0
  57. data/vendor/assets/javascripts/core/alert.min.js +2 -0
  58. data/vendor/assets/javascripts/core/button.js +156 -0
  59. data/vendor/assets/javascripts/core/button.min.js +2 -0
  60. data/vendor/assets/javascripts/core/core.js +820 -0
  61. data/vendor/assets/javascripts/core/core.min.js +2 -0
  62. data/vendor/assets/javascripts/core/cover.js +87 -0
  63. data/vendor/assets/javascripts/core/cover.min.js +2 -0
  64. data/vendor/assets/javascripts/core/dropdown.js +534 -0
  65. data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
  66. data/vendor/assets/javascripts/core/grid.js +117 -0
  67. data/vendor/assets/javascripts/core/grid.min.js +2 -0
  68. data/vendor/assets/javascripts/core/modal.js +387 -0
  69. data/vendor/assets/javascripts/core/modal.min.js +2 -0
  70. data/vendor/assets/javascripts/core/nav.js +153 -0
  71. data/vendor/assets/javascripts/core/nav.min.js +2 -0
  72. data/vendor/assets/javascripts/core/offcanvas.js +197 -0
  73. data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
  74. data/vendor/assets/javascripts/core/scrollspy.js +209 -0
  75. data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
  76. data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
  77. data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
  78. data/vendor/assets/javascripts/core/switcher.js +307 -0
  79. data/vendor/assets/javascripts/core/switcher.min.js +2 -0
  80. data/vendor/assets/javascripts/core/tab.js +169 -0
  81. data/vendor/assets/javascripts/core/tab.min.js +2 -0
  82. data/vendor/assets/javascripts/core/toggle.js +124 -0
  83. data/vendor/assets/javascripts/core/toggle.min.js +2 -0
  84. data/vendor/assets/javascripts/core/touch.js +175 -0
  85. data/vendor/assets/javascripts/core/touch.min.js +2 -0
  86. data/vendor/assets/javascripts/core/utility.js +335 -0
  87. data/vendor/assets/javascripts/core/utility.min.js +2 -0
  88. data/vendor/assets/javascripts/uikit.js +3898 -0
  89. data/vendor/assets/javascripts/uikit.min.js +3 -0
  90. data/vendor/assets/stylesheets/components/accordion.scss +94 -0
  91. data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
  92. data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
  93. data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
  94. data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
  95. data/vendor/assets/stylesheets/components/form-file.scss +63 -0
  96. data/vendor/assets/stylesheets/components/form-password.scss +74 -0
  97. data/vendor/assets/stylesheets/components/form-select.scss +66 -0
  98. data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
  99. data/vendor/assets/stylesheets/components/nestable.scss +231 -0
  100. data/vendor/assets/stylesheets/components/notify.scss +190 -0
  101. data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
  102. data/vendor/assets/stylesheets/components/progress.scss +173 -0
  103. data/vendor/assets/stylesheets/components/search.scss +309 -0
  104. data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
  105. data/vendor/assets/stylesheets/components/slider.scss +139 -0
  106. data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
  107. data/vendor/assets/stylesheets/components/sortable.scss +124 -0
  108. data/vendor/assets/stylesheets/components/sticky.scss +57 -0
  109. data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
  110. data/vendor/assets/stylesheets/components/upload.scss +34 -0
  111. data/vendor/assets/stylesheets/core/alert.scss +141 -0
  112. data/vendor/assets/stylesheets/core/animation.scss +599 -0
  113. data/vendor/assets/stylesheets/core/article.scss +139 -0
  114. data/vendor/assets/stylesheets/core/badge.scss +110 -0
  115. data/vendor/assets/stylesheets/core/base.scss +563 -0
  116. data/vendor/assets/stylesheets/core/block.scss +155 -0
  117. data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
  118. data/vendor/assets/stylesheets/core/button.scss +406 -0
  119. data/vendor/assets/stylesheets/core/close.scss +132 -0
  120. data/vendor/assets/stylesheets/core/column.scss +209 -0
  121. data/vendor/assets/stylesheets/core/comment.scss +172 -0
  122. data/vendor/assets/stylesheets/core/contrast.scss +493 -0
  123. data/vendor/assets/stylesheets/core/cover.scss +70 -0
  124. data/vendor/assets/stylesheets/core/description-list.scss +71 -0
  125. data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
  126. data/vendor/assets/stylesheets/core/flex.scss +320 -0
  127. data/vendor/assets/stylesheets/core/form.scss +629 -0
  128. data/vendor/assets/stylesheets/core/grid.scss +731 -0
  129. data/vendor/assets/stylesheets/core/icon.scss +930 -0
  130. data/vendor/assets/stylesheets/core/list.scss +102 -0
  131. data/vendor/assets/stylesheets/core/modal.scss +343 -0
  132. data/vendor/assets/stylesheets/core/nav.scss +468 -0
  133. data/vendor/assets/stylesheets/core/navbar.scss +325 -0
  134. data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
  135. data/vendor/assets/stylesheets/core/overlay.scss +534 -0
  136. data/vendor/assets/stylesheets/core/pagination.scss +197 -0
  137. data/vendor/assets/stylesheets/core/panel.scss +332 -0
  138. data/vendor/assets/stylesheets/core/print.scss +61 -0
  139. data/vendor/assets/stylesheets/core/subnav.scss +213 -0
  140. data/vendor/assets/stylesheets/core/switcher.scss +38 -0
  141. data/vendor/assets/stylesheets/core/tab.scss +368 -0
  142. data/vendor/assets/stylesheets/core/table.scss +147 -0
  143. data/vendor/assets/stylesheets/core/text.scss +136 -0
  144. data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
  145. data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
  146. data/vendor/assets/stylesheets/core/utility.scss +610 -0
  147. data/vendor/assets/stylesheets/core/variables.scss +23 -0
  148. data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
  149. data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
  150. data/vendor/assets/stylesheets/uikit.scss +52 -0
  151. metadata +251 -0
@@ -0,0 +1,2 @@
1
+ /*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ !function(t){"use strict";var i=[];t.component("stackMargin",{defaults:{cls:"uk-margin-small-top",rowfirst:!1,observe:!1},boot:function(){t.ready(function(i){t.$("[data-uk-margin]",i).each(function(){var i=t.$(this);i.data("stackMargin")||t.stackMargin(i,t.Utils.options(i.attr("data-uk-margin")))})})},init:function(){var e=this;t.$win.on("resize orientationchange",function(){var i=function(){e.process()};return t.$(function(){i(),t.$win.on("load",i)}),t.Utils.debounce(i,20)}()),this.on("display.uk.check",function(){this.element.is(":visible")&&this.process()}.bind(this)),this.options.observe&&t.domObserve(this.element,function(){e.element.is(":visible")&&e.process()}),i.push(this)},process:function(){var i=this.element.children();if(t.Utils.stackMargin(i,this.options),!this.options.rowfirst||!i.length)return this;var e={},n=!1;return i.removeClass(this.options.rowfirst).each(function(i,s){s=t.$(this),"none"!=this.style.display&&(i=s.offset().left,((e[i]=e[i]||[])&&e[i]).push(this),n=n===!1?i:Math.min(n,i))}),t.$(e[n]).addClass(this.options.rowfirst),this}}),function(){var i=[],e=function(t){if(t.is(":visible")){var i=t.parent().width(),e=t.data("width"),n=i/e,s=Math.floor(n*t.data("height"));t.css({height:e>i?s:t.data("height")})}};t.component("responsiveElement",{defaults:{},boot:function(){t.ready(function(i){t.$("iframe.uk-responsive-width, [data-uk-responsive]",i).each(function(){var i,e=t.$(this);e.data("responsiveElement")||(i=t.responsiveElement(e,{}))})})},init:function(){var t=this.element;t.attr("width")&&t.attr("height")&&(t.data({width:t.attr("width"),height:t.attr("height")}).on("display.uk.check",function(){e(t)}),e(t),i.push(t))}}),t.$win.on("resize load",t.Utils.debounce(function(){i.forEach(function(t){e(t)})},15))}(),t.Utils.stackMargin=function(i,e){e=t.$.extend({cls:"uk-margin-small-top"},e),i=t.$(i).removeClass(e.cls);var n=!1;i.each(function(i,e,s,a){a=t.$(this),"none"!=a.css("display")&&(i=a.offset(),e=a.outerHeight(),s=i.top+e,a.data({ukMarginPos:s,ukMarginTop:i.top}),(n===!1||i.top<n.top)&&(n={top:i.top,left:i.left,pos:s}))}).each(function(i){i=t.$(this),"none"!=i.css("display")&&i.data("ukMarginTop")>n.top&&i.data("ukMarginPos")>n.pos&&i.addClass(e.cls)})},t.Utils.matchHeights=function(i,e){i=t.$(i).css("min-height",""),e=t.$.extend({row:!0},e);var n=function(i){if(!(i.length<2)){var e=0;i.each(function(){e=Math.max(e,t.$(this).outerHeight())}).each(function(){var i=t.$(this),n=e-("border-box"==i.css("box-sizing")?0:i.outerHeight()-i.height());i.css("min-height",n+"px")})}};e.row?(i.first().width(),setTimeout(function(){var e=!1,s=[];i.each(function(){var i=t.$(this),a=i.offset().top;a!=e&&s.length&&(n(t.$(s)),s=[],a=i.offset().top),s.push(i),e=a}),s.length&&n(t.$(s))},0)):n(i)},function(i){t.Utils.inlineSvg=function(e,n){t.$(e||'img[src$=".svg"]',n||document).each(function(){var e=t.$(this),n=e.attr("src");if(!i[n]){var s=t.$.Deferred();t.$.get(n,{nc:Math.random()},function(i){s.resolve(t.$(i).find("svg"))}),i[n]=s.promise()}i[n].then(function(i){var n=t.$(i).clone();e.attr("id")&&n.attr("id",e.attr("id")),e.attr("class")&&n.attr("class",e.attr("class")),e.attr("style")&&n.attr("style",e.attr("style")),e.attr("width")&&(n.attr("width",e.attr("width")),e.attr("height")||n.removeAttr("height")),e.attr("height")&&(n.attr("height",e.attr("height")),e.attr("width")||n.removeAttr("width")),e.replaceWith(n)})})},t.ready(function(i){t.Utils.inlineSvg("[data-uk-svg]",i)})}({}),t.Utils.getCssVar=function(t){var i,e=document.documentElement,n=e.appendChild(document.createElement("div"));n.classList.add("var-"+t);try{i=JSON.parse(i=getComputedStyle(n,":before").content.replace(/^["'](.*)["']$/,"$1"))}catch(s){i=void 0}return e.removeChild(n),i}}(UIkit);
@@ -0,0 +1,3898 @@
1
+ /*! UIkit 2.27.2 | 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.2';
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 (e.originalEvent && e.originalEvent.pointerId && 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
+ width : ele.attr('width'),
1135
+ height: ele.attr('height')
1136
+ }).on('display.uk.check', function(){
1137
+ check(ele);
1138
+ });
1139
+
1140
+ check(ele);
1141
+
1142
+ elements.push(ele);
1143
+ }
1144
+ }
1145
+ });
1146
+
1147
+ UI.$win.on('resize load', UI.Utils.debounce(function(){
1148
+
1149
+ elements.forEach(function(ele){
1150
+ check(ele);
1151
+ });
1152
+
1153
+ }, 15));
1154
+
1155
+ })();
1156
+
1157
+
1158
+ // helper
1159
+
1160
+ UI.Utils.stackMargin = function(elements, options) {
1161
+
1162
+ options = UI.$.extend({
1163
+ cls: 'uk-margin-small-top'
1164
+ }, options);
1165
+
1166
+ elements = UI.$(elements).removeClass(options.cls);
1167
+
1168
+ var min = false;
1169
+
1170
+ elements.each(function(offset, height, pos, $ele){
1171
+
1172
+ $ele = UI.$(this);
1173
+
1174
+ if ($ele.css('display') != 'none') {
1175
+
1176
+ offset = $ele.offset();
1177
+ height = $ele.outerHeight();
1178
+ pos = offset.top + height;
1179
+
1180
+ $ele.data({
1181
+ ukMarginPos: pos,
1182
+ ukMarginTop: offset.top
1183
+ });
1184
+
1185
+ if (min === false || (offset.top < min.top) ) {
1186
+
1187
+ min = {
1188
+ top : offset.top,
1189
+ left : offset.left,
1190
+ pos : pos
1191
+ };
1192
+ }
1193
+ }
1194
+
1195
+ }).each(function($ele) {
1196
+
1197
+ $ele = UI.$(this);
1198
+
1199
+ if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
1200
+ $ele.addClass(options.cls);
1201
+ }
1202
+ });
1203
+ };
1204
+
1205
+ UI.Utils.matchHeights = function(elements, options) {
1206
+
1207
+ elements = UI.$(elements).css('min-height', '');
1208
+ options = UI.$.extend({ row : true }, options);
1209
+
1210
+ var matchHeights = function(group){
1211
+
1212
+ if (group.length < 2) return;
1213
+
1214
+ var max = 0;
1215
+
1216
+ group.each(function() {
1217
+ max = Math.max(max, UI.$(this).outerHeight());
1218
+ }).each(function() {
1219
+
1220
+ var element = UI.$(this),
1221
+ height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
1222
+
1223
+ element.css('min-height', height + 'px');
1224
+ });
1225
+ };
1226
+
1227
+ if (options.row) {
1228
+
1229
+ elements.first().width(); // force redraw
1230
+
1231
+ setTimeout(function(){
1232
+
1233
+ var lastoffset = false, group = [];
1234
+
1235
+ elements.each(function() {
1236
+
1237
+ var ele = UI.$(this), offset = ele.offset().top;
1238
+
1239
+ if (offset != lastoffset && group.length) {
1240
+
1241
+ matchHeights(UI.$(group));
1242
+ group = [];
1243
+ offset = ele.offset().top;
1244
+ }
1245
+
1246
+ group.push(ele);
1247
+ lastoffset = offset;
1248
+ });
1249
+
1250
+ if (group.length) {
1251
+ matchHeights(UI.$(group));
1252
+ }
1253
+
1254
+ }, 0);
1255
+
1256
+ } else {
1257
+ matchHeights(elements);
1258
+ }
1259
+ };
1260
+
1261
+ (function(cacheSvgs){
1262
+
1263
+ UI.Utils.inlineSvg = function(selector, root) {
1264
+
1265
+ var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
1266
+
1267
+ var img = UI.$(this),
1268
+ src = img.attr('src');
1269
+
1270
+ if (!cacheSvgs[src]) {
1271
+
1272
+ var d = UI.$.Deferred();
1273
+
1274
+ UI.$.get(src, {nc: Math.random()}, function(data){
1275
+ d.resolve(UI.$(data).find('svg'));
1276
+ });
1277
+
1278
+ cacheSvgs[src] = d.promise();
1279
+ }
1280
+
1281
+ cacheSvgs[src].then(function(svg) {
1282
+
1283
+ var $svg = UI.$(svg).clone();
1284
+
1285
+ if (img.attr('id')) $svg.attr('id', img.attr('id'));
1286
+ if (img.attr('class')) $svg.attr('class', img.attr('class'));
1287
+ if (img.attr('style')) $svg.attr('style', img.attr('style'));
1288
+
1289
+ if (img.attr('width')) {
1290
+ $svg.attr('width', img.attr('width'));
1291
+ if (!img.attr('height')) $svg.removeAttr('height');
1292
+ }
1293
+
1294
+ if (img.attr('height')){
1295
+ $svg.attr('height', img.attr('height'));
1296
+ if (!img.attr('width')) $svg.removeAttr('width');
1297
+ }
1298
+
1299
+ img.replaceWith($svg);
1300
+ });
1301
+ });
1302
+ };
1303
+
1304
+ // init code
1305
+ UI.ready(function(context) {
1306
+ UI.Utils.inlineSvg('[data-uk-svg]', context);
1307
+ });
1308
+
1309
+ })({});
1310
+
1311
+ UI.Utils.getCssVar = function(name) {
1312
+
1313
+ /* usage in css: .var-name:before { content:"xyz" } */
1314
+
1315
+ var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
1316
+
1317
+ element.classList.add('var-'+name);
1318
+
1319
+ try {
1320
+ val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
1321
+ } catch (e) {
1322
+ val = undefined;
1323
+ }
1324
+
1325
+ doc.removeChild(element);
1326
+
1327
+ return val;
1328
+ }
1329
+
1330
+ })(UIkit);
1331
+
1332
+ (function(UI) {
1333
+
1334
+ "use strict";
1335
+
1336
+ UI.component('smoothScroll', {
1337
+
1338
+ boot: function() {
1339
+
1340
+ // init code
1341
+ UI.$html.on('click.smooth-scroll.uikit', '[data-uk-smooth-scroll]', function(e) {
1342
+ var ele = UI.$(this);
1343
+
1344
+ if (!ele.data('smoothScroll')) {
1345
+ var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr('data-uk-smooth-scroll')));
1346
+ ele.trigger('click');
1347
+ }
1348
+
1349
+ return false;
1350
+ });
1351
+ },
1352
+
1353
+ init: function() {
1354
+
1355
+ var $this = this;
1356
+
1357
+ this.on('click', function(e) {
1358
+ e.preventDefault();
1359
+ scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$('body'), $this.options);
1360
+ });
1361
+ }
1362
+ });
1363
+
1364
+ function scrollToElement(ele, options) {
1365
+
1366
+ options = UI.$.extend({
1367
+ duration: 1000,
1368
+ transition: 'easeOutExpo',
1369
+ offset: 0,
1370
+ complete: function(){}
1371
+ }, options);
1372
+
1373
+ // get / set parameters
1374
+ var target = ele.offset().top - options.offset,
1375
+ docheight = UI.$doc.height(),
1376
+ winheight = window.innerHeight;
1377
+
1378
+ if ((target + winheight) > docheight) {
1379
+ target = docheight - winheight;
1380
+ }
1381
+
1382
+ // animate to target, fire callback when done
1383
+ UI.$('html,body').stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
1384
+ }
1385
+
1386
+ UI.Utils.scrollToElement = scrollToElement;
1387
+
1388
+ if (!UI.$.easing.easeOutExpo) {
1389
+ UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
1390
+ }
1391
+
1392
+ })(UIkit);
1393
+
1394
+ (function(UI) {
1395
+
1396
+ "use strict";
1397
+
1398
+ var $win = UI.$win,
1399
+ $doc = UI.$doc,
1400
+ scrollspies = [],
1401
+ checkScrollSpy = function() {
1402
+ for(var i=0; i < scrollspies.length; i++) {
1403
+ window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
1404
+ }
1405
+ };
1406
+
1407
+ UI.component('scrollspy', {
1408
+
1409
+ defaults: {
1410
+ target : false,
1411
+ cls : 'uk-scrollspy-inview',
1412
+ initcls : 'uk-scrollspy-init-inview',
1413
+ topoffset : 0,
1414
+ leftoffset : 0,
1415
+ repeat : false,
1416
+ delay : 0
1417
+ },
1418
+
1419
+ boot: function() {
1420
+
1421
+ // listen to scroll and resize
1422
+ $doc.on('scrolling.uk.document', checkScrollSpy);
1423
+ $win.on('load resize orientationchange', UI.Utils.debounce(checkScrollSpy, 50));
1424
+
1425
+ // init code
1426
+ UI.ready(function(context) {
1427
+
1428
+ UI.$('[data-uk-scrollspy]', context).each(function() {
1429
+
1430
+ var element = UI.$(this);
1431
+
1432
+ if (!element.data('scrollspy')) {
1433
+ var obj = UI.scrollspy(element, UI.Utils.options(element.attr('data-uk-scrollspy')));
1434
+ }
1435
+ });
1436
+ });
1437
+ },
1438
+
1439
+ init: function() {
1440
+
1441
+ var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
1442
+
1443
+ var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
1444
+ delayIdx = elements.length === 1 ? 1 : 0,
1445
+ toggleclsIdx = 0;
1446
+
1447
+ elements.each(function(idx){
1448
+
1449
+ var element = UI.$(this),
1450
+ inviewstate = element.data('inviewstate'),
1451
+ inview = UI.Utils.isInView(element, $this.options),
1452
+ toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
1453
+
1454
+ if (inview && !inviewstate && !element.data('scrollspy-idle')) {
1455
+
1456
+ if (!initinview) {
1457
+ element.addClass($this.options.initcls);
1458
+ $this.offset = element.offset();
1459
+ initinview = true;
1460
+
1461
+ element.trigger('init.uk.scrollspy');
1462
+ }
1463
+
1464
+ element.data('scrollspy-idle', setTimeout(function(){
1465
+
1466
+ element.addClass('uk-scrollspy-inview').toggleClass(toggle).width();
1467
+ element.trigger('inview.uk.scrollspy');
1468
+
1469
+ element.data('scrollspy-idle', false);
1470
+ element.data('inviewstate', true);
1471
+
1472
+ }, $this.options.delay * delayIdx));
1473
+
1474
+ delayIdx++;
1475
+ }
1476
+
1477
+ if (!inview && inviewstate && $this.options.repeat) {
1478
+
1479
+ if (element.data('scrollspy-idle')) {
1480
+ clearTimeout(element.data('scrollspy-idle'));
1481
+ element.data('scrollspy-idle', false);
1482
+ }
1483
+
1484
+ element.removeClass('uk-scrollspy-inview').toggleClass(toggle);
1485
+ element.data('inviewstate', false);
1486
+
1487
+ element.trigger('outview.uk.scrollspy');
1488
+ }
1489
+
1490
+ toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
1491
+
1492
+ });
1493
+ };
1494
+
1495
+ fn();
1496
+
1497
+ this.check = fn;
1498
+
1499
+ scrollspies.push(this);
1500
+ }
1501
+ });
1502
+
1503
+
1504
+ var scrollspynavs = [],
1505
+ checkScrollSpyNavs = function() {
1506
+ for(var i=0; i < scrollspynavs.length; i++) {
1507
+ window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
1508
+ }
1509
+ };
1510
+
1511
+ UI.component('scrollspynav', {
1512
+
1513
+ defaults: {
1514
+ cls : 'uk-active',
1515
+ closest : false,
1516
+ topoffset : 0,
1517
+ leftoffset : 0,
1518
+ smoothscroll : false
1519
+ },
1520
+
1521
+ boot: function() {
1522
+
1523
+ // listen to scroll and resize
1524
+ $doc.on('scrolling.uk.document', checkScrollSpyNavs);
1525
+ $win.on('resize orientationchange', UI.Utils.debounce(checkScrollSpyNavs, 50));
1526
+
1527
+ // init code
1528
+ UI.ready(function(context) {
1529
+
1530
+ UI.$('[data-uk-scrollspy-nav]', context).each(function() {
1531
+
1532
+ var element = UI.$(this);
1533
+
1534
+ if (!element.data('scrollspynav')) {
1535
+ var obj = UI.scrollspynav(element, UI.Utils.options(element.attr('data-uk-scrollspy-nav')));
1536
+ }
1537
+ });
1538
+ });
1539
+ },
1540
+
1541
+ init: function() {
1542
+
1543
+ var ids = [],
1544
+ links = this.find("a[href^='#']").each(function(){ if(this.getAttribute('href').trim()!=='#') ids.push(this.getAttribute('href')); }),
1545
+ targets = UI.$(ids.join(",")),
1546
+
1547
+ clsActive = this.options.cls,
1548
+ clsClosest = this.options.closest || this.options.closest;
1549
+
1550
+ var $this = this, inviews, fn = function(){
1551
+
1552
+ inviews = [];
1553
+
1554
+ for (var i=0 ; i < targets.length ; i++) {
1555
+ if (UI.Utils.isInView(targets.eq(i), $this.options)) {
1556
+ inviews.push(targets.eq(i));
1557
+ }
1558
+ }
1559
+
1560
+ if (inviews.length) {
1561
+
1562
+ var navitems,
1563
+ scrollTop = $win.scrollTop(),
1564
+ target = (function(){
1565
+ for(var i=0; i< inviews.length;i++){
1566
+ if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
1567
+ return inviews[i];
1568
+ }
1569
+ }
1570
+ })();
1571
+
1572
+ if (!target) return;
1573
+
1574
+ if ($this.options.closest) {
1575
+ links.blur().closest(clsClosest).removeClass(clsActive);
1576
+ navitems = links.filter("a[href='#"+target.attr('id')+"']").closest(clsClosest).addClass(clsActive);
1577
+ } else {
1578
+ navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
1579
+ }
1580
+
1581
+ $this.element.trigger('inview.uk.scrollspynav', [target, navitems]);
1582
+ }
1583
+ };
1584
+
1585
+ if (this.options.smoothscroll && UI.smoothScroll) {
1586
+ links.each(function(){
1587
+ UI.smoothScroll(this, $this.options.smoothscroll);
1588
+ });
1589
+ }
1590
+
1591
+ fn();
1592
+
1593
+ this.element.data('scrollspynav', this);
1594
+
1595
+ this.check = fn;
1596
+ scrollspynavs.push(this);
1597
+
1598
+ }
1599
+ });
1600
+
1601
+ })(UIkit);
1602
+
1603
+ (function(UI){
1604
+
1605
+ "use strict";
1606
+
1607
+ var toggles = [];
1608
+
1609
+ UI.component('toggle', {
1610
+
1611
+ defaults: {
1612
+ target : false,
1613
+ cls : 'uk-hidden',
1614
+ animation : false,
1615
+ duration : 200
1616
+ },
1617
+
1618
+ boot: function(){
1619
+
1620
+ // init code
1621
+ UI.ready(function(context) {
1622
+
1623
+ UI.$('[data-uk-toggle]', context).each(function() {
1624
+ var ele = UI.$(this);
1625
+
1626
+ if (!ele.data('toggle')) {
1627
+ var obj = UI.toggle(ele, UI.Utils.options(ele.attr('data-uk-toggle')));
1628
+ }
1629
+ });
1630
+
1631
+ setTimeout(function(){
1632
+
1633
+ toggles.forEach(function(toggle){
1634
+ toggle.getToggles();
1635
+ });
1636
+
1637
+ }, 0);
1638
+ });
1639
+ },
1640
+
1641
+ init: function() {
1642
+
1643
+ var $this = this;
1644
+
1645
+ this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
1646
+
1647
+ this.on('click', function(e) {
1648
+
1649
+ if ($this.element.is('a[href="#"]')) {
1650
+ e.preventDefault();
1651
+ }
1652
+
1653
+ $this.toggle();
1654
+ });
1655
+
1656
+ toggles.push(this);
1657
+ },
1658
+
1659
+ toggle: function() {
1660
+
1661
+ this.getToggles();
1662
+
1663
+ if(!this.totoggle.length) return;
1664
+
1665
+ if (this.options.animation && UI.support.animation) {
1666
+
1667
+ var $this = this, animations = this.options.animation.split(',');
1668
+
1669
+ if (animations.length == 1) {
1670
+ animations[1] = animations[0];
1671
+ }
1672
+
1673
+ animations[0] = animations[0].trim();
1674
+ animations[1] = animations[1].trim();
1675
+
1676
+ this.totoggle.css('animation-duration', this.options.duration+'ms');
1677
+
1678
+ this.totoggle.each(function(){
1679
+
1680
+ var ele = UI.$(this);
1681
+
1682
+ if (ele.hasClass($this.options.cls)) {
1683
+
1684
+ ele.toggleClass($this.options.cls);
1685
+
1686
+ UI.Utils.animate(ele, animations[0]).then(function(){
1687
+ ele.css('animation-duration', '');
1688
+ UI.Utils.checkDisplay(ele);
1689
+ });
1690
+
1691
+ } else {
1692
+
1693
+ UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
1694
+ ele.toggleClass($this.options.cls).css('animation-duration', '');
1695
+ UI.Utils.checkDisplay(ele);
1696
+ });
1697
+
1698
+ }
1699
+
1700
+ });
1701
+
1702
+ } else {
1703
+ this.totoggle.toggleClass(this.options.cls);
1704
+ UI.Utils.checkDisplay(this.totoggle);
1705
+ }
1706
+
1707
+ this.updateAria();
1708
+
1709
+ },
1710
+
1711
+ getToggles: function() {
1712
+ this.totoggle = this.options.target ? UI.$(this.options.target):[];
1713
+ this.updateAria();
1714
+ },
1715
+
1716
+ updateAria: function() {
1717
+ if (this.aria && this.totoggle.length) {
1718
+ this.totoggle.not('[aria-hidden]').each(function(){
1719
+ UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
1720
+ });
1721
+ }
1722
+ }
1723
+ });
1724
+
1725
+ })(UIkit);
1726
+
1727
+ (function(UI) {
1728
+
1729
+ "use strict";
1730
+
1731
+ UI.component('alert', {
1732
+
1733
+ defaults: {
1734
+ fade: true,
1735
+ duration: 200,
1736
+ trigger: '.uk-alert-close'
1737
+ },
1738
+
1739
+ boot: function() {
1740
+
1741
+ // init code
1742
+ UI.$html.on('click.alert.uikit', '[data-uk-alert]', function(e) {
1743
+
1744
+ var ele = UI.$(this);
1745
+
1746
+ if (!ele.data('alert')) {
1747
+
1748
+ var alert = UI.alert(ele, UI.Utils.options(ele.attr('data-uk-alert')));
1749
+
1750
+ if (UI.$(e.target).is(alert.options.trigger)) {
1751
+ e.preventDefault();
1752
+ alert.close();
1753
+ }
1754
+ }
1755
+ });
1756
+ },
1757
+
1758
+ init: function() {
1759
+
1760
+ var $this = this;
1761
+
1762
+ this.on('click', this.options.trigger, function(e) {
1763
+ e.preventDefault();
1764
+ $this.close();
1765
+ });
1766
+ },
1767
+
1768
+ close: function() {
1769
+
1770
+ var element = this.trigger('close.uk.alert'),
1771
+ removeElement = function () {
1772
+ this.trigger('closed.uk.alert').remove();
1773
+ }.bind(this);
1774
+
1775
+ if (this.options.fade) {
1776
+ element.css('overflow', 'hidden').css("max-height", element.height()).animate({
1777
+ height : 0,
1778
+ opacity : 0,
1779
+ paddingTop : 0,
1780
+ paddingBottom : 0,
1781
+ marginTop : 0,
1782
+ marginBottom : 0
1783
+ }, this.options.duration, removeElement);
1784
+ } else {
1785
+ removeElement();
1786
+ }
1787
+ }
1788
+
1789
+ });
1790
+
1791
+ })(UIkit);
1792
+
1793
+ (function(UI) {
1794
+
1795
+ "use strict";
1796
+
1797
+ UI.component('buttonRadio', {
1798
+
1799
+ defaults: {
1800
+ activeClass: 'uk-active',
1801
+ target: '.uk-button'
1802
+ },
1803
+
1804
+ boot: function() {
1805
+
1806
+ // init code
1807
+ UI.$html.on('click.buttonradio.uikit', '[data-uk-button-radio]', function(e) {
1808
+
1809
+ var ele = UI.$(this);
1810
+
1811
+ if (!ele.data('buttonRadio')) {
1812
+
1813
+ var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr('data-uk-button-radio'))),
1814
+ target = UI.$(e.target);
1815
+
1816
+ if (target.is(obj.options.target)) {
1817
+ target.trigger('click');
1818
+ }
1819
+ }
1820
+ });
1821
+ },
1822
+
1823
+ init: function() {
1824
+
1825
+ var $this = this;
1826
+
1827
+ // Init ARIA
1828
+ this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1829
+
1830
+ this.on('click', this.options.target, function(e) {
1831
+
1832
+ var ele = UI.$(this);
1833
+
1834
+ if (ele.is('a[href="#"]')) e.preventDefault();
1835
+
1836
+ $this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
1837
+ ele.addClass($this.options.activeClass);
1838
+
1839
+ // Update ARIA
1840
+ $this.find($this.options.target).not(ele).attr('aria-checked', 'false');
1841
+ ele.attr('aria-checked', 'true');
1842
+
1843
+ $this.trigger('change.uk.button', [ele]);
1844
+ });
1845
+
1846
+ },
1847
+
1848
+ getSelected: function() {
1849
+ return this.find('.' + this.options.activeClass);
1850
+ }
1851
+ });
1852
+
1853
+ UI.component('buttonCheckbox', {
1854
+
1855
+ defaults: {
1856
+ activeClass: 'uk-active',
1857
+ target: '.uk-button'
1858
+ },
1859
+
1860
+ boot: function() {
1861
+
1862
+ UI.$html.on('click.buttoncheckbox.uikit', '[data-uk-button-checkbox]', function(e) {
1863
+ var ele = UI.$(this);
1864
+
1865
+ if (!ele.data('buttonCheckbox')) {
1866
+
1867
+ var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr('data-uk-button-checkbox'))),
1868
+ target = UI.$(e.target);
1869
+
1870
+ if (target.is(obj.options.target)) {
1871
+ target.trigger('click');
1872
+ }
1873
+ }
1874
+ });
1875
+ },
1876
+
1877
+ init: function() {
1878
+
1879
+ var $this = this;
1880
+
1881
+ // Init ARIA
1882
+ this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1883
+
1884
+ this.on('click', this.options.target, function(e) {
1885
+ var ele = UI.$(this);
1886
+
1887
+ if (ele.is('a[href="#"]')) e.preventDefault();
1888
+
1889
+ ele.toggleClass($this.options.activeClass).blur();
1890
+
1891
+ // Update ARIA
1892
+ ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
1893
+
1894
+ $this.trigger('change.uk.button', [ele]);
1895
+ });
1896
+
1897
+ },
1898
+
1899
+ getSelected: function() {
1900
+ return this.find('.' + this.options.activeClass);
1901
+ }
1902
+ });
1903
+
1904
+
1905
+ UI.component('button', {
1906
+
1907
+ defaults: {},
1908
+
1909
+ boot: function() {
1910
+
1911
+ UI.$html.on('click.button.uikit', '[data-uk-button]', function(e) {
1912
+ var ele = UI.$(this);
1913
+
1914
+ if (!ele.data('button')) {
1915
+
1916
+ var obj = UI.button(ele, UI.Utils.options(ele.attr('data-uk-button')));
1917
+ ele.trigger('click');
1918
+ }
1919
+ });
1920
+ },
1921
+
1922
+ init: function() {
1923
+
1924
+ var $this = this;
1925
+
1926
+ // Init ARIA
1927
+ this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1928
+
1929
+ this.on('click', function(e) {
1930
+
1931
+ if ($this.element.is('a[href="#"]')) e.preventDefault();
1932
+
1933
+ $this.toggle();
1934
+ $this.trigger('change.uk.button', [$this.element.blur().hasClass('uk-active')]);
1935
+ });
1936
+
1937
+ },
1938
+
1939
+ toggle: function() {
1940
+ this.element.toggleClass('uk-active');
1941
+
1942
+ // Update ARIA
1943
+ this.element.attr('aria-pressed', this.element.hasClass('uk-active'));
1944
+ }
1945
+ });
1946
+
1947
+ })(UIkit);
1948
+
1949
+ (function(UI) {
1950
+
1951
+ "use strict";
1952
+
1953
+ var active = false, hoverIdle, flips = {
1954
+ x: {
1955
+ 'bottom-left' : 'bottom-right',
1956
+ 'bottom-right' : 'bottom-left',
1957
+ 'bottom-center' : 'bottom-center',
1958
+ 'top-left' : 'top-right',
1959
+ 'top-right' : 'top-left',
1960
+ 'top-center' : 'top-center',
1961
+ 'left-top' : 'right-top',
1962
+ 'left-bottom' : 'right-bottom',
1963
+ 'left-center' : 'right-center',
1964
+ 'right-top' : 'left-top',
1965
+ 'right-bottom' : 'left-bottom',
1966
+ 'right-center' : 'left-center'
1967
+ },
1968
+ y: {
1969
+ 'bottom-left' : 'top-left',
1970
+ 'bottom-right' : 'top-right',
1971
+ 'bottom-center' : 'top-center',
1972
+ 'top-left' : 'bottom-left',
1973
+ 'top-right' : 'bottom-right',
1974
+ 'top-center' : 'bottom-center',
1975
+ 'left-top' : 'left-bottom',
1976
+ 'left-bottom' : 'left-top',
1977
+ 'left-center' : 'left-center',
1978
+ 'right-top' : 'right-bottom',
1979
+ 'right-bottom' : 'right-top',
1980
+ 'right-center' : 'right-center'
1981
+ },
1982
+ xy: {
1983
+ 'bottom-left' : 'top-right',
1984
+ 'bottom-right' : 'top-left',
1985
+ 'bottom-center' : 'top-center',
1986
+ 'top-left' : 'bottom-right',
1987
+ 'top-right' : 'bottom-left',
1988
+ 'top-center' : 'bottom-center',
1989
+ 'left-top' : 'right-bottom',
1990
+ 'left-bottom' : 'right-top',
1991
+ 'left-center' : 'right-center',
1992
+ 'right-top' : 'left-bottom',
1993
+ 'right-bottom' : 'left-top',
1994
+ 'right-center' : 'left-center'
1995
+ }
1996
+ };
1997
+
1998
+ UI.component('dropdown', {
1999
+
2000
+ defaults: {
2001
+ mode : 'hover',
2002
+ pos : 'bottom-left',
2003
+ offset : 0,
2004
+ remaintime : 800,
2005
+ justify : false,
2006
+ boundary : UI.$win,
2007
+ delay : 0,
2008
+ dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
2009
+ hoverDelayIdle : 250,
2010
+ preventflip : false
2011
+ },
2012
+
2013
+ remainIdle: false,
2014
+
2015
+ boot: function() {
2016
+
2017
+ var triggerevent = UI.support.touch ? 'click' : 'mouseenter';
2018
+
2019
+ // init code
2020
+ UI.$html.on(triggerevent+'.dropdown.uikit focus pointerdown', '[data-uk-dropdown]', function(e) {
2021
+
2022
+ var ele = UI.$(this);
2023
+
2024
+ if (!ele.data('dropdown')) {
2025
+
2026
+ var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr('data-uk-dropdown')));
2027
+
2028
+ if (e.type=='click' || (e.type=='mouseenter' && dropdown.options.mode=='hover')) {
2029
+ dropdown.element.trigger(triggerevent);
2030
+ }
2031
+
2032
+ if (dropdown.dropdown.length) {
2033
+ e.preventDefault();
2034
+ }
2035
+ }
2036
+ });
2037
+ },
2038
+
2039
+ init: function() {
2040
+
2041
+ var $this = this;
2042
+
2043
+ this.dropdown = this.find(this.options.dropdownSelector);
2044
+ this.offsetParent = this.dropdown.parents().filter(function() {
2045
+ return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
2046
+ }).slice(0,1);
2047
+
2048
+ if (!this.offsetParent.length) {
2049
+ this.offsetParent = this.element;
2050
+ }
2051
+
2052
+ this.centered = this.dropdown.hasClass('uk-dropdown-center');
2053
+ this.justified = this.options.justify ? UI.$(this.options.justify) : false;
2054
+
2055
+ this.boundary = UI.$(this.options.boundary);
2056
+
2057
+ if (!this.boundary.length) {
2058
+ this.boundary = UI.$win;
2059
+ }
2060
+
2061
+ // legacy DEPRECATED!
2062
+ if (this.dropdown.hasClass('uk-dropdown-up')) {
2063
+ this.options.pos = 'top-left';
2064
+ }
2065
+ if (this.dropdown.hasClass('uk-dropdown-flip')) {
2066
+ this.options.pos = this.options.pos.replace('left','right');
2067
+ }
2068
+ if (this.dropdown.hasClass('uk-dropdown-center')) {
2069
+ this.options.pos = this.options.pos.replace(/(left|right)/,'center');
2070
+ }
2071
+ //-- end legacy
2072
+
2073
+ // Init ARIA
2074
+ this.element.attr('aria-haspopup', 'true');
2075
+ this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
2076
+ this.dropdown.attr('aria-hidden', 'true');
2077
+
2078
+ if (this.options.mode == 'click' || UI.support.touch) {
2079
+
2080
+ this.on('click.uk.dropdown', function(e) {
2081
+
2082
+ var $target = UI.$(e.target);
2083
+
2084
+ if (!$target.parents($this.options.dropdownSelector).length) {
2085
+
2086
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(':visible')) ){
2087
+ e.preventDefault();
2088
+ }
2089
+
2090
+ $target.blur();
2091
+ }
2092
+
2093
+ if (!$this.element.hasClass('uk-open')) {
2094
+
2095
+ $this.show();
2096
+
2097
+ } else {
2098
+
2099
+ if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
2100
+ $this.hide();
2101
+ }
2102
+ }
2103
+ });
2104
+
2105
+ } else {
2106
+
2107
+ this.on('mouseenter', function(e) {
2108
+
2109
+ $this.trigger('pointerenter.uk.dropdown', [$this]);
2110
+
2111
+ if ($this.remainIdle) {
2112
+ clearTimeout($this.remainIdle);
2113
+ }
2114
+
2115
+ if (hoverIdle) {
2116
+ clearTimeout(hoverIdle);
2117
+ }
2118
+
2119
+ if (active && active == $this) {
2120
+ return;
2121
+ }
2122
+
2123
+ // pseudo manuAim
2124
+ if (active && active != $this) {
2125
+
2126
+ hoverIdle = setTimeout(function() {
2127
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2128
+ }, $this.options.hoverDelayIdle);
2129
+
2130
+ } else {
2131
+
2132
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2133
+ }
2134
+
2135
+ }).on('mouseleave', function() {
2136
+
2137
+ if (hoverIdle) {
2138
+ clearTimeout(hoverIdle);
2139
+ }
2140
+
2141
+ $this.remainIdle = setTimeout(function() {
2142
+ if (active && active == $this) $this.hide();
2143
+ }, $this.options.remaintime);
2144
+
2145
+ $this.trigger('pointerleave.uk.dropdown', [$this]);
2146
+
2147
+ }).on('click', function(e){
2148
+
2149
+ var $target = UI.$(e.target);
2150
+
2151
+ if ($this.remainIdle) {
2152
+ clearTimeout($this.remainIdle);
2153
+ }
2154
+
2155
+ if (active && active == $this) {
2156
+ if (!$this.dropdown.find(e.target).length || $target.is('.uk-dropdown-close') || $target.parents('.uk-dropdown-close').length) {
2157
+ $this.hide();
2158
+ }
2159
+ return;
2160
+ }
2161
+
2162
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
2163
+ e.preventDefault();
2164
+ }
2165
+
2166
+ $this.show();
2167
+ });
2168
+ }
2169
+ },
2170
+
2171
+ show: function(){
2172
+
2173
+ UI.$html.off('click.outer.dropdown');
2174
+
2175
+ if (active && active != this) {
2176
+ active.hide(true);
2177
+ }
2178
+
2179
+ if (hoverIdle) {
2180
+ clearTimeout(hoverIdle);
2181
+ }
2182
+
2183
+ this.trigger('beforeshow.uk.dropdown', [this]);
2184
+
2185
+ this.checkDimensions();
2186
+ this.element.addClass('uk-open');
2187
+
2188
+ // Update ARIA
2189
+ this.element.attr('aria-expanded', 'true');
2190
+ this.dropdown.attr('aria-hidden', 'false');
2191
+
2192
+ this.trigger('show.uk.dropdown', [this]);
2193
+
2194
+ UI.Utils.checkDisplay(this.dropdown, true);
2195
+ UI.Utils.focus(this.dropdown);
2196
+ active = this;
2197
+
2198
+ this.registerOuterClick();
2199
+ },
2200
+
2201
+ hide: function(force) {
2202
+
2203
+ this.trigger('beforehide.uk.dropdown', [this, force]);
2204
+
2205
+ this.element.removeClass('uk-open');
2206
+
2207
+ if (this.remainIdle) {
2208
+ clearTimeout(this.remainIdle);
2209
+ }
2210
+
2211
+ this.remainIdle = false;
2212
+
2213
+ // Update ARIA
2214
+ this.element.attr('aria-expanded', 'false');
2215
+ this.dropdown.attr('aria-hidden', 'true');
2216
+
2217
+ this.trigger('hide.uk.dropdown', [this, force]);
2218
+
2219
+ if (active == this) active = false;
2220
+ },
2221
+
2222
+ registerOuterClick: function(){
2223
+
2224
+ var $this = this;
2225
+
2226
+ UI.$html.off('click.outer.dropdown');
2227
+
2228
+ setTimeout(function() {
2229
+
2230
+ UI.$html.on('click.outer.dropdown', function(e) {
2231
+
2232
+ if (hoverIdle) {
2233
+ clearTimeout(hoverIdle);
2234
+ }
2235
+
2236
+ var $target = UI.$(e.target);
2237
+
2238
+ if (active == $this && !$this.element.find(e.target).length) {
2239
+ $this.hide(true);
2240
+ UI.$html.off('click.outer.dropdown');
2241
+ }
2242
+ });
2243
+ }, 10);
2244
+ },
2245
+
2246
+ checkDimensions: function() {
2247
+
2248
+ if (!this.dropdown.length) return;
2249
+
2250
+ // reset
2251
+ this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack uk-dropdown-autoflip').css({
2252
+ topLeft :'',
2253
+ left :'',
2254
+ marginLeft :'',
2255
+ marginRight :''
2256
+ });
2257
+
2258
+ if (this.justified && this.justified.length) {
2259
+ this.dropdown.css('min-width', '');
2260
+ }
2261
+
2262
+ var $this = this,
2263
+ pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
2264
+ posoffset = this.options.offset,
2265
+ dropdown = this.dropdown,
2266
+ offset = dropdown.show().offset() || {left: 0, top: 0},
2267
+ width = dropdown.outerWidth(),
2268
+ height = dropdown.outerHeight(),
2269
+ boundarywidth = this.boundary.width(),
2270
+ boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
2271
+ dpos = this.options.pos;
2272
+
2273
+ var variants = {
2274
+ 'bottom-left' : {top: 0 + pos.height + posoffset, left: 0},
2275
+ 'bottom-right' : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
2276
+ 'bottom-center' : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
2277
+ 'top-left' : {top: 0 - height - posoffset, left: 0},
2278
+ 'top-right' : {top: 0 - height - posoffset, left: 0 + pos.width - width},
2279
+ 'top-center' : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
2280
+ 'left-top' : {top: 0, left: 0 - width - posoffset},
2281
+ 'left-bottom' : {top: 0 + pos.height - height, left: 0 - width - posoffset},
2282
+ 'left-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
2283
+ 'right-top' : {top: 0, left: 0 + pos.width + posoffset},
2284
+ 'right-bottom' : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
2285
+ 'right-center' : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
2286
+ },
2287
+ css = {},
2288
+ pp;
2289
+
2290
+ pp = dpos.split('-');
2291
+ css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2292
+
2293
+ // justify dropdown
2294
+ if (this.justified && this.justified.length) {
2295
+ justify(dropdown.css({left:0}), this.justified, boundarywidth);
2296
+ } else {
2297
+
2298
+ if (this.options.preventflip !== true) {
2299
+
2300
+ var fdpos;
2301
+
2302
+ switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2303
+ case "x":
2304
+ if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
2305
+ break;
2306
+ case "y":
2307
+ if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
2308
+ break;
2309
+ case "xy":
2310
+ if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
2311
+ break;
2312
+ }
2313
+
2314
+ if (fdpos) {
2315
+
2316
+ pp = fdpos.split('-');
2317
+ css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
2318
+ dropdown.addClass('uk-dropdown-autoflip');
2319
+
2320
+ // check flipped
2321
+ if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2322
+ pp = dpos.split('-');
2323
+ css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2324
+ }
2325
+ }
2326
+ }
2327
+ }
2328
+
2329
+ if (width > boundarywidth) {
2330
+ dropdown.addClass('uk-dropdown-stack');
2331
+ this.trigger('stack.uk.dropdown', [this]);
2332
+ }
2333
+
2334
+ dropdown.css(css).css('display', '').addClass('uk-dropdown-'+pp[0]);
2335
+ },
2336
+
2337
+ checkBoundary: function(left, top, width, height, boundarywidth) {
2338
+
2339
+ var axis = "";
2340
+
2341
+ if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
2342
+ axis += "x";
2343
+ }
2344
+
2345
+ if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
2346
+ axis += "y";
2347
+ }
2348
+
2349
+ return axis;
2350
+ }
2351
+ });
2352
+
2353
+
2354
+ UI.component('dropdownOverlay', {
2355
+
2356
+ defaults: {
2357
+ justify : false,
2358
+ cls : '',
2359
+ duration: 200
2360
+ },
2361
+
2362
+ boot: function() {
2363
+
2364
+ // init code
2365
+ UI.ready(function(context) {
2366
+
2367
+ UI.$('[data-uk-dropdown-overlay]', context).each(function() {
2368
+ var ele = UI.$(this);
2369
+
2370
+ if (!ele.data('dropdownOverlay')) {
2371
+ UI.dropdownOverlay(ele, UI.Utils.options(ele.attr('data-uk-dropdown-overlay')));
2372
+ }
2373
+ });
2374
+ });
2375
+ },
2376
+
2377
+ init: function() {
2378
+
2379
+ var $this = this;
2380
+
2381
+ this.justified = this.options.justify ? UI.$(this.options.justify) : false;
2382
+ this.overlay = this.element.find('uk-dropdown-overlay');
2383
+
2384
+ if (!this.overlay.length) {
2385
+ this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
2386
+ }
2387
+
2388
+ this.overlay.addClass(this.options.cls);
2389
+
2390
+ this.on({
2391
+
2392
+ 'beforeshow.uk.dropdown': function(e, dropdown) {
2393
+ $this.dropdown = dropdown;
2394
+
2395
+ if ($this.justified && $this.justified.length) {
2396
+ justify($this.overlay.css({display:'block', marginLeft:'', marginRight:''}), $this.justified, $this.justified.outerWidth());
2397
+ }
2398
+ },
2399
+
2400
+ 'show.uk.dropdown': function(e, dropdown) {
2401
+
2402
+ var h = $this.dropdown.dropdown.outerHeight(true);
2403
+
2404
+ $this.dropdown.element.removeClass('uk-open');
2405
+
2406
+ $this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
2407
+
2408
+ $this.dropdown.dropdown.css('visibility', '');
2409
+ $this.dropdown.element.addClass('uk-open');
2410
+
2411
+ UI.Utils.checkDisplay($this.dropdown.dropdown, true);
2412
+ });
2413
+
2414
+ $this.pointerleave = false;
2415
+ },
2416
+
2417
+ 'hide.uk.dropdown': function() {
2418
+ $this.overlay.stop().animate({height: 0}, $this.options.duration);
2419
+ },
2420
+
2421
+ 'pointerenter.uk.dropdown': function(e, dropdown) {
2422
+ clearTimeout($this.remainIdle);
2423
+ },
2424
+
2425
+ 'pointerleave.uk.dropdown': function(e, dropdown) {
2426
+ $this.pointerleave = true;
2427
+ }
2428
+ });
2429
+
2430
+
2431
+ this.overlay.on({
2432
+
2433
+ 'mouseenter': function() {
2434
+ if ($this.remainIdle) {
2435
+ clearTimeout($this.dropdown.remainIdle);
2436
+ clearTimeout($this.remainIdle);
2437
+ }
2438
+ },
2439
+
2440
+ 'mouseleave': function(){
2441
+
2442
+ if ($this.pointerleave && active) {
2443
+
2444
+ $this.remainIdle = setTimeout(function() {
2445
+ if(active) active.hide();
2446
+ }, active.options.remaintime);
2447
+ }
2448
+ }
2449
+ })
2450
+ }
2451
+
2452
+ });
2453
+
2454
+
2455
+ function justify(ele, justifyTo, boundarywidth, offset) {
2456
+
2457
+ ele = UI.$(ele);
2458
+ justifyTo = UI.$(justifyTo);
2459
+ boundarywidth = boundarywidth || window.innerWidth;
2460
+ offset = offset || ele.offset();
2461
+
2462
+ if (justifyTo.length) {
2463
+
2464
+ var jwidth = justifyTo.outerWidth();
2465
+
2466
+ ele.css('min-width', jwidth);
2467
+
2468
+ if (UI.langdirection == 'right') {
2469
+
2470
+ var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
2471
+ right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
2472
+
2473
+ ele.css('margin-right', right1 - right2);
2474
+
2475
+ } else {
2476
+ ele.css('margin-left', justifyTo.offset().left - offset.left);
2477
+ }
2478
+ }
2479
+ }
2480
+
2481
+ })(UIkit);
2482
+
2483
+ (function(UI) {
2484
+
2485
+ "use strict";
2486
+
2487
+ var grids = [];
2488
+
2489
+ UI.component('gridMatchHeight', {
2490
+
2491
+ defaults: {
2492
+ target : false,
2493
+ row : true,
2494
+ ignorestacked : false,
2495
+ observe : false
2496
+ },
2497
+
2498
+ boot: function() {
2499
+
2500
+ // init code
2501
+ UI.ready(function(context) {
2502
+
2503
+ UI.$('[data-uk-grid-match]', context).each(function() {
2504
+ var grid = UI.$(this), obj;
2505
+
2506
+ if (!grid.data('gridMatchHeight')) {
2507
+ obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr('data-uk-grid-match')));
2508
+ }
2509
+ });
2510
+ });
2511
+ },
2512
+
2513
+ init: function() {
2514
+
2515
+ var $this = this;
2516
+
2517
+ this.columns = this.element.children();
2518
+ this.elements = this.options.target ? this.find(this.options.target) : this.columns;
2519
+
2520
+ if (!this.columns.length) return;
2521
+
2522
+ UI.$win.on('load resize orientationchange', (function() {
2523
+
2524
+ var fn = function() {
2525
+ if ($this.element.is(':visible')) $this.match();
2526
+ };
2527
+
2528
+ UI.$(function() { fn(); });
2529
+
2530
+ return UI.Utils.debounce(fn, 50);
2531
+ })());
2532
+
2533
+ if (this.options.observe) {
2534
+
2535
+ UI.domObserve(this.element, function(e) {
2536
+ if ($this.element.is(':visible')) $this.match();
2537
+ });
2538
+ }
2539
+
2540
+ this.on('display.uk.check', function(e) {
2541
+ if(this.element.is(':visible')) this.match();
2542
+ }.bind(this));
2543
+
2544
+ grids.push(this);
2545
+ },
2546
+
2547
+ match: function() {
2548
+
2549
+ var firstvisible = this.columns.filter(':visible:first');
2550
+
2551
+ if (!firstvisible.length) return;
2552
+
2553
+ var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
2554
+
2555
+ if (stacked && !this.options.ignorestacked) {
2556
+ this.revert();
2557
+ } else {
2558
+ UI.Utils.matchHeights(this.elements, this.options);
2559
+ }
2560
+
2561
+ return this;
2562
+ },
2563
+
2564
+ revert: function() {
2565
+ this.elements.css('min-height', '');
2566
+ return this;
2567
+ }
2568
+ });
2569
+
2570
+ UI.component('gridMargin', {
2571
+
2572
+ defaults: {
2573
+ cls : 'uk-grid-margin',
2574
+ rowfirst : 'uk-row-first'
2575
+ },
2576
+
2577
+ boot: function() {
2578
+
2579
+ // init code
2580
+ UI.ready(function(context) {
2581
+
2582
+ UI.$('[data-uk-grid-margin]', context).each(function() {
2583
+ var grid = UI.$(this), obj;
2584
+
2585
+ if (!grid.data('gridMargin')) {
2586
+ obj = UI.gridMargin(grid, UI.Utils.options(grid.attr('data-uk-grid-margin')));
2587
+ }
2588
+ });
2589
+ });
2590
+ },
2591
+
2592
+ init: function() {
2593
+
2594
+ var stackMargin = UI.stackMargin(this.element, this.options);
2595
+ }
2596
+ });
2597
+
2598
+ })(UIkit);
2599
+
2600
+ (function(UI) {
2601
+
2602
+ "use strict";
2603
+
2604
+ var active = false, activeCount = 0, $html = UI.$html, body;
2605
+
2606
+ UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
2607
+ UI.$('.uk-modal.uk-open').each(function(){
2608
+ return UI.$(this).data('modal') && UI.$(this).data('modal').resize();
2609
+ });
2610
+ }, 150));
2611
+
2612
+ UI.component('modal', {
2613
+
2614
+ defaults: {
2615
+ keyboard: true,
2616
+ bgclose: true,
2617
+ minScrollHeight: 150,
2618
+ center: false,
2619
+ modal: true
2620
+ },
2621
+
2622
+ scrollable: false,
2623
+ transition: false,
2624
+ hasTransitioned: true,
2625
+
2626
+ init: function() {
2627
+
2628
+ if (!body) body = UI.$('body');
2629
+
2630
+ if (!this.element.length) return;
2631
+
2632
+ var $this = this;
2633
+
2634
+ this.paddingdir = 'padding-' + (UI.langdirection == 'left' ? 'right':'left');
2635
+ this.dialog = this.find('.uk-modal-dialog');
2636
+
2637
+ this.active = false;
2638
+
2639
+ // Update ARIA
2640
+ this.element.attr('aria-hidden', this.element.hasClass('uk-open'));
2641
+
2642
+ this.on('click', '.uk-modal-close', function(e) {
2643
+ e.preventDefault();
2644
+ $this.hide();
2645
+ }).on('click', function(e) {
2646
+
2647
+ var target = UI.$(e.target);
2648
+
2649
+ if (target[0] == $this.element[0] && $this.options.bgclose) {
2650
+ $this.hide();
2651
+ }
2652
+ });
2653
+
2654
+ UI.domObserve(this.element, function(e) { $this.resize(); });
2655
+ },
2656
+
2657
+ toggle: function() {
2658
+ return this[this.isActive() ? 'hide' : 'show']();
2659
+ },
2660
+
2661
+ show: function() {
2662
+
2663
+ if (!this.element.length) return;
2664
+
2665
+ var $this = this;
2666
+
2667
+ if (this.isActive()) return;
2668
+
2669
+ if (this.options.modal && active) {
2670
+ active.hide(true);
2671
+ }
2672
+
2673
+ this.element.removeClass('uk-open').show();
2674
+ this.resize(true);
2675
+
2676
+ if (this.options.modal) {
2677
+ active = this;
2678
+ }
2679
+
2680
+ this.active = true;
2681
+
2682
+ activeCount++;
2683
+
2684
+ if (UI.support.transition) {
2685
+ this.hasTransitioned = false;
2686
+ this.element.one(UI.support.transition.end, function(){
2687
+ $this.hasTransitioned = true;
2688
+ UI.Utils.focus($this.dialog, 'a[href]');
2689
+ }).addClass('uk-open');
2690
+ } else {
2691
+ this.element.addClass('uk-open');
2692
+ UI.Utils.focus(this.dialog, 'a[href]');
2693
+ }
2694
+
2695
+ $html.addClass('uk-modal-page').height(); // force browser engine redraw
2696
+
2697
+ // Update ARIA
2698
+ this.element.attr('aria-hidden', 'false');
2699
+
2700
+ this.element.trigger('show.uk.modal');
2701
+
2702
+ UI.Utils.checkDisplay(this.dialog, true);
2703
+
2704
+ return this;
2705
+ },
2706
+
2707
+ hide: function(force) {
2708
+
2709
+ if (!force && UI.support.transition && this.hasTransitioned) {
2710
+
2711
+ var $this = this;
2712
+
2713
+ this.one(UI.support.transition.end, function() {
2714
+ $this._hide();
2715
+ }).removeClass('uk-open');
2716
+
2717
+ } else {
2718
+
2719
+ this._hide();
2720
+ }
2721
+
2722
+ return this;
2723
+ },
2724
+
2725
+ resize: function(force) {
2726
+
2727
+ if (!this.isActive() && !force) return;
2728
+
2729
+ var bodywidth = body.width();
2730
+
2731
+ this.scrollbarwidth = window.innerWidth - bodywidth;
2732
+
2733
+ body.css(this.paddingdir, this.scrollbarwidth);
2734
+
2735
+ this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
2736
+
2737
+ if (!this.updateScrollable() && this.options.center) {
2738
+
2739
+ var dh = this.dialog.outerHeight(),
2740
+ pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
2741
+
2742
+ if ((dh + pad) < window.innerHeight) {
2743
+ this.dialog.css({top: (window.innerHeight/2 - dh/2) - pad });
2744
+ } else {
2745
+ this.dialog.css({top: ''});
2746
+ }
2747
+ }
2748
+ },
2749
+
2750
+ updateScrollable: function() {
2751
+
2752
+ // has scrollable?
2753
+ var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
2754
+
2755
+ if (scrollable.length) {
2756
+
2757
+ scrollable.css('height', 0);
2758
+
2759
+ var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)),
2760
+ dh = this.dialog.outerHeight(),
2761
+ wh = window.innerHeight,
2762
+ h = wh - 2*(offset < 20 ? 20:offset) - dh;
2763
+
2764
+ scrollable.css({
2765
+ maxHeight: (h < this.options.minScrollHeight ? '':h),
2766
+ height:''
2767
+ });
2768
+
2769
+ return true;
2770
+ }
2771
+
2772
+ return false;
2773
+ },
2774
+
2775
+ _hide: function() {
2776
+
2777
+ this.active = false;
2778
+ if (activeCount > 0) activeCount--;
2779
+ else activeCount = 0;
2780
+
2781
+ this.element.hide().removeClass('uk-open');
2782
+
2783
+ // Update ARIA
2784
+ this.element.attr('aria-hidden', 'true');
2785
+
2786
+ if (!activeCount) {
2787
+ $html.removeClass('uk-modal-page');
2788
+ body.css(this.paddingdir, "");
2789
+ }
2790
+
2791
+ if (active===this) active = false;
2792
+
2793
+ this.trigger('hide.uk.modal');
2794
+ },
2795
+
2796
+ isActive: function() {
2797
+ return this.element.hasClass('uk-open');
2798
+ }
2799
+
2800
+ });
2801
+
2802
+ UI.component('modalTrigger', {
2803
+
2804
+ boot: function() {
2805
+
2806
+ // init code
2807
+ UI.$html.on('click.modal.uikit', '[data-uk-modal]', function(e) {
2808
+
2809
+ var ele = UI.$(this);
2810
+
2811
+ if (ele.is('a')) {
2812
+ e.preventDefault();
2813
+ }
2814
+
2815
+ if (!ele.data('modalTrigger')) {
2816
+ var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr('data-uk-modal')));
2817
+ modal.show();
2818
+ }
2819
+
2820
+ });
2821
+
2822
+ // close modal on esc button
2823
+ UI.$html.on('keydown.modal.uikit', function (e) {
2824
+
2825
+ if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
2826
+ e.preventDefault();
2827
+ active.hide();
2828
+ }
2829
+ });
2830
+ },
2831
+
2832
+ init: function() {
2833
+
2834
+ var $this = this;
2835
+
2836
+ this.options = UI.$.extend({
2837
+ target: $this.element.is('a') ? $this.element.attr('href') : false
2838
+ }, this.options);
2839
+
2840
+ this.modal = UI.modal(this.options.target, this.options);
2841
+
2842
+ this.on("click", function(e) {
2843
+ e.preventDefault();
2844
+ $this.show();
2845
+ });
2846
+
2847
+ //methods
2848
+ this.proxy(this.modal, 'show hide isActive');
2849
+ }
2850
+ });
2851
+
2852
+ UI.modal.dialog = function(content, options) {
2853
+
2854
+ var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo('body'), options);
2855
+
2856
+ modal.on('hide.uk.modal', function(){
2857
+ if (modal.persist) {
2858
+ modal.persist.appendTo(modal.persist.data('modalPersistParent'));
2859
+ modal.persist = false;
2860
+ }
2861
+ modal.element.remove();
2862
+ });
2863
+
2864
+ setContent(content, modal);
2865
+
2866
+ return modal;
2867
+ };
2868
+
2869
+ UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
2870
+
2871
+ UI.modal.alert = function(content, options) {
2872
+
2873
+ options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2874
+
2875
+ var modal = UI.modal.dialog(([
2876
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2877
+ '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
2878
+ ]).join(""), options);
2879
+
2880
+ modal.on('show.uk.modal', function(){
2881
+ setTimeout(function(){
2882
+ modal.element.find('button:first').focus();
2883
+ }, 50);
2884
+ });
2885
+
2886
+ return modal.show();
2887
+ };
2888
+
2889
+ UI.modal.confirm = function(content, onconfirm, oncancel) {
2890
+
2891
+ var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {};
2892
+
2893
+ onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
2894
+ oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){};
2895
+ options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options);
2896
+
2897
+ var modal = UI.modal.dialog(([
2898
+ '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2899
+ '<div class="uk-modal-footer uk-text-right"><button class="uk-button js-modal-confirm-cancel">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+options.labels.Ok+'</button></div>'
2900
+ ]).join(""), options);
2901
+
2902
+ modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){
2903
+ UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel();
2904
+ modal.hide();
2905
+ });
2906
+
2907
+ modal.on('show.uk.modal', function(){
2908
+ setTimeout(function(){
2909
+ modal.element.find('.js-modal-confirm').focus();
2910
+ }, 50);
2911
+ });
2912
+
2913
+ return modal.show();
2914
+ };
2915
+
2916
+ UI.modal.prompt = function(text, value, onsubmit, options) {
2917
+
2918
+ onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
2919
+ options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2920
+
2921
+ var modal = UI.modal.dialog(([
2922
+ text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
2923
+ '<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
2924
+ '<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>'
2925
+ ]).join(""), options),
2926
+
2927
+ input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
2928
+ if (e.keyCode == 13) {
2929
+ modal.element.find('.js-modal-ok').trigger('click');
2930
+ }
2931
+ });
2932
+
2933
+ modal.element.find('.js-modal-ok').on('click', function(){
2934
+ if (onsubmit(input.val())!==false){
2935
+ modal.hide();
2936
+ }
2937
+ });
2938
+
2939
+ return modal.show();
2940
+ };
2941
+
2942
+ UI.modal.blockUI = function(content, options) {
2943
+
2944
+ var modal = UI.modal.dialog(([
2945
+ '<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
2946
+ ]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
2947
+
2948
+ modal.content = modal.element.find('.uk-modal-content:first');
2949
+
2950
+ return modal.show();
2951
+ };
2952
+
2953
+ UI.modal.labels = {
2954
+ Ok: 'Ok',
2955
+ Cancel: 'Cancel'
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
+
3124
+ var tmp = {
3125
+ position: $ele.css('position'),
3126
+ visibility: $ele.css('visibility'),
3127
+ display: $ele.css('display')
3128
+ };
3129
+
3130
+ height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
3131
+
3132
+ $ele.css(tmp); // reset element
3133
+ }
3134
+
3135
+ return height;
3136
+ }
3137
+
3138
+ })(UIkit);
3139
+
3140
+ (function(UI) {
3141
+
3142
+ "use strict";
3143
+
3144
+ var scrollpos = {x: window.scrollX, y: window.scrollY},
3145
+ $win = UI.$win,
3146
+ $doc = UI.$doc,
3147
+ $html = UI.$html,
3148
+ Offcanvas = {
3149
+
3150
+ show: function(element, options) {
3151
+
3152
+ element = UI.$(element);
3153
+
3154
+ if (!element.length) return;
3155
+
3156
+ options = UI.$.extend({mode: 'push'}, options);
3157
+
3158
+ var $body = UI.$('body'),
3159
+ bar = element.find('.uk-offcanvas-bar:first'),
3160
+ rtl = (UI.langdirection == 'right'),
3161
+ flip = bar.hasClass('uk-offcanvas-bar-flip') ? -1:1,
3162
+ dir = flip * (rtl ? -1 : 1),
3163
+
3164
+ scrollbarwidth = window.innerWidth - $body.width();
3165
+
3166
+ scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
3167
+
3168
+ bar.attr('mode', options.mode);
3169
+ element.addClass('uk-active');
3170
+
3171
+ $body.css({width: window.innerWidth - scrollbarwidth, height: window.innerHeight}).addClass('uk-offcanvas-page');
3172
+
3173
+ if (options.mode == 'push' || options.mode == 'reveal') {
3174
+ $body.css((rtl ? 'margin-right' : 'margin-left'), (rtl ? -1 : 1) * (bar.outerWidth() * dir));
3175
+ }
3176
+
3177
+ if (options.mode == 'reveal') {
3178
+ bar.css('clip', 'rect(0, '+bar.outerWidth()+'px, 100vh, 0)');
3179
+ }
3180
+
3181
+ $html.css('margin-top', scrollpos.y * -1).width(); // .width() - force redraw
3182
+
3183
+
3184
+ bar.addClass('uk-offcanvas-bar-show');
3185
+
3186
+ this._initElement(element);
3187
+
3188
+ bar.trigger('show.uk.offcanvas', [element, bar]);
3189
+
3190
+ // Update ARIA
3191
+ element.attr('aria-hidden', 'false');
3192
+ },
3193
+
3194
+ hide: function(force) {
3195
+
3196
+ var $body = UI.$('body'),
3197
+ panel = UI.$('.uk-offcanvas.uk-active'),
3198
+ rtl = (UI.langdirection == 'right'),
3199
+ bar = panel.find('.uk-offcanvas-bar:first'),
3200
+ finalize = function() {
3201
+ $body.removeClass('uk-offcanvas-page').css({width: '', height: '', marginLeft: '', marginRight: ''});
3202
+ panel.removeClass('uk-active');
3203
+
3204
+ bar.removeClass('uk-offcanvas-bar-show');
3205
+ $html.css('margin-top', '');
3206
+ window.scrollTo(scrollpos.x, scrollpos.y);
3207
+ bar.trigger('hide.uk.offcanvas', [panel, bar]);
3208
+
3209
+ // Update ARIA
3210
+ panel.attr('aria-hidden', 'true');
3211
+ };
3212
+
3213
+ if (!panel.length) return;
3214
+ if (bar.attr('mode') == 'none') force = true;
3215
+
3216
+ if (UI.support.transition && !force) {
3217
+
3218
+ $body.one(UI.support.transition.end, function() {
3219
+ finalize();
3220
+ }).css((rtl ? 'margin-right' : 'margin-left'), '');
3221
+
3222
+ if (bar.attr('mode') == 'reveal') {
3223
+ bar.css('clip', '');
3224
+ }
3225
+
3226
+ setTimeout(function(){
3227
+ bar.removeClass('uk-offcanvas-bar-show');
3228
+ }, 0);
3229
+
3230
+ } else {
3231
+ finalize();
3232
+ }
3233
+ },
3234
+
3235
+ _initElement: function(element) {
3236
+
3237
+ if (element.data('OffcanvasInit')) return;
3238
+
3239
+ element.on('click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas', function(e) {
3240
+
3241
+ var target = UI.$(e.target);
3242
+
3243
+ if (!e.type.match(/swipe/)) {
3244
+
3245
+ if (!target.hasClass('uk-offcanvas-close')) {
3246
+ if (target.hasClass('uk-offcanvas-bar')) return;
3247
+ if (target.parents('.uk-offcanvas-bar:first').length) return;
3248
+ }
3249
+ }
3250
+
3251
+ e.stopImmediatePropagation();
3252
+ Offcanvas.hide();
3253
+ });
3254
+
3255
+ element.on('click', 'a[href*="#"]', function(e){
3256
+
3257
+ var link = UI.$(this),
3258
+ href = link.attr('href');
3259
+
3260
+ if (href == '#') {
3261
+ return;
3262
+ }
3263
+
3264
+ UI.$doc.one('hide.uk.offcanvas', function() {
3265
+
3266
+ var target;
3267
+
3268
+ try {
3269
+ target = UI.$(link[0].hash);
3270
+ } catch (e){
3271
+ target = '';
3272
+ }
3273
+
3274
+ if (!target.length) {
3275
+ target = UI.$('[name="'+link[0].hash.replace('#','')+'"]');
3276
+ }
3277
+
3278
+ if (target.length && UI.Utils.scrollToElement) {
3279
+ UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
3280
+ } else {
3281
+ window.location.href = href;
3282
+ }
3283
+ });
3284
+
3285
+ Offcanvas.hide();
3286
+ });
3287
+
3288
+ element.data('OffcanvasInit', true);
3289
+ }
3290
+ };
3291
+
3292
+ UI.component('offcanvasTrigger', {
3293
+
3294
+ boot: function() {
3295
+
3296
+ // init code
3297
+ $html.on('click.offcanvas.uikit', '[data-uk-offcanvas]', function(e) {
3298
+
3299
+ e.preventDefault();
3300
+
3301
+ var ele = UI.$(this);
3302
+
3303
+ if (!ele.data('offcanvasTrigger')) {
3304
+ var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr('data-uk-offcanvas')));
3305
+ ele.trigger("click");
3306
+ }
3307
+ });
3308
+
3309
+ $html.on('keydown.uk.offcanvas', function(e) {
3310
+
3311
+ if (e.keyCode === 27) { // ESC
3312
+ Offcanvas.hide();
3313
+ }
3314
+ });
3315
+ },
3316
+
3317
+ init: function() {
3318
+
3319
+ var $this = this;
3320
+
3321
+ this.options = UI.$.extend({
3322
+ target: $this.element.is('a') ? $this.element.attr('href') : false,
3323
+ mode: 'push'
3324
+ }, this.options);
3325
+
3326
+ this.on('click', function(e) {
3327
+ e.preventDefault();
3328
+ Offcanvas.show($this.options.target, $this.options);
3329
+ });
3330
+ }
3331
+ });
3332
+
3333
+ UI.offcanvas = Offcanvas;
3334
+
3335
+ })(UIkit);
3336
+
3337
+ (function(UI) {
3338
+
3339
+ "use strict";
3340
+
3341
+ var Animations;
3342
+
3343
+ UI.component('switcher', {
3344
+
3345
+ defaults: {
3346
+ connect : false,
3347
+ toggle : '>*',
3348
+ active : 0,
3349
+ animation : false,
3350
+ duration : 200,
3351
+ swiping : true
3352
+ },
3353
+
3354
+ animating: false,
3355
+
3356
+ boot: function() {
3357
+
3358
+ // init code
3359
+ UI.ready(function(context) {
3360
+
3361
+ UI.$('[data-uk-switcher]', context).each(function() {
3362
+ var switcher = UI.$(this);
3363
+
3364
+ if (!switcher.data('switcher')) {
3365
+ var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr('data-uk-switcher')));
3366
+ }
3367
+ });
3368
+ });
3369
+ },
3370
+
3371
+ init: function() {
3372
+
3373
+ var $this = this;
3374
+
3375
+ this.on('click.uk.switcher', this.options.toggle, function(e) {
3376
+ e.preventDefault();
3377
+ $this.show(this);
3378
+ });
3379
+
3380
+ if (!this.options.connect) {
3381
+ return;
3382
+ }
3383
+
3384
+ this.connect = UI.$(this.options.connect);
3385
+
3386
+ if (!this.connect.length) {
3387
+ return;
3388
+ }
3389
+
3390
+ this.connect.on('click.uk.switcher', '[data-uk-switcher-item]', function(e) {
3391
+
3392
+ e.preventDefault();
3393
+
3394
+ var item = UI.$(this).attr('data-uk-switcher-item');
3395
+
3396
+ if ($this.index == item) return;
3397
+
3398
+ switch(item) {
3399
+ case 'next':
3400
+ case 'previous':
3401
+ $this.show($this.index + (item=='next' ? 1:-1));
3402
+ break;
3403
+ default:
3404
+ $this.show(parseInt(item, 10));
3405
+ }
3406
+ });
3407
+
3408
+ if (this.options.swiping) {
3409
+
3410
+ this.connect.on('swipeRight swipeLeft', function(e) {
3411
+ e.preventDefault();
3412
+ if (!window.getSelection().toString()) {
3413
+ $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
3414
+ }
3415
+ });
3416
+ }
3417
+
3418
+ this.update();
3419
+ },
3420
+
3421
+ update: function() {
3422
+
3423
+ this.connect.children().removeClass('uk-active').attr('aria-hidden', 'true');
3424
+
3425
+ var toggles = this.find(this.options.toggle),
3426
+ active = toggles.filter('.uk-active');
3427
+
3428
+ if (active.length) {
3429
+ this.show(active, false);
3430
+ } else {
3431
+
3432
+ if (this.options.active===false) return;
3433
+
3434
+ active = toggles.eq(this.options.active);
3435
+ this.show(active.length ? active : toggles.eq(0), false);
3436
+ }
3437
+
3438
+ // Init ARIA for toggles
3439
+ toggles.not(active).attr('aria-expanded', 'false');
3440
+ active.attr('aria-expanded', 'true');
3441
+ },
3442
+
3443
+ show: function(tab, animate) {
3444
+
3445
+ if (this.animating) {
3446
+ return;
3447
+ }
3448
+
3449
+ var toggles = this.find(this.options.toggle);
3450
+
3451
+ if (isNaN(tab)) {
3452
+ tab = UI.$(tab);
3453
+ } else {
3454
+ tab = tab < 0 ? toggles.length-1 : tab;
3455
+ tab = toggles.eq(toggles[tab] ? tab : 0);
3456
+ }
3457
+
3458
+ var $this = this,
3459
+ active = UI.$(tab),
3460
+ animation = Animations[this.options.animation] || function(current, next) {
3461
+
3462
+ if (!$this.options.animation) {
3463
+ return Animations.none.apply($this);
3464
+ }
3465
+
3466
+ var anim = $this.options.animation.split(',');
3467
+
3468
+ if (anim.length == 1) {
3469
+ anim[1] = anim[0];
3470
+ }
3471
+
3472
+ anim[0] = anim[0].trim();
3473
+ anim[1] = anim[1].trim();
3474
+
3475
+ return coreAnimation.apply($this, [anim, current, next]);
3476
+ };
3477
+
3478
+ if (animate===false || !UI.support.animation) {
3479
+ animation = Animations.none;
3480
+ }
3481
+
3482
+ if (active.hasClass("uk-disabled")) return;
3483
+
3484
+ // Update ARIA for Toggles
3485
+ toggles.attr('aria-expanded', 'false');
3486
+ active.attr('aria-expanded', 'true');
3487
+
3488
+ toggles.filter(".uk-active").removeClass("uk-active");
3489
+ active.addClass("uk-active");
3490
+
3491
+ if (this.options.connect && this.connect.length) {
3492
+
3493
+ this.index = this.find(this.options.toggle).index(active);
3494
+
3495
+ if (this.index == -1 ) {
3496
+ this.index = 0;
3497
+ }
3498
+
3499
+ this.connect.each(function() {
3500
+
3501
+ var container = UI.$(this),
3502
+ children = UI.$(container.children()),
3503
+ current = UI.$(children.filter('.uk-active')),
3504
+ next = UI.$(children.eq($this.index));
3505
+
3506
+ $this.animating = true;
3507
+
3508
+ animation.apply($this, [current, next]).then(function(){
3509
+
3510
+ current.removeClass("uk-active");
3511
+ next.addClass("uk-active");
3512
+
3513
+ // Update ARIA for connect
3514
+ current.attr('aria-hidden', 'true');
3515
+ next.attr('aria-hidden', 'false');
3516
+
3517
+ UI.Utils.checkDisplay(next, true);
3518
+
3519
+ $this.animating = false;
3520
+
3521
+ });
3522
+ });
3523
+ }
3524
+
3525
+ this.trigger("show.uk.switcher", [active]);
3526
+ }
3527
+ });
3528
+
3529
+ Animations = {
3530
+
3531
+ 'none': function() {
3532
+ var d = UI.$.Deferred();
3533
+ d.resolve();
3534
+ return d.promise();
3535
+ },
3536
+
3537
+ 'fade': function(current, next) {
3538
+ return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
3539
+ },
3540
+
3541
+ 'slide-bottom': function(current, next) {
3542
+ return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
3543
+ },
3544
+
3545
+ 'slide-top': function(current, next) {
3546
+ return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
3547
+ },
3548
+
3549
+ 'slide-vertical': function(current, next, dir) {
3550
+
3551
+ var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
3552
+
3553
+ if (current && current.index() > next.index()) {
3554
+ anim.reverse();
3555
+ }
3556
+
3557
+ return coreAnimation.apply(this, [anim, current, next]);
3558
+ },
3559
+
3560
+ 'slide-left': function(current, next) {
3561
+ return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
3562
+ },
3563
+
3564
+ 'slide-right': function(current, next) {
3565
+ return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
3566
+ },
3567
+
3568
+ 'slide-horizontal': function(current, next, dir) {
3569
+
3570
+ var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
3571
+
3572
+ if (current && current.index() > next.index()) {
3573
+ anim.reverse();
3574
+ }
3575
+
3576
+ return coreAnimation.apply(this, [anim, current, next]);
3577
+ },
3578
+
3579
+ 'scale': function(current, next) {
3580
+ return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
3581
+ }
3582
+ };
3583
+
3584
+ UI.switcher.animations = Animations;
3585
+
3586
+
3587
+ // helpers
3588
+
3589
+ function coreAnimation(cls, current, next) {
3590
+
3591
+ var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
3592
+
3593
+ if (next[0]===current[0]) {
3594
+ d.resolve();
3595
+ return d.promise();
3596
+ }
3597
+
3598
+ if (typeof(cls) == 'object') {
3599
+ clsIn = cls[0];
3600
+ clsOut = cls[1] || cls[0];
3601
+ }
3602
+
3603
+ UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS
3604
+
3605
+ release = function() {
3606
+
3607
+ if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
3608
+
3609
+ next.addClass(clsIn).one(UI.support.animation.end, function() {
3610
+
3611
+ setTimeout(function () {
3612
+ next.removeClass(''+clsIn+'').css({opacity:'', display:''});
3613
+ }, 0);
3614
+
3615
+ d.resolve();
3616
+
3617
+ UI.$body.css('overflow-x', '');
3618
+
3619
+ if (current) current.css({opacity:'', display:''});
3620
+
3621
+ }.bind(this)).show();
3622
+ };
3623
+
3624
+ next.css('animation-duration', this.options.duration+'ms');
3625
+
3626
+ if (current && current.length) {
3627
+
3628
+ current.css('animation-duration', this.options.duration+'ms');
3629
+
3630
+ current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
3631
+ release();
3632
+ }.bind(this)).css('display', '');
3633
+
3634
+ } else {
3635
+ next.addClass('uk-active');
3636
+ release();
3637
+ }
3638
+
3639
+ return d.promise();
3640
+ }
3641
+
3642
+ })(UIkit);
3643
+
3644
+ (function(UI) {
3645
+
3646
+ "use strict";
3647
+
3648
+ UI.component('tab', {
3649
+
3650
+ defaults: {
3651
+ target : '>li:not(.uk-tab-responsive, .uk-disabled)',
3652
+ connect : false,
3653
+ active : 0,
3654
+ animation : false,
3655
+ duration : 200,
3656
+ swiping : true
3657
+ },
3658
+
3659
+ boot: function() {
3660
+
3661
+ // init code
3662
+ UI.ready(function(context) {
3663
+
3664
+ UI.$('[data-uk-tab]', context).each(function() {
3665
+
3666
+ var tab = UI.$(this);
3667
+
3668
+ if (!tab.data('tab')) {
3669
+ var obj = UI.tab(tab, UI.Utils.options(tab.attr('data-uk-tab')));
3670
+ }
3671
+ });
3672
+ });
3673
+ },
3674
+
3675
+ init: function() {
3676
+
3677
+ var $this = this;
3678
+
3679
+ this.current = false;
3680
+
3681
+ this.on('click.uk.tab', this.options.target, function(e) {
3682
+
3683
+ e.preventDefault();
3684
+
3685
+ if ($this.switcher && $this.switcher.animating) {
3686
+ return;
3687
+ }
3688
+
3689
+ var current = $this.find($this.options.target).not(this);
3690
+
3691
+ current.removeClass('uk-active').blur();
3692
+
3693
+ $this.trigger('change.uk.tab', [UI.$(this).addClass('uk-active'), $this.current]);
3694
+
3695
+ $this.current = UI.$(this);
3696
+
3697
+ // Update ARIA
3698
+ if (!$this.options.connect) {
3699
+ current.attr('aria-expanded', 'false');
3700
+ UI.$(this).attr('aria-expanded', 'true');
3701
+ }
3702
+ });
3703
+
3704
+ if (this.options.connect) {
3705
+ this.connect = UI.$(this.options.connect);
3706
+ }
3707
+
3708
+ // init responsive tab
3709
+ 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>');
3710
+
3711
+ this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
3712
+ this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
3713
+ this.responsivetab.caption = this.responsivetab.find('a:first');
3714
+
3715
+ if (this.element.hasClass('uk-tab-bottom')) this.responsivetab.dropdown.addClass('uk-dropdown-up');
3716
+
3717
+ // handle click
3718
+ this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
3719
+
3720
+ e.preventDefault();
3721
+ e.stopPropagation();
3722
+
3723
+ var link = UI.$(this);
3724
+
3725
+ $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
3726
+ });
3727
+
3728
+ this.on('show.uk.switcher change.uk.tab', function(e, tab) {
3729
+ $this.responsivetab.caption.html(tab.text());
3730
+ });
3731
+
3732
+ this.element.append(this.responsivetab);
3733
+
3734
+ // init UIkit components
3735
+ if (this.options.connect) {
3736
+
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 = UI.$(item[0].outerHTML);
3797
+ clone.find('a').data('index', i);
3798
+
3799
+ this.responsivetab.lst.append(clone);
3800
+ }
3801
+
3802
+ item.addClass('uk-hidden');
3803
+ }
3804
+ }
3805
+ }
3806
+
3807
+ this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
3808
+ }
3809
+ });
3810
+
3811
+ })(UIkit);
3812
+
3813
+ (function(UI){
3814
+
3815
+ "use strict";
3816
+
3817
+ UI.component('cover', {
3818
+
3819
+ defaults: {
3820
+ automute : true
3821
+ },
3822
+
3823
+ boot: function() {
3824
+
3825
+ // auto init
3826
+ UI.ready(function(context) {
3827
+
3828
+ UI.$('[data-uk-cover]', context).each(function(){
3829
+
3830
+ var ele = UI.$(this);
3831
+
3832
+ if(!ele.data('cover')) {
3833
+ var plugin = UI.cover(ele, UI.Utils.options(ele.attr('data-uk-cover')));
3834
+ }
3835
+ });
3836
+ });
3837
+ },
3838
+
3839
+ init: function() {
3840
+
3841
+ this.parent = this.element.parent();
3842
+
3843
+ UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
3844
+ this.check();
3845
+ }.bind(this), 100));
3846
+
3847
+ this.on('display.uk.check', function(e) {
3848
+ if (this.element.is(':visible')) this.check();
3849
+ }.bind(this));
3850
+
3851
+ this.check();
3852
+
3853
+ if (this.element.is('iframe') && this.options.automute) {
3854
+
3855
+ var src = this.element.attr('src');
3856
+
3857
+ this.element.attr('src', '').on('load', function(){
3858
+ this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
3859
+ }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
3860
+ }
3861
+ },
3862
+
3863
+ check: function() {
3864
+
3865
+ this.element.css({ width : '', height : '' });
3866
+
3867
+ this.dimension = {w: this.element.width(), h: this.element.height()};
3868
+
3869
+ if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
3870
+ this.dimension.w = this.element.attr('width');
3871
+ }
3872
+
3873
+ if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
3874
+ this.dimension.h = this.element.attr('height');
3875
+ }
3876
+
3877
+ this.ratio = this.dimension.w / this.dimension.h;
3878
+
3879
+ var w = this.parent.width(), h = this.parent.height(), width, height;
3880
+
3881
+ // if element height < parent height (gap underneath)
3882
+ if ((w / this.ratio) < h) {
3883
+
3884
+ width = Math.ceil(h * this.ratio);
3885
+ height = h;
3886
+
3887
+ // element width < parent width (gap to right)
3888
+ } else {
3889
+
3890
+ width = w;
3891
+ height = Math.ceil(w / this.ratio);
3892
+ }
3893
+
3894
+ this.element.css({ width : width, height : height });
3895
+ }
3896
+ });
3897
+
3898
+ })(UIkit);