diff options
author | Pascal Szewczyk <ps@elektrowecker.de> | 2016-07-18 23:23:54 +0200 |
---|---|---|
committer | Pascal Szewczyk <ps@elektrowecker.de> | 2016-07-18 23:23:54 +0200 |
commit | c94fb32c7a3c28b18a27460aa2447eeec1fac1de (patch) | |
tree | e3bb35d57f90256698135c722eadeb784b47992c /js/core | |
parent | 89685742de42cb8e54ebdbaf7a207cfe16fa62b8 (diff) |
uikit added
Diffstat (limited to 'js/core')
32 files changed, 3846 insertions, 0 deletions
diff --git a/js/core/alert.js b/js/core/alert.js new file mode 100755 index 0000000..e145d5f --- /dev/null +++ b/js/core/alert.js | |||
@@ -0,0 +1,66 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('alert', { | ||
7 | |||
8 | defaults: { | ||
9 | "fade": true, | ||
10 | "duration": 200, | ||
11 | "trigger": ".uk-alert-close" | ||
12 | }, | ||
13 | |||
14 | boot: function() { | ||
15 | |||
16 | // init code | ||
17 | UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) { | ||
18 | |||
19 | var ele = UI.$(this); | ||
20 | |||
21 | if (!ele.data("alert")) { | ||
22 | |||
23 | var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert"))); | ||
24 | |||
25 | if (UI.$(e.target).is(alert.options.trigger)) { | ||
26 | e.preventDefault(); | ||
27 | alert.close(); | ||
28 | } | ||
29 | } | ||
30 | }); | ||
31 | }, | ||
32 | |||
33 | init: function() { | ||
34 | |||
35 | var $this = this; | ||
36 | |||
37 | this.on("click", this.options.trigger, function(e) { | ||
38 | e.preventDefault(); | ||
39 | $this.close(); | ||
40 | }); | ||
41 | }, | ||
42 | |||
43 | close: function() { | ||
44 | |||
45 | var element = this.trigger("close.uk.alert"), | ||
46 | removeElement = function () { | ||
47 | this.trigger("closed.uk.alert").remove(); | ||
48 | }.bind(this); | ||
49 | |||
50 | if (this.options.fade) { | ||
51 | element.css("overflow", "hidden").css("max-height", element.height()).animate({ | ||
52 | "height" : 0, | ||
53 | "opacity" : 0, | ||
54 | "padding-top" : 0, | ||
55 | "padding-bottom" : 0, | ||
56 | "margin-top" : 0, | ||
57 | "margin-bottom" : 0 | ||
58 | }, this.options.duration, removeElement); | ||
59 | } else { | ||
60 | removeElement(); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | }); | ||
65 | |||
66 | })(UIkit); | ||
diff --git a/js/core/alert.min.js b/js/core/alert.min.js new file mode 100755 index 0000000..501b85d --- /dev/null +++ b/js/core/alert.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";t.component("alert",{defaults:{fade:!0,duration:200,trigger:".uk-alert-close"},boot:function(){t.$html.on("click.alert.uikit","[data-uk-alert]",function(i){var o=t.$(this);if(!o.data("alert")){var e=t.alert(o,t.Utils.options(o.attr("data-uk-alert")));t.$(i.target).is(e.options.trigger)&&(i.preventDefault(),e.close())}})},init:function(){var t=this;this.on("click",this.options.trigger,function(i){i.preventDefault(),t.close()})},close:function(){var t=this.trigger("close.uk.alert"),i=function(){this.trigger("closed.uk.alert").remove()}.bind(this);this.options.fade?t.css("overflow","hidden").css("max-height",t.height()).animate({height:0,opacity:0,"padding-top":0,"padding-bottom":0,"margin-top":0,"margin-bottom":0},this.options.duration,i):i()}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/button.js b/js/core/button.js new file mode 100755 index 0000000..9ebe57a --- /dev/null +++ b/js/core/button.js | |||
@@ -0,0 +1,157 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('buttonRadio', { | ||
7 | |||
8 | defaults: { | ||
9 | "activeClass": 'uk-active', | ||
10 | "target": ".uk-button" | ||
11 | }, | ||
12 | |||
13 | boot: function() { | ||
14 | |||
15 | // init code | ||
16 | UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) { | ||
17 | |||
18 | var ele = UI.$(this); | ||
19 | |||
20 | if (!ele.data("buttonRadio")) { | ||
21 | |||
22 | var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))), | ||
23 | target = UI.$(e.target); | ||
24 | |||
25 | if (target.is(obj.options.target)) { | ||
26 | target.trigger("click"); | ||
27 | } | ||
28 | } | ||
29 | }); | ||
30 | }, | ||
31 | |||
32 | init: function() { | ||
33 | |||
34 | var $this = this; | ||
35 | |||
36 | // Init ARIA | ||
37 | this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true'); | ||
38 | |||
39 | this.on("click", this.options.target, function(e) { | ||
40 | |||
41 | var ele = UI.$(this); | ||
42 | |||
43 | if (ele.is('a[href="#"]')) e.preventDefault(); | ||
44 | |||
45 | $this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur(); | ||
46 | ele.addClass($this.options.activeClass); | ||
47 | |||
48 | // Update ARIA | ||
49 | $this.find($this.options.target).not(ele).attr('aria-checked', 'false'); | ||
50 | ele.attr('aria-checked', 'true'); | ||
51 | |||
52 | $this.trigger("change.uk.button", [ele]); | ||
53 | }); | ||
54 | |||
55 | }, | ||
56 | |||
57 | getSelected: function() { | ||
58 | return this.find('.' + this.options.activeClass); | ||
59 | } | ||
60 | }); | ||
61 | |||
62 | UI.component('buttonCheckbox', { | ||
63 | |||
64 | defaults: { | ||
65 | "activeClass": 'uk-active', | ||
66 | "target": ".uk-button" | ||
67 | }, | ||
68 | |||
69 | boot: function() { | ||
70 | |||
71 | UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) { | ||
72 | var ele = UI.$(this); | ||
73 | |||
74 | if (!ele.data("buttonCheckbox")) { | ||
75 | |||
76 | var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))), | ||
77 | target = UI.$(e.target); | ||
78 | |||
79 | if (target.is(obj.options.target)) { | ||
80 | target.trigger("click"); | ||
81 | } | ||
82 | } | ||
83 | }); | ||
84 | }, | ||
85 | |||
86 | init: function() { | ||
87 | |||
88 | var $this = this; | ||
89 | |||
90 | // Init ARIA | ||
91 | this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true'); | ||
92 | |||
93 | this.on("click", this.options.target, function(e) { | ||
94 | var ele = UI.$(this); | ||
95 | |||
96 | if (ele.is('a[href="#"]')) e.preventDefault(); | ||
97 | |||
98 | ele.toggleClass($this.options.activeClass).blur(); | ||
99 | |||
100 | // Update ARIA | ||
101 | ele.attr('aria-checked', ele.hasClass($this.options.activeClass)); | ||
102 | |||
103 | $this.trigger("change.uk.button", [ele]); | ||
104 | }); | ||
105 | |||
106 | }, | ||
107 | |||
108 | getSelected: function() { | ||
109 | return this.find('.' + this.options.activeClass); | ||
110 | } | ||
111 | }); | ||
112 | |||
113 | |||
114 | UI.component('button', { | ||
115 | |||
116 | defaults: {}, | ||
117 | |||
118 | boot: function() { | ||
119 | |||
120 | UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) { | ||
121 | var ele = UI.$(this); | ||
122 | |||
123 | if (!ele.data("button")) { | ||
124 | |||
125 | var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button"))); | ||
126 | ele.trigger("click"); | ||
127 | } | ||
128 | }); | ||
129 | }, | ||
130 | |||
131 | init: function() { | ||
132 | |||
133 | var $this = this; | ||
134 | |||
135 | // Init ARIA | ||
136 | this.element.attr('aria-pressed', this.element.hasClass("uk-active")); | ||
137 | |||
138 | this.on("click", function(e) { | ||
139 | |||
140 | if ($this.element.is('a[href="#"]')) e.preventDefault(); | ||
141 | |||
142 | $this.toggle(); | ||
143 | $this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]); | ||
144 | }); | ||
145 | |||
146 | }, | ||
147 | |||
148 | toggle: function() { | ||
149 | this.element.toggleClass("uk-active"); | ||
150 | |||
151 | // Update ARIA | ||
152 | this.element.attr('aria-pressed', this.element.hasClass("uk-active")); | ||
153 | } | ||
154 | }); | ||
155 | |||
156 | })(UIkit); | ||
157 | |||
diff --git a/js/core/button.min.js b/js/core/button.min.js new file mode 100755 index 0000000..9458783 --- /dev/null +++ b/js/core/button.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";t.component("buttonRadio",{defaults:{activeClass:"uk-active",target:".uk-button"},boot:function(){t.$html.on("click.buttonradio.uikit","[data-uk-button-radio]",function(i){var a=t.$(this);if(!a.data("buttonRadio")){var e=t.buttonRadio(a,t.Utils.options(a.attr("data-uk-button-radio"))),o=t.$(i.target);o.is(e.options.target)&&o.trigger("click")}})},init:function(){var i=this;this.find(i.options.target).attr("aria-checked","false").filter("."+i.options.activeClass).attr("aria-checked","true"),this.on("click",this.options.target,function(a){var e=t.$(this);e.is('a[href="#"]')&&a.preventDefault(),i.find(i.options.target).not(e).removeClass(i.options.activeClass).blur(),e.addClass(i.options.activeClass),i.find(i.options.target).not(e).attr("aria-checked","false"),e.attr("aria-checked","true"),i.trigger("change.uk.button",[e])})},getSelected:function(){return this.find("."+this.options.activeClass)}}),t.component("buttonCheckbox",{defaults:{activeClass:"uk-active",target:".uk-button"},boot:function(){t.$html.on("click.buttoncheckbox.uikit","[data-uk-button-checkbox]",function(i){var a=t.$(this);if(!a.data("buttonCheckbox")){var e=t.buttonCheckbox(a,t.Utils.options(a.attr("data-uk-button-checkbox"))),o=t.$(i.target);o.is(e.options.target)&&o.trigger("click")}})},init:function(){var i=this;this.find(i.options.target).attr("aria-checked","false").filter("."+i.options.activeClass).attr("aria-checked","true"),this.on("click",this.options.target,function(a){var e=t.$(this);e.is('a[href="#"]')&&a.preventDefault(),e.toggleClass(i.options.activeClass).blur(),e.attr("aria-checked",e.hasClass(i.options.activeClass)),i.trigger("change.uk.button",[e])})},getSelected:function(){return this.find("."+this.options.activeClass)}}),t.component("button",{defaults:{},boot:function(){t.$html.on("click.button.uikit","[data-uk-button]",function(){var i=t.$(this);if(!i.data("button")){{t.button(i,t.Utils.options(i.attr("data-uk-button")))}i.trigger("click")}})},init:function(){var t=this;this.element.attr("aria-pressed",this.element.hasClass("uk-active")),this.on("click",function(i){t.element.is('a[href="#"]')&&i.preventDefault(),t.toggle(),t.trigger("change.uk.button",[t.element.blur().hasClass("uk-active")])})},toggle:function(){this.element.toggleClass("uk-active"),this.element.attr("aria-pressed",this.element.hasClass("uk-active"))}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/core.js b/js/core/core.js new file mode 100755 index 0000000..85540af --- /dev/null +++ b/js/core/core.js | |||
@@ -0,0 +1,786 @@ | |||
1 | /*! UIkit 2.26.4 | 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.26.4'; | ||
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, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}" | ||
369 | ].join("\n")); | ||
370 | |||
371 | return data ? fn(data) : fn; | ||
372 | }; | ||
373 | |||
374 | UI.Utils.events = {}; | ||
375 | UI.Utils.events.click = UI.support.touch ? 'tap' : 'click'; | ||
376 | |||
377 | global.UIkit = UI; | ||
378 | |||
379 | // deprecated | ||
380 | |||
381 | UI.fn = function(command, options) { | ||
382 | |||
383 | var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2]; | ||
384 | |||
385 | if (!UI[component]) { | ||
386 | $.error("UIkit component [" + component + "] does not exist."); | ||
387 | return this; | ||
388 | } | ||
389 | |||
390 | return this.each(function() { | ||
391 | var $this = $(this), data = $this.data(component); | ||
392 | if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options))); | ||
393 | if (method) data[method].apply(data, Array.prototype.slice.call(args, 1)); | ||
394 | }); | ||
395 | }; | ||
396 | |||
397 | $.UIkit = UI; | ||
398 | $.fn.uk = UI.fn; | ||
399 | |||
400 | UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left"; | ||
401 | |||
402 | UI.components = {}; | ||
403 | |||
404 | UI.component = function(name, def) { | ||
405 | |||
406 | var fn = function(element, options) { | ||
407 | |||
408 | var $this = this; | ||
409 | |||
410 | this.UIkit = UI; | ||
411 | this.element = element ? UI.$(element) : null; | ||
412 | this.options = $.extend(true, {}, this.defaults, options); | ||
413 | this.plugins = {}; | ||
414 | |||
415 | if (this.element) { | ||
416 | this.element.data(name, this); | ||
417 | } | ||
418 | |||
419 | this.init(); | ||
420 | |||
421 | (this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) { | ||
422 | |||
423 | if (fn.plugins[plugin].init) { | ||
424 | fn.plugins[plugin].init($this); | ||
425 | $this.plugins[plugin] = true; | ||
426 | } | ||
427 | |||
428 | }); | ||
429 | |||
430 | this.trigger('init.uk.component', [name, this]); | ||
431 | |||
432 | return this; | ||
433 | }; | ||
434 | |||
435 | fn.plugins = {}; | ||
436 | |||
437 | $.extend(true, fn.prototype, { | ||
438 | |||
439 | defaults : {plugins: []}, | ||
440 | |||
441 | boot: function(){}, | ||
442 | init: function(){}, | ||
443 | |||
444 | on: function(a1,a2,a3){ | ||
445 | return UI.$(this.element || this).on(a1,a2,a3); | ||
446 | }, | ||
447 | |||
448 | one: function(a1,a2,a3){ | ||
449 | return UI.$(this.element || this).one(a1,a2,a3); | ||
450 | }, | ||
451 | |||
452 | off: function(evt){ | ||
453 | return UI.$(this.element || this).off(evt); | ||
454 | }, | ||
455 | |||
456 | trigger: function(evt, params) { | ||
457 | return UI.$(this.element || this).trigger(evt, params); | ||
458 | }, | ||
459 | |||
460 | find: function(selector) { | ||
461 | return UI.$(this.element ? this.element: []).find(selector); | ||
462 | }, | ||
463 | |||
464 | proxy: function(obj, methods) { | ||
465 | |||
466 | var $this = this; | ||
467 | |||
468 | methods.split(' ').forEach(function(method) { | ||
469 | if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); }; | ||
470 | }); | ||
471 | }, | ||
472 | |||
473 | mixin: function(obj, methods) { | ||
474 | |||
475 | var $this = this; | ||
476 | |||
477 | methods.split(' ').forEach(function(method) { | ||
478 | if (!$this[method]) $this[method] = obj[method].bind($this); | ||
479 | }); | ||
480 | }, | ||
481 | |||
482 | option: function() { | ||
483 | |||
484 | if (arguments.length == 1) { | ||
485 | return this.options[arguments[0]] || undefined; | ||
486 | } else if (arguments.length == 2) { | ||
487 | this.options[arguments[0]] = arguments[1]; | ||
488 | } | ||
489 | } | ||
490 | |||
491 | }, def); | ||
492 | |||
493 | this.components[name] = fn; | ||
494 | |||
495 | this[name] = function() { | ||
496 | |||
497 | var element, options; | ||
498 | |||
499 | if (arguments.length) { | ||
500 | |||
501 | switch(arguments.length) { | ||
502 | case 1: | ||
503 | |||
504 | if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) { | ||
505 | element = $(arguments[0]); | ||
506 | } else { | ||
507 | options = arguments[0]; | ||
508 | } | ||
509 | |||
510 | break; | ||
511 | case 2: | ||
512 | |||
513 | element = $(arguments[0]); | ||
514 | options = arguments[1]; | ||
515 | break; | ||
516 | } | ||
517 | } | ||
518 | |||
519 | if (element && element.data(name)) { | ||
520 | return element.data(name); | ||
521 | } | ||
522 | |||
523 | return (new UI.components[name](element, options)); | ||
524 | }; | ||
525 | |||
526 | if (UI.domready) { | ||
527 | UI.component.boot(name); | ||
528 | } | ||
529 | |||
530 | return fn; | ||
531 | }; | ||
532 | |||
533 | UI.plugin = function(component, name, def) { | ||
534 | this.components[component].plugins[name] = def; | ||
535 | }; | ||
536 | |||
537 | UI.component.boot = function(name) { | ||
538 | |||
539 | if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) { | ||
540 | UI.components[name].prototype.boot.apply(UI, []); | ||
541 | UI.components[name].booted = true; | ||
542 | } | ||
543 | }; | ||
544 | |||
545 | UI.component.bootComponents = function() { | ||
546 | |||
547 | for (var component in UI.components) { | ||
548 | UI.component.boot(component); | ||
549 | } | ||
550 | }; | ||
551 | |||
552 | |||
553 | // DOM mutation save ready helper function | ||
554 | |||
555 | UI.domObservers = []; | ||
556 | UI.domready = false; | ||
557 | |||
558 | UI.ready = function(fn) { | ||
559 | |||
560 | UI.domObservers.push(fn); | ||
561 | |||
562 | if (UI.domready) { | ||
563 | fn(document); | ||
564 | } | ||
565 | }; | ||
566 | |||
567 | UI.on = function(a1,a2,a3){ | ||
568 | |||
569 | if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) { | ||
570 | a2.apply(UI.$doc); | ||
571 | } | ||
572 | |||
573 | return UI.$doc.on(a1,a2,a3); | ||
574 | }; | ||
575 | |||
576 | UI.one = function(a1,a2,a3){ | ||
577 | |||
578 | if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) { | ||
579 | a2.apply(UI.$doc); | ||
580 | return UI.$doc; | ||
581 | } | ||
582 | |||
583 | return UI.$doc.one(a1,a2,a3); | ||
584 | }; | ||
585 | |||
586 | UI.trigger = function(evt, params) { | ||
587 | return UI.$doc.trigger(evt, params); | ||
588 | }; | ||
589 | |||
590 | UI.domObserve = function(selector, fn) { | ||
591 | |||
592 | if(!UI.support.mutationobserver) return; | ||
593 | |||
594 | fn = fn || function() {}; | ||
595 | |||
596 | UI.$(selector).each(function() { | ||
597 | |||
598 | var element = this, | ||
599 | $element = UI.$(element); | ||
600 | |||
601 | if ($element.data('observer')) { | ||
602 | return; | ||
603 | } | ||
604 | |||
605 | try { | ||
606 | |||
607 | var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) { | ||
608 | fn.apply(element, []); | ||
609 | $element.trigger('changed.uk.dom'); | ||
610 | }, 50), {childList: true, subtree: true}); | ||
611 | |||
612 | // pass in the target node, as well as the observer options | ||
613 | observer.observe(element, { childList: true, subtree: true }); | ||
614 | |||
615 | $element.data('observer', observer); | ||
616 | |||
617 | } catch(e) {} | ||
618 | }); | ||
619 | }; | ||
620 | |||
621 | UI.init = function(root) { | ||
622 | |||
623 | root = root || document; | ||
624 | |||
625 | UI.domObservers.forEach(function(fn){ | ||
626 | fn(root); | ||
627 | }); | ||
628 | }; | ||
629 | |||
630 | UI.on('domready.uk.dom', function(){ | ||
631 | |||
632 | UI.init(); | ||
633 | |||
634 | if (UI.domready) UI.Utils.checkDisplay(); | ||
635 | }); | ||
636 | |||
637 | document.addEventListener('DOMContentLoaded', function(){ | ||
638 | |||
639 | var domReady = function() { | ||
640 | |||
641 | UI.$body = UI.$('body'); | ||
642 | |||
643 | UI.trigger('beforeready.uk.dom'); | ||
644 | |||
645 | UI.component.bootComponents(); | ||
646 | |||
647 | // custom scroll observer | ||
648 | var rafToken = requestAnimationFrame((function(){ | ||
649 | |||
650 | var memory = {dir: {x:0, y:0}, x: window.pageXOffset, y:window.pageYOffset}; | ||
651 | |||
652 | var fn = function(){ | ||
653 | // reading this (window.page[X|Y]Offset) causes a full page recalc of the layout in Chrome, | ||
654 | // so we only want to do this once | ||
655 | var wpxo = window.pageXOffset; | ||
656 | var wpyo = window.pageYOffset; | ||
657 | |||
658 | // Did the scroll position change since the last time we were here? | ||
659 | if (memory.x != wpxo || memory.y != wpyo) { | ||
660 | |||
661 | // Set the direction of the scroll and store the new position | ||
662 | if (wpxo != memory.x) {memory.dir.x = wpxo > memory.x ? 1:-1; } else { memory.dir.x = 0; } | ||
663 | if (wpyo != memory.y) {memory.dir.y = wpyo > memory.y ? 1:-1; } else { memory.dir.y = 0; } | ||
664 | |||
665 | memory.x = wpxo; | ||
666 | memory.y = wpyo; | ||
667 | |||
668 | // Trigger the scroll event, this could probably be sent using memory.clone() but this is | ||
669 | // more explicit and easier to see exactly what is being sent in the event. | ||
670 | UI.$doc.trigger('scrolling.uk.document', [{ | ||
671 | "dir": {"x": memory.dir.x, "y": memory.dir.y}, "x": wpxo, "y": wpyo | ||
672 | }]); | ||
673 | } | ||
674 | |||
675 | cancelAnimationFrame(rafToken); | ||
676 | rafToken = requestAnimationFrame(fn); | ||
677 | }; | ||
678 | |||
679 | if (UI.support.touch) { | ||
680 | UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn); | ||
681 | } | ||
682 | |||
683 | if (memory.x || memory.y) fn(); | ||
684 | |||
685 | return fn; | ||
686 | |||
687 | })()); | ||
688 | |||
689 | // run component init functions on dom | ||
690 | UI.trigger('domready.uk.dom'); | ||
691 | |||
692 | if (UI.support.touch) { | ||
693 | |||
694 | // remove css hover rules for touch devices | ||
695 | // UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/); | ||
696 | |||
697 | // viewport unit fix for uk-height-viewport - should be fixed in iOS 8 | ||
698 | if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) { | ||
699 | |||
700 | UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){ | ||
701 | |||
702 | var fn = function() { | ||
703 | $('.uk-height-viewport').css('height', window.innerHeight); | ||
704 | return fn; | ||
705 | }; | ||
706 | |||
707 | return fn(); | ||
708 | |||
709 | })(), 100)); | ||
710 | } | ||
711 | } | ||
712 | |||
713 | UI.trigger('afterready.uk.dom'); | ||
714 | |||
715 | // mark that domready is left behind | ||
716 | UI.domready = true; | ||
717 | |||
718 | // auto init js components | ||
719 | if (UI.support.mutationobserver) { | ||
720 | |||
721 | var initFn = UI.Utils.debounce(function(){ | ||
722 | requestAnimationFrame(function(){ UI.init(document.body);}); | ||
723 | }, 10); | ||
724 | |||
725 | (new UI.support.mutationobserver(function(mutations) { | ||
726 | |||
727 | var init = false; | ||
728 | |||
729 | mutations.every(function(mutation){ | ||
730 | |||
731 | if (mutation.type != 'childList') return true; | ||
732 | |||
733 | for (var i = 0, node; i < mutation.addedNodes.length; ++i) { | ||
734 | |||
735 | node = mutation.addedNodes[i]; | ||
736 | |||
737 | if (node.outerHTML && node.outerHTML.indexOf('data-uk-') !== -1) { | ||
738 | return (init = true) && false; | ||
739 | } | ||
740 | } | ||
741 | return true; | ||
742 | }); | ||
743 | |||
744 | if (init) initFn(); | ||
745 | |||
746 | })).observe(document.body, {childList: true, subtree: true}); | ||
747 | } | ||
748 | }; | ||
749 | |||
750 | if (document.readyState == 'complete' || document.readyState == 'interactive') { | ||
751 | setTimeout(domReady); | ||
752 | } | ||
753 | |||
754 | return domReady; | ||
755 | |||
756 | }()); | ||
757 | |||
758 | // add touch identifier class | ||
759 | UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch"); | ||
760 | |||
761 | // add uk-hover class on tap to support overlays on touch devices | ||
762 | if (UI.support.touch) { | ||
763 | |||
764 | var hoverset = false, | ||
765 | exclude, | ||
766 | hovercls = 'uk-hover', | ||
767 | selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover'; | ||
768 | |||
769 | UI.$html.on('mouseenter touchstart MSPointerDown pointerdown', selector, function() { | ||
770 | |||
771 | if (hoverset) $('.'+hovercls).removeClass(hovercls); | ||
772 | |||
773 | hoverset = $(this).addClass(hovercls); | ||
774 | |||
775 | }).on('mouseleave touchend MSPointerUp pointerup', function(e) { | ||
776 | |||
777 | exclude = $(e.target).parents(selector); | ||
778 | |||
779 | if (hoverset) { | ||
780 | hoverset.not(exclude).removeClass(hovercls); | ||
781 | } | ||
782 | }); | ||
783 | } | ||
784 | |||
785 | return UI; | ||
786 | }); | ||
diff --git a/js/core/core.min.js b/js/core/core.min.js new file mode 100755 index 0000000..07642d0 --- /dev/null +++ b/js/core/core.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){if("function"==typeof define&&define.amd&&define("uikit",function(){var n=window.UIkit||t(window,window.jQuery,window.document);return n.load=function(t,e,o,i){var r,a=t.split(","),s=[],u=(i.config&&i.config.uikit&&i.config.uikit.base?i.config.uikit.base:"").replace(/\/+$/g,"");if(!u)throw new Error("Please define base path to UIkit in the requirejs config.");for(r=0;r<a.length;r+=1){var c=a[r].replace(/\./g,"/");s.push(u+"/components/"+c)}e(s,function(){o(n)})},n}),!window.jQuery)throw new Error("UIkit requires jQuery");window&&window.jQuery&&t(window,window.jQuery,window.document)}(function(t,n,e){"use strict";var o={},i=t.UIkit?Object.create(t.UIkit):void 0;if(o.version="2.26.4",o.noConflict=function(){return i&&(t.UIkit=i,n.UIkit=i,n.fn.uk=i.fn),o},o.prefix=function(t){return t},o.$=n,o.$doc=o.$(document),o.$win=o.$(window),o.$html=o.$("html"),o.support={},o.support.transition=function(){var t=function(){var t,n=e.body||e.documentElement,o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(t in o)if(void 0!==n.style[t])return o[t]}();return t&&{end:t}}(),o.support.animation=function(){var t=function(){var t,n=e.body||e.documentElement,o={WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(t in o)if(void 0!==n.style[t])return o[t]}();return t&&{end:t}}(),function(){Date.now=Date.now||function(){return(new Date).getTime()};for(var t=["webkit","moz"],n=0;n<t.length&&!window.requestAnimationFrame;++n){var e=t[n];window.requestAnimationFrame=window[e+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e+"CancelAnimationFrame"]||window[e+"CancelRequestAnimationFrame"]}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var o=0;window.requestAnimationFrame=function(t){var n=Date.now(),e=Math.max(o+16,n);return setTimeout(function(){t(o=e)},e-n)},window.cancelAnimationFrame=clearTimeout}}(),o.support.touch="ontouchstart"in document||t.DocumentTouch&&document instanceof t.DocumentTouch||t.navigator.msPointerEnabled&&t.navigator.msMaxTouchPoints>0||t.navigator.pointerEnabled&&t.navigator.maxTouchPoints>0||!1,o.support.mutationobserver=t.MutationObserver||t.WebKitMutationObserver||null,o.Utils={},o.Utils.isFullscreen=function(){return document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.fullscreenElement||!1},o.Utils.str2json=function(t,n){try{return n?JSON.parse(t.replace(/([\$\w]+)\s*:/g,function(t,n){return'"'+n+'":'}).replace(/'([^']+)'/g,function(t,n){return'"'+n+'"'})):new Function("","var json = "+t+"; return JSON.parse(JSON.stringify(json));")()}catch(e){return!1}},o.Utils.debounce=function(t,n,e){var o;return function(){var i=this,r=arguments,a=function(){o=null,e||t.apply(i,r)},s=e&&!o;clearTimeout(o),o=setTimeout(a,n),s&&t.apply(i,r)}},o.Utils.throttle=function(t,n){var e=!1;return function(){e||(t.call(),e=!0,setTimeout(function(){e=!1},n))}},o.Utils.removeCssRules=function(t){var n,e,o,i,r,a,s,u,c,d;t&&setTimeout(function(){try{for(d=document.styleSheets,i=0,s=d.length;s>i;i++){for(o=d[i],e=[],o.cssRules=o.cssRules,n=r=0,u=o.cssRules.length;u>r;n=++r)o.cssRules[n].type===CSSRule.STYLE_RULE&&t.test(o.cssRules[n].selectorText)&&e.unshift(n);for(a=0,c=e.length;c>a;a++)o.deleteRule(e[a])}}catch(l){}},0)},o.Utils.isInView=function(t,e){var i=n(t);if(!i.is(":visible"))return!1;var r=o.$win.scrollLeft(),a=o.$win.scrollTop(),s=i.offset(),u=s.left,c=s.top;return e=n.extend({topoffset:0,leftoffset:0},e),c+i.height()>=a&&c-e.topoffset<=a+o.$win.height()&&u+i.width()>=r&&u-e.leftoffset<=r+o.$win.width()?!0:!1},o.Utils.checkDisplay=function(t,e){var i=o.$("[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]",t||document);return t&&!i.length&&(i=n(t)),i.trigger("display.uk.check"),e&&("string"!=typeof e&&(e='[class*="uk-animation-"]'),i.find(e).each(function(){var t=o.$(this),n=t.attr("class"),e=n.match(/uk-animation-(.+)/);t.removeClass(e[0]).width(),t.addClass(e[0])})),i},o.Utils.options=function(t){if("string"!=n.type(t))return t;-1!=t.indexOf(":")&&"}"!=t.trim().substr(-1)&&(t="{"+t+"}");var e=t?t.indexOf("{"):-1,i={};if(-1!=e)try{i=o.Utils.str2json(t.substr(e))}catch(r){}return i},o.Utils.animate=function(t,e){var i=n.Deferred();return t=o.$(t),t.css("display","none").addClass(e).one(o.support.animation.end,function(){t.removeClass(e),i.resolve()}),t.css("display",""),i.promise()},o.Utils.uid=function(t){return(t||"id")+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random())},o.Utils.template=function(t,n){for(var e,o,i,r,a=t.replace(/\n/g,"\\n").replace(/\{\{\{\s*(.+?)\s*\}\}\}/g,"{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),s=0,u=[],c=0;s<a.length;){if(e=a[s],e.match(/\{\{\s*(.+?)\s*\}\}/))switch(s+=1,e=a[s],o=e[0],i=e.substring(e.match(/^(\^|\#|\!|\~|\:)/)?1:0),o){case"~":u.push("for(var $i=0;$i<"+i+".length;$i++) { var $item = "+i+"[$i];"),c++;break;case":":u.push("for(var $key in "+i+") { var $val = "+i+"[$key];"),c++;break;case"#":u.push("if("+i+") {"),c++;break;case"^":u.push("if(!"+i+") {"),c++;break;case"/":u.push("}"),c--;break;case"!":u.push("__ret.push("+i+");");break;default:u.push("__ret.push(escape("+i+"));")}else u.push("__ret.push('"+e.replace(/\'/g,"\\'")+"');");s+=1}return r=new Function("$data",["var __ret = [];","try {","with($data){",c?'__ret = ["Not all blocks are closed correctly."]':u.join(""),"};","}catch(e){__ret = [e.message];}",'return __ret.join("").replace(/\\n\\n/g, "\\n");',"function escape(html) { return String(html).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>');}"].join("\n")),n?r(n):r},o.Utils.events={},o.Utils.events.click=o.support.touch?"tap":"click",t.UIkit=o,o.fn=function(t,e){var i=arguments,r=t.match(/^([a-z\-]+)(?:\.([a-z]+))?/i),a=r[1],s=r[2];return o[a]?this.each(function(){var t=n(this),r=t.data(a);r||t.data(a,r=o[a](this,s?void 0:e)),s&&r[s].apply(r,Array.prototype.slice.call(i,1))}):(n.error("UIkit component ["+a+"] does not exist."),this)},n.UIkit=o,n.fn.uk=o.fn,o.langdirection="rtl"==o.$html.attr("dir")?"right":"left",o.components={},o.component=function(t,e){var i=function(e,r){var a=this;return this.UIkit=o,this.element=e?o.$(e):null,this.options=n.extend(!0,{},this.defaults,r),this.plugins={},this.element&&this.element.data(t,this),this.init(),(this.options.plugins.length?this.options.plugins:Object.keys(i.plugins)).forEach(function(t){i.plugins[t].init&&(i.plugins[t].init(a),a.plugins[t]=!0)}),this.trigger("init.uk.component",[t,this]),this};return i.plugins={},n.extend(!0,i.prototype,{defaults:{plugins:[]},boot:function(){},init:function(){},on:function(t,n,e){return o.$(this.element||this).on(t,n,e)},one:function(t,n,e){return o.$(this.element||this).one(t,n,e)},off:function(t){return o.$(this.element||this).off(t)},trigger:function(t,n){return o.$(this.element||this).trigger(t,n)},find:function(t){return o.$(this.element?this.element:[]).find(t)},proxy:function(t,n){var e=this;n.split(" ").forEach(function(n){e[n]||(e[n]=function(){return t[n].apply(t,arguments)})})},mixin:function(t,n){var e=this;n.split(" ").forEach(function(n){e[n]||(e[n]=t[n].bind(e))})},option:function(){return 1==arguments.length?this.options[arguments[0]]||void 0:(2==arguments.length&&(this.options[arguments[0]]=arguments[1]),void 0)}},e),this.components[t]=i,this[t]=function(){var e,i;if(arguments.length)switch(arguments.length){case 1:"string"==typeof arguments[0]||arguments[0].nodeType||arguments[0]instanceof jQuery?e=n(arguments[0]):i=arguments[0];break;case 2:e=n(arguments[0]),i=arguments[1]}return e&&e.data(t)?e.data(t):new o.components[t](e,i)},o.domready&&o.component.boot(t),i},o.plugin=function(t,n,e){this.components[t].plugins[n]=e},o.component.boot=function(t){o.components[t].prototype&&o.components[t].prototype.boot&&!o.components[t].booted&&(o.components[t].prototype.boot.apply(o,[]),o.components[t].booted=!0)},o.component.bootComponents=function(){for(var t in o.components)o.component.boot(t)},o.domObservers=[],o.domready=!1,o.ready=function(t){o.domObservers.push(t),o.domready&&t(document)},o.on=function(t,n,e){return t&&t.indexOf("ready.uk.dom")>-1&&o.domready&&n.apply(o.$doc),o.$doc.on(t,n,e)},o.one=function(t,n,e){return t&&t.indexOf("ready.uk.dom")>-1&&o.domready?(n.apply(o.$doc),o.$doc):o.$doc.one(t,n,e)},o.trigger=function(t,n){return o.$doc.trigger(t,n)},o.domObserve=function(t,n){o.support.mutationobserver&&(n=n||function(){},o.$(t).each(function(){var t=this,e=o.$(t);if(!e.data("observer"))try{var i=new o.support.mutationobserver(o.Utils.debounce(function(){n.apply(t,[]),e.trigger("changed.uk.dom")},50),{childList:!0,subtree:!0});i.observe(t,{childList:!0,subtree:!0}),e.data("observer",i)}catch(r){}}))},o.init=function(t){t=t||document,o.domObservers.forEach(function(n){n(t)})},o.on("domready.uk.dom",function(){o.init(),o.domready&&o.Utils.checkDisplay()}),document.addEventListener("DOMContentLoaded",function(){var t=function(){o.$body=o.$("body"),o.trigger("beforeready.uk.dom"),o.component.bootComponents();var t=requestAnimationFrame(function(){var n={dir:{x:0,y:0},x:window.pageXOffset,y:window.pageYOffset},e=function(){var i=window.pageXOffset,r=window.pageYOffset;(n.x!=i||n.y!=r)&&(n.dir.x=i!=n.x?i>n.x?1:-1:0,n.dir.y=r!=n.y?r>n.y?1:-1:0,n.x=i,n.y=r,o.$doc.trigger("scrolling.uk.document",[{dir:{x:n.dir.x,y:n.dir.y},x:i,y:r}])),cancelAnimationFrame(t),t=requestAnimationFrame(e)};return o.support.touch&&o.$html.on("touchmove touchend MSPointerMove MSPointerUp pointermove pointerup",e),(n.x||n.y)&&e(),e}());if(o.trigger("domready.uk.dom"),o.support.touch&&navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&o.$win.on("load orientationchange resize",o.Utils.debounce(function(){var t=function(){return n(".uk-height-viewport").css("height",window.innerHeight),t};return t()}(),100)),o.trigger("afterready.uk.dom"),o.domready=!0,o.support.mutationobserver){var e=o.Utils.debounce(function(){requestAnimationFrame(function(){o.init(document.body)})},10);new o.support.mutationobserver(function(t){var n=!1;t.every(function(t){if("childList"!=t.type)return!0;for(var e,o=0;o<t.addedNodes.length;++o)if(e=t.addedNodes[o],e.outerHTML&&-1!==e.outerHTML.indexOf("data-uk-"))return(n=!0)&&!1;return!0}),n&&e()}).observe(document.body,{childList:!0,subtree:!0})}};return("complete"==document.readyState||"interactive"==document.readyState)&&setTimeout(t),t}()),o.$html.addClass(o.support.touch?"uk-touch":"uk-notouch"),o.support.touch){var r,a=!1,s="uk-hover",u=".uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover";o.$html.on("mouseenter touchstart MSPointerDown pointerdown",u,function(){a&&n("."+s).removeClass(s),a=n(this).addClass(s)}).on("mouseleave touchend MSPointerUp pointerup",function(t){r=n(t.target).parents(u),a&&a.not(r).removeClass(s)})}return o}); \ No newline at end of file | ||
diff --git a/js/core/cover.js b/js/core/cover.js new file mode 100755 index 0000000..046ac9d --- /dev/null +++ b/js/core/cover.js | |||
@@ -0,0 +1,95 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI){ | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('cover', { | ||
7 | |||
8 | defaults: { | ||
9 | automute : true | ||
10 | }, | ||
11 | |||
12 | boot: function() { | ||
13 | |||
14 | // auto init | ||
15 | UI.ready(function(context) { | ||
16 | |||
17 | UI.$("[data-uk-cover]", context).each(function(){ | ||
18 | |||
19 | var ele = UI.$(this); | ||
20 | |||
21 | if(!ele.data("cover")) { | ||
22 | var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover"))); | ||
23 | } | ||
24 | }); | ||
25 | }); | ||
26 | }, | ||
27 | |||
28 | init: function() { | ||
29 | |||
30 | this.parent = this.element.parent(); | ||
31 | |||
32 | UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){ | ||
33 | this.check(); | ||
34 | }.bind(this), 100)); | ||
35 | |||
36 | this.on("display.uk.check", function(e) { | ||
37 | if(this.element.is(":visible")) this.check(); | ||
38 | }.bind(this)); | ||
39 | |||
40 | this.check(); | ||
41 | |||
42 | if (this.element.is('iframe') && this.options.automute) { | ||
43 | |||
44 | var src = this.element.attr('src'); | ||
45 | |||
46 | this.element.attr('src', '').on('load', function(){ | ||
47 | |||
48 | this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*'); | ||
49 | |||
50 | }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join('')); | ||
51 | } | ||
52 | }, | ||
53 | |||
54 | check: function() { | ||
55 | |||
56 | this.element.css({ | ||
57 | 'width' : '', | ||
58 | 'height' : '' | ||
59 | }); | ||
60 | |||
61 | this.dimension = {w: this.element.width(), h: this.element.height()}; | ||
62 | |||
63 | if (this.element.attr('width') && !isNaN(this.element.attr('width'))) { | ||
64 | this.dimension.w = this.element.attr('width'); | ||
65 | } | ||
66 | |||
67 | if (this.element.attr('height') && !isNaN(this.element.attr('height'))) { | ||
68 | this.dimension.h = this.element.attr('height'); | ||
69 | } | ||
70 | |||
71 | this.ratio = this.dimension.w / this.dimension.h; | ||
72 | |||
73 | var w = this.parent.width(), h = this.parent.height(), width, height; | ||
74 | |||
75 | // if element height < parent height (gap underneath) | ||
76 | if ((w / this.ratio) < h) { | ||
77 | |||
78 | width = Math.ceil(h * this.ratio); | ||
79 | height = h; | ||
80 | |||
81 | // element width < parent width (gap to right) | ||
82 | } else { | ||
83 | |||
84 | width = w; | ||
85 | height = Math.ceil(w / this.ratio); | ||
86 | } | ||
87 | |||
88 | this.element.css({ | ||
89 | 'width' : width, | ||
90 | 'height' : height | ||
91 | }); | ||
92 | } | ||
93 | }); | ||
94 | |||
95 | })(UIkit); | ||
diff --git a/js/core/cover.min.js b/js/core/cover.min.js new file mode 100755 index 0000000..6bc18a9 --- /dev/null +++ b/js/core/cover.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";t.component("cover",{defaults:{automute:!0},boot:function(){t.ready(function(i){t.$("[data-uk-cover]",i).each(function(){var i=t.$(this);if(!i.data("cover")){t.cover(i,t.Utils.options(i.attr("data-uk-cover")))}})})},init:function(){if(this.parent=this.element.parent(),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){this.check()}.bind(this),100)),this.on("display.uk.check",function(){this.element.is(":visible")&&this.check()}.bind(this)),this.check(),this.element.is("iframe")&&this.options.automute){var i=this.element.attr("src");this.element.attr("src","").on("load",function(){this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}',"*")}).attr("src",[i,i.indexOf("?")>-1?"&":"?","enablejsapi=1&api=1"].join(""))}},check:function(){this.element.css({width:"",height:""}),this.dimension={w:this.element.width(),h:this.element.height()},this.element.attr("width")&&!isNaN(this.element.attr("width"))&&(this.dimension.w=this.element.attr("width")),this.element.attr("height")&&!isNaN(this.element.attr("height"))&&(this.dimension.h=this.element.attr("height")),this.ratio=this.dimension.w/this.dimension.h;var t,i,e=this.parent.width(),n=this.parent.height();e/this.ratio<n?(t=Math.ceil(n*this.ratio),i=n):(t=e,i=Math.ceil(e/this.ratio)),this.element.css({width:t,height:i})}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/dropdown.js b/js/core/dropdown.js new file mode 100755 index 0000000..1fa7035 --- /dev/null +++ b/js/core/dropdown.js | |||
@@ -0,0 +1,525 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var active = false, hoverIdle, flips = { | ||
7 | 'x': { | ||
8 | "bottom-left" : 'bottom-right', | ||
9 | "bottom-right" : 'bottom-left', | ||
10 | "bottom-center" : 'bottom-center', | ||
11 | "top-left" : 'top-right', | ||
12 | "top-right" : 'top-left', | ||
13 | "top-center" : 'top-center', | ||
14 | "left-top" : 'right-top', | ||
15 | "left-bottom" : 'right-bottom', | ||
16 | "left-center" : 'right-center', | ||
17 | "right-top" : 'left-top', | ||
18 | "right-bottom" : 'left-bottom', | ||
19 | "right-center" : 'left-center' | ||
20 | }, | ||
21 | 'y': { | ||
22 | "bottom-left" : 'top-left', | ||
23 | "bottom-right" : 'top-right', | ||
24 | "bottom-center" : 'top-center', | ||
25 | "top-left" : 'bottom-left', | ||
26 | "top-right" : 'bottom-right', | ||
27 | "top-center" : 'bottom-center', | ||
28 | "left-top" : 'left-bottom', | ||
29 | "left-bottom" : 'left-top', | ||
30 | "left-center" : 'left-center', | ||
31 | "right-top" : 'right-bottom', | ||
32 | "right-bottom" : 'right-top', | ||
33 | "right-center" : 'right-center' | ||
34 | }, | ||
35 | 'xy': { | ||
36 | "bottom-left" : 'top-right', | ||
37 | "bottom-right" : 'top-left', | ||
38 | "bottom-center" : 'top-center', | ||
39 | "top-left" : 'bottom-right', | ||
40 | "top-right" : 'bottom-left', | ||
41 | "top-center" : 'bottom-center', | ||
42 | "left-top" : 'right-bottom', | ||
43 | "left-bottom" : 'right-top', | ||
44 | "left-center" : 'right-center', | ||
45 | "right-top" : 'left-bottom', | ||
46 | "right-bottom" : 'left-top', | ||
47 | "right-center" : 'left-center' | ||
48 | } | ||
49 | }; | ||
50 | |||
51 | UI.component('dropdown', { | ||
52 | |||
53 | defaults: { | ||
54 | 'mode' : 'hover', | ||
55 | 'pos' : 'bottom-left', | ||
56 | 'offset' : 0, | ||
57 | 'remaintime' : 800, | ||
58 | 'justify' : false, | ||
59 | 'boundary' : UI.$win, | ||
60 | 'delay' : 0, | ||
61 | 'dropdownSelector': '.uk-dropdown,.uk-dropdown-blank', | ||
62 | 'hoverDelayIdle' : 250, | ||
63 | 'preventflip' : false | ||
64 | }, | ||
65 | |||
66 | remainIdle: false, | ||
67 | |||
68 | boot: function() { | ||
69 | |||
70 | var triggerevent = UI.support.touch ? "click" : "mouseenter"; | ||
71 | |||
72 | // init code | ||
73 | UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) { | ||
74 | |||
75 | var ele = UI.$(this); | ||
76 | |||
77 | if (!ele.data("dropdown")) { | ||
78 | |||
79 | var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown"))); | ||
80 | |||
81 | if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) { | ||
82 | dropdown.element.trigger(triggerevent); | ||
83 | } | ||
84 | |||
85 | if (dropdown.element.find(dropdown.options.dropdownSelector).length) { | ||
86 | e.preventDefault(); | ||
87 | } | ||
88 | } | ||
89 | }); | ||
90 | }, | ||
91 | |||
92 | init: function() { | ||
93 | |||
94 | var $this = this; | ||
95 | |||
96 | this.dropdown = this.find(this.options.dropdownSelector); | ||
97 | this.offsetParent = this.dropdown.parents().filter(function() { | ||
98 | return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1; | ||
99 | }).slice(0,1); | ||
100 | |||
101 | this.centered = this.dropdown.hasClass('uk-dropdown-center'); | ||
102 | this.justified = this.options.justify ? UI.$(this.options.justify) : false; | ||
103 | |||
104 | this.boundary = UI.$(this.options.boundary); | ||
105 | |||
106 | if (!this.boundary.length) { | ||
107 | this.boundary = UI.$win; | ||
108 | } | ||
109 | |||
110 | // legacy DEPRECATED! | ||
111 | if (this.dropdown.hasClass('uk-dropdown-up')) { | ||
112 | this.options.pos = 'top-left'; | ||
113 | } | ||
114 | if (this.dropdown.hasClass('uk-dropdown-flip')) { | ||
115 | this.options.pos = this.options.pos.replace('left','right'); | ||
116 | } | ||
117 | if (this.dropdown.hasClass('uk-dropdown-center')) { | ||
118 | this.options.pos = this.options.pos.replace(/(left|right)/,'center'); | ||
119 | } | ||
120 | //-- end legacy | ||
121 | |||
122 | // Init ARIA | ||
123 | this.element.attr('aria-haspopup', 'true'); | ||
124 | this.element.attr('aria-expanded', this.element.hasClass("uk-open")); | ||
125 | |||
126 | if (this.options.mode == "click" || UI.support.touch) { | ||
127 | |||
128 | this.on("click.uk.dropdown", function(e) { | ||
129 | |||
130 | var $target = UI.$(e.target); | ||
131 | |||
132 | if (!$target.parents($this.options.dropdownSelector).length) { | ||
133 | |||
134 | if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){ | ||
135 | e.preventDefault(); | ||
136 | } | ||
137 | |||
138 | $target.blur(); | ||
139 | } | ||
140 | |||
141 | if (!$this.element.hasClass('uk-open')) { | ||
142 | |||
143 | $this.show(); | ||
144 | |||
145 | } else { | ||
146 | |||
147 | if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) { | ||
148 | $this.hide(); | ||
149 | } | ||
150 | } | ||
151 | }); | ||
152 | |||
153 | } else { | ||
154 | |||
155 | this.on("mouseenter", function(e) { | ||
156 | |||
157 | $this.trigger('pointerenter.uk.dropdown', [$this]); | ||
158 | |||
159 | if ($this.remainIdle) { | ||
160 | clearTimeout($this.remainIdle); | ||
161 | } | ||
162 | |||
163 | if (hoverIdle) { | ||
164 | clearTimeout(hoverIdle); | ||
165 | } | ||
166 | |||
167 | if (active && active == $this) { | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | // pseudo manuAim | ||
172 | if (active && active != $this) { | ||
173 | |||
174 | hoverIdle = setTimeout(function() { | ||
175 | hoverIdle = setTimeout($this.show.bind($this), $this.options.delay); | ||
176 | }, $this.options.hoverDelayIdle); | ||
177 | |||
178 | } else { | ||
179 | |||
180 | hoverIdle = setTimeout($this.show.bind($this), $this.options.delay); | ||
181 | } | ||
182 | |||
183 | }).on("mouseleave", function() { | ||
184 | |||
185 | if (hoverIdle) { | ||
186 | clearTimeout(hoverIdle); | ||
187 | } | ||
188 | |||
189 | $this.remainIdle = setTimeout(function() { | ||
190 | if (active && active == $this) $this.hide(); | ||
191 | }, $this.options.remaintime); | ||
192 | |||
193 | $this.trigger('pointerleave.uk.dropdown', [$this]); | ||
194 | |||
195 | }).on("click", function(e){ | ||
196 | |||
197 | var $target = UI.$(e.target); | ||
198 | |||
199 | if ($this.remainIdle) { | ||
200 | clearTimeout($this.remainIdle); | ||
201 | } | ||
202 | |||
203 | if (active && active == $this) { | ||
204 | if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) { | ||
205 | $this.hide(); | ||
206 | } | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){ | ||
211 | e.preventDefault(); | ||
212 | } | ||
213 | |||
214 | $this.show(); | ||
215 | }); | ||
216 | } | ||
217 | }, | ||
218 | |||
219 | show: function(){ | ||
220 | |||
221 | UI.$html.off("click.outer.dropdown"); | ||
222 | |||
223 | if (active && active != this) { | ||
224 | active.hide(true); | ||
225 | } | ||
226 | |||
227 | if (hoverIdle) { | ||
228 | clearTimeout(hoverIdle); | ||
229 | } | ||
230 | |||
231 | this.trigger('beforeshow.uk.dropdown', [this]); | ||
232 | |||
233 | this.checkDimensions(); | ||
234 | this.element.addClass('uk-open'); | ||
235 | |||
236 | // Update ARIA | ||
237 | this.element.attr('aria-expanded', 'true'); | ||
238 | |||
239 | this.trigger('show.uk.dropdown', [this]); | ||
240 | |||
241 | UI.Utils.checkDisplay(this.dropdown, true); | ||
242 | active = this; | ||
243 | |||
244 | this.registerOuterClick(); | ||
245 | }, | ||
246 | |||
247 | hide: function(force) { | ||
248 | |||
249 | this.trigger('beforehide.uk.dropdown', [this, force]); | ||
250 | |||
251 | this.element.removeClass('uk-open'); | ||
252 | |||
253 | if (this.remainIdle) { | ||
254 | clearTimeout(this.remainIdle); | ||
255 | } | ||
256 | |||
257 | this.remainIdle = false; | ||
258 | |||
259 | // Update ARIA | ||
260 | this.element.attr('aria-expanded', 'false'); | ||
261 | |||
262 | this.trigger('hide.uk.dropdown', [this, force]); | ||
263 | |||
264 | if (active == this) active = false; | ||
265 | }, | ||
266 | |||
267 | registerOuterClick: function(){ | ||
268 | |||
269 | var $this = this; | ||
270 | |||
271 | UI.$html.off("click.outer.dropdown"); | ||
272 | |||
273 | setTimeout(function() { | ||
274 | |||
275 | UI.$html.on("click.outer.dropdown", function(e) { | ||
276 | |||
277 | if (hoverIdle) { | ||
278 | clearTimeout(hoverIdle); | ||
279 | } | ||
280 | |||
281 | var $target = UI.$(e.target); | ||
282 | |||
283 | if (active == $this && !$this.element.find(e.target).length) { | ||
284 | $this.hide(true); | ||
285 | UI.$html.off("click.outer.dropdown"); | ||
286 | } | ||
287 | }); | ||
288 | }, 10); | ||
289 | }, | ||
290 | |||
291 | checkDimensions: function() { | ||
292 | |||
293 | if (!this.dropdown.length) return; | ||
294 | |||
295 | // reset | ||
296 | this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({ | ||
297 | 'top-left':'', | ||
298 | 'left':'', | ||
299 | 'margin-left' :'', | ||
300 | 'margin-right':'' | ||
301 | }); | ||
302 | |||
303 | if (this.justified && this.justified.length) { | ||
304 | this.dropdown.css("min-width", ""); | ||
305 | } | ||
306 | |||
307 | var $this = this, | ||
308 | pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}), | ||
309 | posoffset = this.options.offset, | ||
310 | dropdown = this.dropdown, | ||
311 | offset = dropdown.show().offset() || {left: 0, top: 0}, | ||
312 | width = dropdown.outerWidth(), | ||
313 | height = dropdown.outerHeight(), | ||
314 | boundarywidth = this.boundary.width(), | ||
315 | boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0}, | ||
316 | dpos = this.options.pos; | ||
317 | |||
318 | var variants = { | ||
319 | "bottom-left" : {top: 0 + pos.height + posoffset, left: 0}, | ||
320 | "bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width}, | ||
321 | "bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2}, | ||
322 | "top-left" : {top: 0 - height - posoffset, left: 0}, | ||
323 | "top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width}, | ||
324 | "top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2}, | ||
325 | "left-top" : {top: 0, left: 0 - width - posoffset}, | ||
326 | "left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset}, | ||
327 | "left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset}, | ||
328 | "right-top" : {top: 0, left: 0 + pos.width + posoffset}, | ||
329 | "right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset}, | ||
330 | "right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset} | ||
331 | }, | ||
332 | css = {}, | ||
333 | pp; | ||
334 | |||
335 | pp = dpos.split('-'); | ||
336 | css = variants[dpos] ? variants[dpos] : variants['bottom-left']; | ||
337 | |||
338 | // justify dropdown | ||
339 | if (this.justified && this.justified.length) { | ||
340 | justify(dropdown.css({left:0}), this.justified, boundarywidth); | ||
341 | } else { | ||
342 | |||
343 | if (this.options.preventflip !== true) { | ||
344 | |||
345 | var fdpos; | ||
346 | |||
347 | switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) { | ||
348 | case "x": | ||
349 | if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top'; | ||
350 | break; | ||
351 | case "y": | ||
352 | if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left'; | ||
353 | break; | ||
354 | case "xy": | ||
355 | if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom'; | ||
356 | break; | ||
357 | } | ||
358 | |||
359 | if (fdpos) { | ||
360 | |||
361 | pp = fdpos.split('-'); | ||
362 | css = variants[fdpos] ? variants[fdpos] : variants['bottom-left']; | ||
363 | |||
364 | // check flipped | ||
365 | if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) { | ||
366 | pp = dpos.split('-'); | ||
367 | css = variants[dpos] ? variants[dpos] : variants['bottom-left']; | ||
368 | } | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | |||
373 | if (width > boundarywidth) { | ||
374 | dropdown.addClass("uk-dropdown-stack"); | ||
375 | this.trigger('stack.uk.dropdown', [this]); | ||
376 | } | ||
377 | |||
378 | dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]); | ||
379 | }, | ||
380 | |||
381 | checkBoundary: function(left, top, width, height, boundarywidth) { | ||
382 | |||
383 | var axis = ""; | ||
384 | |||
385 | if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) { | ||
386 | axis += "x"; | ||
387 | } | ||
388 | |||
389 | if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) { | ||
390 | axis += "y"; | ||
391 | } | ||
392 | |||
393 | return axis; | ||
394 | } | ||
395 | }); | ||
396 | |||
397 | |||
398 | UI.component('dropdownOverlay', { | ||
399 | |||
400 | defaults: { | ||
401 | 'justify' : false, | ||
402 | 'cls' : '', | ||
403 | 'duration': 200 | ||
404 | }, | ||
405 | |||
406 | boot: function() { | ||
407 | |||
408 | // init code | ||
409 | UI.ready(function(context) { | ||
410 | |||
411 | UI.$("[data-uk-dropdown-overlay]", context).each(function() { | ||
412 | var ele = UI.$(this); | ||
413 | |||
414 | if (!ele.data("dropdownOverlay")) { | ||
415 | UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay"))); | ||
416 | } | ||
417 | }); | ||
418 | }); | ||
419 | }, | ||
420 | |||
421 | init: function() { | ||
422 | |||
423 | var $this = this; | ||
424 | |||
425 | this.justified = this.options.justify ? UI.$(this.options.justify) : false; | ||
426 | this.overlay = this.element.find('uk-dropdown-overlay'); | ||
427 | |||
428 | if (!this.overlay.length) { | ||
429 | this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element); | ||
430 | } | ||
431 | |||
432 | this.overlay.addClass(this.options.cls); | ||
433 | |||
434 | this.on({ | ||
435 | |||
436 | 'beforeshow.uk.dropdown': function(e, dropdown) { | ||
437 | $this.dropdown = dropdown; | ||
438 | |||
439 | if ($this.justified && $this.justified.length) { | ||
440 | justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth()); | ||
441 | } | ||
442 | }, | ||
443 | |||
444 | 'show.uk.dropdown': function(e, dropdown) { | ||
445 | |||
446 | var h = $this.dropdown.dropdown.outerHeight(true); | ||
447 | |||
448 | $this.dropdown.element.removeClass('uk-open'); | ||
449 | |||
450 | $this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() { | ||
451 | |||
452 | $this.dropdown.dropdown.css('visibility', ''); | ||
453 | $this.dropdown.element.addClass('uk-open'); | ||
454 | |||
455 | UI.Utils.checkDisplay($this.dropdown.dropdown, true); | ||
456 | }); | ||
457 | |||
458 | $this.pointerleave = false; | ||
459 | }, | ||
460 | |||
461 | 'hide.uk.dropdown': function() { | ||
462 | $this.overlay.stop().animate({height: 0}, $this.options.duration); | ||
463 | }, | ||
464 | |||
465 | 'pointerenter.uk.dropdown': function(e, dropdown) { | ||
466 | clearTimeout($this.remainIdle); | ||
467 | }, | ||
468 | |||
469 | 'pointerleave.uk.dropdown': function(e, dropdown) { | ||
470 | $this.pointerleave = true; | ||
471 | } | ||
472 | }); | ||
473 | |||
474 | |||
475 | this.overlay.on({ | ||
476 | |||
477 | 'mouseenter': function() { | ||
478 | if ($this.remainIdle) { | ||
479 | clearTimeout($this.dropdown.remainIdle); | ||
480 | clearTimeout($this.remainIdle); | ||
481 | } | ||
482 | }, | ||
483 | |||
484 | 'mouseleave': function(){ | ||
485 | |||
486 | if ($this.pointerleave && active) { | ||
487 | |||
488 | $this.remainIdle = setTimeout(function() { | ||
489 | if(active) active.hide(); | ||
490 | }, active.options.remaintime); | ||
491 | } | ||
492 | } | ||
493 | }) | ||
494 | } | ||
495 | |||
496 | }); | ||
497 | |||
498 | |||
499 | function justify(ele, justifyTo, boundarywidth, offset) { | ||
500 | |||
501 | ele = UI.$(ele); | ||
502 | justifyTo = UI.$(justifyTo); | ||
503 | boundarywidth = boundarywidth || window.innerWidth; | ||
504 | offset = offset || ele.offset(); | ||
505 | |||
506 | if (justifyTo.length) { | ||
507 | |||
508 | var jwidth = justifyTo.outerWidth(); | ||
509 | |||
510 | ele.css("min-width", jwidth); | ||
511 | |||
512 | if (UI.langdirection == 'right') { | ||
513 | |||
514 | var right1 = boundarywidth - (justifyTo.offset().left + jwidth), | ||
515 | right2 = boundarywidth - (ele.offset().left + ele.outerWidth()); | ||
516 | |||
517 | ele.css("margin-right", right1 - right2); | ||
518 | |||
519 | } else { | ||
520 | ele.css("margin-left", justifyTo.offset().left - offset.left); | ||
521 | } | ||
522 | } | ||
523 | } | ||
524 | |||
525 | })(UIkit); | ||
diff --git a/js/core/dropdown.min.js b/js/core/dropdown.min.js new file mode 100755 index 0000000..410c82e --- /dev/null +++ b/js/core/dropdown.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";function o(o,e,i,n){if(o=t.$(o),e=t.$(e),i=i||window.innerWidth,n=n||o.offset(),e.length){var r=e.outerWidth();if(o.css("min-width",r),"right"==t.langdirection){var s=i-(e.offset().left+r),d=i-(o.offset().left+o.outerWidth());o.css("margin-right",s-d)}else o.css("margin-left",e.offset().left-n.left)}}var e,i=!1,n={x:{"bottom-left":"bottom-right","bottom-right":"bottom-left","bottom-center":"bottom-center","top-left":"top-right","top-right":"top-left","top-center":"top-center","left-top":"right-top","left-bottom":"right-bottom","left-center":"right-center","right-top":"left-top","right-bottom":"left-bottom","right-center":"left-center"},y:{"bottom-left":"top-left","bottom-right":"top-right","bottom-center":"top-center","top-left":"bottom-left","top-right":"bottom-right","top-center":"bottom-center","left-top":"left-bottom","left-bottom":"left-top","left-center":"left-center","right-top":"right-bottom","right-bottom":"right-top","right-center":"right-center"},xy:{"bottom-left":"top-right","bottom-right":"top-left","bottom-center":"top-center","top-left":"bottom-right","top-right":"bottom-left","top-center":"bottom-center","left-top":"right-bottom","left-bottom":"right-top","left-center":"right-center","right-top":"left-bottom","right-bottom":"left-top","right-center":"left-center"}};t.component("dropdown",{defaults:{mode:"hover",pos:"bottom-left",offset:0,remaintime:800,justify:!1,boundary:t.$win,delay:0,dropdownSelector:".uk-dropdown,.uk-dropdown-blank",hoverDelayIdle:250,preventflip:!1},remainIdle:!1,boot:function(){var o=t.support.touch?"click":"mouseenter";t.$html.on(o+".dropdown.uikit","[data-uk-dropdown]",function(e){var i=t.$(this);if(!i.data("dropdown")){var n=t.dropdown(i,t.Utils.options(i.attr("data-uk-dropdown")));("click"==o||"mouseenter"==o&&"hover"==n.options.mode)&&n.element.trigger(o),n.element.find(n.options.dropdownSelector).length&&e.preventDefault()}})},init:function(){var o=this;this.dropdown=this.find(this.options.dropdownSelector),this.offsetParent=this.dropdown.parents().filter(function(){return-1!==t.$.inArray(t.$(this).css("position"),["relative","fixed","absolute"])}).slice(0,1),this.centered=this.dropdown.hasClass("uk-dropdown-center"),this.justified=this.options.justify?t.$(this.options.justify):!1,this.boundary=t.$(this.options.boundary),this.boundary.length||(this.boundary=t.$win),this.dropdown.hasClass("uk-dropdown-up")&&(this.options.pos="top-left"),this.dropdown.hasClass("uk-dropdown-flip")&&(this.options.pos=this.options.pos.replace("left","right")),this.dropdown.hasClass("uk-dropdown-center")&&(this.options.pos=this.options.pos.replace(/(left|right)/,"center")),this.element.attr("aria-haspopup","true"),this.element.attr("aria-expanded",this.element.hasClass("uk-open")),"click"==this.options.mode||t.support.touch?this.on("click.uk.dropdown",function(e){var i=t.$(e.target);i.parents(o.options.dropdownSelector).length||((i.is("a[href='#']")||i.parent().is("a[href='#']")||o.dropdown.length&&!o.dropdown.is(":visible"))&&e.preventDefault(),i.blur()),o.element.hasClass("uk-open")?(!o.dropdown.find(e.target).length||i.is(".uk-dropdown-close")||i.parents(".uk-dropdown-close").length)&&o.hide():o.show()}):this.on("mouseenter",function(){o.trigger("pointerenter.uk.dropdown",[o]),o.remainIdle&&clearTimeout(o.remainIdle),e&&clearTimeout(e),i&&i==o||(e=i&&i!=o?setTimeout(function(){e=setTimeout(o.show.bind(o),o.options.delay)},o.options.hoverDelayIdle):setTimeout(o.show.bind(o),o.options.delay))}).on("mouseleave",function(){e&&clearTimeout(e),o.remainIdle=setTimeout(function(){i&&i==o&&o.hide()},o.options.remaintime),o.trigger("pointerleave.uk.dropdown",[o])}).on("click",function(e){var n=t.$(e.target);return o.remainIdle&&clearTimeout(o.remainIdle),i&&i==o?((!o.dropdown.find(e.target).length||n.is(".uk-dropdown-close")||n.parents(".uk-dropdown-close").length)&&o.hide(),void 0):((n.is("a[href='#']")||n.parent().is("a[href='#']"))&&e.preventDefault(),o.show(),void 0)})},show:function(){t.$html.off("click.outer.dropdown"),i&&i!=this&&i.hide(!0),e&&clearTimeout(e),this.trigger("beforeshow.uk.dropdown",[this]),this.checkDimensions(),this.element.addClass("uk-open"),this.element.attr("aria-expanded","true"),this.trigger("show.uk.dropdown",[this]),t.Utils.checkDisplay(this.dropdown,!0),i=this,this.registerOuterClick()},hide:function(t){this.trigger("beforehide.uk.dropdown",[this,t]),this.element.removeClass("uk-open"),this.remainIdle&&clearTimeout(this.remainIdle),this.remainIdle=!1,this.element.attr("aria-expanded","false"),this.trigger("hide.uk.dropdown",[this,t]),i==this&&(i=!1)},registerOuterClick:function(){var o=this;t.$html.off("click.outer.dropdown"),setTimeout(function(){t.$html.on("click.outer.dropdown",function(n){e&&clearTimeout(e);t.$(n.target);i!=o||o.element.find(n.target).length||(o.hide(!0),t.$html.off("click.outer.dropdown"))})},10)},checkDimensions:function(){if(this.dropdown.length){this.dropdown.removeClass("uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack").css({"top-left":"",left:"","margin-left":"","margin-right":""}),this.justified&&this.justified.length&&this.dropdown.css("min-width","");var e,i=t.$.extend({},this.offsetParent.offset(),{width:this.offsetParent[0].offsetWidth,height:this.offsetParent[0].offsetHeight}),r=this.options.offset,s=this.dropdown,d=(s.show().offset()||{left:0,top:0},s.outerWidth()),h=s.outerHeight(),l=this.boundary.width(),p=(this.boundary[0]!==window&&this.boundary.offset()?this.boundary.offset():{top:0,left:0},this.options.pos),a={"bottom-left":{top:0+i.height+r,left:0},"bottom-right":{top:0+i.height+r,left:0+i.width-d},"bottom-center":{top:0+i.height+r,left:0+i.width/2-d/2},"top-left":{top:0-h-r,left:0},"top-right":{top:0-h-r,left:0+i.width-d},"top-center":{top:0-h-r,left:0+i.width/2-d/2},"left-top":{top:0,left:0-d-r},"left-bottom":{top:0+i.height-h,left:0-d-r},"left-center":{top:0+i.height/2-h/2,left:0-d-r},"right-top":{top:0,left:0+i.width+r},"right-bottom":{top:0+i.height-h,left:0+i.width+r},"right-center":{top:0+i.height/2-h/2,left:0+i.width+r}},f={};if(e=p.split("-"),f=a[p]?a[p]:a["bottom-left"],this.justified&&this.justified.length)o(s.css({left:0}),this.justified,l);else if(this.options.preventflip!==!0){var u;switch(this.checkBoundary(i.left+f.left,i.top+f.top,d,h,l)){case"x":"x"!==this.options.preventflip&&(u=n.x[p]||"right-top");break;case"y":"y"!==this.options.preventflip&&(u=n.y[p]||"top-left");break;case"xy":this.options.preventflip||(u=n.xy[p]||"right-bottom")}u&&(e=u.split("-"),f=a[u]?a[u]:a["bottom-left"],this.checkBoundary(i.left+f.left,i.top+f.top,d,h,l)&&(e=p.split("-"),f=a[p]?a[p]:a["bottom-left"]))}d>l&&(s.addClass("uk-dropdown-stack"),this.trigger("stack.uk.dropdown",[this])),s.css(f).css("display","").addClass("uk-dropdown-"+e[0])}},checkBoundary:function(o,e,i,n,r){var s="";return(0>o||o-t.$win.scrollLeft()+i>r)&&(s+="x"),(e-t.$win.scrollTop()<0||e-t.$win.scrollTop()+n>window.innerHeight)&&(s+="y"),s}}),t.component("dropdownOverlay",{defaults:{justify:!1,cls:"",duration:200},boot:function(){t.ready(function(o){t.$("[data-uk-dropdown-overlay]",o).each(function(){var o=t.$(this);o.data("dropdownOverlay")||t.dropdownOverlay(o,t.Utils.options(o.attr("data-uk-dropdown-overlay")))})})},init:function(){var e=this;this.justified=this.options.justify?t.$(this.options.justify):!1,this.overlay=this.element.find("uk-dropdown-overlay"),this.overlay.length||(this.overlay=t.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element)),this.overlay.addClass(this.options.cls),this.on({"beforeshow.uk.dropdown":function(t,i){e.dropdown=i,e.justified&&e.justified.length&&o(e.overlay.css({display:"block","margin-left":"","margin-right":""}),e.justified,e.justified.outerWidth())},"show.uk.dropdown":function(){var o=e.dropdown.dropdown.outerHeight(!0);e.dropdown.element.removeClass("uk-open"),e.overlay.stop().css("display","block").animate({height:o},e.options.duration,function(){e.dropdown.dropdown.css("visibility",""),e.dropdown.element.addClass("uk-open"),t.Utils.checkDisplay(e.dropdown.dropdown,!0)}),e.pointerleave=!1},"hide.uk.dropdown":function(){e.overlay.stop().animate({height:0},e.options.duration)},"pointerenter.uk.dropdown":function(){clearTimeout(e.remainIdle)},"pointerleave.uk.dropdown":function(){e.pointerleave=!0}}),this.overlay.on({mouseenter:function(){e.remainIdle&&(clearTimeout(e.dropdown.remainIdle),clearTimeout(e.remainIdle))},mouseleave:function(){e.pointerleave&&i&&(e.remainIdle=setTimeout(function(){i&&i.hide()},i.options.remaintime))}})}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/grid.js b/js/core/grid.js new file mode 100755 index 0000000..2552f93 --- /dev/null +++ b/js/core/grid.js | |||
@@ -0,0 +1,117 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var grids = []; | ||
7 | |||
8 | UI.component('gridMatchHeight', { | ||
9 | |||
10 | defaults: { | ||
11 | "target" : false, | ||
12 | "row" : true, | ||
13 | "ignorestacked" : false, | ||
14 | "observe" : false | ||
15 | }, | ||
16 | |||
17 | boot: function() { | ||
18 | |||
19 | // init code | ||
20 | UI.ready(function(context) { | ||
21 | |||
22 | UI.$("[data-uk-grid-match]", context).each(function() { | ||
23 | var grid = UI.$(this), obj; | ||
24 | |||
25 | if (!grid.data("gridMatchHeight")) { | ||
26 | obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match"))); | ||
27 | } | ||
28 | }); | ||
29 | }); | ||
30 | }, | ||
31 | |||
32 | init: function() { | ||
33 | |||
34 | var $this = this; | ||
35 | |||
36 | this.columns = this.element.children(); | ||
37 | this.elements = this.options.target ? this.find(this.options.target) : this.columns; | ||
38 | |||
39 | if (!this.columns.length) return; | ||
40 | |||
41 | UI.$win.on('load resize orientationchange', (function() { | ||
42 | |||
43 | var fn = function() { | ||
44 | if ($this.element.is(":visible")) $this.match(); | ||
45 | }; | ||
46 | |||
47 | UI.$(function() { fn(); }); | ||
48 | |||
49 | return UI.Utils.debounce(fn, 50); | ||
50 | })()); | ||
51 | |||
52 | if (this.options.observe) { | ||
53 | |||
54 | UI.domObserve(this.element, function(e) { | ||
55 | if ($this.element.is(":visible")) $this.match(); | ||
56 | }); | ||
57 | } | ||
58 | |||
59 | this.on("display.uk.check", function(e) { | ||
60 | if(this.element.is(":visible")) this.match(); | ||
61 | }.bind(this)); | ||
62 | |||
63 | grids.push(this); | ||
64 | }, | ||
65 | |||
66 | match: function() { | ||
67 | |||
68 | var firstvisible = this.columns.filter(":visible:first"); | ||
69 | |||
70 | if (!firstvisible.length) return; | ||
71 | |||
72 | var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100; | ||
73 | |||
74 | if (stacked && !this.options.ignorestacked) { | ||
75 | this.revert(); | ||
76 | } else { | ||
77 | UI.Utils.matchHeights(this.elements, this.options); | ||
78 | } | ||
79 | |||
80 | return this; | ||
81 | }, | ||
82 | |||
83 | revert: function() { | ||
84 | this.elements.css('min-height', ''); | ||
85 | return this; | ||
86 | } | ||
87 | }); | ||
88 | |||
89 | UI.component('gridMargin', { | ||
90 | |||
91 | defaults: { | ||
92 | cls : 'uk-grid-margin', | ||
93 | rowfirst : 'uk-row-first' | ||
94 | }, | ||
95 | |||
96 | boot: function() { | ||
97 | |||
98 | // init code | ||
99 | UI.ready(function(context) { | ||
100 | |||
101 | UI.$("[data-uk-grid-margin]", context).each(function() { | ||
102 | var grid = UI.$(this), obj; | ||
103 | |||
104 | if (!grid.data("gridMargin")) { | ||
105 | obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin"))); | ||
106 | } | ||
107 | }); | ||
108 | }); | ||
109 | }, | ||
110 | |||
111 | init: function() { | ||
112 | |||
113 | var stackMargin = UI.stackMargin(this.element, this.options); | ||
114 | } | ||
115 | }); | ||
116 | |||
117 | })(UIkit); | ||
diff --git a/js/core/grid.min.js b/js/core/grid.min.js new file mode 100755 index 0000000..fe52a52 --- /dev/null +++ b/js/core/grid.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";var i=[];t.component("gridMatchHeight",{defaults:{target:!1,row:!0,ignorestacked:!1,observe:!1},boot:function(){t.ready(function(i){t.$("[data-uk-grid-match]",i).each(function(){var i,n=t.$(this);n.data("gridMatchHeight")||(i=t.gridMatchHeight(n,t.Utils.options(n.attr("data-uk-grid-match"))))})})},init:function(){var n=this;this.columns=this.element.children(),this.elements=this.options.target?this.find(this.options.target):this.columns,this.columns.length&&(t.$win.on("load resize orientationchange",function(){var i=function(){n.element.is(":visible")&&n.match()};return t.$(function(){i()}),t.Utils.debounce(i,50)}()),this.options.observe&&t.domObserve(this.element,function(){n.element.is(":visible")&&n.match()}),this.on("display.uk.check",function(){this.element.is(":visible")&&this.match()}.bind(this)),i.push(this))},match:function(){var i=this.columns.filter(":visible:first");if(i.length){var n=Math.ceil(100*parseFloat(i.css("width"))/parseFloat(i.parent().css("width")))>=100;return n&&!this.options.ignorestacked?this.revert():t.Utils.matchHeights(this.elements,this.options),this}},revert:function(){return this.elements.css("min-height",""),this}}),t.component("gridMargin",{defaults:{cls:"uk-grid-margin",rowfirst:"uk-row-first"},boot:function(){t.ready(function(i){t.$("[data-uk-grid-margin]",i).each(function(){var i,n=t.$(this);n.data("gridMargin")||(i=t.gridMargin(n,t.Utils.options(n.attr("data-uk-grid-margin"))))})})},init:function(){t.stackMargin(this.element,this.options)}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/modal.js b/js/core/modal.js new file mode 100755 index 0000000..74d122d --- /dev/null +++ b/js/core/modal.js | |||
@@ -0,0 +1,393 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var active = false, activeCount = 0, $html = UI.$html, body; | ||
7 | |||
8 | UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){ | ||
9 | UI.$('.uk-modal.uk-open').each(function(){ | ||
10 | UI.$(this).data('modal').resize(); | ||
11 | }); | ||
12 | }, 150)); | ||
13 | |||
14 | UI.component('modal', { | ||
15 | |||
16 | defaults: { | ||
17 | keyboard: true, | ||
18 | bgclose: true, | ||
19 | minScrollHeight: 150, | ||
20 | center: false, | ||
21 | modal: true | ||
22 | }, | ||
23 | |||
24 | scrollable: false, | ||
25 | transition: false, | ||
26 | hasTransitioned: true, | ||
27 | |||
28 | init: function() { | ||
29 | |||
30 | if (!body) body = UI.$('body'); | ||
31 | |||
32 | if (!this.element.length) return; | ||
33 | |||
34 | var $this = this; | ||
35 | |||
36 | this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left"); | ||
37 | this.dialog = this.find(".uk-modal-dialog"); | ||
38 | |||
39 | this.active = false; | ||
40 | |||
41 | // Update ARIA | ||
42 | this.element.attr('aria-hidden', this.element.hasClass("uk-open")); | ||
43 | |||
44 | this.on("click", ".uk-modal-close", function(e) { | ||
45 | e.preventDefault(); | ||
46 | $this.hide(); | ||
47 | }).on("click", function(e) { | ||
48 | |||
49 | var target = UI.$(e.target); | ||
50 | |||
51 | if (target[0] == $this.element[0] && $this.options.bgclose) { | ||
52 | $this.hide(); | ||
53 | } | ||
54 | }); | ||
55 | |||
56 | UI.domObserve(this.element, function(e) { $this.resize(); }); | ||
57 | }, | ||
58 | |||
59 | toggle: function() { | ||
60 | return this[this.isActive() ? "hide" : "show"](); | ||
61 | }, | ||
62 | |||
63 | show: function() { | ||
64 | |||
65 | if (!this.element.length) return; | ||
66 | |||
67 | var $this = this; | ||
68 | |||
69 | if (this.isActive()) return; | ||
70 | |||
71 | if (this.options.modal && active) { | ||
72 | active.hide(true); | ||
73 | } | ||
74 | |||
75 | this.element.removeClass("uk-open").show(); | ||
76 | this.resize(true); | ||
77 | |||
78 | if (this.options.modal) { | ||
79 | active = this; | ||
80 | } | ||
81 | |||
82 | this.active = true; | ||
83 | |||
84 | activeCount++; | ||
85 | |||
86 | if (UI.support.transition) { | ||
87 | this.hasTransitioned = false; | ||
88 | this.element.one(UI.support.transition.end, function(){ | ||
89 | $this.hasTransitioned = true; | ||
90 | }).addClass("uk-open"); | ||
91 | } else { | ||
92 | this.element.addClass("uk-open"); | ||
93 | } | ||
94 | |||
95 | $html.addClass("uk-modal-page").height(); // force browser engine redraw | ||
96 | |||
97 | // Update ARIA | ||
98 | this.element.attr('aria-hidden', 'false'); | ||
99 | |||
100 | this.element.trigger("show.uk.modal"); | ||
101 | |||
102 | UI.Utils.checkDisplay(this.dialog, true); | ||
103 | |||
104 | return this; | ||
105 | }, | ||
106 | |||
107 | hide: function(force) { | ||
108 | |||
109 | if (!force && UI.support.transition && this.hasTransitioned) { | ||
110 | |||
111 | var $this = this; | ||
112 | |||
113 | this.one(UI.support.transition.end, function() { | ||
114 | $this._hide(); | ||
115 | }).removeClass("uk-open"); | ||
116 | |||
117 | } else { | ||
118 | |||
119 | this._hide(); | ||
120 | } | ||
121 | |||
122 | return this; | ||
123 | }, | ||
124 | |||
125 | resize: function(force) { | ||
126 | |||
127 | if (!this.isActive() && !force) return; | ||
128 | |||
129 | var bodywidth = body.width(); | ||
130 | |||
131 | this.scrollbarwidth = window.innerWidth - bodywidth; | ||
132 | |||
133 | body.css(this.paddingdir, this.scrollbarwidth); | ||
134 | |||
135 | this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto'); | ||
136 | |||
137 | if (!this.updateScrollable() && this.options.center) { | ||
138 | |||
139 | var dh = this.dialog.outerHeight(), | ||
140 | pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10); | ||
141 | |||
142 | if ((dh + pad) < window.innerHeight) { | ||
143 | this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad }); | ||
144 | } else { | ||
145 | this.dialog.css({'top': ''}); | ||
146 | } | ||
147 | } | ||
148 | }, | ||
149 | |||
150 | updateScrollable: function() { | ||
151 | |||
152 | // has scrollable? | ||
153 | var scrollable = this.dialog.find('.uk-overflow-container:visible:first'); | ||
154 | |||
155 | if (scrollable.length) { | ||
156 | |||
157 | scrollable.css('height', 0); | ||
158 | |||
159 | var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)), | ||
160 | dh = this.dialog.outerHeight(), | ||
161 | wh = window.innerHeight, | ||
162 | h = wh - 2*(offset < 20 ? 20:offset) - dh; | ||
163 | |||
164 | scrollable.css({ | ||
165 | 'max-height': (h < this.options.minScrollHeight ? '':h), | ||
166 | 'height':'' | ||
167 | }); | ||
168 | |||
169 | return true; | ||
170 | } | ||
171 | |||
172 | return false; | ||
173 | }, | ||
174 | |||
175 | _hide: function() { | ||
176 | |||
177 | this.active = false; | ||
178 | if (activeCount > 0) activeCount--; | ||
179 | else activeCount = 0; | ||
180 | |||
181 | this.element.hide().removeClass('uk-open'); | ||
182 | |||
183 | // Update ARIA | ||
184 | this.element.attr('aria-hidden', 'true'); | ||
185 | |||
186 | if (!activeCount) { | ||
187 | $html.removeClass('uk-modal-page'); | ||
188 | body.css(this.paddingdir, ""); | ||
189 | } | ||
190 | |||
191 | if (active===this) active = false; | ||
192 | |||
193 | this.trigger('hide.uk.modal'); | ||
194 | }, | ||
195 | |||
196 | isActive: function() { | ||
197 | return this.element.hasClass('uk-open'); | ||
198 | } | ||
199 | |||
200 | }); | ||
201 | |||
202 | UI.component('modalTrigger', { | ||
203 | |||
204 | boot: function() { | ||
205 | |||
206 | // init code | ||
207 | UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) { | ||
208 | |||
209 | var ele = UI.$(this); | ||
210 | |||
211 | if (ele.is("a")) { | ||
212 | e.preventDefault(); | ||
213 | } | ||
214 | |||
215 | if (!ele.data("modalTrigger")) { | ||
216 | var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal"))); | ||
217 | modal.show(); | ||
218 | } | ||
219 | |||
220 | }); | ||
221 | |||
222 | // close modal on esc button | ||
223 | UI.$html.on('keydown.modal.uikit', function (e) { | ||
224 | |||
225 | if (active && e.keyCode === 27 && active.options.keyboard) { // ESC | ||
226 | e.preventDefault(); | ||
227 | active.hide(); | ||
228 | } | ||
229 | }); | ||
230 | }, | ||
231 | |||
232 | init: function() { | ||
233 | |||
234 | var $this = this; | ||
235 | |||
236 | this.options = UI.$.extend({ | ||
237 | "target": $this.element.is("a") ? $this.element.attr("href") : false | ||
238 | }, this.options); | ||
239 | |||
240 | this.modal = UI.modal(this.options.target, this.options); | ||
241 | |||
242 | this.on("click", function(e) { | ||
243 | e.preventDefault(); | ||
244 | $this.show(); | ||
245 | }); | ||
246 | |||
247 | //methods | ||
248 | this.proxy(this.modal, "show hide isActive"); | ||
249 | } | ||
250 | }); | ||
251 | |||
252 | UI.modal.dialog = function(content, options) { | ||
253 | |||
254 | var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options); | ||
255 | |||
256 | modal.on("hide.uk.modal", function(){ | ||
257 | if (modal.persist) { | ||
258 | modal.persist.appendTo(modal.persist.data("modalPersistParent")); | ||
259 | modal.persist = false; | ||
260 | } | ||
261 | modal.element.remove(); | ||
262 | }); | ||
263 | |||
264 | setContent(content, modal); | ||
265 | |||
266 | return modal; | ||
267 | }; | ||
268 | |||
269 | UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>'; | ||
270 | |||
271 | UI.modal.alert = function(content, options) { | ||
272 | |||
273 | options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options); | ||
274 | |||
275 | var modal = UI.modal.dialog(([ | ||
276 | '<div class="uk-margin uk-modal-content">'+String(content)+'</div>', | ||
277 | '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>' | ||
278 | ]).join(""), options); | ||
279 | |||
280 | modal.on('show.uk.modal', function(){ | ||
281 | setTimeout(function(){ | ||
282 | modal.element.find('button:first').focus(); | ||
283 | }, 50); | ||
284 | }); | ||
285 | |||
286 | return modal.show(); | ||
287 | }; | ||
288 | |||
289 | UI.modal.confirm = function(content, onconfirm, oncancel) { | ||
290 | |||
291 | var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {}; | ||
292 | |||
293 | onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){}; | ||
294 | oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){}; | ||
295 | options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options); | ||
296 | |||
297 | var modal = UI.modal.dialog(([ | ||
298 | '<div class="uk-margin uk-modal-content">'+String(content)+'</div>', | ||
299 | '<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>' | ||
300 | ]).join(""), options); | ||
301 | |||
302 | modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){ | ||
303 | UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel(); | ||
304 | modal.hide(); | ||
305 | }); | ||
306 | |||
307 | modal.on('show.uk.modal', function(){ | ||
308 | setTimeout(function(){ | ||
309 | modal.element.find('.js-modal-confirm').focus(); | ||
310 | }, 50); | ||
311 | }); | ||
312 | |||
313 | return modal.show(); | ||
314 | }; | ||
315 | |||
316 | UI.modal.prompt = function(text, value, onsubmit, options) { | ||
317 | |||
318 | onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){}; | ||
319 | options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options); | ||
320 | |||
321 | var modal = UI.modal.dialog(([ | ||
322 | text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'', | ||
323 | '<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>', | ||
324 | '<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>' | ||
325 | ]).join(""), options), | ||
326 | |||
327 | input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){ | ||
328 | if (e.keyCode == 13) { | ||
329 | modal.element.find(".js-modal-ok").trigger('click'); | ||
330 | } | ||
331 | }); | ||
332 | |||
333 | modal.element.find(".js-modal-ok").on("click", function(){ | ||
334 | if (onsubmit(input.val())!==false){ | ||
335 | modal.hide(); | ||
336 | } | ||
337 | }); | ||
338 | |||
339 | modal.on('show.uk.modal', function(){ | ||
340 | setTimeout(function(){ | ||
341 | input.focus(); | ||
342 | }, 50); | ||
343 | }); | ||
344 | |||
345 | return modal.show(); | ||
346 | }; | ||
347 | |||
348 | UI.modal.blockUI = function(content, options) { | ||
349 | |||
350 | var modal = UI.modal.dialog(([ | ||
351 | '<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>' | ||
352 | ]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options)); | ||
353 | |||
354 | modal.content = modal.element.find('.uk-modal-content:first'); | ||
355 | |||
356 | return modal.show(); | ||
357 | }; | ||
358 | |||
359 | |||
360 | UI.modal.labels = { | ||
361 | 'Ok': 'Ok', | ||
362 | 'Cancel': 'Cancel' | ||
363 | }; | ||
364 | |||
365 | |||
366 | // helper functions | ||
367 | function setContent(content, modal){ | ||
368 | |||
369 | if(!modal) return; | ||
370 | |||
371 | if (typeof content === 'object') { | ||
372 | |||
373 | // convert DOM object to a jQuery object | ||
374 | content = content instanceof jQuery ? content : UI.$(content); | ||
375 | |||
376 | if(content.parent().length) { | ||
377 | modal.persist = content; | ||
378 | modal.persist.data("modalPersistParent", content.parent()); | ||
379 | } | ||
380 | }else if (typeof content === 'string' || typeof content === 'number') { | ||
381 | // just insert the data as innerHTML | ||
382 | content = UI.$('<div></div>').html(content); | ||
383 | }else { | ||
384 | // unsupported data type! | ||
385 | content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content); | ||
386 | } | ||
387 | |||
388 | content.appendTo(modal.element.find('.uk-modal-dialog')); | ||
389 | |||
390 | return modal; | ||
391 | } | ||
392 | |||
393 | })(UIkit); | ||
diff --git a/js/core/modal.min.js b/js/core/modal.min.js new file mode 100755 index 0000000..6dc903a --- /dev/null +++ b/js/core/modal.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";function i(i,e){return e?("object"==typeof i?(i=i instanceof jQuery?i:t.$(i),i.parent().length&&(e.persist=i,e.persist.data("modalPersistParent",i.parent()))):i="string"==typeof i||"number"==typeof i?t.$("<div></div>").html(i):t.$("<div></div>").html("UIkit.modal Error: Unsupported data type: "+typeof i),i.appendTo(e.element.find(".uk-modal-dialog")),e):void 0}var e,o=!1,n=0,s=t.$html;t.$win.on("resize orientationchange",t.Utils.debounce(function(){t.$(".uk-modal.uk-open").each(function(){t.$(this).data("modal").resize()})},150)),t.component("modal",{defaults:{keyboard:!0,bgclose:!0,minScrollHeight:150,center:!1,modal:!0},scrollable:!1,transition:!1,hasTransitioned:!0,init:function(){if(e||(e=t.$("body")),this.element.length){var i=this;this.paddingdir="padding-"+("left"==t.langdirection?"right":"left"),this.dialog=this.find(".uk-modal-dialog"),this.active=!1,this.element.attr("aria-hidden",this.element.hasClass("uk-open")),this.on("click",".uk-modal-close",function(t){t.preventDefault(),i.hide()}).on("click",function(e){var o=t.$(e.target);o[0]==i.element[0]&&i.options.bgclose&&i.hide()}),t.domObserve(this.element,function(){i.resize()})}},toggle:function(){return this[this.isActive()?"hide":"show"]()},show:function(){if(this.element.length){var i=this;if(!this.isActive())return this.options.modal&&o&&o.hide(!0),this.element.removeClass("uk-open").show(),this.resize(!0),this.options.modal&&(o=this),this.active=!0,n++,t.support.transition?(this.hasTransitioned=!1,this.element.one(t.support.transition.end,function(){i.hasTransitioned=!0}).addClass("uk-open")):this.element.addClass("uk-open"),s.addClass("uk-modal-page").height(),this.element.attr("aria-hidden","false"),this.element.trigger("show.uk.modal"),t.Utils.checkDisplay(this.dialog,!0),this}},hide:function(i){if(!i&&t.support.transition&&this.hasTransitioned){var e=this;this.one(t.support.transition.end,function(){e._hide()}).removeClass("uk-open")}else this._hide();return this},resize:function(t){if(this.isActive()||t){var i=e.width();if(this.scrollbarwidth=window.innerWidth-i,e.css(this.paddingdir,this.scrollbarwidth),this.element.css("overflow-y",this.scrollbarwidth?"scroll":"auto"),!this.updateScrollable()&&this.options.center){var o=this.dialog.outerHeight(),n=parseInt(this.dialog.css("margin-top"),10)+parseInt(this.dialog.css("margin-bottom"),10);o+n<window.innerHeight?this.dialog.css({top:window.innerHeight/2-o/2-n}):this.dialog.css({top:""})}}},updateScrollable:function(){var t=this.dialog.find(".uk-overflow-container:visible:first");if(t.length){t.css("height",0);var i=Math.abs(parseInt(this.dialog.css("margin-top"),10)),e=this.dialog.outerHeight(),o=window.innerHeight,n=o-2*(20>i?20:i)-e;return t.css({"max-height":n<this.options.minScrollHeight?"":n,height:""}),!0}return!1},_hide:function(){this.active=!1,n>0?n--:n=0,this.element.hide().removeClass("uk-open"),this.element.attr("aria-hidden","true"),n||(s.removeClass("uk-modal-page"),e.css(this.paddingdir,"")),o===this&&(o=!1),this.trigger("hide.uk.modal")},isActive:function(){return this.element.hasClass("uk-open")}}),t.component("modalTrigger",{boot:function(){t.$html.on("click.modal.uikit","[data-uk-modal]",function(i){var e=t.$(this);if(e.is("a")&&i.preventDefault(),!e.data("modalTrigger")){var o=t.modalTrigger(e,t.Utils.options(e.attr("data-uk-modal")));o.show()}}),t.$html.on("keydown.modal.uikit",function(t){o&&27===t.keyCode&&o.options.keyboard&&(t.preventDefault(),o.hide())})},init:function(){var i=this;this.options=t.$.extend({target:i.element.is("a")?i.element.attr("href"):!1},this.options),this.modal=t.modal(this.options.target,this.options),this.on("click",function(t){t.preventDefault(),i.show()}),this.proxy(this.modal,"show hide isActive")}}),t.modal.dialog=function(e,o){var n=t.modal(t.$(t.modal.dialog.template).appendTo("body"),o);return n.on("hide.uk.modal",function(){n.persist&&(n.persist.appendTo(n.persist.data("modalPersistParent")),n.persist=!1),n.element.remove()}),i(e,n),n},t.modal.dialog.template='<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>',t.modal.alert=function(i,e){e=t.$.extend(!0,{bgclose:!1,keyboard:!1,modal:!1,labels:t.modal.labels},e);var o=t.modal.dialog(['<div class="uk-margin uk-modal-content">'+String(i)+"</div>",'<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+e.labels.Ok+"</button></div>"].join(""),e);return o.on("show.uk.modal",function(){setTimeout(function(){o.element.find("button:first").focus()},50)}),o.show()},t.modal.confirm=function(i,e,o){var n=arguments.length>1&&arguments[arguments.length-1]?arguments[arguments.length-1]:{};e=t.$.isFunction(e)?e:function(){},o=t.$.isFunction(o)?o:function(){},n=t.$.extend(!0,{bgclose:!1,keyboard:!1,modal:!1,labels:t.modal.labels},t.$.isFunction(n)?{}:n);var s=t.modal.dialog(['<div class="uk-margin uk-modal-content">'+String(i)+"</div>",'<div class="uk-modal-footer uk-text-right"><button class="uk-button js-modal-confirm-cancel">'+n.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+n.labels.Ok+"</button></div>"].join(""),n);return s.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click",function(){t.$(this).is(".js-modal-confirm")?e():o(),s.hide()}),s.on("show.uk.modal",function(){setTimeout(function(){s.element.find(".js-modal-confirm").focus()},50)}),s.show()},t.modal.prompt=function(i,e,o,n){o=t.$.isFunction(o)?o:function(){},n=t.$.extend(!0,{bgclose:!1,keyboard:!1,modal:!1,labels:t.modal.labels},n);var s=t.modal.dialog([i?'<div class="uk-modal-content uk-form">'+String(i)+"</div>":"",'<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>','<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-modal-close">'+n.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-ok">'+n.labels.Ok+"</button></div>"].join(""),n),a=s.element.find("input[type='text']").val(e||"").on("keyup",function(t){13==t.keyCode&&s.element.find(".js-modal-ok").trigger("click")});return s.element.find(".js-modal-ok").on("click",function(){o(a.val())!==!1&&s.hide()}),s.on("show.uk.modal",function(){setTimeout(function(){a.focus()},50)}),s.show()},t.modal.blockUI=function(i,e){var o=t.modal.dialog(['<div class="uk-margin uk-modal-content">'+String(i||'<div class="uk-text-center">...</div>')+"</div>"].join(""),t.$.extend({bgclose:!1,keyboard:!1,modal:!1},e));return o.content=o.element.find(".uk-modal-content:first"),o.show()},t.modal.labels={Ok:"Ok",Cancel:"Cancel"}}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/nav.js b/js/core/nav.js new file mode 100755 index 0000000..a6157ab --- /dev/null +++ b/js/core/nav.js | |||
@@ -0,0 +1,136 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('nav', { | ||
7 | |||
8 | defaults: { | ||
9 | "toggle": ">li.uk-parent > a[href='#']", | ||
10 | "lists": ">li.uk-parent > ul", | ||
11 | "multiple": false | ||
12 | }, | ||
13 | |||
14 | boot: function() { | ||
15 | |||
16 | // init code | ||
17 | UI.ready(function(context) { | ||
18 | |||
19 | UI.$("[data-uk-nav]", context).each(function() { | ||
20 | var nav = UI.$(this); | ||
21 | |||
22 | if (!nav.data("nav")) { | ||
23 | var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav"))); | ||
24 | } | ||
25 | }); | ||
26 | }); | ||
27 | }, | ||
28 | |||
29 | init: function() { | ||
30 | |||
31 | var $this = this; | ||
32 | |||
33 | this.on("click.uk.nav", this.options.toggle, function(e) { | ||
34 | e.preventDefault(); | ||
35 | var ele = UI.$(this); | ||
36 | $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li")); | ||
37 | }); | ||
38 | |||
39 | this.find(this.options.lists).each(function() { | ||
40 | var $ele = UI.$(this), | ||
41 | parent = $ele.parent(), | ||
42 | active = parent.hasClass("uk-active"); | ||
43 | |||
44 | $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>'); | ||
45 | parent.data("list-container", $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden')); | ||
46 | |||
47 | // Init ARIA | ||
48 | parent.attr('aria-expanded', parent.hasClass("uk-open")); | ||
49 | |||
50 | if (active) $this.open(parent, true); | ||
51 | }); | ||
52 | |||
53 | }, | ||
54 | |||
55 | open: function(li, noanimation) { | ||
56 | |||
57 | var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container'); | ||
58 | |||
59 | if (!this.options.multiple) { | ||
60 | |||
61 | element.children('.uk-open').not(li).each(function() { | ||
62 | |||
63 | var ele = UI.$(this); | ||
64 | |||
65 | if (ele.data('list-container')) { | ||
66 | ele.data('list-container').stop().animate({height: 0}, function() { | ||
67 | UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden'); | ||
68 | }); | ||
69 | } | ||
70 | }); | ||
71 | } | ||
72 | |||
73 | $li.toggleClass('uk-open'); | ||
74 | |||
75 | // Update ARIA | ||
76 | $li.attr('aria-expanded', $li.hasClass('uk-open')); | ||
77 | |||
78 | if ($container) { | ||
79 | |||
80 | if ($li.hasClass('uk-open')) { | ||
81 | $container.removeClass('uk-hidden'); | ||
82 | } | ||
83 | |||
84 | if (noanimation) { | ||
85 | |||
86 | $container.stop().height($li.hasClass('uk-open') ? 'auto' : 0); | ||
87 | |||
88 | if (!$li.hasClass('uk-open')) { | ||
89 | $container.addClass('uk-hidden'); | ||
90 | } | ||
91 | |||
92 | this.trigger('display.uk.check'); | ||
93 | |||
94 | } else { | ||
95 | |||
96 | $container.stop().animate({ | ||
97 | height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0) | ||
98 | }, function() { | ||
99 | |||
100 | if (!$li.hasClass('uk-open')) { | ||
101 | $container.addClass('uk-hidden'); | ||
102 | } else { | ||
103 | $container.css('height', ''); | ||
104 | } | ||
105 | |||
106 | $this.trigger('display.uk.check'); | ||
107 | }); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | }); | ||
112 | |||
113 | |||
114 | // helper | ||
115 | |||
116 | function getHeight(ele) { | ||
117 | var $ele = UI.$(ele), height = "auto"; | ||
118 | |||
119 | if ($ele.is(":visible")) { | ||
120 | height = $ele.outerHeight(); | ||
121 | } else { | ||
122 | var tmp = { | ||
123 | position: $ele.css("position"), | ||
124 | visibility: $ele.css("visibility"), | ||
125 | display: $ele.css("display") | ||
126 | }; | ||
127 | |||
128 | height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight(); | ||
129 | |||
130 | $ele.css(tmp); // reset element | ||
131 | } | ||
132 | |||
133 | return height; | ||
134 | } | ||
135 | |||
136 | })(UIkit); | ||
diff --git a/js/core/nav.min.js b/js/core/nav.min.js new file mode 100755 index 0000000..3ee579c --- /dev/null +++ b/js/core/nav.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(i){"use strict";function t(t){var s=i.$(t),a="auto";if(s.is(":visible"))a=s.outerHeight();else{var e={position:s.css("position"),visibility:s.css("visibility"),display:s.css("display")};a=s.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),s.css(e)}return a}i.component("nav",{defaults:{toggle:">li.uk-parent > a[href='#']",lists:">li.uk-parent > ul",multiple:!1},boot:function(){i.ready(function(t){i.$("[data-uk-nav]",t).each(function(){var t=i.$(this);if(!t.data("nav")){i.nav(t,i.Utils.options(t.attr("data-uk-nav")))}})})},init:function(){var t=this;this.on("click.uk.nav",this.options.toggle,function(s){s.preventDefault();var a=i.$(this);t.open(a.parent()[0]==t.element[0]?a:a.parent("li"))}),this.find(this.options.lists).each(function(){var s=i.$(this),a=s.parent(),e=a.hasClass("uk-active");s.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>'),a.data("list-container",s.parent()[e?"removeClass":"addClass"]("uk-hidden")),a.attr("aria-expanded",a.hasClass("uk-open")),e&&t.open(a,!0)})},open:function(s,a){var e=this,n=this.element,o=i.$(s),l=o.data("list-container");this.options.multiple||n.children(".uk-open").not(s).each(function(){var t=i.$(this);t.data("list-container")&&t.data("list-container").stop().animate({height:0},function(){i.$(this).parent().removeClass("uk-open").end().addClass("uk-hidden")})}),o.toggleClass("uk-open"),o.attr("aria-expanded",o.hasClass("uk-open")),l&&(o.hasClass("uk-open")&&l.removeClass("uk-hidden"),a?(l.stop().height(o.hasClass("uk-open")?"auto":0),o.hasClass("uk-open")||l.addClass("uk-hidden"),this.trigger("display.uk.check")):l.stop().animate({height:o.hasClass("uk-open")?t(l.find("ul:first")):0},function(){o.hasClass("uk-open")?l.css("height",""):l.addClass("uk-hidden"),e.trigger("display.uk.check")}))}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/offcanvas.js b/js/core/offcanvas.js new file mode 100755 index 0000000..9b2c289 --- /dev/null +++ b/js/core/offcanvas.js | |||
@@ -0,0 +1,180 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var scrollpos = {x: window.scrollX, y: window.scrollY}, | ||
7 | $win = UI.$win, | ||
8 | $doc = UI.$doc, | ||
9 | $html = UI.$html, | ||
10 | Offcanvas = { | ||
11 | |||
12 | show: function(element) { | ||
13 | |||
14 | element = UI.$(element); | ||
15 | |||
16 | if (!element.length) return; | ||
17 | |||
18 | var $body = UI.$('body'), | ||
19 | bar = element.find(".uk-offcanvas-bar:first"), | ||
20 | rtl = (UI.langdirection == "right"), | ||
21 | flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1, | ||
22 | dir = flip * (rtl ? -1 : 1), | ||
23 | |||
24 | scrollbarwidth = window.innerWidth - $body.width(); | ||
25 | |||
26 | scrollpos = {x: window.pageXOffset, y: window.pageYOffset}; | ||
27 | |||
28 | element.addClass("uk-active"); | ||
29 | |||
30 | $body.css({"width": window.innerWidth - scrollbarwidth, "height": window.innerHeight}).addClass("uk-offcanvas-page"); | ||
31 | $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw | ||
32 | |||
33 | $html.css('margin-top', scrollpos.y * -1); | ||
34 | |||
35 | bar.addClass("uk-offcanvas-bar-show"); | ||
36 | |||
37 | this._initElement(element); | ||
38 | |||
39 | bar.trigger('show.uk.offcanvas', [element, bar]); | ||
40 | |||
41 | // Update ARIA | ||
42 | element.attr('aria-hidden', 'false'); | ||
43 | }, | ||
44 | |||
45 | hide: function(force) { | ||
46 | |||
47 | var $body = UI.$('body'), | ||
48 | panel = UI.$(".uk-offcanvas.uk-active"), | ||
49 | rtl = (UI.langdirection == "right"), | ||
50 | bar = panel.find(".uk-offcanvas-bar:first"), | ||
51 | finalize = function() { | ||
52 | $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""}); | ||
53 | panel.removeClass("uk-active"); | ||
54 | |||
55 | bar.removeClass("uk-offcanvas-bar-show"); | ||
56 | $html.css('margin-top', ''); | ||
57 | window.scrollTo(scrollpos.x, scrollpos.y); | ||
58 | bar.trigger('hide.uk.offcanvas', [panel, bar]); | ||
59 | |||
60 | // Update ARIA | ||
61 | panel.attr('aria-hidden', 'true'); | ||
62 | }; | ||
63 | |||
64 | if (!panel.length) return; | ||
65 | |||
66 | if (UI.support.transition && !force) { | ||
67 | |||
68 | $body.one(UI.support.transition.end, function() { | ||
69 | finalize(); | ||
70 | }).css((rtl ? "margin-right" : "margin-left"), ""); | ||
71 | |||
72 | setTimeout(function(){ | ||
73 | bar.removeClass("uk-offcanvas-bar-show"); | ||
74 | }, 0); | ||
75 | |||
76 | } else { | ||
77 | finalize(); | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | _initElement: function(element) { | ||
82 | |||
83 | if (element.data("OffcanvasInit")) return; | ||
84 | |||
85 | element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) { | ||
86 | |||
87 | var target = UI.$(e.target); | ||
88 | |||
89 | if (!e.type.match(/swipe/)) { | ||
90 | |||
91 | if (!target.hasClass("uk-offcanvas-close")) { | ||
92 | if (target.hasClass("uk-offcanvas-bar")) return; | ||
93 | if (target.parents(".uk-offcanvas-bar:first").length) return; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | e.stopImmediatePropagation(); | ||
98 | Offcanvas.hide(); | ||
99 | }); | ||
100 | |||
101 | element.on("click", "a[href*='#']", function(e){ | ||
102 | |||
103 | var link = UI.$(this), | ||
104 | href = link.attr("href"); | ||
105 | |||
106 | if (href == "#") { | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | UI.$doc.one('hide.uk.offcanvas', function() { | ||
111 | |||
112 | var target; | ||
113 | |||
114 | try { | ||
115 | target = UI.$(link[0].hash); | ||
116 | } catch (e){ | ||
117 | target = ''; | ||
118 | } | ||
119 | |||
120 | if (!target.length) { | ||
121 | target = UI.$('[name="'+link[0].hash.replace('#','')+'"]'); | ||
122 | } | ||
123 | |||
124 | if (target.length && UI.Utils.scrollToElement) { | ||
125 | UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}')); | ||
126 | } else { | ||
127 | window.location.href = href; | ||
128 | } | ||
129 | }); | ||
130 | |||
131 | Offcanvas.hide(); | ||
132 | }); | ||
133 | |||
134 | element.data("OffcanvasInit", true); | ||
135 | } | ||
136 | }; | ||
137 | |||
138 | UI.component('offcanvasTrigger', { | ||
139 | |||
140 | boot: function() { | ||
141 | |||
142 | // init code | ||
143 | $html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) { | ||
144 | |||
145 | e.preventDefault(); | ||
146 | |||
147 | var ele = UI.$(this); | ||
148 | |||
149 | if (!ele.data("offcanvasTrigger")) { | ||
150 | var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas"))); | ||
151 | ele.trigger("click"); | ||
152 | } | ||
153 | }); | ||
154 | |||
155 | $html.on('keydown.uk.offcanvas', function(e) { | ||
156 | |||
157 | if (e.keyCode === 27) { // ESC | ||
158 | Offcanvas.hide(); | ||
159 | } | ||
160 | }); | ||
161 | }, | ||
162 | |||
163 | init: function() { | ||
164 | |||
165 | var $this = this; | ||
166 | |||
167 | this.options = UI.$.extend({ | ||
168 | "target": $this.element.is("a") ? $this.element.attr("href") : false | ||
169 | }, this.options); | ||
170 | |||
171 | this.on("click", function(e) { | ||
172 | e.preventDefault(); | ||
173 | Offcanvas.show($this.options.target); | ||
174 | }); | ||
175 | } | ||
176 | }); | ||
177 | |||
178 | UI.offcanvas = Offcanvas; | ||
179 | |||
180 | })(UIkit); | ||
diff --git a/js/core/offcanvas.min.js b/js/core/offcanvas.min.js new file mode 100755 index 0000000..faa3887 --- /dev/null +++ b/js/core/offcanvas.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(a){"use strict";var t={x:window.scrollX,y:window.scrollY},n=(a.$win,a.$doc,a.$html),i={show:function(i){if(i=a.$(i),i.length){var o=a.$("body"),s=i.find(".uk-offcanvas-bar:first"),e="right"==a.langdirection,f=s.hasClass("uk-offcanvas-bar-flip")?-1:1,r=f*(e?-1:1),c=window.innerWidth-o.width();t={x:window.pageXOffset,y:window.pageYOffset},i.addClass("uk-active"),o.css({width:window.innerWidth-c,height:window.innerHeight}).addClass("uk-offcanvas-page"),o.css(e?"margin-right":"margin-left",(e?-1:1)*s.outerWidth()*r).width(),n.css("margin-top",-1*t.y),s.addClass("uk-offcanvas-bar-show"),this._initElement(i),s.trigger("show.uk.offcanvas",[i,s]),i.attr("aria-hidden","false")}},hide:function(i){var o=a.$("body"),s=a.$(".uk-offcanvas.uk-active"),e="right"==a.langdirection,f=s.find(".uk-offcanvas-bar:first"),r=function(){o.removeClass("uk-offcanvas-page").css({width:"",height:"","margin-left":"","margin-right":""}),s.removeClass("uk-active"),f.removeClass("uk-offcanvas-bar-show"),n.css("margin-top",""),window.scrollTo(t.x,t.y),f.trigger("hide.uk.offcanvas",[s,f]),s.attr("aria-hidden","true")};s.length&&(a.support.transition&&!i?(o.one(a.support.transition.end,function(){r()}).css(e?"margin-right":"margin-left",""),setTimeout(function(){f.removeClass("uk-offcanvas-bar-show")},0)):r())},_initElement:function(t){t.data("OffcanvasInit")||(t.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas",function(t){var n=a.$(t.target);if(!t.type.match(/swipe/)&&!n.hasClass("uk-offcanvas-close")){if(n.hasClass("uk-offcanvas-bar"))return;if(n.parents(".uk-offcanvas-bar:first").length)return}t.stopImmediatePropagation(),i.hide()}),t.on("click","a[href*='#']",function(){var t=a.$(this),n=t.attr("href");"#"!=n&&(a.$doc.one("hide.uk.offcanvas",function(){var i;try{i=a.$(t[0].hash)}catch(o){i=""}i.length||(i=a.$('[name="'+t[0].hash.replace("#","")+'"]')),i.length&&a.Utils.scrollToElement?a.Utils.scrollToElement(i,a.Utils.options(t.attr("data-uk-smooth-scroll")||"{}")):window.location.href=n}),i.hide())}),t.data("OffcanvasInit",!0))}};a.component("offcanvasTrigger",{boot:function(){n.on("click.offcanvas.uikit","[data-uk-offcanvas]",function(t){t.preventDefault();var n=a.$(this);if(!n.data("offcanvasTrigger")){{a.offcanvasTrigger(n,a.Utils.options(n.attr("data-uk-offcanvas")))}n.trigger("click")}}),n.on("keydown.uk.offcanvas",function(a){27===a.keyCode&&i.hide()})},init:function(){var t=this;this.options=a.$.extend({target:t.element.is("a")?t.element.attr("href"):!1},this.options),this.on("click",function(a){a.preventDefault(),i.show(t.options.target)})}}),a.offcanvas=i}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/scrollspy.js b/js/core/scrollspy.js new file mode 100755 index 0000000..a67e2c8 --- /dev/null +++ b/js/core/scrollspy.js | |||
@@ -0,0 +1,209 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var $win = UI.$win, | ||
7 | $doc = UI.$doc, | ||
8 | scrollspies = [], | ||
9 | checkScrollSpy = function() { | ||
10 | for(var i=0; i < scrollspies.length; i++) { | ||
11 | window.requestAnimationFrame.apply(window, [scrollspies[i].check]); | ||
12 | } | ||
13 | }; | ||
14 | |||
15 | UI.component('scrollspy', { | ||
16 | |||
17 | defaults: { | ||
18 | "target" : false, | ||
19 | "cls" : "uk-scrollspy-inview", | ||
20 | "initcls" : "uk-scrollspy-init-inview", | ||
21 | "topoffset" : 0, | ||
22 | "leftoffset" : 0, | ||
23 | "repeat" : false, | ||
24 | "delay" : 0 | ||
25 | }, | ||
26 | |||
27 | boot: function() { | ||
28 | |||
29 | // listen to scroll and resize | ||
30 | $doc.on("scrolling.uk.document", checkScrollSpy); | ||
31 | $win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50)); | ||
32 | |||
33 | // init code | ||
34 | UI.ready(function(context) { | ||
35 | |||
36 | UI.$("[data-uk-scrollspy]", context).each(function() { | ||
37 | |||
38 | var element = UI.$(this); | ||
39 | |||
40 | if (!element.data("scrollspy")) { | ||
41 | var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy"))); | ||
42 | } | ||
43 | }); | ||
44 | }); | ||
45 | }, | ||
46 | |||
47 | init: function() { | ||
48 | |||
49 | var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){ | ||
50 | |||
51 | var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element, | ||
52 | delayIdx = elements.length === 1 ? 1 : 0, | ||
53 | toggleclsIdx = 0; | ||
54 | |||
55 | elements.each(function(idx){ | ||
56 | |||
57 | var element = UI.$(this), | ||
58 | inviewstate = element.data('inviewstate'), | ||
59 | inview = UI.Utils.isInView(element, $this.options), | ||
60 | toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim(); | ||
61 | |||
62 | if (inview && !inviewstate && !element.data('scrollspy-idle')) { | ||
63 | |||
64 | if (!initinview) { | ||
65 | element.addClass($this.options.initcls); | ||
66 | $this.offset = element.offset(); | ||
67 | initinview = true; | ||
68 | |||
69 | element.trigger("init.uk.scrollspy"); | ||
70 | } | ||
71 | |||
72 | element.data('scrollspy-idle', setTimeout(function(){ | ||
73 | |||
74 | element.addClass("uk-scrollspy-inview").toggleClass(toggle).width(); | ||
75 | element.trigger("inview.uk.scrollspy"); | ||
76 | |||
77 | element.data('scrollspy-idle', false); | ||
78 | element.data('inviewstate', true); | ||
79 | |||
80 | }, $this.options.delay * delayIdx)); | ||
81 | |||
82 | delayIdx++; | ||
83 | } | ||
84 | |||
85 | if (!inview && inviewstate && $this.options.repeat) { | ||
86 | |||
87 | if (element.data('scrollspy-idle')) { | ||
88 | clearTimeout(element.data('scrollspy-idle')); | ||
89 | element.data('scrollspy-idle', false); | ||
90 | } | ||
91 | |||
92 | element.removeClass("uk-scrollspy-inview").toggleClass(toggle); | ||
93 | element.data('inviewstate', false); | ||
94 | |||
95 | element.trigger("outview.uk.scrollspy"); | ||
96 | } | ||
97 | |||
98 | toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0; | ||
99 | |||
100 | }); | ||
101 | }; | ||
102 | |||
103 | fn(); | ||
104 | |||
105 | this.check = fn; | ||
106 | |||
107 | scrollspies.push(this); | ||
108 | } | ||
109 | }); | ||
110 | |||
111 | |||
112 | var scrollspynavs = [], | ||
113 | checkScrollSpyNavs = function() { | ||
114 | for(var i=0; i < scrollspynavs.length; i++) { | ||
115 | window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]); | ||
116 | } | ||
117 | }; | ||
118 | |||
119 | UI.component('scrollspynav', { | ||
120 | |||
121 | defaults: { | ||
122 | "cls" : 'uk-active', | ||
123 | "closest" : false, | ||
124 | "topoffset" : 0, | ||
125 | "leftoffset" : 0, | ||
126 | "smoothscroll" : false | ||
127 | }, | ||
128 | |||
129 | boot: function() { | ||
130 | |||
131 | // listen to scroll and resize | ||
132 | $doc.on("scrolling.uk.document", checkScrollSpyNavs); | ||
133 | $win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50)); | ||
134 | |||
135 | // init code | ||
136 | UI.ready(function(context) { | ||
137 | |||
138 | UI.$("[data-uk-scrollspy-nav]", context).each(function() { | ||
139 | |||
140 | var element = UI.$(this); | ||
141 | |||
142 | if (!element.data("scrollspynav")) { | ||
143 | var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav"))); | ||
144 | } | ||
145 | }); | ||
146 | }); | ||
147 | }, | ||
148 | |||
149 | init: function() { | ||
150 | |||
151 | var ids = [], | ||
152 | links = this.find("a[href^='#']").each(function(){ if(this.getAttribute("href").trim()!=='#') ids.push(this.getAttribute("href")); }), | ||
153 | targets = UI.$(ids.join(",")), | ||
154 | |||
155 | clsActive = this.options.cls, | ||
156 | clsClosest = this.options.closest || this.options.closest; | ||
157 | |||
158 | var $this = this, inviews, fn = function(){ | ||
159 | |||
160 | inviews = []; | ||
161 | |||
162 | for (var i=0 ; i < targets.length ; i++) { | ||
163 | if (UI.Utils.isInView(targets.eq(i), $this.options)) { | ||
164 | inviews.push(targets.eq(i)); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | if (inviews.length) { | ||
169 | |||
170 | var navitems, | ||
171 | scrollTop = $win.scrollTop(), | ||
172 | target = (function(){ | ||
173 | for(var i=0; i< inviews.length;i++){ | ||
174 | if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){ | ||
175 | return inviews[i]; | ||
176 | } | ||
177 | } | ||
178 | })(); | ||
179 | |||
180 | if (!target) return; | ||
181 | |||
182 | if ($this.options.closest) { | ||
183 | links.blur().closest(clsClosest).removeClass(clsActive); | ||
184 | navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive); | ||
185 | } else { | ||
186 | navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive); | ||
187 | } | ||
188 | |||
189 | $this.element.trigger("inview.uk.scrollspynav", [target, navitems]); | ||
190 | } | ||
191 | }; | ||
192 | |||
193 | if (this.options.smoothscroll && UI.smoothScroll) { | ||
194 | links.each(function(){ | ||
195 | UI.smoothScroll(this, $this.options.smoothscroll); | ||
196 | }); | ||
197 | } | ||
198 | |||
199 | fn(); | ||
200 | |||
201 | this.element.data("scrollspynav", this); | ||
202 | |||
203 | this.check = fn; | ||
204 | scrollspynavs.push(this); | ||
205 | |||
206 | } | ||
207 | }); | ||
208 | |||
209 | })(UIkit); | ||
diff --git a/js/core/scrollspy.min.js b/js/core/scrollspy.min.js new file mode 100755 index 0000000..74d651b --- /dev/null +++ b/js/core/scrollspy.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";var s=t.$win,o=t.$doc,i=[],e=function(){for(var t=0;t<i.length;t++)window.requestAnimationFrame.apply(window,[i[t].check])};t.component("scrollspy",{defaults:{target:!1,cls:"uk-scrollspy-inview",initcls:"uk-scrollspy-init-inview",topoffset:0,leftoffset:0,repeat:!1,delay:0},boot:function(){o.on("scrolling.uk.document",e),s.on("load resize orientationchange",t.Utils.debounce(e,50)),t.ready(function(s){t.$("[data-uk-scrollspy]",s).each(function(){var s=t.$(this);if(!s.data("scrollspy")){t.scrollspy(s,t.Utils.options(s.attr("data-uk-scrollspy")))}})})},init:function(){var s,o=this,e=this.options.cls.split(/,/),l=function(){var i=o.options.target?o.element.find(o.options.target):o.element,l=1===i.length?1:0,n=0;i.each(function(){var i=t.$(this),a=i.data("inviewstate"),r=t.Utils.isInView(i,o.options),c=i.data("ukScrollspyCls")||e[n].trim();!r||a||i.data("scrollspy-idle")||(s||(i.addClass(o.options.initcls),o.offset=i.offset(),s=!0,i.trigger("init.uk.scrollspy")),i.data("scrollspy-idle",setTimeout(function(){i.addClass("uk-scrollspy-inview").toggleClass(c).width(),i.trigger("inview.uk.scrollspy"),i.data("scrollspy-idle",!1),i.data("inviewstate",!0)},o.options.delay*l)),l++),!r&&a&&o.options.repeat&&(i.data("scrollspy-idle")&&(clearTimeout(i.data("scrollspy-idle")),i.data("scrollspy-idle",!1)),i.removeClass("uk-scrollspy-inview").toggleClass(c),i.data("inviewstate",!1),i.trigger("outview.uk.scrollspy")),n=e[n+1]?n+1:0})};l(),this.check=l,i.push(this)}});var l=[],n=function(){for(var t=0;t<l.length;t++)window.requestAnimationFrame.apply(window,[l[t].check])};t.component("scrollspynav",{defaults:{cls:"uk-active",closest:!1,topoffset:0,leftoffset:0,smoothscroll:!1},boot:function(){o.on("scrolling.uk.document",n),s.on("resize orientationchange",t.Utils.debounce(n,50)),t.ready(function(s){t.$("[data-uk-scrollspy-nav]",s).each(function(){var s=t.$(this);if(!s.data("scrollspynav")){t.scrollspynav(s,t.Utils.options(s.attr("data-uk-scrollspy-nav")))}})})},init:function(){var o,i=[],e=this.find("a[href^='#']").each(function(){"#"!==this.getAttribute("href").trim()&&i.push(this.getAttribute("href"))}),n=t.$(i.join(",")),a=this.options.cls,r=this.options.closest||this.options.closest,c=this,p=function(){o=[];for(var i=0;i<n.length;i++)t.Utils.isInView(n.eq(i),c.options)&&o.push(n.eq(i));if(o.length){var l,p=s.scrollTop(),f=function(){for(var t=0;t<o.length;t++)if(o[t].offset().top-c.options.topoffset>=p)return o[t]}();if(!f)return;c.options.closest?(e.blur().closest(r).removeClass(a),l=e.filter("a[href='#"+f.attr("id")+"']").closest(r).addClass(a)):l=e.removeClass(a).filter("a[href='#"+f.attr("id")+"']").addClass(a),c.element.trigger("inview.uk.scrollspynav",[f,l])}};this.options.smoothscroll&&t.smoothScroll&&e.each(function(){t.smoothScroll(this,c.options.smoothscroll)}),p(),this.element.data("scrollspynav",this),this.check=p,l.push(this)}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/smooth-scroll.js b/js/core/smooth-scroll.js new file mode 100755 index 0000000..789e426 --- /dev/null +++ b/js/core/smooth-scroll.js | |||
@@ -0,0 +1,62 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('smoothScroll', { | ||
7 | |||
8 | boot: function() { | ||
9 | |||
10 | // init code | ||
11 | UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) { | ||
12 | var ele = UI.$(this); | ||
13 | |||
14 | if (!ele.data("smoothScroll")) { | ||
15 | var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll"))); | ||
16 | ele.trigger("click"); | ||
17 | } | ||
18 | |||
19 | return false; | ||
20 | }); | ||
21 | }, | ||
22 | |||
23 | init: function() { | ||
24 | |||
25 | var $this = this; | ||
26 | |||
27 | this.on("click", function(e) { | ||
28 | e.preventDefault(); | ||
29 | scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options); | ||
30 | }); | ||
31 | } | ||
32 | }); | ||
33 | |||
34 | function scrollToElement(ele, options) { | ||
35 | |||
36 | options = UI.$.extend({ | ||
37 | duration: 1000, | ||
38 | transition: 'easeOutExpo', | ||
39 | offset: 0, | ||
40 | complete: function(){} | ||
41 | }, options); | ||
42 | |||
43 | // get / set parameters | ||
44 | var target = ele.offset().top - options.offset, | ||
45 | docheight = UI.$doc.height(), | ||
46 | winheight = window.innerHeight; | ||
47 | |||
48 | if ((target + winheight) > docheight) { | ||
49 | target = docheight - winheight; | ||
50 | } | ||
51 | |||
52 | // animate to target, fire callback when done | ||
53 | UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete); | ||
54 | } | ||
55 | |||
56 | UI.Utils.scrollToElement = scrollToElement; | ||
57 | |||
58 | if (!UI.$.easing.easeOutExpo) { | ||
59 | UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; }; | ||
60 | } | ||
61 | |||
62 | })(UIkit); | ||
diff --git a/js/core/smooth-scroll.min.js b/js/core/smooth-scroll.min.js new file mode 100755 index 0000000..5968d4e --- /dev/null +++ b/js/core/smooth-scroll.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";function o(o,i){i=t.$.extend({duration:1e3,transition:"easeOutExpo",offset:0,complete:function(){}},i);var n=o.offset().top-i.offset,s=t.$doc.height(),e=window.innerHeight;n+e>s&&(n=s-e),t.$("html,body").stop().animate({scrollTop:n},i.duration,i.transition).promise().done(i.complete)}t.component("smoothScroll",{boot:function(){t.$html.on("click.smooth-scroll.uikit","[data-uk-smooth-scroll]",function(){var o=t.$(this);if(!o.data("smoothScroll")){{t.smoothScroll(o,t.Utils.options(o.attr("data-uk-smooth-scroll")))}o.trigger("click")}return!1})},init:function(){var i=this;this.on("click",function(n){n.preventDefault(),o(t.$(this.hash).length?t.$(this.hash):t.$("body"),i.options)})}}),t.Utils.scrollToElement=o,t.$.easing.easeOutExpo||(t.$.easing.easeOutExpo=function(t,o,i,n,s){return o==s?i+n:n*(-Math.pow(2,-10*o/s)+1)+i})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/switcher.js b/js/core/switcher.js new file mode 100755 index 0000000..793eb3c --- /dev/null +++ b/js/core/switcher.js | |||
@@ -0,0 +1,307 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var Animations; | ||
7 | |||
8 | UI.component('switcher', { | ||
9 | |||
10 | defaults: { | ||
11 | connect : false, | ||
12 | toggle : ">*", | ||
13 | active : 0, | ||
14 | animation : false, | ||
15 | duration : 200, | ||
16 | swiping : true | ||
17 | }, | ||
18 | |||
19 | animating: false, | ||
20 | |||
21 | boot: function() { | ||
22 | |||
23 | // init code | ||
24 | UI.ready(function(context) { | ||
25 | |||
26 | UI.$("[data-uk-switcher]", context).each(function() { | ||
27 | var switcher = UI.$(this); | ||
28 | |||
29 | if (!switcher.data("switcher")) { | ||
30 | var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher"))); | ||
31 | } | ||
32 | }); | ||
33 | }); | ||
34 | }, | ||
35 | |||
36 | init: function() { | ||
37 | |||
38 | var $this = this; | ||
39 | |||
40 | this.on("click.uk.switcher", this.options.toggle, function(e) { | ||
41 | e.preventDefault(); | ||
42 | $this.show(this); | ||
43 | }); | ||
44 | |||
45 | if (this.options.connect) { | ||
46 | |||
47 | this.connect = UI.$(this.options.connect); | ||
48 | |||
49 | this.connect.children().removeClass("uk-active"); | ||
50 | |||
51 | // delegate switch commands within container content | ||
52 | if (this.connect.length) { | ||
53 | |||
54 | // Init ARIA for connect | ||
55 | this.connect.children().attr('aria-hidden', 'true'); | ||
56 | |||
57 | this.connect.on("click", '[data-uk-switcher-item]', function(e) { | ||
58 | |||
59 | e.preventDefault(); | ||
60 | |||
61 | var item = UI.$(this).attr('data-uk-switcher-item'); | ||
62 | |||
63 | if ($this.index == item) return; | ||
64 | |||
65 | switch(item) { | ||
66 | case 'next': | ||
67 | case 'previous': | ||
68 | $this.show($this.index + (item=='next' ? 1:-1)); | ||
69 | break; | ||
70 | default: | ||
71 | $this.show(parseInt(item, 10)); | ||
72 | } | ||
73 | }); | ||
74 | |||
75 | if (this.options.swiping) { | ||
76 | |||
77 | this.connect.on('swipeRight swipeLeft', function(e) { | ||
78 | e.preventDefault(); | ||
79 | if(!window.getSelection().toString()) { | ||
80 | $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1)); | ||
81 | } | ||
82 | }); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | var toggles = this.find(this.options.toggle), | ||
87 | active = toggles.filter(".uk-active"); | ||
88 | |||
89 | if (active.length) { | ||
90 | this.show(active, false); | ||
91 | } else { | ||
92 | |||
93 | if (this.options.active===false) return; | ||
94 | |||
95 | active = toggles.eq(this.options.active); | ||
96 | this.show(active.length ? active : toggles.eq(0), false); | ||
97 | } | ||
98 | |||
99 | // Init ARIA for toggles | ||
100 | toggles.not(active).attr('aria-expanded', 'false'); | ||
101 | active.attr('aria-expanded', 'true'); | ||
102 | } | ||
103 | |||
104 | }, | ||
105 | |||
106 | show: function(tab, animate) { | ||
107 | |||
108 | if (this.animating) { | ||
109 | return; | ||
110 | } | ||
111 | |||
112 | if (isNaN(tab)) { | ||
113 | tab = UI.$(tab); | ||
114 | } else { | ||
115 | |||
116 | var toggles = this.find(this.options.toggle); | ||
117 | |||
118 | tab = tab < 0 ? toggles.length-1 : tab; | ||
119 | tab = toggles.eq(toggles[tab] ? tab : 0); | ||
120 | } | ||
121 | |||
122 | var $this = this, | ||
123 | toggles = this.find(this.options.toggle), | ||
124 | active = UI.$(tab), | ||
125 | animation = Animations[this.options.animation] || function(current, next) { | ||
126 | |||
127 | if (!$this.options.animation) { | ||
128 | return Animations.none.apply($this); | ||
129 | } | ||
130 | |||
131 | var anim = $this.options.animation.split(','); | ||
132 | |||
133 | if (anim.length == 1) { | ||
134 | anim[1] = anim[0]; | ||
135 | } | ||
136 | |||
137 | anim[0] = anim[0].trim(); | ||
138 | anim[1] = anim[1].trim(); | ||
139 | |||
140 | return coreAnimation.apply($this, [anim, current, next]); | ||
141 | }; | ||
142 | |||
143 | if (animate===false || !UI.support.animation) { | ||
144 | animation = Animations.none; | ||
145 | } | ||
146 | |||
147 | if (active.hasClass("uk-disabled")) return; | ||
148 | |||
149 | // Update ARIA for Toggles | ||
150 | toggles.attr('aria-expanded', 'false'); | ||
151 | active.attr('aria-expanded', 'true'); | ||
152 | |||
153 | toggles.filter(".uk-active").removeClass("uk-active"); | ||
154 | active.addClass("uk-active"); | ||
155 | |||
156 | if (this.options.connect && this.connect.length) { | ||
157 | |||
158 | this.index = this.find(this.options.toggle).index(active); | ||
159 | |||
160 | if (this.index == -1 ) { | ||
161 | this.index = 0; | ||
162 | } | ||
163 | |||
164 | this.connect.each(function() { | ||
165 | |||
166 | var container = UI.$(this), | ||
167 | children = UI.$(container.children()), | ||
168 | current = UI.$(children.filter('.uk-active')), | ||
169 | next = UI.$(children.eq($this.index)); | ||
170 | |||
171 | $this.animating = true; | ||
172 | |||
173 | animation.apply($this, [current, next]).then(function(){ | ||
174 | |||
175 | current.removeClass("uk-active"); | ||
176 | next.addClass("uk-active"); | ||
177 | |||
178 | // Update ARIA for connect | ||
179 | current.attr('aria-hidden', 'true'); | ||
180 | next.attr('aria-hidden', 'false'); | ||
181 | |||
182 | UI.Utils.checkDisplay(next, true); | ||
183 | |||
184 | $this.animating = false; | ||
185 | |||
186 | }); | ||
187 | }); | ||
188 | } | ||
189 | |||
190 | this.trigger("show.uk.switcher", [active]); | ||
191 | } | ||
192 | }); | ||
193 | |||
194 | Animations = { | ||
195 | |||
196 | 'none': function() { | ||
197 | var d = UI.$.Deferred(); | ||
198 | d.resolve(); | ||
199 | return d.promise(); | ||
200 | }, | ||
201 | |||
202 | 'fade': function(current, next) { | ||
203 | return coreAnimation.apply(this, ['uk-animation-fade', current, next]); | ||
204 | }, | ||
205 | |||
206 | 'slide-bottom': function(current, next) { | ||
207 | return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]); | ||
208 | }, | ||
209 | |||
210 | 'slide-top': function(current, next) { | ||
211 | return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]); | ||
212 | }, | ||
213 | |||
214 | 'slide-vertical': function(current, next, dir) { | ||
215 | |||
216 | var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom']; | ||
217 | |||
218 | if (current && current.index() > next.index()) { | ||
219 | anim.reverse(); | ||
220 | } | ||
221 | |||
222 | return coreAnimation.apply(this, [anim, current, next]); | ||
223 | }, | ||
224 | |||
225 | 'slide-left': function(current, next) { | ||
226 | return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]); | ||
227 | }, | ||
228 | |||
229 | 'slide-right': function(current, next) { | ||
230 | return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]); | ||
231 | }, | ||
232 | |||
233 | 'slide-horizontal': function(current, next, dir) { | ||
234 | |||
235 | var anim = ['uk-animation-slide-right', 'uk-animation-slide-left']; | ||
236 | |||
237 | if (current && current.index() > next.index()) { | ||
238 | anim.reverse(); | ||
239 | } | ||
240 | |||
241 | return coreAnimation.apply(this, [anim, current, next]); | ||
242 | }, | ||
243 | |||
244 | 'scale': function(current, next) { | ||
245 | return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]); | ||
246 | } | ||
247 | }; | ||
248 | |||
249 | UI.switcher.animations = Animations; | ||
250 | |||
251 | |||
252 | // helpers | ||
253 | |||
254 | function coreAnimation(cls, current, next) { | ||
255 | |||
256 | var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release; | ||
257 | |||
258 | if (next[0]===current[0]) { | ||
259 | d.resolve(); | ||
260 | return d.promise(); | ||
261 | } | ||
262 | |||
263 | if (typeof(cls) == 'object') { | ||
264 | clsIn = cls[0]; | ||
265 | clsOut = cls[1] || cls[0]; | ||
266 | } | ||
267 | |||
268 | UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS | ||
269 | |||
270 | release = function() { | ||
271 | |||
272 | if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse'); | ||
273 | |||
274 | next.addClass(clsIn).one(UI.support.animation.end, function() { | ||
275 | |||
276 | setTimeout(function () { | ||
277 | next.removeClass(''+clsIn+'').css({opacity:'', display:''}); | ||
278 | }, 0); | ||
279 | |||
280 | d.resolve(); | ||
281 | |||
282 | UI.$body.css('overflow-x', ''); | ||
283 | |||
284 | if (current) current.css({opacity:'', display:''}); | ||
285 | |||
286 | }.bind(this)).show(); | ||
287 | }; | ||
288 | |||
289 | next.css('animation-duration', this.options.duration+'ms'); | ||
290 | |||
291 | if (current && current.length) { | ||
292 | |||
293 | current.css('animation-duration', this.options.duration+'ms'); | ||
294 | |||
295 | current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() { | ||
296 | release(); | ||
297 | }.bind(this)).css('display', ''); | ||
298 | |||
299 | } else { | ||
300 | next.addClass('uk-active'); | ||
301 | release(); | ||
302 | } | ||
303 | |||
304 | return d.promise(); | ||
305 | } | ||
306 | |||
307 | })(UIkit); | ||
diff --git a/js/core/switcher.min.js b/js/core/switcher.min.js new file mode 100755 index 0000000..9c4bc36 --- /dev/null +++ b/js/core/switcher.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";function i(i,n,e){var s,a=t.$.Deferred(),o=i,r=i;return e[0]===n[0]?(a.resolve(),a.promise()):("object"==typeof i&&(o=i[0],r=i[1]||i[0]),t.$body.css("overflow-x","hidden"),s=function(){n&&n.hide().removeClass("uk-active "+r+" uk-animation-reverse"),e.addClass(o).one(t.support.animation.end,function(){setTimeout(function(){e.removeClass(""+o).css({opacity:"",display:""})},0),a.resolve(),t.$body.css("overflow-x",""),n&&n.css({opacity:"",display:""})}.bind(this)).show()},e.css("animation-duration",this.options.duration+"ms"),n&&n.length?(n.css("animation-duration",this.options.duration+"ms"),n.css("display","none").addClass(r+" uk-animation-reverse").one(t.support.animation.end,function(){s()}.bind(this)).css("display","")):(e.addClass("uk-active"),s()),a.promise())}var n;t.component("switcher",{defaults:{connect:!1,toggle:">*",active:0,animation:!1,duration:200,swiping:!0},animating:!1,boot:function(){t.ready(function(i){t.$("[data-uk-switcher]",i).each(function(){var i=t.$(this);if(!i.data("switcher")){t.switcher(i,t.Utils.options(i.attr("data-uk-switcher")))}})})},init:function(){var i=this;if(this.on("click.uk.switcher",this.options.toggle,function(t){t.preventDefault(),i.show(this)}),this.options.connect){this.connect=t.$(this.options.connect),this.connect.children().removeClass("uk-active"),this.connect.length&&(this.connect.children().attr("aria-hidden","true"),this.connect.on("click","[data-uk-switcher-item]",function(n){n.preventDefault();var e=t.$(this).attr("data-uk-switcher-item");if(i.index!=e)switch(e){case"next":case"previous":i.show(i.index+("next"==e?1:-1));break;default:i.show(parseInt(e,10))}}),this.options.swiping&&this.connect.on("swipeRight swipeLeft",function(t){t.preventDefault(),window.getSelection().toString()||i.show(i.index+("swipeLeft"==t.type?1:-1))}));var n=this.find(this.options.toggle),e=n.filter(".uk-active");if(e.length)this.show(e,!1);else{if(this.options.active===!1)return;e=n.eq(this.options.active),this.show(e.length?e:n.eq(0),!1)}n.not(e).attr("aria-expanded","false"),e.attr("aria-expanded","true")}},show:function(e,s){if(!this.animating){if(isNaN(e))e=t.$(e);else{var a=this.find(this.options.toggle);e=0>e?a.length-1:e,e=a.eq(a[e]?e:0)}var o=this,a=this.find(this.options.toggle),r=t.$(e),c=n[this.options.animation]||function(t,e){if(!o.options.animation)return n.none.apply(o);var s=o.options.animation.split(",");return 1==s.length&&(s[1]=s[0]),s[0]=s[0].trim(),s[1]=s[1].trim(),i.apply(o,[s,t,e])};s!==!1&&t.support.animation||(c=n.none),r.hasClass("uk-disabled")||(a.attr("aria-expanded","false"),r.attr("aria-expanded","true"),a.filter(".uk-active").removeClass("uk-active"),r.addClass("uk-active"),this.options.connect&&this.connect.length&&(this.index=this.find(this.options.toggle).index(r),-1==this.index&&(this.index=0),this.connect.each(function(){var i=t.$(this),n=t.$(i.children()),e=t.$(n.filter(".uk-active")),s=t.$(n.eq(o.index));o.animating=!0,c.apply(o,[e,s]).then(function(){e.removeClass("uk-active"),s.addClass("uk-active"),e.attr("aria-hidden","true"),s.attr("aria-hidden","false"),t.Utils.checkDisplay(s,!0),o.animating=!1})})),this.trigger("show.uk.switcher",[r]))}}}),n={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,n){return i.apply(this,["uk-animation-fade",t,n])},"slide-bottom":function(t,n){return i.apply(this,["uk-animation-slide-bottom",t,n])},"slide-top":function(t,n){return i.apply(this,["uk-animation-slide-top",t,n])},"slide-vertical":function(t,n){var e=["uk-animation-slide-top","uk-animation-slide-bottom"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},"slide-left":function(t,n){return i.apply(this,["uk-animation-slide-left",t,n])},"slide-right":function(t,n){return i.apply(this,["uk-animation-slide-right",t,n])},"slide-horizontal":function(t,n){var e=["uk-animation-slide-right","uk-animation-slide-left"];return t&&t.index()>n.index()&&e.reverse(),i.apply(this,[e,t,n])},scale:function(t,n){return i.apply(this,["uk-animation-scale-up",t,n])}},t.switcher.animations=n}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/tab.js b/js/core/tab.js new file mode 100755 index 0000000..4784a6f --- /dev/null +++ b/js/core/tab.js | |||
@@ -0,0 +1,167 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | UI.component('tab', { | ||
7 | |||
8 | defaults: { | ||
9 | 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)', | ||
10 | 'connect' : false, | ||
11 | 'active' : 0, | ||
12 | 'animation' : false, | ||
13 | 'duration' : 200, | ||
14 | 'swiping' : true | ||
15 | }, | ||
16 | |||
17 | boot: function() { | ||
18 | |||
19 | // init code | ||
20 | UI.ready(function(context) { | ||
21 | |||
22 | UI.$("[data-uk-tab]", context).each(function() { | ||
23 | |||
24 | var tab = UI.$(this); | ||
25 | |||
26 | if (!tab.data("tab")) { | ||
27 | var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab"))); | ||
28 | } | ||
29 | }); | ||
30 | }); | ||
31 | }, | ||
32 | |||
33 | init: function() { | ||
34 | |||
35 | var $this = this; | ||
36 | |||
37 | this.current = false; | ||
38 | |||
39 | this.on("click.uk.tab", this.options.target, function(e) { | ||
40 | |||
41 | e.preventDefault(); | ||
42 | |||
43 | if ($this.switcher && $this.switcher.animating) { | ||
44 | return; | ||
45 | } | ||
46 | |||
47 | var current = $this.find($this.options.target).not(this); | ||
48 | |||
49 | current.removeClass("uk-active").blur(); | ||
50 | |||
51 | $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]); | ||
52 | |||
53 | $this.current = UI.$(this); | ||
54 | |||
55 | // Update ARIA | ||
56 | if (!$this.options.connect) { | ||
57 | current.attr('aria-expanded', 'false'); | ||
58 | UI.$(this).attr('aria-expanded', 'true'); | ||
59 | } | ||
60 | }); | ||
61 | |||
62 | if (this.options.connect) { | ||
63 | this.connect = UI.$(this.options.connect); | ||
64 | } | ||
65 | |||
66 | // init responsive tab | ||
67 | 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>'); | ||
68 | |||
69 | this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown'); | ||
70 | this.responsivetab.lst = this.responsivetab.dropdown.find('ul'); | ||
71 | this.responsivetab.caption = this.responsivetab.find('a:first'); | ||
72 | |||
73 | if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up"); | ||
74 | |||
75 | // handle click | ||
76 | this.responsivetab.lst.on('click.uk.tab', 'a', function(e) { | ||
77 | |||
78 | e.preventDefault(); | ||
79 | e.stopPropagation(); | ||
80 | |||
81 | var link = UI.$(this); | ||
82 | |||
83 | $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click'); | ||
84 | }); | ||
85 | |||
86 | this.on('show.uk.switcher change.uk.tab', function(e, tab) { | ||
87 | $this.responsivetab.caption.html(tab.text()); | ||
88 | }); | ||
89 | |||
90 | this.element.append(this.responsivetab); | ||
91 | |||
92 | // init UIkit components | ||
93 | if (this.options.connect) { | ||
94 | this.switcher = UI.switcher(this.element, { | ||
95 | 'toggle' : '>li:not(.uk-tab-responsive)', | ||
96 | 'connect' : this.options.connect, | ||
97 | 'active' : this.options.active, | ||
98 | 'animation' : this.options.animation, | ||
99 | 'duration' : this.options.duration, | ||
100 | 'swiping' : this.options.swiping | ||
101 | }); | ||
102 | } | ||
103 | |||
104 | UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"}); | ||
105 | |||
106 | // init | ||
107 | $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]); | ||
108 | |||
109 | this.check(); | ||
110 | |||
111 | UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){ | ||
112 | if ($this.element.is(":visible")) $this.check(); | ||
113 | }, 100)); | ||
114 | |||
115 | this.on('display.uk.check', function(){ | ||
116 | if ($this.element.is(":visible")) $this.check(); | ||
117 | }); | ||
118 | }, | ||
119 | |||
120 | check: function() { | ||
121 | |||
122 | var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden'); | ||
123 | |||
124 | if (!children.length) { | ||
125 | this.responsivetab.addClass('uk-hidden'); | ||
126 | return; | ||
127 | } | ||
128 | |||
129 | var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)), | ||
130 | doresponsive = false, | ||
131 | item, link, clone; | ||
132 | |||
133 | this.responsivetab.lst.empty(); | ||
134 | |||
135 | children.each(function(){ | ||
136 | |||
137 | if (UI.$(this).offset().top > top) { | ||
138 | doresponsive = true; | ||
139 | } | ||
140 | }); | ||
141 | |||
142 | if (doresponsive) { | ||
143 | |||
144 | for (var i = 0; i < children.length; i++) { | ||
145 | |||
146 | item = UI.$(children.eq(i)); | ||
147 | link = item.find('a'); | ||
148 | |||
149 | if (item.css('float') != 'none' && !item.attr('uk-dropdown')) { | ||
150 | |||
151 | if (!item.hasClass('uk-disabled')) { | ||
152 | |||
153 | clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" '); | ||
154 | |||
155 | this.responsivetab.lst.append(clone); | ||
156 | } | ||
157 | |||
158 | item.addClass('uk-hidden'); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | |||
163 | this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden'); | ||
164 | } | ||
165 | }); | ||
166 | |||
167 | })(UIkit); | ||
diff --git a/js/core/tab.min.js b/js/core/tab.min.js new file mode 100755 index 0000000..ead79e0 --- /dev/null +++ b/js/core/tab.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";t.component("tab",{defaults:{target:">li:not(.uk-tab-responsive, .uk-disabled)",connect:!1,active:0,animation:!1,duration:200,swiping:!0},boot:function(){t.ready(function(i){t.$("[data-uk-tab]",i).each(function(){var i=t.$(this);if(!i.data("tab")){t.tab(i,t.Utils.options(i.attr("data-uk-tab")))}})})},init:function(){var i=this;this.current=!1,this.on("click.uk.tab",this.options.target,function(e){if(e.preventDefault(),!i.switcher||!i.switcher.animating){var s=i.find(i.options.target).not(this);s.removeClass("uk-active").blur(),i.trigger("change.uk.tab",[t.$(this).addClass("uk-active"),i.current]),i.current=t.$(this),i.options.connect||(s.attr("aria-expanded","false"),t.$(this).attr("aria-expanded","true"))}}),this.options.connect&&(this.connect=t.$(this.options.connect)),this.responsivetab=t.$('<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>'),this.responsivetab.dropdown=this.responsivetab.find(".uk-dropdown"),this.responsivetab.lst=this.responsivetab.dropdown.find("ul"),this.responsivetab.caption=this.responsivetab.find("a:first"),this.element.hasClass("uk-tab-bottom")&&this.responsivetab.dropdown.addClass("uk-dropdown-up"),this.responsivetab.lst.on("click.uk.tab","a",function(e){e.preventDefault(),e.stopPropagation();var s=t.$(this);i.element.children("li:not(.uk-tab-responsive)").eq(s.data("index")).trigger("click")}),this.on("show.uk.switcher change.uk.tab",function(t,e){i.responsivetab.caption.html(e.text())}),this.element.append(this.responsivetab),this.options.connect&&(this.switcher=t.switcher(this.element,{toggle:">li:not(.uk-tab-responsive)",connect:this.options.connect,active:this.options.active,animation:this.options.animation,duration:this.options.duration,swiping:this.options.swiping})),t.dropdown(this.responsivetab,{mode:"click",preventflip:"y"}),i.trigger("change.uk.tab",[this.element.find(this.options.target).not(".uk-tab-responsive").filter(".uk-active")]),this.check(),t.$win.on("resize orientationchange",t.Utils.debounce(function(){i.element.is(":visible")&&i.check()},100)),this.on("display.uk.check",function(){i.element.is(":visible")&&i.check()})},check:function(){var i=this.element.children("li:not(.uk-tab-responsive)").removeClass("uk-hidden");if(!i.length)return this.responsivetab.addClass("uk-hidden"),void 0;var e,s,n,a=i.eq(0).offset().top+Math.ceil(i.eq(0).height()/2),o=!1;if(this.responsivetab.lst.empty(),i.each(function(){t.$(this).offset().top>a&&(o=!0)}),o)for(var r=0;r<i.length;r++)e=t.$(i.eq(r)),s=e.find("a"),"none"==e.css("float")||e.attr("uk-dropdown")||(e.hasClass("uk-disabled")||(n=e[0].outerHTML.replace("<a ",'<a data-index="'+r+'" '),this.responsivetab.lst.append(n)),e.addClass("uk-hidden"));this.responsivetab[this.responsivetab.lst.children("li").length?"removeClass":"addClass"]("uk-hidden")}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/toggle.js b/js/core/toggle.js new file mode 100755 index 0000000..05fc2b3 --- /dev/null +++ b/js/core/toggle.js | |||
@@ -0,0 +1,120 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI){ | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var toggles = []; | ||
7 | |||
8 | UI.component('toggle', { | ||
9 | |||
10 | defaults: { | ||
11 | target : false, | ||
12 | cls : 'uk-hidden', | ||
13 | animation : false, | ||
14 | duration : 200 | ||
15 | }, | ||
16 | |||
17 | boot: function(){ | ||
18 | |||
19 | // init code | ||
20 | UI.ready(function(context) { | ||
21 | |||
22 | UI.$("[data-uk-toggle]", context).each(function() { | ||
23 | var ele = UI.$(this); | ||
24 | |||
25 | if (!ele.data("toggle")) { | ||
26 | var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle"))); | ||
27 | } | ||
28 | }); | ||
29 | |||
30 | setTimeout(function(){ | ||
31 | |||
32 | toggles.forEach(function(toggle){ | ||
33 | toggle.getToggles(); | ||
34 | }); | ||
35 | |||
36 | }, 0); | ||
37 | }); | ||
38 | }, | ||
39 | |||
40 | init: function() { | ||
41 | |||
42 | var $this = this; | ||
43 | |||
44 | this.aria = (this.options.cls.indexOf('uk-hidden') !== -1); | ||
45 | |||
46 | this.getToggles(); | ||
47 | |||
48 | this.on("click", function(e) { | ||
49 | if ($this.element.is('a[href="#"]')) e.preventDefault(); | ||
50 | $this.toggle(); | ||
51 | }); | ||
52 | |||
53 | toggles.push(this); | ||
54 | }, | ||
55 | |||
56 | toggle: function() { | ||
57 | |||
58 | if(!this.totoggle.length) return; | ||
59 | |||
60 | if (this.options.animation && UI.support.animation) { | ||
61 | |||
62 | var $this = this, animations = this.options.animation.split(','); | ||
63 | |||
64 | if (animations.length == 1) { | ||
65 | animations[1] = animations[0]; | ||
66 | } | ||
67 | |||
68 | animations[0] = animations[0].trim(); | ||
69 | animations[1] = animations[1].trim(); | ||
70 | |||
71 | this.totoggle.css('animation-duration', this.options.duration+'ms'); | ||
72 | |||
73 | this.totoggle.each(function(){ | ||
74 | |||
75 | var ele = UI.$(this); | ||
76 | |||
77 | if (ele.hasClass($this.options.cls)) { | ||
78 | |||
79 | ele.toggleClass($this.options.cls); | ||
80 | |||
81 | UI.Utils.animate(ele, animations[0]).then(function(){ | ||
82 | ele.css('animation-duration', ''); | ||
83 | UI.Utils.checkDisplay(ele); | ||
84 | }); | ||
85 | |||
86 | } else { | ||
87 | |||
88 | UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){ | ||
89 | ele.toggleClass($this.options.cls).css('animation-duration', ''); | ||
90 | UI.Utils.checkDisplay(ele); | ||
91 | }); | ||
92 | |||
93 | } | ||
94 | |||
95 | }); | ||
96 | |||
97 | } else { | ||
98 | this.totoggle.toggleClass(this.options.cls); | ||
99 | UI.Utils.checkDisplay(this.totoggle); | ||
100 | } | ||
101 | |||
102 | this.updateAria(); | ||
103 | |||
104 | }, | ||
105 | |||
106 | getToggles: function() { | ||
107 | this.totoggle = this.options.target ? UI.$(this.options.target):[]; | ||
108 | this.updateAria(); | ||
109 | }, | ||
110 | |||
111 | updateAria: function() { | ||
112 | if (this.aria && this.totoggle.length) { | ||
113 | this.totoggle.each(function(){ | ||
114 | UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden')); | ||
115 | }); | ||
116 | } | ||
117 | } | ||
118 | }); | ||
119 | |||
120 | })(UIkit); | ||
diff --git a/js/core/toggle.min.js b/js/core/toggle.min.js new file mode 100755 index 0000000..e410b19 --- /dev/null +++ b/js/core/toggle.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(t){"use strict";var i=[];t.component("toggle",{defaults:{target:!1,cls:"uk-hidden",animation:!1,duration:200},boot:function(){t.ready(function(o){t.$("[data-uk-toggle]",o).each(function(){var i=t.$(this);if(!i.data("toggle")){t.toggle(i,t.Utils.options(i.attr("data-uk-toggle")))}}),setTimeout(function(){i.forEach(function(t){t.getToggles()})},0)})},init:function(){var t=this;this.aria=-1!==this.options.cls.indexOf("uk-hidden"),this.getToggles(),this.on("click",function(i){t.element.is('a[href="#"]')&&i.preventDefault(),t.toggle()}),i.push(this)},toggle:function(){if(this.totoggle.length){if(this.options.animation&&t.support.animation){var i=this,o=this.options.animation.split(",");1==o.length&&(o[1]=o[0]),o[0]=o[0].trim(),o[1]=o[1].trim(),this.totoggle.css("animation-duration",this.options.duration+"ms"),this.totoggle.each(function(){var s=t.$(this);s.hasClass(i.options.cls)?(s.toggleClass(i.options.cls),t.Utils.animate(s,o[0]).then(function(){s.css("animation-duration",""),t.Utils.checkDisplay(s)})):t.Utils.animate(this,o[1]+" uk-animation-reverse").then(function(){s.toggleClass(i.options.cls).css("animation-duration",""),t.Utils.checkDisplay(s)})})}else this.totoggle.toggleClass(this.options.cls),t.Utils.checkDisplay(this.totoggle);this.updateAria()}},getToggles:function(){this.totoggle=this.options.target?t.$(this.options.target):[],this.updateAria()},updateAria:function(){this.aria&&this.totoggle.length&&this.totoggle.each(function(){t.$(this).attr("aria-hidden",t.$(this).hasClass("uk-hidden"))})}})}(UIkit); \ No newline at end of file | ||
diff --git a/js/core/touch.js b/js/core/touch.js new file mode 100755 index 0000000..43577d8 --- /dev/null +++ b/js/core/touch.js | |||
@@ -0,0 +1,175 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | // Based on Zeptos touch.js | ||
3 | // https://raw.github.com/madrobby/zepto/master/src/touch.js | ||
4 | // Zepto.js may be freely distributed under the MIT license. | ||
5 | |||
6 | ;(function($){ | ||
7 | |||
8 | if ($.fn.swipeLeft) { | ||
9 | return; | ||
10 | } | ||
11 | |||
12 | |||
13 | var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture; | ||
14 | |||
15 | function swipeDirection(x1, x2, y1, y2) { | ||
16 | return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down'); | ||
17 | } | ||
18 | |||
19 | function longTap() { | ||
20 | longTapTimeout = null; | ||
21 | if (touch.last) { | ||
22 | if ( touch.el !== undefined ) touch.el.trigger('longTap'); | ||
23 | touch = {}; | ||
24 | } | ||
25 | } | ||
26 | |||
27 | function cancelLongTap() { | ||
28 | if (longTapTimeout) clearTimeout(longTapTimeout); | ||
29 | longTapTimeout = null; | ||
30 | } | ||
31 | |||
32 | function cancelAll() { | ||
33 | if (touchTimeout) clearTimeout(touchTimeout); | ||
34 | if (tapTimeout) clearTimeout(tapTimeout); | ||
35 | if (swipeTimeout) clearTimeout(swipeTimeout); | ||
36 | if (longTapTimeout) clearTimeout(longTapTimeout); | ||
37 | touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null; | ||
38 | touch = {}; | ||
39 | } | ||
40 | |||
41 | function isPrimaryTouch(event){ | ||
42 | return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary; | ||
43 | } | ||
44 | |||
45 | $(function(){ | ||
46 | var now, delta, deltaX = 0, deltaY = 0, firstTouch; | ||
47 | |||
48 | if ('MSGesture' in window) { | ||
49 | gesture = new MSGesture(); | ||
50 | gesture.target = document.body; | ||
51 | } | ||
52 | |||
53 | $(document) | ||
54 | .on('MSGestureEnd gestureend', function(e){ | ||
55 | |||
56 | var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null; | ||
57 | |||
58 | if (swipeDirectionFromVelocity && touch.el !== undefined) { | ||
59 | touch.el.trigger('swipe'); | ||
60 | touch.el.trigger('swipe'+ swipeDirectionFromVelocity); | ||
61 | } | ||
62 | }) | ||
63 | // MSPointerDown: for IE10 | ||
64 | // pointerdown: for IE11 | ||
65 | .on('touchstart MSPointerDown pointerdown', function(e){ | ||
66 | |||
67 | if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return; | ||
68 | |||
69 | firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0]; | ||
70 | |||
71 | now = Date.now(); | ||
72 | delta = now - (touch.last || now); | ||
73 | touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode); | ||
74 | |||
75 | if(touchTimeout) clearTimeout(touchTimeout); | ||
76 | |||
77 | touch.x1 = firstTouch.pageX; | ||
78 | touch.y1 = firstTouch.pageY; | ||
79 | |||
80 | if (delta > 0 && delta <= 250) touch.isDoubleTap = true; | ||
81 | |||
82 | touch.last = now; | ||
83 | longTapTimeout = setTimeout(longTap, longTapDelay); | ||
84 | |||
85 | // adds the current touch contact for IE gesture recognition | ||
86 | if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) { | ||
87 | gesture.addPointer(e.originalEvent.pointerId); | ||
88 | } | ||
89 | |||
90 | }) | ||
91 | // MSPointerMove: for IE10 | ||
92 | // pointermove: for IE11 | ||
93 | .on('touchmove MSPointerMove pointermove', function(e){ | ||
94 | |||
95 | if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return; | ||
96 | |||
97 | firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0]; | ||
98 | |||
99 | cancelLongTap(); | ||
100 | touch.x2 = firstTouch.pageX; | ||
101 | touch.y2 = firstTouch.pageY; | ||
102 | |||
103 | deltaX += Math.abs(touch.x1 - touch.x2); | ||
104 | deltaY += Math.abs(touch.y1 - touch.y2); | ||
105 | }) | ||
106 | // MSPointerUp: for IE10 | ||
107 | // pointerup: for IE11 | ||
108 | .on('touchend MSPointerUp pointerup', function(e){ | ||
109 | |||
110 | if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return; | ||
111 | |||
112 | cancelLongTap(); | ||
113 | |||
114 | // swipe | ||
115 | if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){ | ||
116 | |||
117 | swipeTimeout = setTimeout(function() { | ||
118 | if ( touch.el !== undefined ) { | ||
119 | touch.el.trigger('swipe'); | ||
120 | touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))); | ||
121 | } | ||
122 | touch = {}; | ||
123 | }, 0); | ||
124 | |||
125 | // normal tap | ||
126 | } else if ('last' in touch) { | ||
127 | |||
128 | // don't fire tap when delta position changed by more than 30 pixels, | ||
129 | // for instance when moving to a point and back to origin | ||
130 | if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) { | ||
131 | // delay by one tick so we can cancel the 'tap' event if 'scroll' fires | ||
132 | // ('tap' fires before 'scroll') | ||
133 | tapTimeout = setTimeout(function() { | ||
134 | |||
135 | // trigger universal 'tap' with the option to cancelTouch() | ||
136 | // (cancelTouch cancels processing of single vs double taps for faster 'tap' response) | ||
137 | var event = $.Event('tap'); | ||
138 | event.cancelTouch = cancelAll; | ||
139 | if ( touch.el !== undefined ) touch.el.trigger(event); | ||
140 | |||
141 | // trigger double tap immediately | ||
142 | if (touch.isDoubleTap) { | ||
143 | if ( touch.el !== undefined ) touch.el.trigger('doubleTap'); | ||
144 | touch = {}; | ||
145 | } | ||
146 | |||
147 | // trigger single tap after 250ms of inactivity | ||
148 | else { | ||
149 | touchTimeout = setTimeout(function(){ | ||
150 | touchTimeout = null; | ||
151 | if ( touch.el !== undefined ) touch.el.trigger('singleTap'); | ||
152 | touch = {}; | ||
153 | }, 250); | ||
154 | } | ||
155 | }, 0); | ||
156 | } else { | ||
157 | touch = {}; | ||
158 | } | ||
159 | deltaX = deltaY = 0; | ||
160 | } | ||
161 | }) | ||
162 | // when the browser window loses focus, | ||
163 | // for example when a modal dialog is shown, | ||
164 | // cancel all ongoing events | ||
165 | .on('touchcancel MSPointerCancel', cancelAll); | ||
166 | |||
167 | // scrolling the window indicates intention of the user | ||
168 | // to scroll, not tap or swipe, so cancel all ongoing events | ||
169 | $(window).on('scroll', cancelAll); | ||
170 | }); | ||
171 | |||
172 | ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){ | ||
173 | $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); }; | ||
174 | }); | ||
175 | })(jQuery); | ||
diff --git a/js/core/touch.min.js b/js/core/touch.min.js new file mode 100755 index 0000000..b86dfd1 --- /dev/null +++ b/js/core/touch.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | !function(e){function t(e,t,n,o){return Math.abs(e-t)>=Math.abs(n-o)?e-t>0?"Left":"Right":n-o>0?"Up":"Down"}function n(){p=null,g.last&&(void 0!==g.el&&g.el.trigger("longTap"),g={})}function o(){p&&clearTimeout(p),p=null}function i(){a&&clearTimeout(a),l&&clearTimeout(l),u&&clearTimeout(u),p&&clearTimeout(p),a=l=u=p=null,g={}}function r(e){return e.pointerType==e.MSPOINTER_TYPE_TOUCH&&e.isPrimary}if(!e.fn.swipeLeft){var a,l,u,p,c,g={},s=750;e(function(){var v,y,w,f=0,d=0;"MSGesture"in window&&(c=new MSGesture,c.target=document.body),e(document).on("MSGestureEnd gestureend",function(e){var t=e.originalEvent.velocityX>1?"Right":e.originalEvent.velocityX<-1?"Left":e.originalEvent.velocityY>1?"Down":e.originalEvent.velocityY<-1?"Up":null;t&&void 0!==g.el&&(g.el.trigger("swipe"),g.el.trigger("swipe"+t))}).on("touchstart MSPointerDown pointerdown",function(t){("MSPointerDown"!=t.type||r(t.originalEvent))&&(w="MSPointerDown"==t.type||"pointerdown"==t.type?t:t.originalEvent.touches[0],v=Date.now(),y=v-(g.last||v),g.el=e("tagName"in w.target?w.target:w.target.parentNode),a&&clearTimeout(a),g.x1=w.pageX,g.y1=w.pageY,y>0&&250>=y&&(g.isDoubleTap=!0),g.last=v,p=setTimeout(n,s),!c||"MSPointerDown"!=t.type&&"pointerdown"!=t.type&&"touchstart"!=t.type||c.addPointer(t.originalEvent.pointerId))}).on("touchmove MSPointerMove pointermove",function(e){("MSPointerMove"!=e.type||r(e.originalEvent))&&(w="MSPointerMove"==e.type||"pointermove"==e.type?e:e.originalEvent.touches[0],o(),g.x2=w.pageX,g.y2=w.pageY,f+=Math.abs(g.x1-g.x2),d+=Math.abs(g.y1-g.y2))}).on("touchend MSPointerUp pointerup",function(n){("MSPointerUp"!=n.type||r(n.originalEvent))&&(o(),g.x2&&Math.abs(g.x1-g.x2)>30||g.y2&&Math.abs(g.y1-g.y2)>30?u=setTimeout(function(){void 0!==g.el&&(g.el.trigger("swipe"),g.el.trigger("swipe"+t(g.x1,g.x2,g.y1,g.y2))),g={}},0):"last"in g&&(isNaN(f)||30>f&&30>d?l=setTimeout(function(){var t=e.Event("tap");t.cancelTouch=i,void 0!==g.el&&g.el.trigger(t),g.isDoubleTap?(void 0!==g.el&&g.el.trigger("doubleTap"),g={}):a=setTimeout(function(){a=null,void 0!==g.el&&g.el.trigger("singleTap"),g={}},250)},0):g={},f=d=0))}).on("touchcancel MSPointerCancel",i),e(window).on("scroll",i)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(t){e.fn[t]=function(n){return e(this).on(t,n)}})}}(jQuery); \ No newline at end of file | ||
diff --git a/js/core/utility.js b/js/core/utility.js new file mode 100755 index 0000000..0090b8c --- /dev/null +++ b/js/core/utility.js | |||
@@ -0,0 +1,319 @@ | |||
1 | /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | ||
2 | (function(UI) { | ||
3 | |||
4 | "use strict"; | ||
5 | |||
6 | var stacks = []; | ||
7 | |||
8 | UI.component('stackMargin', { | ||
9 | |||
10 | defaults: { | ||
11 | cls: 'uk-margin-small-top', | ||
12 | rowfirst: false, | ||
13 | observe: false | ||
14 | }, | ||
15 | |||
16 | boot: function() { | ||
17 | |||
18 | // init code | ||
19 | UI.ready(function(context) { | ||
20 | |||
21 | UI.$("[data-uk-margin]", context).each(function() { | ||
22 | |||
23 | var ele = UI.$(this); | ||
24 | |||
25 | if (!ele.data("stackMargin")) { | ||
26 | UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin"))); | ||
27 | } | ||
28 | }); | ||
29 | }); | ||
30 | }, | ||
31 | |||
32 | init: function() { | ||
33 | |||
34 | var $this = this; | ||
35 | |||
36 | UI.$win.on('resize orientationchange', (function() { | ||
37 | |||
38 | var fn = function() { | ||
39 | $this.process(); | ||
40 | }; | ||
41 | |||
42 | UI.$(function() { | ||
43 | fn(); | ||
44 | UI.$win.on("load", fn); | ||
45 | }); | ||
46 | |||
47 | return UI.Utils.debounce(fn, 20); | ||
48 | })()); | ||
49 | |||
50 | this.on("display.uk.check", function(e) { | ||
51 | if (this.element.is(":visible")) this.process(); | ||
52 | }.bind(this)); | ||
53 | |||
54 | if (this.options.observe) { | ||
55 | |||
56 | UI.domObserve(this.element, function(e) { | ||
57 | if ($this.element.is(":visible")) $this.process(); | ||
58 | }); | ||
59 | } | ||
60 | |||
61 | stacks.push(this); | ||
62 | }, | ||
63 | |||
64 | process: function() { | ||
65 | |||
66 | var $this = this, columns = this.element.children(); | ||
67 | |||
68 | UI.Utils.stackMargin(columns, this.options); | ||
69 | |||
70 | if (!this.options.rowfirst || !columns.length) { | ||
71 | return this; | ||
72 | } | ||
73 | |||
74 | // Mark first column elements | ||
75 | var group = {}, minleft = false; | ||
76 | |||
77 | columns.removeClass(this.options.rowfirst).each(function(offset, $ele){ | ||
78 | |||
79 | $ele = UI.$(this); | ||
80 | |||
81 | if (this.style.display != 'none') { | ||
82 | offset = $ele.offset().left; | ||
83 | ((group[offset] = group[offset] || []) && group[offset]).push(this); | ||
84 | minleft = minleft === false ? offset : Math.min(minleft, offset); | ||
85 | } | ||
86 | }); | ||
87 | |||
88 | UI.$(group[minleft]).addClass(this.options.rowfirst); | ||
89 | |||
90 | return this; | ||
91 | } | ||
92 | |||
93 | }); | ||
94 | |||
95 | |||
96 | // responsive element e.g. iframes | ||
97 | |||
98 | (function(){ | ||
99 | |||
100 | var elements = [], check = function(ele) { | ||
101 | |||
102 | if (!ele.is(':visible')) return; | ||
103 | |||
104 | var width = ele.parent().width(), | ||
105 | iwidth = ele.data('width'), | ||
106 | ratio = (width / iwidth), | ||
107 | height = Math.floor(ratio * ele.data('height')); | ||
108 | |||
109 | ele.css({'height': (width < iwidth) ? height : ele.data('height')}); | ||
110 | }; | ||
111 | |||
112 | UI.component('responsiveElement', { | ||
113 | |||
114 | defaults: {}, | ||
115 | |||
116 | boot: function() { | ||
117 | |||
118 | // init code | ||
119 | UI.ready(function(context) { | ||
120 | |||
121 | UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() { | ||
122 | |||
123 | var ele = UI.$(this), obj; | ||
124 | |||
125 | if (!ele.data("responsiveElement")) { | ||
126 | obj = UI.responsiveElement(ele, {}); | ||
127 | } | ||
128 | }); | ||
129 | }); | ||
130 | }, | ||
131 | |||
132 | init: function() { | ||
133 | |||
134 | var ele = this.element; | ||
135 | |||
136 | if (ele.attr('width') && ele.attr('height')) { | ||
137 | |||
138 | ele.data({ | ||
139 | |||
140 | 'width' : ele.attr('width'), | ||
141 | 'height': ele.attr('height') | ||
142 | |||
143 | }).on('display.uk.check', function(){ | ||
144 | check(ele); | ||
145 | }); | ||
146 | |||
147 | check(ele); | ||
148 | |||
149 | elements.push(ele); | ||
150 | } | ||
151 | } | ||
152 | }); | ||
153 | |||
154 | UI.$win.on('resize load', UI.Utils.debounce(function(){ | ||
155 | |||
156 | elements.forEach(function(ele){ | ||
157 | check(ele); | ||
158 | }); | ||
159 | |||
160 | }, 15)); | ||
161 | |||
162 | })(); | ||
163 | |||
164 | |||
165 | |||
166 | // helper | ||
167 | |||
168 | UI.Utils.stackMargin = function(elements, options) { | ||
169 | |||
170 | options = UI.$.extend({ | ||
171 | 'cls': 'uk-margin-small-top' | ||
172 | }, options); | ||
173 | |||
174 | elements = UI.$(elements).removeClass(options.cls); | ||
175 | |||
176 | var min = false; | ||
177 | |||
178 | elements.each(function(offset, height, pos, $ele){ | ||
179 | |||
180 | $ele = UI.$(this); | ||
181 | |||
182 | if ($ele.css('display') != 'none') { | ||
183 | |||
184 | offset = $ele.offset(); | ||
185 | height = $ele.outerHeight(); | ||
186 | pos = offset.top + height; | ||
187 | |||
188 | $ele.data({ | ||
189 | 'ukMarginPos': pos, | ||
190 | 'ukMarginTop': offset.top | ||
191 | }); | ||
192 | |||
193 | if (min === false || (offset.top < min.top) ) { | ||
194 | |||
195 | min = { | ||
196 | top : offset.top, | ||
197 | left : offset.left, | ||
198 | pos : pos | ||
199 | }; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | }).each(function($ele) { | ||
204 | |||
205 | $ele = UI.$(this); | ||
206 | |||
207 | if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) { | ||
208 | $ele.addClass(options.cls); | ||
209 | } | ||
210 | }); | ||
211 | }; | ||
212 | |||
213 | UI.Utils.matchHeights = function(elements, options) { | ||
214 | |||
215 | elements = UI.$(elements).css('min-height', ''); | ||
216 | options = UI.$.extend({ row : true }, options); | ||
217 | |||
218 | var matchHeights = function(group){ | ||
219 | |||
220 | if (group.length < 2) return; | ||
221 | |||
222 | var max = 0; | ||
223 | |||
224 | group.each(function() { | ||
225 | max = Math.max(max, UI.$(this).outerHeight()); | ||
226 | }).each(function() { | ||
227 | |||
228 | var element = UI.$(this), | ||
229 | height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height())); | ||
230 | |||
231 | element.css('min-height', height + 'px'); | ||
232 | }); | ||
233 | }; | ||
234 | |||
235 | if (options.row) { | ||
236 | |||
237 | elements.first().width(); // force redraw | ||
238 | |||
239 | setTimeout(function(){ | ||
240 | |||
241 | var lastoffset = false, group = []; | ||
242 | |||
243 | elements.each(function() { | ||
244 | |||
245 | var ele = UI.$(this), offset = ele.offset().top; | ||
246 | |||
247 | if (offset != lastoffset && group.length) { | ||
248 | |||
249 | matchHeights(UI.$(group)); | ||
250 | group = []; | ||
251 | offset = ele.offset().top; | ||
252 | } | ||
253 | |||
254 | group.push(ele); | ||
255 | lastoffset = offset; | ||
256 | }); | ||
257 | |||
258 | if (group.length) { | ||
259 | matchHeights(UI.$(group)); | ||
260 | } | ||
261 | |||
262 | }, 0); | ||
263 | |||
264 | } else { | ||
265 | matchHeights(elements); | ||
266 | } | ||
267 | }; | ||
268 | |||
269 | (function(cacheSvgs){ | ||
270 | |||
271 | UI.Utils.inlineSvg = function(selector, root) { | ||
272 | |||
273 | var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){ | ||
274 | |||
275 | var img = UI.$(this), | ||
276 | src = img.attr('src'); | ||
277 | |||
278 | if (!cacheSvgs[src]) { | ||
279 | |||
280 | var d = UI.$.Deferred(); | ||
281 | |||
282 | UI.$.get(src, {nc: Math.random()}, function(data){ | ||
283 | d.resolve(UI.$(data).find('svg')); | ||
284 | }); | ||
285 | |||
286 | cacheSvgs[src] = d.promise(); | ||
287 | } | ||
288 | |||
289 | cacheSvgs[src].then(function(svg) { | ||
290 | |||
291 | var $svg = UI.$(svg).clone(); | ||
292 | |||
293 | if (img.attr('id')) $svg.attr('id', img.attr('id')); | ||
294 | if (img.attr('class')) $svg.attr('class', img.attr('class')); | ||
295 | if (img.attr('style')) $svg.attr('style', img.attr('style')); | ||
296 | |||
297 | if (img.attr('width')) { | ||
298 | $svg.attr('width', img.attr('width')); | ||
299 | if (!img.attr('height')) $svg.removeAttr('height'); | ||
300 | } | ||
301 | |||
302 | if (img.attr('height')){ | ||
303 | $svg.attr('height', img.attr('height')); | ||
304 | if (!img.attr('width')) $svg.removeAttr('width'); | ||
305 | } | ||
306 | |||
307 | img.replaceWith($svg); | ||
308 | }); | ||
309 | }); | ||
310 | }; | ||
311 | |||
312 | // init code | ||
313 | UI.ready(function(context) { | ||
314 | UI.Utils.inlineSvg('[data-uk-svg]', context); | ||
315 | }); | ||
316 | |||
317 | })({}); | ||
318 | |||
319 | })(UIkit); | ||
diff --git a/js/core/utility.min.js b/js/core/utility.min.js new file mode 100755 index 0000000..1b8e7ab --- /dev/null +++ b/js/core/utility.min.js | |||
@@ -0,0 +1,2 @@ | |||
1 | /*! UIkit 2.26.4 | 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 n=this;t.$win.on("resize orientationchange",function(){var i=function(){n.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(){n.element.is(":visible")&&n.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 n={},e=!1;return i.removeClass(this.options.rowfirst).each(function(i,s){s=t.$(this),"none"!=this.style.display&&(i=s.offset().left,((n[i]=n[i]||[])&&n[i]).push(this),e=e===!1?i:Math.min(e,i))}),t.$(n[e]).addClass(this.options.rowfirst),this}}),function(){var i=[],n=function(t){if(t.is(":visible")){var i=t.parent().width(),n=t.data("width"),e=i/n,s=Math.floor(e*t.data("height"));t.css({height:n>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,n=t.$(this);n.data("responsiveElement")||(i=t.responsiveElement(n,{}))})})},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(){n(t)}),n(t),i.push(t))}}),t.$win.on("resize load",t.Utils.debounce(function(){i.forEach(function(t){n(t)})},15))}(),t.Utils.stackMargin=function(i,n){n=t.$.extend({cls:"uk-margin-small-top"},n),i=t.$(i).removeClass(n.cls);var e=!1;i.each(function(i,n,s,a){a=t.$(this),"none"!=a.css("display")&&(i=a.offset(),n=a.outerHeight(),s=i.top+n,a.data({ukMarginPos:s,ukMarginTop:i.top}),(e===!1||i.top<e.top)&&(e={top:i.top,left:i.left,pos:s}))}).each(function(i){i=t.$(this),"none"!=i.css("display")&&i.data("ukMarginTop")>e.top&&i.data("ukMarginPos")>e.pos&&i.addClass(n.cls)})},t.Utils.matchHeights=function(i,n){i=t.$(i).css("min-height",""),n=t.$.extend({row:!0},n);var e=function(i){if(!(i.length<2)){var n=0;i.each(function(){n=Math.max(n,t.$(this).outerHeight())}).each(function(){var i=t.$(this),e=n-("border-box"==i.css("box-sizing")?0:i.outerHeight()-i.height());i.css("min-height",e+"px")})}};n.row?(i.first().width(),setTimeout(function(){var n=!1,s=[];i.each(function(){var i=t.$(this),a=i.offset().top;a!=n&&s.length&&(e(t.$(s)),s=[],a=i.offset().top),s.push(i),n=a}),s.length&&e(t.$(s))},0)):e(i)},function(i){t.Utils.inlineSvg=function(n,e){t.$(n||'img[src$=".svg"]',e||document).each(function(){var n=t.$(this),e=n.attr("src");if(!i[e]){var s=t.$.Deferred();t.$.get(e,{nc:Math.random()},function(i){s.resolve(t.$(i).find("svg"))}),i[e]=s.promise()}i[e].then(function(i){var e=t.$(i).clone();n.attr("id")&&e.attr("id",n.attr("id")),n.attr("class")&&e.attr("class",n.attr("class")),n.attr("style")&&e.attr("style",n.attr("style")),n.attr("width")&&(e.attr("width",n.attr("width")),n.attr("height")||e.removeAttr("height")),n.attr("height")&&(e.attr("height",n.attr("height")),n.attr("width")||e.removeAttr("width")),n.replaceWith(e)})})},t.ready(function(i){t.Utils.inlineSvg("[data-uk-svg]",i)})}({})}(UIkit); \ No newline at end of file | ||