summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/accordion.js174
-rwxr-xr-xjs/components/accordion.min.js2
-rwxr-xr-xjs/components/autocomplete.js334
-rwxr-xr-xjs/components/autocomplete.min.js2
-rwxr-xr-xjs/components/datepicker.js3166
-rwxr-xr-xjs/components/datepicker.min.js3
-rwxr-xr-xjs/components/form-password.js67
-rwxr-xr-xjs/components/form-password.min.js2
-rwxr-xr-xjs/components/form-select.js77
-rwxr-xr-xjs/components/form-select.min.js2
-rwxr-xr-xjs/components/grid-parallax.js168
-rwxr-xr-xjs/components/grid-parallax.min.js2
-rwxr-xr-xjs/components/grid.js527
-rwxr-xr-xjs/components/grid.min.js2
-rwxr-xr-xjs/components/htmleditor.js679
-rwxr-xr-xjs/components/htmleditor.min.js2
-rwxr-xr-xjs/components/lightbox.js591
-rwxr-xr-xjs/components/lightbox.min.js2
-rwxr-xr-xjs/components/nestable.js653
-rwxr-xr-xjs/components/nestable.min.js2
-rwxr-xr-xjs/components/notify.js189
-rwxr-xr-xjs/components/notify.min.js2
-rwxr-xr-xjs/components/pagination.js147
-rwxr-xr-xjs/components/pagination.min.js2
-rwxr-xr-xjs/components/parallax.js462
-rwxr-xr-xjs/components/parallax.min.js2
-rwxr-xr-xjs/components/search.js92
-rwxr-xr-xjs/components/search.min.js2
-rwxr-xr-xjs/components/slider.js540
-rwxr-xr-xjs/components/slider.min.js2
-rwxr-xr-xjs/components/slideset.js514
-rwxr-xr-xjs/components/slideset.min.js2
-rwxr-xr-xjs/components/slideshow-fx.js383
-rwxr-xr-xjs/components/slideshow-fx.min.js2
-rwxr-xr-xjs/components/slideshow.js560
-rwxr-xr-xjs/components/slideshow.min.js2
-rwxr-xr-xjs/components/sortable.js688
-rwxr-xr-xjs/components/sortable.min.js2
-rwxr-xr-xjs/components/sticky.js364
-rwxr-xr-xjs/components/sticky.min.js2
-rwxr-xr-xjs/components/timepicker.js192
-rwxr-xr-xjs/components/timepicker.min.js2
-rwxr-xr-xjs/components/tooltip.js234
-rwxr-xr-xjs/components/tooltip.min.js2
-rwxr-xr-xjs/components/upload.js257
-rwxr-xr-xjs/components/upload.min.js2
-rwxr-xr-xjs/core/alert.js66
-rwxr-xr-xjs/core/alert.min.js2
-rwxr-xr-xjs/core/button.js157
-rwxr-xr-xjs/core/button.min.js2
-rwxr-xr-xjs/core/core.js786
-rwxr-xr-xjs/core/core.min.js2
-rwxr-xr-xjs/core/cover.js95
-rwxr-xr-xjs/core/cover.min.js2
-rwxr-xr-xjs/core/dropdown.js525
-rwxr-xr-xjs/core/dropdown.min.js2
-rwxr-xr-xjs/core/grid.js117
-rwxr-xr-xjs/core/grid.min.js2
-rwxr-xr-xjs/core/modal.js393
-rwxr-xr-xjs/core/modal.min.js2
-rwxr-xr-xjs/core/nav.js136
-rwxr-xr-xjs/core/nav.min.js2
-rwxr-xr-xjs/core/offcanvas.js180
-rwxr-xr-xjs/core/offcanvas.min.js2
-rwxr-xr-xjs/core/scrollspy.js209
-rwxr-xr-xjs/core/scrollspy.min.js2
-rwxr-xr-xjs/core/smooth-scroll.js62
-rwxr-xr-xjs/core/smooth-scroll.min.js2
-rwxr-xr-xjs/core/switcher.js307
-rwxr-xr-xjs/core/switcher.min.js2
-rwxr-xr-xjs/core/tab.js167
-rwxr-xr-xjs/core/tab.min.js2
-rwxr-xr-xjs/core/toggle.js120
-rwxr-xr-xjs/core/toggle.min.js2
-rwxr-xr-xjs/core/touch.js175
-rwxr-xr-xjs/core/touch.min.js2
-rwxr-xr-xjs/core/utility.js319
-rwxr-xr-xjs/core/utility.min.js2
-rwxr-xr-xjs/uikit.js3814
-rwxr-xr-xjs/uikit.min.js3
80 files changed, 18768 insertions, 0 deletions
diff --git a/js/components/accordion.js b/js/components/accordion.js
new file mode 100755
index 0000000..2401780
--- /dev/null
+++ b/js/components/accordion.js
@@ -0,0 +1,174 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3 var component;
4
5 if (window.UIkit) {
6 component = addon(UIkit);
7 }
8
9 if (typeof define == "function" && define.amd) {
10 define("uikit-accordion", ["uikit"], function(){
11 return component || addon(UIkit);
12 });
13 }
14})(function(UI){
15
16 "use strict";
17
18 UI.component('accordion', {
19
20 defaults: {
21 showfirst : true,
22 collapse : true,
23 animate : true,
24 easing : 'swing',
25 duration : 300,
26 toggle : '.uk-accordion-title',
27 containers : '.uk-accordion-content',
28 clsactive : 'uk-active'
29 },
30
31 boot: function() {
32
33 // init code
34 UI.ready(function(context) {
35
36 setTimeout(function(){
37
38 UI.$("[data-uk-accordion]", context).each(function(){
39
40 var ele = UI.$(this);
41
42 if(!ele.data("accordion")) {
43 UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
44 }
45 });
46
47 }, 0);
48 });
49 },
50
51 init: function() {
52
53 var $this = this;
54
55 this.element.on('click.uk.accordion', this.options.toggle, function(e) {
56
57 e.preventDefault();
58
59 $this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
60 });
61
62 this.update();
63
64 if (this.options.showfirst) {
65 this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
66 }
67 },
68
69 toggleItem: function(wrapper, animated, collapse) {
70
71 var $this = this;
72
73 wrapper.data('toggle').toggleClass(this.options.clsactive);
74 wrapper.data('content').toggleClass(this.options.clsactive);
75
76 var active = wrapper.data('toggle').hasClass(this.options.clsactive);
77
78 if (collapse) {
79 this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
80 this.content.not(wrapper.data('content')).removeClass(this.options.clsactive)
81 .parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
82 }
83
84 wrapper.stop().css('overflow', 'hidden');
85
86 if (animated) {
87
88 wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
89
90 if (active) {
91 wrapper.css({'overflow': '', 'height': 'auto'});
92 UI.Utils.checkDisplay(wrapper.data('content'));
93 }
94
95 $this.trigger('display.uk.check');
96 }});
97
98 } else {
99
100 wrapper.height(active ? 'auto' : 0);
101
102 if (active) {
103 wrapper.css({'overflow': ''});
104 UI.Utils.checkDisplay(wrapper.data('content'));
105 }
106
107 this.trigger('display.uk.check');
108 }
109
110 // Update ARIA
111 wrapper.attr('aria-expanded', active);
112
113 this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
114 },
115
116 update: function() {
117
118 var $this = this, $content, $wrapper, $toggle;
119
120 this.toggle = this.find(this.options.toggle);
121 this.content = this.find(this.options.containers);
122
123 this.content.each(function(index) {
124
125 $content = UI.$(this);
126
127 if ($content.parent().data('wrapper')) {
128 $wrapper = $content.parent();
129 } else {
130 $wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
131
132 // Init ARIA
133 $wrapper.attr('aria-expanded', 'false');
134 }
135
136 $toggle = $this.toggle.eq(index);
137
138 $wrapper.data('toggle', $toggle);
139 $wrapper.data('content', $content);
140 $toggle.data('wrapper', $wrapper);
141 $content.data('wrapper', $wrapper);
142 });
143
144 this.element.trigger('update.uk.accordion', [this]);
145 }
146
147 });
148
149 // helper
150
151 function getHeight(ele) {
152
153 var $ele = UI.$(ele), height = "auto";
154
155 if ($ele.is(":visible")) {
156 height = $ele.outerHeight();
157 } else {
158
159 var tmp = {
160 position : $ele.css("position"),
161 visibility : $ele.css("visibility"),
162 display : $ele.css("display")
163 };
164
165 height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
166
167 $ele.css(tmp); // reset element
168 }
169
170 return height;
171 }
172
173 return UI.accordion;
174});
diff --git a/js/components/accordion.min.js b/js/components/accordion.min.js
new file mode 100755
index 0000000..ca3e452
--- /dev/null
+++ b/js/components/accordion.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-accordion",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i){var o=t.$(i),e="auto";if(o.is(":visible"))e=o.outerHeight();else{var a={position:o.css("position"),visibility:o.css("visibility"),display:o.css("display")};e=o.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),o.css(a)}return e}return t.component("accordion",{defaults:{showfirst:!0,collapse:!0,animate:!0,easing:"swing",duration:300,toggle:".uk-accordion-title",containers:".uk-accordion-content",clsactive:"uk-active"},boot:function(){t.ready(function(i){setTimeout(function(){t.$("[data-uk-accordion]",i).each(function(){var i=t.$(this);i.data("accordion")||t.accordion(i,t.Utils.options(i.attr("data-uk-accordion")))})},0)})},init:function(){var i=this;this.element.on("click.uk.accordion",this.options.toggle,function(o){o.preventDefault(),i.toggleItem(t.$(this).data("wrapper"),i.options.animate,i.options.collapse)}),this.update(),this.options.showfirst&&this.toggleItem(this.toggle.eq(0).data("wrapper"),!1,!1)},toggleItem:function(o,e,a){var n=this;o.data("toggle").toggleClass(this.options.clsactive),o.data("content").toggleClass(this.options.clsactive);var s=o.data("toggle").hasClass(this.options.clsactive);a&&(this.toggle.not(o.data("toggle")).removeClass(this.options.clsactive),this.content.not(o.data("content")).removeClass(this.options.clsactive).parent().stop().css("overflow","hidden").animate({height:0},{easing:this.options.easing,duration:e?this.options.duration:0}).attr("aria-expanded","false")),o.stop().css("overflow","hidden"),e?o.animate({height:s?i(o.data("content")):0},{easing:this.options.easing,duration:this.options.duration,complete:function(){s&&(o.css({overflow:"",height:"auto"}),t.Utils.checkDisplay(o.data("content"))),n.trigger("display.uk.check")}}):(o.height(s?"auto":0),s&&(o.css({overflow:""}),t.Utils.checkDisplay(o.data("content"))),this.trigger("display.uk.check")),o.attr("aria-expanded",s),this.element.trigger("toggle.uk.accordion",[s,o.data("toggle"),o.data("content")])},update:function(){var i,o,e,a=this;this.toggle=this.find(this.options.toggle),this.content=this.find(this.options.containers),this.content.each(function(n){i=t.$(this),i.parent().data("wrapper")?o=i.parent():(o=t.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent(),o.attr("aria-expanded","false")),e=a.toggle.eq(n),o.data("toggle",e),o.data("content",i),e.data("wrapper",o),i.data("wrapper",o)}),this.element.trigger("update.uk.accordion",[this])}}),t.accordion}); \ No newline at end of file
diff --git a/js/components/autocomplete.js b/js/components/autocomplete.js
new file mode 100755
index 0000000..58a405d
--- /dev/null
+++ b/js/components/autocomplete.js
@@ -0,0 +1,334 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-autocomplete", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var active;
21
22 UI.component('autocomplete', {
23
24 defaults: {
25 minLength: 3,
26 param: 'search',
27 method: 'post',
28 delay: 300,
29 loadingClass: 'uk-loading',
30 flipDropdown: false,
31 skipClass: 'uk-skip',
32 hoverClass: 'uk-active',
33 source: null,
34 renderer: null,
35
36 // template
37
38 template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
39 },
40
41 visible : false,
42 value : null,
43 selected : null,
44
45 boot: function() {
46
47 // init code
48 UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
49
50 var ele = UI.$(this);
51
52 if (!ele.data("autocomplete")) {
53 UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
54 }
55 });
56
57 // register outer click for autocompletes
58 UI.$html.on("click.autocomplete.uikit", function(e) {
59 if (active && e.target!=active.input[0]) active.hide();
60 });
61 },
62
63 init: function() {
64
65 var $this = this,
66 select = false,
67 trigger = UI.Utils.debounce(function(e) {
68 if(select) {
69 return (select = false);
70 }
71 $this.handle();
72 }, this.options.delay);
73
74
75 this.dropdown = this.find('.uk-dropdown');
76 this.template = this.find('script[type="text/autocomplete"]').html();
77 this.template = UI.Utils.template(this.template || this.options.template);
78 this.input = this.find("input:first").attr("autocomplete", "off");
79
80 if (!this.dropdown.length) {
81 this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
82 }
83
84 if (this.options.flipDropdown) {
85 this.dropdown.addClass('uk-dropdown-flip');
86 }
87
88 this.dropdown.attr('aria-expanded', 'false');
89
90 this.input.on({
91 "keydown": function(e) {
92
93 if (e && e.which && !e.shiftKey) {
94
95 switch (e.which) {
96 case 13: // enter
97 select = true;
98
99 if ($this.selected) {
100 e.preventDefault();
101 $this.select();
102 }
103 break;
104 case 38: // up
105 e.preventDefault();
106 $this.pick('prev', true);
107 break;
108 case 40: // down
109 e.preventDefault();
110 $this.pick('next', true);
111 break;
112 case 27:
113 case 9: // esc, tab
114 $this.hide();
115 break;
116 default:
117 break;
118 }
119 }
120
121 },
122 "keyup": trigger
123 });
124
125 this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
126 $this.select();
127 });
128
129 this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
130 $this.pick(UI.$(this));
131 });
132
133 this.triggercomplete = trigger;
134 },
135
136 handle: function() {
137
138 var $this = this, old = this.value;
139
140 this.value = this.input.val();
141
142 if (this.value.length < this.options.minLength) return this.hide();
143
144 if (this.value != old) {
145 $this.request();
146 }
147
148 return this;
149 },
150
151 pick: function(item, scrollinview) {
152
153 var $this = this,
154 items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
155 selected = false;
156
157 if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
158 selected = item;
159 } else if (item == 'next' || item == 'prev') {
160
161 if (this.selected) {
162 var index = items.index(this.selected);
163
164 if (item == 'next') {
165 selected = items.eq(index + 1 < items.length ? index + 1 : 0);
166 } else {
167 selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
168 }
169
170 } else {
171 selected = items[(item == 'next') ? 'first' : 'last']();
172 }
173
174 selected = UI.$(selected);
175 }
176
177 if (selected && selected.length) {
178 this.selected = selected;
179 items.removeClass(this.options.hoverClass);
180 this.selected.addClass(this.options.hoverClass);
181
182 // jump to selected if not in view
183 if (scrollinview) {
184
185 var top = selected.position().top,
186 scrollTop = $this.dropdown.scrollTop(),
187 dpheight = $this.dropdown.height();
188
189 if (top > dpheight || top < 0) {
190 $this.dropdown.scrollTop(scrollTop + top);
191 }
192 }
193 }
194 },
195
196 select: function() {
197
198 if(!this.selected) return;
199
200 var data = this.selected.data();
201
202 this.trigger("selectitem.uk.autocomplete", [data, this]);
203
204 if (data.value) {
205 this.input.val(data.value).trigger('change');
206 }
207
208 this.hide();
209 },
210
211 show: function() {
212 if (this.visible) return;
213 this.visible = true;
214 this.element.addClass("uk-open");
215
216 if (active && active!==this) {
217 active.hide();
218 }
219
220 active = this;
221
222 // Update aria
223 this.dropdown.attr('aria-expanded', 'true');
224
225 return this;
226 },
227
228 hide: function() {
229 if (!this.visible) return;
230 this.visible = false;
231 this.element.removeClass("uk-open");
232
233 if (active === this) {
234 active = false;
235 }
236
237 // Update aria
238 this.dropdown.attr('aria-expanded', 'false');
239
240 return this;
241 },
242
243 request: function() {
244
245 var $this = this,
246 release = function(data) {
247
248 if(data) {
249 $this.render(data);
250 }
251
252 $this.element.removeClass($this.options.loadingClass);
253 };
254
255 this.element.addClass(this.options.loadingClass);
256
257 if (this.options.source) {
258
259 var source = this.options.source;
260
261 switch(typeof(this.options.source)) {
262 case 'function':
263
264 this.options.source.apply(this, [release]);
265
266 break;
267
268 case 'object':
269
270 if(source.length) {
271
272 var items = [];
273
274 source.forEach(function(item){
275 if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
276 items.push(item);
277 }
278 });
279
280 release(items);
281 }
282
283 break;
284
285 case 'string':
286
287 var params ={};
288
289 params[this.options.param] = this.value;
290
291 UI.$.ajax({
292 url: this.options.source,
293 data: params,
294 type: this.options.method,
295 dataType: 'json'
296 }).done(function(json) {
297 release(json || []);
298 });
299
300 break;
301
302 default:
303 release(null);
304 }
305
306 } else {
307 this.element.removeClass($this.options.loadingClass);
308 }
309 },
310
311 render: function(data) {
312
313 this.dropdown.empty();
314
315 this.selected = false;
316
317 if (this.options.renderer) {
318
319 this.options.renderer.apply(this, [data]);
320
321 } else if(data && data.length) {
322
323 this.dropdown.append(this.template({"items":data}));
324 this.show();
325
326 this.trigger('show.uk.autocomplete');
327 }
328
329 return this;
330 }
331 });
332
333 return UI.autocomplete;
334});
diff --git a/js/components/autocomplete.min.js b/js/components/autocomplete.min.js
new file mode 100755
index 0000000..10eed9a
--- /dev/null
+++ b/js/components/autocomplete.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-autocomplete",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e;return t.component("autocomplete",{defaults:{minLength:3,param:"search",method:"post",delay:300,loadingClass:"uk-loading",flipDropdown:!1,skipClass:"uk-skip",hoverClass:"uk-active",source:null,renderer:null,template:'<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'},visible:!1,value:null,selected:null,boot:function(){t.$html.on("focus.autocomplete.uikit","[data-uk-autocomplete]",function(){var e=t.$(this);e.data("autocomplete")||t.autocomplete(e,t.Utils.options(e.attr("data-uk-autocomplete")))}),t.$html.on("click.autocomplete.uikit",function(t){e&&t.target!=e.input[0]&&e.hide()})},init:function(){var e=this,i=!1,s=t.Utils.debounce(function(){return i?i=!1:(e.handle(),void 0)},this.options.delay);this.dropdown=this.find(".uk-dropdown"),this.template=this.find('script[type="text/autocomplete"]').html(),this.template=t.Utils.template(this.template||this.options.template),this.input=this.find("input:first").attr("autocomplete","off"),this.dropdown.length||(this.dropdown=t.$('<div class="uk-dropdown"></div>').appendTo(this.element)),this.options.flipDropdown&&this.dropdown.addClass("uk-dropdown-flip"),this.dropdown.attr("aria-expanded","false"),this.input.on({keydown:function(t){if(t&&t.which&&!t.shiftKey)switch(t.which){case 13:i=!0,e.selected&&(t.preventDefault(),e.select());break;case 38:t.preventDefault(),e.pick("prev",!0);break;case 40:t.preventDefault(),e.pick("next",!0);break;case 27:case 9:e.hide()}},keyup:s}),this.dropdown.on("click",".uk-autocomplete-results > *",function(){e.select()}),this.dropdown.on("mouseover",".uk-autocomplete-results > *",function(){e.pick(t.$(this))}),this.triggercomplete=s},handle:function(){var t=this,e=this.value;return this.value=this.input.val(),this.value.length<this.options.minLength?this.hide():(this.value!=e&&t.request(),this)},pick:function(e,i){var s=this,o=t.$(this.dropdown.find(".uk-autocomplete-results").children(":not(."+this.options.skipClass+")")),n=!1;if("string"==typeof e||e.hasClass(this.options.skipClass)){if("next"==e||"prev"==e){if(this.selected){var a=o.index(this.selected);n="next"==e?o.eq(a+1<o.length?a+1:0):o.eq(0>a-1?o.length-1:a-1)}else n=o["next"==e?"first":"last"]();n=t.$(n)}}else n=e;if(n&&n.length&&(this.selected=n,o.removeClass(this.options.hoverClass),this.selected.addClass(this.options.hoverClass),i)){var l=n.position().top,h=s.dropdown.scrollTop(),r=s.dropdown.height();(l>r||0>l)&&s.dropdown.scrollTop(h+l)}},select:function(){if(this.selected){var t=this.selected.data();this.trigger("selectitem.uk.autocomplete",[t,this]),t.value&&this.input.val(t.value).trigger("change"),this.hide()}},show:function(){return this.visible?void 0:(this.visible=!0,this.element.addClass("uk-open"),e&&e!==this&&e.hide(),e=this,this.dropdown.attr("aria-expanded","true"),this)},hide:function(){return this.visible?(this.visible=!1,this.element.removeClass("uk-open"),e===this&&(e=!1),this.dropdown.attr("aria-expanded","false"),this):void 0},request:function(){var e=this,i=function(t){t&&e.render(t),e.element.removeClass(e.options.loadingClass)};if(this.element.addClass(this.options.loadingClass),this.options.source){var s=this.options.source;switch(typeof this.options.source){case"function":this.options.source.apply(this,[i]);break;case"object":if(s.length){var o=[];s.forEach(function(t){t.value&&-1!=t.value.toLowerCase().indexOf(e.value.toLowerCase())&&o.push(t)}),i(o)}break;case"string":var n={};n[this.options.param]=this.value,t.$.ajax({url:this.options.source,data:n,type:this.options.method,dataType:"json"}).done(function(t){i(t||[])});break;default:i(null)}}else this.element.removeClass(e.options.loadingClass)},render:function(t){return this.dropdown.empty(),this.selected=!1,this.options.renderer?this.options.renderer.apply(this,[t]):t&&t.length&&(this.dropdown.append(this.template({items:t})),this.show(),this.trigger("show.uk.autocomplete")),this}}),t.autocomplete}); \ No newline at end of file
diff --git a/js/components/datepicker.js b/js/components/datepicker.js
new file mode 100755
index 0000000..31890b4
--- /dev/null
+++ b/js/components/datepicker.js
@@ -0,0 +1,3166 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-datepicker", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 // Datepicker
21
22 var active = false, dropdown, moment;
23
24 UI.component('datepicker', {
25
26 defaults: {
27 mobile: false,
28 weekstart: 1,
29 i18n: {
30 months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
31 weekdays : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
32 },
33 format: "YYYY-MM-DD",
34 offsettop: 5,
35 maxDate: false,
36 minDate: false,
37 pos: 'auto',
38 template: function(data, opts) {
39
40 var content = '', i;
41
42 content += '<div class="uk-datepicker-nav">';
43 content += '<a href="" class="uk-datepicker-previous"></a>';
44 content += '<a href="" class="uk-datepicker-next"></a>';
45
46 if (UI.formSelect) {
47
48 var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
49
50 for (i=0;i<opts.i18n.months.length;i++) {
51 if(i==data.month) {
52 options.push('<option value="'+i+'" selected>'+opts.i18n.months[i]+'</option>');
53 } else {
54 options.push('<option value="'+i+'">'+opts.i18n.months[i]+'</option>');
55 }
56 }
57
58 months = '<span class="uk-form-select">'+ opts.i18n.months[data.month] + '<select class="update-picker-month">'+options.join('')+'</select></span>';
59
60 // --
61
62 options = [];
63
64 minYear = data.minDate ? data.minDate.year() : currentyear - 50;
65 maxYear = data.maxDate ? data.maxDate.year() : currentyear + 20;
66
67 for (i=minYear;i<=maxYear;i++) {
68 if (i == data.year) {
69 options.push('<option value="'+i+'" selected>'+i+'</option>');
70 } else {
71 options.push('<option value="'+i+'">'+i+'</option>');
72 }
73 }
74
75 years = '<span class="uk-form-select">'+ data.year + '<select class="update-picker-year">'+options.join('')+'</select></span>';
76
77 content += '<div class="uk-datepicker-heading">'+ months + ' ' + years +'</div>';
78
79 } else {
80 content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
81 }
82
83 content += '</div>';
84
85 content += '<table class="uk-datepicker-table">';
86 content += '<thead>';
87 for(i = 0; i < data.weekdays.length; i++) {
88 if (data.weekdays[i]) {
89 content += '<th>'+data.weekdays[i]+'</th>';
90 }
91 }
92 content += '</thead>';
93
94 content += '<tbody>';
95 for(i = 0; i < data.days.length; i++) {
96 if (data.days[i] && data.days[i].length){
97 content += '<tr>';
98 for(var d = 0; d < data.days[i].length; d++) {
99 if (data.days[i][d]) {
100 var day = data.days[i][d],
101 cls = [];
102
103 if(!day.inmonth) cls.push("uk-datepicker-table-muted");
104 if(day.selected) cls.push("uk-active");
105 if(day.disabled) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
106
107 content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
108 }
109 }
110 content += '</tr>';
111 }
112 }
113 content += '</tbody>';
114
115 content += '</table>';
116
117 return content;
118 }
119 },
120
121 boot: function() {
122
123 UI.$win.on("resize orientationchange", function() {
124
125 if (active) {
126 active.hide();
127 }
128 });
129
130 // init code
131 UI.$html.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
132
133 var ele = UI.$(this);
134
135 if (!ele.data("datepicker")) {
136 e.preventDefault();
137 UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
138 ele.trigger("focus");
139 }
140 });
141
142 UI.$html.on("click focus", '*', function(e) {
143
144 var target = UI.$(e.target);
145
146 if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
147 active.hide();
148 }
149 });
150 },
151
152 init: function() {
153
154 // use native datepicker on touch devices
155 if (UI.support.touch && this.element.attr('type')=='date' && !this.options.mobile) {
156 return;
157 }
158
159 var $this = this;
160
161 this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
162
163 this.on("click focus", function(){
164 if (active!==$this) $this.pick(this.value ? this.value:($this.options.minDate ? $this.options.minDate :''));
165 }).on("change", function(){
166
167 if ($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
168 $this.element.val(moment().format($this.options.format));
169 }
170 });
171
172 // init dropdown
173 if (!dropdown) {
174
175 dropdown = UI.$('<div class="uk-dropdown uk-datepicker"></div>');
176
177 dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
178
179 e.stopPropagation();
180 e.preventDefault();
181
182 var ele = UI.$(this);
183
184 if (ele.hasClass('uk-datepicker-date-disabled')) return false;
185
186 if (ele.is('[data-date]')) {
187 active.current = moment(ele.data("date"));
188 active.element.val(active.current.isValid() ? active.current.format(active.options.format) : null).trigger("change");
189 active.hide();
190 } else {
191 active.add((ele.hasClass("uk-datepicker-next") ? 1:-1), "months");
192 }
193 });
194
195 dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
196
197 var select = UI.$(this);
198 active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
199 });
200
201 dropdown.appendTo("body");
202 }
203 },
204
205 pick: function(initdate) {
206
207 var offset = this.element.offset(),
208 css = {"left": offset.left, "right":""};
209
210 this.current = isNaN(initdate) ? moment(initdate, this.options.format):moment();
211 this.initdate = this.current.format("YYYY-MM-DD");
212
213 this.update();
214
215 if (UI.langdirection == 'right') {
216 css.right = window.innerWidth - (css.left + this.element.outerWidth());
217 css.left = "";
218 }
219
220 var posTop = (offset.top - this.element.outerHeight() + this.element.height()) - this.options.offsettop - dropdown.outerHeight(),
221 posBottom = offset.top + this.element.outerHeight() + this.options.offsettop;
222
223 css.top = posBottom;
224
225 if (this.options.pos == 'top') {
226 css.top = posTop;
227 } else if(this.options.pos == 'auto' && (window.innerHeight - posBottom - dropdown.outerHeight() < 0 && posTop >= 0) ) {
228 css.top = posTop;
229 }
230
231 dropdown.css(css).show();
232 this.trigger('show.uk.datepicker');
233
234 active = this;
235 },
236
237 add: function(unit, value) {
238 this.current.add(unit, value);
239 this.update();
240 },
241
242 setMonth: function(month) {
243 this.current.month(month);
244 this.update();
245 },
246
247 setYear: function(year) {
248 this.current.year(year);
249 this.update();
250 },
251
252 update: function() {
253
254 var data = this.getRows(this.current.year(), this.current.month()),
255 tpl = this.options.template(data, this.options);
256
257 dropdown.html(tpl);
258
259 this.trigger('update.uk.datepicker');
260 },
261
262 getRows: function(year, month) {
263
264 var opts = this.options,
265 now = moment().format('YYYY-MM-DD'),
266 days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
267 before = new Date(year, month, 1, 12).getDay(),
268 data = {"month":month, "year":year,"weekdays":[],"days":[], "maxDate": false, "minDate": false},
269 row = [];
270
271 if (opts.maxDate!==false){
272 data.maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add(opts.maxDate, 'days');
273 }
274
275 if (opts.minDate!==false){
276 data.minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add(opts.minDate-1, 'days');
277 }
278
279 data.weekdays = (function(){
280
281 for (var i=0, arr=[]; i < 7; i++) {
282
283 var day = i + (opts.weekstart || 0);
284
285 while (day >= 7) {
286 day -= 7;
287 }
288
289 arr.push(opts.i18n.weekdays[day]);
290 }
291
292 return arr;
293 })();
294
295 if (opts.weekstart && opts.weekstart > 0) {
296 before -= opts.weekstart;
297 if (before < 0) {
298 before += 7;
299 }
300 }
301
302 var cells = days + before, after = cells;
303
304 while(after > 7) { after -= 7; }
305
306 cells += 7 - after;
307
308 var day, isDisabled, isSelected, isToday, isInMonth;
309
310 for (var i = 0, r = 0; i < cells; i++) {
311
312 day = new Date(year, month, 1 + (i - before), 12);
313 isDisabled = (data.minDate && data.minDate > day) || (data.maxDate && day > data.maxDate);
314 isInMonth = !(i < before || i >= (days + before));
315
316 day = moment(day);
317
318 isSelected = this.initdate == day.format("YYYY-MM-DD");
319 isToday = now == day.format("YYYY-MM-DD");
320
321 row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
322
323 if (++r === 7) {
324 data.days.push(row);
325 row = [];
326 r = 0;
327 }
328 }
329
330 return data;
331 },
332
333 hide: function() {
334
335 if (active && active === this) {
336 dropdown.hide();
337 active = false;
338
339 this.trigger('hide.uk.datepicker');
340 }
341 }
342 });
343
344 //! moment.js
345 //! version : 2.8.3
346 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
347 //! license : MIT
348 //! momentjs.com
349
350 moment = (function (undefined) {
351 /************************************
352 Constants
353 ************************************/
354 var moment,
355 VERSION = '2.8.3',
356 // the global-scope this is NOT the global object in Node.js
357 globalScope = typeof global !== 'undefined' ? global : this,
358 oldGlobalMoment,
359 round = Math.round,
360 hasOwnProperty = Object.prototype.hasOwnProperty,
361 i,
362
363 YEAR = 0,
364 MONTH = 1,
365 DATE = 2,
366 HOUR = 3,
367 MINUTE = 4,
368 SECOND = 5,
369 MILLISECOND = 6,
370
371 // internal storage for locale config files
372 locales = {},
373
374 // extra moment internal properties (plugins register props here)
375 momentProperties = [],
376
377 // check for nodeJS
378 hasModule = (typeof module !== 'undefined' && module.exports),
379
380 // ASP.NET json date format regex
381 aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
382 aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
383
384 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
385 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
386 isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
387
388 // format tokens
389 formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
390 localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
391
392 // parsing token regexes
393 parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
394 parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
395 parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
396 parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
397 parseTokenDigits = /\d+/, // nonzero number of digits
398 parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
399 parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
400 parseTokenT = /T/i, // T (ISO separator)
401 parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
402 parseTokenOrdinal = /\d{1,2}/,
403
404 //strict parsing regexes
405 parseTokenOneDigit = /\d/, // 0 - 9
406 parseTokenTwoDigits = /\d\d/, // 00 - 99
407 parseTokenThreeDigits = /\d{3}/, // 000 - 999
408 parseTokenFourDigits = /\d{4}/, // 0000 - 9999
409 parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
410 parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
411
412 // iso 8601 regex
413 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
414 isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
415
416 isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
417
418 isoDates = [
419 ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
420 ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
421 ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
422 ['GGGG-[W]WW', /\d{4}-W\d{2}/],
423 ['YYYY-DDD', /\d{4}-\d{3}/]
424 ],
425
426 // iso time formats and regexes
427 isoTimes = [
428 ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
429 ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
430 ['HH:mm', /(T| )\d\d:\d\d/],
431 ['HH', /(T| )\d\d/]
432 ],
433
434 // timezone chunker '+10:00' > ['10', '00'] or '-1530' > ['-15', '30']
435 parseTimezoneChunker = /([\+\-]|\d\d)/gi,
436
437 // getter and setter names
438 proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
439 unitMillisecondFactors = {
440 'Milliseconds' : 1,
441 'Seconds' : 1e3,
442 'Minutes' : 6e4,
443 'Hours' : 36e5,
444 'Days' : 864e5,
445 'Months' : 2592e6,
446 'Years' : 31536e6
447 },
448
449 unitAliases = {
450 ms : 'millisecond',
451 s : 'second',
452 m : 'minute',
453 h : 'hour',
454 d : 'day',
455 D : 'date',
456 w : 'week',
457 W : 'isoWeek',
458 M : 'month',
459 Q : 'quarter',
460 y : 'year',
461 DDD : 'dayOfYear',
462 e : 'weekday',
463 E : 'isoWeekday',
464 gg: 'weekYear',
465 GG: 'isoWeekYear'
466 },
467
468 camelFunctions = {
469 dayofyear : 'dayOfYear',
470 isoweekday : 'isoWeekday',
471 isoweek : 'isoWeek',
472 weekyear : 'weekYear',
473 isoweekyear : 'isoWeekYear'
474 },
475
476 // format function strings
477 formatFunctions = {},
478
479 // default relative time thresholds
480 relativeTimeThresholds = {
481 s: 45, // seconds to minute
482 m: 45, // minutes to hour
483 h: 22, // hours to day
484 d: 26, // days to month
485 M: 11 // months to year
486 },
487
488 // tokens to ordinalize and pad
489 ordinalizeTokens = 'DDD w W M D d'.split(' '),
490 paddedTokens = 'M D H h m s w W'.split(' '),
491
492 formatTokenFunctions = {
493 M : function () {
494 return this.month() + 1;
495 },
496 MMM : function (format) {
497 return this.localeData().monthsShort(this, format);
498 },
499 MMMM : function (format) {
500 return this.localeData().months(this, format);
501 },
502 D : function () {
503 return this.date();
504 },
505 DDD : function () {
506 return this.dayOfYear();
507 },
508 d : function () {
509 return this.day();
510 },
511 dd : function (format) {
512 return this.localeData().weekdaysMin(this, format);
513 },
514 ddd : function (format) {
515 return this.localeData().weekdaysShort(this, format);
516 },
517 dddd : function (format) {
518 return this.localeData().weekdays(this, format);
519 },
520 w : function () {
521 return this.week();
522 },
523 W : function () {
524 return this.isoWeek();
525 },
526 YY : function () {
527 return leftZeroFill(this.year() % 100, 2);
528 },
529 YYYY : function () {
530 return leftZeroFill(this.year(), 4);
531 },
532 YYYYY : function () {
533 return leftZeroFill(this.year(), 5);
534 },
535 YYYYYY : function () {
536 var y = this.year(), sign = y >= 0 ? '+' : '-';
537 return sign + leftZeroFill(Math.abs(y), 6);
538 },
539 gg : function () {
540 return leftZeroFill(this.weekYear() % 100, 2);
541 },
542 gggg : function () {
543 return leftZeroFill(this.weekYear(), 4);
544 },
545 ggggg : function () {
546 return leftZeroFill(this.weekYear(), 5);
547 },
548 GG : function () {
549 return leftZeroFill(this.isoWeekYear() % 100, 2);
550 },
551 GGGG : function () {
552 return leftZeroFill(this.isoWeekYear(), 4);
553 },
554 GGGGG : function () {
555 return leftZeroFill(this.isoWeekYear(), 5);
556 },
557 e : function () {
558 return this.weekday();
559 },
560 E : function () {
561 return this.isoWeekday();
562 },
563 a : function () {
564 return this.localeData().meridiem(this.hours(), this.minutes(), true);
565 },
566 A : function () {
567 return this.localeData().meridiem(this.hours(), this.minutes(), false);
568 },
569 H : function () {
570 return this.hours();
571 },
572 h : function () {
573 return this.hours() % 12 || 12;
574 },
575 m : function () {
576 return this.minutes();
577 },
578 s : function () {
579 return this.seconds();
580 },
581 S : function () {
582 return toInt(this.milliseconds() / 100);
583 },
584 SS : function () {
585 return leftZeroFill(toInt(this.milliseconds() / 10), 2);
586 },
587 SSS : function () {
588 return leftZeroFill(this.milliseconds(), 3);
589 },
590 SSSS : function () {
591 return leftZeroFill(this.milliseconds(), 3);
592 },
593 Z : function () {
594 var a = -this.zone(),
595 b = '+';
596 if (a < 0) {
597 a = -a;
598 b = '-';
599 }
600 return b + leftZeroFill(toInt(a / 60), 2) + ':' + leftZeroFill(toInt(a) % 60, 2);
601 },
602 ZZ : function () {
603 var a = -this.zone(),
604 b = '+';
605 if (a < 0) {
606 a = -a;
607 b = '-';
608 }
609 return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
610 },
611 z : function () {
612 return this.zoneAbbr();
613 },
614 zz : function () {
615 return this.zoneName();
616 },
617 X : function () {
618 return this.unix();
619 },
620 Q : function () {
621 return this.quarter();
622 }
623 },
624
625 deprecations = {},
626
627 lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
628
629 // Pick the first defined of two or three arguments. dfl comes from
630 // default.
631 function dfl(a, b, c) {
632 switch (arguments.length) {
633 case 2: return a != null ? a : b;
634 case 3: return a != null ? a : b != null ? b : c;
635 default: throw new Error('Implement me');
636 }
637 }
638
639 function hasOwnProp(a, b) {
640 return hasOwnProperty.call(a, b);
641 }
642
643 function defaultParsingFlags() {
644 // We need to deep clone this object, and es5 standard is not very
645 // helpful.
646 return {
647 empty : false,
648 unusedTokens : [],
649 unusedInput : [],
650 overflow : -2,
651 charsLeftOver : 0,
652 nullInput : false,
653 invalidMonth : null,
654 invalidFormat : false,
655 userInvalidated : false,
656 iso: false
657 };
658 }
659
660 function printMsg(msg) {
661 if (moment.suppressDeprecationWarnings === false &&
662 typeof console !== 'undefined' && console.warn) {
663 console.warn('Deprecation warning: ' + msg);
664 }
665 }
666
667 function deprecate(msg, fn) {
668 var firstTime = true;
669 return extend(function () {
670 if (firstTime) {
671 printMsg(msg);
672 firstTime = false;
673 }
674 return fn.apply(this, arguments);
675 }, fn);
676 }
677
678 function deprecateSimple(name, msg) {
679 if (!deprecations[name]) {
680 printMsg(msg);
681 deprecations[name] = true;
682 }
683 }
684
685 function padToken(func, count) {
686 return function (a) {
687 return leftZeroFill(func.call(this, a), count);
688 };
689 }
690 function ordinalizeToken(func, period) {
691 return function (a) {
692 return this.localeData().ordinal(func.call(this, a), period);
693 };
694 }
695
696 while (ordinalizeTokens.length) {
697 i = ordinalizeTokens.pop();
698 formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
699 }
700 while (paddedTokens.length) {
701 i = paddedTokens.pop();
702 formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
703 }
704 formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
705
706
707 /************************************
708 Constructors
709 ************************************/
710
711 function Locale() {
712 }
713
714 // Moment prototype object
715 function Moment(config, skipOverflow) {
716 if (skipOverflow !== false) {
717 checkOverflow(config);
718 }
719 copyConfig(this, config);
720 this._d = new Date(+config._d);
721 }
722
723 // Duration Constructor
724 function Duration(duration) {
725 var normalizedInput = normalizeObjectUnits(duration),
726 years = normalizedInput.year || 0,
727 quarters = normalizedInput.quarter || 0,
728 months = normalizedInput.month || 0,
729 weeks = normalizedInput.week || 0,
730 days = normalizedInput.day || 0,
731 hours = normalizedInput.hour || 0,
732 minutes = normalizedInput.minute || 0,
733 seconds = normalizedInput.second || 0,
734 milliseconds = normalizedInput.millisecond || 0;
735
736 // representation for dateAddRemove
737 this._milliseconds = +milliseconds +
738 seconds * 1e3 + // 1000
739 minutes * 6e4 + // 1000 * 60
740 hours * 36e5; // 1000 * 60 * 60
741 // Because of dateAddRemove treats 24 hours as different from a
742 // day when working around DST, we need to store them separately
743 this._days = +days +
744 weeks * 7;
745 // It is impossible translate months into days without knowing
746 // which months you are are talking about, so we have to store
747 // it separately.
748 this._months = +months +
749 quarters * 3 +
750 years * 12;
751
752 this._data = {};
753
754 this._locale = moment.localeData();
755
756 this._bubble();
757 }
758
759 /************************************
760 Helpers
761 ************************************/
762
763
764 function extend(a, b) {
765 for (var i in b) {
766 if (hasOwnProp(b, i)) {
767 a[i] = b[i];
768 }
769 }
770
771 if (hasOwnProp(b, 'toString')) {
772 a.toString = b.toString;
773 }
774
775 if (hasOwnProp(b, 'valueOf')) {
776 a.valueOf = b.valueOf;
777 }
778
779 return a;
780 }
781
782 function copyConfig(to, from) {
783 var i, prop, val;
784
785 if (typeof from._isAMomentObject !== 'undefined') {
786 to._isAMomentObject = from._isAMomentObject;
787 }
788 if (typeof from._i !== 'undefined') {
789 to._i = from._i;
790 }
791 if (typeof from._f !== 'undefined') {
792 to._f = from._f;
793 }
794 if (typeof from._l !== 'undefined') {
795 to._l = from._l;
796 }
797 if (typeof from._strict !== 'undefined') {
798 to._strict = from._strict;
799 }
800 if (typeof from._tzm !== 'undefined') {
801 to._tzm = from._tzm;
802 }
803 if (typeof from._isUTC !== 'undefined') {
804 to._isUTC = from._isUTC;
805 }
806 if (typeof from._offset !== 'undefined') {
807 to._offset = from._offset;
808 }
809 if (typeof from._pf !== 'undefined') {
810 to._pf = from._pf;
811 }
812 if (typeof from._locale !== 'undefined') {
813 to._locale = from._locale;
814 }
815
816 if (momentProperties.length > 0) {
817 for (i in momentProperties) {
818 prop = momentProperties[i];
819 val = from[prop];
820 if (typeof val !== 'undefined') {
821 to[prop] = val;
822 }
823 }
824 }
825
826 return to;
827 }
828
829 function absRound(number) {
830 if (number < 0) {
831 return Math.ceil(number);
832 } else {
833 return Math.floor(number);
834 }
835 }
836
837 // left zero fill a number
838 // see http://jsperf.com/left-zero-filling for performance comparison
839 function leftZeroFill(number, targetLength, forceSign) {
840 var output = '' + Math.abs(number),
841 sign = number >= 0;
842
843 while (output.length < targetLength) {
844 output = '0' + output;
845 }
846 return (sign ? (forceSign ? '+' : '') : '-') + output;
847 }
848
849 function positiveMomentsDifference(base, other) {
850 var res = {milliseconds: 0, months: 0};
851
852 res.months = other.month() - base.month() +
853 (other.year() - base.year()) * 12;
854 if (base.clone().add(res.months, 'M').isAfter(other)) {
855 --res.months;
856 }
857
858 res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
859
860 return res;
861 }
862
863 function momentsDifference(base, other) {
864 var res;
865 other = makeAs(other, base);
866 if (base.isBefore(other)) {
867 res = positiveMomentsDifference(base, other);
868 } else {
869 res = positiveMomentsDifference(other, base);
870 res.milliseconds = -res.milliseconds;
871 res.months = -res.months;
872 }
873
874 return res;
875 }
876
877 // TODO: remove 'name' arg after deprecation is removed
878 function createAdder(direction, name) {
879 return function (val, period) {
880 var dur, tmp;
881 //invert the arguments, but complain about it
882 if (period !== null && !isNaN(+period)) {
883 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
884 tmp = val; val = period; period = tmp;
885 }
886
887 val = typeof val === 'string' ? +val : val;
888 dur = moment.duration(val, period);
889 addOrSubtractDurationFromMoment(this, dur, direction);
890 return this;
891 };
892 }
893
894 function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
895 var milliseconds = duration._milliseconds,
896 days = duration._days,
897 months = duration._months;
898 updateOffset = updateOffset == null ? true : updateOffset;
899
900 if (milliseconds) {
901 mom._d.setTime(+mom._d + milliseconds * isAdding);
902 }
903 if (days) {
904 rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
905 }
906 if (months) {
907 rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
908 }
909 if (updateOffset) {
910 moment.updateOffset(mom, days || months);
911 }
912 }
913
914 // check if is an array
915 function isArray(input) {
916 return Object.prototype.toString.call(input) === '[object Array]';
917 }
918
919 function isDate(input) {
920 return Object.prototype.toString.call(input) === '[object Date]' ||
921 input instanceof Date;
922 }
923
924 // compare two arrays, return the number of differences
925 function compareArrays(array1, array2, dontConvert) {
926 var len = Math.min(array1.length, array2.length),
927 lengthDiff = Math.abs(array1.length - array2.length),
928 diffs = 0,
929 i;
930 for (i = 0; i < len; i++) {
931 if ((dontConvert && array1[i] !== array2[i]) ||
932 (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
933 diffs++;
934 }
935 }
936 return diffs + lengthDiff;
937 }
938
939 function normalizeUnits(units) {
940 if (units) {
941 var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
942 units = unitAliases[units] || camelFunctions[lowered] || lowered;
943 }
944 return units;
945 }
946
947 function normalizeObjectUnits(inputObject) {
948 var normalizedInput = {},
949 normalizedProp,
950 prop;
951
952 for (prop in inputObject) {
953 if (hasOwnProp(inputObject, prop)) {
954 normalizedProp = normalizeUnits(prop);
955 if (normalizedProp) {
956 normalizedInput[normalizedProp] = inputObject[prop];
957 }
958 }
959 }
960
961 return normalizedInput;
962 }
963
964 function makeList(field) {
965 var count, setter;
966
967 if (field.indexOf('week') === 0) {
968 count = 7;
969 setter = 'day';
970 }
971 else if (field.indexOf('month') === 0) {
972 count = 12;
973 setter = 'month';
974 }
975 else {
976 return;
977 }
978
979 moment[field] = function (format, index) {
980 var i, getter,
981 method = moment._locale[field],
982 results = [];
983
984 if (typeof format === 'number') {
985 index = format;
986 format = undefined;
987 }
988
989 getter = function (i) {
990 var m = moment().utc().set(setter, i);
991 return method.call(moment._locale, m, format || '');
992 };
993
994 if (index != null) {
995 return getter(index);
996 }
997 else {
998 for (i = 0; i < count; i++) {
999 results.push(getter(i));
1000 }
1001 return results;
1002 }
1003 };
1004 }
1005
1006 function toInt(argumentForCoercion) {
1007 var coercedNumber = +argumentForCoercion,
1008 value = 0;
1009
1010 if (coercedNumber !== 0 && isFinite(coercedNumber)) {
1011 if (coercedNumber >= 0) {
1012 value = Math.floor(coercedNumber);
1013 } else {
1014 value = Math.ceil(coercedNumber);
1015 }
1016 }
1017
1018 return value;
1019 }
1020
1021 function daysInMonth(year, month) {
1022 return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
1023 }
1024
1025 function weeksInYear(year, dow, doy) {
1026 return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
1027 }
1028
1029 function daysInYear(year) {
1030 return isLeapYear(year) ? 366 : 365;
1031 }
1032
1033 function isLeapYear(year) {
1034 return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
1035 }
1036
1037 function checkOverflow(m) {
1038 var overflow;
1039 if (m._a && m._pf.overflow === -2) {
1040 overflow =
1041 m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
1042 m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
1043 m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
1044 m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
1045 m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
1046 m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
1047 -1;
1048
1049 if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
1050 overflow = DATE;
1051 }
1052
1053 m._pf.overflow = overflow;
1054 }
1055 }
1056
1057 function isValid(m) {
1058 if (m._isValid == null) {
1059 m._isValid = !isNaN(m._d.getTime()) &&
1060 m._pf.overflow < 0 &&
1061 !m._pf.empty &&
1062 !m._pf.invalidMonth &&
1063 !m._pf.nullInput &&
1064 !m._pf.invalidFormat &&
1065 !m._pf.userInvalidated;
1066
1067 if (m._strict) {
1068 m._isValid = m._isValid &&
1069 m._pf.charsLeftOver === 0 &&
1070 m._pf.unusedTokens.length === 0;
1071 }
1072 }
1073 return m._isValid;
1074 }
1075
1076 function normalizeLocale(key) {
1077 return key ? key.toLowerCase().replace('_', '-') : key;
1078 }
1079
1080 // pick the locale from the array
1081 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
1082 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
1083 function chooseLocale(names) {
1084 var i = 0, j, next, locale, split;
1085
1086 while (i < names.length) {
1087 split = normalizeLocale(names[i]).split('-');
1088 j = split.length;
1089 next = normalizeLocale(names[i + 1]);
1090 next = next ? next.split('-') : null;
1091 while (j > 0) {
1092 locale = loadLocale(split.slice(0, j).join('-'));
1093 if (locale) {
1094 return locale;
1095 }
1096 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
1097 //the next array item is better than a shallower substring of this one
1098 break;
1099 }
1100 j--;
1101 }
1102 i++;
1103 }
1104 return null;
1105 }
1106
1107 function loadLocale(name) {
1108 var oldLocale = null;
1109 if (!locales[name] && hasModule) {
1110 try {
1111 oldLocale = moment.locale();
1112 require('./locale/' + name);
1113 // because defineLocale currently also sets the global locale, we want to undo that for lazy loaded locales
1114 moment.locale(oldLocale);
1115 } catch (e) { }
1116 }
1117 return locales[name];
1118 }
1119
1120 // Return a moment from input, that is local/utc/zone equivalent to model.
1121 function makeAs(input, model) {
1122 return model._isUTC ? moment(input).zone(model._offset || 0) :
1123 moment(input).local();
1124 }
1125
1126 /************************************
1127 Locale
1128 ************************************/
1129
1130
1131 extend(Locale.prototype, {
1132
1133 set : function (config) {
1134 var prop, i;
1135 for (i in config) {
1136 prop = config[i];
1137 if (typeof prop === 'function') {
1138 this[i] = prop;
1139 } else {
1140 this['_' + i] = prop;
1141 }
1142 }
1143 },
1144
1145 _months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
1146 months : function (m) {
1147 return this._months[m.month()];
1148 },
1149
1150 _monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
1151 monthsShort : function (m) {
1152 return this._monthsShort[m.month()];
1153 },
1154
1155 monthsParse : function (monthName) {
1156 var i, mom, regex;
1157
1158 if (!this._monthsParse) {
1159 this._monthsParse = [];
1160 }
1161
1162 for (i = 0; i < 12; i++) {
1163 // make the regex if we don't have it already
1164 if (!this._monthsParse[i]) {
1165 mom = moment.utc([2000, i]);
1166 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
1167 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
1168 }
1169 // test the regex
1170 if (this._monthsParse[i].test(monthName)) {
1171 return i;
1172 }
1173 }
1174 },
1175
1176 _weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
1177 weekdays : function (m) {
1178 return this._weekdays[m.day()];
1179 },
1180
1181 _weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
1182 weekdaysShort : function (m) {
1183 return this._weekdaysShort[m.day()];
1184 },
1185
1186 _weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
1187 weekdaysMin : function (m) {
1188 return this._weekdaysMin[m.day()];
1189 },
1190
1191 weekdaysParse : function (weekdayName) {
1192 var i, mom, regex;
1193
1194 if (!this._weekdaysParse) {
1195 this._weekdaysParse = [];
1196 }
1197
1198 for (i = 0; i < 7; i++) {
1199 // make the regex if we don't have it already
1200 if (!this._weekdaysParse[i]) {
1201 mom = moment([2000, 1]).day(i);
1202 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
1203 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
1204 }
1205 // test the regex
1206 if (this._weekdaysParse[i].test(weekdayName)) {
1207 return i;
1208 }
1209 }
1210 },
1211
1212 _longDateFormat : {
1213 LT : 'h:mm A',
1214 L : 'MM/DD/YYYY',
1215 LL : 'MMMM D, YYYY',
1216 LLL : 'MMMM D, YYYY LT',
1217 LLLL : 'dddd, MMMM D, YYYY LT'
1218 },
1219 longDateFormat : function (key) {
1220 var output = this._longDateFormat[key];
1221 if (!output && this._longDateFormat[key.toUpperCase()]) {
1222 output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
1223 return val.slice(1);
1224 });
1225 this._longDateFormat[key] = output;
1226 }
1227 return output;
1228 },
1229
1230 isPM : function (input) {
1231 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
1232 // Using charAt should be more compatible.
1233 return ((input + '').toLowerCase().charAt(0) === 'p');
1234 },
1235
1236 _meridiemParse : /[ap]\.?m?\.?/i,
1237 meridiem : function (hours, minutes, isLower) {
1238 if (hours > 11) {
1239 return isLower ? 'pm' : 'PM';
1240 } else {
1241 return isLower ? 'am' : 'AM';
1242 }
1243 },
1244
1245 _calendar : {
1246 sameDay : '[Today at] LT',
1247 nextDay : '[Tomorrow at] LT',
1248 nextWeek : 'dddd [at] LT',
1249 lastDay : '[Yesterday at] LT',
1250 lastWeek : '[Last] dddd [at] LT',
1251 sameElse : 'L'
1252 },
1253 calendar : function (key, mom) {
1254 var output = this._calendar[key];
1255 return typeof output === 'function' ? output.apply(mom) : output;
1256 },
1257
1258 _relativeTime : {
1259 future : 'in %s',
1260 past : '%s ago',
1261 s : 'a few seconds',
1262 m : 'a minute',
1263 mm : '%d minutes',
1264 h : 'an hour',
1265 hh : '%d hours',
1266 d : 'a day',
1267 dd : '%d days',
1268 M : 'a month',
1269 MM : '%d months',
1270 y : 'a year',
1271 yy : '%d years'
1272 },
1273
1274 relativeTime : function (number, withoutSuffix, string, isFuture) {
1275 var output = this._relativeTime[string];
1276 return (typeof output === 'function') ?
1277 output(number, withoutSuffix, string, isFuture) :
1278 output.replace(/%d/i, number);
1279 },
1280
1281 pastFuture : function (diff, output) {
1282 var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
1283 return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
1284 },
1285
1286 ordinal : function (number) {
1287 return this._ordinal.replace('%d', number);
1288 },
1289 _ordinal : '%d',
1290
1291 preparse : function (string) {
1292 return string;
1293 },
1294
1295 postformat : function (string) {
1296 return string;
1297 },
1298
1299 week : function (mom) {
1300 return weekOfYear(mom, this._week.dow, this._week.doy).week;
1301 },
1302
1303 _week : {
1304 dow : 0, // Sunday is the first day of the week.
1305 doy : 6 // The week that contains Jan 1st is the first week of the year.
1306 },
1307
1308 _invalidDate: 'Invalid date',
1309 invalidDate: function () {
1310 return this._invalidDate;
1311 }
1312 });
1313
1314 /************************************
1315 Formatting
1316 ************************************/
1317
1318
1319 function removeFormattingTokens(input) {
1320 if (input.match(/\[[\s\S]/)) {
1321 return input.replace(/^\[|\]$/g, '');
1322 }
1323 return input.replace(/\\/g, '');
1324 }
1325
1326 function makeFormatFunction(format) {
1327 var array = format.match(formattingTokens), i, length;
1328
1329 for (i = 0, length = array.length; i < length; i++) {
1330 if (formatTokenFunctions[array[i]]) {
1331 array[i] = formatTokenFunctions[array[i]];
1332 } else {
1333 array[i] = removeFormattingTokens(array[i]);
1334 }
1335 }
1336
1337 return function (mom) {
1338 var output = '';
1339 for (i = 0; i < length; i++) {
1340 output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
1341 }
1342 return output;
1343 };
1344 }
1345
1346 // format date using native date object
1347 function formatMoment(m, format) {
1348 if (!m.isValid()) {
1349 return m.localeData().invalidDate();
1350 }
1351
1352 format = expandFormat(format, m.localeData());
1353
1354 if (!formatFunctions[format]) {
1355 formatFunctions[format] = makeFormatFunction(format);
1356 }
1357
1358 return formatFunctions[format](m);
1359 }
1360
1361 function expandFormat(format, locale) {
1362 var i = 5;
1363
1364 function replaceLongDateFormatTokens(input) {
1365 return locale.longDateFormat(input) || input;
1366 }
1367
1368 localFormattingTokens.lastIndex = 0;
1369 while (i >= 0 && localFormattingTokens.test(format)) {
1370 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
1371 localFormattingTokens.lastIndex = 0;
1372 i -= 1;
1373 }
1374
1375 return format;
1376 }
1377
1378
1379 /************************************
1380 Parsing
1381 ************************************/
1382
1383
1384 // get the regex to find the next token
1385 function getParseRegexForToken(token, config) {
1386 var a, strict = config._strict;
1387 switch (token) {
1388 case 'Q':
1389 return parseTokenOneDigit;
1390 case 'DDDD':
1391 return parseTokenThreeDigits;
1392 case 'YYYY':
1393 case 'GGGG':
1394 case 'gggg':
1395 return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
1396 case 'Y':
1397 case 'G':
1398 case 'g':
1399 return parseTokenSignedNumber;
1400 case 'YYYYYY':
1401 case 'YYYYY':
1402 case 'GGGGG':
1403 case 'ggggg':
1404 return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
1405 case 'S':
1406 if (strict) {
1407 return parseTokenOneDigit;
1408 }
1409 /* falls through */
1410 case 'SS':
1411 if (strict) {
1412 return parseTokenTwoDigits;
1413 }
1414 /* falls through */
1415 case 'SSS':
1416 if (strict) {
1417 return parseTokenThreeDigits;
1418 }
1419 /* falls through */
1420 case 'DDD':
1421 return parseTokenOneToThreeDigits;
1422 case 'MMM':
1423 case 'MMMM':
1424 case 'dd':
1425 case 'ddd':
1426 case 'dddd':
1427 return parseTokenWord;
1428 case 'a':
1429 case 'A':
1430 return config._locale._meridiemParse;
1431 case 'X':
1432 return parseTokenTimestampMs;
1433 case 'Z':
1434 case 'ZZ':
1435 return parseTokenTimezone;
1436 case 'T':
1437 return parseTokenT;
1438 case 'SSSS':
1439 return parseTokenDigits;
1440 case 'MM':
1441 case 'DD':
1442 case 'YY':
1443 case 'GG':
1444 case 'gg':
1445 case 'HH':
1446 case 'hh':
1447 case 'mm':
1448 case 'ss':
1449 case 'ww':
1450 case 'WW':
1451 return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
1452 case 'M':
1453 case 'D':
1454 case 'd':
1455 case 'H':
1456 case 'h':
1457 case 'm':
1458 case 's':
1459 case 'w':
1460 case 'W':
1461 case 'e':
1462 case 'E':
1463 return parseTokenOneOrTwoDigits;
1464 case 'Do':
1465 return parseTokenOrdinal;
1466 default :
1467 a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i'));
1468 return a;
1469 }
1470 }
1471
1472 function timezoneMinutesFromString(string) {
1473 string = string || '';
1474 var possibleTzMatches = (string.match(parseTokenTimezone) || []),
1475 tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
1476 parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
1477 minutes = +(parts[1] * 60) + toInt(parts[2]);
1478
1479 return parts[0] === '+' ? -minutes : minutes;
1480 }
1481
1482 // function to convert string input to date
1483 function addTimeToArrayFromToken(token, input, config) {
1484 var a, datePartArray = config._a;
1485
1486 switch (token) {
1487 // QUARTER
1488 case 'Q':
1489 if (input != null) {
1490 datePartArray[MONTH] = (toInt(input) - 1) * 3;
1491 }
1492 break;
1493 // MONTH
1494 case 'M' : // fall through to MM
1495 case 'MM' :
1496 if (input != null) {
1497 datePartArray[MONTH] = toInt(input) - 1;
1498 }
1499 break;
1500 case 'MMM' : // fall through to MMMM
1501 case 'MMMM' :
1502 a = config._locale.monthsParse(input);
1503 // if we didn't find a month name, mark the date as invalid.
1504 if (a != null) {
1505 datePartArray[MONTH] = a;
1506 } else {
1507 config._pf.invalidMonth = input;
1508 }
1509 break;
1510 // DAY OF MONTH
1511 case 'D' : // fall through to DD
1512 case 'DD' :
1513 if (input != null) {
1514 datePartArray[DATE] = toInt(input);
1515 }
1516 break;
1517 case 'Do' :
1518 if (input != null) {
1519 datePartArray[DATE] = toInt(parseInt(input, 10));
1520 }
1521 break;
1522 // DAY OF YEAR
1523 case 'DDD' : // fall through to DDDD
1524 case 'DDDD' :
1525 if (input != null) {
1526 config._dayOfYear = toInt(input);
1527 }
1528
1529 break;
1530 // YEAR
1531 case 'YY' :
1532 datePartArray[YEAR] = moment.parseTwoDigitYear(input);
1533 break;
1534 case 'YYYY' :
1535 case 'YYYYY' :
1536 case 'YYYYYY' :
1537 datePartArray[YEAR] = toInt(input);
1538 break;
1539 // AM / PM
1540 case 'a' : // fall through to A
1541 case 'A' :
1542 config._isPm = config._locale.isPM(input);
1543 break;
1544 // 24 HOUR
1545 case 'H' : // fall through to hh
1546 case 'HH' : // fall through to hh
1547 case 'h' : // fall through to hh
1548 case 'hh' :
1549 datePartArray[HOUR] = toInt(input);
1550 break;
1551 // MINUTE
1552 case 'm' : // fall through to mm
1553 case 'mm' :
1554 datePartArray[MINUTE] = toInt(input);
1555 break;
1556 // SECOND
1557 case 's' : // fall through to ss
1558 case 'ss' :
1559 datePartArray[SECOND] = toInt(input);
1560 break;
1561 // MILLISECOND
1562 case 'S' :
1563 case 'SS' :
1564 case 'SSS' :
1565 case 'SSSS' :
1566 datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
1567 break;
1568 // UNIX TIMESTAMP WITH MS
1569 case 'X':
1570 config._d = new Date(parseFloat(input) * 1000);
1571 break;
1572 // TIMEZONE
1573 case 'Z' : // fall through to ZZ
1574 case 'ZZ' :
1575 config._useUTC = true;
1576 config._tzm = timezoneMinutesFromString(input);
1577 break;
1578 // WEEKDAY - human
1579 case 'dd':
1580 case 'ddd':
1581 case 'dddd':
1582 a = config._locale.weekdaysParse(input);
1583 // if we didn't get a weekday name, mark the date as invalid
1584 if (a != null) {
1585 config._w = config._w || {};
1586 config._w['d'] = a;
1587 } else {
1588 config._pf.invalidWeekday = input;
1589 }
1590 break;
1591 // WEEK, WEEK DAY - numeric
1592 case 'w':
1593 case 'ww':
1594 case 'W':
1595 case 'WW':
1596 case 'd':
1597 case 'e':
1598 case 'E':
1599 token = token.substr(0, 1);
1600 /* falls through */
1601 case 'gggg':
1602 case 'GGGG':
1603 case 'GGGGG':
1604 token = token.substr(0, 2);
1605 if (input) {
1606 config._w = config._w || {};
1607 config._w[token] = toInt(input);
1608 }
1609 break;
1610 case 'gg':
1611 case 'GG':
1612 config._w = config._w || {};
1613 config._w[token] = moment.parseTwoDigitYear(input);
1614 }
1615 }
1616
1617 function dayOfYearFromWeekInfo(config) {
1618 var w, weekYear, week, weekday, dow, doy, temp;
1619
1620 w = config._w;
1621 if (w.GG != null || w.W != null || w.E != null) {
1622 dow = 1;
1623 doy = 4;
1624
1625 // TODO: We need to take the current isoWeekYear, but that depends on
1626 // how we interpret now (local, utc, fixed offset). So create
1627 // a now version of current config (take local/utc/offset flags, and
1628 // create now).
1629 weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year);
1630 week = dfl(w.W, 1);
1631 weekday = dfl(w.E, 1);
1632 } else {
1633 dow = config._locale._week.dow;
1634 doy = config._locale._week.doy;
1635
1636 weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year);
1637 week = dfl(w.w, 1);
1638
1639 if (w.d != null) {
1640 // weekday -- low day numbers are considered next week
1641 weekday = w.d;
1642 if (weekday < dow) {
1643 ++week;
1644 }
1645 } else if (w.e != null) {
1646 // local weekday -- counting starts from begining of week
1647 weekday = w.e + dow;
1648 } else {
1649 // default to begining of week
1650 weekday = dow;
1651 }
1652 }
1653 temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
1654
1655 config._a[YEAR] = temp.year;
1656 config._dayOfYear = temp.dayOfYear;
1657 }
1658
1659 // convert an array to a date.
1660 // the array should mirror the parameters below
1661 // note: all values past the year are optional and will default to the lowest possible value.
1662 // [year, month, day , hour, minute, second, millisecond]
1663 function dateFromConfig(config) {
1664 var i, date, input = [], currentDate, yearToUse;
1665
1666 if (config._d) {
1667 return;
1668 }
1669
1670 currentDate = currentDateArray(config);
1671
1672 //compute day of the year from weeks and weekdays
1673 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
1674 dayOfYearFromWeekInfo(config);
1675 }
1676
1677 //if the day of the year is set, figure out what it is
1678 if (config._dayOfYear) {
1679 yearToUse = dfl(config._a[YEAR], currentDate[YEAR]);
1680
1681 if (config._dayOfYear > daysInYear(yearToUse)) {
1682 config._pf._overflowDayOfYear = true;
1683 }
1684
1685 date = makeUTCDate(yearToUse, 0, config._dayOfYear);
1686 config._a[MONTH] = date.getUTCMonth();
1687 config._a[DATE] = date.getUTCDate();
1688 }
1689
1690 // Default to current date.
1691 // * if no year, month, day of month are given, default to today
1692 // * if day of month is given, default month and year
1693 // * if month is given, default only year
1694 // * if year is given, don't default anything
1695 for (i = 0; i < 3 && config._a[i] == null; ++i) {
1696 config._a[i] = input[i] = currentDate[i];
1697 }
1698
1699 // Zero out whatever was not defaulted, including time
1700 for (; i < 7; i++) {
1701 config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
1702 }
1703
1704 config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
1705 // Apply timezone offset from input. The actual zone can be changed
1706 // with parseZone.
1707 if (config._tzm != null) {
1708 config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
1709 }
1710 }
1711
1712 function dateFromObject(config) {
1713 var normalizedInput;
1714
1715 if (config._d) {
1716 return;
1717 }
1718
1719 normalizedInput = normalizeObjectUnits(config._i);
1720 config._a = [
1721 normalizedInput.year,
1722 normalizedInput.month,
1723 normalizedInput.day,
1724 normalizedInput.hour,
1725 normalizedInput.minute,
1726 normalizedInput.second,
1727 normalizedInput.millisecond
1728 ];
1729
1730 dateFromConfig(config);
1731 }
1732
1733 function currentDateArray(config) {
1734 var now = new Date();
1735 if (config._useUTC) {
1736 return [
1737 now.getUTCFullYear(),
1738 now.getUTCMonth(),
1739 now.getUTCDate()
1740 ];
1741 } else {
1742 return [now.getFullYear(), now.getMonth(), now.getDate()];
1743 }
1744 }
1745
1746 // date from string and format string
1747 function makeDateFromStringAndFormat(config) {
1748 if (config._f === moment.ISO_8601) {
1749 parseISO(config);
1750 return;
1751 }
1752
1753 config._a = [];
1754 config._pf.empty = true;
1755
1756 // This array is used to make a Date, either with `new Date` or `Date.UTC`
1757 var string = '' + config._i,
1758 i, parsedInput, tokens, token, skipped,
1759 stringLength = string.length,
1760 totalParsedInputLength = 0;
1761
1762 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
1763
1764 for (i = 0; i < tokens.length; i++) {
1765 token = tokens[i];
1766 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
1767 if (parsedInput) {
1768 skipped = string.substr(0, string.indexOf(parsedInput));
1769 if (skipped.length > 0) {
1770 config._pf.unusedInput.push(skipped);
1771 }
1772 string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
1773 totalParsedInputLength += parsedInput.length;
1774 }
1775 // don't parse if it's not a known token
1776 if (formatTokenFunctions[token]) {
1777 if (parsedInput) {
1778 config._pf.empty = false;
1779 }
1780 else {
1781 config._pf.unusedTokens.push(token);
1782 }
1783 addTimeToArrayFromToken(token, parsedInput, config);
1784 }
1785 else if (config._strict && !parsedInput) {
1786 config._pf.unusedTokens.push(token);
1787 }
1788 }
1789
1790 // add remaining unparsed input length to the string
1791 config._pf.charsLeftOver = stringLength - totalParsedInputLength;
1792 if (string.length > 0) {
1793 config._pf.unusedInput.push(string);
1794 }
1795
1796 // handle am pm
1797 if (config._isPm && config._a[HOUR] < 12) {
1798 config._a[HOUR] += 12;
1799 }
1800 // if is 12 am, change hours to 0
1801 if (config._isPm === false && config._a[HOUR] === 12) {
1802 config._a[HOUR] = 0;
1803 }
1804
1805 dateFromConfig(config);
1806 checkOverflow(config);
1807 }
1808
1809 function unescapeFormat(s) {
1810 return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
1811 return p1 || p2 || p3 || p4;
1812 });
1813 }
1814
1815 // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
1816 function regexpEscape(s) {
1817 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
1818 }
1819
1820 // date from string and array of format strings
1821 function makeDateFromStringAndArray(config) {
1822 var tempConfig,
1823 bestMoment,
1824
1825 scoreToBeat,
1826 i,
1827 currentScore;
1828
1829 if (config._f.length === 0) {
1830 config._pf.invalidFormat = true;
1831 config._d = new Date(NaN);
1832 return;
1833 }
1834
1835 for (i = 0; i < config._f.length; i++) {
1836 currentScore = 0;
1837 tempConfig = copyConfig({}, config);
1838 if (config._useUTC != null) {
1839 tempConfig._useUTC = config._useUTC;
1840 }
1841 tempConfig._pf = defaultParsingFlags();
1842 tempConfig._f = config._f[i];
1843 makeDateFromStringAndFormat(tempConfig);
1844
1845 if (!isValid(tempConfig)) {
1846 continue;
1847 }
1848
1849 // if there is any input that was not parsed add a penalty for that format
1850 currentScore += tempConfig._pf.charsLeftOver;
1851
1852 //or tokens
1853 currentScore += tempConfig._pf.unusedTokens.length * 10;
1854
1855 tempConfig._pf.score = currentScore;
1856
1857 if (scoreToBeat == null || currentScore < scoreToBeat) {
1858 scoreToBeat = currentScore;
1859 bestMoment = tempConfig;
1860 }
1861 }
1862
1863 extend(config, bestMoment || tempConfig);
1864 }
1865
1866 // date from iso format
1867 function parseISO(config) {
1868 var i, l,
1869 string = config._i,
1870 match = isoRegex.exec(string);
1871
1872 if (match) {
1873 config._pf.iso = true;
1874 for (i = 0, l = isoDates.length; i < l; i++) {
1875 if (isoDates[i][1].exec(string)) {
1876 // match[5] should be 'T' or undefined
1877 config._f = isoDates[i][0] + (match[6] || ' ');
1878 break;
1879 }
1880 }
1881 for (i = 0, l = isoTimes.length; i < l; i++) {
1882 if (isoTimes[i][1].exec(string)) {
1883 config._f += isoTimes[i][0];
1884 break;
1885 }
1886 }
1887 if (string.match(parseTokenTimezone)) {
1888 config._f += 'Z';
1889 }
1890 makeDateFromStringAndFormat(config);
1891 } else {
1892 config._isValid = false;
1893 }
1894 }
1895
1896 // date from iso format or fallback
1897 function makeDateFromString(config) {
1898 parseISO(config);
1899 if (config._isValid === false) {
1900 delete config._isValid;
1901 moment.createFromInputFallback(config);
1902 }
1903 }
1904
1905 function map(arr, fn) {
1906 var res = [], i;
1907 for (i = 0; i < arr.length; ++i) {
1908 res.push(fn(arr[i], i));
1909 }
1910 return res;
1911 }
1912
1913 function makeDateFromInput(config) {
1914 var input = config._i, matched;
1915 if (input === undefined) {
1916 config._d = new Date();
1917 } else if (isDate(input)) {
1918 config._d = new Date(+input);
1919 } else if ((matched = aspNetJsonRegex.exec(input)) !== null) {
1920 config._d = new Date(+matched[1]);
1921 } else if (typeof input === 'string') {
1922 makeDateFromString(config);
1923 } else if (isArray(input)) {
1924 config._a = map(input.slice(0), function (obj) {
1925 return parseInt(obj, 10);
1926 });
1927 dateFromConfig(config);
1928 } else if (typeof(input) === 'object') {
1929 dateFromObject(config);
1930 } else if (typeof(input) === 'number') {
1931 // from milliseconds
1932 config._d = new Date(input);
1933 } else {
1934 moment.createFromInputFallback(config);
1935 }
1936 }
1937
1938 function makeDate(y, m, d, h, M, s, ms) {
1939 //can't just apply() to create a date:
1940 //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
1941 var date = new Date(y, m, d, h, M, s, ms);
1942
1943 //the date constructor doesn't accept years < 1970
1944 if (y < 1970) {
1945 date.setFullYear(y);
1946 }
1947 return date;
1948 }
1949
1950 function makeUTCDate(y) {
1951 var date = new Date(Date.UTC.apply(null, arguments));
1952 if (y < 1970) {
1953 date.setUTCFullYear(y);
1954 }
1955 return date;
1956 }
1957
1958 function parseWeekday(input, locale) {
1959 if (typeof input === 'string') {
1960 if (!isNaN(input)) {
1961 input = parseInt(input, 10);
1962 }
1963 else {
1964 input = locale.weekdaysParse(input);
1965 if (typeof input !== 'number') {
1966 return null;
1967 }
1968 }
1969 }
1970 return input;
1971 }
1972
1973 /************************************
1974 Relative Time
1975 ************************************/
1976
1977
1978 // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
1979 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
1980 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
1981 }
1982
1983 function relativeTime(posNegDuration, withoutSuffix, locale) {
1984 var duration = moment.duration(posNegDuration).abs(),
1985 seconds = round(duration.as('s')),
1986 minutes = round(duration.as('m')),
1987 hours = round(duration.as('h')),
1988 days = round(duration.as('d')),
1989 months = round(duration.as('M')),
1990 years = round(duration.as('y')),
1991
1992 args = seconds < relativeTimeThresholds.s && ['s', seconds] ||
1993 minutes === 1 && ['m'] ||
1994 minutes < relativeTimeThresholds.m && ['mm', minutes] ||
1995 hours === 1 && ['h'] ||
1996 hours < relativeTimeThresholds.h && ['hh', hours] ||
1997 days === 1 && ['d'] ||
1998 days < relativeTimeThresholds.d && ['dd', days] ||
1999 months === 1 && ['M'] ||
2000 months < relativeTimeThresholds.M && ['MM', months] ||
2001 years === 1 && ['y'] || ['yy', years];
2002
2003 args[2] = withoutSuffix;
2004 args[3] = +posNegDuration > 0;
2005 args[4] = locale;
2006 return substituteTimeAgo.apply({}, args);
2007 }
2008
2009
2010 /************************************
2011 Week of Year
2012 ************************************/
2013
2014
2015 // firstDayOfWeek 0 = sun, 6 = sat
2016 // the day of the week that starts the week
2017 // (usually sunday or monday)
2018 // firstDayOfWeekOfYear 0 = sun, 6 = sat
2019 // the first week is the week that contains the first
2020 // of this day of the week
2021 // (eg. ISO weeks use thursday (4))
2022 function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
2023 var end = firstDayOfWeekOfYear - firstDayOfWeek,
2024 daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
2025 adjustedMoment;
2026
2027
2028 if (daysToDayOfWeek > end) {
2029 daysToDayOfWeek -= 7;
2030 }
2031
2032 if (daysToDayOfWeek < end - 7) {
2033 daysToDayOfWeek += 7;
2034 }
2035
2036 adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');
2037 return {
2038 week: Math.ceil(adjustedMoment.dayOfYear() / 7),
2039 year: adjustedMoment.year()
2040 };
2041 }
2042
2043 //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
2044 function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
2045 var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
2046
2047 d = d === 0 ? 7 : d;
2048 weekday = weekday != null ? weekday : firstDayOfWeek;
2049 daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
2050 dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
2051
2052 return {
2053 year: dayOfYear > 0 ? year : year - 1,
2054 dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
2055 };
2056 }
2057
2058 /************************************
2059 Top Level Functions
2060 ************************************/
2061
2062 function makeMoment(config) {
2063 var input = config._i,
2064 format = config._f;
2065
2066 config._locale = config._locale || moment.localeData(config._l);
2067
2068 if (input === null || (format === undefined && input === '')) {
2069 return moment.invalid({nullInput: true});
2070 }
2071
2072 if (typeof input === 'string') {
2073 config._i = input = config._locale.preparse(input);
2074 }
2075
2076 if (moment.isMoment(input)) {
2077 return new Moment(input, true);
2078 } else if (format) {
2079 if (isArray(format)) {
2080 makeDateFromStringAndArray(config);
2081 } else {
2082 makeDateFromStringAndFormat(config);
2083 }
2084 } else {
2085 makeDateFromInput(config);
2086 }
2087
2088 return new Moment(config);
2089 }
2090
2091 moment = function (input, format, locale, strict) {
2092 var c;
2093
2094 if (typeof(locale) === 'boolean') {
2095 strict = locale;
2096 locale = undefined;
2097 }
2098 // object construction must be done this way.
2099 // https://github.com/moment/moment/issues/1423
2100 c = {};
2101 c._isAMomentObject = true;
2102 c._i = input;
2103 c._f = format;
2104 c._l = locale;
2105 c._strict = strict;
2106 c._isUTC = false;
2107 c._pf = defaultParsingFlags();
2108
2109 return makeMoment(c);
2110 };
2111
2112 moment.suppressDeprecationWarnings = false;
2113
2114 moment.createFromInputFallback = deprecate(
2115 'moment construction falls back to js Date. This is ' +
2116 'discouraged and will be removed in upcoming major ' +
2117 'release. Please refer to ' +
2118 'https://github.com/moment/moment/issues/1407 for more info.',
2119 function (config) {
2120 config._d = new Date(config._i);
2121 }
2122 );
2123
2124 // Pick a moment m from moments so that m[fn](other) is true for all
2125 // other. This relies on the function fn to be transitive.
2126 //
2127 // moments should either be an array of moment objects or an array, whose
2128 // first element is an array of moment objects.
2129 function pickBy(fn, moments) {
2130 var res, i;
2131 if (moments.length === 1 && isArray(moments[0])) {
2132 moments = moments[0];
2133 }
2134 if (!moments.length) {
2135 return moment();
2136 }
2137 res = moments[0];
2138 for (i = 1; i < moments.length; ++i) {
2139 if (moments[i][fn](res)) {
2140 res = moments[i];
2141 }
2142 }
2143 return res;
2144 }
2145
2146 moment.min = function () {
2147 var args = [].slice.call(arguments, 0);
2148
2149 return pickBy('isBefore', args);
2150 };
2151
2152 moment.max = function () {
2153 var args = [].slice.call(arguments, 0);
2154
2155 return pickBy('isAfter', args);
2156 };
2157
2158 // creating with utc
2159 moment.utc = function (input, format, locale, strict) {
2160 var c;
2161
2162 if (typeof(locale) === 'boolean') {
2163 strict = locale;
2164 locale = undefined;
2165 }
2166 // object construction must be done this way.
2167 // https://github.com/moment/moment/issues/1423
2168 c = {};
2169 c._isAMomentObject = true;
2170 c._useUTC = true;
2171 c._isUTC = true;
2172 c._l = locale;
2173 c._i = input;
2174 c._f = format;
2175 c._strict = strict;
2176 c._pf = defaultParsingFlags();
2177
2178 return makeMoment(c).utc();
2179 };
2180
2181 // creating with unix timestamp (in seconds)
2182 moment.unix = function (input) {
2183 return moment(input * 1000);
2184 };
2185
2186 // duration
2187 moment.duration = function (input, key) {
2188 var duration = input,
2189 // matching against regexp is expensive, do it on demand
2190 match = null,
2191 sign,
2192 ret,
2193 parseIso,
2194 diffRes;
2195
2196 if (moment.isDuration(input)) {
2197 duration = {
2198 ms: input._milliseconds,
2199 d: input._days,
2200 M: input._months
2201 };
2202 } else if (typeof input === 'number') {
2203 duration = {};
2204 if (key) {
2205 duration[key] = input;
2206 } else {
2207 duration.milliseconds = input;
2208 }
2209 } else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
2210 sign = (match[1] === '-') ? -1 : 1;
2211 duration = {
2212 y: 0,
2213 d: toInt(match[DATE]) * sign,
2214 h: toInt(match[HOUR]) * sign,
2215 m: toInt(match[MINUTE]) * sign,
2216 s: toInt(match[SECOND]) * sign,
2217 ms: toInt(match[MILLISECOND]) * sign
2218 };
2219 } else if (!!(match = isoDurationRegex.exec(input))) {
2220 sign = (match[1] === '-') ? -1 : 1;
2221 parseIso = function (inp) {
2222 // We'd normally use ~~inp for this, but unfortunately it also
2223 // converts floats to ints.
2224 // inp may be undefined, so careful calling replace on it.
2225 var res = inp && parseFloat(inp.replace(',', '.'));
2226 // apply sign while we're at it
2227 return (isNaN(res) ? 0 : res) * sign;
2228 };
2229 duration = {
2230 y: parseIso(match[2]),
2231 M: parseIso(match[3]),
2232 d: parseIso(match[4]),
2233 h: parseIso(match[5]),
2234 m: parseIso(match[6]),
2235 s: parseIso(match[7]),
2236 w: parseIso(match[8])
2237 };
2238 } else if (typeof duration === 'object' &&
2239 ('from' in duration || 'to' in duration)) {
2240 diffRes = momentsDifference(moment(duration.from), moment(duration.to));
2241
2242 duration = {};
2243 duration.ms = diffRes.milliseconds;
2244 duration.M = diffRes.months;
2245 }
2246
2247 ret = new Duration(duration);
2248
2249 if (moment.isDuration(input) && hasOwnProp(input, '_locale')) {
2250 ret._locale = input._locale;
2251 }
2252
2253 return ret;
2254 };
2255
2256 // version number
2257 moment.version = VERSION;
2258
2259 // default format
2260 moment.defaultFormat = isoFormat;
2261
2262 // constant that refers to the ISO standard
2263 moment.ISO_8601 = function () {};
2264
2265 // Plugins that add properties should also add the key here (null value),
2266 // so we can properly clone ourselves.
2267 moment.momentProperties = momentProperties;
2268
2269 // This function will be called whenever a moment is mutated.
2270 // It is intended to keep the offset in sync with the timezone.
2271 moment.updateOffset = function () {};
2272
2273 // This function allows you to set a threshold for relative time strings
2274 moment.relativeTimeThreshold = function (threshold, limit) {
2275 if (relativeTimeThresholds[threshold] === undefined) {
2276 return false;
2277 }
2278 if (limit === undefined) {
2279 return relativeTimeThresholds[threshold];
2280 }
2281 relativeTimeThresholds[threshold] = limit;
2282 return true;
2283 };
2284
2285 moment.lang = deprecate(
2286 'moment.lang is deprecated. Use moment.locale instead.',
2287 function (key, value) {
2288 return moment.locale(key, value);
2289 }
2290 );
2291
2292 // This function will load locale and then set the global locale. If
2293 // no arguments are passed in, it will simply return the current global
2294 // locale key.
2295 moment.locale = function (key, values) {
2296 var data;
2297 if (key) {
2298 if (typeof(values) !== 'undefined') {
2299 data = moment.defineLocale(key, values);
2300 }
2301 else {
2302 data = moment.localeData(key);
2303 }
2304
2305 if (data) {
2306 moment.duration._locale = moment._locale = data;
2307 }
2308 }
2309
2310 return moment._locale._abbr;
2311 };
2312
2313 moment.defineLocale = function (name, values) {
2314 if (values !== null) {
2315 values.abbr = name;
2316 if (!locales[name]) {
2317 locales[name] = new Locale();
2318 }
2319 locales[name].set(values);
2320
2321 // backwards compat for now: also set the locale
2322 moment.locale(name);
2323
2324 return locales[name];
2325 } else {
2326 // useful for testing
2327 delete locales[name];
2328 return null;
2329 }
2330 };
2331
2332 moment.langData = deprecate(
2333 'moment.langData is deprecated. Use moment.localeData instead.',
2334 function (key) {
2335 return moment.localeData(key);
2336 }
2337 );
2338
2339 // returns locale data
2340 moment.localeData = function (key) {
2341 var locale;
2342
2343 if (key && key._locale && key._locale._abbr) {
2344 key = key._locale._abbr;
2345 }
2346
2347 if (!key) {
2348 return moment._locale;
2349 }
2350
2351 if (!isArray(key)) {
2352 //short-circuit everything else
2353 locale = loadLocale(key);
2354 if (locale) {
2355 return locale;
2356 }
2357 key = [key];
2358 }
2359
2360 return chooseLocale(key);
2361 };
2362
2363 // compare moment object
2364 moment.isMoment = function (obj) {
2365 return obj instanceof Moment ||
2366 (obj != null && hasOwnProp(obj, '_isAMomentObject'));
2367 };
2368
2369 // for typechecking Duration objects
2370 moment.isDuration = function (obj) {
2371 return obj instanceof Duration;
2372 };
2373
2374 for (i = lists.length - 1; i >= 0; --i) {
2375 makeList(lists[i]);
2376 }
2377
2378 moment.normalizeUnits = function (units) {
2379 return normalizeUnits(units);
2380 };
2381
2382 moment.invalid = function (flags) {
2383 var m = moment.utc(NaN);
2384 if (flags != null) {
2385 extend(m._pf, flags);
2386 }
2387 else {
2388 m._pf.userInvalidated = true;
2389 }
2390
2391 return m;
2392 };
2393
2394 moment.parseZone = function () {
2395 return moment.apply(null, arguments).parseZone();
2396 };
2397
2398 moment.parseTwoDigitYear = function (input) {
2399 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
2400 };
2401
2402 /************************************
2403 Moment Prototype
2404 ************************************/
2405
2406
2407 extend(moment.fn = Moment.prototype, {
2408
2409 clone : function () {
2410 return moment(this);
2411 },
2412
2413 valueOf : function () {
2414 return +this._d + ((this._offset || 0) * 60000);
2415 },
2416
2417 unix : function () {
2418 return Math.floor(+this / 1000);
2419 },
2420
2421 toString : function () {
2422 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
2423 },
2424
2425 toDate : function () {
2426 return this._offset ? new Date(+this) : this._d;
2427 },
2428
2429 toISOString : function () {
2430 var m = moment(this).utc();
2431 if (0 < m.year() && m.year() <= 9999) {
2432 return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
2433 } else {
2434 return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
2435 }
2436 },
2437
2438 toArray : function () {
2439 var m = this;
2440 return [
2441 m.year(),
2442 m.month(),
2443 m.date(),
2444 m.hours(),
2445 m.minutes(),
2446 m.seconds(),
2447 m.milliseconds()
2448 ];
2449 },
2450
2451 isValid : function () {
2452 return isValid(this);
2453 },
2454
2455 isDSTShifted : function () {
2456 if (this._a) {
2457 return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
2458 }
2459
2460 return false;
2461 },
2462
2463 parsingFlags : function () {
2464 return extend({}, this._pf);
2465 },
2466
2467 invalidAt: function () {
2468 return this._pf.overflow;
2469 },
2470
2471 utc : function (keepLocalTime) {
2472 return this.zone(0, keepLocalTime);
2473 },
2474
2475 local : function (keepLocalTime) {
2476 if (this._isUTC) {
2477 this.zone(0, keepLocalTime);
2478 this._isUTC = false;
2479
2480 if (keepLocalTime) {
2481 this.add(this._dateTzOffset(), 'm');
2482 }
2483 }
2484 return this;
2485 },
2486
2487 format : function (inputString) {
2488 var output = formatMoment(this, inputString || moment.defaultFormat);
2489 return this.localeData().postformat(output);
2490 },
2491
2492 add : createAdder(1, 'add'),
2493
2494 subtract : createAdder(-1, 'subtract'),
2495
2496 diff : function (input, units, asFloat) {
2497 var that = makeAs(input, this),
2498 zoneDiff = (this.zone() - that.zone()) * 6e4,
2499 diff, output, daysAdjust;
2500
2501 units = normalizeUnits(units);
2502
2503 if (units === 'year' || units === 'month') {
2504 // average number of days in the months in the given dates
2505 diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
2506 // difference in months
2507 output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
2508 // adjust by taking difference in days, average number of days
2509 // and dst in the given months.
2510 daysAdjust = (this - moment(this).startOf('month')) -
2511 (that - moment(that).startOf('month'));
2512 // same as above but with zones, to negate all dst
2513 daysAdjust -= ((this.zone() - moment(this).startOf('month').zone()) -
2514 (that.zone() - moment(that).startOf('month').zone())) * 6e4;
2515 output += daysAdjust / diff;
2516 if (units === 'year') {
2517 output = output / 12;
2518 }
2519 } else {
2520 diff = (this - that);
2521 output = units === 'second' ? diff / 1e3 : // 1000
2522 units === 'minute' ? diff / 6e4 : // 1000 * 60
2523 units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
2524 units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
2525 units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
2526 diff;
2527 }
2528 return asFloat ? output : absRound(output);
2529 },
2530
2531 from : function (time, withoutSuffix) {
2532 return moment.duration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
2533 },
2534
2535 fromNow : function (withoutSuffix) {
2536 return this.from(moment(), withoutSuffix);
2537 },
2538
2539 calendar : function (time) {
2540 // We want to compare the start of today, vs this.
2541 // Getting start-of-today depends on whether we're zone'd or not.
2542 var now = time || moment(),
2543 sod = makeAs(now, this).startOf('day'),
2544 diff = this.diff(sod, 'days', true),
2545 format = diff < -6 ? 'sameElse' :
2546 diff < -1 ? 'lastWeek' :
2547 diff < 0 ? 'lastDay' :
2548 diff < 1 ? 'sameDay' :
2549 diff < 2 ? 'nextDay' :
2550 diff < 7 ? 'nextWeek' : 'sameElse';
2551 return this.format(this.localeData().calendar(format, this));
2552 },
2553
2554 isLeapYear : function () {
2555 return isLeapYear(this.year());
2556 },
2557
2558 isDST : function () {
2559 return (this.zone() < this.clone().month(0).zone() ||
2560 this.zone() < this.clone().month(5).zone());
2561 },
2562
2563 day : function (input) {
2564 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
2565 if (input != null) {
2566 input = parseWeekday(input, this.localeData());
2567 return this.add(input - day, 'd');
2568 } else {
2569 return day;
2570 }
2571 },
2572
2573 month : makeAccessor('Month', true),
2574
2575 startOf : function (units) {
2576 units = normalizeUnits(units);
2577 // the following switch intentionally omits break keywords
2578 // to utilize falling through the cases.
2579 switch (units) {
2580 case 'year':
2581 this.month(0);
2582 /* falls through */
2583 case 'quarter':
2584 case 'month':
2585 this.date(1);
2586 /* falls through */
2587 case 'week':
2588 case 'isoWeek':
2589 case 'day':
2590 this.hours(0);
2591 /* falls through */
2592 case 'hour':
2593 this.minutes(0);
2594 /* falls through */
2595 case 'minute':
2596 this.seconds(0);
2597 /* falls through */
2598 case 'second':
2599 this.milliseconds(0);
2600 /* falls through */
2601 }
2602
2603 // weeks are a special case
2604 if (units === 'week') {
2605 this.weekday(0);
2606 } else if (units === 'isoWeek') {
2607 this.isoWeekday(1);
2608 }
2609
2610 // quarters are also special
2611 if (units === 'quarter') {
2612 this.month(Math.floor(this.month() / 3) * 3);
2613 }
2614
2615 return this;
2616 },
2617
2618 endOf: function (units) {
2619 units = normalizeUnits(units);
2620 return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
2621 },
2622
2623 isAfter: function (input, units) {
2624 units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
2625 if (units === 'millisecond') {
2626 input = moment.isMoment(input) ? input : moment(input);
2627 return +this > +input;
2628 } else {
2629 return +this.clone().startOf(units) > +moment(input).startOf(units);
2630 }
2631 },
2632
2633 isBefore: function (input, units) {
2634 units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
2635 if (units === 'millisecond') {
2636 input = moment.isMoment(input) ? input : moment(input);
2637 return +this < +input;
2638 } else {
2639 return +this.clone().startOf(units) < +moment(input).startOf(units);
2640 }
2641 },
2642
2643 isSame: function (input, units) {
2644 units = normalizeUnits(units || 'millisecond');
2645 if (units === 'millisecond') {
2646 input = moment.isMoment(input) ? input : moment(input);
2647 return +this === +input;
2648 } else {
2649 return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
2650 }
2651 },
2652
2653 min: deprecate(
2654 'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
2655 function (other) {
2656 other = moment.apply(null, arguments);
2657 return other < this ? this : other;
2658 }
2659 ),
2660
2661 max: deprecate(
2662 'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
2663 function (other) {
2664 other = moment.apply(null, arguments);
2665 return other > this ? this : other;
2666 }
2667 ),
2668
2669 // keepLocalTime = true means only change the timezone, without
2670 // affecting the local hour. So 5:31:26 +0300 --[zone(2, true)]-->
2671 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist int zone
2672 // +0200, so we adjust the time as needed, to be valid.
2673 //
2674 // Keeping the time actually adds/subtracts (one hour)
2675 // from the actual represented time. That is why we call updateOffset
2676 // a second time. In case it wants us to change the offset again
2677 // _changeInProgress == true case, then we have to adjust, because
2678 // there is no such time in the given timezone.
2679 zone : function (input, keepLocalTime) {
2680 var offset = this._offset || 0,
2681 localAdjust;
2682 if (input != null) {
2683 if (typeof input === 'string') {
2684 input = timezoneMinutesFromString(input);
2685 }
2686 if (Math.abs(input) < 16) {
2687 input = input * 60;
2688 }
2689 if (!this._isUTC && keepLocalTime) {
2690 localAdjust = this._dateTzOffset();
2691 }
2692 this._offset = input;
2693 this._isUTC = true;
2694 if (localAdjust != null) {
2695 this.subtract(localAdjust, 'm');
2696 }
2697 if (offset !== input) {
2698 if (!keepLocalTime || this._changeInProgress) {
2699 addOrSubtractDurationFromMoment(this,
2700 moment.duration(offset - input, 'm'), 1, false);
2701 } else if (!this._changeInProgress) {
2702 this._changeInProgress = true;
2703 moment.updateOffset(this, true);
2704 this._changeInProgress = null;
2705 }
2706 }
2707 } else {
2708 return this._isUTC ? offset : this._dateTzOffset();
2709 }
2710 return this;
2711 },
2712
2713 zoneAbbr : function () {
2714 return this._isUTC ? 'UTC' : '';
2715 },
2716
2717 zoneName : function () {
2718 return this._isUTC ? 'Coordinated Universal Time' : '';
2719 },
2720
2721 parseZone : function () {
2722 if (this._tzm) {
2723 this.zone(this._tzm);
2724 } else if (typeof this._i === 'string') {
2725 this.zone(this._i);
2726 }
2727 return this;
2728 },
2729
2730 hasAlignedHourOffset : function (input) {
2731 if (!input) {
2732 input = 0;
2733 }
2734 else {
2735 input = moment(input).zone();
2736 }
2737
2738 return (this.zone() - input) % 60 === 0;
2739 },
2740
2741 daysInMonth : function () {
2742 return daysInMonth(this.year(), this.month());
2743 },
2744
2745 dayOfYear : function (input) {
2746 var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
2747 return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
2748 },
2749
2750 quarter : function (input) {
2751 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
2752 },
2753
2754 weekYear : function (input) {
2755 var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
2756 return input == null ? year : this.add((input - year), 'y');
2757 },
2758
2759 isoWeekYear : function (input) {
2760 var year = weekOfYear(this, 1, 4).year;
2761 return input == null ? year : this.add((input - year), 'y');
2762 },
2763
2764 week : function (input) {
2765 var week = this.localeData().week(this);
2766 return input == null ? week : this.add((input - week) * 7, 'd');
2767 },
2768
2769 isoWeek : function (input) {
2770 var week = weekOfYear(this, 1, 4).week;
2771 return input == null ? week : this.add((input - week) * 7, 'd');
2772 },
2773
2774 weekday : function (input) {
2775 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
2776 return input == null ? weekday : this.add(input - weekday, 'd');
2777 },
2778
2779 isoWeekday : function (input) {
2780 // behaves the same as moment#day except
2781 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
2782 // as a setter, sunday should belong to the previous week.
2783 return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
2784 },
2785
2786 isoWeeksInYear : function () {
2787 return weeksInYear(this.year(), 1, 4);
2788 },
2789
2790 weeksInYear : function () {
2791 var weekInfo = this.localeData()._week;
2792 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
2793 },
2794
2795 get : function (units) {
2796 units = normalizeUnits(units);
2797 return this[units]();
2798 },
2799
2800 set : function (units, value) {
2801 units = normalizeUnits(units);
2802 if (typeof this[units] === 'function') {
2803 this[units](value);
2804 }
2805 return this;
2806 },
2807
2808 // If passed a locale key, it will set the locale for this
2809 // instance. Otherwise, it will return the locale configuration
2810 // variables for this instance.
2811 locale : function (key) {
2812 var newLocaleData;
2813
2814 if (key === undefined) {
2815 return this._locale._abbr;
2816 } else {
2817 newLocaleData = moment.localeData(key);
2818 if (newLocaleData != null) {
2819 this._locale = newLocaleData;
2820 }
2821 return this;
2822 }
2823 },
2824
2825 lang : deprecate(
2826 'moment().lang() is deprecated. Use moment().localeData() instead.',
2827 function (key) {
2828 if (key === undefined) {
2829 return this.localeData();
2830 } else {
2831 return this.locale(key);
2832 }
2833 }
2834 ),
2835
2836 localeData : function () {
2837 return this._locale;
2838 },
2839
2840 _dateTzOffset : function () {
2841 // On Firefox.24 Date#getTimezoneOffset returns a floating point.
2842 // https://github.com/moment/moment/pull/1871
2843 return Math.round(this._d.getTimezoneOffset() / 15) * 15;
2844 }
2845 });
2846
2847 function rawMonthSetter(mom, value) {
2848 var dayOfMonth;
2849
2850 // TODO: Move this out of here!
2851 if (typeof value === 'string') {
2852 value = mom.localeData().monthsParse(value);
2853 // TODO: Another silent failure?
2854 if (typeof value !== 'number') {
2855 return mom;
2856 }
2857 }
2858
2859 dayOfMonth = Math.min(mom.date(),
2860 daysInMonth(mom.year(), value));
2861 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
2862 return mom;
2863 }
2864
2865 function rawGetter(mom, unit) {
2866 return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
2867 }
2868
2869 function rawSetter(mom, unit, value) {
2870 if (unit === 'Month') {
2871 return rawMonthSetter(mom, value);
2872 } else {
2873 return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
2874 }
2875 }
2876
2877 function makeAccessor(unit, keepTime) {
2878 return function (value) {
2879 if (value != null) {
2880 rawSetter(this, unit, value);
2881 moment.updateOffset(this, keepTime);
2882 return this;
2883 } else {
2884 return rawGetter(this, unit);
2885 }
2886 };
2887 }
2888
2889 moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
2890 moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
2891 moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
2892 // Setting the hour should keep the time, because the user explicitly
2893 // specified which hour he wants. So trying to maintain the same hour (in
2894 // a new timezone) makes sense. Adding/subtracting hours does not follow
2895 // this rule.
2896 moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
2897 // moment.fn.month is defined separately
2898 moment.fn.date = makeAccessor('Date', true);
2899 moment.fn.dates = deprecate('dates accessor is deprecated. Use date instead.', makeAccessor('Date', true));
2900 moment.fn.year = makeAccessor('FullYear', true);
2901 moment.fn.years = deprecate('years accessor is deprecated. Use year instead.', makeAccessor('FullYear', true));
2902
2903 // add plural methods
2904 moment.fn.days = moment.fn.day;
2905 moment.fn.months = moment.fn.month;
2906 moment.fn.weeks = moment.fn.week;
2907 moment.fn.isoWeeks = moment.fn.isoWeek;
2908 moment.fn.quarters = moment.fn.quarter;
2909
2910 // add aliased format methods
2911 moment.fn.toJSON = moment.fn.toISOString;
2912
2913 /************************************
2914 Duration Prototype
2915 ************************************/
2916
2917
2918 function daysToYears (days) {
2919 // 400 years have 146097 days (taking into account leap year rules)
2920 return days * 400 / 146097;
2921 }
2922
2923 function yearsToDays (years) {
2924 // years * 365 + absRound(years / 4) -
2925 // absRound(years / 100) + absRound(years / 400);
2926 return years * 146097 / 400;
2927 }
2928
2929 extend(moment.duration.fn = Duration.prototype, {
2930
2931 _bubble : function () {
2932 var milliseconds = this._milliseconds,
2933 days = this._days,
2934 months = this._months,
2935 data = this._data,
2936 seconds, minutes, hours, years = 0;
2937
2938 // The following code bubbles up values, see the tests for
2939 // examples of what that means.
2940 data.milliseconds = milliseconds % 1000;
2941
2942 seconds = absRound(milliseconds / 1000);
2943 data.seconds = seconds % 60;
2944
2945 minutes = absRound(seconds / 60);
2946 data.minutes = minutes % 60;
2947
2948 hours = absRound(minutes / 60);
2949 data.hours = hours % 24;
2950
2951 days += absRound(hours / 24);
2952
2953 // Accurately convert days to years, assume start from year 0.
2954 years = absRound(daysToYears(days));
2955 days -= absRound(yearsToDays(years));
2956
2957 // 30 days to a month
2958 // TODO (iskren): Use anchor date (like 1st Jan) to compute this.
2959 months += absRound(days / 30);
2960 days %= 30;
2961
2962 // 12 months -> 1 year
2963 years += absRound(months / 12);
2964 months %= 12;
2965
2966 data.days = days;
2967 data.months = months;
2968 data.years = years;
2969 },
2970
2971 abs : function () {
2972 this._milliseconds = Math.abs(this._milliseconds);
2973 this._days = Math.abs(this._days);
2974 this._months = Math.abs(this._months);
2975
2976 this._data.milliseconds = Math.abs(this._data.milliseconds);
2977 this._data.seconds = Math.abs(this._data.seconds);
2978 this._data.minutes = Math.abs(this._data.minutes);
2979 this._data.hours = Math.abs(this._data.hours);
2980 this._data.months = Math.abs(this._data.months);
2981 this._data.years = Math.abs(this._data.years);
2982
2983 return this;
2984 },
2985
2986 weeks : function () {
2987 return absRound(this.days() / 7);
2988 },
2989
2990 valueOf : function () {
2991 return this._milliseconds +
2992 this._days * 864e5 +
2993 (this._months % 12) * 2592e6 +
2994 toInt(this._months / 12) * 31536e6;
2995 },
2996
2997 humanize : function (withSuffix) {
2998 var output = relativeTime(this, !withSuffix, this.localeData());
2999
3000 if (withSuffix) {
3001 output = this.localeData().pastFuture(+this, output);
3002 }
3003
3004 return this.localeData().postformat(output);
3005 },
3006
3007 add : function (input, val) {
3008 // supports only 2.0-style add(1, 's') or add(moment)
3009 var dur = moment.duration(input, val);
3010
3011 this._milliseconds += dur._milliseconds;
3012 this._days += dur._days;
3013 this._months += dur._months;
3014
3015 this._bubble();
3016
3017 return this;
3018 },
3019
3020 subtract : function (input, val) {
3021 var dur = moment.duration(input, val);
3022
3023 this._milliseconds -= dur._milliseconds;
3024 this._days -= dur._days;
3025 this._months -= dur._months;
3026
3027 this._bubble();
3028
3029 return this;
3030 },
3031
3032 get : function (units) {
3033 units = normalizeUnits(units);
3034 return this[units.toLowerCase() + 's']();
3035 },
3036
3037 as : function (units) {
3038 var days, months;
3039 units = normalizeUnits(units);
3040
3041 if (units === 'month' || units === 'year') {
3042 days = this._days + this._milliseconds / 864e5;
3043 months = this._months + daysToYears(days) * 12;
3044 return units === 'month' ? months : months / 12;
3045 } else {
3046 // handle milliseconds separately because of floating point math errors (issue #1867)
3047 days = this._days + yearsToDays(this._months / 12);
3048 switch (units) {
3049 case 'week': return days / 7 + this._milliseconds / 6048e5;
3050 case 'day': return days + this._milliseconds / 864e5;
3051 case 'hour': return days * 24 + this._milliseconds / 36e5;
3052 case 'minute': return days * 24 * 60 + this._milliseconds / 6e4;
3053 case 'second': return days * 24 * 60 * 60 + this._milliseconds / 1000;
3054 // Math.floor prevents floating point math errors here
3055 case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + this._milliseconds;
3056 default: throw new Error('Unknown unit ' + units);
3057 }
3058 }
3059 },
3060
3061 lang : moment.fn.lang,
3062 locale : moment.fn.locale,
3063
3064 toIsoString : deprecate(
3065 'toIsoString() is deprecated. Please use toISOString() instead ' +
3066 '(notice the capitals)',
3067 function () {
3068 return this.toISOString();
3069 }
3070 ),
3071
3072 toISOString : function () {
3073 // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
3074 var years = Math.abs(this.years()),
3075 months = Math.abs(this.months()),
3076 days = Math.abs(this.days()),
3077 hours = Math.abs(this.hours()),
3078 minutes = Math.abs(this.minutes()),
3079 seconds = Math.abs(this.seconds() + this.milliseconds() / 1000);
3080
3081 if (!this.asSeconds()) {
3082 // this is the same as C#'s (Noda) and python (isodate)...
3083 // but not other JS (goog.date)
3084 return 'P0D';
3085 }
3086
3087 return (this.asSeconds() < 0 ? '-' : '') +
3088 'P' +
3089 (years ? years + 'Y' : '') +
3090 (months ? months + 'M' : '') +
3091 (days ? days + 'D' : '') +
3092 ((hours || minutes || seconds) ? 'T' : '') +
3093 (hours ? hours + 'H' : '') +
3094 (minutes ? minutes + 'M' : '') +
3095 (seconds ? seconds + 'S' : '');
3096 },
3097
3098 localeData : function () {
3099 return this._locale;
3100 }
3101 });
3102
3103 moment.duration.fn.toString = moment.duration.fn.toISOString;
3104
3105 function makeDurationGetter(name) {
3106 moment.duration.fn[name] = function () {
3107 return this._data[name];
3108 };
3109 }
3110
3111 for (i in unitMillisecondFactors) {
3112 if (hasOwnProp(unitMillisecondFactors, i)) {
3113 makeDurationGetter(i.toLowerCase());
3114 }
3115 }
3116
3117 moment.duration.fn.asMilliseconds = function () {
3118 return this.as('ms');
3119 };
3120 moment.duration.fn.asSeconds = function () {
3121 return this.as('s');
3122 };
3123 moment.duration.fn.asMinutes = function () {
3124 return this.as('m');
3125 };
3126 moment.duration.fn.asHours = function () {
3127 return this.as('h');
3128 };
3129 moment.duration.fn.asDays = function () {
3130 return this.as('d');
3131 };
3132 moment.duration.fn.asWeeks = function () {
3133 return this.as('weeks');
3134 };
3135 moment.duration.fn.asMonths = function () {
3136 return this.as('M');
3137 };
3138 moment.duration.fn.asYears = function () {
3139 return this.as('y');
3140 };
3141
3142 /************************************
3143 Default Locale
3144 ************************************/
3145
3146
3147 // Set default locale, other locale will inherit from English.
3148 moment.locale('en', {
3149 ordinal : function (number) {
3150 var b = number % 10,
3151 output = (toInt(number % 100 / 10) === 1) ? 'th' :
3152 (b === 1) ? 'st' :
3153 (b === 2) ? 'nd' :
3154 (b === 3) ? 'rd' : 'th';
3155 return number + output;
3156 }
3157 });
3158
3159 return moment;
3160
3161 }).call(this);
3162
3163 UI.Utils.moment = moment;
3164
3165 return UI.datepicker;
3166});
diff --git a/js/components/datepicker.min.js b/js/components/datepicker.min.js
new file mode 100755
index 0000000..f8dfe47
--- /dev/null
+++ b/js/components/datepicker.min.js
@@ -0,0 +1,3 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-datepicker",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e,n,a=!1;return t.component("datepicker",{defaults:{mobile:!1,weekstart:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},format:"YYYY-MM-DD",offsettop:5,maxDate:!1,minDate:!1,pos:"auto",template:function(e,n){var a,s="";if(s+='<div class="uk-datepicker-nav">',s+='<a href="" class="uk-datepicker-previous"></a>',s+='<a href="" class="uk-datepicker-next"></a>',t.formSelect){var i,r,o,u,c=(new Date).getFullYear(),d=[];for(a=0;a<n.i18n.months.length;a++)a==e.month?d.push('<option value="'+a+'" selected>'+n.i18n.months[a]+"</option>"):d.push('<option value="'+a+'">'+n.i18n.months[a]+"</option>");for(i='<span class="uk-form-select">'+n.i18n.months[e.month]+'<select class="update-picker-month">'+d.join("")+"</select></span>",d=[],o=e.minDate?e.minDate.year():c-50,u=e.maxDate?e.maxDate.year():c+20,a=o;u>=a;a++)a==e.year?d.push('<option value="'+a+'" selected>'+a+"</option>"):d.push('<option value="'+a+'">'+a+"</option>");r='<span class="uk-form-select">'+e.year+'<select class="update-picker-year">'+d.join("")+"</select></span>",s+='<div class="uk-datepicker-heading">'+i+" "+r+"</div>"}else s+='<div class="uk-datepicker-heading">'+n.i18n.months[e.month]+" "+e.year+"</div>";for(s+="</div>",s+='<table class="uk-datepicker-table">',s+="<thead>",a=0;a<e.weekdays.length;a++)e.weekdays[a]&&(s+="<th>"+e.weekdays[a]+"</th>");for(s+="</thead>",s+="<tbody>",a=0;a<e.days.length;a++)if(e.days[a]&&e.days[a].length){s+="<tr>";for(var l=0;l<e.days[a].length;l++)if(e.days[a][l]){var h=e.days[a][l],f=[];h.inmonth||f.push("uk-datepicker-table-muted"),h.selected&&f.push("uk-active"),h.disabled&&f.push("uk-datepicker-date-disabled uk-datepicker-table-muted"),s+='<td><a href="" class="'+f.join(" ")+'" data-date="'+h.day.format()+'">'+h.day.format("D")+"</a></td>"}s+="</tr>"}return s+="</tbody>",s+="</table>"}},boot:function(){t.$win.on("resize orientationchange",function(){a&&a.hide()}),t.$html.on("focus.datepicker.uikit","[data-uk-datepicker]",function(e){var n=t.$(this);n.data("datepicker")||(e.preventDefault(),t.datepicker(n,t.Utils.options(n.attr("data-uk-datepicker"))),n.trigger("focus"))}),t.$html.on("click focus","*",function(n){var s=t.$(n.target);!a||s[0]==e[0]||s.data("datepicker")||s.parents(".uk-datepicker:first").length||a.hide()})},init:function(){if(!t.support.touch||"date"!=this.element.attr("type")||this.options.mobile){var s=this;this.current=this.element.val()?n(this.element.val(),this.options.format):n(),this.on("click focus",function(){a!==s&&s.pick(this.value?this.value:s.options.minDate?s.options.minDate:"")}).on("change",function(){s.element.val()&&!n(s.element.val(),s.options.format).isValid()&&s.element.val(n().format(s.options.format))}),e||(e=t.$('<div class="uk-dropdown uk-datepicker"></div>'),e.on("click",".uk-datepicker-next, .uk-datepicker-previous, [data-date]",function(e){e.stopPropagation(),e.preventDefault();var s=t.$(this);return s.hasClass("uk-datepicker-date-disabled")?!1:(s.is("[data-date]")?(a.current=n(s.data("date")),a.element.val(a.current.isValid()?a.current.format(a.options.format):null).trigger("change"),a.hide()):a.add(s.hasClass("uk-datepicker-next")?1:-1,"months"),void 0)}),e.on("change",".update-picker-month, .update-picker-year",function(){var e=t.$(this);a[e.is(".update-picker-year")?"setYear":"setMonth"](Number(e.val()))}),e.appendTo("body"))}},pick:function(s){var i=this.element.offset(),r={left:i.left,right:""};this.current=isNaN(s)?n(s,this.options.format):n(),this.initdate=this.current.format("YYYY-MM-DD"),this.update(),"right"==t.langdirection&&(r.right=window.innerWidth-(r.left+this.element.outerWidth()),r.left="");var o=i.top-this.element.outerHeight()+this.element.height()-this.options.offsettop-e.outerHeight(),u=i.top+this.element.outerHeight()+this.options.offsettop;r.top=u,"top"==this.options.pos?r.top=o:"auto"==this.options.pos&&window.innerHeight-u-e.outerHeight()<0&&o>=0&&(r.top=o),e.css(r).show(),this.trigger("show.uk.datepicker"),a=this},add:function(t,e){this.current.add(t,e),this.update()},setMonth:function(t){this.current.month(t),this.update()},setYear:function(t){this.current.year(t),this.update()},update:function(){var t=this.getRows(this.current.year(),this.current.month()),n=this.options.template(t,this.options);e.html(n),this.trigger("update.uk.datepicker")},getRows:function(t,e){var a=this.options,s=n().format("YYYY-MM-DD"),i=[31,t%4===0&&t%100!==0||t%400===0?29:28,31,30,31,30,31,31,30,31,30,31][e],r=new Date(t,e,1,12).getDay(),o={month:e,year:t,weekdays:[],days:[],maxDate:!1,minDate:!1},u=[];a.maxDate!==!1&&(o.maxDate=isNaN(a.maxDate)?n(a.maxDate,a.format):n().add(a.maxDate,"days")),a.minDate!==!1&&(o.minDate=isNaN(a.minDate)?n(a.minDate,a.format):n().add(a.minDate-1,"days")),o.weekdays=function(){for(var t=0,e=[];7>t;t++){for(var n=t+(a.weekstart||0);n>=7;)n-=7;e.push(a.i18n.weekdays[n])}return e}(),a.weekstart&&a.weekstart>0&&(r-=a.weekstart,0>r&&(r+=7));for(var c=i+r,d=c;d>7;)d-=7;c+=7-d;for(var l,h,f,m,_,p=0,y=0;c>p;p++)l=new Date(t,e,1+(p-r),12),h=o.minDate&&o.minDate>l||o.maxDate&&l>o.maxDate,_=!(r>p||p>=i+r),l=n(l),f=this.initdate==l.format("YYYY-MM-DD"),m=s==l.format("YYYY-MM-DD"),u.push({selected:f,today:m,disabled:h,day:l,inmonth:_}),7===++y&&(o.days.push(u),u=[],y=0);return o},hide:function(){a&&a===this&&(e.hide(),a=!1,this.trigger("hide.uk.datepicker"))}}),n=function(t){function e(t,e,n){switch(arguments.length){case 2:return null!=t?t:e;case 3:return null!=t?t:null!=e?e:n;default:throw new Error("Implement me")}}function n(t,e){return Ye.call(t,e)}function a(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function s(t){De.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function i(t,e){var n=!0;return h(function(){return n&&(s(t),n=!1),e.apply(this,arguments)},e)}function r(t,e){mn[t]||(s(e),mn[t]=!0)}function o(t,e){return function(n){return _(t.call(this,n),e)}}function u(t,e){return function(n){return this.localeData().ordinal(t.call(this,n),e)}}function c(){}function d(t,e){e!==!1&&F(t),f(this,t),this._d=new Date(+t._d)}function l(t){var e=v(t),n=e.year||0,a=e.quarter||0,s=e.month||0,i=e.week||0,r=e.day||0,o=e.hour||0,u=e.minute||0,c=e.second||0,d=e.millisecond||0;this._milliseconds=+d+1e3*c+6e4*u+36e5*o,this._days=+r+7*i,this._months=+s+3*a+12*n,this._data={},this._locale=De.localeData(),this._bubble()}function h(t,e){for(var a in e)n(e,a)&&(t[a]=e[a]);return n(e,"toString")&&(t.toString=e.toString),n(e,"valueOf")&&(t.valueOf=e.valueOf),t}function f(t,e){var n,a,s;if("undefined"!=typeof e._isAMomentObject&&(t._isAMomentObject=e._isAMomentObject),"undefined"!=typeof e._i&&(t._i=e._i),"undefined"!=typeof e._f&&(t._f=e._f),"undefined"!=typeof e._l&&(t._l=e._l),"undefined"!=typeof e._strict&&(t._strict=e._strict),"undefined"!=typeof e._tzm&&(t._tzm=e._tzm),"undefined"!=typeof e._isUTC&&(t._isUTC=e._isUTC),"undefined"!=typeof e._offset&&(t._offset=e._offset),"undefined"!=typeof e._pf&&(t._pf=e._pf),"undefined"!=typeof e._locale&&(t._locale=e._locale),Fe.length>0)for(n in Fe)a=Fe[n],s=e[a],"undefined"!=typeof s&&(t[a]=s);return t}function m(t){return 0>t?Math.ceil(t):Math.floor(t)}function _(t,e,n){for(var a=""+Math.abs(t),s=t>=0;a.length<e;)a="0"+a;return(s?n?"+":"":"-")+a}function p(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function y(t,e){var n;return e=I(e,t),t.isBefore(e)?n=p(t,e):(n=p(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n}function D(t,e){return function(n,a){var s,i;return null===a||isNaN(+a)||(r(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period)."),i=n,n=a,a=i),n="string"==typeof n?+n:n,s=De.duration(n,a),g(this,s,t),this}}function g(t,e,n,a){var s=e._milliseconds,i=e._days,r=e._months;a=null==a?!0:a,s&&t._d.setTime(+t._d+s*n),i&&fe(t,"Date",he(t,"Date")+i*n),r&&le(t,he(t,"Month")+r*n),a&&De.updateOffset(t,i||r)}function k(t){return"[object Array]"===Object.prototype.toString.call(t)}function M(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function Y(t,e,n){var a,s=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),r=0;for(a=0;s>a;a++)(n&&t[a]!==e[a]||!n&&S(t[a])!==S(e[a]))&&r++;return r+i}function w(t){if(t){var e=t.toLowerCase().replace(/(.)s$/,"$1");t=on[t]||un[e]||e}return t}function v(t){var e,a,s={};for(a in t)n(t,a)&&(e=w(a),e&&(s[e]=t[a]));return s}function b(e){var n,a;if(0===e.indexOf("week"))n=7,a="day";else{if(0!==e.indexOf("month"))return;n=12,a="month"}De[e]=function(s,i){var r,o,u=De._locale[e],c=[];if("number"==typeof s&&(i=s,s=t),o=function(t){var e=De().utc().set(a,t);return u.call(De._locale,e,s||"")},null!=i)return o(i);for(r=0;n>r;r++)c.push(o(r));return c}}function S(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=e>=0?Math.floor(e):Math.ceil(e)),n}function T(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function O(t,e,n){return oe(De([t,11,31+e-n]),e,n).week}function W(t){return U(t)?366:365}function U(t){return t%4===0&&t%100!==0||t%400===0}function F(t){var e;t._a&&-2===t._pf.overflow&&(e=t._a[ve]<0||t._a[ve]>11?ve:t._a[be]<1||t._a[be]>T(t._a[we],t._a[ve])?be:t._a[Se]<0||t._a[Se]>23?Se:t._a[Te]<0||t._a[Te]>59?Te:t._a[Oe]<0||t._a[Oe]>59?Oe:t._a[We]<0||t._a[We]>999?We:-1,t._pf._overflowDayOfYear&&(we>e||e>be)&&(e=be),t._pf.overflow=e)}function G(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length)),t._isValid}function C(t){return t?t.toLowerCase().replace("_","-"):t}function z(t){for(var e,n,a,s,i=0;i<t.length;){for(s=C(t[i]).split("-"),e=s.length,n=C(t[i+1]),n=n?n.split("-"):null;e>0;){if(a=x(s.slice(0,e).join("-")))return a;if(n&&n.length>=e&&Y(s,n,!0)>=e-1)break;e--}i++}return null}function x(t){var e=null;if(!Ue[t]&&Ge)try{e=De.locale(),require("./locale/"+t),De.locale(e)}catch(n){}return Ue[t]}function I(t,e){return e._isUTC?De(t).zone(e._offset||0):De(t).local()}function H(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function L(t){var e,n,a=t.match(Ie);for(e=0,n=a.length;n>e;e++)a[e]=fn[a[e]]?fn[a[e]]:H(a[e]);return function(s){var i="";for(e=0;n>e;e++)i+=a[e]instanceof Function?a[e].call(s,t):a[e];return i}}function P(t,e){return t.isValid()?(e=A(e,t.localeData()),cn[e]||(cn[e]=L(e)),cn[e](t)):t.localeData().invalidDate()}function A(t,e){function n(t){return e.longDateFormat(t)||t}var a=5;for(He.lastIndex=0;a>=0&&He.test(t);)t=t.replace(He,n),He.lastIndex=0,a-=1;return t}function N(t,e){var n,a=e._strict;switch(t){case"Q":return qe;case"DDDD":return Re;case"YYYY":case"GGGG":case"gggg":return a?Xe:Ae;case"Y":case"G":case"g":return Ke;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return a?Be:Ne;case"S":if(a)return qe;case"SS":if(a)return Qe;case"SSS":if(a)return Re;case"DDD":return Pe;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return je;case"a":case"A":return e._locale._meridiemParse;case"X":return Ve;case"Z":case"ZZ":return Ee;case"T":return $e;case"SSSS":return Ze;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return a?Qe:Le;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Le;case"Do":return Je;default:return n=new RegExp(R(Q(t.replace("\\","")),"i"))}}function Z(t){t=t||"";var e=t.match(Ee)||[],n=e[e.length-1]||[],a=(n+"").match(sn)||["-",0,0],s=+(60*a[1])+S(a[2]);return"+"===a[0]?-s:s}function j(t,e,n){var a,s=n._a;switch(t){case"Q":null!=e&&(s[ve]=3*(S(e)-1));break;case"M":case"MM":null!=e&&(s[ve]=S(e)-1);break;case"MMM":case"MMMM":a=n._locale.monthsParse(e),null!=a?s[ve]=a:n._pf.invalidMonth=e;break;case"D":case"DD":null!=e&&(s[be]=S(e));break;case"Do":null!=e&&(s[be]=S(parseInt(e,10)));break;case"DDD":case"DDDD":null!=e&&(n._dayOfYear=S(e));break;case"YY":s[we]=De.parseTwoDigitYear(e);break;case"YYYY":case"YYYYY":case"YYYYYY":s[we]=S(e);break;case"a":case"A":n._isPm=n._locale.isPM(e);break;case"H":case"HH":case"h":case"hh":s[Se]=S(e);break;case"m":case"mm":s[Te]=S(e);break;case"s":case"ss":s[Oe]=S(e);break;case"S":case"SS":case"SSS":case"SSSS":s[We]=S(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=Z(e);break;case"dd":case"ddd":case"dddd":a=n._locale.weekdaysParse(e),null!=a?(n._w=n._w||{},n._w.d=a):n._pf.invalidWeekday=e;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":t=t.substr(0,1);case"gggg":case"GGGG":case"GGGGG":t=t.substr(0,2),e&&(n._w=n._w||{},n._w[t]=S(e));break;case"gg":case"GG":n._w=n._w||{},n._w[t]=De.parseTwoDigitYear(e)}}function E(t){var n,a,s,i,r,o,u;n=t._w,null!=n.GG||null!=n.W||null!=n.E?(r=1,o=4,a=e(n.GG,t._a[we],oe(De(),1,4).year),s=e(n.W,1),i=e(n.E,1)):(r=t._locale._week.dow,o=t._locale._week.doy,a=e(n.gg,t._a[we],oe(De(),r,o).year),s=e(n.w,1),null!=n.d?(i=n.d,r>i&&++s):i=null!=n.e?n.e+r:r),u=ue(a,s,i,o,r),t._a[we]=u.year,t._dayOfYear=u.dayOfYear}function $(t){var n,a,s,i,r=[];if(!t._d){for(s=J(t),t._w&&null==t._a[be]&&null==t._a[ve]&&E(t),t._dayOfYear&&(i=e(t._a[we],s[we]),t._dayOfYear>W(i)&&(t._pf._overflowDayOfYear=!0),a=ae(i,0,t._dayOfYear),t._a[ve]=a.getUTCMonth(),t._a[be]=a.getUTCDate()),n=0;3>n&&null==t._a[n];++n)t._a[n]=r[n]=s[n];for(;7>n;n++)t._a[n]=r[n]=null==t._a[n]?2===n?1:0:t._a[n];t._d=(t._useUTC?ae:ne).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()+t._tzm)}}function V(t){var e;t._d||(e=v(t._i),t._a=[e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond],$(t))}function J(t){var e=new Date;return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function q(t){if(t._f===De.ISO_8601)return B(t),void 0;t._a=[],t._pf.empty=!0;var e,n,a,s,i,r=""+t._i,o=r.length,u=0;for(a=A(t._f,t._locale).match(Ie)||[],e=0;e<a.length;e++)s=a[e],n=(r.match(N(s,t))||[])[0],n&&(i=r.substr(0,r.indexOf(n)),i.length>0&&t._pf.unusedInput.push(i),r=r.slice(r.indexOf(n)+n.length),u+=n.length),fn[s]?(n?t._pf.empty=!1:t._pf.unusedTokens.push(s),j(s,n,t)):t._strict&&!n&&t._pf.unusedTokens.push(s);t._pf.charsLeftOver=o-u,r.length>0&&t._pf.unusedInput.push(r),t._isPm&&t._a[Se]<12&&(t._a[Se]+=12),t._isPm===!1&&12===t._a[Se]&&(t._a[Se]=0),$(t),F(t)}function Q(t){return t.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,a,s){return e||n||a||s})}function R(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function X(t){var e,n,s,i,r;if(0===t._f.length)return t._pf.invalidFormat=!0,t._d=new Date(0/0),void 0;for(i=0;i<t._f.length;i++)r=0,e=f({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._pf=a(),e._f=t._f[i],q(e),G(e)&&(r+=e._pf.charsLeftOver,r+=10*e._pf.unusedTokens.length,e._pf.score=r,(null==s||s>r)&&(s=r,n=e));h(t,n||e)}function B(t){var e,n,a=t._i,s=tn.exec(a);if(s){for(t._pf.iso=!0,e=0,n=nn.length;n>e;e++)if(nn[e][1].exec(a)){t._f=nn[e][0]+(s[6]||" ");break}for(e=0,n=an.length;n>e;e++)if(an[e][1].exec(a)){t._f+=an[e][0];break}a.match(Ee)&&(t._f+="Z"),q(t)}else t._isValid=!1}function K(t){B(t),t._isValid===!1&&(delete t._isValid,De.createFromInputFallback(t))}function te(t,e){var n,a=[];for(n=0;n<t.length;++n)a.push(e(t[n],n));return a}function ee(e){var n,a=e._i;a===t?e._d=new Date:M(a)?e._d=new Date(+a):null!==(n=Ce.exec(a))?e._d=new Date(+n[1]):"string"==typeof a?K(e):k(a)?(e._a=te(a.slice(0),function(t){return parseInt(t,10)}),$(e)):"object"==typeof a?V(e):"number"==typeof a?e._d=new Date(a):De.createFromInputFallback(e)}function ne(t,e,n,a,s,i,r){var o=new Date(t,e,n,a,s,i,r);return 1970>t&&o.setFullYear(t),o}function ae(t){var e=new Date(Date.UTC.apply(null,arguments));return 1970>t&&e.setUTCFullYear(t),e}function se(t,e){if("string"==typeof t)if(isNaN(t)){if(t=e.weekdaysParse(t),"number"!=typeof t)return null}else t=parseInt(t,10);return t}function ie(t,e,n,a,s){return s.relativeTime(e||1,!!n,t,a)}function re(t,e,n){var a=De.duration(t).abs(),s=Me(a.as("s")),i=Me(a.as("m")),r=Me(a.as("h")),o=Me(a.as("d")),u=Me(a.as("M")),c=Me(a.as("y")),d=s<dn.s&&["s",s]||1===i&&["m"]||i<dn.m&&["mm",i]||1===r&&["h"]||r<dn.h&&["hh",r]||1===o&&["d"]||o<dn.d&&["dd",o]||1===u&&["M"]||u<dn.M&&["MM",u]||1===c&&["y"]||["yy",c];return d[2]=e,d[3]=+t>0,d[4]=n,ie.apply({},d)}function oe(t,e,n){var a,s=n-e,i=n-t.day();return i>s&&(i-=7),s-7>i&&(i+=7),a=De(t).add(i,"d"),{week:Math.ceil(a.dayOfYear()/7),year:a.year()}}function ue(t,e,n,a,s){var i,r,o=ae(t,0,1).getUTCDay();return o=0===o?7:o,n=null!=n?n:s,i=s-o+(o>a?7:0)-(s>o?7:0),r=7*(e-1)+(n-s)+i+1,{year:r>0?t:t-1,dayOfYear:r>0?r:W(t-1)+r}}function ce(e){var n=e._i,a=e._f;return e._locale=e._locale||De.localeData(e._l),null===n||a===t&&""===n?De.invalid({nullInput:!0}):("string"==typeof n&&(e._i=n=e._locale.preparse(n)),De.isMoment(n)?new d(n,!0):(a?k(a)?X(e):q(e):ee(e),new d(e)))}function de(t,e){var n,a;if(1===e.length&&k(e[0])&&(e=e[0]),!e.length)return De();for(n=e[0],a=1;a<e.length;++a)e[a][t](n)&&(n=e[a]);return n}function le(t,e){var n;return"string"==typeof e&&(e=t.localeData().monthsParse(e),"number"!=typeof e)?t:(n=Math.min(t.date(),T(t.year(),e)),t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t)}function he(t,e){return t._d["get"+(t._isUTC?"UTC":"")+e]()}function fe(t,e,n){return"Month"===e?le(t,n):t._d["set"+(t._isUTC?"UTC":"")+e](n)}function me(t,e){return function(n){return null!=n?(fe(this,t,n),De.updateOffset(this,e),this):he(this,t)}}function _e(t){return 400*t/146097}function pe(t){return 146097*t/400}function ye(t){De.duration.fn[t]=function(){return this._data[t]}}for(var De,ge,ke="2.8.3",Me=Math.round,Ye=Object.prototype.hasOwnProperty,we=0,ve=1,be=2,Se=3,Te=4,Oe=5,We=6,Ue={},Fe=[],Ge="undefined"!=typeof module&&module.exports,Ce=/^\/?Date\((\-?\d+)/i,ze=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,xe=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Ie=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,He=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Le=/\d\d?/,Pe=/\d{1,3}/,Ae=/\d{1,4}/,Ne=/[+\-]?\d{1,6}/,Ze=/\d+/,je=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Ee=/Z|[\+\-]\d\d:?\d\d/gi,$e=/T/i,Ve=/[\+\-]?\d+(\.\d{1,3})?/,Je=/\d{1,2}/,qe=/\d/,Qe=/\d\d/,Re=/\d{3}/,Xe=/\d{4}/,Be=/[+-]?\d{6}/,Ke=/[+-]?\d+/,tn=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,en="YYYY-MM-DDTHH:mm:ssZ",nn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],an=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],sn=/([\+\-]|\d\d)/gi,rn=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),on={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},un={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},cn={},dn={s:45,m:45,h:22,d:26,M:11},ln="DDD w W M D d".split(" "),hn="M D H h m s w W".split(" "),fn={M:function(){return this.month()+1},MMM:function(t){return this.localeData().monthsShort(this,t)},MMMM:function(t){return this.localeData().months(this,t)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(t){return this.localeData().weekdaysMin(this,t)},ddd:function(t){return this.localeData().weekdaysShort(this,t)},dddd:function(t){return this.localeData().weekdays(this,t)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return _(this.year()%100,2)},YYYY:function(){return _(this.year(),4)},YYYYY:function(){return _(this.year(),5)},YYYYYY:function(){var t=this.year(),e=t>=0?"+":"-";return e+_(Math.abs(t),6)},gg:function(){return _(this.weekYear()%100,2)},gggg:function(){return _(this.weekYear(),4)},ggggg:function(){return _(this.weekYear(),5)},GG:function(){return _(this.isoWeekYear()%100,2)},GGGG:function(){return _(this.isoWeekYear(),4)},GGGGG:function(){return _(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return S(this.milliseconds()/100)},SS:function(){return _(S(this.milliseconds()/10),2)},SSS:function(){return _(this.milliseconds(),3)},SSSS:function(){return _(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+_(S(t/60),2)+":"+_(S(t)%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+_(S(t/60),2)+_(S(t)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},mn={},_n=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];ln.length;)ge=ln.pop(),fn[ge+"o"]=u(fn[ge],ge);for(;hn.length;)ge=hn.pop(),fn[ge+ge]=o(fn[ge],2);fn.DDDD=o(fn.DDD,3),h(c.prototype,{set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,a;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=De.utc([2e3,e]),a="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(a.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,a;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=De([2e3,1]).day(e),a="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(a.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,a){var s=this._relativeTime[n];return"function"==typeof s?s(t,e,n,a):s.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return oe(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),De=function(e,n,s,i){var r;return"boolean"==typeof s&&(i=s,s=t),r={},r._isAMomentObject=!0,r._i=e,r._f=n,r._l=s,r._strict=i,r._isUTC=!1,r._pf=a(),ce(r)},De.suppressDeprecationWarnings=!1,De.createFromInputFallback=i("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i)}),De.min=function(){var t=[].slice.call(arguments,0);return de("isBefore",t)},De.max=function(){var t=[].slice.call(arguments,0);return de("isAfter",t)},De.utc=function(e,n,s,i){var r;return"boolean"==typeof s&&(i=s,s=t),r={},r._isAMomentObject=!0,r._useUTC=!0,r._isUTC=!0,r._l=s,r._i=e,r._f=n,r._strict=i,r._pf=a(),ce(r).utc()},De.unix=function(t){return De(1e3*t)},De.duration=function(t,e){var a,s,i,r,o=t,u=null;return De.isDuration(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(u=ze.exec(t))?(a="-"===u[1]?-1:1,o={y:0,d:S(u[be])*a,h:S(u[Se])*a,m:S(u[Te])*a,s:S(u[Oe])*a,ms:S(u[We])*a}):(u=xe.exec(t))?(a="-"===u[1]?-1:1,i=function(t){var e=t&&parseFloat(t.replace(",","."));return(isNaN(e)?0:e)*a},o={y:i(u[2]),M:i(u[3]),d:i(u[4]),h:i(u[5]),m:i(u[6]),s:i(u[7]),w:i(u[8])}):"object"==typeof o&&("from"in o||"to"in o)&&(r=y(De(o.from),De(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),s=new l(o),De.isDuration(t)&&n(t,"_locale")&&(s._locale=t._locale),s},De.version=ke,De.defaultFormat=en,De.ISO_8601=function(){},De.momentProperties=Fe,De.updateOffset=function(){},De.relativeTimeThreshold=function(e,n){return dn[e]===t?!1:n===t?dn[e]:(dn[e]=n,!0)},De.lang=i("moment.lang is deprecated. Use moment.locale instead.",function(t,e){return De.locale(t,e)}),De.locale=function(t,e){var n;return t&&(n="undefined"!=typeof e?De.defineLocale(t,e):De.localeData(t),n&&(De.duration._locale=De._locale=n)),De._locale._abbr},De.defineLocale=function(t,e){return null!==e?(e.abbr=t,Ue[t]||(Ue[t]=new c),Ue[t].set(e),De.locale(t),Ue[t]):(delete Ue[t],null)},De.langData=i("moment.langData is deprecated. Use moment.localeData instead.",function(t){return De.localeData(t)}),De.localeData=function(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return De._locale;if(!k(t)){if(e=x(t))return e;t=[t]}return z(t)},De.isMoment=function(t){return t instanceof d||null!=t&&n(t,"_isAMomentObject")},De.isDuration=function(t){return t instanceof l};for(ge=_n.length-1;ge>=0;--ge)b(_n[ge]);De.normalizeUnits=function(t){return w(t)},De.invalid=function(t){var e=De.utc(0/0);return null!=t?h(e._pf,t):e._pf.userInvalidated=!0,e},De.parseZone=function(){return De.apply(null,arguments).parseZone()},De.parseTwoDigitYear=function(t){return S(t)+(S(t)>68?1900:2e3)},h(De.fn=d.prototype,{clone:function(){return De(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var t=De(this).utc();return 0<t.year()&&t.year()<=9999?P(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var t=this;return[t.year(),t.month(),t.date(),t.hours(),t.minutes(),t.seconds(),t.milliseconds()]},isValid:function(){return G(this)},isDSTShifted:function(){return this._a?this.isValid()&&Y(this._a,(this._isUTC?De.utc(this._a):De(this._a)).toArray())>0:!1},parsingFlags:function(){return h({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(t){return this.zone(0,t)},local:function(t){return this._isUTC&&(this.zone(0,t),this._isUTC=!1,t&&this.add(this._dateTzOffset(),"m")),this},format:function(t){var e=P(this,t||De.defaultFormat);return this.localeData().postformat(e)},add:D(1,"add"),subtract:D(-1,"subtract"),diff:function(t,e,n){var a,s,i,r=I(t,this),o=6e4*(this.zone()-r.zone());return e=w(e),"year"===e||"month"===e?(a=432e5*(this.daysInMonth()+r.daysInMonth()),s=12*(this.year()-r.year())+(this.month()-r.month()),i=this-De(this).startOf("month")-(r-De(r).startOf("month")),i-=6e4*(this.zone()-De(this).startOf("month").zone()-(r.zone()-De(r).startOf("month").zone())),s+=i/a,"year"===e&&(s/=12)):(a=this-r,s="second"===e?a/1e3:"minute"===e?a/6e4:"hour"===e?a/36e5:"day"===e?(a-o)/864e5:"week"===e?(a-o)/6048e5:a),n?s:m(s)},from:function(t,e){return De.duration({to:this,from:t}).locale(this.locale()).humanize(!e)},fromNow:function(t){return this.from(De(),t)},calendar:function(t){var e=t||De(),n=I(e,this).startOf("day"),a=this.diff(n,"days",!0),s=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.localeData().calendar(s,this))},isLeapYear:function(){return U(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(t){var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=se(t,this.localeData()),this.add(t-e,"d")):e},month:me("Month",!0),startOf:function(t){switch(t=w(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t?this.weekday(0):"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(t){return t=w(t),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms")},isAfter:function(t,e){return e=w("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=De.isMoment(t)?t:De(t),+this>+t):+this.clone().startOf(e)>+De(t).startOf(e)},isBefore:function(t,e){return e=w("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=De.isMoment(t)?t:De(t),+t>+this):+this.clone().startOf(e)<+De(t).startOf(e)},isSame:function(t,e){return e=w(e||"millisecond"),"millisecond"===e?(t=De.isMoment(t)?t:De(t),+this===+t):+this.clone().startOf(e)===+I(t,this).startOf(e)},min:i("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(t){return t=De.apply(null,arguments),this>t?this:t}),max:i("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(t){return t=De.apply(null,arguments),t>this?this:t}),zone:function(t,e){var n,a=this._offset||0;return null==t?this._isUTC?a:this._dateTzOffset():("string"==typeof t&&(t=Z(t)),Math.abs(t)<16&&(t=60*t),!this._isUTC&&e&&(n=this._dateTzOffset()),this._offset=t,this._isUTC=!0,null!=n&&this.subtract(n,"m"),a!==t&&(!e||this._changeInProgress?g(this,De.duration(a-t,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,De.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this
3},hasAlignedHourOffset:function(t){return t=t?De(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return T(this.year(),this.month())},dayOfYear:function(t){var e=Me((De(this).startOf("day")-De(this).startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},quarter:function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},weekYear:function(t){var e=oe(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==t?e:this.add(t-e,"y")},isoWeekYear:function(t){var e=oe(this,1,4).year;return null==t?e:this.add(t-e,"y")},week:function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},isoWeek:function(t){var e=oe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},weekday:function(t){var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},isoWeeksInYear:function(){return O(this.year(),1,4)},weeksInYear:function(){var t=this.localeData()._week;return O(this.year(),t.dow,t.doy)},get:function(t){return t=w(t),this[t]()},set:function(t,e){return t=w(t),"function"==typeof this[t]&&this[t](e),this},locale:function(e){var n;return e===t?this._locale._abbr:(n=De.localeData(e),null!=n&&(this._locale=n),this)},lang:i("moment().lang() is deprecated. Use moment().localeData() instead.",function(e){return e===t?this.localeData():this.locale(e)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),De.fn.millisecond=De.fn.milliseconds=me("Milliseconds",!1),De.fn.second=De.fn.seconds=me("Seconds",!1),De.fn.minute=De.fn.minutes=me("Minutes",!1),De.fn.hour=De.fn.hours=me("Hours",!0),De.fn.date=me("Date",!0),De.fn.dates=i("dates accessor is deprecated. Use date instead.",me("Date",!0)),De.fn.year=me("FullYear",!0),De.fn.years=i("years accessor is deprecated. Use year instead.",me("FullYear",!0)),De.fn.days=De.fn.day,De.fn.months=De.fn.month,De.fn.weeks=De.fn.week,De.fn.isoWeeks=De.fn.isoWeek,De.fn.quarters=De.fn.quarter,De.fn.toJSON=De.fn.toISOString,h(De.duration.fn=l.prototype,{_bubble:function(){var t,e,n,a=this._milliseconds,s=this._days,i=this._months,r=this._data,o=0;r.milliseconds=a%1e3,t=m(a/1e3),r.seconds=t%60,e=m(t/60),r.minutes=e%60,n=m(e/60),r.hours=n%24,s+=m(n/24),o=m(_e(s)),s-=m(pe(o)),i+=m(s/30),s%=30,o+=m(i/12),i%=12,r.days=s,r.months=i,r.years=o},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return m(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},humanize:function(t){var e=re(this,!t,this.localeData());return t&&(e=this.localeData().pastFuture(+this,e)),this.localeData().postformat(e)},add:function(t,e){var n=De.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=De.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=w(t),this[t.toLowerCase()+"s"]()},as:function(t){var e,n;if(t=w(t),"month"===t||"year"===t)return e=this._days+this._milliseconds/864e5,n=this._months+12*_e(e),"month"===t?n:n/12;switch(e=this._days+pe(this._months/12),t){case"week":return e/7+this._milliseconds/6048e5;case"day":return e+this._milliseconds/864e5;case"hour":return 24*e+this._milliseconds/36e5;case"minute":return 24*e*60+this._milliseconds/6e4;case"second":return 24*e*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*e*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+t)}},lang:De.fn.lang,locale:De.fn.locale,toIsoString:i("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var t=Math.abs(this.years()),e=Math.abs(this.months()),n=Math.abs(this.days()),a=Math.abs(this.hours()),s=Math.abs(this.minutes()),i=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(t?t+"Y":"")+(e?e+"M":"")+(n?n+"D":"")+(a||s||i?"T":"")+(a?a+"H":"")+(s?s+"M":"")+(i?i+"S":""):"P0D"},localeData:function(){return this._locale}}),De.duration.fn.toString=De.duration.fn.toISOString;for(ge in rn)n(rn,ge)&&ye(ge.toLowerCase());return De.duration.fn.asMilliseconds=function(){return this.as("ms")},De.duration.fn.asSeconds=function(){return this.as("s")},De.duration.fn.asMinutes=function(){return this.as("m")},De.duration.fn.asHours=function(){return this.as("h")},De.duration.fn.asDays=function(){return this.as("d")},De.duration.fn.asWeeks=function(){return this.as("weeks")},De.duration.fn.asMonths=function(){return this.as("M")},De.duration.fn.asYears=function(){return this.as("y")},De.locale("en",{ordinal:function(t){var e=t%10,n=1===S(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),De}.call(this),t.Utils.moment=n,t.datepicker}); \ No newline at end of file
diff --git a/js/components/form-password.js b/js/components/form-password.js
new file mode 100755
index 0000000..b0b0e60
--- /dev/null
+++ b/js/components/form-password.js
@@ -0,0 +1,67 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-form-password", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 UI.component('formPassword', {
21
22 defaults: {
23 "lblShow": "Show",
24 "lblHide": "Hide"
25 },
26
27 boot: function() {
28 // init code
29 UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
30
31 var ele = UI.$(this);
32
33 if (!ele.data("formPassword")) {
34
35 e.preventDefault();
36
37 UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
38 ele.trigger("click");
39 }
40 });
41 },
42
43 init: function() {
44
45 var $this = this;
46
47 this.on("click", function(e) {
48
49 e.preventDefault();
50
51 if($this.input.length) {
52 var type = $this.input.attr("type");
53 $this.input.attr("type", type=="text" ? "password":"text");
54 $this.element.html($this.options[type=="text" ? "lblShow":"lblHide"]);
55 }
56 });
57
58 this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
59 this.element.html(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]);
60
61
62 this.element.data("formPassword", this);
63 }
64 });
65
66 return UI.formPassword;
67});
diff --git a/js/components/form-password.min.js b/js/components/form-password.min.js
new file mode 100755
index 0000000..b358994
--- /dev/null
+++ b/js/components/form-password.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-form-password",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";return t.component("formPassword",{defaults:{lblShow:"Show",lblHide:"Hide"},boot:function(){t.$html.on("click.formpassword.uikit","[data-uk-form-password]",function(i){var e=t.$(this);e.data("formPassword")||(i.preventDefault(),t.formPassword(e,t.Utils.options(e.attr("data-uk-form-password"))),e.trigger("click"))})},init:function(){var t=this;this.on("click",function(i){if(i.preventDefault(),t.input.length){var e=t.input.attr("type");t.input.attr("type","text"==e?"password":"text"),t.element.html(t.options["text"==e?"lblShow":"lblHide"])}}),this.input=this.element.next("input").length?this.element.next("input"):this.element.prev("input"),this.element.html(this.options[this.input.is("[type='password']")?"lblShow":"lblHide"]),this.element.data("formPassword",this)}}),t.formPassword}); \ No newline at end of file
diff --git a/js/components/form-select.js b/js/components/form-select.js
new file mode 100755
index 0000000..8f081fb
--- /dev/null
+++ b/js/components/form-select.js
@@ -0,0 +1,77 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-form-select", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 UI.component('formSelect', {
21
22 defaults: {
23 'target': '>span:first',
24 'activeClass': 'uk-active'
25 },
26
27 boot: function() {
28 // init code
29 UI.ready(function(context) {
30
31 UI.$("[data-uk-form-select]", context).each(function(){
32
33 var ele = UI.$(this);
34
35 if (!ele.data("formSelect")) {
36 UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
37 }
38 });
39 });
40 },
41
42 init: function() {
43 var $this = this;
44
45 this.target = this.find(this.options.target);
46 this.select = this.find('select');
47
48 // init + on change event
49 this.select.on("change", (function(){
50
51 var select = $this.select[0], fn = function(){
52
53 try {
54 if($this.options.target === 'input')
55 {
56 $this.target.val(select.options[select.selectedIndex].text);
57 }
58 else
59 {
60 $this.target.text(select.options[select.selectedIndex].text);
61 }
62 } catch(e) {}
63
64 $this.element[$this.select.val() ? 'addClass':'removeClass']($this.options.activeClass);
65
66 return fn;
67 };
68
69 return fn();
70 })());
71
72 this.element.data("formSelect", this);
73 }
74 });
75
76 return UI.formSelect;
77});
diff --git a/js/components/form-select.min.js b/js/components/form-select.min.js
new file mode 100755
index 0000000..ee92f53
--- /dev/null
+++ b/js/components/form-select.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-form-select",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";return t.component("formSelect",{defaults:{target:">span:first",activeClass:"uk-active"},boot:function(){t.ready(function(e){t.$("[data-uk-form-select]",e).each(function(){var e=t.$(this);e.data("formSelect")||t.formSelect(e,t.Utils.options(e.attr("data-uk-form-select")))})})},init:function(){var t=this;this.target=this.find(this.options.target),this.select=this.find("select"),this.select.on("change",function(){var e=t.select[0],i=function(){try{"input"===t.options.target?t.target.val(e.options[e.selectedIndex].text):t.target.text(e.options[e.selectedIndex].text)}catch(n){}return t.element[t.select.val()?"addClass":"removeClass"](t.options.activeClass),i};return i()}()),this.element.data("formSelect",this)}}),t.formSelect}); \ No newline at end of file
diff --git a/js/components/grid-parallax.js b/js/components/grid-parallax.js
new file mode 100755
index 0000000..45b7a9e
--- /dev/null
+++ b/js/components/grid-parallax.js
@@ -0,0 +1,168 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-grid-parallax", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 var parallaxes = [], checkParallaxes = function() {
19
20 requestAnimationFrame(function(){
21 for (var i=0; i < parallaxes.length; i++) {
22 parallaxes[i].process();
23 }
24 });
25 };
26
27
28 UI.component('gridparallax', {
29
30 defaults: {
31 target : false,
32 smooth : 150,
33 translate : 150
34 },
35
36 boot: function() {
37
38 // listen to scroll and resize
39 UI.$doc.on("scrolling.uk.document", checkParallaxes);
40 UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
41 checkParallaxes();
42 }, 50));
43
44 // init code
45 UI.ready(function(context) {
46
47 UI.$('[data-uk-grid-parallax]', context).each(function() {
48
49 var parallax = UI.$(this);
50
51 if (!parallax.data("gridparallax")) {
52 UI.gridparallax(parallax, UI.Utils.options(parallax.attr("data-uk-grid-parallax")));
53 }
54 });
55 });
56 },
57
58 init: function() {
59
60 var $this = this;
61
62 this.initItems().process();
63 parallaxes.push(this);
64
65 UI.$win.on('load resize orientationchange', (function() {
66
67 var fn = function() {
68 var columns = getcolumns($this.element);
69
70 $this.element.css('margin-bottom', '');
71
72 if (columns > 1) {
73 $this.element.css('margin-bottom', $this.options.translate + parseInt($this.element.css('margin-bottom')));
74 }
75 };
76
77 UI.$(function() { fn(); });
78
79 return UI.Utils.debounce(fn, 50);
80 })());
81 },
82
83 initItems: function() {
84
85 var smooth = this.options.smooth;
86
87 this.items = (this.options.target ? this.element.find(this.options.target) : this.element.children()).each(function(){
88 UI.$(this).css({
89 transition: 'transform '+smooth+'ms linear',
90 transform: ''
91 });
92 });
93
94 return this;
95 },
96
97 process: function() {
98
99 var percent = percentageInViewport(this.element),
100 columns = getcolumns(this.element),
101 items = this.items,
102 mods = [(columns-1)];
103
104 if (columns == 1 || !percent) {
105 items.css('transform', '');
106 return;
107 }
108
109 while(mods.length < columns) {
110 if(!(mods[mods.length-1] - 2)) break;
111 mods.push(mods[mods.length-1] - 2);
112 }
113
114 var translate = this.options.translate, percenttranslate = percent * translate;
115
116 items.each(function(idx, ele, translate){
117 translate = mods.indexOf((idx+1) % columns) != -1 ? percenttranslate : percenttranslate / 8;
118 UI.$(this).css('transform', 'translate3d(0,'+(translate)+'px, 0)');
119 });
120 }
121
122 });
123
124
125 function getcolumns(element) {
126
127 var children = element.children(),
128 first = children.filter(':visible:first'),
129 top = first[0].offsetTop + first.outerHeight();
130
131 for (var column=0;column<children.length;column++) {
132 if (children[column].offsetTop >= top) break;
133 }
134
135 return column || 1;
136 }
137
138 function percentageInViewport(element) {
139
140 var top = element.offset().top,
141 height = element.outerHeight(),
142 scrolltop = UIkit.$win.scrollTop(),
143 wh = window.innerHeight,
144 distance, percentage, percent;
145
146 if (top > (scrolltop + wh)) {
147 percent = 0;
148 } else if ((top + height) < scrolltop) {
149 percent = 1;
150 } else {
151
152 if ((top + height) < wh) {
153 percent = (scrolltop < wh ? scrolltop : scrolltop - wh) / (top+height);
154 } else {
155
156 distance = (scrolltop + wh) - top;
157 percentage = Math.round(distance / ((wh + height) / 100));
158 percent = percentage/100;
159 }
160
161 if (top < wh) {
162 percent = percent * scrolltop / ((top + height) - wh);
163 }
164 }
165
166 return percent > 1 ? 1:percent;
167 }
168}); \ No newline at end of file
diff --git a/js/components/grid-parallax.min.js b/js/components/grid-parallax.min.js
new file mode 100755
index 0000000..fddc517
--- /dev/null
+++ b/js/components/grid-parallax.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var n;window.UIkit&&(n=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-grid-parallax",["uikit"],function(){return n||t(UIkit)})}(function(t){function n(t){for(var n=t.children(),i=n.filter(":visible:first"),e=i[0].offsetTop+i.outerHeight(),o=0;o<n.length&&!(n[o].offsetTop>=e);o++);return o||1}function i(t){var n,i,e,o=t.offset().top,r=t.outerHeight(),s=UIkit.$win.scrollTop(),a=window.innerHeight;return o>s+a?e=0:s>o+r?e=1:(a>o+r?e=(a>s?s:s-a)/(o+r):(n=s+a-o,i=Math.round(n/((a+r)/100)),e=i/100),a>o&&(e=e*s/(o+r-a))),e>1?1:e}var e=[],o=function(){requestAnimationFrame(function(){for(var t=0;t<e.length;t++)e[t].process()})};t.component("gridparallax",{defaults:{target:!1,smooth:150,translate:150},boot:function(){t.$doc.on("scrolling.uk.document",o),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){o()},50)),t.ready(function(n){t.$("[data-uk-grid-parallax]",n).each(function(){var n=t.$(this);n.data("gridparallax")||t.gridparallax(n,t.Utils.options(n.attr("data-uk-grid-parallax")))})})},init:function(){var i=this;this.initItems().process(),e.push(this),t.$win.on("load resize orientationchange",function(){var e=function(){var t=n(i.element);i.element.css("margin-bottom",""),t>1&&i.element.css("margin-bottom",i.options.translate+parseInt(i.element.css("margin-bottom")))};return t.$(function(){e()}),t.Utils.debounce(e,50)}())},initItems:function(){var n=this.options.smooth;return this.items=(this.options.target?this.element.find(this.options.target):this.element.children()).each(function(){t.$(this).css({transition:"transform "+n+"ms linear",transform:""})}),this},process:function(){var e=i(this.element),o=n(this.element),r=this.items,s=[o-1];if(1==o||!e)return r.css("transform",""),void 0;for(;s.length<o&&s[s.length-1]-2;)s.push(s[s.length-1]-2);var a=this.options.translate,l=e*a;r.each(function(n,i,e){e=-1!=s.indexOf((n+1)%o)?l:l/8,t.$(this).css("transform","translate3d(0,"+e+"px, 0)")})}})}); \ No newline at end of file
diff --git a/js/components/grid.js b/js/components/grid.js
new file mode 100755
index 0000000..87d4919
--- /dev/null
+++ b/js/components/grid.js
@@ -0,0 +1,527 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-grid", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 UI.component('grid', {
21
22 defaults: {
23 colwidth : 'auto',
24 animation : true,
25 duration : 300,
26 gutter : 0,
27 controls : false,
28 filter : false
29 },
30
31 boot: function() {
32
33 // init code
34 UI.ready(function(context) {
35
36 UI.$('[data-uk-grid]', context).each(function(){
37
38 var ele = UI.$(this);
39
40 if(!ele.data("grid")) {
41 UI.grid(ele, UI.Utils.options(ele.attr('data-uk-grid')));
42 }
43 });
44 });
45 },
46
47 init: function() {
48
49 var $this = this, gutter = String(this.options.gutter).trim().split(' ');
50
51 this.gutterv = parseInt(gutter[0], 10);
52 this.gutterh = parseInt((gutter[1] || gutter[0]), 10);
53
54 // make sure parent element has the right position property
55 this.element.css({'position': 'relative'});
56
57 this.controls = null;
58
59 if (this.options.controls) {
60
61 this.controls = UI.$(this.options.controls);
62
63 // filter
64 this.controls.on('click', '[data-uk-filter]', function(e){
65 e.preventDefault();
66 $this.filter(UI.$(this).attr('data-uk-filter'));
67 });
68
69 // sort
70 this.controls.on('click', '[data-uk-sort]', function(e){
71 e.preventDefault();
72 var cmd = UI.$(this).attr('data-uk-sort').split(':');
73 $this.sort(cmd[0], cmd[1]);
74 });
75 }
76
77 UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
78
79 if ($this.currentfilter) {
80 $this.filter($this.currentfilter);
81 } else {
82 this.updateLayout();
83 }
84
85 }.bind(this), 100));
86
87 this.on('display.uk.check', function(){
88 if ($this.element.is(":visible")) $this.updateLayout();
89 });
90
91 UI.domObserve(this.element, function(e) {
92 $this.updateLayout();
93 });
94
95 if (this.options.filter !== false) {
96 this.filter(this.options.filter);
97 } else {
98 this.updateLayout();
99 }
100 },
101
102 _prepareElements: function() {
103
104 var children = this.element.children(':not([data-grid-prepared])'), css;
105
106 // exit if no already prepared elements found
107 if (!children.length) {
108 return;
109 }
110
111 css = {
112 'position' : 'absolute',
113 'box-sizing' : 'border-box',
114 'width' : this.options.colwidth == 'auto' ? '' : this.options.colwidth
115 };
116
117 if (this.options.gutter) {
118
119 css['padding-left'] = this.gutterh;
120 css['padding-bottom'] = this.gutterv;
121
122 this.element.css('margin-left', this.gutterh * -1);
123 }
124
125 children.attr('data-grid-prepared', 'true').css(css);
126 },
127
128 updateLayout: function(elements) {
129
130 this._prepareElements();
131
132 elements = elements || this.element.children(':visible');
133
134 var children = elements,
135 maxwidth = this.element.width() + (2*this.gutterh) + 2,
136 left = 0,
137 top = 0,
138 positions = [],
139
140 item, width, height, pos, i, z, max, size;
141
142 this.trigger('beforeupdate.uk.grid', [children]);
143
144 children.each(function(index){
145
146 size = getElementSize(this);
147
148 item = UI.$(this);
149 width = size.outerWidth;
150 height = size.outerHeight;
151 left = 0;
152 top = 0;
153
154 for (i=0,max=positions.length;i<max;i++) {
155
156 pos = positions[i];
157
158 if (left <= pos.aX) { left = pos.aX; }
159 if (maxwidth < (left + width)) { left = 0; }
160 if (top <= pos.aY) { top = pos.aY; }
161 }
162
163 positions.push({
164 "ele" : item,
165 "top" : top,
166 "left" : left,
167 "width" : width,
168 "height" : height,
169 "aY" : (top + height),
170 "aX" : (left + width)
171 });
172 });
173
174 var posPrev, maxHeight = 0;
175
176 // fix top
177 for (i=0,max=positions.length;i<max;i++) {
178
179 pos = positions[i];
180 top = 0;
181
182 for (z=0;z<i;z++) {
183
184 posPrev = positions[z];
185
186 // (posPrev.left + 1) fixex 1px bug when using % based widths
187 if (pos.left < posPrev.aX && (posPrev.left +1) < pos.aX) {
188 top = posPrev.aY;
189 }
190 }
191
192 pos.top = top;
193 pos.aY = top + pos.height;
194
195 maxHeight = Math.max(maxHeight, pos.aY);
196 }
197
198 maxHeight = maxHeight - this.gutterv;
199
200 if (this.options.animation) {
201
202 this.element.stop().animate({'height': maxHeight}, 100);
203
204 positions.forEach(function(pos){
205 pos.ele.stop().animate({"top": pos.top, "left": pos.left, opacity: 1}, this.options.duration);
206 }.bind(this));
207
208 } else {
209
210 this.element.css('height', maxHeight);
211
212 positions.forEach(function(pos){
213 pos.ele.css({"top": pos.top, "left": pos.left, opacity: 1});
214 }.bind(this));
215 }
216
217 // make sure to trigger possible scrollpies etc.
218 setTimeout(function() {
219 UI.$doc.trigger('scrolling.uk.document');
220 }, 2 * this.options.duration * (this.options.animation ? 1:0));
221
222 this.trigger('afterupdate.uk.grid', [children]);
223 },
224
225 filter: function(filter) {
226
227 this.currentfilter = filter;
228
229 filter = filter || [];
230
231 if (typeof(filter) === 'number') {
232 filter = filter.toString();
233 }
234
235 if (typeof(filter) === 'string') {
236 filter = filter.split(/,/).map(function(item){ return item.trim(); });
237 }
238
239 var $this = this, children = this.element.children(), elements = {"visible": [], "hidden": []}, visible, hidden;
240
241 children.each(function(index){
242
243 var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
244
245 if (f) {
246
247 f = f.split(/,/).map(function(item){ return item.trim(); });
248
249 filter.forEach(function(item){
250 if (f.indexOf(item) > -1) infilter = true;
251 });
252 }
253
254 elements[infilter ? "visible":"hidden"].push(ele);
255 });
256
257 // convert to jQuery collections
258 elements.hidden = UI.$(elements.hidden).map(function () {return this[0];});
259 elements.visible = UI.$(elements.visible).map(function () {return this[0];});
260
261 elements.hidden.attr('aria-hidden', 'true').filter(':visible').fadeOut(this.options.duration);
262 elements.visible.attr('aria-hidden', 'false').filter(':hidden').css('opacity', 0).show();
263
264 $this.updateLayout(elements.visible);
265
266 if (this.controls && this.controls.length) {
267 this.controls.find('[data-uk-filter]').removeClass('uk-active').filter('[data-uk-filter="'+filter+'"]').addClass('uk-active');
268 }
269 },
270
271 sort: function(by, order){
272
273 order = order || 1;
274
275 // covert from string (asc|desc) to number
276 if (typeof(order) === 'string') {
277 order = order.toLowerCase() == 'desc' ? -1 : 1;
278 }
279
280 var elements = this.element.children();
281
282 elements.sort(function(a, b){
283
284 a = UI.$(a);
285 b = UI.$(b);
286
287 return (b.data(by) || '') < (a.data(by) || '') ? order : (order*-1);
288
289 }).appendTo(this.element);
290
291 this.updateLayout(elements.filter(':visible'));
292
293 if (this.controls && this.controls.length) {
294 this.controls.find('[data-uk-sort]').removeClass('uk-active').filter('[data-uk-sort="'+by+':'+(order == -1 ? 'desc':'asc')+'"]').addClass('uk-active');
295 }
296 }
297 });
298
299
300 /*!
301 * getSize v1.2.2
302 * measure size of elements
303 * MIT license
304 * https://github.com/desandro/get-size
305 */
306 function _getSize() {
307
308 var prefixes = 'Webkit Moz ms Ms O'.split(' ');
309 var docElemStyle = document.documentElement.style;
310
311 function getStyleProperty( propName ) {
312 if ( !propName ) {
313 return;
314 }
315
316 // test standard property first
317 if ( typeof docElemStyle[ propName ] === 'string' ) {
318 return propName;
319 }
320
321 // capitalize
322 propName = propName.charAt(0).toUpperCase() + propName.slice(1);
323
324 // test vendor specific properties
325 var prefixed;
326 for ( var i=0, len = prefixes.length; i < len; i++ ) {
327 prefixed = prefixes[i] + propName;
328 if ( typeof docElemStyle[ prefixed ] === 'string' ) {
329 return prefixed;
330 }
331 }
332 }
333
334 // -------------------------- helpers -------------------------- //
335
336 // get a number from a string, not a percentage
337 function getStyleSize( value ) {
338 var num = parseFloat( value );
339 // not a percent like '100%', and a number
340 var isValid = value.indexOf('%') === -1 && !isNaN( num );
341 return isValid && num;
342 }
343
344 function noop() {}
345
346 var logError = typeof console === 'undefined' ? noop : function( message ) {
347 console.error( message );
348 };
349
350 // -------------------------- measurements -------------------------- //
351
352 var measurements = [
353 'paddingLeft',
354 'paddingRight',
355 'paddingTop',
356 'paddingBottom',
357 'marginLeft',
358 'marginRight',
359 'marginTop',
360 'marginBottom',
361 'borderLeftWidth',
362 'borderRightWidth',
363 'borderTopWidth',
364 'borderBottomWidth'
365 ];
366
367 function getZeroSize() {
368 var size = {
369 width: 0,
370 height: 0,
371 innerWidth: 0,
372 innerHeight: 0,
373 outerWidth: 0,
374 outerHeight: 0
375 };
376 for ( var i=0, len = measurements.length; i < len; i++ ) {
377 var measurement = measurements[i];
378 size[ measurement ] = 0;
379 }
380 return size;
381 }
382
383
384 // -------------------------- setup -------------------------- //
385
386 var isSetup = false;
387 var getStyle, boxSizingProp, isBoxSizeOuter;
388
389 /**
390 * setup vars and functions
391 * do it on initial getSize(), rather than on script load
392 * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397
393 */
394 function setup() {
395 // setup once
396 if ( isSetup ) {
397 return;
398 }
399 isSetup = true;
400
401 var getComputedStyle = window.getComputedStyle;
402 getStyle = ( function() {
403 var getStyleFn = getComputedStyle ?
404 function( elem ) {
405 return getComputedStyle( elem, null );
406 } :
407 function( elem ) {
408 return elem.currentStyle;
409 };
410
411 return function getStyle( elem ) {
412 var style = getStyleFn( elem );
413 if ( !style ) {
414 logError( 'Style returned ' + style +
415 '. Are you running this code in a hidden iframe on Firefox? ' +
416 'See http://bit.ly/getsizebug1' );
417 }
418 return style;
419 };
420 })();
421
422 // -------------------------- box sizing -------------------------- //
423
424 boxSizingProp = getStyleProperty('boxSizing');
425
426 /**
427 * WebKit measures the outer-width on style.width on border-box elems
428 * IE & Firefox measures the inner-width
429 */
430 if ( boxSizingProp ) {
431 var div = document.createElement('div');
432 div.style.width = '200px';
433 div.style.padding = '1px 2px 3px 4px';
434 div.style.borderStyle = 'solid';
435 div.style.borderWidth = '1px 2px 3px 4px';
436 div.style[ boxSizingProp ] = 'border-box';
437
438 var body = document.body || document.documentElement;
439 body.appendChild( div );
440 var style = getStyle( div );
441
442 isBoxSizeOuter = getStyleSize( style.width ) === 200;
443 body.removeChild( div );
444 }
445
446 }
447
448 // -------------------------- getSize -------------------------- //
449
450 function getSize( elem ) {
451 setup();
452
453 // use querySeletor if elem is string
454 if ( typeof elem === 'string' ) {
455 elem = document.querySelector( elem );
456 }
457
458 // do not proceed on non-objects
459 if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
460 return;
461 }
462
463 var style = getStyle( elem );
464
465 // if hidden, everything is 0
466 if ( style.display === 'none' ) {
467 return getZeroSize();
468 }
469
470 var size = {};
471 size.width = elem.offsetWidth;
472 size.height = elem.offsetHeight;
473
474 var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
475 style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
476
477 // get all measurements
478 for ( var i=0, len = measurements.length; i < len; i++ ) {
479 var measurement = measurements[i];
480 var value = style[ measurement ];
481
482 var num = parseFloat( value );
483 // any 'auto', 'medium' value will be 0
484 size[ measurement ] = !isNaN( num ) ? num : 0;
485 }
486
487 var paddingWidth = size.paddingLeft + size.paddingRight;
488 var paddingHeight = size.paddingTop + size.paddingBottom;
489 var marginWidth = size.marginLeft + size.marginRight;
490 var marginHeight = size.marginTop + size.marginBottom;
491 var borderWidth = size.borderLeftWidth + size.borderRightWidth;
492 var borderHeight = size.borderTopWidth + size.borderBottomWidth;
493
494 var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
495
496 // overwrite width and height if we can get it from style
497 var styleWidth = getStyleSize( style.width );
498 if ( styleWidth !== false ) {
499 size.width = styleWidth +
500 // add padding and border unless it's already including it
501 ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
502 }
503
504 var styleHeight = getStyleSize( style.height );
505 if ( styleHeight !== false ) {
506 size.height = styleHeight +
507 // add padding and border unless it's already including it
508 ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
509 }
510
511 size.innerWidth = size.width - ( paddingWidth + borderWidth );
512 size.innerHeight = size.height - ( paddingHeight + borderHeight );
513
514 size.outerWidth = size.width + marginWidth;
515 size.outerHeight = size.height + marginHeight;
516
517 return size;
518 }
519
520 return getSize;
521
522 }
523
524 function getElementSize(ele) {
525 return _getSize()(ele);
526 }
527});
diff --git a/js/components/grid.min.js b/js/components/grid.min.js
new file mode 100755
index 0000000..3eeedfe
--- /dev/null
+++ b/js/components/grid.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-grid",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(){function t(t){if(t){if("string"==typeof u[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var i,e=0,n=h.length;n>e;e++)if(i=h[e]+t,"string"==typeof u[i])return i}}function i(t){var i=parseFloat(t),e=-1===t.indexOf("%")&&!isNaN(i);return e&&i}function e(){}function n(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0,e=f.length;e>i;i++){var n=f[i];t[n]=0}return t}function r(){if(!c){c=!0;var e=window.getComputedStyle;if(a=function(){var t=e?function(t){return e(t,null)}:function(t){return t.currentStyle};return function(i){var e=t(i);return e||l("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}}(),s=t("boxSizing")){var n=document.createElement("div");n.style.width="200px",n.style.padding="1px 2px 3px 4px",n.style.borderStyle="solid",n.style.borderWidth="1px 2px 3px 4px",n.style[s]="border-box";var r=document.body||document.documentElement;r.appendChild(n);var o=a(n);d=200===i(o.width),r.removeChild(n)}}}function o(t){if(r(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=a(t);if("none"===e.display)return n();var o={};o.width=t.offsetWidth,o.height=t.offsetHeight;for(var h=o.isBorderBox=!(!s||!e[s]||"border-box"!==e[s]),u=0,l=f.length;l>u;u++){var c=f[u],p=e[c],g=parseFloat(p);o[c]=isNaN(g)?0:g}var m=o.paddingLeft+o.paddingRight,v=o.paddingTop+o.paddingBottom,b=o.marginLeft+o.marginRight,y=o.marginTop+o.marginBottom,k=o.borderLeftWidth+o.borderRightWidth,w=o.borderTopWidth+o.borderBottomWidth,x=h&&d,W=i(e.width);W!==!1&&(o.width=W+(x?0:m+k));var L=i(e.height);return L!==!1&&(o.height=L+(x?0:v+w)),o.innerWidth=o.width-(m+k),o.innerHeight=o.height-(v+w),o.outerWidth=o.width+b,o.outerHeight=o.height+y,o}}var a,s,d,h="Webkit Moz ms Ms O".split(" "),u=document.documentElement.style,l="undefined"==typeof console?e:function(t){console.error(t)},f=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],c=!1;return o}function e(t){return i()(t)}t.component("grid",{defaults:{colwidth:"auto",animation:!0,duration:300,gutter:0,controls:!1,filter:!1},boot:function(){t.ready(function(i){t.$("[data-uk-grid]",i).each(function(){var i=t.$(this);i.data("grid")||t.grid(i,t.Utils.options(i.attr("data-uk-grid")))})})},init:function(){var i=this,e=String(this.options.gutter).trim().split(" ");this.gutterv=parseInt(e[0],10),this.gutterh=parseInt(e[1]||e[0],10),this.element.css({position:"relative"}),this.controls=null,this.options.controls&&(this.controls=t.$(this.options.controls),this.controls.on("click","[data-uk-filter]",function(e){e.preventDefault(),i.filter(t.$(this).attr("data-uk-filter"))}),this.controls.on("click","[data-uk-sort]",function(e){e.preventDefault();var n=t.$(this).attr("data-uk-sort").split(":");i.sort(n[0],n[1])})),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){i.currentfilter?i.filter(i.currentfilter):this.updateLayout()}.bind(this),100)),this.on("display.uk.check",function(){i.element.is(":visible")&&i.updateLayout()}),t.domObserve(this.element,function(){i.updateLayout()}),this.options.filter!==!1?this.filter(this.options.filter):this.updateLayout()},_prepareElements:function(){var t,i=this.element.children(":not([data-grid-prepared])");i.length&&(t={position:"absolute","box-sizing":"border-box",width:"auto"==this.options.colwidth?"":this.options.colwidth},this.options.gutter&&(t["padding-left"]=this.gutterh,t["padding-bottom"]=this.gutterv,this.element.css("margin-left",-1*this.gutterh)),i.attr("data-grid-prepared","true").css(t))},updateLayout:function(i){this._prepareElements(),i=i||this.element.children(":visible");var n,r,o,a,s,d,h,u,l=i,f=this.element.width()+2*this.gutterh+2,c=0,p=0,g=[];this.trigger("beforeupdate.uk.grid",[l]),l.each(function(){for(u=e(this),n=t.$(this),r=u.outerWidth,o=u.outerHeight,c=0,p=0,s=0,h=g.length;h>s;s++)a=g[s],c<=a.aX&&(c=a.aX),c+r>f&&(c=0),p<=a.aY&&(p=a.aY);g.push({ele:n,top:p,left:c,width:r,height:o,aY:p+o,aX:c+r})});var m,v=0;for(s=0,h=g.length;h>s;s++){for(a=g[s],p=0,d=0;s>d;d++)m=g[d],a.left<m.aX&&m.left+1<a.aX&&(p=m.aY);a.top=p,a.aY=p+a.height,v=Math.max(v,a.aY)}v-=this.gutterv,this.options.animation?(this.element.stop().animate({height:v},100),g.forEach(function(t){t.ele.stop().animate({top:t.top,left:t.left,opacity:1},this.options.duration)}.bind(this))):(this.element.css("height",v),g.forEach(function(t){t.ele.css({top:t.top,left:t.left,opacity:1})}.bind(this))),setTimeout(function(){t.$doc.trigger("scrolling.uk.document")},2*this.options.duration*(this.options.animation?1:0)),this.trigger("afterupdate.uk.grid",[l])},filter:function(i){this.currentfilter=i,i=i||[],"number"==typeof i&&(i=i.toString()),"string"==typeof i&&(i=i.split(/,/).map(function(t){return t.trim()}));var e=this,n=this.element.children(),r={visible:[],hidden:[]};n.each(function(){var e=t.$(this),n=e.attr("data-uk-filter"),o=i.length?!1:!0;n&&(n=n.split(/,/).map(function(t){return t.trim()}),i.forEach(function(t){n.indexOf(t)>-1&&(o=!0)})),r[o?"visible":"hidden"].push(e)}),r.hidden=t.$(r.hidden).map(function(){return this[0]}),r.visible=t.$(r.visible).map(function(){return this[0]}),r.hidden.attr("aria-hidden","true").filter(":visible").fadeOut(this.options.duration),r.visible.attr("aria-hidden","false").filter(":hidden").css("opacity",0).show(),e.updateLayout(r.visible),this.controls&&this.controls.length&&this.controls.find("[data-uk-filter]").removeClass("uk-active").filter('[data-uk-filter="'+i+'"]').addClass("uk-active")},sort:function(i,e){e=e||1,"string"==typeof e&&(e="desc"==e.toLowerCase()?-1:1);var n=this.element.children();n.sort(function(n,r){return n=t.$(n),r=t.$(r),(r.data(i)||"")<(n.data(i)||"")?e:-1*e}).appendTo(this.element),this.updateLayout(n.filter(":visible")),this.controls&&this.controls.length&&this.controls.find("[data-uk-sort]").removeClass("uk-active").filter('[data-uk-sort="'+i+":"+(-1==e?"desc":"asc")+'"]').addClass("uk-active")}})}); \ No newline at end of file
diff --git a/js/components/htmleditor.js b/js/components/htmleditor.js
new file mode 100755
index 0000000..68b5b52
--- /dev/null
+++ b/js/components/htmleditor.js
@@ -0,0 +1,679 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-htmleditor", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI) {
17
18 "use strict";
19
20 var editors = [];
21
22 UI.component('htmleditor', {
23
24 defaults: {
25 iframe : false,
26 mode : 'split',
27 markdown : false,
28 autocomplete : true,
29 enablescripts: false,
30 height : 500,
31 maxsplitsize : 1000,
32 codemirror : { mode: 'htmlmixed', lineWrapping: true, dragDrop: false, autoCloseTags: true, matchTags: true, autoCloseBrackets: true, matchBrackets: true, indentUnit: 4, indentWithTabs: false, tabSize: 4, hintOptions: {completionSingle:false} },
33 toolbar : [ 'bold', 'italic', 'strike', 'link', 'image', 'blockquote', 'listUl', 'listOl' ],
34 lblPreview : 'Preview',
35 lblCodeview : 'HTML',
36 lblMarkedview: 'Markdown'
37 },
38
39 boot: function() {
40
41 // init code
42 UI.ready(function(context) {
43
44 UI.$('textarea[data-uk-htmleditor]', context).each(function() {
45
46 var editor = UI.$(this);
47
48 if (!editor.data('htmleditor')) {
49 UI.htmleditor(editor, UI.Utils.options(editor.attr('data-uk-htmleditor')));
50 }
51 });
52 });
53 },
54
55 init: function() {
56
57 var $this = this, tpl = UI.components.htmleditor.template;
58
59 this.CodeMirror = this.options.CodeMirror || CodeMirror;
60 this.buttons = {};
61
62 tpl = tpl.replace(/\{:lblPreview}/g, this.options.lblPreview);
63 tpl = tpl.replace(/\{:lblCodeview}/g, this.options.lblCodeview);
64
65 this.htmleditor = UI.$(tpl);
66 this.content = this.htmleditor.find('.uk-htmleditor-content');
67 this.toolbar = this.htmleditor.find('.uk-htmleditor-toolbar');
68 this.preview = this.htmleditor.find('.uk-htmleditor-preview').children().eq(0);
69 this.code = this.htmleditor.find('.uk-htmleditor-code');
70
71 this.element.before(this.htmleditor).appendTo(this.code);
72 this.editor = this.CodeMirror.fromTextArea(this.element[0], this.options.codemirror);
73 this.editor.htmleditor = this;
74 this.editor.on('change', UI.Utils.debounce(function() { $this.render(); }, 150));
75 this.editor.on('change', function() {
76 $this.editor.save();
77 $this.element.trigger('input');
78 });
79 this.code.find('.CodeMirror').css('height', this.options.height);
80
81 // iframe mode?
82 if (this.options.iframe) {
83
84 this.iframe = UI.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>');
85 this.preview.append(this.iframe);
86
87 // must open and close document object to start using it!
88 this.iframe[0].contentWindow.document.open();
89 this.iframe[0].contentWindow.document.close();
90
91 this.preview.container = UI.$(this.iframe[0].contentWindow.document).find('body');
92
93 // append custom stylesheet
94 if (typeof(this.options.iframe) === 'string') {
95 this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">');
96 }
97
98 } else {
99 this.preview.container = this.preview;
100 }
101
102 UI.$win.on('resize load', UI.Utils.debounce(function() { $this.fit(); }, 200));
103
104 var previewContainer = this.iframe ? this.preview.container:$this.preview.parent(),
105 codeContent = this.code.find('.CodeMirror-sizer'),
106 codeScroll = this.code.find('.CodeMirror-scroll').on('scroll', UI.Utils.debounce(function() {
107
108 if ($this.htmleditor.attr('data-mode') == 'tab') return;
109
110 // calc position
111 var codeHeight = codeContent.height() - codeScroll.height(),
112 previewHeight = previewContainer[0].scrollHeight - ($this.iframe ? $this.iframe.height() : previewContainer.height()),
113 ratio = previewHeight / codeHeight,
114 previewPosition = codeScroll.scrollTop() * ratio;
115
116 // apply new scroll
117 previewContainer.scrollTop(previewPosition);
118
119 }, 10));
120
121 this.htmleditor.on('click', '.uk-htmleditor-button-code, .uk-htmleditor-button-preview', function(e) {
122
123 e.preventDefault();
124
125 if ($this.htmleditor.attr('data-mode') == 'tab') {
126
127 $this.htmleditor.find('.uk-htmleditor-button-code, .uk-htmleditor-button-preview').removeClass('uk-active').filter(this).addClass('uk-active');
128
129 $this.activetab = UI.$(this).hasClass('uk-htmleditor-button-code') ? 'code' : 'preview';
130 $this.htmleditor.attr('data-active-tab', $this.activetab);
131 $this.editor.refresh();
132 }
133 });
134
135 // toolbar actions
136 this.htmleditor.on('click', 'a[data-htmleditor-button]', function() {
137
138 if (!$this.code.is(':visible')) return;
139
140 $this.trigger('action.' + UI.$(this).data('htmleditor-button'), [$this.editor]);
141 });
142
143 this.preview.parent().css('height', this.code.height());
144
145 // autocomplete
146 if (this.options.autocomplete && this.CodeMirror.showHint && this.CodeMirror.hint && this.CodeMirror.hint.html) {
147
148 this.editor.on('inputRead', UI.Utils.debounce(function() {
149 var doc = $this.editor.getDoc(), POS = doc.getCursor(), mode = $this.CodeMirror.innerMode($this.editor.getMode(), $this.editor.getTokenAt(POS).state).mode.name;
150
151 if (mode == 'xml') { //html depends on xml
152
153 var cur = $this.editor.getCursor(), token = $this.editor.getTokenAt(cur);
154
155 if (token.string.charAt(0) == '<' || token.type == 'attribute') {
156 $this.CodeMirror.showHint($this.editor, $this.CodeMirror.hint.html, { completeSingle: false });
157 }
158 }
159 }, 100));
160 }
161
162 this.debouncedRedraw = UI.Utils.debounce(function () { $this.redraw(); }, 5);
163
164 this.on('init.uk.component', function() {
165 $this.debouncedRedraw();
166 });
167
168 this.element.attr('data-uk-check-display', 1).on('display.uk.check', function(e) {
169 if (this.htmleditor.is(":visible")) this.fit();
170 }.bind(this));
171
172 editors.push(this);
173 },
174
175 addButton: function(name, button) {
176 this.buttons[name] = button;
177 },
178
179 addButtons: function(buttons) {
180 UI.$.extend(this.buttons, buttons);
181 },
182
183 replaceInPreview: function(regexp, callback) {
184
185 var editor = this.editor, results = [], value = editor.getValue(), offset = -1, index = 0;
186
187 this.currentvalue = this.currentvalue.replace(regexp, function() {
188
189 offset = value.indexOf(arguments[0], ++offset);
190
191 var match = {
192 matches: arguments,
193 from : translateOffset(offset),
194 to : translateOffset(offset + arguments[0].length),
195 replace: function(value) {
196 editor.replaceRange(value, match.from, match.to);
197 },
198 inRange: function(cursor) {
199
200 if (cursor.line === match.from.line && cursor.line === match.to.line) {
201 return cursor.ch >= match.from.ch && cursor.ch < match.to.ch;
202 }
203
204 return (cursor.line === match.from.line && cursor.ch >= match.from.ch) ||
205 (cursor.line > match.from.line && cursor.line < match.to.line) ||
206 (cursor.line === match.to.line && cursor.ch < match.to.ch);
207 }
208 };
209
210 var result = typeof(callback) === 'string' ? callback : callback(match, index);
211
212 if (!result && result !== '') {
213 return arguments[0];
214 }
215
216 index++;
217
218 results.push(match);
219 return result;
220 });
221
222 function translateOffset(offset) {
223 var result = editor.getValue().substring(0, offset).split('\n');
224 return { line: result.length - 1, ch: result[result.length - 1].length }
225 }
226
227 return results;
228 },
229
230 _buildtoolbar: function() {
231
232 if (!(this.options.toolbar && this.options.toolbar.length)) return;
233
234 var $this = this, bar = [];
235
236 this.toolbar.empty();
237
238 this.options.toolbar.forEach(function(button) {
239 if (!$this.buttons[button]) return;
240
241 var title = $this.buttons[button].title ? $this.buttons[button].title : button;
242
243 bar.push('<li><a data-htmleditor-button="'+button+'" title="'+title+'" data-uk-tooltip>'+$this.buttons[button].label+'</a></li>');
244 });
245
246 this.toolbar.html(bar.join('\n'));
247 },
248
249 fit: function() {
250
251 var mode = this.options.mode;
252
253 if (mode == 'split' && this.htmleditor.width() < this.options.maxsplitsize) {
254 mode = 'tab';
255 }
256
257 if (mode == 'tab') {
258 if (!this.activetab) {
259 this.activetab = 'code';
260 this.htmleditor.attr('data-active-tab', this.activetab);
261 }
262
263 this.htmleditor.find('.uk-htmleditor-button-code, .uk-htmleditor-button-preview').removeClass('uk-active')
264 .filter(this.activetab == 'code' ? '.uk-htmleditor-button-code' : '.uk-htmleditor-button-preview')
265 .addClass('uk-active');
266 }
267
268 this.editor.refresh();
269 this.preview.parent().css('height', this.code.height());
270
271 this.htmleditor.attr('data-mode', mode);
272 },
273
274 redraw: function() {
275 this._buildtoolbar();
276 this.render();
277 this.fit();
278 },
279
280 getMode: function() {
281 return this.editor.getOption('mode');
282 },
283
284 getCursorMode: function() {
285 var param = { mode: 'html'};
286 this.trigger('cursorMode', [param]);
287 return param.mode;
288 },
289
290 render: function() {
291
292 this.currentvalue = this.editor.getValue();
293
294 if (!this.options.enablescripts) {
295 this.currentvalue = this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/img, '');
296 }
297
298 // empty code
299 if (!this.currentvalue) {
300
301 this.element.val('');
302 this.preview.container.html('');
303
304 return;
305 }
306
307 this.trigger('render', [this]);
308 this.trigger('renderLate', [this]);
309
310 this.preview.container.html(this.currentvalue);
311 },
312
313 addShortcut: function(name, callback) {
314 var map = {};
315 if (!UI.$.isArray(name)) {
316 name = [name];
317 }
318
319 name.forEach(function(key) {
320 map[key] = callback;
321 });
322
323 this.editor.addKeyMap(map);
324
325 return map;
326 },
327
328 addShortcutAction: function(action, shortcuts) {
329 var editor = this;
330 this.addShortcut(shortcuts, function() {
331 editor.element.trigger('action.' + action, [editor.editor]);
332 });
333 },
334
335 replaceSelection: function(replace) {
336
337 var text = this.editor.getSelection();
338
339 if (!text.length) {
340
341 var cur = this.editor.getCursor(),
342 curLine = this.editor.getLine(cur.line),
343 start = cur.ch,
344 end = start;
345
346 while (end < curLine.length && /[\w$]+/.test(curLine.charAt(end))) ++end;
347 while (start && /[\w$]+/.test(curLine.charAt(start - 1))) --start;
348
349 var curWord = start != end && curLine.slice(start, end);
350
351 if (curWord) {
352 this.editor.setSelection({ line: cur.line, ch: start}, { line: cur.line, ch: end });
353 text = curWord;
354 }
355 }
356
357 var html = replace.replace('$1', text);
358
359 this.editor.replaceSelection(html, 'end');
360 this.editor.focus();
361 },
362
363 replaceLine: function(replace) {
364 var pos = this.editor.getDoc().getCursor(),
365 text = this.editor.getLine(pos.line),
366 html = replace.replace('$1', text);
367
368 this.editor.replaceRange(html , { line: pos.line, ch: 0 }, { line: pos.line, ch: text.length });
369 this.editor.setCursor({ line: pos.line, ch: html.length });
370 this.editor.focus();
371 },
372
373 save: function() {
374 this.editor.save();
375 }
376 });
377
378
379 UI.components.htmleditor.template = [
380 '<div class="uk-htmleditor uk-clearfix" data-mode="split">',
381 '<div class="uk-htmleditor-navbar">',
382 '<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>',
383 '<div class="uk-htmleditor-navbar-flip">',
384 '<ul class="uk-htmleditor-navbar-nav">',
385 '<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>',
386 '<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>',
387 '<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',
388 '</ul>',
389 '</div>',
390 '</div>',
391 '<div class="uk-htmleditor-content">',
392 '<div class="uk-htmleditor-code"></div>',
393 '<div class="uk-htmleditor-preview"><div></div></div>',
394 '</div>',
395 '</div>'
396 ].join('');
397
398
399 UI.plugin('htmleditor', 'base', {
400
401 init: function(editor) {
402
403 editor.addButtons({
404
405 fullscreen: {
406 title : 'Fullscreen',
407 label : '<i class="uk-icon-expand"></i>'
408 },
409 bold : {
410 title : 'Bold',
411 label : '<i class="uk-icon-bold"></i>'
412 },
413 italic : {
414 title : 'Italic',
415 label : '<i class="uk-icon-italic"></i>'
416 },
417 strike : {
418 title : 'Strikethrough',
419 label : '<i class="uk-icon-strikethrough"></i>'
420 },
421 blockquote : {
422 title : 'Blockquote',
423 label : '<i class="uk-icon-quote-right"></i>'
424 },
425 link : {
426 title : 'Link',
427 label : '<i class="uk-icon-link"></i>'
428 },
429 image : {
430 title : 'Image',
431 label : '<i class="uk-icon-picture-o"></i>'
432 },
433 listUl : {
434 title : 'Unordered List',
435 label : '<i class="uk-icon-list-ul"></i>'
436 },
437 listOl : {
438 title : 'Ordered List',
439 label : '<i class="uk-icon-list-ol"></i>'
440 }
441
442 });
443
444 addAction('bold', '<strong>$1</strong>');
445 addAction('italic', '<em>$1</em>');
446 addAction('strike', '<del>$1</del>');
447 addAction('blockquote', '<blockquote><p>$1</p></blockquote>', 'replaceLine');
448 addAction('link', '<a href="http://">$1</a>');
449 addAction('image', '<img src="http://" alt="$1">');
450
451 var listfn = function(tag) {
452 if (editor.getCursorMode() == 'html') {
453
454 tag = tag || 'ul';
455
456 var cm = editor.editor,
457 doc = cm.getDoc(),
458 pos = doc.getCursor(true),
459 posend = doc.getCursor(false),
460 im = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(cm.getCursor()).state),
461 inList = im && im.state && im.state.context && ['ul','ol'].indexOf(im.state.context.tagName) != -1;
462
463 for (var i=pos.line; i<(posend.line+1);i++) {
464 cm.replaceRange('<li>'+cm.getLine(i)+'</li>', { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
465 }
466
467 if (!inList) {
468 cm.replaceRange('<'+tag+'>'+"\n"+cm.getLine(pos.line), { line: pos.line, ch: 0 }, { line: pos.line, ch: cm.getLine(pos.line).length });
469 cm.replaceRange(cm.getLine((posend.line+1))+"\n"+'</'+tag+'>', { line: (posend.line+1), ch: 0 }, { line: (posend.line+1), ch: cm.getLine((posend.line+1)).length });
470 cm.setCursor({ line: posend.line+1, ch: cm.getLine(posend.line+1).length });
471 } else {
472 cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
473 }
474
475 cm.focus();
476 }
477 };
478
479 editor.on('action.listUl', function() {
480 listfn('ul');
481 });
482
483 editor.on('action.listOl', function() {
484 listfn('ol');
485 });
486
487 editor.htmleditor.on('click', 'a[data-htmleditor-button="fullscreen"]', function() {
488
489 editor.htmleditor.toggleClass('uk-htmleditor-fullscreen');
490
491 var wrap = editor.editor.getWrapperElement();
492
493 if (editor.htmleditor.hasClass('uk-htmleditor-fullscreen')) {
494
495 var fixedParent = false, parents = editor.htmleditor.parents().each(function(){
496 if (UI.$(this).css('position')=='fixed' && !UI.$(this).is('html')) {
497 fixedParent = UI.$(this);
498 }
499 });
500
501 editor.htmleditor.data('fixedParents', false);
502
503 if (fixedParent) {
504
505 var transformed = [];
506
507 fixedParent = fixedParent.parent().find(parents).each(function(){
508
509 if (UI.$(this).css('transform') != 'none') {
510 transformed.push(UI.$(this).data('transform-reset', {
511 'transform': this.style.transform,
512 '-webkit-transform': this.style.webkitTransform,
513 '-webkit-transition':this.style.webkitTransition,
514 'transition':this.style.transition
515 }).css({
516 'transform': 'none',
517 '-webkit-transform': 'none',
518 '-webkit-transition':'none',
519 'transition':'none'
520 }));
521 }
522 });
523
524 editor.htmleditor.data('fixedParents', transformed);
525 }
526
527 editor.editor.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, width: wrap.style.width, height: wrap.style.height};
528 wrap.style.width = '';
529 wrap.style.height = editor.content.height()+'px';
530 document.documentElement.style.overflow = 'hidden';
531
532 } else {
533
534 document.documentElement.style.overflow = '';
535 var info = editor.editor.state.fullScreenRestore;
536 wrap.style.width = info.width; wrap.style.height = info.height;
537 window.scrollTo(info.scrollLeft, info.scrollTop);
538
539 if (editor.htmleditor.data('fixedParents')) {
540 editor.htmleditor.data('fixedParents').forEach(function(parent){
541 parent.css(parent.data('transform-reset'));
542 });
543 }
544 }
545
546 setTimeout(function() {
547 editor.fit();
548 UI.$win.trigger('resize');
549 }, 50);
550 });
551
552 editor.addShortcut(['Ctrl-S', 'Cmd-S'], function() { editor.element.trigger('htmleditor-save', [editor]); });
553 editor.addShortcutAction('bold', ['Ctrl-B', 'Cmd-B']);
554
555 function addAction(name, replace, mode) {
556 editor.on('action.'+name, function() {
557 if (editor.getCursorMode() == 'html') {
558 editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
559 }
560 });
561 }
562 }
563 });
564
565 UI.plugin('htmleditor', 'markdown', {
566
567 init: function(editor) {
568
569 var parser = editor.options.mdparser || window.marked || null;
570
571 if (!parser) return;
572
573 if (editor.options.markdown) {
574 enableMarkdown();
575 }
576
577 addAction('bold', '**$1**');
578 addAction('italic', '*$1*');
579 addAction('strike', '~~$1~~');
580 addAction('blockquote', '> $1', 'replaceLine');
581 addAction('link', '[$1](http://)');
582 addAction('image', '![$1](http://)');
583
584 editor.on('action.listUl', function() {
585
586 if (editor.getCursorMode() == 'markdown') {
587
588 var cm = editor.editor,
589 pos = cm.getDoc().getCursor(true),
590 posend = cm.getDoc().getCursor(false);
591
592 for (var i=pos.line; i<(posend.line+1);i++) {
593 cm.replaceRange('* '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
594 }
595
596 cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
597 cm.focus();
598 }
599 });
600
601 editor.on('action.listOl', function() {
602
603 if (editor.getCursorMode() == 'markdown') {
604
605 var cm = editor.editor,
606 pos = cm.getDoc().getCursor(true),
607 posend = cm.getDoc().getCursor(false),
608 prefix = 1;
609
610 if (pos.line > 0) {
611 var prevline = cm.getLine(pos.line-1), matches;
612
613 if(matches = prevline.match(/^(\d+)\./)) {
614 prefix = Number(matches[1])+1;
615 }
616 }
617
618 for (var i=pos.line; i<(posend.line+1);i++) {
619 cm.replaceRange(prefix+'. '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
620 prefix++;
621 }
622
623 cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
624 cm.focus();
625 }
626 });
627
628 editor.on('renderLate', function() {
629 if (editor.editor.options.mode == 'gfm') {
630 editor.currentvalue = parser(editor.currentvalue);
631 }
632 });
633
634 editor.on('cursorMode', function(e, param) {
635 if (editor.editor.options.mode == 'gfm') {
636 var pos = editor.editor.getDoc().getCursor();
637 if (!editor.editor.getTokenAt(pos).state.base.htmlState) {
638 param.mode = 'markdown';
639 }
640 }
641 });
642
643 UI.$.extend(editor, {
644
645 enableMarkdown: function() {
646 enableMarkdown();
647 this.render();
648 },
649 disableMarkdown: function() {
650 this.editor.setOption('mode', 'htmlmixed');
651 this.htmleditor.find('.uk-htmleditor-button-code a').html(this.options.lblCodeview);
652 this.render();
653 }
654
655 });
656
657 // switch markdown mode on event
658 editor.on({
659 enableMarkdown : function() { editor.enableMarkdown(); },
660 disableMarkdown : function() { editor.disableMarkdown(); }
661 });
662
663 function enableMarkdown() {
664 editor.editor.setOption('mode', 'gfm');
665 editor.htmleditor.find('.uk-htmleditor-button-code a').html(editor.options.lblMarkedview);
666 }
667
668 function addAction(name, replace, mode) {
669 editor.on('action.'+name, function() {
670 if (editor.getCursorMode() == 'markdown') {
671 editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
672 }
673 });
674 }
675 }
676 });
677
678 return UI.htmleditor;
679});
diff --git a/js/components/htmleditor.min.js b/js/components/htmleditor.min.js
new file mode 100755
index 0000000..a62f47e
--- /dev/null
+++ b/js/components/htmleditor.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-htmleditor",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e=[];return t.component("htmleditor",{defaults:{iframe:!1,mode:"split",markdown:!1,autocomplete:!0,enablescripts:!1,height:500,maxsplitsize:1e3,codemirror:{mode:"htmlmixed",lineWrapping:!0,dragDrop:!1,autoCloseTags:!0,matchTags:!0,autoCloseBrackets:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!1,tabSize:4,hintOptions:{completionSingle:!1}},toolbar:["bold","italic","strike","link","image","blockquote","listUl","listOl"],lblPreview:"Preview",lblCodeview:"HTML",lblMarkedview:"Markdown"},boot:function(){t.ready(function(e){t.$("textarea[data-uk-htmleditor]",e).each(function(){var e=t.$(this);e.data("htmleditor")||t.htmleditor(e,t.Utils.options(e.attr("data-uk-htmleditor")))})})},init:function(){var i=this,o=t.components.htmleditor.template;this.CodeMirror=this.options.CodeMirror||CodeMirror,this.buttons={},o=o.replace(/\{:lblPreview}/g,this.options.lblPreview),o=o.replace(/\{:lblCodeview}/g,this.options.lblCodeview),this.htmleditor=t.$(o),this.content=this.htmleditor.find(".uk-htmleditor-content"),this.toolbar=this.htmleditor.find(".uk-htmleditor-toolbar"),this.preview=this.htmleditor.find(".uk-htmleditor-preview").children().eq(0),this.code=this.htmleditor.find(".uk-htmleditor-code"),this.element.before(this.htmleditor).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),this.editor.htmleditor=this,this.editor.on("change",t.Utils.debounce(function(){i.render()},150)),this.editor.on("change",function(){i.editor.save(),i.element.trigger("input")}),this.code.find(".CodeMirror").css("height",this.options.height),this.options.iframe?(this.iframe=t.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>'),this.preview.append(this.iframe),this.iframe[0].contentWindow.document.open(),this.iframe[0].contentWindow.document.close(),this.preview.container=t.$(this.iframe[0].contentWindow.document).find("body"),"string"==typeof this.options.iframe&&this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">')):this.preview.container=this.preview,t.$win.on("resize load",t.Utils.debounce(function(){i.fit()},200));var n=this.iframe?this.preview.container:i.preview.parent(),r=this.code.find(".CodeMirror-sizer"),l=this.code.find(".CodeMirror-scroll").on("scroll",t.Utils.debounce(function(){if("tab"!=i.htmleditor.attr("data-mode")){var t=r.height()-l.height(),e=n[0].scrollHeight-(i.iframe?i.iframe.height():n.height()),o=e/t,s=l.scrollTop()*o;n.scrollTop(s)}},10));this.htmleditor.on("click",".uk-htmleditor-button-code, .uk-htmleditor-button-preview",function(e){e.preventDefault(),"tab"==i.htmleditor.attr("data-mode")&&(i.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),i.activetab=t.$(this).hasClass("uk-htmleditor-button-code")?"code":"preview",i.htmleditor.attr("data-active-tab",i.activetab),i.editor.refresh())}),this.htmleditor.on("click","a[data-htmleditor-button]",function(){i.code.is(":visible")&&i.trigger("action."+t.$(this).data("htmleditor-button"),[i.editor])}),this.preview.parent().css("height",this.code.height()),this.options.autocomplete&&this.CodeMirror.showHint&&this.CodeMirror.hint&&this.CodeMirror.hint.html&&this.editor.on("inputRead",t.Utils.debounce(function(){var t=i.editor.getDoc(),e=t.getCursor(),o=i.CodeMirror.innerMode(i.editor.getMode(),i.editor.getTokenAt(e).state).mode.name;if("xml"==o){var n=i.editor.getCursor(),r=i.editor.getTokenAt(n);("<"==r.string.charAt(0)||"attribute"==r.type)&&i.CodeMirror.showHint(i.editor,i.CodeMirror.hint.html,{completeSingle:!1})}},100)),this.debouncedRedraw=t.Utils.debounce(function(){i.redraw()},5),this.on("init.uk.component",function(){i.debouncedRedraw()}),this.element.attr("data-uk-check-display",1).on("display.uk.check",function(){this.htmleditor.is(":visible")&&this.fit()}.bind(this)),e.push(this)},addButton:function(t,e){this.buttons[t]=e},addButtons:function(e){t.$.extend(this.buttons,e)},replaceInPreview:function(t,e){function i(t){var e=o.getValue().substring(0,t).split("\n");return{line:e.length-1,ch:e[e.length-1].length}}var o=this.editor,n=[],r=o.getValue(),l=-1,s=0;return this.currentvalue=this.currentvalue.replace(t,function(){l=r.indexOf(arguments[0],++l);var t={matches:arguments,from:i(l),to:i(l+arguments[0].length),replace:function(e){o.replaceRange(e,t.from,t.to)},inRange:function(e){return e.line===t.from.line&&e.line===t.to.line?e.ch>=t.from.ch&&e.ch<t.to.ch:e.line===t.from.line&&e.ch>=t.from.ch||e.line>t.from.line&&e.line<t.to.line||e.line===t.to.line&&e.ch<t.to.ch}},a="string"==typeof e?e:e(t,s);return a||""===a?(s++,n.push(t),a):arguments[0]}),n},_buildtoolbar:function(){if(this.options.toolbar&&this.options.toolbar.length){var t=this,e=[];this.toolbar.empty(),this.options.toolbar.forEach(function(i){if(t.buttons[i]){var o=t.buttons[i].title?t.buttons[i].title:i;e.push('<li><a data-htmleditor-button="'+i+'" title="'+o+'" data-uk-tooltip>'+t.buttons[i].label+"</a></li>")}}),this.toolbar.html(e.join("\n"))}},fit:function(){var t=this.options.mode;"split"==t&&this.htmleditor.width()<this.options.maxsplitsize&&(t="tab"),"tab"==t&&(this.activetab||(this.activetab="code",this.htmleditor.attr("data-active-tab",this.activetab)),this.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter("code"==this.activetab?".uk-htmleditor-button-code":".uk-htmleditor-button-preview").addClass("uk-active")),this.editor.refresh(),this.preview.parent().css("height",this.code.height()),this.htmleditor.attr("data-mode",t)},redraw:function(){this._buildtoolbar(),this.render(),this.fit()},getMode:function(){return this.editor.getOption("mode")},getCursorMode:function(){var t={mode:"html"};return this.trigger("cursorMode",[t]),t.mode},render:function(){return this.currentvalue=this.editor.getValue(),this.options.enablescripts||(this.currentvalue=this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/gim,"")),this.currentvalue?(this.trigger("render",[this]),this.trigger("renderLate",[this]),this.preview.container.html(this.currentvalue),void 0):(this.element.val(""),this.preview.container.html(""),void 0)},addShortcut:function(e,i){var o={};return t.$.isArray(e)||(e=[e]),e.forEach(function(t){o[t]=i}),this.editor.addKeyMap(o),o},addShortcutAction:function(t,e){var i=this;this.addShortcut(e,function(){i.element.trigger("action."+t,[i.editor])})},replaceSelection:function(t){var e=this.editor.getSelection();if(!e.length){for(var i=this.editor.getCursor(),o=this.editor.getLine(i.line),n=i.ch,r=n;r<o.length&&/[\w$]+/.test(o.charAt(r));)++r;for(;n&&/[\w$]+/.test(o.charAt(n-1));)--n;var l=n!=r&&o.slice(n,r);l&&(this.editor.setSelection({line:i.line,ch:n},{line:i.line,ch:r}),e=l)}var s=t.replace("$1",e);this.editor.replaceSelection(s,"end"),this.editor.focus()},replaceLine:function(t){var e=this.editor.getDoc().getCursor(),i=this.editor.getLine(e.line),o=t.replace("$1",i);this.editor.replaceRange(o,{line:e.line,ch:0},{line:e.line,ch:i.length}),this.editor.setCursor({line:e.line,ch:o.length}),this.editor.focus()},save:function(){this.editor.save()}}),t.components.htmleditor.template=['<div class="uk-htmleditor uk-clearfix" data-mode="split">','<div class="uk-htmleditor-navbar">','<ul class="uk-htmleditor-navbar-nav uk-htmleditor-toolbar"></ul>','<div class="uk-htmleditor-navbar-flip">','<ul class="uk-htmleditor-navbar-nav">','<li class="uk-htmleditor-button-code"><a>{:lblCodeview}</a></li>','<li class="uk-htmleditor-button-preview"><a>{:lblPreview}</a></li>','<li><a data-htmleditor-button="fullscreen"><i class="uk-icon-expand"></i></a></li>',"</ul>","</div>","</div>",'<div class="uk-htmleditor-content">','<div class="uk-htmleditor-code"></div>','<div class="uk-htmleditor-preview"><div></div></div>',"</div>","</div>"].join(""),t.plugin("htmleditor","base",{init:function(e){function i(t,i,o){e.on("action."+t,function(){"html"==e.getCursorMode()&&e["replaceLine"==o?"replaceLine":"replaceSelection"](i)})}e.addButtons({fullscreen:{title:"Fullscreen",label:'<i class="uk-icon-expand"></i>'},bold:{title:"Bold",label:'<i class="uk-icon-bold"></i>'},italic:{title:"Italic",label:'<i class="uk-icon-italic"></i>'},strike:{title:"Strikethrough",label:'<i class="uk-icon-strikethrough"></i>'},blockquote:{title:"Blockquote",label:'<i class="uk-icon-quote-right"></i>'},link:{title:"Link",label:'<i class="uk-icon-link"></i>'},image:{title:"Image",label:'<i class="uk-icon-picture-o"></i>'},listUl:{title:"Unordered List",label:'<i class="uk-icon-list-ul"></i>'},listOl:{title:"Ordered List",label:'<i class="uk-icon-list-ol"></i>'}}),i("bold","<strong>$1</strong>"),i("italic","<em>$1</em>"),i("strike","<del>$1</del>"),i("blockquote","<blockquote><p>$1</p></blockquote>","replaceLine"),i("link",'<a href="http://">$1</a>'),i("image",'<img src="http://" alt="$1">');var o=function(t){if("html"==e.getCursorMode()){t=t||"ul";for(var i=e.editor,o=i.getDoc(),n=o.getCursor(!0),r=o.getCursor(!1),l=CodeMirror.innerMode(i.getMode(),i.getTokenAt(i.getCursor()).state),s=l&&l.state&&l.state.context&&-1!=["ul","ol"].indexOf(l.state.context.tagName),a=n.line;a<r.line+1;a++)i.replaceRange("<li>"+i.getLine(a)+"</li>",{line:a,ch:0},{line:a,ch:i.getLine(a).length});s?i.setCursor({line:r.line,ch:i.getLine(r.line).length}):(i.replaceRange("<"+t+">\n"+i.getLine(n.line),{line:n.line,ch:0},{line:n.line,ch:i.getLine(n.line).length}),i.replaceRange(i.getLine(r.line+1)+"\n</"+t+">",{line:r.line+1,ch:0},{line:r.line+1,ch:i.getLine(r.line+1).length}),i.setCursor({line:r.line+1,ch:i.getLine(r.line+1).length})),i.focus()}};e.on("action.listUl",function(){o("ul")}),e.on("action.listOl",function(){o("ol")}),e.htmleditor.on("click",'a[data-htmleditor-button="fullscreen"]',function(){e.htmleditor.toggleClass("uk-htmleditor-fullscreen");var i=e.editor.getWrapperElement();if(e.htmleditor.hasClass("uk-htmleditor-fullscreen")){var o=!1,n=e.htmleditor.parents().each(function(){"fixed"!=t.$(this).css("position")||t.$(this).is("html")||(o=t.$(this))});if(e.htmleditor.data("fixedParents",!1),o){var r=[];o=o.parent().find(n).each(function(){"none"!=t.$(this).css("transform")&&r.push(t.$(this).data("transform-reset",{transform:this.style.transform,"-webkit-transform":this.style.webkitTransform,"-webkit-transition":this.style.webkitTransition,transition:this.style.transition}).css({transform:"none","-webkit-transform":"none","-webkit-transition":"none",transition:"none"}))}),e.htmleditor.data("fixedParents",r)}e.editor.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:i.style.width,height:i.style.height},i.style.width="",i.style.height=e.content.height()+"px",document.documentElement.style.overflow="hidden"}else{document.documentElement.style.overflow="";var l=e.editor.state.fullScreenRestore;i.style.width=l.width,i.style.height=l.height,window.scrollTo(l.scrollLeft,l.scrollTop),e.htmleditor.data("fixedParents")&&e.htmleditor.data("fixedParents").forEach(function(t){t.css(t.data("transform-reset"))})}setTimeout(function(){e.fit(),t.$win.trigger("resize")},50)}),e.addShortcut(["Ctrl-S","Cmd-S"],function(){e.element.trigger("htmleditor-save",[e])}),e.addShortcutAction("bold",["Ctrl-B","Cmd-B"])}}),t.plugin("htmleditor","markdown",{init:function(e){function i(){e.editor.setOption("mode","gfm"),e.htmleditor.find(".uk-htmleditor-button-code a").html(e.options.lblMarkedview)}function o(t,i,o){e.on("action."+t,function(){"markdown"==e.getCursorMode()&&e["replaceLine"==o?"replaceLine":"replaceSelection"](i)})}var n=e.options.mdparser||window.marked||null;n&&(e.options.markdown&&i(),o("bold","**$1**"),o("italic","*$1*"),o("strike","~~$1~~"),o("blockquote","> $1","replaceLine"),o("link","[$1](http://)"),o("image","![$1](http://)"),e.on("action.listUl",function(){if("markdown"==e.getCursorMode()){for(var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),n=i.line;n<o.line+1;n++)t.replaceRange("* "+t.getLine(n),{line:n,ch:0},{line:n,ch:t.getLine(n).length});t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("action.listOl",function(){if("markdown"==e.getCursorMode()){var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),n=1;if(i.line>0){var r,l=t.getLine(i.line-1);(r=l.match(/^(\d+)\./))&&(n=Number(r[1])+1)}for(var s=i.line;s<o.line+1;s++)t.replaceRange(n+". "+t.getLine(s),{line:s,ch:0},{line:s,ch:t.getLine(s).length}),n++;t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("renderLate",function(){"gfm"==e.editor.options.mode&&(e.currentvalue=n(e.currentvalue))}),e.on("cursorMode",function(t,i){if("gfm"==e.editor.options.mode){var o=e.editor.getDoc().getCursor();e.editor.getTokenAt(o).state.base.htmlState||(i.mode="markdown")}}),t.$.extend(e,{enableMarkdown:function(){i(),this.render()},disableMarkdown:function(){this.editor.setOption("mode","htmlmixed"),this.htmleditor.find(".uk-htmleditor-button-code a").html(this.options.lblCodeview),this.render()}}),e.on({enableMarkdown:function(){e.enableMarkdown()},disableMarkdown:function(){e.disableMarkdown()}}))}}),t.htmleditor}); \ No newline at end of file
diff --git a/js/components/lightbox.js b/js/components/lightbox.js
new file mode 100755
index 0000000..78fb9fd
--- /dev/null
+++ b/js/components/lightbox.js
@@ -0,0 +1,591 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) { // AMD
11 define("uikit-lightbox", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var modal, cache = {};
21
22 UI.component('lightbox', {
23
24 defaults: {
25 "allowfullscreen" : true,
26 "duration" : 400,
27 "group" : false,
28 "keyboard" : true
29 },
30
31 index : 0,
32 items : false,
33
34 boot: function() {
35
36 UI.$html.on('click', '[data-uk-lightbox]', function(e){
37
38 e.preventDefault();
39
40 var link = UI.$(this);
41
42 if (!link.data("lightbox")) {
43
44 UI.lightbox(link, UI.Utils.options(link.attr("data-uk-lightbox")));
45 }
46
47 link.data("lightbox").show(link);
48 });
49
50 // keyboard navigation
51 UI.$doc.on('keyup', function(e) {
52
53 if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
54
55 e.preventDefault();
56
57 switch(e.keyCode) {
58 case 37:
59 modal.lightbox.previous();
60 break;
61 case 39:
62 modal.lightbox.next();
63 break;
64 }
65 }
66 });
67 },
68
69 init: function() {
70
71 var siblings = [];
72
73 this.index = 0;
74 this.siblings = [];
75
76 if (this.element && this.element.length) {
77
78 var domSiblings = this.options.group ? UI.$([
79 '[data-uk-lightbox*="'+this.options.group+'"]',
80 "[data-uk-lightbox*='"+this.options.group+"']"
81 ].join(',')) : this.element;
82
83 domSiblings.each(function() {
84
85 var ele = UI.$(this);
86
87 siblings.push({
88 'source': ele.attr('href'),
89 'title' : ele.attr('data-title') || ele.attr('title'),
90 'type' : ele.attr("data-lightbox-type") || 'auto',
91 'link' : ele
92 });
93 });
94
95 this.index = domSiblings.index(this.element);
96 this.siblings = siblings;
97
98 } else if (this.options.group && this.options.group.length) {
99 this.siblings = this.options.group;
100 }
101
102 this.trigger('lightbox-init', [this]);
103 },
104
105 show: function(index) {
106
107 this.modal = getModal(this);
108
109 // stop previous animation
110 this.modal.dialog.stop();
111 this.modal.content.stop();
112
113 var $this = this, promise = UI.$.Deferred(), data, item;
114
115 index = index || 0;
116
117 // index is a jQuery object or DOM element
118 if (typeof(index) == 'object') {
119
120 this.siblings.forEach(function(s, idx){
121
122 if (index[0] === s.link[0]) {
123 index = idx;
124 }
125 });
126 }
127
128 // fix index if needed
129 if ( index < 0 ) {
130 index = this.siblings.length - index;
131 } else if (!this.siblings[index]) {
132 index = 0;
133 }
134
135 item = this.siblings[index];
136
137 data = {
138 "lightbox" : $this,
139 "source" : item.source,
140 "type" : item.type,
141 "index" : index,
142 "promise" : promise,
143 "title" : item.title,
144 "item" : item,
145 "meta" : {
146 "content" : '',
147 "width" : null,
148 "height" : null
149 }
150 };
151
152 this.index = index;
153
154 this.modal.content.empty();
155
156 if (!this.modal.is(':visible')) {
157 this.modal.content.css({width:'', height:''}).empty();
158 this.modal.modal.show();
159 }
160
161 this.modal.loader.removeClass('uk-hidden');
162
163 promise.promise().done(function() {
164
165 $this.data = data;
166 $this.fitSize(data);
167
168 }).fail(function(){
169
170 data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
171 data.meta.width = 400;
172 data.meta.height = 300;
173
174 $this.data = data;
175 $this.fitSize(data);
176 });
177
178 $this.trigger('showitem.uk.lightbox', [data]);
179 },
180
181 fitSize: function() {
182
183 var $this = this,
184 data = this.data,
185 pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
186 dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
187 dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
188 dpad = dpadTop + dpadBot,
189 content = data.meta.content,
190 duration = $this.options.duration;
191
192 if (this.siblings.length > 1) {
193
194 content = [
195 content,
196 '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
197 '<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
198 ].join('');
199 }
200
201 // calculate width
202 var tmp = UI.$('<div>&nbsp;</div>').css({
203 'opacity' : 0,
204 'position' : 'absolute',
205 'top' : 0,
206 'left' : 0,
207 'width' : '100%',
208 'max-width' : $this.modal.dialog.css('max-width'),
209 'padding' : $this.modal.dialog.css('padding'),
210 'margin' : $this.modal.dialog.css('margin')
211 }), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
212
213 tmp.appendTo('body').width();
214
215 maxwidth = tmp.width();
216 maxheight = window.innerHeight - dpad;
217
218 tmp.remove();
219
220 this.modal.dialog.find('.uk-modal-caption').remove();
221
222 if (data.title) {
223 this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
224 maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
225 }
226
227 if (maxwidth < data.meta.width) {
228
229 h = Math.floor( h * (maxwidth / w) );
230 w = maxwidth;
231 }
232
233 if (maxheight < h) {
234
235 h = Math.floor(maxheight);
236 w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
237 }
238
239 this.modal.content.css('opacity', 0).width(w).html(content);
240
241 if (data.type == 'iframe') {
242 this.modal.content.find('iframe:first').height(h);
243 }
244
245 var dh = h + pad,
246 t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
247
248 if (t < 0) { t = 0; }
249
250 this.modal.closer.addClass('uk-hidden');
251
252 if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
253 duration = 0;
254 }
255
256 this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
257 $this.modal.loader.addClass('uk-hidden');
258 $this.modal.content.css({width:''}).animate({'opacity': 1}, function() {
259 $this.modal.closer.removeClass('uk-hidden');
260 });
261
262 $this.modal.data({'mwidth': w, 'mheight': h});
263 });
264 },
265
266 next: function() {
267 this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
268 },
269
270 previous: function() {
271 this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
272 }
273 });
274
275
276 // Plugins
277
278 UI.plugin('lightbox', 'image', {
279
280 init: function(lightbox) {
281
282 lightbox.on("showitem.uk.lightbox", function(e, data){
283
284 if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
285
286 var resolve = function(source, width, height) {
287
288 data.meta = {
289 "content" : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
290 "width" : width,
291 "height" : height
292 };
293
294 data.type = 'image';
295
296 data.promise.resolve();
297 };
298
299 if (!cache[data.source]) {
300
301 var img = new Image();
302
303 img.onerror = function(){
304 data.promise.reject('Loading image failed');
305 };
306
307 img.onload = function(){
308 cache[data.source] = {width: img.width, height: img.height};
309 resolve(data.source, cache[data.source].width, cache[data.source].height);
310 };
311
312 img.src = data.source;
313
314 } else {
315 resolve(data.source, cache[data.source].width, cache[data.source].height);
316 }
317 }
318 });
319 }
320 });
321
322 UI.plugin("lightbox", "youtube", {
323
324 init: function(lightbox) {
325
326 var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
327 youtubeRegExpShort = /youtu\.be\/(.*)/;
328
329
330 lightbox.on("showitem.uk.lightbox", function(e, data){
331
332 var id, matches, resolve = function(id, width, height) {
333
334 data.meta = {
335 'content': '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
336 'width': width,
337 'height': height
338 };
339
340 data.type = 'iframe';
341
342 data.promise.resolve();
343 };
344
345 if (matches = data.source.match(youtubeRegExp)) {
346 id = matches[2];
347 }
348
349 if (matches = data.source.match(youtubeRegExpShort)) {
350 id = matches[1];
351 }
352
353 if (id) {
354
355 if(!cache[id]) {
356
357 var img = new Image(), lowres = false;
358
359 img.onerror = function(){
360 cache[id] = {width:640, height:320};
361 resolve(id, cache[id].width, cache[id].height);
362 };
363
364 img.onload = function(){
365 //youtube default 404 thumb, fall back to lowres
366 if (img.width == 120 && img.height == 90) {
367 if (!lowres) {
368 lowres = true;
369 img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
370 } else {
371 cache[id] = {width: 640, height: 320};
372 resolve(id, cache[id].width, cache[id].height);
373 }
374 } else {
375 cache[id] = {width: img.width, height: img.height};
376 resolve(id, img.width, img.height);
377 }
378 };
379
380 img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
381
382 } else {
383 resolve(id, cache[id].width, cache[id].height);
384 }
385
386 e.stopImmediatePropagation();
387 }
388 });
389 }
390 });
391
392
393 UI.plugin("lightbox", "vimeo", {
394
395 init: function(lightbox) {
396
397 var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
398
399
400 lightbox.on("showitem.uk.lightbox", function(e, data){
401
402 var id, resolve = function(id, width, height) {
403
404 data.meta = {
405 'content': '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
406 'width': width,
407 'height': height
408 };
409
410 data.type = 'iframe';
411
412 data.promise.resolve();
413 };
414
415 if (matches = data.source.match(regex)) {
416
417 id = matches[2];
418
419 if(!cache[id]) {
420
421 UI.$.ajax({
422 type : 'GET',
423 url : 'http://vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
424 jsonp : 'callback',
425 dataType : 'jsonp',
426 success : function(data) {
427 cache[id] = {width:data.width, height:data.height};
428 resolve(id, cache[id].width, cache[id].height);
429 }
430 });
431
432 } else {
433 resolve(id, cache[id].width, cache[id].height);
434 }
435
436 e.stopImmediatePropagation();
437 }
438 });
439 }
440 });
441
442 UI.plugin("lightbox", "video", {
443
444 init: function(lightbox) {
445
446 lightbox.on("showitem.uk.lightbox", function(e, data){
447
448
449 var resolve = function(source, width, height) {
450
451 data.meta = {
452 'content': '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
453 'width': width,
454 'height': height
455 };
456
457 data.type = 'video';
458
459 data.promise.resolve();
460 };
461
462 if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
463
464 if (!cache[data.source]) {
465
466 var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
467
468 var idle = setInterval(function() {
469
470 if (vid[0].videoWidth) {
471 clearInterval(idle);
472 cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
473 resolve(data.source, cache[data.source].width, cache[data.source].height);
474 vid.remove();
475 }
476
477 }, 20);
478
479 } else {
480 resolve(data.source, cache[data.source].width, cache[data.source].height);
481 }
482 }
483 });
484 }
485 });
486
487
488 UIkit.plugin("lightbox", "iframe", {
489
490 init: function (lightbox) {
491
492 lightbox.on("showitem.uk.lightbox", function (e, data) {
493
494 var resolve = function (source, width, height) {
495
496 data.meta = {
497 'content': '<iframe class="uk-responsive-width" src="' + source + '" width="' + width + '" height="' + height + '"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
498 'width': width,
499 'height': height
500 };
501
502 data.type = 'iframe';
503
504 data.promise.resolve();
505 };
506
507 if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) {
508 resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600));
509 }
510 });
511
512 }
513 });
514
515 function getModal(lightbox) {
516
517 if (modal) {
518 modal.lightbox = lightbox;
519 return modal;
520 }
521
522 // init lightbox container
523 modal = UI.$([
524 '<div class="uk-modal">',
525 '<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2 - 200)+'px;">',
526 '<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>',
527 '<div class="uk-lightbox-content"></div>',
528 '<div class="uk-modal-spinner uk-hidden"></div>',
529 '</div>',
530 '</div>'
531 ].join('')).appendTo('body');
532
533 modal.dialog = modal.find('.uk-modal-dialog:first');
534 modal.content = modal.find('.uk-lightbox-content:first');
535 modal.loader = modal.find('.uk-modal-spinner:first');
536 modal.closer = modal.find('.uk-close.uk-close-alt');
537 modal.modal = UI.modal(modal, {modal:false});
538
539 // next / previous
540 modal.on("swipeRight swipeLeft", function(e) {
541 modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
542 }).on("click", "[data-lightbox-previous], [data-lightbox-next]", function(e){
543 e.preventDefault();
544 modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
545 });
546
547 // destroy content on modal hide
548 modal.on("hide.uk.modal", function(e) {
549 modal.content.html('');
550 });
551
552 var resizeCache = {w: window.innerWidth, h:window.innerHeight};
553
554 UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
555
556 if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) {
557 modal.lightbox.fitSize();
558 }
559
560 resizeCache = {w: window.innerWidth, h:window.innerHeight};
561
562 }, 100));
563
564 modal.lightbox = lightbox;
565
566 return modal;
567 }
568
569 UI.lightbox.create = function(items, options) {
570
571 if (!items) return;
572
573 var group = [], o;
574
575 items.forEach(function(item) {
576
577 group.push(UI.$.extend({
578 'source' : '',
579 'title' : '',
580 'type' : 'auto',
581 'link' : false
582 }, (typeof(item) == 'string' ? {'source': item} : item)));
583 });
584
585 o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
586
587 return o;
588 };
589
590 return UI.lightbox;
591});
diff --git a/js/components/lightbox.min.js b/js/components/lightbox.min.js
new file mode 100755
index 0000000..5075244
--- /dev/null
+++ b/js/components/lightbox.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-lightbox",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";function t(t){if(e)return e.lightbox=t,e;e=i.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>',"</div>","</div>"].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(",")):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join(""));var d,r,u=i.$("<div>&nbsp;</div>").css({opacity:0,position:"absolute",top:0,left:0,width:"100%","max-width":t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('<div class="uk-modal-caption">'+e.title+"</div>"),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),d<e.meta.width&&(g=Math.floor(g*(d/c)),c=d),g>r&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'<img class="uk-responsive-width" width="'+e+'" height="'+o+'" src ="'+i+'">',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+o+'" style="max-width:100%;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+o+'" style="width:100%;box-sizing:border-box;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"http://vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'<video class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+o+'" controls></video>',width:t,height:o},e.type="video",e.promise.resolve()};if("video"==e.type||e.source.match(/\.(mp4|webm|ogv)$/i))if(o[e.source])n(e.source,o[e.source].width,o[e.source].height);else var s=i.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'<iframe class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+n+'"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox}); \ No newline at end of file
diff --git a/js/components/nestable.js b/js/components/nestable.js
new file mode 100755
index 0000000..573345d
--- /dev/null
+++ b/js/components/nestable.js
@@ -0,0 +1,653 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2/*
3 * Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
4 */
5(function(addon) {
6
7 var component;
8
9 if (window.UIkit) {
10 component = addon(UIkit);
11 }
12
13 if (typeof define == "function" && define.amd) {
14 define("uikit-nestable", ["uikit"], function(){
15 return component || addon(UIkit);
16 });
17 }
18
19})(function(UI) {
20
21 "use strict";
22
23 var hasTouch = 'ontouchstart' in window,
24 html = UI.$html,
25 touchedlists = [],
26 $win = UI.$win,
27 draggingElement;
28
29 var eStart = hasTouch ? 'touchstart' : 'mousedown',
30 eMove = hasTouch ? 'touchmove' : 'mousemove',
31 eEnd = hasTouch ? 'touchend' : 'mouseup',
32 eCancel = hasTouch ? 'touchcancel' : 'mouseup';
33
34
35 UI.component('nestable', {
36
37 defaults: {
38 listBaseClass : 'uk-nestable',
39 listClass : 'uk-nestable-list',
40 listItemClass : 'uk-nestable-item',
41 dragClass : 'uk-nestable-dragged',
42 movingClass : 'uk-nestable-moving',
43 noChildrenClass : 'uk-nestable-nochildren',
44 emptyClass : 'uk-nestable-empty',
45 handleClass : '',
46 collapsedClass : 'uk-collapsed',
47 placeholderClass: 'uk-nestable-placeholder',
48 noDragClass : 'uk-nestable-nodrag',
49 group : false,
50 maxDepth : 10,
51 threshold : 20,
52 idlethreshold : 10,
53 },
54
55 boot: function() {
56
57 // adjust document scrolling
58 UI.$html.on('mousemove touchmove', function(e) {
59
60 if (draggingElement) {
61
62 var top = draggingElement.offset().top;
63
64 if (top < UI.$win.scrollTop()) {
65 UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
66 } else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
67 UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
68 }
69 }
70 });
71
72 // init code
73 UI.ready(function(context) {
74
75 UI.$("[data-uk-nestable]", context).each(function(){
76
77 var ele = UI.$(this);
78
79 if (!ele.data("nestable")) {
80 UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
81 }
82 });
83 });
84 },
85
86 init: function() {
87
88 var $this = this;
89
90 Object.keys(this.options).forEach(function(key){
91
92 if(String(key).indexOf('Class')!=-1) {
93 $this.options['_'+key] = '.' + $this.options[key];
94 }
95 });
96
97 this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass);
98
99 this.checkEmptyList();
100
101 this.reset();
102 this.element.data('nestable-group', this.options.group || UI.Utils.uid('nestable-group'));
103
104 this.find(this.options._listItemClass).each(function() {
105 $this.setParent(UI.$(this));
106 });
107
108 this.on('click', '[data-nestable-action]', function(e) {
109
110 if ($this.dragEl || (!hasTouch && e.button !== 0)) {
111 return;
112 }
113
114 e.preventDefault();
115
116 var target = UI.$(e.currentTarget),
117 action = target.data('nestableAction'),
118 item = target.closest($this.options._listItemClass);
119
120 if (action === 'collapse') {
121 $this.collapseItem(item);
122 }
123 if (action === 'expand') {
124 $this.expandItem(item);
125 }
126 if (action === 'toggle') {
127 $this.toggleItem(item);
128 }
129 });
130
131 var onStartEvent = function(e) {
132
133 var handle = UI.$(e.target),
134 link = handle.is('a[href]') ? handle:handle.parents('a[href]');
135
136 if (e.target === $this.element[0]) {
137 return;
138 }
139
140 if (handle.is($this.options._noDragClass) || handle.closest($this.options._noDragClass).length) {
141 return;
142 }
143
144 if (handle.is('[data-nestable-action]') || handle.closest('[data-nestable-action]').length) {
145 return;
146 }
147
148 if ($this.options.handleClass && !handle.hasClass($this.options.handleClass)) {
149
150 if ($this.options.handleClass) {
151 handle = handle.closest($this.options._handleClass);
152 }
153 }
154
155 if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
156 return;
157 }
158
159 if (e.originalEvent && e.originalEvent.touches) {
160 e = evt.originalEvent.touches[0];
161 }
162
163 $this.delayMove = function(evt) {
164
165 link = false;
166
167 evt.preventDefault();
168 $this.dragStart(e);
169 $this.trigger('start.uk.nestable', [$this]);
170
171 $this.delayMove = false;
172 };
173
174 $this.delayMove.x = parseInt(e.pageX, 10);
175 $this.delayMove.y = parseInt(e.pageY, 10);
176 $this.delayMove.threshold = $this.options.idlethreshold;
177
178 if (link.length && eEnd == 'touchend') {
179
180 $this.one(eEnd, function(){
181 if (link && link.attr('href').trim()) {
182 location.href = link.attr('href');
183 }
184 });
185 }
186
187 e.preventDefault();
188 };
189
190 var onMoveEvent = function(e) {
191
192 if (e.originalEvent && e.originalEvent.touches) {
193 e = e.originalEvent.touches[0];
194 }
195
196 if ($this.delayMove && (Math.abs(e.pageX - $this.delayMove.x) > $this.delayMove.threshold || Math.abs(e.pageY - $this.delayMove.y) > $this.delayMove.threshold)) {
197
198 if (!window.getSelection().toString()) {
199 $this.delayMove(e);
200 } else {
201 $this.delayMove = false;
202 }
203 }
204
205 if ($this.dragEl) {
206 e.preventDefault();
207 $this.dragMove(e);
208 $this.trigger('move.uk.nestable', [$this]);
209 }
210 };
211
212 var onEndEvent = function(e) {
213
214 if ($this.dragEl) {
215 e.preventDefault();
216 $this.dragStop(hasTouch ? e.touches[0] : e);
217 }
218
219 draggingElement = false;
220 $this.delayMove = false;
221 };
222
223 if (hasTouch) {
224 this.element[0].addEventListener(eStart, onStartEvent, false);
225 window.addEventListener(eMove, onMoveEvent, false);
226 window.addEventListener(eEnd, onEndEvent, false);
227 window.addEventListener(eCancel, onEndEvent, false);
228 } else {
229 this.on(eStart, onStartEvent);
230 $win.on(eMove, onMoveEvent);
231 $win.on(eEnd, onEndEvent);
232 }
233
234 },
235
236 serialize: function() {
237
238 var data,
239 depth = 0,
240 list = this,
241 step = function(level, depth) {
242
243 var array = [ ], items = level.children(list.options._listItemClass);
244
245 items.each(function() {
246
247 var li = UI.$(this),
248 item = {}, attribute,
249 sub = li.children(list.options._listClass);
250
251 for (var i = 0, attr, val; i < li[0].attributes.length; i++) {
252 attribute = li[0].attributes[i];
253 if (attribute.name.indexOf('data-') === 0) {
254 attr = attribute.name.substr(5);
255 val = UI.Utils.str2json(attribute.value);
256 item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
257 }
258 }
259
260 if (sub.length) {
261 item.children = step(sub, depth + 1);
262 }
263
264 array.push(item);
265
266 });
267 return array;
268 };
269
270 data = step(list.element, depth);
271
272 return data;
273 },
274
275 list: function(options) {
276
277 var data = [],
278 list = this,
279 depth = 0,
280 step = function(level, depth, parent) {
281
282 var items = level.children(options._listItemClass);
283
284 items.each(function(index) {
285 var li = UI.$(this),
286 item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
287 sub = li.children(options._listClass);
288
289 data.push(item);
290
291 if (sub.length) {
292 step(sub, depth + 1, li.data(options.idProperty || 'id'));
293 }
294 });
295 };
296
297 options = UI.$.extend({}, list.options, options);
298
299 step(list.element, depth);
300
301 return data;
302 },
303
304 reset: function() {
305
306 this.mouse = {
307 offsetX : 0,
308 offsetY : 0,
309 startX : 0,
310 startY : 0,
311 lastX : 0,
312 lastY : 0,
313 nowX : 0,
314 nowY : 0,
315 distX : 0,
316 distY : 0,
317 dirAx : 0,
318 dirX : 0,
319 dirY : 0,
320 lastDirX : 0,
321 lastDirY : 0,
322 distAxX : 0,
323 distAxY : 0
324 };
325 this.moving = false;
326 this.dragEl = null;
327 this.dragRootEl = null;
328 this.dragDepth = 0;
329 this.hasNewRoot = false;
330 this.pointEl = null;
331
332 for (var i=0; i<touchedlists.length; i++) {
333 this.checkEmptyList(touchedlists[i]);
334 }
335
336 touchedlists = [];
337 },
338
339 toggleItem: function(li) {
340 this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
341 },
342
343 expandItem: function(li) {
344 li.removeClass(this.options.collapsedClass);
345 },
346
347 collapseItem: function(li) {
348 var lists = li.children(this.options._listClass);
349 if (lists.length) {
350 li.addClass(this.options.collapsedClass);
351 }
352 },
353
354 expandAll: function() {
355 var list = this;
356 this.find(list.options._listItemClass).each(function() {
357 list.expandItem(UI.$(this));
358 });
359 },
360
361 collapseAll: function() {
362 var list = this;
363 this.find(list.options._listItemClass).each(function() {
364 list.collapseItem(UI.$(this));
365 });
366 },
367
368 setParent: function(li) {
369
370 if (li.children(this.options._listClass).length) {
371 li.addClass("uk-parent");
372 }
373 },
374
375 unsetParent: function(li) {
376 li.removeClass('uk-parent '+this.options.collapsedClass);
377 li.children(this.options._listClass).remove();
378 },
379
380 dragStart: function(e) {
381
382 var mouse = this.mouse,
383 target = UI.$(e.target),
384 dragItem = target.closest(this.options._listItemClass),
385 offset = dragItem.offset();
386
387 this.placeEl = dragItem;
388
389 mouse.offsetX = e.pageX - offset.left;
390 mouse.offsetY = e.pageY - offset.top;
391
392 mouse.startX = mouse.lastX = offset.left;
393 mouse.startY = mouse.lastY = offset.top;
394
395 this.dragRootEl = this.element;
396
397 this.dragEl = UI.$('<ul></ul>').addClass(this.options.listClass + ' ' + this.options.dragClass).append(dragItem.clone());
398 this.dragEl.css('width', dragItem.width());
399 this.placeEl.addClass(this.options.placeholderClass);
400
401 draggingElement = this.dragEl;
402
403 this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
404
405 UI.$body.append(this.dragEl);
406
407 this.dragEl.css({
408 left : offset.left,
409 top : offset.top
410 });
411
412 // total depth of dragging item
413 var i, depth, items = this.dragEl.find(this.options._listItemClass);
414
415 for (i = 0; i < items.length; i++) {
416 depth = UI.$(items[i]).parents(this.options._listClass+','+this.options._listBaseClass).length;
417 if (depth > this.dragDepth) {
418 this.dragDepth = depth;
419 }
420 }
421
422 html.addClass(this.options.movingClass);
423 },
424
425 dragStop: function(e) {
426
427 var el = UI.$(this.placeEl),
428 root = this.placeEl.parents(this.options._listBaseClass+':first');
429
430 this.placeEl.removeClass(this.options.placeholderClass);
431 this.dragEl.remove();
432
433 if (this.element[0] !== root[0]) {
434
435 root.trigger('change.uk.nestable',[root.data('nestable'), el, 'added']);
436 this.element.trigger('change.uk.nestable', [this, el, 'removed']);
437
438 } else {
439 this.element.trigger('change.uk.nestable',[this, el, "moved"]);
440 }
441
442 this.trigger('stop.uk.nestable', [this, el]);
443
444 this.reset();
445
446 html.removeClass(this.options.movingClass);
447 },
448
449 dragMove: function(e) {
450 var list, parent, prev, next, depth,
451 opt = this.options,
452 mouse = this.mouse,
453 maxDepth = this.dragRootEl ? this.dragRootEl.data('nestable').options.maxDepth : opt.maxDepth;
454
455 this.dragEl.css({
456 left : e.pageX - mouse.offsetX,
457 top : e.pageY - mouse.offsetY
458 });
459
460 // mouse position last events
461 mouse.lastX = mouse.nowX;
462 mouse.lastY = mouse.nowY;
463 // mouse position this events
464 mouse.nowX = e.pageX;
465 mouse.nowY = e.pageY;
466 // distance mouse moved between events
467 mouse.distX = mouse.nowX - mouse.lastX;
468 mouse.distY = mouse.nowY - mouse.lastY;
469 // direction mouse was moving
470 mouse.lastDirX = mouse.dirX;
471 mouse.lastDirY = mouse.dirY;
472 // direction mouse is now moving (on both axis)
473 mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
474 mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
475 // axis mouse is now moving on
476 var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
477
478 // do nothing on first move
479 if (!mouse.moving) {
480 mouse.dirAx = newAx;
481 mouse.moving = true;
482 return;
483 }
484
485 // calc distance moved on this axis (and direction)
486 if (mouse.dirAx !== newAx) {
487 mouse.distAxX = 0;
488 mouse.distAxY = 0;
489 } else {
490 mouse.distAxX += Math.abs(mouse.distX);
491 if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
492 mouse.distAxX = 0;
493 }
494 mouse.distAxY += Math.abs(mouse.distY);
495 if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
496 mouse.distAxY = 0;
497 }
498 }
499 mouse.dirAx = newAx;
500
501 /**
502 * move horizontal
503 */
504 if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
505 // reset move distance on x-axis for new phase
506 mouse.distAxX = 0;
507 prev = this.placeEl.prev('li');
508
509 // increase horizontal level if previous sibling exists, is not collapsed, and does not have a 'no children' class
510 if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
511
512 // cannot increase level when item above is collapsed
513 list = prev.find(opt._listClass).last();
514
515 // check if depth limit has reached
516 depth = this.placeEl.parents(opt._listClass+','+opt._listBaseClass).length;
517
518 if (depth + this.dragDepth <= maxDepth) {
519
520 // create new sub-level if one doesn't exist
521 if (!list.length) {
522 list = UI.$('<ul/>').addClass(opt.listClass);
523 list.append(this.placeEl);
524 prev.append(list);
525 this.setParent(prev);
526 } else {
527 // else append to next level up
528 list = prev.children(opt._listClass).last();
529 list.append(this.placeEl);
530 }
531 }
532 }
533
534 // decrease horizontal level
535 if (mouse.distX < 0) {
536
537 // we cannot decrease the level if an item precedes the current one
538 next = this.placeEl.next(opt._listItemClass);
539 if (!next.length) {
540
541 // get parent ul of the list item
542 var parentUl = this.placeEl.closest([opt._listBaseClass, opt._listClass].join(','));
543 // try to get the li surrounding the ul
544 var surroundingLi = parentUl.closest(opt._listItemClass);
545
546 // if the ul is inside of a li (meaning it is nested)
547 if (surroundingLi.length) {
548 // we can decrease the horizontal level
549 surroundingLi.after(this.placeEl);
550 // if the previous parent ul is now empty
551 if (!parentUl.children().length) {
552 this.unsetParent(surroundingLi);
553 }
554 }
555 }
556 }
557 }
558
559 var isEmpty = false;
560
561 // find list item under cursor
562 var pointX = e.pageX - (window.pageXOffset || document.scrollLeft || 0),
563 pointY = e.pageY - (window.pageYOffset || document.documentElement.scrollTop);
564 this.pointEl = UI.$(document.elementFromPoint(pointX, pointY));
565
566 if (opt.handleClass && this.pointEl.hasClass(opt.handleClass)) {
567
568 this.pointEl = this.pointEl.closest(opt._listItemClass);
569
570 } else {
571
572 var nestableitem = this.pointEl.closest(opt._listItemClass);
573
574 if (nestableitem.length) {
575 this.pointEl = nestableitem;
576 }
577 }
578
579 if (this.placeEl.find(this.pointEl).length) {
580 return;
581 }
582
583 if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
584 isEmpty = true;
585 this.checkEmptyList(this.pointEl);
586 } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listItemClass)) {
587 return;
588 }
589
590 // find parent list of item under cursor
591 var pointElRoot = this.element,
592 tmpRoot = this.pointEl.closest(this.options._listBaseClass),
593 isNewRoot = pointElRoot[0] != tmpRoot[0];
594
595 /**
596 * move vertical
597 */
598 if (!mouse.dirAx || isNewRoot || isEmpty) {
599
600 // check if groups match if dragging over new root
601 if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
602 return;
603 } else {
604 touchedlists.push(pointElRoot);
605 }
606
607 // check depth limit
608 depth = this.dragDepth - 1 + this.pointEl.parents(opt._listClass+','+opt._listBaseClass).length;
609
610 if (depth > maxDepth) {
611 return;
612 }
613
614 var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
615
616 parent = this.placeEl.parent();
617
618 if (isEmpty) {
619 this.pointEl.append(this.placeEl);
620 } else if (before) {
621 this.pointEl.before(this.placeEl);
622 } else {
623 this.pointEl.after(this.placeEl);
624 }
625
626 if (!parent.children().length) {
627 if (!parent.data("nestable")) this.unsetParent(parent.parent());
628 }
629
630 this.checkEmptyList(this.dragRootEl);
631 this.checkEmptyList(pointElRoot);
632
633 // parent root list has changed
634 if (isNewRoot) {
635 this.dragRootEl = tmpRoot;
636 this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
637 }
638 }
639 },
640
641 checkEmptyList: function(list) {
642
643 list = list ? UI.$(list) : this.element;
644
645 if (this.options.emptyClass) {
646 list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
647 }
648 }
649
650 });
651
652 return UI.nestable;
653});
diff --git a/js/components/nestable.min.js b/js/components/nestable.min.js
new file mode 100755
index 0000000..e0d4da2
--- /dev/null
+++ b/js/components/nestable.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var s;window.UIkit&&(s=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-nestable",["uikit"],function(){return s||t(UIkit)})}(function(t){"use strict";var s,e="ontouchstart"in window,i=t.$html,l=[],a=t.$win,n=e?"touchstart":"mousedown",o=e?"touchmove":"mousemove",h=e?"touchend":"mouseup",r=e?"touchcancel":"mouseup";return t.component("nestable",{defaults:{listBaseClass:"uk-nestable",listClass:"uk-nestable-list",listItemClass:"uk-nestable-item",dragClass:"uk-nestable-dragged",movingClass:"uk-nestable-moving",noChildrenClass:"uk-nestable-nochildren",emptyClass:"uk-nestable-empty",handleClass:"",collapsedClass:"uk-collapsed",placeholderClass:"uk-nestable-placeholder",noDragClass:"uk-nestable-nodrag",group:!1,maxDepth:10,threshold:20,idlethreshold:10},boot:function(){t.$html.on("mousemove touchmove",function(){if(s){var e=s.offset().top;e<t.$win.scrollTop()?t.$win.scrollTop(t.$win.scrollTop()-Math.ceil(s.height()/2)):e+s.height()>window.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(s.height()/2))}}),t.ready(function(s){t.$("[data-uk-nestable]",s).each(function(){var s=t.$(this);s.data("nestable")||t.nestable(s,t.Utils.options(s.attr("data-uk-nestable")))})})},init:function(){var i=this;Object.keys(this.options).forEach(function(t){-1!=String(t).indexOf("Class")&&(i.options["_"+t]="."+i.options[t])}),this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass),this.checkEmptyList(),this.reset(),this.element.data("nestable-group",this.options.group||t.Utils.uid("nestable-group")),this.find(this.options._listItemClass).each(function(){i.setParent(t.$(this))}),this.on("click","[data-nestable-action]",function(s){if(!i.dragEl&&(e||0===s.button)){s.preventDefault();var l=t.$(s.currentTarget),a=l.data("nestableAction"),n=l.closest(i.options._listItemClass);"collapse"===a&&i.collapseItem(n),"expand"===a&&i.expandItem(n),"toggle"===a&&i.toggleItem(n)}});var l=function(s){var l=t.$(s.target),a=l.is("a[href]")?l:l.parents("a[href]");s.target!==i.element[0]&&(l.is(i.options._noDragClass)||l.closest(i.options._noDragClass).length||l.is("[data-nestable-action]")||l.closest("[data-nestable-action]").length||(i.options.handleClass&&!l.hasClass(i.options.handleClass)&&i.options.handleClass&&(l=l.closest(i.options._handleClass)),!l.length||i.dragEl||!e&&0!==s.button||e&&1!==s.touches.length||(s.originalEvent&&s.originalEvent.touches&&(s=evt.originalEvent.touches[0]),i.delayMove=function(t){a=!1,t.preventDefault(),i.dragStart(s),i.trigger("start.uk.nestable",[i]),i.delayMove=!1},i.delayMove.x=parseInt(s.pageX,10),i.delayMove.y=parseInt(s.pageY,10),i.delayMove.threshold=i.options.idlethreshold,a.length&&"touchend"==h&&i.one(h,function(){a&&a.attr("href").trim()&&(location.href=a.attr("href"))}),s.preventDefault())))},d=function(t){t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),i.delayMove&&(Math.abs(t.pageX-i.delayMove.x)>i.delayMove.threshold||Math.abs(t.pageY-i.delayMove.y)>i.delayMove.threshold)&&(window.getSelection().toString()?i.delayMove=!1:i.delayMove(t)),i.dragEl&&(t.preventDefault(),i.dragMove(t),i.trigger("move.uk.nestable",[i]))},p=function(t){i.dragEl&&(t.preventDefault(),i.dragStop(e?t.touches[0]:t)),s=!1,i.delayMove=!1};e?(this.element[0].addEventListener(n,l,!1),window.addEventListener(o,d,!1),window.addEventListener(h,p,!1),window.addEventListener(r,p,!1)):(this.on(n,l),a.on(o,d),a.on(h,p))},serialize:function(){var s,e=0,i=this,l=function(s,e){var a=[],n=s.children(i.options._listItemClass);return n.each(function(){for(var s,n,o,h=t.$(this),r={},d=h.children(i.options._listClass),p=0;p<h[0].attributes.length;p++)s=h[0].attributes[p],0===s.name.indexOf("data-")&&(n=s.name.substr(5),o=t.Utils.str2json(s.value),r[n]=o||"false"==s.value||"0"==s.value?o:s.value);d.length&&(r.children=l(d,e+1)),a.push(r)}),a};return s=l(i.element,e)},list:function(s){var e=[],i=this,l=0,a=function(i,l,n){var o=i.children(s._listItemClass);o.each(function(i){var o=t.$(this),h=t.$.extend({parent_id:n?n:null,depth:l,order:i},o.data()),r=o.children(s._listClass);e.push(h),r.length&&a(r,l+1,o.data(s.idProperty||"id"))})};return s=t.$.extend({},i.options,s),a(i.element,l),e},reset:function(){this.mouse={offsetX:0,offsetY:0,startX:0,startY:0,lastX:0,lastY:0,nowX:0,nowY:0,distX:0,distY:0,dirAx:0,dirX:0,dirY:0,lastDirX:0,lastDirY:0,distAxX:0,distAxY:0},this.moving=!1,this.dragEl=null,this.dragRootEl=null,this.dragDepth=0,this.hasNewRoot=!1,this.pointEl=null;for(var t=0;t<l.length;t++)this.checkEmptyList(l[t]);l=[]},toggleItem:function(t){this[t.hasClass(this.options.collapsedClass)?"expandItem":"collapseItem"](t)},expandItem:function(t){t.removeClass(this.options.collapsedClass)},collapseItem:function(t){var s=t.children(this.options._listClass);s.length&&t.addClass(this.options.collapsedClass)},expandAll:function(){var s=this;this.find(s.options._listItemClass).each(function(){s.expandItem(t.$(this))})},collapseAll:function(){var s=this;this.find(s.options._listItemClass).each(function(){s.collapseItem(t.$(this))})},setParent:function(t){t.children(this.options._listClass).length&&t.addClass("uk-parent")},unsetParent:function(t){t.removeClass("uk-parent "+this.options.collapsedClass),t.children(this.options._listClass).remove()},dragStart:function(e){var l=this.mouse,a=t.$(e.target),n=a.closest(this.options._listItemClass),o=n.offset();this.placeEl=n,l.offsetX=e.pageX-o.left,l.offsetY=e.pageY-o.top,l.startX=l.lastX=o.left,l.startY=l.lastY=o.top,this.dragRootEl=this.element,this.dragEl=t.$("<ul></ul>").addClass(this.options.listClass+" "+this.options.dragClass).append(n.clone()),this.dragEl.css("width",n.width()),this.placeEl.addClass(this.options.placeholderClass),s=this.dragEl,this.tmpDragOnSiblings=[n[0].previousSibling,n[0].nextSibling],t.$body.append(this.dragEl),this.dragEl.css({left:o.left,top:o.top});var h,r,d=this.dragEl.find(this.options._listItemClass);for(h=0;h<d.length;h++)r=t.$(d[h]).parents(this.options._listClass+","+this.options._listBaseClass).length,r>this.dragDepth&&(this.dragDepth=r);i.addClass(this.options.movingClass)},dragStop:function(){var s=t.$(this.placeEl),e=this.placeEl.parents(this.options._listBaseClass+":first");this.placeEl.removeClass(this.options.placeholderClass),this.dragEl.remove(),this.element[0]!==e[0]?(e.trigger("change.uk.nestable",[e.data("nestable"),s,"added"]),this.element.trigger("change.uk.nestable",[this,s,"removed"])):this.element.trigger("change.uk.nestable",[this,s,"moved"]),this.trigger("stop.uk.nestable",[this,s]),this.reset(),i.removeClass(this.options.movingClass)},dragMove:function(s){var e,i,a,n,o,h=this.options,r=this.mouse,d=this.dragRootEl?this.dragRootEl.data("nestable").options.maxDepth:h.maxDepth;this.dragEl.css({left:s.pageX-r.offsetX,top:s.pageY-r.offsetY}),r.lastX=r.nowX,r.lastY=r.nowY,r.nowX=s.pageX,r.nowY=s.pageY,r.distX=r.nowX-r.lastX,r.distY=r.nowY-r.lastY,r.lastDirX=r.dirX,r.lastDirY=r.dirY,r.dirX=0===r.distX?0:r.distX>0?1:-1,r.dirY=0===r.distY?0:r.distY>0?1:-1;var p=Math.abs(r.distX)>Math.abs(r.distY)?1:0;if(!r.moving)return r.dirAx=p,r.moving=!0,void 0;if(r.dirAx!==p?(r.distAxX=0,r.distAxY=0):(r.distAxX+=Math.abs(r.distX),0!==r.dirX&&r.dirX!==r.lastDirX&&(r.distAxX=0),r.distAxY+=Math.abs(r.distY),0!==r.dirY&&r.dirY!==r.lastDirY&&(r.distAxY=0)),r.dirAx=p,r.dirAx&&r.distAxX>=h.threshold&&(r.distAxX=0,a=this.placeEl.prev("li"),r.distX>0&&a.length&&!a.hasClass(h.collapsedClass)&&!a.hasClass(h.noChildrenClass)&&(e=a.find(h._listClass).last(),o=this.placeEl.parents(h._listClass+","+h._listBaseClass).length,o+this.dragDepth<=d&&(e.length?(e=a.children(h._listClass).last(),e.append(this.placeEl)):(e=t.$("<ul/>").addClass(h.listClass),e.append(this.placeEl),a.append(e),this.setParent(a)))),r.distX<0&&(n=this.placeEl.next(h._listItemClass),!n.length))){var c=this.placeEl.closest([h._listBaseClass,h._listClass].join(",")),g=c.closest(h._listItemClass);g.length&&(g.after(this.placeEl),c.children().length||this.unsetParent(g))}var u=!1,f=s.pageX-(window.pageXOffset||document.scrollLeft||0),m=s.pageY-(window.pageYOffset||document.documentElement.scrollTop);if(this.pointEl=t.$(document.elementFromPoint(f,m)),h.handleClass&&this.pointEl.hasClass(h.handleClass))this.pointEl=this.pointEl.closest(h._listItemClass);else{var C=this.pointEl.closest(h._listItemClass);C.length&&(this.pointEl=C)}if(!this.placeEl.find(this.pointEl).length){if(this.pointEl.data("nestable")&&!this.pointEl.children().length)u=!0,this.checkEmptyList(this.pointEl);else if(!this.pointEl.length||!this.pointEl.hasClass(h.listItemClass))return;var v=this.element,E=this.pointEl.closest(this.options._listBaseClass),b=v[0]!=E[0];if(!r.dirAx||b||u){if(b&&h.group!==E.data("nestable-group"))return;if(l.push(v),o=this.dragDepth-1+this.pointEl.parents(h._listClass+","+h._listBaseClass).length,o>d)return;var X=s.pageY<this.pointEl.offset().top+this.pointEl.height()/2;i=this.placeEl.parent(),u?this.pointEl.append(this.placeEl):X?this.pointEl.before(this.placeEl):this.pointEl.after(this.placeEl),i.children().length||i.data("nestable")||this.unsetParent(i.parent()),this.checkEmptyList(this.dragRootEl),this.checkEmptyList(v),b&&(this.dragRootEl=E,this.hasNewRoot=this.element[0]!==this.dragRootEl[0])}}},checkEmptyList:function(s){s=s?t.$(s):this.element,this.options.emptyClass&&s[s.children().length?"removeClass":"addClass"](this.options.emptyClass)}}),t.nestable}); \ No newline at end of file
diff --git a/js/components/notify.js b/js/components/notify.js
new file mode 100755
index 0000000..d67be84
--- /dev/null
+++ b/js/components/notify.js
@@ -0,0 +1,189 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-notify", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var containers = {},
21 messages = {},
22
23 notify = function(options){
24
25 if (UI.$.type(options) == 'string') {
26 options = { message: options };
27 }
28
29 if (arguments[1]) {
30 options = UI.$.extend(options, UI.$.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
31 }
32
33 return (new Message(options)).show();
34 },
35 closeAll = function(group, instantly){
36
37 var id;
38
39 if (group) {
40 for(id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
41 } else {
42 for(id in messages) { messages[id].close(instantly); }
43 }
44 };
45
46 var Message = function(options){
47
48 this.options = UI.$.extend({}, Message.defaults, options);
49
50 this.uuid = UI.Utils.uid("notifymsg");
51 this.element = UI.$([
52
53 '<div class="uk-notify-message">',
54 '<a class="uk-close"></a>',
55 '<div></div>',
56 '</div>'
57
58 ].join('')).data("notifyMessage", this);
59
60 this.content(this.options.message);
61
62 // status
63 if (this.options.status) {
64 this.element.addClass('uk-notify-message-'+this.options.status);
65 this.currentstatus = this.options.status;
66 }
67
68 this.group = this.options.group;
69
70 messages[this.uuid] = this;
71
72 if(!containers[this.options.pos]) {
73 containers[this.options.pos] = UI.$('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
74
75 var message = UI.$(this).data("notifyMessage");
76
77 message.element.trigger('manualclose.uk.notify', [message]);
78 message.close();
79 });
80 }
81 };
82
83
84 UI.$.extend(Message.prototype, {
85
86 uuid: false,
87 element: false,
88 timout: false,
89 currentstatus: "",
90 group: false,
91
92 show: function() {
93
94 if (this.element.is(":visible")) return;
95
96 var $this = this;
97
98 containers[this.options.pos].show().prepend(this.element);
99
100 var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
101
102 this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
103
104 if ($this.options.timeout) {
105
106 var closefn = function(){ $this.close(); };
107
108 $this.timeout = setTimeout(closefn, $this.options.timeout);
109
110 $this.element.hover(
111 function() { clearTimeout($this.timeout); },
112 function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
113 );
114 }
115
116 });
117
118 return this;
119 },
120
121 close: function(instantly) {
122
123 var $this = this,
124 finalize = function(){
125 $this.element.remove();
126
127 if (!containers[$this.options.pos].children().length) {
128 containers[$this.options.pos].hide();
129 }
130
131 $this.options.onClose.apply($this, []);
132 $this.element.trigger('close.uk.notify', [$this]);
133
134 delete messages[$this.uuid];
135 };
136
137 if (this.timeout) clearTimeout(this.timeout);
138
139 if (instantly) {
140 finalize();
141 } else {
142 this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
143 finalize();
144 });
145 }
146 },
147
148 content: function(html){
149
150 var container = this.element.find(">div");
151
152 if(!html) {
153 return container.html();
154 }
155
156 container.html(html);
157
158 return this;
159 },
160
161 status: function(status) {
162
163 if (!status) {
164 return this.currentstatus;
165 }
166
167 this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
168
169 this.currentstatus = status;
170
171 return this;
172 }
173 });
174
175 Message.defaults = {
176 message: "",
177 status: "",
178 timeout: 5000,
179 group: null,
180 pos: 'top-center',
181 onClose: function() {}
182 };
183
184 UI.notify = notify;
185 UI.notify.message = Message;
186 UI.notify.closeAll = closeAll;
187
188 return notify;
189});
diff --git a/js/components/notify.min.js b/js/components/notify.min.js
new file mode 100755
index 0000000..6c24ebb
--- /dev/null
+++ b/js/components/notify.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-notify",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e={},i={},s=function(e){return"string"==t.$.type(e)&&(e={message:e}),arguments[1]&&(e=t.$.extend(e,"string"==t.$.type(arguments[1])?{status:arguments[1]}:arguments[1])),new n(e).show()},o=function(t,e){var s;if(t)for(s in i)t===i[s].group&&i[s].close(e);else for(s in i)i[s].close(e)},n=function(s){this.options=t.$.extend({},n.defaults,s),this.uuid=t.Utils.uid("notifymsg"),this.element=t.$(['<div class="uk-notify-message">','<a class="uk-close"></a>',"<div></div>","</div>"].join("")).data("notifyMessage",this),this.content(this.options.message),this.options.status&&(this.element.addClass("uk-notify-message-"+this.options.status),this.currentstatus=this.options.status),this.group=this.options.group,i[this.uuid]=this,e[this.options.pos]||(e[this.options.pos]=t.$('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo("body").on("click",".uk-notify-message",function(){var e=t.$(this).data("notifyMessage");e.element.trigger("manualclose.uk.notify",[e]),e.close()}))};return t.$.extend(n.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var t=this;e[this.options.pos].show().prepend(this.element);var i=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":i},function(){if(t.options.timeout){var e=function(){t.close()};t.timeout=setTimeout(e,t.options.timeout),t.element.hover(function(){clearTimeout(t.timeout)},function(){t.timeout=setTimeout(e,t.options.timeout)})}}),this}},close:function(t){var s=this,o=function(){s.element.remove(),e[s.options.pos].children().length||e[s.options.pos].hide(),s.options.onClose.apply(s,[]),s.element.trigger("close.uk.notify",[s]),delete i[s.uuid]};this.timeout&&clearTimeout(this.timeout),t?o():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){o()})},content:function(t){var e=this.element.find(">div");return t?(e.html(t),this):e.html()},status:function(t){return t?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+t),this.currentstatus=t,this):this.currentstatus}}),n.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center",onClose:function(){}},t.notify=s,t.notify.message=n,t.notify.closeAll=o,s}); \ No newline at end of file
diff --git a/js/components/pagination.js b/js/components/pagination.js
new file mode 100755
index 0000000..f5a8478
--- /dev/null
+++ b/js/components/pagination.js
@@ -0,0 +1,147 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2/*
3 * Based on simplePagination - Copyright (c) 2012 Flavius Matis - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
4 */
5(function(addon) {
6
7 var component;
8
9 if (window.UIkit) {
10 component = addon(UIkit);
11 }
12
13 if (typeof define == "function" && define.amd) {
14 define("uikit-pagination", ["uikit"], function(){
15 return component || addon(UIkit);
16 });
17 }
18
19})(function(UI){
20
21 "use strict";
22
23 UI.component('pagination', {
24
25 defaults: {
26 items : 1,
27 itemsOnPage : 1,
28 pages : 0,
29 displayedPages : 7,
30 edges : 1,
31 currentPage : 0,
32 lblPrev : false,
33 lblNext : false,
34 onSelectPage : function() {}
35 },
36
37 boot: function() {
38
39 // init code
40 UI.ready(function(context) {
41
42 UI.$("[data-uk-pagination]", context).each(function(){
43 var ele = UI.$(this);
44
45 if (!ele.data("pagination")) {
46 UI.pagination(ele, UI.Utils.options(ele.attr("data-uk-pagination")));
47 }
48 });
49 });
50 },
51
52 init: function() {
53
54 var $this = this;
55
56 this.pages = this.options.pages ? this.options.pages : Math.ceil(this.options.items / this.options.itemsOnPage) ? Math.ceil(this.options.items / this.options.itemsOnPage) : 1;
57 this.currentPage = this.options.currentPage;
58 this.halfDisplayed = this.options.displayedPages / 2;
59
60 this.on("click", "a[data-page]", function(e){
61 e.preventDefault();
62 $this.selectPage(UI.$(this).data("page"));
63 });
64
65 this._render();
66 },
67
68 _getInterval: function() {
69
70 return {
71 start: Math.ceil(this.currentPage > this.halfDisplayed ? Math.max(Math.min(this.currentPage - this.halfDisplayed, (this.pages - this.options.displayedPages)), 0) : 0),
72 end : Math.ceil(this.currentPage > this.halfDisplayed ? Math.min(this.currentPage + this.halfDisplayed, this.pages) : Math.min(this.options.displayedPages, this.pages))
73 };
74 },
75
76 render: function(pages) {
77 this.pages = pages ? pages : this.pages;
78 this._render();
79 },
80
81 selectPage: function(pageIndex, pages) {
82 this.currentPage = pageIndex;
83 this.render(pages);
84
85 this.options.onSelectPage.apply(this, [pageIndex]);
86 this.trigger('select.uk.pagination', [pageIndex, this]);
87 },
88
89 _render: function() {
90
91 var o = this.options, interval = this._getInterval(), i;
92
93 this.element.empty();
94
95 // Generate Prev link
96 if (o.lblPrev) this._append(this.currentPage - 1, {text: o.lblPrev});
97
98 // Generate start edges
99 if (interval.start > 0 && o.edges > 0) {
100
101 var end = Math.min(o.edges, interval.start);
102
103 for (i = 0; i < end; i++) this._append(i);
104
105 if (o.edges < interval.start && (interval.start - o.edges != 1)) {
106 this.element.append('<li><span>...</span></li>');
107 } else if (interval.start - o.edges == 1) {
108 this._append(o.edges);
109 }
110 }
111
112 // Generate interval links
113 for (i = interval.start; i < interval.end; i++) this._append(i);
114
115 // Generate end edges
116 if (interval.end < this.pages && o.edges > 0) {
117
118 if (this.pages - o.edges > interval.end && (this.pages - o.edges - interval.end != 1)) {
119 this.element.append('<li><span>...</span></li>');
120 } else if (this.pages - o.edges - interval.end == 1) {
121 this._append(interval.end++);
122 }
123
124 var begin = Math.max(this.pages - o.edges, interval.end);
125
126 for (i = begin; i < this.pages; i++) this._append(i);
127 }
128
129 // Generate Next link (unless option is set for at front)
130 if (o.lblNext) this._append(this.currentPage + 1, {text: o.lblNext});
131 },
132
133 _append: function(pageIndex, opts) {
134
135 var item, options;
136
137 pageIndex = pageIndex < 0 ? 0 : (pageIndex < this.pages ? pageIndex : this.pages - 1);
138 options = UI.$.extend({ text: pageIndex + 1 }, opts);
139
140 item = (pageIndex == this.currentPage) ? '<li class="uk-active"><span>' + (options.text) + '</span></li>' : '<li><a href="#page-'+(pageIndex+1)+'" data-page="'+pageIndex+'">'+options.text+'</a></li>';
141
142 this.element.append(item);
143 }
144 });
145
146 return UI.pagination;
147});
diff --git a/js/components/pagination.min.js b/js/components/pagination.min.js
new file mode 100755
index 0000000..7361066
--- /dev/null
+++ b/js/components/pagination.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-pagination",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";return t.component("pagination",{defaults:{items:1,itemsOnPage:1,pages:0,displayedPages:7,edges:1,currentPage:0,lblPrev:!1,lblNext:!1,onSelectPage:function(){}},boot:function(){t.ready(function(e){t.$("[data-uk-pagination]",e).each(function(){var e=t.$(this);e.data("pagination")||t.pagination(e,t.Utils.options(e.attr("data-uk-pagination")))})})},init:function(){var e=this;this.pages=this.options.pages?this.options.pages:Math.ceil(this.options.items/this.options.itemsOnPage)?Math.ceil(this.options.items/this.options.itemsOnPage):1,this.currentPage=this.options.currentPage,this.halfDisplayed=this.options.displayedPages/2,this.on("click","a[data-page]",function(i){i.preventDefault(),e.selectPage(t.$(this).data("page"))}),this._render()},_getInterval:function(){return{start:Math.ceil(this.currentPage>this.halfDisplayed?Math.max(Math.min(this.currentPage-this.halfDisplayed,this.pages-this.options.displayedPages),0):0),end:Math.ceil(this.currentPage>this.halfDisplayed?Math.min(this.currentPage+this.halfDisplayed,this.pages):Math.min(this.options.displayedPages,this.pages))}},render:function(t){this.pages=t?t:this.pages,this._render()},selectPage:function(t,e){this.currentPage=t,this.render(e),this.options.onSelectPage.apply(this,[t]),this.trigger("select.uk.pagination",[t,this])},_render:function(){var t,e=this.options,i=this._getInterval();if(this.element.empty(),e.lblPrev&&this._append(this.currentPage-1,{text:e.lblPrev}),i.start>0&&e.edges>0){var s=Math.min(e.edges,i.start);for(t=0;s>t;t++)this._append(t);e.edges<i.start&&i.start-e.edges!=1?this.element.append("<li><span>...</span></li>"):i.start-e.edges==1&&this._append(e.edges)}for(t=i.start;t<i.end;t++)this._append(t);if(i.end<this.pages&&e.edges>0){this.pages-e.edges>i.end&&this.pages-e.edges-i.end!=1?this.element.append("<li><span>...</span></li>"):this.pages-e.edges-i.end==1&&this._append(i.end++);var a=Math.max(this.pages-e.edges,i.end);for(t=a;t<this.pages;t++)this._append(t)}e.lblNext&&this._append(this.currentPage+1,{text:e.lblNext})},_append:function(e,i){var s,a;e=0>e?0:e<this.pages?e:this.pages-1,a=t.$.extend({text:e+1},i),s=e==this.currentPage?'<li class="uk-active"><span>'+a.text+"</span></li>":'<li><a href="#page-'+(e+1)+'" data-page="'+e+'">'+a.text+"</a></li>",this.element.append(s)}}),t.pagination}); \ No newline at end of file
diff --git a/js/components/parallax.js b/js/components/parallax.js
new file mode 100755
index 0000000..e706abb
--- /dev/null
+++ b/js/components/parallax.js
@@ -0,0 +1,462 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-parallax", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var parallaxes = [],
21 supports3d = false,
22 scrolltop = 0,
23 wh = window.innerHeight,
24 checkParallaxes = function() {
25
26 scrolltop = UI.$win.scrollTop();
27
28 window.requestAnimationFrame(function(){
29 for (var i=0; i < parallaxes.length; i++) {
30 parallaxes[i].process();
31 }
32 });
33 };
34
35
36 UI.component('parallax', {
37
38 defaults: {
39 velocity : 0.5,
40 target : false,
41 viewport : false,
42 media : false
43 },
44
45 boot: function() {
46
47 supports3d = (function(){
48
49 var el = document.createElement('div'),
50 has3d,
51 transforms = {
52 'WebkitTransform':'-webkit-transform',
53 'MSTransform':'-ms-transform',
54 'MozTransform':'-moz-transform',
55 'Transform':'transform'
56 };
57
58 // Add it to the body to get the computed style.
59 document.body.insertBefore(el, null);
60
61 for (var t in transforms) {
62 if (el.style[t] !== undefined) {
63 el.style[t] = "translate3d(1px,1px,1px)";
64 has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
65 }
66 }
67
68 document.body.removeChild(el);
69
70 return (has3d !== undefined && has3d.length > 0 && has3d !== "none");
71 })();
72
73 // listen to scroll and resize
74 UI.$doc.on("scrolling.uk.document", checkParallaxes);
75 UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
76 wh = window.innerHeight;
77 checkParallaxes();
78 }, 50));
79
80 // init code
81 UI.ready(function(context) {
82
83 UI.$('[data-uk-parallax]', context).each(function() {
84
85 var parallax = UI.$(this);
86
87 if (!parallax.data("parallax")) {
88 UI.parallax(parallax, UI.Utils.options(parallax.attr("data-uk-parallax")));
89 }
90 });
91 });
92 },
93
94 init: function() {
95
96 this.base = this.options.target ? UI.$(this.options.target) : this.element;
97 this.props = {};
98 this.velocity = (this.options.velocity || 1);
99
100 var reserved = ['target','velocity','viewport','plugins','media'];
101
102 Object.keys(this.options).forEach(function(prop){
103
104 if (reserved.indexOf(prop) !== -1) {
105 return;
106 }
107
108 var start, end, dir, diff, startend = String(this.options[prop]).split(',');
109
110 if (prop.match(/color/i)) {
111 start = startend[1] ? startend[0] : this._getStartValue(prop),
112 end = startend[1] ? startend[1] : startend[0];
113
114 if (!start) {
115 start = 'rgba(255,255,255,0)';
116 }
117
118 } else {
119 start = parseFloat(startend[1] ? startend[0] : this._getStartValue(prop)),
120 end = parseFloat(startend[1] ? startend[1] : startend[0]);
121 diff = (start < end ? (end-start):(start-end));
122 dir = (start < end ? 1:-1);
123 }
124
125 this.props[prop] = { 'start': start, 'end': end, 'dir': dir, 'diff': diff };
126
127 }.bind(this));
128
129 parallaxes.push(this);
130 },
131
132 process: function() {
133
134 if (this.options.media) {
135
136 switch(typeof(this.options.media)) {
137 case 'number':
138 if (window.innerWidth < this.options.media) {
139 return false;
140 }
141 break;
142 case 'string':
143 if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
144 return false;
145 }
146 break;
147 }
148 }
149
150 var percent = this.percentageInViewport();
151
152 if (this.options.viewport !== false) {
153 percent = (this.options.viewport === 0) ? 1 : percent / this.options.viewport;
154 }
155
156 this.update(percent);
157 },
158
159 percentageInViewport: function() {
160
161 var top = this.base.offset().top,
162 height = this.base.outerHeight(),
163 distance, percentage, percent;
164
165 if (top > (scrolltop + wh)) {
166 percent = 0;
167 } else if ((top + height) < scrolltop) {
168 percent = 1;
169 } else {
170
171 if ((top + height) < wh) {
172
173 percent = (scrolltop < wh ? scrolltop : scrolltop - wh) / (top+height);
174
175 } else {
176
177 distance = (scrolltop + wh) - top;
178 percentage = Math.round(distance / ((wh + height) / 100));
179 percent = percentage/100;
180 }
181 }
182
183 return percent;
184 },
185
186 update: function(percent) {
187
188 var $this = this,
189 css = {transform:'', filter:''},
190 compercent = percent * (1 - (this.velocity - (this.velocity * percent))),
191 opts, val;
192
193 if (compercent < 0) compercent = 0;
194 if (compercent > 1) compercent = 1;
195
196 if (this._percent !== undefined && this._percent == compercent) {
197 return;
198 }
199
200 Object.keys(this.props).forEach(function(prop) {
201
202 opts = this.props[prop];
203
204 if (percent === 0) {
205 val = opts.start;
206 } else if(percent === 1) {
207 val = opts.end;
208 } else if(opts.diff !== undefined) {
209 val = opts.start + (opts.diff * compercent * opts.dir);
210 }
211
212 if ((prop == 'bg' || prop == 'bgp') && !this._bgcover) {
213 this._bgcover = initBgImageParallax(this, prop, opts);
214 }
215
216 switch(prop) {
217
218 // transforms
219 case 'x':
220 css.transform += supports3d ? ' translate3d('+val+'px, 0, 0)':' translateX('+val+'px)';
221 break;
222 case 'xp':
223 css.transform += supports3d ? ' translate3d('+val+'%, 0, 0)':' translateX('+val+'%)';
224 break;
225 case 'y':
226 css.transform += supports3d ? ' translate3d(0, '+val+'px, 0)':' translateY('+val+'px)';
227 break;
228 case 'yp':
229 css.transform += supports3d ? ' translate3d(0, '+val+'%, 0)':' translateY('+val+'%)';
230 break;
231 case 'rotate':
232 css.transform += ' rotate('+val+'deg)';
233 break;
234 case 'scale':
235 css.transform += ' scale('+val+')';
236 break;
237
238 // bg image
239 case 'bg':
240
241 // don't move if image height is too small
242 // if ($this.element.data('bgsize') && ($this.element.data('bgsize').h + val - window.innerHeight) < 0) {
243 // break;
244 // }
245
246 css['background-position'] = '50% '+val+'px';
247 break;
248 case 'bgp':
249 css['background-position'] = '50% '+val+'%';
250 break;
251
252 // color
253 case 'color':
254 case 'background-color':
255 case 'border-color':
256 css[prop] = calcColor(opts.start, opts.end, compercent);
257 break;
258
259 // CSS Filter
260 case 'blur':
261 css.filter += ' blur('+val+'px)';
262 break;
263 case 'hue':
264 css.filter += ' hue-rotate('+val+'deg)';
265 break;
266 case 'grayscale':
267 css.filter += ' grayscale('+val+'%)';
268 break;
269 case 'invert':
270 css.filter += ' invert('+val+'%)';
271 break;
272 case 'fopacity':
273 css.filter += ' opacity('+val+'%)';
274 break;
275 case 'saturate':
276 css.filter += ' saturate('+val+'%)';
277 break;
278 case 'sepia':
279 css.filter += ' sepia('+val+'%)';
280 break;
281
282 default:
283 css[prop] = val;
284 break;
285 }
286
287 }.bind(this));
288
289 if (css.filter) {
290 css['-webkit-filter'] = css.filter;
291 }
292
293 this.element.css(css);
294
295 this._percent = compercent;
296 },
297
298 _getStartValue: function(prop) {
299
300 var value = 0;
301
302 switch(prop) {
303 case 'scale':
304 value = 1;
305 break;
306 default:
307 value = this.element.css(prop);
308 }
309
310 return (value || 0);
311 }
312
313 });
314
315
316 // helper
317
318 function initBgImageParallax(obj, prop, opts) {
319
320 var img = new Image(), url, element, size, check, ratio, width, height;
321
322 element = obj.element.css({'background-size': 'cover', 'background-repeat': 'no-repeat'});
323 url = element.css('background-image').replace(/^url\(/g, '').replace(/\)$/g, '').replace(/("|')/g, '');
324 check = function() {
325
326 var w = element.innerWidth(), h = element.innerHeight(), extra = (prop=='bg') ? opts.diff : (opts.diff/100) * h;
327
328 h += extra;
329 w += Math.ceil(extra * ratio);
330
331 if (w-extra < size.w && h < size.h) {
332 return obj.element.css({'background-size': 'auto'});
333 }
334
335 // if element height < parent height (gap underneath)
336 if ((w / ratio) < h) {
337
338 width = Math.ceil(h * ratio);
339 height = h;
340
341 if (h > window.innerHeight) {
342 width = width * 1.2;
343 height = height * 1.2;
344 }
345
346 // element width < parent width (gap to right)
347 } else {
348
349 width = w;
350 height = Math.ceil(w / ratio);
351 }
352
353 element.css({'background-size': (width+'px '+height+'px')}).data('bgsize', {w:width,h:height});
354 };
355
356 img.onerror = function(){
357 // image url doesn't exist
358 };
359
360 img.onload = function(){
361 size = {w:img.width, h:img.height};
362 ratio = img.width / img.height;
363
364 UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
365 check();
366 }, 50));
367
368 check();
369 };
370
371 img.src = url;
372
373 return true;
374 }
375
376
377 // Some named colors to work with, added by Bradley Ayers
378 // From Interface by Stefan Petre
379 // http://interface.eyecon.ro/
380 var colors = {
381 'black': [0,0,0,1],
382 'blue': [0,0,255,1],
383 'brown': [165,42,42,1],
384 'cyan': [0,255,255,1],
385 'fuchsia': [255,0,255,1],
386 'gold': [255,215,0,1],
387 'green': [0,128,0,1],
388 'indigo': [75,0,130,1],
389 'khaki': [240,230,140,1],
390 'lime': [0,255,0,1],
391 'magenta': [255,0,255,1],
392 'maroon': [128,0,0,1],
393 'navy': [0,0,128,1],
394 'olive': [128,128,0,1],
395 'orange': [255,165,0,1],
396 'pink': [255,192,203,1],
397 'purple': [128,0,128,1],
398 'violet': [128,0,128,1],
399 'red': [255,0,0,1],
400 'silver': [192,192,192,1],
401 'white': [255,255,255,1],
402 'yellow': [255,255,0,1],
403 'transparent': [255,255,255,0]
404 };
405
406 function calcColor(start, end, pos) {
407
408 start = parseColor(start);
409 end = parseColor(end);
410 pos = pos || 0;
411
412 return calculateColor(start, end, pos);
413 }
414
415 /**!
416 * @preserve Color animation 1.6.0
417 * http://www.bitstorm.org/jquery/color-animation/
418 * Copyright 2011, 2013 Edwin Martin <edwin@bitstorm.org>
419 * Released under the MIT and GPL licenses.
420 */
421
422 // Calculate an in-between color. Returns "#aabbcc"-like string.
423 function calculateColor(begin, end, pos) {
424 var color = 'rgba('
425 + parseInt((begin[0] + pos * (end[0] - begin[0])), 10) + ','
426 + parseInt((begin[1] + pos * (end[1] - begin[1])), 10) + ','
427 + parseInt((begin[2] + pos * (end[2] - begin[2])), 10) + ','
428 + (begin && end ? parseFloat(begin[3] + pos * (end[3] - begin[3])) : 1);
429
430 color += ')';
431 return color;
432 }
433
434 // Parse an CSS-syntax color. Outputs an array [r, g, b]
435 function parseColor(color) {
436
437 var match, quadruplet;
438
439 // Match #aabbcc
440 if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) {
441 quadruplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1];
442
443 // Match #abc
444 } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) {
445 quadruplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1];
446
447 // Match rgb(n, n, n)
448 } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
449 quadruplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1];
450
451 } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)) {
452 quadruplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])];
453
454 // No browser returns rgb(n%, n%, n%), so little reason to support this format.
455 } else {
456 quadruplet = colors[color] || [255,255,255,0];
457 }
458 return quadruplet;
459 }
460
461 return UI.parallax;
462});
diff --git a/js/components/parallax.min.js b/js/components/parallax.min.js
new file mode 100755
index 0000000..aa290a1
--- /dev/null
+++ b/js/components/parallax.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(e){var t;window.UIkit&&(t=e(UIkit)),"function"==typeof define&&define.amd&&define("uikit-parallax",["uikit"],function(){return t||e(UIkit)})}(function(e){"use strict";function t(t,a,r){var i,n,s,o,c,l,p,f=new Image;return n=t.element.css({"background-size":"cover","background-repeat":"no-repeat"}),i=n.css("background-image").replace(/^url\(/g,"").replace(/\)$/g,"").replace(/("|')/g,""),o=function(){var e=n.innerWidth(),i=n.innerHeight(),o="bg"==a?r.diff:r.diff/100*i;return i+=o,e+=Math.ceil(o*c),e-o<s.w&&i<s.h?t.element.css({"background-size":"auto"}):(i>e/c?(l=Math.ceil(i*c),p=i,i>window.innerHeight&&(l=1.2*l,p=1.2*p)):(l=e,p=Math.ceil(e/c)),n.css({"background-size":l+"px "+p+"px"}).data("bgsize",{w:l,h:p}),void 0)},f.onerror=function(){},f.onload=function(){s={w:f.width,h:f.height},c=f.width/f.height,e.$win.on("load resize orientationchange",e.Utils.debounce(function(){o()},50)),o()},f.src=i,!0}function a(e,t,a){return e=i(e),t=i(t),a=a||0,r(e,t,a)}function r(e,t,a){var r="rgba("+parseInt(e[0]+a*(t[0]-e[0]),10)+","+parseInt(e[1]+a*(t[1]-e[1]),10)+","+parseInt(e[2]+a*(t[2]-e[2]),10)+","+(e&&t?parseFloat(e[3]+a*(t[3]-e[3])):1);return r+=")"}function i(e){var t,a;return a=(t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),1]:(t=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(e))?[17*parseInt(t[1],16),17*parseInt(t[2],16),17*parseInt(t[3],16),1]:(t=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),1]:(t=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(e))?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4])]:p[e]||[255,255,255,0]}var n=[],s=!1,o=0,c=window.innerHeight,l=function(){o=e.$win.scrollTop(),window.requestAnimationFrame(function(){for(var e=0;e<n.length;e++)n[e].process()})};e.component("parallax",{defaults:{velocity:.5,target:!1,viewport:!1,media:!1},boot:function(){s=function(){var e,t=document.createElement("div"),a={WebkitTransform:"-webkit-transform",MSTransform:"-ms-transform",MozTransform:"-moz-transform",Transform:"transform"};document.body.insertBefore(t,null);for(var r in a)void 0!==t.style[r]&&(t.style[r]="translate3d(1px,1px,1px)",e=window.getComputedStyle(t).getPropertyValue(a[r]));return document.body.removeChild(t),void 0!==e&&e.length>0&&"none"!==e}(),e.$doc.on("scrolling.uk.document",l),e.$win.on("load resize orientationchange",e.Utils.debounce(function(){c=window.innerHeight,l()},50)),e.ready(function(t){e.$("[data-uk-parallax]",t).each(function(){var t=e.$(this);t.data("parallax")||e.parallax(t,e.Utils.options(t.attr("data-uk-parallax")))})})},init:function(){this.base=this.options.target?e.$(this.options.target):this.element,this.props={},this.velocity=this.options.velocity||1;var t=["target","velocity","viewport","plugins","media"];Object.keys(this.options).forEach(function(e){if(-1===t.indexOf(e)){var a,r,i,n,s=String(this.options[e]).split(",");e.match(/color/i)?(a=s[1]?s[0]:this._getStartValue(e),r=s[1]?s[1]:s[0],a||(a="rgba(255,255,255,0)")):(a=parseFloat(s[1]?s[0]:this._getStartValue(e)),r=parseFloat(s[1]?s[1]:s[0]),n=r>a?r-a:a-r,i=r>a?1:-1),this.props[e]={start:a,end:r,dir:i,diff:n}}}.bind(this)),n.push(this)},process:function(){if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidth<this.options.media)return!1;break;case"string":if(window.matchMedia&&!window.matchMedia(this.options.media).matches)return!1}var e=this.percentageInViewport();this.options.viewport!==!1&&(e=0===this.options.viewport?1:e/this.options.viewport),this.update(e)},percentageInViewport:function(){var e,t,a,r=this.base.offset().top,i=this.base.outerHeight();return r>o+c?a=0:o>r+i?a=1:c>r+i?a=(c>o?o:o-c)/(r+i):(e=o+c-r,t=Math.round(e/((c+i)/100)),a=t/100),a},update:function(e){var r,i,n={transform:"",filter:""},o=e*(1-(this.velocity-this.velocity*e));0>o&&(o=0),o>1&&(o=1),(void 0===this._percent||this._percent!=o)&&(Object.keys(this.props).forEach(function(c){switch(r=this.props[c],0===e?i=r.start:1===e?i=r.end:void 0!==r.diff&&(i=r.start+r.diff*o*r.dir),"bg"!=c&&"bgp"!=c||this._bgcover||(this._bgcover=t(this,c,r)),c){case"x":n.transform+=s?" translate3d("+i+"px, 0, 0)":" translateX("+i+"px)";break;case"xp":n.transform+=s?" translate3d("+i+"%, 0, 0)":" translateX("+i+"%)";break;case"y":n.transform+=s?" translate3d(0, "+i+"px, 0)":" translateY("+i+"px)";break;case"yp":n.transform+=s?" translate3d(0, "+i+"%, 0)":" translateY("+i+"%)";break;case"rotate":n.transform+=" rotate("+i+"deg)";break;case"scale":n.transform+=" scale("+i+")";break;case"bg":n["background-position"]="50% "+i+"px";break;case"bgp":n["background-position"]="50% "+i+"%";break;case"color":case"background-color":case"border-color":n[c]=a(r.start,r.end,o);break;case"blur":n.filter+=" blur("+i+"px)";break;case"hue":n.filter+=" hue-rotate("+i+"deg)";break;case"grayscale":n.filter+=" grayscale("+i+"%)";break;case"invert":n.filter+=" invert("+i+"%)";break;case"fopacity":n.filter+=" opacity("+i+"%)";break;case"saturate":n.filter+=" saturate("+i+"%)";break;case"sepia":n.filter+=" sepia("+i+"%)";break;default:n[c]=i}}.bind(this)),n.filter&&(n["-webkit-filter"]=n.filter),this.element.css(n),this._percent=o)},_getStartValue:function(e){var t=0;switch(e){case"scale":t=1;break;default:t=this.element.css(e)}return t||0}});var p={black:[0,0,0,1],blue:[0,0,255,1],brown:[165,42,42,1],cyan:[0,255,255,1],fuchsia:[255,0,255,1],gold:[255,215,0,1],green:[0,128,0,1],indigo:[75,0,130,1],khaki:[240,230,140,1],lime:[0,255,0,1],magenta:[255,0,255,1],maroon:[128,0,0,1],navy:[0,0,128,1],olive:[128,128,0,1],orange:[255,165,0,1],pink:[255,192,203,1],purple:[128,0,128,1],violet:[128,0,128,1],red:[255,0,0,1],silver:[192,192,192,1],white:[255,255,255,1],yellow:[255,255,0,1],transparent:[255,255,255,0]};return e.parallax}); \ No newline at end of file
diff --git a/js/components/search.js b/js/components/search.js
new file mode 100755
index 0000000..6f8a46e
--- /dev/null
+++ b/js/components/search.js
@@ -0,0 +1,92 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-search", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 UI.component('search', {
21 defaults: {
22 msgResultsHeader : 'Search Results',
23 msgMoreResults : 'More Results',
24 msgNoResults : 'No results found',
25 template : '<ul class="uk-nav uk-nav-search uk-autocomplete-results">\
26 {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}}\
27 {{#items && items.length}}\
28 {{~items}}\
29 <li data-url="{{!$item.url}}">\
30 <a href="{{!$item.url}}">\
31 {{{$item.title}}}\
32 {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}}\
33 </a>\
34 </li>\
35 {{/items}}\
36 {{#msgMoreResults}}\
37 <li class="uk-nav-divider uk-skip"></li>\
38 <li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li>\
39 {{/msgMoreResults}}\
40 {{/end}}\
41 {{^items.length}}\
42 {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}}\
43 {{/end}}\
44 </ul>',
45
46 renderer: function(data) {
47
48 var opts = this.options;
49
50 this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults}));
51 this.show();
52 }
53 },
54
55 boot: function() {
56
57 // init code
58 UI.$html.on("focus.search.uikit", "[data-uk-search]", function(e) {
59 var ele =UI.$(this);
60
61 if (!ele.data("search")) {
62 UI.search(ele, UI.Utils.options(ele.attr("data-uk-search")));
63 }
64 });
65 },
66
67 init: function() {
68 var $this = this;
69
70 this.autocomplete = UI.autocomplete(this.element, this.options);
71
72 this.autocomplete.dropdown.addClass('uk-dropdown-search');
73
74 this.autocomplete.input.on("keyup", function(){
75 $this.element[$this.autocomplete.input.val() ? "addClass":"removeClass"]("uk-active");
76 }).closest("form").on("reset", function(){
77 $this.value="";
78 $this.element.removeClass("uk-active");
79 });
80
81 this.on('selectitem.uk.autocomplete', function(e, data) {
82 if (data.url) {
83 location.href = data.url;
84 } else if(data.moreresults) {
85 $this.autocomplete.input.closest('form').submit();
86 }
87 });
88
89 this.element.data("search", this);
90 }
91 });
92});
diff --git a/js/components/search.min.js b/js/components/search.min.js
new file mode 100755
index 0000000..d74b4ac
--- /dev/null
+++ b/js/components/search.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(e){var s;window.UIkit&&(s=e(UIkit)),"function"==typeof define&&define.amd&&define("uikit-search",["uikit"],function(){return s||e(UIkit)})}(function(e){"use strict";e.component("search",{defaults:{msgResultsHeader:"Search Results",msgMoreResults:"More Results",msgNoResults:"No results found",template:'<ul class="uk-nav uk-nav-search uk-autocomplete-results"> {{#msgResultsHeader}}<li class="uk-nav-header uk-skip">{{msgResultsHeader}}</li>{{/msgResultsHeader}} {{#items && items.length}} {{~items}} <li data-url="{{!$item.url}}"> <a href="{{!$item.url}}"> {{{$item.title}}} {{#$item.text}}<div>{{{$item.text}}}</div>{{/$item.text}} </a> </li> {{/items}} {{#msgMoreResults}} <li class="uk-nav-divider uk-skip"></li> <li class="uk-search-moreresults" data-moreresults="true"><a href="#" onclick="jQuery(this).closest(\'form\').submit();">{{msgMoreResults}}</a></li> {{/msgMoreResults}} {{/end}} {{^items.length}} {{#msgNoResults}}<li class="uk-skip"><a>{{msgNoResults}}</a></li>{{/msgNoResults}} {{/end}} </ul>',renderer:function(e){var s=this.options;this.dropdown.append(this.template({items:e.results||[],msgResultsHeader:s.msgResultsHeader,msgMoreResults:s.msgMoreResults,msgNoResults:s.msgNoResults})),this.show()}},boot:function(){e.$html.on("focus.search.uikit","[data-uk-search]",function(){var s=e.$(this);s.data("search")||e.search(s,e.Utils.options(s.attr("data-uk-search")))})},init:function(){var s=this;this.autocomplete=e.autocomplete(this.element,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){s.element[s.autocomplete.input.val()?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){s.value="",s.element.removeClass("uk-active")}),this.on("selectitem.uk.autocomplete",function(e,t){t.url?location.href=t.url:t.moreresults&&s.autocomplete.input.closest("form").submit()}),this.element.data("search",this)}})}); \ No newline at end of file
diff --git a/js/components/slider.js b/js/components/slider.js
new file mode 100755
index 0000000..f89b588
--- /dev/null
+++ b/js/components/slider.js
@@ -0,0 +1,540 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-slider", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var dragging, delayIdle, anchor, dragged, store = {};
21
22 UI.component('slider', {
23
24 defaults: {
25 center : false,
26 threshold : 10,
27 infinite : true,
28 autoplay : false,
29 autoplayInterval : 7000,
30 pauseOnHover : true,
31 activecls : 'uk-active'
32 },
33
34 boot: function() {
35
36 // init code
37 UI.ready(function(context) {
38
39 setTimeout(function(){
40
41 UI.$('[data-uk-slider]', context).each(function(){
42
43 var ele = UI.$(this);
44
45 if (!ele.data('slider')) {
46 UI.slider(ele, UI.Utils.options(ele.attr('data-uk-slider')));
47 }
48 });
49
50 }, 0);
51 });
52 },
53
54 init: function() {
55
56 var $this = this;
57
58 this.container = this.element.find('.uk-slider');
59 this.focus = 0;
60
61 UI.$win.on('resize load', UI.Utils.debounce(function() {
62 $this.resize(true);
63 }, 100));
64
65 this.on('click.uk.slider', '[data-uk-slider-item]', function(e) {
66
67 e.preventDefault();
68
69 var item = UI.$(this).attr('data-uk-slider-item');
70
71 if ($this.focus == item) return;
72
73 // stop autoplay
74 $this.stop();
75
76 switch(item) {
77 case 'next':
78 case 'previous':
79 $this[item=='next' ? 'next':'previous']();
80 break;
81 default:
82 $this.updateFocus(parseInt(item, 10));
83 }
84 });
85
86 this.container.on({
87
88 'touchstart mousedown': function(evt) {
89
90 if (evt.originalEvent && evt.originalEvent.touches) {
91 evt = evt.originalEvent.touches[0];
92 }
93
94 // ignore right click button
95 if (evt.button && evt.button==2 || !$this.active) {
96 return;
97 }
98
99 // stop autoplay
100 $this.stop();
101
102 anchor = UI.$(evt.target).is('a') ? UI.$(evt.target) : UI.$(evt.target).parents('a:first');
103 dragged = false;
104
105 if (anchor.length) {
106
107 anchor.one('click', function(e){
108 if (dragged) e.preventDefault();
109 });
110 }
111
112 delayIdle = function(e) {
113
114 dragged = true;
115 dragging = $this;
116 store = {
117 touchx : parseInt(e.pageX, 10),
118 dir : 1,
119 focus : $this.focus,
120 base : $this.options.center ? 'center':'area'
121 };
122
123 if (e.originalEvent && e.originalEvent.touches) {
124 e = e.originalEvent.touches[0];
125 }
126
127 dragging.element.data({
128 'pointer-start': {x: parseInt(e.pageX, 10), y: parseInt(e.pageY, 10)},
129 'pointer-pos-start': $this.pos
130 });
131
132 $this.container.addClass('uk-drag');
133
134 delayIdle = false;
135 };
136
137 delayIdle.x = parseInt(evt.pageX, 10);
138 delayIdle.threshold = $this.options.threshold;
139
140 },
141
142 mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
143 mouseleave: function() { $this.hovering = false; }
144 });
145
146 this.resize(true);
147
148 this.on('display.uk.check', function(){
149 if ($this.element.is(":visible")) {
150 $this.resize(true);
151 }
152 });
153
154 // prevent dragging links + images
155 this.element.find('a,img').attr('draggable', 'false');
156
157 // Set autoplay
158 if (this.options.autoplay) {
159 this.start();
160 }
161
162 },
163
164 resize: function(focus) {
165
166 var $this = this, pos = 0, maxheight = 0, item, width, cwidth, size;
167
168 this.items = this.container.children().filter(':visible');
169 this.vp = this.element[0].getBoundingClientRect().width;
170
171 this.container.css({'min-width': '', 'min-height': ''});
172
173 this.items.each(function(idx){
174
175 item = UI.$(this);
176 size = item.css({'left': '', 'width':''})[0].getBoundingClientRect();
177 width = size.width;
178 cwidth = item.width();
179 maxheight = Math.max(maxheight, size.height);
180
181 item.css({'left': pos, 'width':width}).data({'idx':idx, 'left': pos, 'width': width, 'cwidth':cwidth, 'area': (pos+width), 'center':(pos - ($this.vp/2 - cwidth/2))});
182
183 pos += width;
184 });
185
186 this.container.css({'min-width': pos, 'min-height': maxheight});
187
188 if (this.options.infinite && (pos <= (2*this.vp) || this.items.length < 5) && !this.itemsResized) {
189
190 // fill with cloned items
191 this.container.children().each(function(idx){
192 $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
193 }).each(function(idx){
194 $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
195 });
196
197 this.itemsResized = true;
198
199 return this.resize();
200 }
201
202 this.cw = pos;
203 this.pos = 0;
204 this.active = pos >= this.vp;
205
206 this.container.css({
207 '-ms-transform': '',
208 '-webkit-transform': '',
209 'transform': ''
210 });
211
212 if (focus) this.updateFocus(this.focus);
213 },
214
215 updatePos: function(pos) {
216 this.pos = pos;
217 this.container.css({
218 '-ms-transform': 'translateX('+pos+'px)',
219 '-webkit-transform': 'translateX('+pos+'px)',
220 'transform': 'translateX('+pos+'px)'
221 });
222 },
223
224 updateFocus: function(idx, dir) {
225
226 if (!this.active) {
227 return;
228 }
229
230 dir = dir || (idx > this.focus ? 1:-1);
231
232 var item = this.items.eq(idx), area, i;
233
234 if (this.options.infinite) {
235 this.infinite(idx, dir);
236 }
237
238 if (this.options.center) {
239
240 this.updatePos(item.data('center')*-1);
241
242 this.items.filter('.'+this.options.activecls).removeClass(this.options.activecls);
243 item.addClass(this.options.activecls);
244
245 } else {
246
247 if (this.options.infinite) {
248
249 this.updatePos(item.data('left')*-1);
250
251 } else {
252
253 area = 0;
254
255 for (i=idx;i<this.items.length;i++) {
256 area += this.items.eq(i).data('width');
257 }
258
259
260 if (area > this.vp) {
261
262 this.updatePos(item.data('left')*-1);
263
264 } else {
265
266 if (dir == 1) {
267
268 area = 0;
269
270 for (i=this.items.length-1;i>=0;i--) {
271
272 area += this.items.eq(i).data('width');
273
274 if (area == this.vp) {
275 idx = i;
276 break;
277 }
278
279 if (area > this.vp) {
280 idx = (i < this.items.length-1) ? i+1 : i;
281 break;
282 }
283 }
284
285 if (area > this.vp) {
286 this.updatePos((this.container.width() - this.vp) * -1);
287 } else {
288 this.updatePos(this.items.eq(idx).data('left')*-1);
289 }
290 }
291 }
292 }
293 }
294
295 // mark elements
296 var left = this.items.eq(idx).data('left');
297
298 this.items.removeClass('uk-slide-before uk-slide-after').each(function(i){
299 if (i!==idx) {
300 UI.$(this).addClass(UI.$(this).data('left') < left ? 'uk-slide-before':'uk-slide-after');
301 }
302 });
303
304 this.focus = idx;
305
306 this.trigger('focusitem.uk.slider', [idx,this.items.eq(idx),this]);
307 },
308
309 next: function() {
310
311 var focus = this.items[this.focus + 1] ? (this.focus + 1) : (this.options.infinite ? 0:this.focus);
312
313 this.updateFocus(focus, 1);
314 },
315
316 previous: function() {
317
318 var focus = this.items[this.focus - 1] ? (this.focus - 1) : (this.options.infinite ? (this.items[this.focus - 1] ? this.items-1:this.items.length-1):this.focus);
319
320 this.updateFocus(focus, -1);
321 },
322
323 start: function() {
324
325 this.stop();
326
327 var $this = this;
328
329 this.interval = setInterval(function() {
330 if (!$this.hovering) $this.next();
331 }, this.options.autoplayInterval);
332
333 },
334
335 stop: function() {
336 if (this.interval) clearInterval(this.interval);
337 },
338
339 infinite: function(baseidx, direction) {
340
341 var $this = this, item = this.items.eq(baseidx), i, z = baseidx, move = [], area = 0;
342
343 if (direction == 1) {
344
345
346 for (i=0;i<this.items.length;i++) {
347
348 if (z != baseidx) {
349 area += this.items.eq(z).data('width');
350 move.push(this.items.eq(z));
351 }
352
353 if (area > this.vp) {
354 break;
355 }
356
357 z = z+1 == this.items.length ? 0:z+1;
358 }
359
360 if (move.length) {
361
362 move.forEach(function(itm){
363
364 var left = item.data('area');
365
366 itm.css({'left': left}).data({
367 'left' : left,
368 'area' : (left+itm.data('width')),
369 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
370 });
371
372 item = itm;
373 });
374 }
375
376
377 } else {
378
379 for (i=this.items.length-1;i >-1 ;i--) {
380
381 area += this.items.eq(z).data('width');
382
383 if (z != baseidx) {
384 move.push(this.items.eq(z));
385 }
386
387 if (area > this.vp) {
388 break;
389 }
390
391 z = z-1 == -1 ? this.items.length-1:z-1;
392 }
393
394 if (move.length) {
395
396 move.forEach(function(itm){
397
398 var left = item.data('left') - itm.data('width');
399
400 itm.css({'left': left}).data({
401 'left' : left,
402 'area' : (left+itm.data('width')),
403 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
404 });
405
406 item = itm;
407 });
408 }
409 }
410 }
411 });
412
413 // handle dragging
414 UI.$doc.on('mousemove.uk.slider touchmove.uk.slider', function(e) {
415
416 if (e.originalEvent && e.originalEvent.touches) {
417 e = e.originalEvent.touches[0];
418 }
419
420 if (delayIdle && Math.abs(e.pageX - delayIdle.x) > delayIdle.threshold) {
421
422 if (!window.getSelection().toString()) {
423 delayIdle(e);
424 } else {
425 dragging = delayIdle = false;
426 }
427 }
428
429 if (!dragging) {
430 return;
431 }
432
433 var x, xDiff, pos, dir, focus, item, next, diff, i, z, itm;
434
435 if (e.clientX || e.clientY) {
436 x = e.clientX;
437 } else if (e.pageX || e.pageY) {
438 x = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft;
439 }
440
441 focus = store.focus;
442 xDiff = x - dragging.element.data('pointer-start').x;
443 pos = dragging.element.data('pointer-pos-start') + xDiff;
444 dir = x > dragging.element.data('pointer-start').x ? -1:1;
445 item = dragging.items.eq(store.focus);
446
447 if (dir == 1) {
448
449 diff = item.data('left') + Math.abs(xDiff);
450
451 for (i=0,z=store.focus;i<dragging.items.length;i++) {
452
453 itm = dragging.items.eq(z);
454
455 if (z != store.focus && itm.data('left') < diff && itm.data('area') > diff) {
456 focus = z;
457 break;
458 }
459
460 z = z+1 == dragging.items.length ? 0:z+1;
461 }
462
463 } else {
464
465 diff = item.data('left') - Math.abs(xDiff);
466
467 for (i=0,z=store.focus;i<dragging.items.length;i++) {
468
469 itm = dragging.items.eq(z);
470
471 if (z != store.focus && itm.data('area') <= item.data('left') && itm.data('center') < diff) {
472 focus = z;
473 break;
474 }
475
476 z = z-1 == -1 ? dragging.items.length-1:z-1;
477 }
478 }
479
480 if (dragging.options.infinite && focus!=store._focus) {
481 dragging.infinite(focus, dir);
482 }
483
484 dragging.updatePos(pos);
485
486 store.dir = dir;
487 store._focus = focus;
488 store.touchx = parseInt(e.pageX, 10);
489 store.diff = diff;
490 });
491
492 UI.$doc.on('mouseup.uk.slider touchend.uk.slider', function(e) {
493
494 if (dragging) {
495
496 dragging.container.removeClass('uk-drag');
497
498 // TODO is this needed?
499 dragging.items.eq(store.focus);
500
501 var itm, focus = false, i, z;
502
503 if (store.dir == 1) {
504
505 for (i=0,z=store.focus;i<dragging.items.length;i++) {
506
507 itm = dragging.items.eq(z);
508
509 if (z != store.focus && itm.data('left') > store.diff) {
510 focus = z;
511 break;
512 }
513
514 z = z+1 == dragging.items.length ? 0:z+1;
515 }
516
517 } else {
518
519 for (i=0,z=store.focus;i<dragging.items.length;i++) {
520
521 itm = dragging.items.eq(z);
522
523 if (z != store.focus && itm.data('left') < store.diff) {
524 focus = z;
525 break;
526 }
527
528 z = z-1 == -1 ? dragging.items.length-1:z-1;
529 }
530 }
531
532 dragging.updateFocus(focus!==false ? focus:store._focus);
533
534 }
535
536 dragging = delayIdle = false;
537 });
538
539 return UI.slider;
540});
diff --git a/js/components/slider.min.js b/js/components/slider.min.js
new file mode 100755
index 0000000..8828306
--- /dev/null
+++ b/js/components/slider.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slider",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e,i,s,n,a={};return t.component("slider",{defaults:{center:!1,threshold:10,infinite:!0,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0,activecls:"uk-active"},boot:function(){t.ready(function(e){setTimeout(function(){t.$("[data-uk-slider]",e).each(function(){var e=t.$(this);e.data("slider")||t.slider(e,t.Utils.options(e.attr("data-uk-slider")))})},0)})},init:function(){var o=this;this.container=this.element.find(".uk-slider"),this.focus=0,t.$win.on("resize load",t.Utils.debounce(function(){o.resize(!0)},100)),this.on("click.uk.slider","[data-uk-slider-item]",function(e){e.preventDefault();var i=t.$(this).attr("data-uk-slider-item");if(o.focus!=i)switch(o.stop(),i){case"next":case"previous":o["next"==i?"next":"previous"]();break;default:o.updateFocus(parseInt(i,10))}}),this.container.on({"touchstart mousedown":function(h){h.originalEvent&&h.originalEvent.touches&&(h=h.originalEvent.touches[0]),h.button&&2==h.button||!o.active||(o.stop(),s=t.$(h.target).is("a")?t.$(h.target):t.$(h.target).parents("a:first"),n=!1,s.length&&s.one("click",function(t){n&&t.preventDefault()}),i=function(t){n=!0,e=o,a={touchx:parseInt(t.pageX,10),dir:1,focus:o.focus,base:o.options.center?"center":"area"},t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),e.element.data({"pointer-start":{x:parseInt(t.pageX,10),y:parseInt(t.pageY,10)},"pointer-pos-start":o.pos}),o.container.addClass("uk-drag"),i=!1},i.x=parseInt(h.pageX,10),i.threshold=o.options.threshold)},mouseenter:function(){o.options.pauseOnHover&&(o.hovering=!0)},mouseleave:function(){o.hovering=!1}}),this.resize(!0),this.on("display.uk.check",function(){o.element.is(":visible")&&o.resize(!0)}),this.element.find("a,img").attr("draggable","false"),this.options.autoplay&&this.start()},resize:function(e){var i,s,n,a,o=this,h=0,r=0;return this.items=this.container.children().filter(":visible"),this.vp=this.element[0].getBoundingClientRect().width,this.container.css({"min-width":"","min-height":""}),this.items.each(function(e){i=t.$(this),a=i.css({left:"",width:""})[0].getBoundingClientRect(),s=a.width,n=i.width(),r=Math.max(r,a.height),i.css({left:h,width:s}).data({idx:e,left:h,width:s,cwidth:n,area:h+s,center:h-(o.vp/2-n/2)}),h+=s}),this.container.css({"min-width":h,"min-height":r}),this.options.infinite&&(h<=2*this.vp||this.items.length<5)&&!this.itemsResized?(this.container.children().each(function(t){o.container.append(o.items.eq(t).clone(!0).attr("id",""))}).each(function(t){o.container.append(o.items.eq(t).clone(!0).attr("id",""))}),this.itemsResized=!0,this.resize()):(this.cw=h,this.pos=0,this.active=h>=this.vp,this.container.css({"-ms-transform":"","-webkit-transform":"",transform:""}),e&&this.updateFocus(this.focus),void 0)},updatePos:function(t){this.pos=t,this.container.css({"-ms-transform":"translateX("+t+"px)","-webkit-transform":"translateX("+t+"px)",transform:"translateX("+t+"px)"})},updateFocus:function(e,i){if(this.active){i=i||(e>this.focus?1:-1);var s,n,a=this.items.eq(e);if(this.options.infinite&&this.infinite(e,i),this.options.center)this.updatePos(-1*a.data("center")),this.items.filter("."+this.options.activecls).removeClass(this.options.activecls),a.addClass(this.options.activecls);else if(this.options.infinite)this.updatePos(-1*a.data("left"));else{for(s=0,n=e;n<this.items.length;n++)s+=this.items.eq(n).data("width");if(s>this.vp)this.updatePos(-1*a.data("left"));else if(1==i){for(s=0,n=this.items.length-1;n>=0;n--){if(s+=this.items.eq(n).data("width"),s==this.vp){e=n;break}if(s>this.vp){e=n<this.items.length-1?n+1:n;break}}s>this.vp?this.updatePos(-1*(this.container.width()-this.vp)):this.updatePos(-1*this.items.eq(e).data("left"))}}var o=this.items.eq(e).data("left");this.items.removeClass("uk-slide-before uk-slide-after").each(function(i){i!==e&&t.$(this).addClass(t.$(this).data("left")<o?"uk-slide-before":"uk-slide-after")}),this.focus=e,this.trigger("focusitem.uk.slider",[e,this.items.eq(e),this])}},next:function(){var t=this.items[this.focus+1]?this.focus+1:this.options.infinite?0:this.focus;this.updateFocus(t,1)},previous:function(){var t=this.items[this.focus-1]?this.focus-1:this.options.infinite?this.items[this.focus-1]?this.items-1:this.items.length-1:this.focus;this.updateFocus(t,-1)},start:function(){this.stop();var t=this;this.interval=setInterval(function(){t.hovering||t.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)},infinite:function(t,e){var i,s=this,n=this.items.eq(t),a=t,o=[],h=0;if(1==e){for(i=0;i<this.items.length&&(a!=t&&(h+=this.items.eq(a).data("width"),o.push(this.items.eq(a))),!(h>this.vp));i++)a=a+1==this.items.length?0:a+1;o.length&&o.forEach(function(t){var e=n.data("area");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}else{for(i=this.items.length-1;i>-1&&(h+=this.items.eq(a).data("width"),a!=t&&o.push(this.items.eq(a)),!(h>this.vp));i--)a=a-1==-1?this.items.length-1:a-1;o.length&&o.forEach(function(t){var e=n.data("left")-t.data("width");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}}}),t.$doc.on("mousemove.uk.slider touchmove.uk.slider",function(t){if(t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),i&&Math.abs(t.pageX-i.x)>i.threshold&&(window.getSelection().toString()?e=i=!1:i(t)),e){var s,n,o,h,r,c,f,u,d,l;if(t.clientX||t.clientY?s=t.clientX:(t.pageX||t.pageY)&&(s=t.pageX-document.body.scrollLeft-document.documentElement.scrollLeft),r=a.focus,n=s-e.element.data("pointer-start").x,o=e.element.data("pointer-pos-start")+n,h=s>e.element.data("pointer-start").x?-1:1,c=e.items.eq(a.focus),1==h)for(f=c.data("left")+Math.abs(n),u=0,d=a.focus;u<e.items.length;u++){if(l=e.items.eq(d),d!=a.focus&&l.data("left")<f&&l.data("area")>f){r=d;break}d=d+1==e.items.length?0:d+1}else for(f=c.data("left")-Math.abs(n),u=0,d=a.focus;u<e.items.length;u++){if(l=e.items.eq(d),d!=a.focus&&l.data("area")<=c.data("left")&&l.data("center")<f){r=d;break}d=d-1==-1?e.items.length-1:d-1}e.options.infinite&&r!=a._focus&&e.infinite(r,h),e.updatePos(o),a.dir=h,a._focus=r,a.touchx=parseInt(t.pageX,10),a.diff=f}}),t.$doc.on("mouseup.uk.slider touchend.uk.slider",function(){if(e){e.container.removeClass("uk-drag"),e.items.eq(a.focus);var t,s,n,o=!1;if(1==a.dir)for(s=0,n=a.focus;s<e.items.length;s++){if(t=e.items.eq(n),n!=a.focus&&t.data("left")>a.diff){o=n;break}n=n+1==e.items.length?0:n+1}else for(s=0,n=a.focus;s<e.items.length;s++){if(t=e.items.eq(n),n!=a.focus&&t.data("left")<a.diff){o=n;break}n=n-1==-1?e.items.length-1:n-1}e.updateFocus(o!==!1?o:a._focus)}e=i=!1}),t.slider}); \ No newline at end of file
diff --git a/js/components/slideset.js b/js/components/slideset.js
new file mode 100755
index 0000000..b9a39b0
--- /dev/null
+++ b/js/components/slideset.js
@@ -0,0 +1,514 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-slideset", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var Animations;
21
22 UI.component('slideset', {
23
24 defaults: {
25 default : 1,
26 animation : 'fade',
27 duration : 200,
28 filter : '',
29 delay : false,
30 controls : false,
31 autoplay : false,
32 autoplayInterval : 7000,
33 pauseOnHover : true
34 },
35
36 sets: [],
37
38 boot: function() {
39
40 // auto init
41 UI.ready(function(context) {
42
43 UI.$("[data-uk-slideset]", context).each(function(){
44
45 var ele = UI.$(this);
46
47 if(!ele.data("slideset")) {
48 UI.slideset(ele, UI.Utils.options(ele.attr("data-uk-slideset")));
49 }
50 });
51 });
52 },
53
54 init: function() {
55
56 var $this = this;
57
58 this.activeSet = false;
59 this.list = this.element.find('.uk-slideset');
60 this.nav = this.element.find('.uk-slideset-nav');
61 this.controls = this.options.controls ? UI.$(this.options.controls) : this.element;
62
63 UI.$win.on("resize load", UI.Utils.debounce(function() {
64 $this.updateSets();
65 }, 100));
66
67 $this.list.addClass('uk-grid-width-1-'+$this.options.default);
68
69 ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
70
71 if (!$this.options[bp]) {
72 return;
73 }
74
75 $this.list.addClass('uk-grid-width-'+bp+'-1-'+$this.options[bp]);
76 });
77
78 this.on("click.uk.slideset", '[data-uk-slideset-item]', function(e) {
79
80 e.preventDefault();
81
82 if ($this.animating) {
83 return;
84 }
85
86 var set = UI.$(this).attr('data-uk-slideset-item');
87
88 if ($this.activeSet === set) return;
89
90 switch(set) {
91 case 'next':
92 case 'previous':
93 $this[set=='next' ? 'next':'previous']();
94 break;
95 default:
96 $this.show(parseInt(set, 10));
97 }
98
99 });
100
101 this.controls.on('click.uk.slideset', '[data-uk-filter]', function(e) {
102
103 var ele = UI.$(this);
104
105 if (ele.parent().hasClass('uk-slideset')) {
106 return;
107 }
108
109 e.preventDefault();
110
111 if ($this.animating || $this.currentFilter == ele.attr('data-uk-filter')) {
112 return;
113 }
114
115 $this.updateFilter(ele.attr('data-uk-filter'));
116
117 $this._hide().then(function(){
118
119 $this.updateSets(true, true);
120 });
121 });
122
123 this.on('swipeRight swipeLeft', function(e) {
124 $this[e.type=='swipeLeft' ? 'next' : 'previous']();
125 });
126
127 this.updateFilter(this.options.filter);
128 this.updateSets();
129
130 this.element.on({
131 mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
132 mouseleave: function() { $this.hovering = false; }
133 });
134
135 // Set autoplay
136 if (this.options.autoplay) {
137 this.start();
138 }
139 },
140
141 updateSets: function(animate, force) {
142
143 var visible = this.visible, i;
144
145 this.visible = this.getVisibleOnCurrenBreakpoint();
146
147 if (visible == this.visible && !force) {
148 return;
149 }
150
151 this.children = this.list.children().hide();
152 this.items = this.getItems();
153 this.sets = array_chunk(this.items, this.visible);
154
155 for (i=0;i<this.sets.length;i++) {
156 this.sets[i].css({'display': 'none'});
157 }
158
159 // update nav
160 if (this.nav.length && this.nav.empty()) {
161
162 for (i=0;i<this.sets.length;i++) {
163 this.nav.append('<li data-uk-slideset-item="'+i+'"><a></a></li>');
164 }
165
166 this.nav[this.nav.children().length==1 ? 'addClass':'removeClass']('uk-invisible');
167 }
168
169 this.activeSet = false;
170 this.show(0, !animate);
171 },
172
173 updateFilter: function(currentfilter) {
174
175 var $this = this, filter;
176
177 this.currentFilter = currentfilter;
178
179 this.controls.find('[data-uk-filter]').each(function(){
180
181 filter = UI.$(this);
182
183 if (!filter.parent().hasClass('uk-slideset')) {
184
185 if (filter.attr('data-uk-filter') == $this.currentFilter) {
186 filter.addClass('uk-active');
187 } else {
188 filter.removeClass('uk-active');
189 }
190 }
191 });
192 },
193
194 getVisibleOnCurrenBreakpoint: function() {
195
196 var breakpoint = null,
197 tmp = UI.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo('body'),
198 testdiv = tmp.children().eq(0),
199 breakpoints = this.options;
200
201 ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
202
203 if (!breakpoints[bp] || breakpoint) {
204 return;
205 }
206
207 tmp.attr('class', 'uk-grid-width-'+bp+'-1-2').width();
208
209 if (testdiv.width() == 50) {
210 breakpoint = bp;
211 }
212 });
213
214 tmp.remove();
215
216 return this.options[breakpoint] || this.options['default'];
217 },
218
219 getItems: function() {
220
221 var items = [], filter;
222
223 if (this.currentFilter) {
224
225 filter = this.currentFilter || [];
226
227 if (typeof(filter) === 'string') {
228 filter = filter.split(/,/).map(function(item){ return item.trim(); });
229 }
230
231 this.children.each(function(index){
232
233 var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
234
235 if (f) {
236
237 f = f.split(/,/).map(function(item){ return item.trim(); });
238
239 filter.forEach(function(item){
240 if (f.indexOf(item) > -1) infilter = true;
241 });
242 }
243
244 if(infilter) items.push(ele[0]);
245 });
246
247 items = UI.$(items);
248
249 } else {
250 items = this.list.children();
251 }
252
253 return items;
254 },
255
256 show: function(setIndex, noanimate, dir) {
257
258 var $this = this;
259
260 if (this.activeSet === setIndex || this.animating) {
261 return;
262 }
263
264 dir = dir || (setIndex < this.activeSet ? -1:1);
265
266 var current = this.sets[this.activeSet] || [],
267 next = this.sets[setIndex],
268 animation = this._getAnimation();
269
270 if (noanimate || !UI.support.animation) {
271 animation = Animations.none;
272 }
273
274 this.animating = true;
275
276 if (this.nav.length) {
277 this.nav.children().removeClass('uk-active').eq(setIndex).addClass('uk-active');
278 }
279
280 animation.apply($this, [current, next, dir]).then(function(){
281
282 UI.Utils.checkDisplay(next, true);
283
284 $this.children.hide().removeClass('uk-active');
285 next.addClass('uk-active').css({'display': '', 'opacity':''});
286
287 $this.animating = false;
288 $this.activeSet = setIndex;
289
290 UI.Utils.checkDisplay(next, true);
291
292 $this.trigger('show.uk.slideset', [next]);
293 });
294
295 },
296
297 _getAnimation: function() {
298
299 var animation = Animations[this.options.animation] || Animations.none;
300
301 if (!UI.support.animation) {
302 animation = Animations.none;
303 }
304
305 return animation;
306 },
307
308 _hide: function() {
309
310 var $this = this,
311 current = this.sets[this.activeSet] || [],
312 animation = this._getAnimation();
313
314 this.animating = true;
315
316 return animation.apply($this, [current, [], 1]).then(function(){
317 $this.animating = false;
318 });
319 },
320
321 next: function() {
322 this.show(this.sets[this.activeSet + 1] ? (this.activeSet + 1) : 0, false, 1);
323 },
324
325 previous: function() {
326 this.show(this.sets[this.activeSet - 1] ? (this.activeSet - 1) : (this.sets.length - 1), false, -1);
327 },
328
329 start: function() {
330
331 this.stop();
332
333 var $this = this;
334
335 this.interval = setInterval(function() {
336 if (!$this.hovering && !$this.animating) $this.next();
337 }, this.options.autoplayInterval);
338
339 },
340
341 stop: function() {
342 if (this.interval) clearInterval(this.interval);
343 }
344 });
345
346 Animations = {
347
348 'none': function() {
349 var d = UI.$.Deferred();
350 d.resolve();
351 return d.promise();
352 },
353
354 'fade': function(current, next) {
355 return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
356 },
357
358 'slide-bottom': function(current, next) {
359 return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
360 },
361
362 'slide-top': function(current, next) {
363 return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
364 },
365
366 'slide-vertical': function(current, next, dir) {
367
368 var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
369
370 if (dir == -1) {
371 anim.reverse();
372 }
373
374 return coreAnimation.apply(this, [anim, current, next]);
375 },
376
377 'slide-horizontal': function(current, next, dir) {
378
379 var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
380
381 if (dir == -1) {
382 anim.reverse();
383 }
384
385 return coreAnimation.apply(this, [anim, current, next, dir]);
386 },
387
388 'scale': function(current, next) {
389 return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
390 }
391 };
392
393 UI.slideset.animations = Animations;
394
395 // helpers
396
397 function coreAnimation(cls, current, next, dir) {
398
399 var d = UI.$.Deferred(),
400 delay = (this.options.delay === false) ? Math.floor(this.options.duration/2) : this.options.delay,
401 $this = this, clsIn, clsOut, release, i;
402
403 dir = dir || 1;
404
405 this.element.css('min-height', this.element.height());
406
407 if (next[0]===current[0]) {
408 d.resolve();
409 return d.promise();
410 }
411
412 if (typeof(cls) == 'object') {
413 clsIn = cls[0];
414 clsOut = cls[1] || cls[0];
415 } else {
416 clsIn = cls;
417 clsOut = clsIn;
418 }
419
420 release = function() {
421
422 if (current && current.length) {
423 current.hide().removeClass(clsOut+' uk-animation-reverse').css({'opacity':'', 'animation-delay': '', 'animation':''});
424 }
425
426 if (!next.length) {
427 d.resolve();
428 return;
429 }
430
431 for (i=0;i<next.length;i++) {
432 next.eq(dir == 1 ? i:(next.length - i)-1).css('animation-delay', (i*delay)+'ms');
433 }
434
435 var finish = function() {
436 next.removeClass(''+clsIn+'').css({opacity:'', display:'', 'animation-delay':'', 'animation':''});
437 d.resolve();
438 $this.element.css('min-height', '');
439 finish = false;
440 };
441
442 next.addClass(clsIn)[dir==1 ? 'last':'first']().one(UI.support.animation.end, function(){
443 if(finish) finish();
444 }).end().css('display', '');
445
446 // make sure everything resolves really
447 setTimeout(function() {
448 if(finish) finish();
449 }, next.length * delay * 2);
450 };
451
452 if (next.length) {
453 next.css('animation-duration', this.options.duration+'ms');
454 }
455
456 if (current && current.length) {
457
458 current.css('animation-duration', this.options.duration+'ms')[dir==1 ? 'last':'first']().one(UI.support.animation.end, function() {
459 release();
460 });
461
462 for (i=0;i<current.length;i++) {
463
464 (function (index, ele){
465
466 setTimeout(function(){
467
468 ele.css('display', 'none').css('display', '').css('opacity', 0).on(UI.support.animation.end, function(){
469 ele.removeClass(clsOut);
470 }).addClass(clsOut+' uk-animation-reverse');
471
472 }.bind(this), i * delay);
473
474 })(i, current.eq(dir == 1 ? i:(current.length - i)-1));
475 }
476
477 } else {
478 release();
479 }
480
481 return d.promise();
482 }
483
484 function array_chunk(input, size) {
485
486 var x, i = 0, c = -1, l = input.length || 0, n = [];
487
488 if (size < 1) return null;
489
490 while (i < l) {
491
492 x = i % size;
493
494 if(x) {
495 n[c][x] = input[i];
496 } else {
497 n[++c] = [input[i]];
498 }
499
500 i++;
501 }
502
503 i = 0;
504 l = n.length;
505
506 while (i < l) {
507 n[i] = jQuery(n[i]);
508 i++;
509 }
510
511 return n;
512 }
513
514});
diff --git a/js/components/slideset.min.js b/js/components/slideset.min.js
new file mode 100755
index 0000000..7858e6a
--- /dev/null
+++ b/js/components/slideset.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideset",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(i,e,s,n){var a,o,r,l,h=t.$.Deferred(),u=this.options.delay===!1?Math.floor(this.options.duration/2):this.options.delay,d=this;if(n=n||1,this.element.css("min-height",this.element.height()),s[0]===e[0])return h.resolve(),h.promise();if("object"==typeof i?(a=i[0],o=i[1]||i[0]):(a=i,o=a),r=function(){if(e&&e.length&&e.hide().removeClass(o+" uk-animation-reverse").css({opacity:"","animation-delay":"",animation:""}),!s.length)return h.resolve(),void 0;for(l=0;l<s.length;l++)s.eq(1==n?l:s.length-l-1).css("animation-delay",l*u+"ms");var i=function(){s.removeClass(""+a).css({opacity:"",display:"","animation-delay":"",animation:""}),h.resolve(),d.element.css("min-height",""),i=!1};s.addClass(a)[1==n?"last":"first"]().one(t.support.animation.end,function(){i&&i()}).end().css("display",""),setTimeout(function(){i&&i()},s.length*u*2)},s.length&&s.css("animation-duration",this.options.duration+"ms"),e&&e.length)for(e.css("animation-duration",this.options.duration+"ms")[1==n?"last":"first"]().one(t.support.animation.end,function(){r()}),l=0;l<e.length;l++)!function(i,e){setTimeout(function(){e.css("display","none").css("display","").css("opacity",0).on(t.support.animation.end,function(){e.removeClass(o)}).addClass(o+" uk-animation-reverse")}.bind(this),l*u)}(l,e.eq(1==n?l:e.length-l-1));else r();return h.promise()}function e(t,i){var e,s=0,n=-1,a=t.length||0,o=[];if(1>i)return null;for(;a>s;)e=s%i,e?o[n][e]=t[s]:o[++n]=[t[s]],s++;for(s=0,a=o.length;a>s;)o[s]=jQuery(o[s]),s++;return o}var s;t.component("slideset",{defaults:{"default":1,animation:"fade",duration:200,filter:"",delay:!1,controls:!1,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},sets:[],boot:function(){t.ready(function(i){t.$("[data-uk-slideset]",i).each(function(){var i=t.$(this);i.data("slideset")||t.slideset(i,t.Utils.options(i.attr("data-uk-slideset")))})})},init:function(){var i=this;this.activeSet=!1,this.list=this.element.find(".uk-slideset"),this.nav=this.element.find(".uk-slideset-nav"),this.controls=this.options.controls?t.$(this.options.controls):this.element,t.$win.on("resize load",t.Utils.debounce(function(){i.updateSets()},100)),i.list.addClass("uk-grid-width-1-"+i.options.default),["xlarge","large","medium","small"].forEach(function(t){i.options[t]&&i.list.addClass("uk-grid-width-"+t+"-1-"+i.options[t])}),this.on("click.uk.slideset","[data-uk-slideset-item]",function(e){if(e.preventDefault(),!i.animating){var s=t.$(this).attr("data-uk-slideset-item");if(i.activeSet!==s)switch(s){case"next":case"previous":i["next"==s?"next":"previous"]();break;default:i.show(parseInt(s,10))}}}),this.controls.on("click.uk.slideset","[data-uk-filter]",function(e){var s=t.$(this);s.parent().hasClass("uk-slideset")||(e.preventDefault(),i.animating||i.currentFilter==s.attr("data-uk-filter")||(i.updateFilter(s.attr("data-uk-filter")),i._hide().then(function(){i.updateSets(!0,!0)})))}),this.on("swipeRight swipeLeft",function(t){i["swipeLeft"==t.type?"next":"previous"]()}),this.updateFilter(this.options.filter),this.updateSets(),this.element.on({mouseenter:function(){i.options.pauseOnHover&&(i.hovering=!0)},mouseleave:function(){i.hovering=!1}}),this.options.autoplay&&this.start()},updateSets:function(t,i){var s,n=this.visible;if(this.visible=this.getVisibleOnCurrenBreakpoint(),n!=this.visible||i){for(this.children=this.list.children().hide(),this.items=this.getItems(),this.sets=e(this.items,this.visible),s=0;s<this.sets.length;s++)this.sets[s].css({display:"none"});if(this.nav.length&&this.nav.empty()){for(s=0;s<this.sets.length;s++)this.nav.append('<li data-uk-slideset-item="'+s+'"><a></a></li>');this.nav[1==this.nav.children().length?"addClass":"removeClass"]("uk-invisible")}this.activeSet=!1,this.show(0,!t)}},updateFilter:function(i){var e,s=this;this.currentFilter=i,this.controls.find("[data-uk-filter]").each(function(){e=t.$(this),e.parent().hasClass("uk-slideset")||(e.attr("data-uk-filter")==s.currentFilter?e.addClass("uk-active"):e.removeClass("uk-active"))})},getVisibleOnCurrenBreakpoint:function(){var i=null,e=t.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo("body"),s=e.children().eq(0),n=this.options;return["xlarge","large","medium","small"].forEach(function(t){n[t]&&!i&&(e.attr("class","uk-grid-width-"+t+"-1-2").width(),50==s.width()&&(i=t))}),e.remove(),this.options[i]||this.options["default"]},getItems:function(){var i,e=[];return this.currentFilter?(i=this.currentFilter||[],"string"==typeof i&&(i=i.split(/,/).map(function(t){return t.trim()})),this.children.each(function(){var s=t.$(this),n=s.attr("data-uk-filter"),a=i.length?!1:!0;n&&(n=n.split(/,/).map(function(t){return t.trim()}),i.forEach(function(t){n.indexOf(t)>-1&&(a=!0)})),a&&e.push(s[0])}),e=t.$(e)):e=this.list.children(),e},show:function(i,e,n){var a=this;if(this.activeSet!==i&&!this.animating){n=n||(i<this.activeSet?-1:1);var o=this.sets[this.activeSet]||[],r=this.sets[i],l=this._getAnimation();(e||!t.support.animation)&&(l=s.none),this.animating=!0,this.nav.length&&this.nav.children().removeClass("uk-active").eq(i).addClass("uk-active"),l.apply(a,[o,r,n]).then(function(){t.Utils.checkDisplay(r,!0),a.children.hide().removeClass("uk-active"),r.addClass("uk-active").css({display:"",opacity:""}),a.animating=!1,a.activeSet=i,t.Utils.checkDisplay(r,!0),a.trigger("show.uk.slideset",[r])})}},_getAnimation:function(){var i=s[this.options.animation]||s.none;return t.support.animation||(i=s.none),i},_hide:function(){var t=this,i=this.sets[this.activeSet]||[],e=this._getAnimation();return this.animating=!0,e.apply(t,[i,[],1]).then(function(){t.animating=!1})},next:function(){this.show(this.sets[this.activeSet+1]?this.activeSet+1:0,!1,1)},previous:function(){this.show(this.sets[this.activeSet-1]?this.activeSet-1:this.sets.length-1,!1,-1)},start:function(){this.stop();var t=this;this.interval=setInterval(function(){t.hovering||t.animating||t.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)}}),s={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,e){return i.apply(this,["uk-animation-fade",t,e])},"slide-bottom":function(t,e){return i.apply(this,["uk-animation-slide-bottom",t,e])},"slide-top":function(t,e){return i.apply(this,["uk-animation-slide-top",t,e])},"slide-vertical":function(t,e,s){var n=["uk-animation-slide-top","uk-animation-slide-bottom"];return-1==s&&n.reverse(),i.apply(this,[n,t,e])},"slide-horizontal":function(t,e,s){var n=["uk-animation-slide-right","uk-animation-slide-left"];return-1==s&&n.reverse(),i.apply(this,[n,t,e,s])},scale:function(t,e){return i.apply(this,["uk-animation-scale-up",t,e])}},t.slideset.animations=s}); \ No newline at end of file
diff --git a/js/components/slideshow-fx.js b/js/components/slideshow-fx.js
new file mode 100755
index 0000000..d180509
--- /dev/null
+++ b/js/components/slideshow-fx.js
@@ -0,0 +1,383 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-slideshow-fx", ["uikit"], function() {
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI) {
17
18 "use strict";
19
20 var Animations = UI.slideshow.animations;
21
22 UI.$.extend(UI.slideshow.animations, {
23 'slice': function(current, next, dir, fromfx) {
24
25 if (!current.data('cover')) {
26 return Animations.fade.apply(this, arguments);
27 }
28
29 var d = UI.$.Deferred();
30
31 var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
32 bgimage = next.data('cover').css('background-image'),
33 ghost = UI.$('<li></li>').css({
34 top : 0,
35 left : 0,
36 width : this.container.width(),
37 height : this.container.height(),
38 opacity: 1,
39 zIndex : 15
40 }),
41 ghostWidth = ghost.width(),
42 ghostHeight = ghost.height(),
43 pos = fromfx == 'slice-up' ? ghostHeight:'0',
44 bar;
45
46 for (var i = 0; i < this.options.slices; i++) {
47
48 if (fromfx == 'slice-up-down') {
49 pos = ((i % 2) + 2) % 2==0 ? '0':ghostHeight;
50 }
51
52 var width = (i == this.options.slices-1) ? sliceWidth : sliceWidth,
53 clipto = ('rect(0px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
54 clipfrom;
55
56 //slice-down - default
57 clipfrom = ('rect(0px, '+(width*(i+1))+'px, 0px, '+(sliceWidth*i)+'px)');
58
59 if (fromfx == 'slice-up' || (fromfx == 'slice-up-down' && ((i % 2) + 2) % 2==0 )) {
60 clipfrom = ('rect('+ghostHeight+'px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)');
61 }
62
63 bar = UI.$('<div class="uk-cover-background"></div>').css({
64 'position' : 'absolute',
65 'top' : 0,
66 'left' : 0,
67 'width' : ghostWidth,
68 'height' : ghostHeight,
69 'background-image' : bgimage,
70 'clip' : clipfrom,
71 'opacity' : 0,
72 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms',
73 '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms'
74
75 }).data('clip', clipto);
76
77 ghost.append(bar);
78 }
79
80 this.container.append(ghost);
81
82 ghost.children().last().on(UI.support.transition.end, function() {
83
84 setTimeout(ghost.remove.bind(ghost), 0);
85
86 d.resolve();
87 });
88
89 ghost.width();
90
91 ghost.children().each(function() {
92 var bar = UI.$(this);
93
94 bar.css({
95 'clip': bar.data('clip'),
96 'opacity': 1
97 });
98 });
99
100 return d.promise();
101 },
102
103 'slice-up': function(current, next, dir) {
104 return Animations.slice.apply(this, [current, next, dir, 'slice-up']);
105 },
106
107 'slice-down': function(current, next, dir) {
108 return Animations.slice.apply(this, [current, next, dir, 'slice-down']);
109 },
110
111 'slice-up-down': function(current, next, dir) {
112 return Animations.slice.apply(this, [current, next, dir, 'slice-up-down']);
113 },
114
115 'fold': function(current, next, dir) {
116
117 if (!next.data('cover')) {
118 return Animations.fade.apply(this, arguments);
119 }
120
121 var d = UI.$.Deferred();
122
123 var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
124 bgimage = next.data('cover').css('background-image'),
125 ghost = UI.$('<li></li>').css({
126 width : next.width(),
127 height : next.height(),
128 opacity: 1,
129 zIndex : 15
130 }),
131 ghostWidth = next.width(),
132 ghostHeight = next.height(),
133 bar;
134
135 for (var i = 0; i < this.options.slices; i++) {
136
137 bar = UI.$('<div class="uk-cover-background"></div>').css({
138 'position' : 'absolute',
139 'top' : 0,
140 'left' : 0,
141 'width' : ghostWidth,
142 'height' : ghostHeight,
143 'background-image' : bgimage,
144 'transform-origin' : (sliceWidth*i)+'px 0 0',
145 'clip' : ('rect(0px, '+(sliceWidth*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
146 'opacity' : 0,
147 'transform' : 'scaleX(0.000001)',
148 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms',
149 '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms'
150 });
151
152 ghost.prepend(bar);
153 }
154
155 this.container.append(ghost);
156
157 ghost.width();
158
159 ghost.children().first().on(UI.support.transition.end, function() {
160
161 setTimeout(ghost.remove.bind(ghost), 0);
162
163 d.resolve();
164 }).end().css({
165 'transform': 'scaleX(1)',
166 'opacity': 1
167 });
168
169 return d.promise();
170 },
171
172 'puzzle': function(current, next, dir) {
173
174 if (!next.data('cover')) {
175 return Animations.fade.apply(this, arguments);
176 }
177
178 var d = UI.$.Deferred(), $this = this;
179
180 var boxCols = Math.round(this.options.slices/2),
181 boxWidth = Math.round(next.width()/boxCols),
182 boxRows = Math.round(next.height()/boxWidth),
183 boxHeight = Math.round(next.height()/boxRows)+1,
184 bgimage = next.data('cover').css('background-image'),
185 ghost = UI.$('<li></li>').css({
186 width : this.container.width(),
187 height : this.container.height(),
188 opacity : 1,
189 zIndex : 15
190 }),
191 ghostWidth = this.container.width(),
192 ghostHeight = this.container.height(),
193 box, rect, width;
194
195 for (var rows = 0; rows < boxRows; rows++) {
196
197 for (var cols = 0; cols < boxCols; cols++) {
198
199 width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
200
201 rect = [
202 (boxHeight * rows) +'px', // top
203 (width * (cols+1)) +'px', // right
204 (boxHeight * (rows + 1)) +'px', // bottom
205 (boxWidth * cols) +'px' // left
206 ];
207
208 box = UI.$('<div class="uk-cover-background"></div>').css({
209 'position' : 'absolute',
210 'top' : 0,
211 'left' : 0,
212 'opacity' : 0,
213 'width' : ghostWidth,
214 'height' : ghostHeight,
215 'background-image' : bgimage,
216 'clip' : ('rect('+rect.join(',')+')'),
217 '-webkit-transform' : 'translateZ(0)', // fixes webkit opacity flickering bug
218 'transform' : 'translateZ(0)' // fixes moz opacity flickering bug
219 });
220
221 ghost.append(box);
222 }
223 }
224
225 this.container.append(ghost);
226
227 var boxes = shuffle(ghost.children());
228
229 boxes.each(function(i) {
230 UI.$(this).css({
231 'transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms',
232 '-webkit-transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms'
233 });
234 }).last().on(UI.support.transition.end, function() {
235
236 setTimeout(ghost.remove.bind(ghost), 0);
237
238 d.resolve();
239 });
240
241 ghost.width();
242
243 boxes.css({'opacity': 1});
244
245 return d.promise();
246 },
247
248 'boxes': function(current, next, dir, fromfx) {
249
250 if (!next.data('cover')) {
251 return Animations.fade.apply(this, arguments);
252 }
253
254 var d = UI.$.Deferred();
255
256 var boxCols = Math.round(this.options.slices/2),
257 boxWidth = Math.round(next.width()/boxCols),
258 boxRows = Math.round(next.height()/boxWidth),
259 boxHeight = Math.round(next.height()/boxRows)+1,
260 bgimage = next.data('cover').css('background-image'),
261 ghost = UI.$('<li></li>').css({
262 width : next.width(),
263 height : next.height(),
264 opacity : 1,
265 zIndex : 15
266 }),
267 ghostWidth = next.width(),
268 ghostHeight = next.height(),
269 box, rect, width, cols;
270
271 for (var rows = 0; rows < boxRows; rows++) {
272
273 for (cols = 0; cols < boxCols; cols++) {
274
275 width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
276
277 rect = [
278 (boxHeight * rows) +'px', // top
279 (width * (cols+1)) +'px', // right
280 (boxHeight * (rows + 1)) +'px', // bottom
281 (boxWidth * cols) +'px' // left
282 ];
283
284 box = UI.$('<div class="uk-cover-background"></div>').css({
285 'position' : 'absolute',
286 'top' : 0,
287 'left' : 0,
288 'opacity' : 1,
289 'width' : ghostWidth,
290 'height' : ghostHeight,
291 'background-image' : bgimage,
292 'transform-origin' : rect[3]+' '+rect[0]+' 0',
293 'clip' : ('rect('+rect.join(',')+')'),
294 '-webkit-transform' : 'scale(0.0000000000000001)',
295 'transform' : 'scale(0.0000000000000001)'
296 });
297
298 ghost.append(box);
299 }
300 }
301
302 this.container.append(ghost);
303
304 var rowIndex = 0, colIndex = 0, timeBuff = 0, box2Darr = [[]], boxes = ghost.children(), prevCol;
305
306 if (fromfx == 'boxes-reverse') {
307 boxes = [].reverse.apply(boxes);
308 }
309
310 boxes.each(function() {
311
312 box2Darr[rowIndex][colIndex] = UI.$(this);
313 colIndex++;
314
315 if(colIndex == boxCols) {
316 rowIndex++;
317 colIndex = 0;
318 box2Darr[rowIndex] = [];
319 }
320 });
321
322 for (cols = 0, prevCol = 0; cols < (boxCols * boxRows); cols++) {
323
324 prevCol = cols;
325
326 for (var row = 0; row < boxRows; row++) {
327
328 if (prevCol >= 0 && prevCol < boxCols) {
329
330 box2Darr[row][prevCol].css({
331 'transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms',
332 '-webkit-transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms'
333 });
334 }
335 prevCol--;
336 }
337 timeBuff += 100;
338 }
339
340 boxes.last().on(UI.support.transition.end, function() {
341
342 setTimeout(ghost.remove.bind(ghost), 0);
343
344 d.resolve();
345 });
346
347 ghost.width();
348
349 boxes.css({
350 '-webkit-transform': 'scale(1)',
351 'transform': 'scale(1)'
352 });
353
354 return d.promise();
355 },
356
357 'boxes-reverse': function(current, next, dir) {
358 return Animations.boxes.apply(this, [current, next, dir, 'boxes-reverse']);
359 },
360
361 'random-fx': function(){
362
363 var animations = ['slice-up', 'fold', 'puzzle', 'slice-down', 'boxes', 'slice-up-down', 'boxes-reverse'];
364
365 this.fxIndex = (this.fxIndex === undefined ? -1 : this.fxIndex) + 1;
366
367 if (!animations[this.fxIndex]) this.fxIndex = 0;
368
369 return Animations[animations[this.fxIndex]].apply(this, arguments);
370 }
371 });
372
373
374 // helper functions
375
376 // Shuffle an array
377 var shuffle = function(arr) {
378 for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x) {}
379 return arr;
380 };
381
382 return UI.slideshow.animations;
383});
diff --git a/js/components/slideshow-fx.min.js b/js/components/slideshow-fx.min.js
new file mode 100755
index 0000000..72340d1
--- /dev/null
+++ b/js/components/slideshow-fx.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow-fx",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t=i.slideshow.animations;i.$.extend(i.slideshow.animations,{slice:function(e,s,n,o){if(!e.data("cover"))return t.fade.apply(this,arguments);for(var r,a=i.$.Deferred(),c=Math.ceil(this.element.width()/this.options.slices),d=s.data("cover").css("background-image"),h=i.$("<li></li>").css({top:0,left:0,width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),p=h.width(),l=h.height(),u="slice-up"==o?l:"0",f=0;f<this.options.slices;f++){"slice-up-down"==o&&(u=(f%2+2)%2==0?"0":l);var m,x=f==this.options.slices-1?c:c,v="rect(0px, "+x*(f+1)+"px, "+l+"px, "+c*f+"px)";m="rect(0px, "+x*(f+1)+"px, 0px, "+c*f+"px)",("slice-up"==o||"slice-up-down"==o&&(f%2+2)%2==0)&&(m="rect("+l+"px, "+x*(f+1)+"px, "+l+"px, "+c*f+"px)"),r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:p,height:l,"background-image":d,clip:m,opacity:0,transition:"all "+this.options.duration+"ms ease-in-out "+60*f+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+60*f+"ms"}).data("clip",v),h.append(r)}return this.container.append(h),h.children().last().on(i.support.transition.end,function(){setTimeout(h.remove.bind(h),0),a.resolve()}),h.width(),h.children().each(function(){var t=i.$(this);t.css({clip:t.data("clip"),opacity:1})}),a.promise()},"slice-up":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up"])},"slice-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-down"])},"slice-up-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up-down"])},fold:function(e,s){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var n,o=i.$.Deferred(),r=Math.ceil(this.element.width()/this.options.slices),a=s.data("cover").css("background-image"),c=i.$("<li></li>").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),d=s.width(),h=s.height(),p=0;p<this.options.slices;p++)n=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:d,height:h,"background-image":a,"transform-origin":r*p+"px 0 0",clip:"rect(0px, "+r*(p+1)+"px, "+h+"px, "+r*p+"px)",opacity:0,transform:"scaleX(0.000001)",transition:"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms"}),c.prepend(n);return this.container.append(c),c.width(),c.children().first().on(i.support.transition.end,function(){setTimeout(c.remove.bind(c),0),o.resolve()}).end().css({transform:"scaleX(1)",opacity:1}),o.promise()},puzzle:function(s,n){if(!n.data("cover"))return t.fade.apply(this,arguments);for(var o,r,a,c=i.$.Deferred(),d=this,h=Math.round(this.options.slices/2),p=Math.round(n.width()/h),l=Math.round(n.height()/p),u=Math.round(n.height()/l)+1,f=n.data("cover").css("background-image"),m=i.$("<li></li>").css({width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),x=this.container.width(),v=this.container.height(),g=0;l>g;g++)for(var w=0;h>w;w++)a=w==h-1?p+2:p,r=[u*g+"px",a*(w+1)+"px",u*(g+1)+"px",p*w+"px"],o=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:0,width:x,height:v,"background-image":f,clip:"rect("+r.join(",")+")","-webkit-transform":"translateZ(0)",transform:"translateZ(0)"}),m.append(o);this.container.append(m);var b=e(m.children());return b.each(function(t){i.$(this).css({transition:"all "+d.options.duration+"ms ease-in-out "+(50+25*t)+"ms","-webkit-transition":"all "+d.options.duration+"ms ease-in-out "+(50+25*t)+"ms"})}).last().on(i.support.transition.end,function(){setTimeout(m.remove.bind(m),0),c.resolve()}),m.width(),b.css({opacity:1}),c.promise()},boxes:function(e,s,n,o){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var r,a,c,d,h=i.$.Deferred(),p=Math.round(this.options.slices/2),l=Math.round(s.width()/p),u=Math.round(s.height()/l),f=Math.round(s.height()/u)+1,m=s.data("cover").css("background-image"),x=i.$("<li></li>").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),v=s.width(),g=s.height(),w=0;u>w;w++)for(d=0;p>d;d++)c=d==p-1?l+2:l,a=[f*w+"px",c*(d+1)+"px",f*(w+1)+"px",l*d+"px"],r=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,opacity:1,width:v,height:g,"background-image":m,"transform-origin":a[3]+" "+a[0]+" 0",clip:"rect("+a.join(",")+")","-webkit-transform":"scale(0.0000000000000001)",transform:"scale(0.0000000000000001)"}),x.append(r);this.container.append(x);var b,k=0,y=0,$=0,I=[[]],M=x.children();for("boxes-reverse"==o&&(M=[].reverse.apply(M)),M.each(function(){I[k][y]=i.$(this),y++,y==p&&(k++,y=0,I[k]=[])}),d=0,b=0;p*u>d;d++){b=d;for(var z=0;u>z;z++)b>=0&&p>b&&I[z][b].css({transition:"all "+this.options.duration+"ms linear "+(50+$)+"ms","-webkit-transition":"all "+this.options.duration+"ms linear "+(50+$)+"ms"}),b--;$+=100}return M.last().on(i.support.transition.end,function(){setTimeout(x.remove.bind(x),0),h.resolve()}),x.width(),M.css({"-webkit-transform":"scale(1)",transform:"scale(1)"}),h.promise()},"boxes-reverse":function(i,e,s){return t.boxes.apply(this,[i,e,s,"boxes-reverse"])},"random-fx":function(){var i=["slice-up","fold","puzzle","slice-down","boxes","slice-up-down","boxes-reverse"];return this.fxIndex=(void 0===this.fxIndex?-1:this.fxIndex)+1,i[this.fxIndex]||(this.fxIndex=0),t[i[this.fxIndex]].apply(this,arguments)}});var e=function(i){for(var t,e,s=i.length;s;t=parseInt(Math.random()*s),e=i[--s],i[s]=i[t],i[t]=e);return i};return i.slideshow.animations}); \ No newline at end of file
diff --git a/js/components/slideshow.js b/js/components/slideshow.js
new file mode 100755
index 0000000..88cd4e7
--- /dev/null
+++ b/js/components/slideshow.js
@@ -0,0 +1,560 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-slideshow", ["uikit"], function() {
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI) {
17
18 "use strict";
19
20 var Animations, playerId = 0;
21
22 UI.component('slideshow', {
23
24 defaults: {
25 animation : "fade",
26 duration : 500,
27 height : "auto",
28 start : 0,
29 autoplay : false,
30 autoplayInterval : 7000,
31 videoautoplay : true,
32 videomute : true,
33 slices : 15,
34 pauseOnHover : true,
35 kenburns : false,
36 kenburnsanimations : [
37 'uk-animation-middle-left',
38 'uk-animation-top-right',
39 'uk-animation-bottom-left',
40 'uk-animation-top-center',
41 '', // middle-center
42 'uk-animation-bottom-right'
43 ]
44 },
45
46 current : false,
47 interval : null,
48 hovering : false,
49
50 boot: function() {
51
52 // init code
53 UI.ready(function(context) {
54
55 UI.$('[data-uk-slideshow]', context).each(function() {
56
57 var slideshow = UI.$(this);
58
59 if (!slideshow.data("slideshow")) {
60 UI.slideshow(slideshow, UI.Utils.options(slideshow.attr("data-uk-slideshow")));
61 }
62 });
63 });
64 },
65
66 init: function() {
67
68 var $this = this, canvas, kbanimduration;
69
70 this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow:first'));
71 this.slides = this.container.children();
72 this.slidesCount = this.slides.length;
73 this.current = this.options.start;
74 this.animating = false;
75 this.triggers = this.find('[data-uk-slideshow-item]');
76 this.fixFullscreen = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && this.container.hasClass('uk-slideshow-fullscreen'); // viewport unit fix for height:100vh - should be fixed in iOS 8
77
78 if (this.options.kenburns) {
79
80 kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
81
82 if (!String(kbanimduration).match(/(ms|s)$/)) {
83 kbanimduration += 'ms';
84 }
85
86 if (typeof(this.options.kenburnsanimations) == 'string') {
87 this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
88 }
89 }
90
91 this.slides.each(function(index) {
92
93 var slide = UI.$(this),
94 media = slide.children('img,video,iframe').eq(0);
95
96 slide.data('media', media);
97 slide.data('sizer', media);
98
99 if (media.length) {
100
101 var placeholder;
102
103 switch(media[0].nodeName) {
104 case 'IMG':
105
106 var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
107
108 if (media.attr('width') && media.attr('height')) {
109 placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')});
110 media.replaceWith(placeholder);
111 media = placeholder;
112 placeholder = undefined;
113 }
114
115 media.css({width: '100%',height: 'auto', opacity:0});
116 slide.prepend(cover).data('cover', cover);
117 break;
118
119 case 'IFRAME':
120
121 var src = media[0].src, iframeId = 'sw-'+(++playerId);
122
123 media
124 .attr('src', '').on('load', function(){
125
126 if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
127 $this.pausemedia(media);
128 }
129
130 if ($this.options.videomute) {
131
132 $this.mutemedia(media);
133
134 var inv = setInterval((function(ic) {
135 return function() {
136 $this.mutemedia(media);
137 if (++ic >= 4) clearInterval(inv);
138 }
139 })(0), 250);
140 }
141
142 })
143 .data('slideshow', $this) // add self-reference for the vimeo-ready listener
144 .attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
145 .attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
146 .addClass('uk-position-absolute');
147
148 // disable pointer events
149 if(!UI.support.touch) media.css('pointer-events', 'none');
150
151 placeholder = true;
152
153 if (UI.cover) {
154 UI.cover(media);
155 media.attr('data-uk-cover', '{}');
156 }
157
158 break;
159
160 case 'VIDEO':
161 media.addClass('uk-cover-object uk-position-absolute');
162 placeholder = true;
163
164 if ($this.options.videomute) $this.mutemedia(media);
165 }
166
167 if (placeholder) {
168
169 canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
170 var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
171
172 slide.prepend(img);
173 slide.data('sizer', img);
174 }
175
176 } else {
177 slide.data('sizer', slide);
178 }
179
180 if ($this.hasKenBurns(slide)) {
181
182 slide.data('cover').css({
183 '-webkit-animation-duration': kbanimduration,
184 'animation-duration': kbanimduration
185 });
186 }
187 });
188
189 this.on("click.uk.slideshow", '[data-uk-slideshow-item]', function(e) {
190
191 e.preventDefault();
192
193 var slide = UI.$(this).attr('data-uk-slideshow-item');
194
195 if ($this.current == slide) return;
196
197 switch(slide) {
198 case 'next':
199 case 'previous':
200 $this[slide=='next' ? 'next':'previous']();
201 break;
202 default:
203 $this.show(parseInt(slide, 10));
204 }
205
206 $this.stop();
207 });
208
209 // Set start slide
210 this.slides.attr('aria-hidden', 'true').eq(this.current).addClass('uk-active').attr('aria-hidden', 'false');
211 this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass('uk-active');
212
213 UI.$win.on("resize load", UI.Utils.debounce(function() {
214 $this.resize();
215
216 if ($this.fixFullscreen) {
217 $this.container.css('height', window.innerHeight);
218 $this.slides.css('height', window.innerHeight);
219 }
220 }, 100));
221
222 // chrome image load fix
223 setTimeout(function(){
224 $this.resize();
225 }, 80);
226
227 // Set autoplay
228 if (this.options.autoplay) {
229 this.start();
230 }
231
232 if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
233 this.playmedia(this.slides.eq(this.current).data('media'));
234 }
235
236 if (this.options.kenburns) {
237 this.applyKenBurns(this.slides.eq(this.current));
238 }
239
240 this.container.on({
241 mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
242 mouseleave: function() { $this.hovering = false; }
243 });
244
245 this.on('swipeRight swipeLeft', function(e) {
246 $this[e.type=='swipeLeft' ? 'next' : 'previous']();
247 });
248
249 this.on('display.uk.check', function(){
250 if ($this.element.is(":visible")) {
251
252 $this.resize();
253
254 if ($this.fixFullscreen) {
255 $this.container.css('height', window.innerHeight);
256 $this.slides.css('height', window.innerHeight);
257 }
258 }
259 });
260 },
261
262
263 resize: function() {
264
265 if (this.container.hasClass('uk-slideshow-fullscreen')) return;
266
267 var height = this.options.height;
268
269 if (this.options.height === 'auto') {
270
271 height = 0;
272
273 this.slides.css('height', '').each(function() {
274 height = Math.max(height, UI.$(this).height());
275 });
276 }
277
278 this.container.css('height', height);
279 this.slides.css('height', height);
280 },
281
282 show: function(index, direction) {
283
284 if (this.animating || this.current == index) return;
285
286 this.animating = true;
287
288 var $this = this,
289 current = this.slides.eq(this.current),
290 next = this.slides.eq(index),
291 dir = direction ? direction : this.current < index ? 1 : -1,
292 currentmedia = current.data('media'),
293 animation = Animations[this.options.animation] ? this.options.animation : 'fade',
294 nextmedia = next.data('media'),
295 finalize = function() {
296
297 if (!$this.animating) return;
298
299 if (currentmedia && currentmedia.is('video,iframe')) {
300 $this.pausemedia(currentmedia);
301 }
302
303 if (nextmedia && nextmedia.is('video,iframe')) {
304 $this.playmedia(nextmedia);
305 }
306
307 next.addClass("uk-active").attr('aria-hidden', 'false');
308 current.removeClass("uk-active").attr('aria-hidden', 'true');
309
310 $this.animating = false;
311 $this.current = index;
312
313 UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
314
315 $this.trigger('show.uk.slideshow', [next, current, $this]);
316 };
317
318 $this.applyKenBurns(next);
319
320 // animation fallback
321 if (!UI.support.animation) {
322 animation = 'none';
323 }
324
325 current = UI.$(current);
326 next = UI.$(next);
327
328 $this.trigger('beforeshow.uk.slideshow', [next, current, $this]);
329
330 Animations[animation].apply(this, [current, next, dir]).then(finalize);
331
332 $this.triggers.removeClass('uk-active');
333 $this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
334 },
335
336 applyKenBurns: function(slide) {
337
338 if (!this.hasKenBurns(slide)) {
339 return;
340 }
341
342 var animations = this.options.kenburnsanimations,
343 index = this.kbindex || 0;
344
345
346 slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
347 slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
348
349 this.kbindex = animations[index + 1] ? (index+1):0;
350 },
351
352 hasKenBurns: function(slide) {
353 return (this.options.kenburns && slide.data('cover'));
354 },
355
356 next: function() {
357 this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1);
358 },
359
360 previous: function() {
361 this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1);
362 },
363
364 start: function() {
365
366 this.stop();
367
368 var $this = this;
369
370 this.interval = setInterval(function() {
371 if (!$this.hovering) $this.next();
372 }, this.options.autoplayInterval);
373
374 },
375
376 stop: function() {
377 if (this.interval) clearInterval(this.interval);
378 },
379
380 playmedia: function(media) {
381
382 if (!(media && media[0])) return;
383
384 switch(media[0].nodeName) {
385 case 'VIDEO':
386
387 if (!this.options.videomute) {
388 media[0].muted = false;
389 }
390
391 media[0].play();
392 break;
393 case 'IFRAME':
394
395 if (!this.options.videomute) {
396 media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
397 }
398
399 media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
400 break;
401 }
402 },
403
404 pausemedia: function(media) {
405
406 switch(media[0].nodeName) {
407 case 'VIDEO':
408 media[0].pause();
409 break;
410 case 'IFRAME':
411 media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
412 break;
413 }
414 },
415
416 mutemedia: function(media) {
417
418 switch(media[0].nodeName) {
419 case 'VIDEO':
420 media[0].muted = true;
421 break;
422 case 'IFRAME':
423 media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
424 break;
425 }
426 }
427 });
428
429 Animations = {
430
431 'none': function() {
432
433 var d = UI.$.Deferred();
434 d.resolve();
435 return d.promise();
436 },
437
438 'scroll': function(current, next, dir) {
439
440 var d = UI.$.Deferred();
441
442 current.css('animation-duration', this.options.duration+'ms');
443 next.css('animation-duration', this.options.duration+'ms');
444
445 next.css('opacity', 1).one(UI.support.animation.end, function() {
446
447 current.css('opacity', 0).removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
448 next.removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
449 d.resolve();
450
451 }.bind(this));
452
453 current.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
454 next.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
455 next.width(); // force redraw
456
457 return d.promise();
458 },
459
460 'swipe': function(current, next, dir) {
461
462 var d = UI.$.Deferred();
463
464 current.css('animation-duration', this.options.duration+'ms');
465 next.css('animation-duration', this.options.duration+'ms');
466
467 next.css('opacity', 1).one(UI.support.animation.end, function() {
468
469 current.css('opacity', 0).removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
470 next.removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
471 d.resolve();
472
473 }.bind(this));
474
475 current.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
476 next.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
477 next.width(); // force redraw
478
479 return d.promise();
480 },
481
482 'scale': function(current, next, dir) {
483
484 var d = UI.$.Deferred();
485
486 current.css('animation-duration', this.options.duration+'ms');
487 next.css('animation-duration', this.options.duration+'ms');
488
489 next.css('opacity', 1);
490
491 current.one(UI.support.animation.end, function() {
492
493 current.css('opacity', 0).removeClass('uk-slideshow-scale-out');
494 d.resolve();
495
496 }.bind(this));
497
498 current.addClass('uk-slideshow-scale-out');
499 current.width(); // force redraw
500
501 return d.promise();
502 },
503
504 'fade': function(current, next, dir) {
505
506 var d = UI.$.Deferred();
507
508 current.css('animation-duration', this.options.duration+'ms');
509 next.css('animation-duration', this.options.duration+'ms');
510
511 next.css('opacity', 1);
512
513 // for plain text content slides - looks smoother
514 if (!(next.data('cover') || next.data('placeholder'))) {
515
516 next.css('opacity', 1).one(UI.support.animation.end, function() {
517 next.removeClass('uk-slideshow-fade-in');
518 }).addClass('uk-slideshow-fade-in');
519 }
520
521 current.one(UI.support.animation.end, function() {
522
523 current.css('opacity', 0).removeClass('uk-slideshow-fade-out');
524 d.resolve();
525
526 }.bind(this));
527
528 current.addClass('uk-slideshow-fade-out');
529 current.width(); // force redraw
530
531 return d.promise();
532 }
533 };
534
535 UI.slideshow.animations = Animations;
536
537 // Listen for messages from the vimeo player
538 window.addEventListener('message', function onMessageReceived(e) {
539
540 var data = e.data, iframe;
541
542 if (typeof(data) == 'string') {
543
544 try {
545 data = JSON.parse(data);
546 } catch(err) {
547 data = {};
548 }
549 }
550
551 if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
552 iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
553
554 if (iframe.length) {
555 iframe.data('slideshow').mutemedia(iframe);
556 }
557 }
558 }, false);
559
560});
diff --git a/js/components/slideshow.min.js b/js/components/slideshow.min.js
new file mode 100755
index 0000000..0dc7037
--- /dev/null
+++ b/js/components/slideshow.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t,s=0;i.component("slideshow",{defaults:{animation:"fade",duration:500,height:"auto",start:0,autoplay:!1,autoplayInterval:7e3,videoautoplay:!0,videomute:!0,slices:15,pauseOnHover:!0,kenburns:!1,kenburnsanimations:["uk-animation-middle-left","uk-animation-top-right","uk-animation-bottom-left","uk-animation-top-center","","uk-animation-bottom-right"]},current:!1,interval:null,hovering:!1,boot:function(){i.ready(function(t){i.$("[data-uk-slideshow]",t).each(function(){var t=i.$(this);t.data("slideshow")||i.slideshow(t,i.Utils.options(t.attr("data-uk-slideshow")))})})},init:function(){var t,e,a=this;this.container=this.element.hasClass("uk-slideshow")?this.element:i.$(this.find(".uk-slideshow:first")),this.slides=this.container.children(),this.slidesCount=this.slides.length,this.current=this.options.start,this.animating=!1,this.triggers=this.find("[data-uk-slideshow-item]"),this.fixFullscreen=navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&this.container.hasClass("uk-slideshow-fullscreen"),this.options.kenburns&&(e=this.options.kenburns===!0?"15s":this.options.kenburns,String(e).match(/(ms|s)$/)||(e+="ms"),"string"==typeof this.options.kenburnsanimations&&(this.options.kenburnsanimations=this.options.kenburnsanimations.split(","))),this.slides.each(function(n){var o=i.$(this),r=o.children("img,video,iframe").eq(0);if(o.data("media",r),o.data("sizer",r),r.length){var d;switch(r[0].nodeName){case"IMG":var u=i.$('<div class="uk-cover-background uk-position-cover"></div>').css({"background-image":"url("+r.attr("src")+")"});r.attr("width")&&r.attr("height")&&(d=i.$("<canvas></canvas>").attr({width:r.attr("width"),height:r.attr("height")}),r.replaceWith(d),r=d,d=void 0),r.css({width:"100%",height:"auto",opacity:0}),o.prepend(u).data("cover",u);break;case"IFRAME":var h=r[0].src,c="sw-"+ ++s;r.attr("src","").on("load",function(){if((n!==a.current||n==a.current&&!a.options.videoautoplay)&&a.pausemedia(r),a.options.videomute){a.mutemedia(r);var i=setInterval(function(t){return function(){a.mutemedia(r),++t>=4&&clearInterval(i)}}(0),250)}}).data("slideshow",a).attr("data-player-id",c).attr("src",[h,h.indexOf("?")>-1?"&":"?","enablejsapi=1&api=1&player_id="+c].join("")).addClass("uk-position-absolute"),i.support.touch||r.css("pointer-events","none"),d=!0,i.cover&&(i.cover(r),r.attr("data-uk-cover","{}"));break;case"VIDEO":r.addClass("uk-cover-object uk-position-absolute"),d=!0,a.options.videomute&&a.mutemedia(r)}if(d){t=i.$("<canvas></canvas>").attr({width:r[0].width,height:r[0].height});var l=i.$('<img style="width:100%;height:auto;">').attr("src",t[0].toDataURL());o.prepend(l),o.data("sizer",l)}}else o.data("sizer",o);a.hasKenBurns(o)&&o.data("cover").css({"-webkit-animation-duration":e,"animation-duration":e})}),this.on("click.uk.slideshow","[data-uk-slideshow-item]",function(t){t.preventDefault();var s=i.$(this).attr("data-uk-slideshow-item");if(a.current!=s){switch(s){case"next":case"previous":a["next"==s?"next":"previous"]();break;default:a.show(parseInt(s,10))}a.stop()}}),this.slides.attr("aria-hidden","true").eq(this.current).addClass("uk-active").attr("aria-hidden","false"),this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass("uk-active"),i.$win.on("resize load",i.Utils.debounce(function(){a.resize(),a.fixFullscreen&&(a.container.css("height",window.innerHeight),a.slides.css("height",window.innerHeight))},100)),setTimeout(function(){a.resize()},80),this.options.autoplay&&this.start(),this.options.videoautoplay&&this.slides.eq(this.current).data("media")&&this.playmedia(this.slides.eq(this.current).data("media")),this.options.kenburns&&this.applyKenBurns(this.slides.eq(this.current)),this.container.on({mouseenter:function(){a.options.pauseOnHover&&(a.hovering=!0)},mouseleave:function(){a.hovering=!1}}),this.on("swipeRight swipeLeft",function(i){a["swipeLeft"==i.type?"next":"previous"]()}),this.on("display.uk.check",function(){a.element.is(":visible")&&(a.resize(),a.fixFullscreen&&(a.container.css("height",window.innerHeight),a.slides.css("height",window.innerHeight)))})},resize:function(){if(!this.container.hasClass("uk-slideshow-fullscreen")){var t=this.options.height;"auto"===this.options.height&&(t=0,this.slides.css("height","").each(function(){t=Math.max(t,i.$(this).height())})),this.container.css("height",t),this.slides.css("height",t)}},show:function(s,e){if(!this.animating&&this.current!=s){this.animating=!0;var a=this,n=this.slides.eq(this.current),o=this.slides.eq(s),r=e?e:this.current<s?1:-1,d=n.data("media"),u=t[this.options.animation]?this.options.animation:"fade",h=o.data("media"),c=function(){a.animating&&(d&&d.is("video,iframe")&&a.pausemedia(d),h&&h.is("video,iframe")&&a.playmedia(h),o.addClass("uk-active").attr("aria-hidden","false"),n.removeClass("uk-active").attr("aria-hidden","true"),a.animating=!1,a.current=s,i.Utils.checkDisplay(o,'[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)'),a.trigger("show.uk.slideshow",[o,n,a]))};a.applyKenBurns(o),i.support.animation||(u="none"),n=i.$(n),o=i.$(o),a.trigger("beforeshow.uk.slideshow",[o,n,a]),t[u].apply(this,[n,o,r]).then(c),a.triggers.removeClass("uk-active"),a.triggers.filter('[data-uk-slideshow-item="'+s+'"]').addClass("uk-active")}},applyKenBurns:function(i){if(this.hasKenBurns(i)){var t=this.options.kenburnsanimations,s=this.kbindex||0;i.data("cover").attr("class","uk-cover-background uk-position-cover").width(),i.data("cover").addClass(["uk-animation-scale","uk-animation-reverse",t[s].trim()].join(" ")),this.kbindex=t[s+1]?s+1:0}},hasKenBurns:function(i){return this.options.kenburns&&i.data("cover")},next:function(){this.show(this.slides[this.current+1]?this.current+1:0,1)},previous:function(){this.show(this.slides[this.current-1]?this.current-1:this.slides.length-1,-1)},start:function(){this.stop();var i=this;this.interval=setInterval(function(){i.hovering||i.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)},playmedia:function(i){if(i&&i[0])switch(i[0].nodeName){case"VIDEO":this.options.videomute||(i[0].muted=!1),i[0].play();break;case"IFRAME":this.options.videomute||i[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}',"*"),i[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}',"*")}},pausemedia:function(i){switch(i[0].nodeName){case"VIDEO":i[0].pause();break;case"IFRAME":i[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}',"*")}},mutemedia:function(i){switch(i[0].nodeName){case"VIDEO":i[0].muted=!0;break;case"IFRAME":i[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}',"*")}}}),t={none:function(){var t=i.$.Deferred();return t.resolve(),t.promise()},scroll:function(t,s,e){var a=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1).one(i.support.animation.end,function(){t.css("opacity",0).removeClass(-1==e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),s.removeClass(-1==e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),a.resolve()}.bind(this)),t.addClass(-1==e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),s.addClass(-1==e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),s.width(),a.promise()},swipe:function(t,s,e){var a=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1).one(i.support.animation.end,function(){t.css("opacity",0).removeClass(-1===e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),s.removeClass(-1===e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),a.resolve()}.bind(this)),t.addClass(-1==e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),s.addClass(-1==e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),s.width(),a.promise()},scale:function(t,s){var e=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1),t.one(i.support.animation.end,function(){t.css("opacity",0).removeClass("uk-slideshow-scale-out"),e.resolve()}.bind(this)),t.addClass("uk-slideshow-scale-out"),t.width(),e.promise()},fade:function(t,s){var e=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1),s.data("cover")||s.data("placeholder")||s.css("opacity",1).one(i.support.animation.end,function(){s.removeClass("uk-slideshow-fade-in")}).addClass("uk-slideshow-fade-in"),t.one(i.support.animation.end,function(){t.css("opacity",0).removeClass("uk-slideshow-fade-out"),e.resolve()}.bind(this)),t.addClass("uk-slideshow-fade-out"),t.width(),e.promise()}},i.slideshow.animations=t,window.addEventListener("message",function(t){var s,e=t.data;if("string"==typeof e)try{e=JSON.parse(e)}catch(a){e={}}t.origin&&t.origin.indexOf("vimeo")>-1&&"ready"==e.event&&e.player_id&&(s=i.$('[data-player-id="'+e.player_id+'"]'),s.length&&s.data("slideshow").mutemedia(s))},!1)}); \ No newline at end of file
diff --git a/js/components/sortable.js b/js/components/sortable.js
new file mode 100755
index 0000000..de378d9
--- /dev/null
+++ b/js/components/sortable.js
@@ -0,0 +1,688 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2/*
3 * Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
4 */
5(function(addon) {
6
7 var component;
8
9 if (window.UIkit) {
10 component = addon(UIkit);
11 }
12
13 if (typeof define == "function" && define.amd) {
14 define("uikit-sortable", ["uikit"], function(){
15 return component || addon(UIkit);
16 });
17 }
18
19})(function(UI){
20
21 "use strict";
22
23 var supportsTouch = ('ontouchstart' in window || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
24 draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement, startEvent;
25
26 var POINTER_DOWN = supportsTouch ? ('MSGesture' in window ? 'pointerdown':'touchstart') : 'mousedown',
27 POINTER_MOVE = supportsTouch ? ('MSGesture' in window ? 'pointermove':'touchmove') : 'mousemove',
28 POINTER_UP = supportsTouch ? ('MSGesture' in window ? 'pointerup':'touchend') : 'mouseup';
29
30 function closestSortable(ele) {
31
32 ele = UI.$(ele);
33
34 do {
35 if (ele.data('sortable')) {
36 return ele;
37 }
38 ele = UI.$(ele).parent();
39 } while(ele.length);
40
41 return ele;
42 }
43
44 UI.component('sortable', {
45
46 defaults: {
47
48 animation : 150,
49 threshold : 10,
50
51 childClass : 'uk-sortable-item',
52 placeholderClass : 'uk-sortable-placeholder',
53 overClass : 'uk-sortable-over',
54 draggingClass : 'uk-sortable-dragged',
55 dragMovingClass : 'uk-sortable-moving',
56 baseClass : 'uk-sortable',
57 noDragClass : 'uk-sortable-nodrag',
58 emptyClass : 'uk-sortable-empty',
59 dragCustomClass : '',
60 handleClass : false,
61 group : false,
62
63 stop : function() {},
64 start : function() {},
65 change : function() {}
66 },
67
68 boot: function() {
69
70 // auto init
71 UI.ready(function(context) {
72
73 UI.$("[data-uk-sortable]", context).each(function(){
74
75 var ele = UI.$(this);
76
77 if(!ele.data("sortable")) {
78 UI.sortable(ele, UI.Utils.options(ele.attr("data-uk-sortable")));
79 }
80 });
81 });
82
83 UI.$html.on(POINTER_MOVE, function(e) {
84
85 if (delayIdle) {
86
87 var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e;
88
89 if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) {
90 delayIdle.apply(src);
91 }
92 }
93
94 if (draggingPlaceholder) {
95
96 if (!moving) {
97 moving = true;
98 draggingPlaceholder.show();
99
100 draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
101 draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
102
103 UI.$html.addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
104 }
105
106 var offset = draggingPlaceholder.data('mouse-offset'),
107 ev = e.originalEvent.touches && e.originalEvent.touches[0] || e.originalEvent,
108 left = parseInt(ev.pageX, 10) + offset.left,
109 top = parseInt(ev.pageY, 10) + offset.top;
110
111 draggingPlaceholder.css({'left': left, 'top': top });
112
113 // adjust document scrolling
114
115 if (top + (draggingPlaceholder.height()/3) > document.body.offsetHeight) {
116 return;
117 }
118
119 if (top < UI.$win.scrollTop()) {
120 UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/3));
121 } else if ( (top + (draggingPlaceholder.height()/3)) > (window.innerHeight + UI.$win.scrollTop()) ) {
122 UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/3));
123 }
124 }
125 });
126
127 UI.$html.on(POINTER_UP, function(e) {
128
129 delayIdle = clickedlink = false;
130
131 // dragging?
132 if (!currentlyDraggingElement || !draggingPlaceholder) {
133 // completely reset dragging attempt. will cause weird delay behavior elsewise
134 currentlyDraggingElement = draggingPlaceholder = null;
135 return;
136 }
137
138 // inside or outside of sortable?
139 var sortable = closestSortable(currentlyDraggingElement),
140 component = draggingPlaceholder.$sortable,
141 ev = { type: e.type };
142
143 if (sortable[0]) {
144 component.dragDrop(ev, component.element);
145 }
146 component.dragEnd(ev, component.element);
147 });
148 },
149
150 init: function() {
151
152 var $this = this,
153 element = this.element[0];
154
155 touchedlists = [];
156
157 this.checkEmptyList();
158
159 this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group'));
160
161 var handleDragStart = delegate(function(e) {
162
163 if (e.data && e.data.sortable) {
164 return;
165 }
166
167 var $target = UI.$(e.target),
168 $link = $target.is('a[href]') ? $target:$target.parents('a[href]');
169
170 if ($target.is(':input')) {
171 return;
172 }
173
174 if ($this.options.handleClass) {
175 var handle = $target.hasClass($this.options.handleClass) ? $target : $target.closest('.'+$this.options.handleClass, $this.element);
176 if (!handle.length) return;
177 }
178
179 e.preventDefault();
180
181 if ($link.length) {
182
183 $link.one('click', function(e){
184 e.preventDefault();
185 }).one(POINTER_UP, function(){
186
187 if (!moved) {
188 $link.trigger('click');
189 if (supportsTouch && $link.attr('href').trim()) {
190 location.href = $link.attr('href');
191 }
192 }
193 });
194 }
195
196 e.data = e.data || {};
197
198 e.data.sortable = element;
199
200 return $this.dragStart(e, this);
201 });
202
203 var handleDragEnter = delegate(UI.Utils.debounce(function(e) {
204 return $this.dragEnter(e, this);
205 }), 40);
206
207 var handleDragLeave = delegate(function(e) {
208
209 // Prevent dragenter on a child from allowing a dragleave on the container
210 var previousCounter = $this.dragenterData(this);
211 $this.dragenterData(this, previousCounter - 1);
212
213 // This is a fix for child elements firing dragenter before the parent fires dragleave
214 if (!$this.dragenterData(this)) {
215 UI.$(this).removeClass($this.options.overClass);
216 $this.dragenterData(this, false);
217 }
218 });
219
220 var handleTouchMove = delegate(function(e) {
221
222 if (!currentlyDraggingElement ||
223 currentlyDraggingElement === this ||
224 currentlyDraggingTarget === this) {
225 return true;
226 }
227
228 $this.element.children().removeClass($this.options.overClass);
229 currentlyDraggingTarget = this;
230
231 $this.moveElementNextTo(currentlyDraggingElement, this);
232
233 return prevent(e);
234 });
235
236 // Bind/unbind standard mouse/touch events as a polyfill.
237 function addDragHandlers() {
238
239 if (supportsTouch && startEvent.touches && startEvent.touches.length) {
240 element.addEventListener(POINTER_MOVE, handleTouchMove, false);
241 } else {
242 element.addEventListener('mouseover', handleDragEnter, false);
243 element.addEventListener('mouseout', handleDragLeave, false);
244 }
245
246 // document.addEventListener("selectstart", prevent, false);
247 }
248
249 function removeDragHandlers() {
250 if (supportsTouch && startEvent.touches && startEvent.touches.length) {
251 element.removeEventListener(POINTER_MOVE, handleTouchMove, false);
252 } else {
253 element.removeEventListener('mouseover', handleDragEnter, false);
254 element.removeEventListener('mouseout', handleDragLeave, false);
255 }
256
257 // document.removeEventListener("selectstart", prevent, false);
258 }
259
260 this.addDragHandlers = addDragHandlers;
261 this.removeDragHandlers = removeDragHandlers;
262
263 function handleDragMove(e) {
264
265 if (!currentlyDraggingElement) {
266 return;
267 }
268
269 $this.dragMove(e, $this);
270 }
271
272 function delegate(fn) {
273
274 return function(e) {
275
276 var touch, target, context;
277
278 startEvent = e;
279
280 if (e) {
281 touch = e.touches && e.touches[0] || e;
282 target = touch.target || e.target;
283
284 // Fix event.target for a touch event
285 if (supportsTouch && document.elementFromPoint) {
286 target = document.elementFromPoint(touch.pageX - document.body.scrollLeft, touch.pageY - document.body.scrollTop);
287 }
288
289 overElement = UI.$(target);
290 }
291
292 if (UI.$(target).hasClass('.'+$this.options.childClass)) {
293 fn.apply(target, [e]);
294 } else if (target !== element) {
295
296 // If a child is initiating the event or ending it, then use the container as context for the callback.
297 context = moveUpToChildNode(element, target);
298
299 if (context) {
300 fn.apply(context, [e]);
301 }
302 }
303 };
304 }
305
306 window.addEventListener(POINTER_MOVE, handleDragMove, false);
307 element.addEventListener(POINTER_DOWN, handleDragStart, false);
308 },
309
310 dragStart: function(e, elem) {
311
312 moved = false;
313 moving = false;
314 dragging = false;
315
316 var $this = this,
317 target = UI.$(e.target);
318
319 if (!supportsTouch && e.button==2) {
320 return;
321 }
322
323 if (target.is('.'+$this.options.noDragClass) || target.closest('.'+$this.options.noDragClass).length) {
324 return;
325 }
326
327 // prevent dragging if taget is a form field
328 if (target.is(':input')) {
329 return;
330 }
331
332 currentlyDraggingElement = elem;
333
334 // init drag placeholder
335 if (draggingPlaceholder) {
336 draggingPlaceholder.remove();
337 }
338
339 var $current = UI.$(currentlyDraggingElement), offset = $current.offset(), ev = e.touches && e.touches[0] || e;
340
341 delayIdle = {
342
343 pos : { x:ev.pageX, y:ev.pageY },
344 threshold : $this.options.handleClass ? 1 : $this.options.threshold,
345 apply : function(evt) {
346
347 draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
348 display : 'none',
349 top : offset.top,
350 left : offset.left,
351 width : $current.width(),
352 height : $current.height(),
353 padding : $current.css('padding')
354 }).data({
355 'mouse-offset': {
356 'left' : offset.left - parseInt(ev.pageX, 10),
357 'top' : offset.top - parseInt(ev.pageY, 10)
358 },
359 'origin' : $this.element,
360 'index' : $current.index()
361 }).append($current.html()).appendTo('body');
362
363 draggingPlaceholder.$current = $current;
364 draggingPlaceholder.$sortable = $this;
365
366 $current.data({
367 'start-list': $current.parent(),
368 'start-index': $current.index(),
369 'sortable-group': $this.options.group
370 });
371
372 $this.addDragHandlers();
373
374 $this.options.start(this, currentlyDraggingElement);
375 $this.trigger('start.uk.sortable', [$this, currentlyDraggingElement, draggingPlaceholder]);
376
377 moved = true;
378 delayIdle = false;
379 }
380 };
381 },
382
383 dragMove: function(e, elem) {
384
385 overElement = UI.$(document.elementFromPoint(e.pageX - (document.body.scrollLeft || document.scrollLeft || 0), e.pageY - (document.body.scrollTop || document.documentElement.scrollTop || 0)));
386
387 var overRoot = overElement.closest('.'+this.options.baseClass),
388 groupOver = overRoot.data("sortable-group"),
389 $current = UI.$(currentlyDraggingElement),
390 currentRoot = $current.parent(),
391 groupCurrent = $current.data("sortable-group"),
392 overChild;
393
394 if (overRoot[0] !== currentRoot[0] && groupCurrent !== undefined && groupOver === groupCurrent) {
395
396 overRoot.data('sortable').addDragHandlers();
397
398 touchedlists.push(overRoot);
399 overRoot.children().addClass(this.options.childClass);
400
401 // swap root
402 if (overRoot.children().length > 0) {
403 overChild = overElement.closest('.'+this.options.childClass);
404
405 if (overChild.length) {
406 overChild.before($current);
407 } else {
408 overRoot.append($current);
409 }
410
411 } else { // empty list
412 overElement.append($current);
413 }
414
415 UIkit.$doc.trigger('mouseover');
416 }
417
418 this.checkEmptyList();
419 this.checkEmptyList(currentRoot);
420 },
421
422 dragEnter: function(e, elem) {
423
424 if (!currentlyDraggingElement || currentlyDraggingElement === elem) {
425 return true;
426 }
427
428 var previousCounter = this.dragenterData(elem);
429
430 this.dragenterData(elem, previousCounter + 1);
431
432 // Prevent dragenter on a child from allowing a dragleave on the container
433 if (previousCounter === 0) {
434
435 var currentlist = UI.$(elem).parent(),
436 startlist = UI.$(currentlyDraggingElement).data("start-list");
437
438 if (currentlist[0] !== startlist[0]) {
439
440 var groupOver = currentlist.data('sortable-group'),
441 groupCurrent = UI.$(currentlyDraggingElement).data("sortable-group");
442
443 if ((groupOver || groupCurrent) && (groupOver != groupCurrent)) {
444 return false;
445 }
446 }
447
448 UI.$(elem).addClass(this.options.overClass);
449 this.moveElementNextTo(currentlyDraggingElement, elem);
450 }
451
452 return false;
453 },
454
455 dragEnd: function(e, elem) {
456
457 var $this = this;
458
459 // avoid triggering event twice
460 if (currentlyDraggingElement) {
461 // TODO: trigger on right element?
462 this.options.stop(elem);
463 this.trigger('stop.uk.sortable', [this]);
464 }
465
466 currentlyDraggingElement = null;
467 currentlyDraggingTarget = null;
468
469 touchedlists.push(this.element);
470 touchedlists.forEach(function(el, i) {
471 UI.$(el).children().each(function() {
472 if (this.nodeType === 1) {
473 UI.$(this).removeClass($this.options.overClass)
474 .removeClass($this.options.placeholderClass)
475 .removeClass($this.options.childClass);
476 $this.dragenterData(this, false);
477 }
478 });
479 });
480
481 touchedlists = [];
482
483 UI.$html.removeClass(this.options.dragMovingClass);
484
485 this.removeDragHandlers();
486
487 if (draggingPlaceholder) {
488 draggingPlaceholder.remove();
489 draggingPlaceholder = null;
490 }
491 },
492
493 dragDrop: function(e, elem) {
494
495 if (e.type === 'drop') {
496
497 if (e.stopPropagation) {
498 e.stopPropagation();
499 }
500
501 if (e.preventDefault) {
502 e.preventDefault();
503 }
504 }
505
506 this.triggerChangeEvents();
507 },
508
509 triggerChangeEvents: function() {
510
511 // trigger events once
512 if (!currentlyDraggingElement) return;
513
514 var $current = UI.$(currentlyDraggingElement),
515 oldRoot = draggingPlaceholder.data("origin"),
516 newRoot = $current.closest('.'+this.options.baseClass),
517 triggers = [],
518 el = UI.$(currentlyDraggingElement);
519
520 // events depending on move inside lists or across lists
521 if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) {
522 triggers.push({sortable: this, mode: 'moved'});
523 } else if (oldRoot[0] != newRoot[0]) {
524 triggers.push({sortable: UI.$(newRoot).data('sortable'), mode: 'added'}, {sortable: UI.$(oldRoot).data('sortable'), mode: 'removed'});
525 }
526
527 triggers.forEach(function (trigger, i) {
528 if (trigger.sortable) {
529 trigger.sortable.element.trigger('change.uk.sortable', [trigger.sortable, el, trigger.mode]);
530 }
531 });
532 },
533
534 dragenterData: function(element, val) {
535
536 element = UI.$(element);
537
538 if (arguments.length == 1) {
539 return parseInt(element.data('child-dragenter'), 10) || 0;
540 } else if (!val) {
541 element.removeData('child-dragenter');
542 } else {
543 element.data('child-dragenter', Math.max(0, val));
544 }
545 },
546
547 moveElementNextTo: function(element, elementToMoveNextTo) {
548
549 dragging = true;
550
551 var $this = this,
552 list = UI.$(element).parent().css('min-height', ''),
553 next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
554 children = list.children(),
555 count = children.length;
556
557 if (!$this.options.animation) {
558 elementToMoveNextTo.parentNode.insertBefore(element, next);
559 UI.Utils.checkDisplay($this.element.parent());
560 return;
561 }
562
563 list.css('min-height', list.height());
564
565 children.stop().each(function(){
566 var ele = UI.$(this),
567 offset = ele.position();
568
569 offset.width = ele.width();
570
571 ele.data('offset-before', offset);
572 });
573
574 elementToMoveNextTo.parentNode.insertBefore(element, next);
575
576 UI.Utils.checkDisplay($this.element.parent());
577
578 children = list.children().each(function() {
579 var ele = UI.$(this);
580 ele.data('offset-after', ele.position());
581 }).each(function() {
582 var ele = UI.$(this),
583 before = ele.data('offset-before');
584 ele.css({'position':'absolute', 'top':before.top, 'left':before.left, 'min-width':before.width });
585 });
586
587 children.each(function(){
588
589 var ele = UI.$(this),
590 before = ele.data('offset-before'),
591 offset = ele.data('offset-after');
592
593 ele.css('pointer-events', 'none').width();
594
595 setTimeout(function(){
596 ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
597 ele.css({'position':'','top':'', 'left':'', 'min-width': '', 'pointer-events':''}).removeClass($this.options.overClass).removeData('child-dragenter');
598 count--;
599 if (!count) {
600 list.css('min-height', '');
601 UI.Utils.checkDisplay($this.element.parent());
602 }
603 });
604 }, 0);
605 });
606 },
607
608 serialize: function() {
609
610 var data = [], item, attribute;
611
612 this.element.children().each(function(j, child) {
613 item = {};
614 for (var i = 0, attr, val; i < child.attributes.length; i++) {
615 attribute = child.attributes[i];
616 if (attribute.name.indexOf('data-') === 0) {
617 attr = attribute.name.substr(5);
618 val = UI.Utils.str2json(attribute.value);
619 item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
620 }
621 }
622 data.push(item);
623 });
624
625 return data;
626 },
627
628 checkEmptyList: function(list) {
629
630 list = list ? UI.$(list) : this.element;
631
632 if (this.options.emptyClass) {
633 list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
634 }
635 }
636 });
637
638 // helpers
639
640 function isBelow(el1, el2) {
641
642 var parent = el1.parentNode;
643
644 if (el2.parentNode != parent) {
645 return false;
646 }
647
648 var cur = el1.previousSibling;
649
650 while (cur && cur.nodeType !== 9) {
651 if (cur === el2) {
652 return true;
653 }
654 cur = cur.previousSibling;
655 }
656
657 return false;
658 }
659
660 function moveUpToChildNode(parent, child) {
661 var cur = child;
662 if (cur == parent) { return null; }
663
664 while (cur) {
665 if (cur.parentNode === parent) {
666 return cur;
667 }
668
669 cur = cur.parentNode;
670 if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
671 break;
672 }
673 }
674 return null;
675 }
676
677 function prevent(e) {
678 if (e.stopPropagation) {
679 e.stopPropagation();
680 }
681 if (e.preventDefault) {
682 e.preventDefault();
683 }
684 e.returnValue = false;
685 }
686
687 return UI.sortable;
688});
diff --git a/js/components/sortable.min.js b/js/components/sortable.min.js
new file mode 100755
index 0000000..3807ff1
--- /dev/null
+++ b/js/components/sortable.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-sortable",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";function e(e){e=t.$(e);do{if(e.data("sortable"))return e;e=t.$(e).parent()}while(e.length);return e}function o(t,e){var o=t.parentNode;if(e.parentNode!=o)return!1;for(var n=t.previousSibling;n&&9!==n.nodeType;){if(n===e)return!0;n=n.previousSibling}return!1}function n(t,e){var o=e;if(o==t)return null;for(;o;){if(o.parentNode===t)return o;if(o=o.parentNode,!o||!o.ownerDocument||11===o.nodeType)break}return null}function s(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}var a,r,i,l,d,h,u,p,c,g,f,m="ontouchstart"in window||"MSGesture"in window||window.DocumentTouch&&document instanceof DocumentTouch,v=m?"MSGesture"in window?"pointerdown":"touchstart":"mousedown",b=m?"MSGesture"in window?"pointermove":"touchmove":"mousemove",C=m?"MSGesture"in window?"pointerup":"touchend":"mouseup";return t.component("sortable",{defaults:{animation:150,threshold:10,childClass:"uk-sortable-item",placeholderClass:"uk-sortable-placeholder",overClass:"uk-sortable-over",draggingClass:"uk-sortable-dragged",dragMovingClass:"uk-sortable-moving",baseClass:"uk-sortable",noDragClass:"uk-sortable-nodrag",emptyClass:"uk-sortable-empty",dragCustomClass:"",handleClass:!1,group:!1,stop:function(){},start:function(){},change:function(){}},boot:function(){t.ready(function(e){t.$("[data-uk-sortable]",e).each(function(){var e=t.$(this);e.data("sortable")||t.sortable(e,t.Utils.options(e.attr("data-uk-sortable")))})}),t.$html.on(b,function(e){if(u){var o=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e;(Math.abs(o.pageX-u.pos.x)>u.threshold||Math.abs(o.pageY-u.pos.y)>u.threshold)&&u.apply(o)}if(a){d||(d=!0,a.show(),a.$current.addClass(a.$sortable.options.placeholderClass),a.$sortable.element.children().addClass(a.$sortable.options.childClass),t.$html.addClass(a.$sortable.options.dragMovingClass));var n=a.data("mouse-offset"),s=e.originalEvent.touches&&e.originalEvent.touches[0]||e.originalEvent,r=parseInt(s.pageX,10)+n.left,i=parseInt(s.pageY,10)+n.top;if(a.css({left:r,top:i}),i+a.height()/3>document.body.offsetHeight)return;i<t.$win.scrollTop()?t.$win.scrollTop(t.$win.scrollTop()-Math.ceil(a.height()/3)):i+a.height()/3>window.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(a.height()/3))}}),t.$html.on(C,function(t){if(u=h=!1,!r||!a)return r=a=null,void 0;var o=e(r),n=a.$sortable,s={type:t.type};o[0]&&n.dragDrop(s,n.element),n.dragEnd(s,n.element)})},init:function(){function e(){m&&f.touches&&f.touches.length?h.addEventListener(b,y,!1):(h.addEventListener("mouseover",$,!1),h.addEventListener("mouseout",w,!1))}function o(){m&&f.touches&&f.touches.length?h.removeEventListener(b,y,!1):(h.removeEventListener("mouseover",$,!1),h.removeEventListener("mouseout",w,!1))}function a(t){r&&d.dragMove(t,d)}function l(e){return function(o){var s,a,r;f=o,o&&(s=o.touches&&o.touches[0]||o,a=s.target||o.target,m&&document.elementFromPoint&&(a=document.elementFromPoint(s.pageX-document.body.scrollLeft,s.pageY-document.body.scrollTop)),g=t.$(a)),t.$(a).hasClass("."+d.options.childClass)?e.apply(a,[o]):a!==h&&(r=n(h,a),r&&e.apply(r,[o]))}}var d=this,h=this.element[0];p=[],this.checkEmptyList(),this.element.data("sortable-group",this.options.group?this.options.group:t.Utils.uid("sortable-group"));var u=l(function(e){if(!e.data||!e.data.sortable){var o=t.$(e.target),n=o.is("a[href]")?o:o.parents("a[href]");if(!o.is(":input")){if(d.options.handleClass){var s=o.hasClass(d.options.handleClass)?o:o.closest("."+d.options.handleClass,d.element);if(!s.length)return}return e.preventDefault(),n.length&&n.one("click",function(t){t.preventDefault()}).one(C,function(){c||(n.trigger("click"),m&&n.attr("href").trim()&&(location.href=n.attr("href")))}),e.data=e.data||{},e.data.sortable=h,d.dragStart(e,this)}}}),$=l(t.Utils.debounce(function(t){return d.dragEnter(t,this)}),40),w=l(function(){var e=d.dragenterData(this);d.dragenterData(this,e-1),d.dragenterData(this)||(t.$(this).removeClass(d.options.overClass),d.dragenterData(this,!1))}),y=l(function(t){return r&&r!==this&&i!==this?(d.element.children().removeClass(d.options.overClass),i=this,d.moveElementNextTo(r,this),s(t)):!0});this.addDragHandlers=e,this.removeDragHandlers=o,window.addEventListener(b,a,!1),h.addEventListener(v,u,!1)},dragStart:function(e,o){c=!1,d=!1,l=!1;var n=this,s=t.$(e.target);if(!(!m&&2==e.button||s.is("."+n.options.noDragClass)||s.closest("."+n.options.noDragClass).length||s.is(":input"))){r=o,a&&a.remove();var i=t.$(r),h=i.offset(),p=e.touches&&e.touches[0]||e;u={pos:{x:p.pageX,y:p.pageY},threshold:n.options.handleClass?1:n.options.threshold,apply:function(){a=t.$('<div class="'+[n.options.draggingClass,n.options.dragCustomClass].join(" ")+'"></div>').css({display:"none",top:h.top,left:h.left,width:i.width(),height:i.height(),padding:i.css("padding")}).data({"mouse-offset":{left:h.left-parseInt(p.pageX,10),top:h.top-parseInt(p.pageY,10)},origin:n.element,index:i.index()}).append(i.html()).appendTo("body"),a.$current=i,a.$sortable=n,i.data({"start-list":i.parent(),"start-index":i.index(),"sortable-group":n.options.group}),n.addDragHandlers(),n.options.start(this,r),n.trigger("start.uk.sortable",[n,r,a]),c=!0,u=!1}}}},dragMove:function(e){g=t.$(document.elementFromPoint(e.pageX-(document.body.scrollLeft||document.scrollLeft||0),e.pageY-(document.body.scrollTop||document.documentElement.scrollTop||0)));var o,n=g.closest("."+this.options.baseClass),s=n.data("sortable-group"),a=t.$(r),i=a.parent(),l=a.data("sortable-group");n[0]!==i[0]&&void 0!==l&&s===l&&(n.data("sortable").addDragHandlers(),p.push(n),n.children().addClass(this.options.childClass),n.children().length>0?(o=g.closest("."+this.options.childClass),o.length?o.before(a):n.append(a)):g.append(a),UIkit.$doc.trigger("mouseover")),this.checkEmptyList(),this.checkEmptyList(i)},dragEnter:function(e,o){if(!r||r===o)return!0;var n=this.dragenterData(o);if(this.dragenterData(o,n+1),0===n){var s=t.$(o).parent(),a=t.$(r).data("start-list");if(s[0]!==a[0]){var i=s.data("sortable-group"),l=t.$(r).data("sortable-group");if((i||l)&&i!=l)return!1}t.$(o).addClass(this.options.overClass),this.moveElementNextTo(r,o)}return!1},dragEnd:function(e,o){var n=this;r&&(this.options.stop(o),this.trigger("stop.uk.sortable",[this])),r=null,i=null,p.push(this.element),p.forEach(function(e){t.$(e).children().each(function(){1===this.nodeType&&(t.$(this).removeClass(n.options.overClass).removeClass(n.options.placeholderClass).removeClass(n.options.childClass),n.dragenterData(this,!1))})}),p=[],t.$html.removeClass(this.options.dragMovingClass),this.removeDragHandlers(),a&&(a.remove(),a=null)},dragDrop:function(t){"drop"===t.type&&(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()),this.triggerChangeEvents()},triggerChangeEvents:function(){if(r){var e=t.$(r),o=a.data("origin"),n=e.closest("."+this.options.baseClass),s=[],i=t.$(r);o[0]===n[0]&&a.data("index")!=e.index()?s.push({sortable:this,mode:"moved"}):o[0]!=n[0]&&s.push({sortable:t.$(n).data("sortable"),mode:"added"},{sortable:t.$(o).data("sortable"),mode:"removed"}),s.forEach(function(t){t.sortable&&t.sortable.element.trigger("change.uk.sortable",[t.sortable,i,t.mode])})}},dragenterData:function(e,o){return e=t.$(e),1==arguments.length?parseInt(e.data("child-dragenter"),10)||0:(o?e.data("child-dragenter",Math.max(0,o)):e.removeData("child-dragenter"),void 0)},moveElementNextTo:function(e,n){l=!0;var s=this,a=t.$(e).parent().css("min-height",""),r=o(e,n)?n:n.nextSibling,i=a.children(),d=i.length;return s.options.animation?(a.css("min-height",a.height()),i.stop().each(function(){var e=t.$(this),o=e.position();o.width=e.width(),e.data("offset-before",o)}),n.parentNode.insertBefore(e,r),t.Utils.checkDisplay(s.element.parent()),i=a.children().each(function(){var e=t.$(this);e.data("offset-after",e.position())}).each(function(){var e=t.$(this),o=e.data("offset-before");e.css({position:"absolute",top:o.top,left:o.left,"min-width":o.width})}),i.each(function(){var e=t.$(this),o=(e.data("offset-before"),e.data("offset-after"));e.css("pointer-events","none").width(),setTimeout(function(){e.animate({top:o.top,left:o.left},s.options.animation,function(){e.css({position:"",top:"",left:"","min-width":"","pointer-events":""}).removeClass(s.options.overClass).removeData("child-dragenter"),d--,d||(a.css("min-height",""),t.Utils.checkDisplay(s.element.parent()))})},0)}),void 0):(n.parentNode.insertBefore(e,r),t.Utils.checkDisplay(s.element.parent()),void 0)},serialize:function(){var e,o,n=[];return this.element.children().each(function(s,a){e={};for(var r,i,l=0;l<a.attributes.length;l++)o=a.attributes[l],0===o.name.indexOf("data-")&&(r=o.name.substr(5),i=t.Utils.str2json(o.value),e[r]=i||"false"==o.value||"0"==o.value?i:o.value);n.push(e)}),n},checkEmptyList:function(e){e=e?t.$(e):this.element,this.options.emptyClass&&e[e.children().length?"removeClass":"addClass"](this.options.emptyClass)}}),t.sortable}); \ No newline at end of file
diff --git a/js/components/sticky.js b/js/components/sticky.js
new file mode 100755
index 0000000..2765f19
--- /dev/null
+++ b/js/components/sticky.js
@@ -0,0 +1,364 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-sticky", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 var $win = UI.$win,
21 $doc = UI.$doc,
22 sticked = [],
23 direction = 1;
24
25 UI.component('sticky', {
26
27 defaults: {
28 top : 0,
29 bottom : 0,
30 animation : '',
31 clsinit : 'uk-sticky-init',
32 clsactive : 'uk-active',
33 clsinactive : '',
34 getWidthFrom : '',
35 showup : false,
36 boundary : false,
37 media : false,
38 target : false,
39 disabled : false
40 },
41
42 boot: function() {
43
44 // should be more efficient than using $win.scroll(checkscrollposition):
45 UI.$doc.on('scrolling.uk.document', function(e, data) {
46 if (!data || !data.dir) return;
47 direction = data.dir.y;
48 checkscrollposition();
49 });
50
51 UI.$win.on('resize orientationchange', UI.Utils.debounce(function() {
52
53 if (!sticked.length) return;
54
55 for (var i = 0; i < sticked.length; i++) {
56 sticked[i].reset(true);
57 sticked[i].self.computeWrapper();
58 }
59
60 checkscrollposition();
61 }, 100));
62
63 // init code
64 UI.ready(function(context) {
65
66 setTimeout(function(){
67
68 UI.$("[data-uk-sticky]", context).each(function(){
69
70 var $ele = UI.$(this);
71
72 if (!$ele.data("sticky")) {
73 UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
74 }
75 });
76
77 checkscrollposition();
78 }, 0);
79 });
80 },
81
82 init: function() {
83
84 var boundary = this.options.boundary, boundtoparent;
85
86 this.wrapper = this.element.wrap('<div class="uk-sticky-placeholder"></div>').parent();
87 this.computeWrapper();
88 this.wrapper.css({
89 'margin-top' : this.element.css('margin-top'),
90 'margin-bottom' : this.element.css('margin-bottom'),
91 'margin-left' : this.element.css('margin-left'),
92 'margin-right' : this.element.css('margin-right')
93 })
94 this.element.css('margin', 0);
95
96 if (boundary) {
97
98 if (boundary === true || boundary[0] === '!') {
99
100 boundary = boundary === true ? this.wrapper.parent() : this.wrapper.closest(boundary.substr(1));
101 boundtoparent = true;
102
103 } else if (typeof boundary === "string") {
104 boundary = UI.$(boundary);
105 }
106 }
107
108 this.sticky = {
109 self : this,
110 options : this.options,
111 element : this.element,
112 currentTop : null,
113 wrapper : this.wrapper,
114 init : false,
115 getWidthFrom : UI.$(this.options.getWidthFrom || this.wrapper),
116 boundary : boundary,
117 boundtoparent : boundtoparent,
118 top : 0,
119 calcTop : function() {
120
121 var top = this.options.top;
122
123 // dynamic top parameter
124 if (this.options.top && typeof(this.options.top) == 'string') {
125
126 // e.g. 50vh
127 if (this.options.top.match(/^(-|)(\d+)vh$/)) {
128 top = window.innerHeight * parseInt(this.options.top, 10)/100;
129 // e.g. #elementId, or .class-1,class-2,.class-3 (first found is used)
130 } else {
131
132 var topElement = UI.$(this.options.top).first();
133
134 if (topElement.length && topElement.is(':visible')) {
135 top = -1 * ((topElement.offset().top + topElement.outerHeight()) - this.wrapper.offset().top);
136 }
137 }
138
139 }
140
141 this.top = top;
142 },
143
144 reset: function(force) {
145
146 this.calcTop();
147
148 var finalize = function() {
149 this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
150 this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
151 this.element.addClass(this.options.clsinactive);
152 this.element.trigger('inactive.uk.sticky');
153
154 this.currentTop = null;
155 this.animate = false;
156
157 }.bind(this);
158
159
160 if (!force && this.options.animation && UI.support.animation && !UI.Utils.isInView(this.wrapper)) {
161
162 this.animate = true;
163
164 this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
165 finalize();
166 }).width(); // force redraw
167
168 this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
169 } else {
170 finalize();
171 }
172 },
173
174 check: function() {
175
176 if (this.options.disabled) {
177 return false;
178 }
179
180 if (this.options.media) {
181
182 switch(typeof(this.options.media)) {
183 case 'number':
184 if (window.innerWidth < this.options.media) {
185 return false;
186 }
187 break;
188 case 'string':
189 if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
190 return false;
191 }
192 break;
193 }
194 }
195
196 var scrollTop = $win.scrollTop(),
197 documentHeight = $doc.height(),
198 dwh = documentHeight - window.innerHeight,
199 extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
200 elementTop = this.wrapper.offset().top,
201 etse = elementTop - this.top - extra,
202 active = (scrollTop >= etse);
203
204 if (active && this.options.showup) {
205
206 // set inactiv if scrolling down
207 if (direction == 1) {
208 active = false;
209 }
210
211 // set inactive when wrapper is still in view
212 if (direction == -1 && !this.element.hasClass(this.options.clsactive) && UI.Utils.isInView(this.wrapper)) {
213 active = false;
214 }
215 }
216
217 return active;
218 }
219 };
220
221 this.sticky.calcTop();
222
223 sticked.push(this.sticky);
224 },
225
226 update: function() {
227 checkscrollposition(this.sticky);
228 },
229
230 enable: function() {
231 this.options.disabled = false;
232 this.update();
233 },
234
235 disable: function(force) {
236 this.options.disabled = true;
237 this.sticky.reset(force);
238 },
239
240 computeWrapper: function() {
241
242 this.wrapper.css({
243 'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
244 'float' : this.element.css('float') != 'none' ? this.element.css('float') : ''
245 });
246
247 if (this.element.css('position') == 'fixed') {
248 this.element.css({
249 width: this.sticky.getWidthFrom.length ? this.sticky.getWidthFrom.width() : this.element.width()
250 });
251 }
252 }
253 });
254
255 function checkscrollposition(direction) {
256
257 var stickies = arguments.length ? arguments : sticked;
258
259 if (!stickies.length || $win.scrollTop() < 0) return;
260
261 var scrollTop = $win.scrollTop(),
262 documentHeight = $doc.height(),
263 windowHeight = $win.height(),
264 dwh = documentHeight - windowHeight,
265 extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
266 newTop, containerBottom, stickyHeight, sticky;
267
268 for (var i = 0; i < stickies.length; i++) {
269
270 sticky = stickies[i];
271
272 if (!sticky.element.is(":visible") || sticky.animate) {
273 continue;
274 }
275
276 if (!sticky.check()) {
277
278 if (sticky.currentTop !== null) {
279 sticky.reset();
280 }
281
282 } else {
283
284 if (sticky.top < 0) {
285 newTop = 0;
286 } else {
287 stickyHeight = sticky.element.outerHeight();
288 newTop = documentHeight - stickyHeight - sticky.top - sticky.options.bottom - scrollTop - extra;
289 newTop = newTop < 0 ? newTop + sticky.top : sticky.top;
290 }
291
292 if (sticky.boundary && sticky.boundary.length) {
293
294 var bTop = sticky.boundary.offset().top;
295
296 if (sticky.boundtoparent) {
297 containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
298 } else {
299 containerBottom = documentHeight - bTop;
300 }
301
302 newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
303 }
304
305
306 if (sticky.currentTop != newTop) {
307
308 sticky.element.css({
309 position : "fixed",
310 top : newTop,
311 width : sticky.getWidthFrom.length ? sticky.getWidthFrom.width() : sticky.element.width()
312 });
313
314 if (!sticky.init) {
315
316 sticky.element.addClass(sticky.options.clsinit);
317
318 if (location.hash && scrollTop > 0 && sticky.options.target) {
319
320 var $target = UI.$(location.hash);
321
322 if ($target.length) {
323
324 setTimeout((function($target, sticky){
325
326 return function() {
327
328 sticky.element.width(); // force redraw
329
330 var offset = $target.offset(),
331 maxoffset = offset.top + $target.outerHeight(),
332 stickyOffset = sticky.element.offset(),
333 stickyHeight = sticky.element.outerHeight(),
334 stickyMaxOffset = stickyOffset.top + stickyHeight;
335
336 if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
337 scrollTop = offset.top - stickyHeight - sticky.options.target;
338 window.scrollTo(0, scrollTop);
339 }
340 };
341
342 })($target, sticky), 0);
343 }
344 }
345 }
346
347 sticky.element.addClass(sticky.options.clsactive).removeClass(sticky.options.clsinactive);
348 sticky.element.trigger('active.uk.sticky');
349 sticky.element.css('margin', '');
350
351 if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) {
352 sticky.element.addClass(sticky.options.animation);
353 }
354
355 sticky.currentTop = newTop;
356 }
357 }
358
359 sticky.init = true;
360 }
361 }
362
363 return UI.sticky;
364});
diff --git a/js/components/sticky.min.js b/js/components/sticky.min.js
new file mode 100755
index 0000000..0fa4ead
--- /dev/null
+++ b/js/components/sticky.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-sticky",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(){var i=arguments.length?arguments:n;if(i.length&&!(e.scrollTop()<0))for(var o,a,r,h,p=e.scrollTop(),c=s.height(),l=e.height(),m=c-l,d=p>m?m-p:0,u=0;u<i.length;u++)if(h=i[u],h.element.is(":visible")&&!h.animate){if(h.check()){if(h.top<0?o=0:(r=h.element.outerHeight(),o=c-r-h.top-h.options.bottom-p-d,o=0>o?o+h.top:h.top),h.boundary&&h.boundary.length){var f=h.boundary.offset().top;a=h.boundtoparent?c-(f+h.boundary.outerHeight())+parseInt(h.boundary.css("padding-bottom")):c-f,o=p+r>c-a-(h.top<0?0:h.top)?c-a-(p+r):o}if(h.currentTop!=o){if(h.element.css({position:"fixed",top:o,width:h.getWidthFrom.length?h.getWidthFrom.width():h.element.width()}),!h.init&&(h.element.addClass(h.options.clsinit),location.hash&&p>0&&h.options.target)){var g=t.$(location.hash);g.length&&setTimeout(function(t,i){return function(){i.element.width();var e=t.offset(),s=e.top+t.outerHeight(),n=i.element.offset(),o=i.element.outerHeight(),a=n.top+o;n.top<s&&e.top<a&&(p=e.top-o-i.options.target,window.scrollTo(0,p))}}(g,h),0)}h.element.addClass(h.options.clsactive).removeClass(h.options.clsinactive),h.element.trigger("active.uk.sticky"),h.element.css("margin",""),h.options.animation&&h.init&&!t.Utils.isInView(h.wrapper)&&h.element.addClass(h.options.animation),h.currentTop=o}}else null!==h.currentTop&&h.reset();h.init=!0}}var e=t.$win,s=t.$doc,n=[],o=1;return t.component("sticky",{defaults:{top:0,bottom:0,animation:"",clsinit:"uk-sticky-init",clsactive:"uk-active",clsinactive:"",getWidthFrom:"",showup:!1,boundary:!1,media:!1,target:!1,disabled:!1},boot:function(){t.$doc.on("scrolling.uk.document",function(t,e){e&&e.dir&&(o=e.dir.y,i())}),t.$win.on("resize orientationchange",t.Utils.debounce(function(){if(n.length){for(var t=0;t<n.length;t++)n[t].reset(!0),n[t].self.computeWrapper();i()}},100)),t.ready(function(e){setTimeout(function(){t.$("[data-uk-sticky]",e).each(function(){var i=t.$(this);i.data("sticky")||t.sticky(i,t.Utils.options(i.attr("data-uk-sticky")))}),i()},0)})},init:function(){var i,a=this.options.boundary;this.wrapper=this.element.wrap('<div class="uk-sticky-placeholder"></div>').parent(),this.computeWrapper(),this.wrapper.css({"margin-top":this.element.css("margin-top"),"margin-bottom":this.element.css("margin-bottom"),"margin-left":this.element.css("margin-left"),"margin-right":this.element.css("margin-right")}),this.element.css("margin",0),a&&(a===!0||"!"===a[0]?(a=a===!0?this.wrapper.parent():this.wrapper.closest(a.substr(1)),i=!0):"string"==typeof a&&(a=t.$(a))),this.sticky={self:this,options:this.options,element:this.element,currentTop:null,wrapper:this.wrapper,init:!1,getWidthFrom:t.$(this.options.getWidthFrom||this.wrapper),boundary:a,boundtoparent:i,top:0,calcTop:function(){var i=this.options.top;if(this.options.top&&"string"==typeof this.options.top)if(this.options.top.match(/^(-|)(\d+)vh$/))i=window.innerHeight*parseInt(this.options.top,10)/100;else{var e=t.$(this.options.top).first();e.length&&e.is(":visible")&&(i=-1*(e.offset().top+e.outerHeight()-this.wrapper.offset().top))}this.top=i},reset:function(i){this.calcTop();var e=function(){this.element.css({position:"",top:"",width:"",left:"",margin:"0"}),this.element.removeClass([this.options.animation,"uk-animation-reverse",this.options.clsactive].join(" ")),this.element.addClass(this.options.clsinactive),this.element.trigger("inactive.uk.sticky"),this.currentTop=null,this.animate=!1}.bind(this);!i&&this.options.animation&&t.support.animation&&!t.Utils.isInView(this.wrapper)?(this.animate=!0,this.element.removeClass(this.options.animation).one(t.support.animation.end,function(){e()}).width(),this.element.addClass(this.options.animation+" uk-animation-reverse")):e()},check:function(){if(this.options.disabled)return!1;if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidth<this.options.media)return!1;break;case"string":if(window.matchMedia&&!window.matchMedia(this.options.media).matches)return!1}var i=e.scrollTop(),n=s.height(),a=n-window.innerHeight,r=i>a?a-i:0,h=this.wrapper.offset().top,p=h-this.top-r,c=i>=p;return c&&this.options.showup&&(1==o&&(c=!1),-1==o&&!this.element.hasClass(this.options.clsactive)&&t.Utils.isInView(this.wrapper)&&(c=!1)),c}},this.sticky.calcTop(),n.push(this.sticky)},update:function(){i(this.sticky)},enable:function(){this.options.disabled=!1,this.update()},disable:function(t){this.options.disabled=!0,this.sticky.reset(t)},computeWrapper:function(){this.wrapper.css({height:-1==["absolute","fixed"].indexOf(this.element.css("position"))?this.element.outerHeight():"","float":"none"!=this.element.css("float")?this.element.css("float"):""}),"fixed"==this.element.css("position")&&this.element.css({width:this.sticky.getWidthFrom.length?this.sticky.getWidthFrom.width():this.element.width()})}}),t.sticky}); \ No newline at end of file
diff --git a/js/components/timepicker.js b/js/components/timepicker.js
new file mode 100755
index 0000000..1b7a808
--- /dev/null
+++ b/js/components/timepicker.js
@@ -0,0 +1,192 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-timepicker", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20
21 UI.component('timepicker', {
22
23 defaults: {
24 format : '24h',
25 delay : 0,
26 start : 0,
27 end : 24
28 },
29
30 boot: function() {
31
32 // init code
33 UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
34
35 var ele = UI.$(this);
36
37 if (!ele.data("timepicker")) {
38 var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
39
40 setTimeout(function(){
41 obj.autocomplete.input.focus();
42 }, 40);
43 }
44 });
45 },
46
47 init: function() {
48
49 var $this = this, times = getTimeRange(this.options.start, this.options.end), container;
50
51 this.options.minLength = 0;
52 this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>';
53
54 this.options.source = function(release) {
55 release(times[$this.options.format] || times['12h']);
56 };
57
58 if (this.element.is('input')) {
59 this.element.wrap('<div class="uk-autocomplete"></div>');
60 container = this.element.parent();
61 } else {
62 container = this.element.addClass('uk-autocomplete');
63 }
64
65 this.autocomplete = UI.autocomplete(container, this.options);
66 this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
67
68 this.autocomplete.on('show.uk.autocomplete', function() {
69
70 var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
71
72 setTimeout(function(){
73 $this.autocomplete.pick(selected, true);
74 }, 10);
75 });
76
77 this.autocomplete.input.on('focus', function(){
78
79 $this.autocomplete.value = Math.random();
80 $this.autocomplete.triggercomplete();
81
82 }).on('blur', UI.Utils.debounce(function() {
83 $this.checkTime();
84 }, 100));
85
86 this.element.data("timepicker", this);
87 },
88
89 checkTime: function() {
90
91 var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
92
93 if (this.options.format == '12h') {
94 arr = time.split(' ');
95 timeArray = arr[0].split(':');
96 meridian = arr[1];
97 } else {
98 timeArray = time.split(':');
99 }
100
101 hour = parseInt(timeArray[0], 10);
102 minute = parseInt(timeArray[1], 10);
103
104 if (isNaN(hour)) hour = 0;
105 if (isNaN(minute)) minute = 0;
106
107 if (this.options.format == '12h') {
108 if (hour > 12) {
109 hour = 12;
110 } else if (hour < 0) {
111 hour = 12;
112 }
113
114 if (meridian === 'am' || meridian === 'a') {
115 meridian = 'AM';
116 } else if (meridian === 'pm' || meridian === 'p') {
117 meridian = 'PM';
118 }
119
120 if (meridian !== 'AM' && meridian !== 'PM') {
121 meridian = 'AM';
122 }
123
124 } else {
125
126 if (hour >= 24) {
127 hour = 23;
128 } else if (hour < 0) {
129 hour = 0;
130 }
131 }
132
133 if (minute < 0) {
134 minute = 0;
135 } else if (minute >= 60) {
136 minute = 0;
137 }
138
139 this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
140 },
141
142 formatTime: function(hour, minute, meridian) {
143 hour = hour < 10 ? '0' + hour : hour;
144 minute = minute < 10 ? '0' + minute : minute;
145 return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
146 }
147 });
148
149 // helper
150
151 function getTimeRange(start, end) {
152
153 start = start || 0;
154 end = end || 24;
155
156 var times = {'12h':[], '24h':[]}, i, h;
157
158 for (i = start, h=''; i<end; i++) {
159
160 h = ''+i;
161
162 if (i<10) h = '0'+h;
163
164 times['24h'].push({value: (h+':00')});
165 times['24h'].push({value: (h+':30')});
166
167 if (i === 0) {
168 h = 12;
169 times['12h'].push({value: (h+':00 AM')});
170 times['12h'].push({value: (h+':30 AM')});
171 }
172
173 if (i > 0 && i<13 && i!==12) {
174 times['12h'].push({value: (h+':00 AM')});
175 times['12h'].push({value: (h+':30 AM')});
176 }
177
178 if (i >= 12) {
179
180 h = h-12;
181 if (h === 0) h = 12;
182 if (h < 10) h = '0'+String(h);
183
184 times['12h'].push({value: (h+':00 PM')});
185 times['12h'].push({value: (h+':30 PM')});
186 }
187 }
188
189 return times;
190 }
191
192});
diff --git a/js/components/timepicker.min.js b/js/components/timepicker.min.js
new file mode 100755
index 0000000..df160db
--- /dev/null
+++ b/js/components/timepicker.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-timepicker",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";function e(t,e){t=t||0,e=e||24;var i,o,a={"12h":[],"24h":[]};for(i=t,o="";e>i;i++)o=""+i,10>i&&(o="0"+o),a["24h"].push({value:o+":00"}),a["24h"].push({value:o+":30"}),0===i&&(o=12,a["12h"].push({value:o+":00 AM"}),a["12h"].push({value:o+":30 AM"})),i>0&&13>i&&12!==i&&(a["12h"].push({value:o+":00 AM"}),a["12h"].push({value:o+":30 AM"})),i>=12&&(o-=12,0===o&&(o=12),10>o&&(o="0"+String(o)),a["12h"].push({value:o+":00 PM"}),a["12h"].push({value:o+":30 PM"}));return a}t.component("timepicker",{defaults:{format:"24h",delay:0,start:0,end:24},boot:function(){t.$html.on("focus.timepicker.uikit","[data-uk-timepicker]",function(){var e=t.$(this);if(!e.data("timepicker")){var i=t.timepicker(e,t.Utils.options(e.attr("data-uk-timepicker")));setTimeout(function(){i.autocomplete.input.focus()},40)}})},init:function(){var i,o=this,a=e(this.options.start,this.options.end);this.options.minLength=0,this.options.template='<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>',this.options.source=function(t){t(a[o.options.format]||a["12h"])},this.element.is("input")?(this.element.wrap('<div class="uk-autocomplete"></div>'),i=this.element.parent()):i=this.element.addClass("uk-autocomplete"),this.autocomplete=t.autocomplete(i,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-small uk-dropdown-scrollable"),this.autocomplete.on("show.uk.autocomplete",function(){var t=o.autocomplete.dropdown.find('[data-value="'+o.autocomplete.input.val()+'"]');setTimeout(function(){o.autocomplete.pick(t,!0)},10)}),this.autocomplete.input.on("focus",function(){o.autocomplete.value=Math.random(),o.autocomplete.triggercomplete()}).on("blur",t.Utils.debounce(function(){o.checkTime()},100)),this.element.data("timepicker",this)},checkTime:function(){var t,e,i,o,a="AM",u=this.autocomplete.input.val();"12h"==this.options.format?(t=u.split(" "),e=t[0].split(":"),a=t[1]):e=u.split(":"),i=parseInt(e[0],10),o=parseInt(e[1],10),isNaN(i)&&(i=0),isNaN(o)&&(o=0),"12h"==this.options.format?(i>12?i=12:0>i&&(i=12),"am"===a||"a"===a?a="AM":("pm"===a||"p"===a)&&(a="PM"),"AM"!==a&&"PM"!==a&&(a="AM")):i>=24?i=23:0>i&&(i=0),0>o?o=0:o>=60&&(o=0),this.autocomplete.input.val(this.formatTime(i,o,a)).trigger("change")},formatTime:function(t,e,i){return t=10>t?"0"+t:t,e=10>e?"0"+e:e,t+":"+e+("12h"==this.options.format?" "+i:"")}})}); \ No newline at end of file
diff --git a/js/components/tooltip.js b/js/components/tooltip.js
new file mode 100755
index 0000000..a38d49d
--- /dev/null
+++ b/js/components/tooltip.js
@@ -0,0 +1,234 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3 var component;
4
5 if (window.UIkit) {
6 component = addon(UIkit);
7 }
8
9 if (typeof define == "function" && define.amd) {
10 define("uikit-tooltip", ["uikit"], function(){
11 return component || addon(UIkit);
12 });
13 }
14
15})(function(UI){
16
17 "use strict";
18
19 var $tooltip, // tooltip container
20 tooltipdelay, checkdelay;
21
22 UI.component('tooltip', {
23
24 defaults: {
25 "offset": 5,
26 "pos": "top",
27 "animation": false,
28 "delay": 0, // in miliseconds
29 "cls": "",
30 "activeClass": "uk-active",
31 "src": function(ele) {
32 var title = ele.attr('title');
33
34 if (title !== undefined) {
35 ele.data('cached-title', title).removeAttr('title');
36 }
37
38 return ele.data("cached-title");
39 }
40 },
41
42 tip: "",
43
44 boot: function() {
45
46 // init code
47 UI.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
48 var ele = UI.$(this);
49
50 if (!ele.data("tooltip")) {
51 UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
52 ele.trigger("mouseenter");
53 }
54 });
55 },
56
57 init: function() {
58
59 var $this = this;
60
61 if (!$tooltip) {
62 $tooltip = UI.$('<div class="uk-tooltip"></div>').appendTo("body");
63 }
64
65 this.on({
66 focus : function(e) { $this.show(); },
67 blur : function(e) { $this.hide(); },
68 mouseenter : function(e) { $this.show(); },
69 mouseleave : function(e) { $this.hide(); }
70 });
71 },
72
73 show: function() {
74
75 this.tip = typeof(this.options.src) === "function" ? this.options.src(this.element) : this.options.src;
76
77 if (tooltipdelay) clearTimeout(tooltipdelay);
78 if (checkdelay) clearTimeout(checkdelay);
79
80 if (typeof(this.tip) === 'string' ? !this.tip.length:true) return;
81
82 $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).removeClass(this.options.activeClass).show();
83 $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
84
85 var $this = this,
86 pos = UI.$.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
87 width = $tooltip[0].offsetWidth,
88 height = $tooltip[0].offsetHeight,
89 offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
90 position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
91 tmppos = position.split("-"),
92 tcss = {
93 "display" : "none",
94 "visibility" : "visible",
95 "top" : (pos.top + pos.height + height),
96 "left" : pos.left
97 };
98
99
100 // prevent strange position
101 // when tooltip is in offcanvas etc.
102 if (UI.$html.css('position')=='fixed' || UI.$body.css('position')=='fixed'){
103 var bodyoffset = UI.$('body').offset(),
104 htmloffset = UI.$('html').offset(),
105 docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
106
107 pos.left -= docoffset.left;
108 pos.top -= docoffset.top;
109 }
110
111
112 if ((tmppos[0] == "left" || tmppos[0] == "right") && UI.langdirection == 'right') {
113 tmppos[0] = tmppos[0] == "left" ? "right" : "left";
114 }
115
116 var variants = {
117 "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
118 "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
119 "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
120 "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
121 };
122
123 UI.$.extend(tcss, variants[tmppos[0]]);
124
125 if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
126
127 var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
128
129 if(boundary) {
130
131 switch(boundary) {
132 case "x":
133
134 if (tmppos.length == 2) {
135 position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
136 } else {
137 position = tcss.left < 0 ? "right": "left";
138 }
139
140 break;
141
142 case "y":
143 if (tmppos.length == 2) {
144 position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
145 } else {
146 position = (tcss.top < 0 ? "bottom": "top");
147 }
148
149 break;
150
151 case "xy":
152 if (tmppos.length == 2) {
153 position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
154 } else {
155 position = tcss.left < 0 ? "right": "left";
156 }
157
158 break;
159
160 }
161
162 tmppos = position.split("-");
163
164 UI.$.extend(tcss, variants[tmppos[0]]);
165
166 if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
167 }
168
169
170 tcss.left -= UI.$body.position().left;
171
172 tooltipdelay = setTimeout(function(){
173
174 $tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
175
176 if ($this.options.animation) {
177 $tooltip.css({opacity: 0, display: 'block'}).addClass($this.options.activeClass).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
178 } else {
179 $tooltip.show().addClass($this.options.activeClass);
180 }
181
182 tooltipdelay = false;
183
184 // close tooltip if element was removed or hidden
185 checkdelay = setInterval(function(){
186 if(!$this.element.is(':visible')) $this.hide();
187 }, 150);
188
189 }, parseInt(this.options.delay, 10) || 0);
190 },
191
192 hide: function() {
193 if(this.element.is("input") && this.element[0]===document.activeElement) return;
194
195 if(tooltipdelay) clearTimeout(tooltipdelay);
196 if (checkdelay) clearTimeout(checkdelay);
197
198 $tooltip.stop();
199
200 if (this.options.animation) {
201
202 var $this = this;
203
204 $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400, function(){
205 $tooltip.removeClass($this.options.activeClass)
206 });
207
208 } else {
209 $tooltip.hide().removeClass(this.options.activeClass);
210 }
211 },
212
213 content: function() {
214 return this.tip;
215 },
216
217 checkBoundary: function(left, top, width, height) {
218
219 var axis = "";
220
221 if(left < 0 || ((left - UI.$win.scrollLeft())+width) > window.innerWidth) {
222 axis += "x";
223 }
224
225 if(top < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
226 axis += "y";
227 }
228
229 return axis;
230 }
231 });
232
233 return UI.tooltip;
234});
diff --git a/js/components/tooltip.min.js b/js/components/tooltip.min.js
new file mode 100755
index 0000000..130ea2e
--- /dev/null
+++ b/js/components/tooltip.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-tooltip",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";var i,o,e;return t.component("tooltip",{defaults:{offset:5,pos:"top",animation:!1,delay:0,cls:"",activeClass:"uk-active",src:function(t){var i=t.attr("title");return void 0!==i&&t.data("cached-title",i).removeAttr("title"),t.data("cached-title")}},tip:"",boot:function(){t.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit","[data-uk-tooltip]",function(){var i=t.$(this);i.data("tooltip")||(t.tooltip(i,t.Utils.options(i.attr("data-uk-tooltip"))),i.trigger("mouseenter"))})},init:function(){var o=this;i||(i=t.$('<div class="uk-tooltip"></div>').appendTo("body")),this.on({focus:function(){o.show()},blur:function(){o.hide()},mouseenter:function(){o.show()},mouseleave:function(){o.hide()}})},show:function(){if(this.tip="function"==typeof this.options.src?this.options.src(this.element):this.options.src,o&&clearTimeout(o),e&&clearTimeout(e),"string"==typeof this.tip?this.tip.length:0){i.stop().css({top:-2e3,visibility:"hidden"}).removeClass(this.options.activeClass).show(),i.html('<div class="uk-tooltip-inner">'+this.tip+"</div>");var s=this,n=t.$.extend({},this.element.offset(),{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}),l=i[0].offsetWidth,f=i[0].offsetHeight,p="function"==typeof this.options.offset?this.options.offset.call(this.element):this.options.offset,a="function"==typeof this.options.pos?this.options.pos.call(this.element):this.options.pos,h=a.split("-"),c={display:"none",visibility:"visible",top:n.top+n.height+f,left:n.left};if("fixed"==t.$html.css("position")||"fixed"==t.$body.css("position")){var r=t.$("body").offset(),d=t.$("html").offset(),u={top:d.top+r.top,left:d.left+r.left};n.left-=u.left,n.top-=u.top}"left"!=h[0]&&"right"!=h[0]||"right"!=t.langdirection||(h[0]="left"==h[0]?"right":"left");var m={bottom:{top:n.top+n.height+p,left:n.left+n.width/2-l/2},top:{top:n.top-f-p,left:n.left+n.width/2-l/2},left:{top:n.top+n.height/2-f/2,left:n.left-l-p},right:{top:n.top+n.height/2-f/2,left:n.left+n.width+p}};t.$.extend(c,m[h[0]]),2==h.length&&(c.left="left"==h[1]?n.left:n.left+n.width-l);var v=this.checkBoundary(c.left,c.top,l,f);if(v){switch(v){case"x":a=2==h.length?h[0]+"-"+(c.left<0?"left":"right"):c.left<0?"right":"left";break;case"y":a=2==h.length?(c.top<0?"bottom":"top")+"-"+h[1]:c.top<0?"bottom":"top";break;case"xy":a=2==h.length?(c.top<0?"bottom":"top")+"-"+(c.left<0?"left":"right"):c.left<0?"right":"left"}h=a.split("-"),t.$.extend(c,m[h[0]]),2==h.length&&(c.left="left"==h[1]?n.left:n.left+n.width-l)}c.left-=t.$body.position().left,o=setTimeout(function(){i.css(c).attr("class",["uk-tooltip","uk-tooltip-"+a,s.options.cls].join(" ")),s.options.animation?i.css({opacity:0,display:"block"}).addClass(s.options.activeClass).animate({opacity:1},parseInt(s.options.animation,10)||400):i.show().addClass(s.options.activeClass),o=!1,e=setInterval(function(){s.element.is(":visible")||s.hide()},150)},parseInt(this.options.delay,10)||0)}},hide:function(){if(!this.element.is("input")||this.element[0]!==document.activeElement)if(o&&clearTimeout(o),e&&clearTimeout(e),i.stop(),this.options.animation){var t=this;i.fadeOut(parseInt(this.options.animation,10)||400,function(){i.removeClass(t.options.activeClass)})}else i.hide().removeClass(this.options.activeClass)},content:function(){return this.tip},checkBoundary:function(i,o,e,s){var n="";return(0>i||i-t.$win.scrollLeft()+e>window.innerWidth)&&(n+="x"),(0>o||o-t.$win.scrollTop()+s>window.innerHeight)&&(n+="y"),n}}),t.tooltip}); \ No newline at end of file
diff --git a/js/components/upload.js b/js/components/upload.js
new file mode 100755
index 0000000..f80f26e
--- /dev/null
+++ b/js/components/upload.js
@@ -0,0 +1,257 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2(function(addon) {
3
4 var component;
5
6 if (window.UIkit) {
7 component = addon(UIkit);
8 }
9
10 if (typeof define == "function" && define.amd) {
11 define("uikit-upload", ["uikit"], function(){
12 return component || addon(UIkit);
13 });
14 }
15
16})(function(UI){
17
18 "use strict";
19
20 UI.component('uploadSelect', {
21
22 init: function() {
23
24 var $this = this;
25
26 this.on("change", function() {
27 xhrupload($this.element[0].files, $this.options);
28 var twin = $this.element.clone(true).data('uploadSelect', $this);
29 $this.element.replaceWith(twin);
30 $this.element = twin;
31 });
32 }
33 });
34
35 UI.component('uploadDrop', {
36
37 defaults: {
38 'dragoverClass': 'uk-dragover'
39 },
40
41 init: function() {
42
43 var $this = this, hasdragCls = false;
44
45 this.on("drop", function(e){
46
47 if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) {
48
49 e.stopPropagation();
50 e.preventDefault();
51
52 $this.element.removeClass($this.options.dragoverClass);
53 $this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]);
54
55 xhrupload(e.originalEvent.dataTransfer.files, $this.options);
56 }
57
58 }).on("dragenter", function(e){
59 e.stopPropagation();
60 e.preventDefault();
61 }).on("dragover", function(e){
62 e.stopPropagation();
63 e.preventDefault();
64
65 if (!hasdragCls) {
66 $this.element.addClass($this.options.dragoverClass);
67 hasdragCls = true;
68 }
69 }).on("dragleave", function(e){
70 e.stopPropagation();
71 e.preventDefault();
72 $this.element.removeClass($this.options.dragoverClass);
73 hasdragCls = false;
74 });
75 }
76 });
77
78
79 UI.support.ajaxupload = (function() {
80
81 function supportFileAPI() {
82 var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
83 }
84
85 function supportAjaxUploadProgressEvents() {
86 var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
87 }
88
89 function supportFormData() {
90 return !! window.FormData;
91 }
92
93 return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
94 })();
95
96
97 function xhrupload(files, settings) {
98
99 if (!UI.support.ajaxupload){
100 return this;
101 }
102
103 settings = UI.$.extend({}, xhrupload.defaults, settings);
104
105 if (!files.length){
106 return;
107 }
108
109 if (settings.allow !== '*.*') {
110
111 for(var i=0,file;file=files[i];i++) {
112
113 if(!matchName(settings.allow, file.name)) {
114
115 if(typeof(settings.notallowed) == 'string') {
116 alert(settings.notallowed);
117 } else {
118 settings.notallowed(file, settings);
119 }
120 return;
121 }
122 }
123 }
124
125 var complete = settings.complete;
126
127 if (settings.single){
128
129 var count = files.length,
130 uploaded = 0,
131 allow = true;
132
133 settings.beforeAll(files);
134
135 settings.complete = function(response, xhr){
136
137 uploaded = uploaded + 1;
138
139 complete(response, xhr);
140
141 if (settings.filelimit && uploaded >= settings.filelimit){
142 allow = false;
143 }
144
145 if (allow && uploaded<count){
146 upload([files[uploaded]], settings);
147 } else {
148 settings.allcomplete(response, xhr);
149 }
150 };
151
152 upload([files[0]], settings);
153
154 } else {
155
156 settings.complete = function(response, xhr){
157 complete(response, xhr);
158 settings.allcomplete(response, xhr);
159 };
160
161 upload(files, settings);
162 }
163
164 function upload(files, settings){
165
166 // upload all at once
167 var formData = new FormData(), xhr = new XMLHttpRequest();
168
169 if (settings.before(settings, files)===false) return;
170
171 for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
172 for (var p in settings.params) { formData.append(p, settings.params[p]); }
173
174 // Add any event handlers here...
175 xhr.upload.addEventListener("progress", function(e){
176 var percent = (e.loaded / e.total)*100;
177 settings.progress(percent, e);
178 }, false);
179
180 xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
181 xhr.addEventListener("load", function(e){ settings.load(e); }, false);
182 xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
183 xhr.addEventListener("error", function(e){ settings.error(e); }, false);
184 xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
185
186 xhr.open(settings.method, settings.action, true);
187
188 if (settings.type=="json") {
189 xhr.setRequestHeader("Accept", "application/json");
190 }
191
192 xhr.onreadystatechange = function() {
193
194 settings.readystatechange(xhr);
195
196 if (xhr.readyState==4){
197
198 var response = xhr.responseText;
199
200 if (settings.type=="json") {
201 try {
202 response = UI.$.parseJSON(response);
203 } catch(e) {
204 response = false;
205 }
206 }
207
208 settings.complete(response, xhr);
209 }
210 };
211 settings.beforeSend(xhr);
212 xhr.send(formData);
213 }
214 }
215
216 xhrupload.defaults = {
217 'action': '',
218 'single': true,
219 'method': 'POST',
220 'param' : 'files[]',
221 'params': {},
222 'allow' : '*.*',
223 'type' : 'text',
224 'filelimit': false,
225
226 // events
227 'before' : function(o){},
228 'beforeSend' : function(xhr){},
229 'beforeAll' : function(){},
230 'loadstart' : function(){},
231 'load' : function(){},
232 'loadend' : function(){},
233 'error' : function(){},
234 'abort' : function(){},
235 'progress' : function(){},
236 'complete' : function(){},
237 'allcomplete' : function(){},
238 'readystatechange': function(){},
239 'notallowed' : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
240 };
241
242 function matchName(pattern, path) {
243
244 var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
245 replace(/\*\*/g, '(\\/[^\\/]+)*').
246 replace(/\*/g, '[^\\/]+').
247 replace(/((?!\\))\?/g, '$1.') + '$';
248
249 parsedPattern = '^' + parsedPattern + '$';
250
251 return (path.match(new RegExp(parsedPattern, 'i')) !== null);
252 }
253
254 UI.Utils.xhrupload = xhrupload;
255
256 return xhrupload;
257});
diff --git a/js/components/upload.min.js b/js/components/upload.min.js
new file mode 100755
index 0000000..99279a9
--- /dev/null
+++ b/js/components/upload.min.js
@@ -0,0 +1,2 @@
1/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2!function(e){var t;window.UIkit&&(t=e(UIkit)),"function"==typeof define&&define.amd&&define("uikit-upload",["uikit"],function(){return t||e(UIkit)})}(function(e){"use strict";function t(o,a){function r(t,n){var o=new FormData,a=new XMLHttpRequest;if(n.before(n,t)!==!1){for(var r,i=0;r=t[i];i++)o.append(n.param,r);for(var l in n.params)o.append(l,n.params[l]);a.upload.addEventListener("progress",function(e){var t=e.loaded/e.total*100;n.progress(t,e)},!1),a.addEventListener("loadstart",function(e){n.loadstart(e)},!1),a.addEventListener("load",function(e){n.load(e)},!1),a.addEventListener("loadend",function(e){n.loadend(e)},!1),a.addEventListener("error",function(e){n.error(e)},!1),a.addEventListener("abort",function(e){n.abort(e)},!1),a.open(n.method,n.action,!0),"json"==n.type&&a.setRequestHeader("Accept","application/json"),a.onreadystatechange=function(){if(n.readystatechange(a),4==a.readyState){var t=a.responseText;if("json"==n.type)try{t=e.$.parseJSON(t)}catch(o){t=!1}n.complete(t,a)}},n.beforeSend(a),a.send(o)}}if(!e.support.ajaxupload)return this;if(a=e.$.extend({},t.defaults,a),o.length){if("*.*"!==a.allow)for(var i,l=0;i=o[l];l++)if(!n(a.allow,i.name))return"string"==typeof a.notallowed?alert(a.notallowed):a.notallowed(i,a),void 0;var f=a.complete;if(a.single){var s=o.length,d=0,p=!0;a.beforeAll(o),a.complete=function(e,t){d+=1,f(e,t),a.filelimit&&d>=a.filelimit&&(p=!1),p&&s>d?r([o[d]],a):a.allcomplete(e,t)},r([o[0]],a)}else a.complete=function(e,t){f(e,t),a.allcomplete(e,t)},r(o,a)}}function n(e,t){var n="^"+e.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return n="^"+n+"$",null!==t.match(new RegExp(n,"i"))}return e.component("uploadSelect",{init:function(){var e=this;this.on("change",function(){t(e.element[0].files,e.options);var n=e.element.clone(!0).data("uploadSelect",e);e.element.replaceWith(n),e.element=n})}}),e.component("uploadDrop",{defaults:{dragoverClass:"uk-dragover"},init:function(){var e=this,n=!1;this.on("drop",function(n){n.originalEvent.dataTransfer&&n.originalEvent.dataTransfer.files&&(n.stopPropagation(),n.preventDefault(),e.element.removeClass(e.options.dragoverClass),e.element.trigger("dropped.uk.upload",[n.originalEvent.dataTransfer.files]),t(n.originalEvent.dataTransfer.files,e.options))}).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}).on("dragover",function(t){t.stopPropagation(),t.preventDefault(),n||(e.element.addClass(e.options.dragoverClass),n=!0)}).on("dragleave",function(t){t.stopPropagation(),t.preventDefault(),e.element.removeClass(e.options.dragoverClass),n=!1})}}),e.support.ajaxupload=function(){function e(){var e=document.createElement("INPUT");return e.type="file","files"in e}function t(){var e=new XMLHttpRequest;return!!(e&&"upload"in e&&"onprogress"in e.upload)}function n(){return!!window.FormData}return e()&&t()&&n()}(),t.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",filelimit:!1,before:function(){},beforeSend:function(){},beforeAll:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(e,t){alert("Only the following file types are allowed: "+t.allow)}},e.Utils.xhrupload=t,t}); \ No newline at end of file
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, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"
369 ].join("\n"));
370
371 return data ? fn(data) : fn;
372 };
373
374 UI.Utils.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, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"].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
diff --git a/js/uikit.js b/js/uikit.js
new file mode 100755
index 0000000..cf8b403
--- /dev/null
+++ b/js/uikit.js
@@ -0,0 +1,3814 @@
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, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"
369 ].join("\n"));
370
371 return data ? fn(data) : fn;
372 };
373
374 UI.Utils.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});
787
788// Based on Zeptos touch.js
789// https://raw.github.com/madrobby/zepto/master/src/touch.js
790// Zepto.js may be freely distributed under the MIT license.
791
792;(function($){
793
794 if ($.fn.swipeLeft) {
795 return;
796 }
797
798
799 var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
800
801 function swipeDirection(x1, x2, y1, y2) {
802 return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
803 }
804
805 function longTap() {
806 longTapTimeout = null;
807 if (touch.last) {
808 if ( touch.el !== undefined ) touch.el.trigger('longTap');
809 touch = {};
810 }
811 }
812
813 function cancelLongTap() {
814 if (longTapTimeout) clearTimeout(longTapTimeout);
815 longTapTimeout = null;
816 }
817
818 function cancelAll() {
819 if (touchTimeout) clearTimeout(touchTimeout);
820 if (tapTimeout) clearTimeout(tapTimeout);
821 if (swipeTimeout) clearTimeout(swipeTimeout);
822 if (longTapTimeout) clearTimeout(longTapTimeout);
823 touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
824 touch = {};
825 }
826
827 function isPrimaryTouch(event){
828 return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
829 }
830
831 $(function(){
832 var now, delta, deltaX = 0, deltaY = 0, firstTouch;
833
834 if ('MSGesture' in window) {
835 gesture = new MSGesture();
836 gesture.target = document.body;
837 }
838
839 $(document)
840 .on('MSGestureEnd gestureend', function(e){
841
842 var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
843
844 if (swipeDirectionFromVelocity && touch.el !== undefined) {
845 touch.el.trigger('swipe');
846 touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
847 }
848 })
849 // MSPointerDown: for IE10
850 // pointerdown: for IE11
851 .on('touchstart MSPointerDown pointerdown', function(e){
852
853 if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
854
855 firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
856
857 now = Date.now();
858 delta = now - (touch.last || now);
859 touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
860
861 if(touchTimeout) clearTimeout(touchTimeout);
862
863 touch.x1 = firstTouch.pageX;
864 touch.y1 = firstTouch.pageY;
865
866 if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
867
868 touch.last = now;
869 longTapTimeout = setTimeout(longTap, longTapDelay);
870
871 // adds the current touch contact for IE gesture recognition
872 if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
873 gesture.addPointer(e.originalEvent.pointerId);
874 }
875
876 })
877 // MSPointerMove: for IE10
878 // pointermove: for IE11
879 .on('touchmove MSPointerMove pointermove', function(e){
880
881 if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
882
883 firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
884
885 cancelLongTap();
886 touch.x2 = firstTouch.pageX;
887 touch.y2 = firstTouch.pageY;
888
889 deltaX += Math.abs(touch.x1 - touch.x2);
890 deltaY += Math.abs(touch.y1 - touch.y2);
891 })
892 // MSPointerUp: for IE10
893 // pointerup: for IE11
894 .on('touchend MSPointerUp pointerup', function(e){
895
896 if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
897
898 cancelLongTap();
899
900 // swipe
901 if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
902
903 swipeTimeout = setTimeout(function() {
904 if ( touch.el !== undefined ) {
905 touch.el.trigger('swipe');
906 touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
907 }
908 touch = {};
909 }, 0);
910
911 // normal tap
912 } else if ('last' in touch) {
913
914 // don't fire tap when delta position changed by more than 30 pixels,
915 // for instance when moving to a point and back to origin
916 if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
917 // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
918 // ('tap' fires before 'scroll')
919 tapTimeout = setTimeout(function() {
920
921 // trigger universal 'tap' with the option to cancelTouch()
922 // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
923 var event = $.Event('tap');
924 event.cancelTouch = cancelAll;
925 if ( touch.el !== undefined ) touch.el.trigger(event);
926
927 // trigger double tap immediately
928 if (touch.isDoubleTap) {
929 if ( touch.el !== undefined ) touch.el.trigger('doubleTap');
930 touch = {};
931 }
932
933 // trigger single tap after 250ms of inactivity
934 else {
935 touchTimeout = setTimeout(function(){
936 touchTimeout = null;
937 if ( touch.el !== undefined ) touch.el.trigger('singleTap');
938 touch = {};
939 }, 250);
940 }
941 }, 0);
942 } else {
943 touch = {};
944 }
945 deltaX = deltaY = 0;
946 }
947 })
948 // when the browser window loses focus,
949 // for example when a modal dialog is shown,
950 // cancel all ongoing events
951 .on('touchcancel MSPointerCancel', cancelAll);
952
953 // scrolling the window indicates intention of the user
954 // to scroll, not tap or swipe, so cancel all ongoing events
955 $(window).on('scroll', cancelAll);
956 });
957
958 ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
959 $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
960 });
961})(jQuery);
962
963(function(UI) {
964
965 "use strict";
966
967 var stacks = [];
968
969 UI.component('stackMargin', {
970
971 defaults: {
972 cls: 'uk-margin-small-top',
973 rowfirst: false,
974 observe: false
975 },
976
977 boot: function() {
978
979 // init code
980 UI.ready(function(context) {
981
982 UI.$("[data-uk-margin]", context).each(function() {
983
984 var ele = UI.$(this);
985
986 if (!ele.data("stackMargin")) {
987 UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
988 }
989 });
990 });
991 },
992
993 init: function() {
994
995 var $this = this;
996
997 UI.$win.on('resize orientationchange', (function() {
998
999 var fn = function() {
1000 $this.process();
1001 };
1002
1003 UI.$(function() {
1004 fn();
1005 UI.$win.on("load", fn);
1006 });
1007
1008 return UI.Utils.debounce(fn, 20);
1009 })());
1010
1011 this.on("display.uk.check", function(e) {
1012 if (this.element.is(":visible")) this.process();
1013 }.bind(this));
1014
1015 if (this.options.observe) {
1016
1017 UI.domObserve(this.element, function(e) {
1018 if ($this.element.is(":visible")) $this.process();
1019 });
1020 }
1021
1022 stacks.push(this);
1023 },
1024
1025 process: function() {
1026
1027 var $this = this, columns = this.element.children();
1028
1029 UI.Utils.stackMargin(columns, this.options);
1030
1031 if (!this.options.rowfirst || !columns.length) {
1032 return this;
1033 }
1034
1035 // Mark first column elements
1036 var group = {}, minleft = false;
1037
1038 columns.removeClass(this.options.rowfirst).each(function(offset, $ele){
1039
1040 $ele = UI.$(this);
1041
1042 if (this.style.display != 'none') {
1043 offset = $ele.offset().left;
1044 ((group[offset] = group[offset] || []) && group[offset]).push(this);
1045 minleft = minleft === false ? offset : Math.min(minleft, offset);
1046 }
1047 });
1048
1049 UI.$(group[minleft]).addClass(this.options.rowfirst);
1050
1051 return this;
1052 }
1053
1054 });
1055
1056
1057 // responsive element e.g. iframes
1058
1059 (function(){
1060
1061 var elements = [], check = function(ele) {
1062
1063 if (!ele.is(':visible')) return;
1064
1065 var width = ele.parent().width(),
1066 iwidth = ele.data('width'),
1067 ratio = (width / iwidth),
1068 height = Math.floor(ratio * ele.data('height'));
1069
1070 ele.css({'height': (width < iwidth) ? height : ele.data('height')});
1071 };
1072
1073 UI.component('responsiveElement', {
1074
1075 defaults: {},
1076
1077 boot: function() {
1078
1079 // init code
1080 UI.ready(function(context) {
1081
1082 UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
1083
1084 var ele = UI.$(this), obj;
1085
1086 if (!ele.data("responsiveElement")) {
1087 obj = UI.responsiveElement(ele, {});
1088 }
1089 });
1090 });
1091 },
1092
1093 init: function() {
1094
1095 var ele = this.element;
1096
1097 if (ele.attr('width') && ele.attr('height')) {
1098
1099 ele.data({
1100
1101 'width' : ele.attr('width'),
1102 'height': ele.attr('height')
1103
1104 }).on('display.uk.check', function(){
1105 check(ele);
1106 });
1107
1108 check(ele);
1109
1110 elements.push(ele);
1111 }
1112 }
1113 });
1114
1115 UI.$win.on('resize load', UI.Utils.debounce(function(){
1116
1117 elements.forEach(function(ele){
1118 check(ele);
1119 });
1120
1121 }, 15));
1122
1123 })();
1124
1125
1126
1127 // helper
1128
1129 UI.Utils.stackMargin = function(elements, options) {
1130
1131 options = UI.$.extend({
1132 'cls': 'uk-margin-small-top'
1133 }, options);
1134
1135 elements = UI.$(elements).removeClass(options.cls);
1136
1137 var min = false;
1138
1139 elements.each(function(offset, height, pos, $ele){
1140
1141 $ele = UI.$(this);
1142
1143 if ($ele.css('display') != 'none') {
1144
1145 offset = $ele.offset();
1146 height = $ele.outerHeight();
1147 pos = offset.top + height;
1148
1149 $ele.data({
1150 'ukMarginPos': pos,
1151 'ukMarginTop': offset.top
1152 });
1153
1154 if (min === false || (offset.top < min.top) ) {
1155
1156 min = {
1157 top : offset.top,
1158 left : offset.left,
1159 pos : pos
1160 };
1161 }
1162 }
1163
1164 }).each(function($ele) {
1165
1166 $ele = UI.$(this);
1167
1168 if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
1169 $ele.addClass(options.cls);
1170 }
1171 });
1172 };
1173
1174 UI.Utils.matchHeights = function(elements, options) {
1175
1176 elements = UI.$(elements).css('min-height', '');
1177 options = UI.$.extend({ row : true }, options);
1178
1179 var matchHeights = function(group){
1180
1181 if (group.length < 2) return;
1182
1183 var max = 0;
1184
1185 group.each(function() {
1186 max = Math.max(max, UI.$(this).outerHeight());
1187 }).each(function() {
1188
1189 var element = UI.$(this),
1190 height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
1191
1192 element.css('min-height', height + 'px');
1193 });
1194 };
1195
1196 if (options.row) {
1197
1198 elements.first().width(); // force redraw
1199
1200 setTimeout(function(){
1201
1202 var lastoffset = false, group = [];
1203
1204 elements.each(function() {
1205
1206 var ele = UI.$(this), offset = ele.offset().top;
1207
1208 if (offset != lastoffset && group.length) {
1209
1210 matchHeights(UI.$(group));
1211 group = [];
1212 offset = ele.offset().top;
1213 }
1214
1215 group.push(ele);
1216 lastoffset = offset;
1217 });
1218
1219 if (group.length) {
1220 matchHeights(UI.$(group));
1221 }
1222
1223 }, 0);
1224
1225 } else {
1226 matchHeights(elements);
1227 }
1228 };
1229
1230 (function(cacheSvgs){
1231
1232 UI.Utils.inlineSvg = function(selector, root) {
1233
1234 var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
1235
1236 var img = UI.$(this),
1237 src = img.attr('src');
1238
1239 if (!cacheSvgs[src]) {
1240
1241 var d = UI.$.Deferred();
1242
1243 UI.$.get(src, {nc: Math.random()}, function(data){
1244 d.resolve(UI.$(data).find('svg'));
1245 });
1246
1247 cacheSvgs[src] = d.promise();
1248 }
1249
1250 cacheSvgs[src].then(function(svg) {
1251
1252 var $svg = UI.$(svg).clone();
1253
1254 if (img.attr('id')) $svg.attr('id', img.attr('id'));
1255 if (img.attr('class')) $svg.attr('class', img.attr('class'));
1256 if (img.attr('style')) $svg.attr('style', img.attr('style'));
1257
1258 if (img.attr('width')) {
1259 $svg.attr('width', img.attr('width'));
1260 if (!img.attr('height')) $svg.removeAttr('height');
1261 }
1262
1263 if (img.attr('height')){
1264 $svg.attr('height', img.attr('height'));
1265 if (!img.attr('width')) $svg.removeAttr('width');
1266 }
1267
1268 img.replaceWith($svg);
1269 });
1270 });
1271 };
1272
1273 // init code
1274 UI.ready(function(context) {
1275 UI.Utils.inlineSvg('[data-uk-svg]', context);
1276 });
1277
1278 })({});
1279
1280})(UIkit);
1281
1282(function(UI) {
1283
1284 "use strict";
1285
1286 UI.component('smoothScroll', {
1287
1288 boot: function() {
1289
1290 // init code
1291 UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
1292 var ele = UI.$(this);
1293
1294 if (!ele.data("smoothScroll")) {
1295 var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
1296 ele.trigger("click");
1297 }
1298
1299 return false;
1300 });
1301 },
1302
1303 init: function() {
1304
1305 var $this = this;
1306
1307 this.on("click", function(e) {
1308 e.preventDefault();
1309 scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
1310 });
1311 }
1312 });
1313
1314 function scrollToElement(ele, options) {
1315
1316 options = UI.$.extend({
1317 duration: 1000,
1318 transition: 'easeOutExpo',
1319 offset: 0,
1320 complete: function(){}
1321 }, options);
1322
1323 // get / set parameters
1324 var target = ele.offset().top - options.offset,
1325 docheight = UI.$doc.height(),
1326 winheight = window.innerHeight;
1327
1328 if ((target + winheight) > docheight) {
1329 target = docheight - winheight;
1330 }
1331
1332 // animate to target, fire callback when done
1333 UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
1334 }
1335
1336 UI.Utils.scrollToElement = scrollToElement;
1337
1338 if (!UI.$.easing.easeOutExpo) {
1339 UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
1340 }
1341
1342})(UIkit);
1343
1344(function(UI) {
1345
1346 "use strict";
1347
1348 var $win = UI.$win,
1349 $doc = UI.$doc,
1350 scrollspies = [],
1351 checkScrollSpy = function() {
1352 for(var i=0; i < scrollspies.length; i++) {
1353 window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
1354 }
1355 };
1356
1357 UI.component('scrollspy', {
1358
1359 defaults: {
1360 "target" : false,
1361 "cls" : "uk-scrollspy-inview",
1362 "initcls" : "uk-scrollspy-init-inview",
1363 "topoffset" : 0,
1364 "leftoffset" : 0,
1365 "repeat" : false,
1366 "delay" : 0
1367 },
1368
1369 boot: function() {
1370
1371 // listen to scroll and resize
1372 $doc.on("scrolling.uk.document", checkScrollSpy);
1373 $win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
1374
1375 // init code
1376 UI.ready(function(context) {
1377
1378 UI.$("[data-uk-scrollspy]", context).each(function() {
1379
1380 var element = UI.$(this);
1381
1382 if (!element.data("scrollspy")) {
1383 var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
1384 }
1385 });
1386 });
1387 },
1388
1389 init: function() {
1390
1391 var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
1392
1393 var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
1394 delayIdx = elements.length === 1 ? 1 : 0,
1395 toggleclsIdx = 0;
1396
1397 elements.each(function(idx){
1398
1399 var element = UI.$(this),
1400 inviewstate = element.data('inviewstate'),
1401 inview = UI.Utils.isInView(element, $this.options),
1402 toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
1403
1404 if (inview && !inviewstate && !element.data('scrollspy-idle')) {
1405
1406 if (!initinview) {
1407 element.addClass($this.options.initcls);
1408 $this.offset = element.offset();
1409 initinview = true;
1410
1411 element.trigger("init.uk.scrollspy");
1412 }
1413
1414 element.data('scrollspy-idle', setTimeout(function(){
1415
1416 element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
1417 element.trigger("inview.uk.scrollspy");
1418
1419 element.data('scrollspy-idle', false);
1420 element.data('inviewstate', true);
1421
1422 }, $this.options.delay * delayIdx));
1423
1424 delayIdx++;
1425 }
1426
1427 if (!inview && inviewstate && $this.options.repeat) {
1428
1429 if (element.data('scrollspy-idle')) {
1430 clearTimeout(element.data('scrollspy-idle'));
1431 element.data('scrollspy-idle', false);
1432 }
1433
1434 element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
1435 element.data('inviewstate', false);
1436
1437 element.trigger("outview.uk.scrollspy");
1438 }
1439
1440 toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
1441
1442 });
1443 };
1444
1445 fn();
1446
1447 this.check = fn;
1448
1449 scrollspies.push(this);
1450 }
1451 });
1452
1453
1454 var scrollspynavs = [],
1455 checkScrollSpyNavs = function() {
1456 for(var i=0; i < scrollspynavs.length; i++) {
1457 window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
1458 }
1459 };
1460
1461 UI.component('scrollspynav', {
1462
1463 defaults: {
1464 "cls" : 'uk-active',
1465 "closest" : false,
1466 "topoffset" : 0,
1467 "leftoffset" : 0,
1468 "smoothscroll" : false
1469 },
1470
1471 boot: function() {
1472
1473 // listen to scroll and resize
1474 $doc.on("scrolling.uk.document", checkScrollSpyNavs);
1475 $win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
1476
1477 // init code
1478 UI.ready(function(context) {
1479
1480 UI.$("[data-uk-scrollspy-nav]", context).each(function() {
1481
1482 var element = UI.$(this);
1483
1484 if (!element.data("scrollspynav")) {
1485 var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
1486 }
1487 });
1488 });
1489 },
1490
1491 init: function() {
1492
1493 var ids = [],
1494 links = this.find("a[href^='#']").each(function(){ if(this.getAttribute("href").trim()!=='#') ids.push(this.getAttribute("href")); }),
1495 targets = UI.$(ids.join(",")),
1496
1497 clsActive = this.options.cls,
1498 clsClosest = this.options.closest || this.options.closest;
1499
1500 var $this = this, inviews, fn = function(){
1501
1502 inviews = [];
1503
1504 for (var i=0 ; i < targets.length ; i++) {
1505 if (UI.Utils.isInView(targets.eq(i), $this.options)) {
1506 inviews.push(targets.eq(i));
1507 }
1508 }
1509
1510 if (inviews.length) {
1511
1512 var navitems,
1513 scrollTop = $win.scrollTop(),
1514 target = (function(){
1515 for(var i=0; i< inviews.length;i++){
1516 if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
1517 return inviews[i];
1518 }
1519 }
1520 })();
1521
1522 if (!target) return;
1523
1524 if ($this.options.closest) {
1525 links.blur().closest(clsClosest).removeClass(clsActive);
1526 navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
1527 } else {
1528 navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
1529 }
1530
1531 $this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
1532 }
1533 };
1534
1535 if (this.options.smoothscroll && UI.smoothScroll) {
1536 links.each(function(){
1537 UI.smoothScroll(this, $this.options.smoothscroll);
1538 });
1539 }
1540
1541 fn();
1542
1543 this.element.data("scrollspynav", this);
1544
1545 this.check = fn;
1546 scrollspynavs.push(this);
1547
1548 }
1549 });
1550
1551})(UIkit);
1552
1553(function(UI){
1554
1555 "use strict";
1556
1557 var toggles = [];
1558
1559 UI.component('toggle', {
1560
1561 defaults: {
1562 target : false,
1563 cls : 'uk-hidden',
1564 animation : false,
1565 duration : 200
1566 },
1567
1568 boot: function(){
1569
1570 // init code
1571 UI.ready(function(context) {
1572
1573 UI.$("[data-uk-toggle]", context).each(function() {
1574 var ele = UI.$(this);
1575
1576 if (!ele.data("toggle")) {
1577 var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
1578 }
1579 });
1580
1581 setTimeout(function(){
1582
1583 toggles.forEach(function(toggle){
1584 toggle.getToggles();
1585 });
1586
1587 }, 0);
1588 });
1589 },
1590
1591 init: function() {
1592
1593 var $this = this;
1594
1595 this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
1596
1597 this.getToggles();
1598
1599 this.on("click", function(e) {
1600 if ($this.element.is('a[href="#"]')) e.preventDefault();
1601 $this.toggle();
1602 });
1603
1604 toggles.push(this);
1605 },
1606
1607 toggle: function() {
1608
1609 if(!this.totoggle.length) return;
1610
1611 if (this.options.animation && UI.support.animation) {
1612
1613 var $this = this, animations = this.options.animation.split(',');
1614
1615 if (animations.length == 1) {
1616 animations[1] = animations[0];
1617 }
1618
1619 animations[0] = animations[0].trim();
1620 animations[1] = animations[1].trim();
1621
1622 this.totoggle.css('animation-duration', this.options.duration+'ms');
1623
1624 this.totoggle.each(function(){
1625
1626 var ele = UI.$(this);
1627
1628 if (ele.hasClass($this.options.cls)) {
1629
1630 ele.toggleClass($this.options.cls);
1631
1632 UI.Utils.animate(ele, animations[0]).then(function(){
1633 ele.css('animation-duration', '');
1634 UI.Utils.checkDisplay(ele);
1635 });
1636
1637 } else {
1638
1639 UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
1640 ele.toggleClass($this.options.cls).css('animation-duration', '');
1641 UI.Utils.checkDisplay(ele);
1642 });
1643
1644 }
1645
1646 });
1647
1648 } else {
1649 this.totoggle.toggleClass(this.options.cls);
1650 UI.Utils.checkDisplay(this.totoggle);
1651 }
1652
1653 this.updateAria();
1654
1655 },
1656
1657 getToggles: function() {
1658 this.totoggle = this.options.target ? UI.$(this.options.target):[];
1659 this.updateAria();
1660 },
1661
1662 updateAria: function() {
1663 if (this.aria && this.totoggle.length) {
1664 this.totoggle.each(function(){
1665 UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
1666 });
1667 }
1668 }
1669 });
1670
1671})(UIkit);
1672
1673(function(UI) {
1674
1675 "use strict";
1676
1677 UI.component('alert', {
1678
1679 defaults: {
1680 "fade": true,
1681 "duration": 200,
1682 "trigger": ".uk-alert-close"
1683 },
1684
1685 boot: function() {
1686
1687 // init code
1688 UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
1689
1690 var ele = UI.$(this);
1691
1692 if (!ele.data("alert")) {
1693
1694 var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
1695
1696 if (UI.$(e.target).is(alert.options.trigger)) {
1697 e.preventDefault();
1698 alert.close();
1699 }
1700 }
1701 });
1702 },
1703
1704 init: function() {
1705
1706 var $this = this;
1707
1708 this.on("click", this.options.trigger, function(e) {
1709 e.preventDefault();
1710 $this.close();
1711 });
1712 },
1713
1714 close: function() {
1715
1716 var element = this.trigger("close.uk.alert"),
1717 removeElement = function () {
1718 this.trigger("closed.uk.alert").remove();
1719 }.bind(this);
1720
1721 if (this.options.fade) {
1722 element.css("overflow", "hidden").css("max-height", element.height()).animate({
1723 "height" : 0,
1724 "opacity" : 0,
1725 "padding-top" : 0,
1726 "padding-bottom" : 0,
1727 "margin-top" : 0,
1728 "margin-bottom" : 0
1729 }, this.options.duration, removeElement);
1730 } else {
1731 removeElement();
1732 }
1733 }
1734
1735 });
1736
1737})(UIkit);
1738
1739(function(UI) {
1740
1741 "use strict";
1742
1743 UI.component('buttonRadio', {
1744
1745 defaults: {
1746 "activeClass": 'uk-active',
1747 "target": ".uk-button"
1748 },
1749
1750 boot: function() {
1751
1752 // init code
1753 UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
1754
1755 var ele = UI.$(this);
1756
1757 if (!ele.data("buttonRadio")) {
1758
1759 var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
1760 target = UI.$(e.target);
1761
1762 if (target.is(obj.options.target)) {
1763 target.trigger("click");
1764 }
1765 }
1766 });
1767 },
1768
1769 init: function() {
1770
1771 var $this = this;
1772
1773 // Init ARIA
1774 this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1775
1776 this.on("click", this.options.target, function(e) {
1777
1778 var ele = UI.$(this);
1779
1780 if (ele.is('a[href="#"]')) e.preventDefault();
1781
1782 $this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
1783 ele.addClass($this.options.activeClass);
1784
1785 // Update ARIA
1786 $this.find($this.options.target).not(ele).attr('aria-checked', 'false');
1787 ele.attr('aria-checked', 'true');
1788
1789 $this.trigger("change.uk.button", [ele]);
1790 });
1791
1792 },
1793
1794 getSelected: function() {
1795 return this.find('.' + this.options.activeClass);
1796 }
1797 });
1798
1799 UI.component('buttonCheckbox', {
1800
1801 defaults: {
1802 "activeClass": 'uk-active',
1803 "target": ".uk-button"
1804 },
1805
1806 boot: function() {
1807
1808 UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
1809 var ele = UI.$(this);
1810
1811 if (!ele.data("buttonCheckbox")) {
1812
1813 var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
1814 target = UI.$(e.target);
1815
1816 if (target.is(obj.options.target)) {
1817 target.trigger("click");
1818 }
1819 }
1820 });
1821 },
1822
1823 init: function() {
1824
1825 var $this = this;
1826
1827 // Init ARIA
1828 this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
1829
1830 this.on("click", this.options.target, function(e) {
1831 var ele = UI.$(this);
1832
1833 if (ele.is('a[href="#"]')) e.preventDefault();
1834
1835 ele.toggleClass($this.options.activeClass).blur();
1836
1837 // Update ARIA
1838 ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
1839
1840 $this.trigger("change.uk.button", [ele]);
1841 });
1842
1843 },
1844
1845 getSelected: function() {
1846 return this.find('.' + this.options.activeClass);
1847 }
1848 });
1849
1850
1851 UI.component('button', {
1852
1853 defaults: {},
1854
1855 boot: function() {
1856
1857 UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
1858 var ele = UI.$(this);
1859
1860 if (!ele.data("button")) {
1861
1862 var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
1863 ele.trigger("click");
1864 }
1865 });
1866 },
1867
1868 init: function() {
1869
1870 var $this = this;
1871
1872 // Init ARIA
1873 this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1874
1875 this.on("click", function(e) {
1876
1877 if ($this.element.is('a[href="#"]')) e.preventDefault();
1878
1879 $this.toggle();
1880 $this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
1881 });
1882
1883 },
1884
1885 toggle: function() {
1886 this.element.toggleClass("uk-active");
1887
1888 // Update ARIA
1889 this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
1890 }
1891 });
1892
1893})(UIkit);
1894
1895
1896(function(UI) {
1897
1898 "use strict";
1899
1900 var active = false, hoverIdle, flips = {
1901 'x': {
1902 "bottom-left" : 'bottom-right',
1903 "bottom-right" : 'bottom-left',
1904 "bottom-center" : 'bottom-center',
1905 "top-left" : 'top-right',
1906 "top-right" : 'top-left',
1907 "top-center" : 'top-center',
1908 "left-top" : 'right-top',
1909 "left-bottom" : 'right-bottom',
1910 "left-center" : 'right-center',
1911 "right-top" : 'left-top',
1912 "right-bottom" : 'left-bottom',
1913 "right-center" : 'left-center'
1914 },
1915 'y': {
1916 "bottom-left" : 'top-left',
1917 "bottom-right" : 'top-right',
1918 "bottom-center" : 'top-center',
1919 "top-left" : 'bottom-left',
1920 "top-right" : 'bottom-right',
1921 "top-center" : 'bottom-center',
1922 "left-top" : 'left-bottom',
1923 "left-bottom" : 'left-top',
1924 "left-center" : 'left-center',
1925 "right-top" : 'right-bottom',
1926 "right-bottom" : 'right-top',
1927 "right-center" : 'right-center'
1928 },
1929 'xy': {
1930 "bottom-left" : 'top-right',
1931 "bottom-right" : 'top-left',
1932 "bottom-center" : 'top-center',
1933 "top-left" : 'bottom-right',
1934 "top-right" : 'bottom-left',
1935 "top-center" : 'bottom-center',
1936 "left-top" : 'right-bottom',
1937 "left-bottom" : 'right-top',
1938 "left-center" : 'right-center',
1939 "right-top" : 'left-bottom',
1940 "right-bottom" : 'left-top',
1941 "right-center" : 'left-center'
1942 }
1943 };
1944
1945 UI.component('dropdown', {
1946
1947 defaults: {
1948 'mode' : 'hover',
1949 'pos' : 'bottom-left',
1950 'offset' : 0,
1951 'remaintime' : 800,
1952 'justify' : false,
1953 'boundary' : UI.$win,
1954 'delay' : 0,
1955 'dropdownSelector': '.uk-dropdown,.uk-dropdown-blank',
1956 'hoverDelayIdle' : 250,
1957 'preventflip' : false
1958 },
1959
1960 remainIdle: false,
1961
1962 boot: function() {
1963
1964 var triggerevent = UI.support.touch ? "click" : "mouseenter";
1965
1966 // init code
1967 UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
1968
1969 var ele = UI.$(this);
1970
1971 if (!ele.data("dropdown")) {
1972
1973 var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
1974
1975 if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
1976 dropdown.element.trigger(triggerevent);
1977 }
1978
1979 if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
1980 e.preventDefault();
1981 }
1982 }
1983 });
1984 },
1985
1986 init: function() {
1987
1988 var $this = this;
1989
1990 this.dropdown = this.find(this.options.dropdownSelector);
1991 this.offsetParent = this.dropdown.parents().filter(function() {
1992 return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
1993 }).slice(0,1);
1994
1995 this.centered = this.dropdown.hasClass('uk-dropdown-center');
1996 this.justified = this.options.justify ? UI.$(this.options.justify) : false;
1997
1998 this.boundary = UI.$(this.options.boundary);
1999
2000 if (!this.boundary.length) {
2001 this.boundary = UI.$win;
2002 }
2003
2004 // legacy DEPRECATED!
2005 if (this.dropdown.hasClass('uk-dropdown-up')) {
2006 this.options.pos = 'top-left';
2007 }
2008 if (this.dropdown.hasClass('uk-dropdown-flip')) {
2009 this.options.pos = this.options.pos.replace('left','right');
2010 }
2011 if (this.dropdown.hasClass('uk-dropdown-center')) {
2012 this.options.pos = this.options.pos.replace(/(left|right)/,'center');
2013 }
2014 //-- end legacy
2015
2016 // Init ARIA
2017 this.element.attr('aria-haspopup', 'true');
2018 this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
2019
2020 if (this.options.mode == "click" || UI.support.touch) {
2021
2022 this.on("click.uk.dropdown", function(e) {
2023
2024 var $target = UI.$(e.target);
2025
2026 if (!$target.parents($this.options.dropdownSelector).length) {
2027
2028 if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
2029 e.preventDefault();
2030 }
2031
2032 $target.blur();
2033 }
2034
2035 if (!$this.element.hasClass('uk-open')) {
2036
2037 $this.show();
2038
2039 } else {
2040
2041 if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2042 $this.hide();
2043 }
2044 }
2045 });
2046
2047 } else {
2048
2049 this.on("mouseenter", function(e) {
2050
2051 $this.trigger('pointerenter.uk.dropdown', [$this]);
2052
2053 if ($this.remainIdle) {
2054 clearTimeout($this.remainIdle);
2055 }
2056
2057 if (hoverIdle) {
2058 clearTimeout(hoverIdle);
2059 }
2060
2061 if (active && active == $this) {
2062 return;
2063 }
2064
2065 // pseudo manuAim
2066 if (active && active != $this) {
2067
2068 hoverIdle = setTimeout(function() {
2069 hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2070 }, $this.options.hoverDelayIdle);
2071
2072 } else {
2073
2074 hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
2075 }
2076
2077 }).on("mouseleave", function() {
2078
2079 if (hoverIdle) {
2080 clearTimeout(hoverIdle);
2081 }
2082
2083 $this.remainIdle = setTimeout(function() {
2084 if (active && active == $this) $this.hide();
2085 }, $this.options.remaintime);
2086
2087 $this.trigger('pointerleave.uk.dropdown', [$this]);
2088
2089 }).on("click", function(e){
2090
2091 var $target = UI.$(e.target);
2092
2093 if ($this.remainIdle) {
2094 clearTimeout($this.remainIdle);
2095 }
2096
2097 if (active && active == $this) {
2098 if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
2099 $this.hide();
2100 }
2101 return;
2102 }
2103
2104 if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
2105 e.preventDefault();
2106 }
2107
2108 $this.show();
2109 });
2110 }
2111 },
2112
2113 show: function(){
2114
2115 UI.$html.off("click.outer.dropdown");
2116
2117 if (active && active != this) {
2118 active.hide(true);
2119 }
2120
2121 if (hoverIdle) {
2122 clearTimeout(hoverIdle);
2123 }
2124
2125 this.trigger('beforeshow.uk.dropdown', [this]);
2126
2127 this.checkDimensions();
2128 this.element.addClass('uk-open');
2129
2130 // Update ARIA
2131 this.element.attr('aria-expanded', 'true');
2132
2133 this.trigger('show.uk.dropdown', [this]);
2134
2135 UI.Utils.checkDisplay(this.dropdown, true);
2136 active = this;
2137
2138 this.registerOuterClick();
2139 },
2140
2141 hide: function(force) {
2142
2143 this.trigger('beforehide.uk.dropdown', [this, force]);
2144
2145 this.element.removeClass('uk-open');
2146
2147 if (this.remainIdle) {
2148 clearTimeout(this.remainIdle);
2149 }
2150
2151 this.remainIdle = false;
2152
2153 // Update ARIA
2154 this.element.attr('aria-expanded', 'false');
2155
2156 this.trigger('hide.uk.dropdown', [this, force]);
2157
2158 if (active == this) active = false;
2159 },
2160
2161 registerOuterClick: function(){
2162
2163 var $this = this;
2164
2165 UI.$html.off("click.outer.dropdown");
2166
2167 setTimeout(function() {
2168
2169 UI.$html.on("click.outer.dropdown", function(e) {
2170
2171 if (hoverIdle) {
2172 clearTimeout(hoverIdle);
2173 }
2174
2175 var $target = UI.$(e.target);
2176
2177 if (active == $this && !$this.element.find(e.target).length) {
2178 $this.hide(true);
2179 UI.$html.off("click.outer.dropdown");
2180 }
2181 });
2182 }, 10);
2183 },
2184
2185 checkDimensions: function() {
2186
2187 if (!this.dropdown.length) return;
2188
2189 // reset
2190 this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
2191 'top-left':'',
2192 'left':'',
2193 'margin-left' :'',
2194 'margin-right':''
2195 });
2196
2197 if (this.justified && this.justified.length) {
2198 this.dropdown.css("min-width", "");
2199 }
2200
2201 var $this = this,
2202 pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
2203 posoffset = this.options.offset,
2204 dropdown = this.dropdown,
2205 offset = dropdown.show().offset() || {left: 0, top: 0},
2206 width = dropdown.outerWidth(),
2207 height = dropdown.outerHeight(),
2208 boundarywidth = this.boundary.width(),
2209 boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
2210 dpos = this.options.pos;
2211
2212 var variants = {
2213 "bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
2214 "bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
2215 "bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
2216 "top-left" : {top: 0 - height - posoffset, left: 0},
2217 "top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
2218 "top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
2219 "left-top" : {top: 0, left: 0 - width - posoffset},
2220 "left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
2221 "left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
2222 "right-top" : {top: 0, left: 0 + pos.width + posoffset},
2223 "right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
2224 "right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
2225 },
2226 css = {},
2227 pp;
2228
2229 pp = dpos.split('-');
2230 css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2231
2232 // justify dropdown
2233 if (this.justified && this.justified.length) {
2234 justify(dropdown.css({left:0}), this.justified, boundarywidth);
2235 } else {
2236
2237 if (this.options.preventflip !== true) {
2238
2239 var fdpos;
2240
2241 switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2242 case "x":
2243 if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
2244 break;
2245 case "y":
2246 if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
2247 break;
2248 case "xy":
2249 if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
2250 break;
2251 }
2252
2253 if (fdpos) {
2254
2255 pp = fdpos.split('-');
2256 css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
2257
2258 // check flipped
2259 if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
2260 pp = dpos.split('-');
2261 css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
2262 }
2263 }
2264 }
2265 }
2266
2267 if (width > boundarywidth) {
2268 dropdown.addClass("uk-dropdown-stack");
2269 this.trigger('stack.uk.dropdown', [this]);
2270 }
2271
2272 dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
2273 },
2274
2275 checkBoundary: function(left, top, width, height, boundarywidth) {
2276
2277 var axis = "";
2278
2279 if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
2280 axis += "x";
2281 }
2282
2283 if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
2284 axis += "y";
2285 }
2286
2287 return axis;
2288 }
2289 });
2290
2291
2292 UI.component('dropdownOverlay', {
2293
2294 defaults: {
2295 'justify' : false,
2296 'cls' : '',
2297 'duration': 200
2298 },
2299
2300 boot: function() {
2301
2302 // init code
2303 UI.ready(function(context) {
2304
2305 UI.$("[data-uk-dropdown-overlay]", context).each(function() {
2306 var ele = UI.$(this);
2307
2308 if (!ele.data("dropdownOverlay")) {
2309 UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
2310 }
2311 });
2312 });
2313 },
2314
2315 init: function() {
2316
2317 var $this = this;
2318
2319 this.justified = this.options.justify ? UI.$(this.options.justify) : false;
2320 this.overlay = this.element.find('uk-dropdown-overlay');
2321
2322 if (!this.overlay.length) {
2323 this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
2324 }
2325
2326 this.overlay.addClass(this.options.cls);
2327
2328 this.on({
2329
2330 'beforeshow.uk.dropdown': function(e, dropdown) {
2331 $this.dropdown = dropdown;
2332
2333 if ($this.justified && $this.justified.length) {
2334 justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
2335 }
2336 },
2337
2338 'show.uk.dropdown': function(e, dropdown) {
2339
2340 var h = $this.dropdown.dropdown.outerHeight(true);
2341
2342 $this.dropdown.element.removeClass('uk-open');
2343
2344 $this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
2345
2346 $this.dropdown.dropdown.css('visibility', '');
2347 $this.dropdown.element.addClass('uk-open');
2348
2349 UI.Utils.checkDisplay($this.dropdown.dropdown, true);
2350 });
2351
2352 $this.pointerleave = false;
2353 },
2354
2355 'hide.uk.dropdown': function() {
2356 $this.overlay.stop().animate({height: 0}, $this.options.duration);
2357 },
2358
2359 'pointerenter.uk.dropdown': function(e, dropdown) {
2360 clearTimeout($this.remainIdle);
2361 },
2362
2363 'pointerleave.uk.dropdown': function(e, dropdown) {
2364 $this.pointerleave = true;
2365 }
2366 });
2367
2368
2369 this.overlay.on({
2370
2371 'mouseenter': function() {
2372 if ($this.remainIdle) {
2373 clearTimeout($this.dropdown.remainIdle);
2374 clearTimeout($this.remainIdle);
2375 }
2376 },
2377
2378 'mouseleave': function(){
2379
2380 if ($this.pointerleave && active) {
2381
2382 $this.remainIdle = setTimeout(function() {
2383 if(active) active.hide();
2384 }, active.options.remaintime);
2385 }
2386 }
2387 })
2388 }
2389
2390 });
2391
2392
2393 function justify(ele, justifyTo, boundarywidth, offset) {
2394
2395 ele = UI.$(ele);
2396 justifyTo = UI.$(justifyTo);
2397 boundarywidth = boundarywidth || window.innerWidth;
2398 offset = offset || ele.offset();
2399
2400 if (justifyTo.length) {
2401
2402 var jwidth = justifyTo.outerWidth();
2403
2404 ele.css("min-width", jwidth);
2405
2406 if (UI.langdirection == 'right') {
2407
2408 var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
2409 right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
2410
2411 ele.css("margin-right", right1 - right2);
2412
2413 } else {
2414 ele.css("margin-left", justifyTo.offset().left - offset.left);
2415 }
2416 }
2417 }
2418
2419})(UIkit);
2420
2421(function(UI) {
2422
2423 "use strict";
2424
2425 var grids = [];
2426
2427 UI.component('gridMatchHeight', {
2428
2429 defaults: {
2430 "target" : false,
2431 "row" : true,
2432 "ignorestacked" : false,
2433 "observe" : false
2434 },
2435
2436 boot: function() {
2437
2438 // init code
2439 UI.ready(function(context) {
2440
2441 UI.$("[data-uk-grid-match]", context).each(function() {
2442 var grid = UI.$(this), obj;
2443
2444 if (!grid.data("gridMatchHeight")) {
2445 obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
2446 }
2447 });
2448 });
2449 },
2450
2451 init: function() {
2452
2453 var $this = this;
2454
2455 this.columns = this.element.children();
2456 this.elements = this.options.target ? this.find(this.options.target) : this.columns;
2457
2458 if (!this.columns.length) return;
2459
2460 UI.$win.on('load resize orientationchange', (function() {
2461
2462 var fn = function() {
2463 if ($this.element.is(":visible")) $this.match();
2464 };
2465
2466 UI.$(function() { fn(); });
2467
2468 return UI.Utils.debounce(fn, 50);
2469 })());
2470
2471 if (this.options.observe) {
2472
2473 UI.domObserve(this.element, function(e) {
2474 if ($this.element.is(":visible")) $this.match();
2475 });
2476 }
2477
2478 this.on("display.uk.check", function(e) {
2479 if(this.element.is(":visible")) this.match();
2480 }.bind(this));
2481
2482 grids.push(this);
2483 },
2484
2485 match: function() {
2486
2487 var firstvisible = this.columns.filter(":visible:first");
2488
2489 if (!firstvisible.length) return;
2490
2491 var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
2492
2493 if (stacked && !this.options.ignorestacked) {
2494 this.revert();
2495 } else {
2496 UI.Utils.matchHeights(this.elements, this.options);
2497 }
2498
2499 return this;
2500 },
2501
2502 revert: function() {
2503 this.elements.css('min-height', '');
2504 return this;
2505 }
2506 });
2507
2508 UI.component('gridMargin', {
2509
2510 defaults: {
2511 cls : 'uk-grid-margin',
2512 rowfirst : 'uk-row-first'
2513 },
2514
2515 boot: function() {
2516
2517 // init code
2518 UI.ready(function(context) {
2519
2520 UI.$("[data-uk-grid-margin]", context).each(function() {
2521 var grid = UI.$(this), obj;
2522
2523 if (!grid.data("gridMargin")) {
2524 obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
2525 }
2526 });
2527 });
2528 },
2529
2530 init: function() {
2531
2532 var stackMargin = UI.stackMargin(this.element, this.options);
2533 }
2534 });
2535
2536})(UIkit);
2537
2538(function(UI) {
2539
2540 "use strict";
2541
2542 var active = false, activeCount = 0, $html = UI.$html, body;
2543
2544 UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
2545 UI.$('.uk-modal.uk-open').each(function(){
2546 UI.$(this).data('modal').resize();
2547 });
2548 }, 150));
2549
2550 UI.component('modal', {
2551
2552 defaults: {
2553 keyboard: true,
2554 bgclose: true,
2555 minScrollHeight: 150,
2556 center: false,
2557 modal: true
2558 },
2559
2560 scrollable: false,
2561 transition: false,
2562 hasTransitioned: true,
2563
2564 init: function() {
2565
2566 if (!body) body = UI.$('body');
2567
2568 if (!this.element.length) return;
2569
2570 var $this = this;
2571
2572 this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
2573 this.dialog = this.find(".uk-modal-dialog");
2574
2575 this.active = false;
2576
2577 // Update ARIA
2578 this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
2579
2580 this.on("click", ".uk-modal-close", function(e) {
2581 e.preventDefault();
2582 $this.hide();
2583 }).on("click", function(e) {
2584
2585 var target = UI.$(e.target);
2586
2587 if (target[0] == $this.element[0] && $this.options.bgclose) {
2588 $this.hide();
2589 }
2590 });
2591
2592 UI.domObserve(this.element, function(e) { $this.resize(); });
2593 },
2594
2595 toggle: function() {
2596 return this[this.isActive() ? "hide" : "show"]();
2597 },
2598
2599 show: function() {
2600
2601 if (!this.element.length) return;
2602
2603 var $this = this;
2604
2605 if (this.isActive()) return;
2606
2607 if (this.options.modal && active) {
2608 active.hide(true);
2609 }
2610
2611 this.element.removeClass("uk-open").show();
2612 this.resize(true);
2613
2614 if (this.options.modal) {
2615 active = this;
2616 }
2617
2618 this.active = true;
2619
2620 activeCount++;
2621
2622 if (UI.support.transition) {
2623 this.hasTransitioned = false;
2624 this.element.one(UI.support.transition.end, function(){
2625 $this.hasTransitioned = true;
2626 }).addClass("uk-open");
2627 } else {
2628 this.element.addClass("uk-open");
2629 }
2630
2631 $html.addClass("uk-modal-page").height(); // force browser engine redraw
2632
2633 // Update ARIA
2634 this.element.attr('aria-hidden', 'false');
2635
2636 this.element.trigger("show.uk.modal");
2637
2638 UI.Utils.checkDisplay(this.dialog, true);
2639
2640 return this;
2641 },
2642
2643 hide: function(force) {
2644
2645 if (!force && UI.support.transition && this.hasTransitioned) {
2646
2647 var $this = this;
2648
2649 this.one(UI.support.transition.end, function() {
2650 $this._hide();
2651 }).removeClass("uk-open");
2652
2653 } else {
2654
2655 this._hide();
2656 }
2657
2658 return this;
2659 },
2660
2661 resize: function(force) {
2662
2663 if (!this.isActive() && !force) return;
2664
2665 var bodywidth = body.width();
2666
2667 this.scrollbarwidth = window.innerWidth - bodywidth;
2668
2669 body.css(this.paddingdir, this.scrollbarwidth);
2670
2671 this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
2672
2673 if (!this.updateScrollable() && this.options.center) {
2674
2675 var dh = this.dialog.outerHeight(),
2676 pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
2677
2678 if ((dh + pad) < window.innerHeight) {
2679 this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
2680 } else {
2681 this.dialog.css({'top': ''});
2682 }
2683 }
2684 },
2685
2686 updateScrollable: function() {
2687
2688 // has scrollable?
2689 var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
2690
2691 if (scrollable.length) {
2692
2693 scrollable.css('height', 0);
2694
2695 var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)),
2696 dh = this.dialog.outerHeight(),
2697 wh = window.innerHeight,
2698 h = wh - 2*(offset < 20 ? 20:offset) - dh;
2699
2700 scrollable.css({
2701 'max-height': (h < this.options.minScrollHeight ? '':h),
2702 'height':''
2703 });
2704
2705 return true;
2706 }
2707
2708 return false;
2709 },
2710
2711 _hide: function() {
2712
2713 this.active = false;
2714 if (activeCount > 0) activeCount--;
2715 else activeCount = 0;
2716
2717 this.element.hide().removeClass('uk-open');
2718
2719 // Update ARIA
2720 this.element.attr('aria-hidden', 'true');
2721
2722 if (!activeCount) {
2723 $html.removeClass('uk-modal-page');
2724 body.css(this.paddingdir, "");
2725 }
2726
2727 if (active===this) active = false;
2728
2729 this.trigger('hide.uk.modal');
2730 },
2731
2732 isActive: function() {
2733 return this.element.hasClass('uk-open');
2734 }
2735
2736 });
2737
2738 UI.component('modalTrigger', {
2739
2740 boot: function() {
2741
2742 // init code
2743 UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
2744
2745 var ele = UI.$(this);
2746
2747 if (ele.is("a")) {
2748 e.preventDefault();
2749 }
2750
2751 if (!ele.data("modalTrigger")) {
2752 var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
2753 modal.show();
2754 }
2755
2756 });
2757
2758 // close modal on esc button
2759 UI.$html.on('keydown.modal.uikit', function (e) {
2760
2761 if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
2762 e.preventDefault();
2763 active.hide();
2764 }
2765 });
2766 },
2767
2768 init: function() {
2769
2770 var $this = this;
2771
2772 this.options = UI.$.extend({
2773 "target": $this.element.is("a") ? $this.element.attr("href") : false
2774 }, this.options);
2775
2776 this.modal = UI.modal(this.options.target, this.options);
2777
2778 this.on("click", function(e) {
2779 e.preventDefault();
2780 $this.show();
2781 });
2782
2783 //methods
2784 this.proxy(this.modal, "show hide isActive");
2785 }
2786 });
2787
2788 UI.modal.dialog = function(content, options) {
2789
2790 var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
2791
2792 modal.on("hide.uk.modal", function(){
2793 if (modal.persist) {
2794 modal.persist.appendTo(modal.persist.data("modalPersistParent"));
2795 modal.persist = false;
2796 }
2797 modal.element.remove();
2798 });
2799
2800 setContent(content, modal);
2801
2802 return modal;
2803 };
2804
2805 UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
2806
2807 UI.modal.alert = function(content, options) {
2808
2809 options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2810
2811 var modal = UI.modal.dialog(([
2812 '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2813 '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
2814 ]).join(""), options);
2815
2816 modal.on('show.uk.modal', function(){
2817 setTimeout(function(){
2818 modal.element.find('button:first').focus();
2819 }, 50);
2820 });
2821
2822 return modal.show();
2823 };
2824
2825 UI.modal.confirm = function(content, onconfirm, oncancel) {
2826
2827 var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {};
2828
2829 onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
2830 oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){};
2831 options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options);
2832
2833 var modal = UI.modal.dialog(([
2834 '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
2835 '<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>'
2836 ]).join(""), options);
2837
2838 modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){
2839 UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel();
2840 modal.hide();
2841 });
2842
2843 modal.on('show.uk.modal', function(){
2844 setTimeout(function(){
2845 modal.element.find('.js-modal-confirm').focus();
2846 }, 50);
2847 });
2848
2849 return modal.show();
2850 };
2851
2852 UI.modal.prompt = function(text, value, onsubmit, options) {
2853
2854 onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
2855 options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
2856
2857 var modal = UI.modal.dialog(([
2858 text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
2859 '<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
2860 '<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>'
2861 ]).join(""), options),
2862
2863 input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
2864 if (e.keyCode == 13) {
2865 modal.element.find(".js-modal-ok").trigger('click');
2866 }
2867 });
2868
2869 modal.element.find(".js-modal-ok").on("click", function(){
2870 if (onsubmit(input.val())!==false){
2871 modal.hide();
2872 }
2873 });
2874
2875 modal.on('show.uk.modal', function(){
2876 setTimeout(function(){
2877 input.focus();
2878 }, 50);
2879 });
2880
2881 return modal.show();
2882 };
2883
2884 UI.modal.blockUI = function(content, options) {
2885
2886 var modal = UI.modal.dialog(([
2887 '<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
2888 ]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
2889
2890 modal.content = modal.element.find('.uk-modal-content:first');
2891
2892 return modal.show();
2893 };
2894
2895
2896 UI.modal.labels = {
2897 'Ok': 'Ok',
2898 'Cancel': 'Cancel'
2899 };
2900
2901
2902 // helper functions
2903 function setContent(content, modal){
2904
2905 if(!modal) return;
2906
2907 if (typeof content === 'object') {
2908
2909 // convert DOM object to a jQuery object
2910 content = content instanceof jQuery ? content : UI.$(content);
2911
2912 if(content.parent().length) {
2913 modal.persist = content;
2914 modal.persist.data("modalPersistParent", content.parent());
2915 }
2916 }else if (typeof content === 'string' || typeof content === 'number') {
2917 // just insert the data as innerHTML
2918 content = UI.$('<div></div>').html(content);
2919 }else {
2920 // unsupported data type!
2921 content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
2922 }
2923
2924 content.appendTo(modal.element.find('.uk-modal-dialog'));
2925
2926 return modal;
2927 }
2928
2929})(UIkit);
2930
2931(function(UI) {
2932
2933 "use strict";
2934
2935 UI.component('nav', {
2936
2937 defaults: {
2938 "toggle": ">li.uk-parent > a[href='#']",
2939 "lists": ">li.uk-parent > ul",
2940 "multiple": false
2941 },
2942
2943 boot: function() {
2944
2945 // init code
2946 UI.ready(function(context) {
2947
2948 UI.$("[data-uk-nav]", context).each(function() {
2949 var nav = UI.$(this);
2950
2951 if (!nav.data("nav")) {
2952 var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
2953 }
2954 });
2955 });
2956 },
2957
2958 init: function() {
2959
2960 var $this = this;
2961
2962 this.on("click.uk.nav", this.options.toggle, function(e) {
2963 e.preventDefault();
2964 var ele = UI.$(this);
2965 $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
2966 });
2967
2968 this.find(this.options.lists).each(function() {
2969 var $ele = UI.$(this),
2970 parent = $ele.parent(),
2971 active = parent.hasClass("uk-active");
2972
2973 $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
2974 parent.data("list-container", $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
2975
2976 // Init ARIA
2977 parent.attr('aria-expanded', parent.hasClass("uk-open"));
2978
2979 if (active) $this.open(parent, true);
2980 });
2981
2982 },
2983
2984 open: function(li, noanimation) {
2985
2986 var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container');
2987
2988 if (!this.options.multiple) {
2989
2990 element.children('.uk-open').not(li).each(function() {
2991
2992 var ele = UI.$(this);
2993
2994 if (ele.data('list-container')) {
2995 ele.data('list-container').stop().animate({height: 0}, function() {
2996 UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden');
2997 });
2998 }
2999 });
3000 }
3001
3002 $li.toggleClass('uk-open');
3003
3004 // Update ARIA
3005 $li.attr('aria-expanded', $li.hasClass('uk-open'));
3006
3007 if ($container) {
3008
3009 if ($li.hasClass('uk-open')) {
3010 $container.removeClass('uk-hidden');
3011 }
3012
3013 if (noanimation) {
3014
3015 $container.stop().height($li.hasClass('uk-open') ? 'auto' : 0);
3016
3017 if (!$li.hasClass('uk-open')) {
3018 $container.addClass('uk-hidden');
3019 }
3020
3021 this.trigger('display.uk.check');
3022
3023 } else {
3024
3025 $container.stop().animate({
3026 height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0)
3027 }, function() {
3028
3029 if (!$li.hasClass('uk-open')) {
3030 $container.addClass('uk-hidden');
3031 } else {
3032 $container.css('height', '');
3033 }
3034
3035 $this.trigger('display.uk.check');
3036 });
3037 }
3038 }
3039 }
3040 });
3041
3042
3043 // helper
3044
3045 function getHeight(ele) {
3046 var $ele = UI.$(ele), height = "auto";
3047
3048 if ($ele.is(":visible")) {
3049 height = $ele.outerHeight();
3050 } else {
3051 var tmp = {
3052 position: $ele.css("position"),
3053 visibility: $ele.css("visibility"),
3054 display: $ele.css("display")
3055 };
3056
3057 height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
3058
3059 $ele.css(tmp); // reset element
3060 }
3061
3062 return height;
3063 }
3064
3065})(UIkit);
3066
3067(function(UI) {
3068
3069 "use strict";
3070
3071 var scrollpos = {x: window.scrollX, y: window.scrollY},
3072 $win = UI.$win,
3073 $doc = UI.$doc,
3074 $html = UI.$html,
3075 Offcanvas = {
3076
3077 show: function(element) {
3078
3079 element = UI.$(element);
3080
3081 if (!element.length) return;
3082
3083 var $body = UI.$('body'),
3084 bar = element.find(".uk-offcanvas-bar:first"),
3085 rtl = (UI.langdirection == "right"),
3086 flip = bar.hasClass("uk-offcanvas-bar-flip") ? -1:1,
3087 dir = flip * (rtl ? -1 : 1),
3088
3089 scrollbarwidth = window.innerWidth - $body.width();
3090
3091 scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
3092
3093 element.addClass("uk-active");
3094
3095 $body.css({"width": window.innerWidth - scrollbarwidth, "height": window.innerHeight}).addClass("uk-offcanvas-page");
3096 $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir)).width(); // .width() - force redraw
3097
3098 $html.css('margin-top', scrollpos.y * -1);
3099
3100 bar.addClass("uk-offcanvas-bar-show");
3101
3102 this._initElement(element);
3103
3104 bar.trigger('show.uk.offcanvas', [element, bar]);
3105
3106 // Update ARIA
3107 element.attr('aria-hidden', 'false');
3108 },
3109
3110 hide: function(force) {
3111
3112 var $body = UI.$('body'),
3113 panel = UI.$(".uk-offcanvas.uk-active"),
3114 rtl = (UI.langdirection == "right"),
3115 bar = panel.find(".uk-offcanvas-bar:first"),
3116 finalize = function() {
3117 $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
3118 panel.removeClass("uk-active");
3119
3120 bar.removeClass("uk-offcanvas-bar-show");
3121 $html.css('margin-top', '');
3122 window.scrollTo(scrollpos.x, scrollpos.y);
3123 bar.trigger('hide.uk.offcanvas', [panel, bar]);
3124
3125 // Update ARIA
3126 panel.attr('aria-hidden', 'true');
3127 };
3128
3129 if (!panel.length) return;
3130
3131 if (UI.support.transition && !force) {
3132
3133 $body.one(UI.support.transition.end, function() {
3134 finalize();
3135 }).css((rtl ? "margin-right" : "margin-left"), "");
3136
3137 setTimeout(function(){
3138 bar.removeClass("uk-offcanvas-bar-show");
3139 }, 0);
3140
3141 } else {
3142 finalize();
3143 }
3144 },
3145
3146 _initElement: function(element) {
3147
3148 if (element.data("OffcanvasInit")) return;
3149
3150 element.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas", function(e) {
3151
3152 var target = UI.$(e.target);
3153
3154 if (!e.type.match(/swipe/)) {
3155
3156 if (!target.hasClass("uk-offcanvas-close")) {
3157 if (target.hasClass("uk-offcanvas-bar")) return;
3158 if (target.parents(".uk-offcanvas-bar:first").length) return;
3159 }
3160 }
3161
3162 e.stopImmediatePropagation();
3163 Offcanvas.hide();
3164 });
3165
3166 element.on("click", "a[href*='#']", function(e){
3167
3168 var link = UI.$(this),
3169 href = link.attr("href");
3170
3171 if (href == "#") {
3172 return;
3173 }
3174
3175 UI.$doc.one('hide.uk.offcanvas', function() {
3176
3177 var target;
3178
3179 try {
3180 target = UI.$(link[0].hash);
3181 } catch (e){
3182 target = '';
3183 }
3184
3185 if (!target.length) {
3186 target = UI.$('[name="'+link[0].hash.replace('#','')+'"]');
3187 }
3188
3189 if (target.length && UI.Utils.scrollToElement) {
3190 UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
3191 } else {
3192 window.location.href = href;
3193 }
3194 });
3195
3196 Offcanvas.hide();
3197 });
3198
3199 element.data("OffcanvasInit", true);
3200 }
3201 };
3202
3203 UI.component('offcanvasTrigger', {
3204
3205 boot: function() {
3206
3207 // init code
3208 $html.on("click.offcanvas.uikit", "[data-uk-offcanvas]", function(e) {
3209
3210 e.preventDefault();
3211
3212 var ele = UI.$(this);
3213
3214 if (!ele.data("offcanvasTrigger")) {
3215 var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr("data-uk-offcanvas")));
3216 ele.trigger("click");
3217 }
3218 });
3219
3220 $html.on('keydown.uk.offcanvas', function(e) {
3221
3222 if (e.keyCode === 27) { // ESC
3223 Offcanvas.hide();
3224 }
3225 });
3226 },
3227
3228 init: function() {
3229
3230 var $this = this;
3231
3232 this.options = UI.$.extend({
3233 "target": $this.element.is("a") ? $this.element.attr("href") : false
3234 }, this.options);
3235
3236 this.on("click", function(e) {
3237 e.preventDefault();
3238 Offcanvas.show($this.options.target);
3239 });
3240 }
3241 });
3242
3243 UI.offcanvas = Offcanvas;
3244
3245})(UIkit);
3246
3247(function(UI) {
3248
3249 "use strict";
3250
3251 var Animations;
3252
3253 UI.component('switcher', {
3254
3255 defaults: {
3256 connect : false,
3257 toggle : ">*",
3258 active : 0,
3259 animation : false,
3260 duration : 200,
3261 swiping : true
3262 },
3263
3264 animating: false,
3265
3266 boot: function() {
3267
3268 // init code
3269 UI.ready(function(context) {
3270
3271 UI.$("[data-uk-switcher]", context).each(function() {
3272 var switcher = UI.$(this);
3273
3274 if (!switcher.data("switcher")) {
3275 var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
3276 }
3277 });
3278 });
3279 },
3280
3281 init: function() {
3282
3283 var $this = this;
3284
3285 this.on("click.uk.switcher", this.options.toggle, function(e) {
3286 e.preventDefault();
3287 $this.show(this);
3288 });
3289
3290 if (this.options.connect) {
3291
3292 this.connect = UI.$(this.options.connect);
3293
3294 this.connect.children().removeClass("uk-active");
3295
3296 // delegate switch commands within container content
3297 if (this.connect.length) {
3298
3299 // Init ARIA for connect
3300 this.connect.children().attr('aria-hidden', 'true');
3301
3302 this.connect.on("click", '[data-uk-switcher-item]', function(e) {
3303
3304 e.preventDefault();
3305
3306 var item = UI.$(this).attr('data-uk-switcher-item');
3307
3308 if ($this.index == item) return;
3309
3310 switch(item) {
3311 case 'next':
3312 case 'previous':
3313 $this.show($this.index + (item=='next' ? 1:-1));
3314 break;
3315 default:
3316 $this.show(parseInt(item, 10));
3317 }
3318 });
3319
3320 if (this.options.swiping) {
3321
3322 this.connect.on('swipeRight swipeLeft', function(e) {
3323 e.preventDefault();
3324 if(!window.getSelection().toString()) {
3325 $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
3326 }
3327 });
3328 }
3329 }
3330
3331 var toggles = this.find(this.options.toggle),
3332 active = toggles.filter(".uk-active");
3333
3334 if (active.length) {
3335 this.show(active, false);
3336 } else {
3337
3338 if (this.options.active===false) return;
3339
3340 active = toggles.eq(this.options.active);
3341 this.show(active.length ? active : toggles.eq(0), false);
3342 }
3343
3344 // Init ARIA for toggles
3345 toggles.not(active).attr('aria-expanded', 'false');
3346 active.attr('aria-expanded', 'true');
3347 }
3348
3349 },
3350
3351 show: function(tab, animate) {
3352
3353 if (this.animating) {
3354 return;
3355 }
3356
3357 if (isNaN(tab)) {
3358 tab = UI.$(tab);
3359 } else {
3360
3361 var toggles = this.find(this.options.toggle);
3362
3363 tab = tab < 0 ? toggles.length-1 : tab;
3364 tab = toggles.eq(toggles[tab] ? tab : 0);
3365 }
3366
3367 var $this = this,
3368 toggles = this.find(this.options.toggle),
3369 active = UI.$(tab),
3370 animation = Animations[this.options.animation] || function(current, next) {
3371
3372 if (!$this.options.animation) {
3373 return Animations.none.apply($this);
3374 }
3375
3376 var anim = $this.options.animation.split(',');
3377
3378 if (anim.length == 1) {
3379 anim[1] = anim[0];
3380 }
3381
3382 anim[0] = anim[0].trim();
3383 anim[1] = anim[1].trim();
3384
3385 return coreAnimation.apply($this, [anim, current, next]);
3386 };
3387
3388 if (animate===false || !UI.support.animation) {
3389 animation = Animations.none;
3390 }
3391
3392 if (active.hasClass("uk-disabled")) return;
3393
3394 // Update ARIA for Toggles
3395 toggles.attr('aria-expanded', 'false');
3396 active.attr('aria-expanded', 'true');
3397
3398 toggles.filter(".uk-active").removeClass("uk-active");
3399 active.addClass("uk-active");
3400
3401 if (this.options.connect && this.connect.length) {
3402
3403 this.index = this.find(this.options.toggle).index(active);
3404
3405 if (this.index == -1 ) {
3406 this.index = 0;
3407 }
3408
3409 this.connect.each(function() {
3410
3411 var container = UI.$(this),
3412 children = UI.$(container.children()),
3413 current = UI.$(children.filter('.uk-active')),
3414 next = UI.$(children.eq($this.index));
3415
3416 $this.animating = true;
3417
3418 animation.apply($this, [current, next]).then(function(){
3419
3420 current.removeClass("uk-active");
3421 next.addClass("uk-active");
3422
3423 // Update ARIA for connect
3424 current.attr('aria-hidden', 'true');
3425 next.attr('aria-hidden', 'false');
3426
3427 UI.Utils.checkDisplay(next, true);
3428
3429 $this.animating = false;
3430
3431 });
3432 });
3433 }
3434
3435 this.trigger("show.uk.switcher", [active]);
3436 }
3437 });
3438
3439 Animations = {
3440
3441 'none': function() {
3442 var d = UI.$.Deferred();
3443 d.resolve();
3444 return d.promise();
3445 },
3446
3447 'fade': function(current, next) {
3448 return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
3449 },
3450
3451 'slide-bottom': function(current, next) {
3452 return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
3453 },
3454
3455 'slide-top': function(current, next) {
3456 return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
3457 },
3458
3459 'slide-vertical': function(current, next, dir) {
3460
3461 var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
3462
3463 if (current && current.index() > next.index()) {
3464 anim.reverse();
3465 }
3466
3467 return coreAnimation.apply(this, [anim, current, next]);
3468 },
3469
3470 'slide-left': function(current, next) {
3471 return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
3472 },
3473
3474 'slide-right': function(current, next) {
3475 return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
3476 },
3477
3478 'slide-horizontal': function(current, next, dir) {
3479
3480 var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
3481
3482 if (current && current.index() > next.index()) {
3483 anim.reverse();
3484 }
3485
3486 return coreAnimation.apply(this, [anim, current, next]);
3487 },
3488
3489 'scale': function(current, next) {
3490 return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
3491 }
3492 };
3493
3494 UI.switcher.animations = Animations;
3495
3496
3497 // helpers
3498
3499 function coreAnimation(cls, current, next) {
3500
3501 var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
3502
3503 if (next[0]===current[0]) {
3504 d.resolve();
3505 return d.promise();
3506 }
3507
3508 if (typeof(cls) == 'object') {
3509 clsIn = cls[0];
3510 clsOut = cls[1] || cls[0];
3511 }
3512
3513 UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS
3514
3515 release = function() {
3516
3517 if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
3518
3519 next.addClass(clsIn).one(UI.support.animation.end, function() {
3520
3521 setTimeout(function () {
3522 next.removeClass(''+clsIn+'').css({opacity:'', display:''});
3523 }, 0);
3524
3525 d.resolve();
3526
3527 UI.$body.css('overflow-x', '');
3528
3529 if (current) current.css({opacity:'', display:''});
3530
3531 }.bind(this)).show();
3532 };
3533
3534 next.css('animation-duration', this.options.duration+'ms');
3535
3536 if (current && current.length) {
3537
3538 current.css('animation-duration', this.options.duration+'ms');
3539
3540 current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
3541 release();
3542 }.bind(this)).css('display', '');
3543
3544 } else {
3545 next.addClass('uk-active');
3546 release();
3547 }
3548
3549 return d.promise();
3550 }
3551
3552})(UIkit);
3553
3554(function(UI) {
3555
3556 "use strict";
3557
3558 UI.component('tab', {
3559
3560 defaults: {
3561 'target' : '>li:not(.uk-tab-responsive, .uk-disabled)',
3562 'connect' : false,
3563 'active' : 0,
3564 'animation' : false,
3565 'duration' : 200,
3566 'swiping' : true
3567 },
3568
3569 boot: function() {
3570
3571 // init code
3572 UI.ready(function(context) {
3573
3574 UI.$("[data-uk-tab]", context).each(function() {
3575
3576 var tab = UI.$(this);
3577
3578 if (!tab.data("tab")) {
3579 var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
3580 }
3581 });
3582 });
3583 },
3584
3585 init: function() {
3586
3587 var $this = this;
3588
3589 this.current = false;
3590
3591 this.on("click.uk.tab", this.options.target, function(e) {
3592
3593 e.preventDefault();
3594
3595 if ($this.switcher && $this.switcher.animating) {
3596 return;
3597 }
3598
3599 var current = $this.find($this.options.target).not(this);
3600
3601 current.removeClass("uk-active").blur();
3602
3603 $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
3604
3605 $this.current = UI.$(this);
3606
3607 // Update ARIA
3608 if (!$this.options.connect) {
3609 current.attr('aria-expanded', 'false');
3610 UI.$(this).attr('aria-expanded', 'true');
3611 }
3612 });
3613
3614 if (this.options.connect) {
3615 this.connect = UI.$(this.options.connect);
3616 }
3617
3618 // init responsive tab
3619 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>');
3620
3621 this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
3622 this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
3623 this.responsivetab.caption = this.responsivetab.find('a:first');
3624
3625 if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
3626
3627 // handle click
3628 this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
3629
3630 e.preventDefault();
3631 e.stopPropagation();
3632
3633 var link = UI.$(this);
3634
3635 $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
3636 });
3637
3638 this.on('show.uk.switcher change.uk.tab', function(e, tab) {
3639 $this.responsivetab.caption.html(tab.text());
3640 });
3641
3642 this.element.append(this.responsivetab);
3643
3644 // init UIkit components
3645 if (this.options.connect) {
3646 this.switcher = UI.switcher(this.element, {
3647 'toggle' : '>li:not(.uk-tab-responsive)',
3648 'connect' : this.options.connect,
3649 'active' : this.options.active,
3650 'animation' : this.options.animation,
3651 'duration' : this.options.duration,
3652 'swiping' : this.options.swiping
3653 });
3654 }
3655
3656 UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"});
3657
3658 // init
3659 $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
3660
3661 this.check();
3662
3663 UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
3664 if ($this.element.is(":visible")) $this.check();
3665 }, 100));
3666
3667 this.on('display.uk.check', function(){
3668 if ($this.element.is(":visible")) $this.check();
3669 });
3670 },
3671
3672 check: function() {
3673
3674 var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
3675
3676 if (!children.length) {
3677 this.responsivetab.addClass('uk-hidden');
3678 return;
3679 }
3680
3681 var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
3682 doresponsive = false,
3683 item, link, clone;
3684
3685 this.responsivetab.lst.empty();
3686
3687 children.each(function(){
3688
3689 if (UI.$(this).offset().top > top) {
3690 doresponsive = true;
3691 }
3692 });
3693
3694 if (doresponsive) {
3695
3696 for (var i = 0; i < children.length; i++) {
3697
3698 item = UI.$(children.eq(i));
3699 link = item.find('a');
3700
3701 if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
3702
3703 if (!item.hasClass('uk-disabled')) {
3704
3705 clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" ');
3706
3707 this.responsivetab.lst.append(clone);
3708 }
3709
3710 item.addClass('uk-hidden');
3711 }
3712 }
3713 }
3714
3715 this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
3716 }
3717 });
3718
3719})(UIkit);
3720
3721(function(UI){
3722
3723 "use strict";
3724
3725 UI.component('cover', {
3726
3727 defaults: {
3728 automute : true
3729 },
3730
3731 boot: function() {
3732
3733 // auto init
3734 UI.ready(function(context) {
3735
3736 UI.$("[data-uk-cover]", context).each(function(){
3737
3738 var ele = UI.$(this);
3739
3740 if(!ele.data("cover")) {
3741 var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
3742 }
3743 });
3744 });
3745 },
3746
3747 init: function() {
3748
3749 this.parent = this.element.parent();
3750
3751 UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
3752 this.check();
3753 }.bind(this), 100));
3754
3755 this.on("display.uk.check", function(e) {
3756 if(this.element.is(":visible")) this.check();
3757 }.bind(this));
3758
3759 this.check();
3760
3761 if (this.element.is('iframe') && this.options.automute) {
3762
3763 var src = this.element.attr('src');
3764
3765 this.element.attr('src', '').on('load', function(){
3766
3767 this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
3768
3769 }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
3770 }
3771 },
3772
3773 check: function() {
3774
3775 this.element.css({
3776 'width' : '',
3777 'height' : ''
3778 });
3779
3780 this.dimension = {w: this.element.width(), h: this.element.height()};
3781
3782 if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
3783 this.dimension.w = this.element.attr('width');
3784 }
3785
3786 if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
3787 this.dimension.h = this.element.attr('height');
3788 }
3789
3790 this.ratio = this.dimension.w / this.dimension.h;
3791
3792 var w = this.parent.width(), h = this.parent.height(), width, height;
3793
3794 // if element height < parent height (gap underneath)
3795 if ((w / this.ratio) < h) {
3796
3797 width = Math.ceil(h * this.ratio);
3798 height = h;
3799
3800 // element width < parent width (gap to right)
3801 } else {
3802
3803 width = w;
3804 height = Math.ceil(w / this.ratio);
3805 }
3806
3807 this.element.css({
3808 'width' : width,
3809 'height' : height
3810 });
3811 }
3812 });
3813
3814})(UIkit);
diff --git a/js/uikit.min.js b/js/uikit.min.js
new file mode 100755
index 0000000..ce54d56
--- /dev/null
+++ b/js/uikit.min.js
@@ -0,0 +1,3 @@
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 i=window.UIkit||t(window,window.jQuery,window.document);return i.load=function(t,e,n,o){var s,a=t.split(","),r=[],l=(o.config&&o.config.uikit&&o.config.uikit.base?o.config.uikit.base:"").replace(/\/+$/g,"");if(!l)throw new Error("Please define base path to UIkit in the requirejs config.");for(s=0;s<a.length;s+=1){var c=a[s].replace(/\./g,"/");r.push(l+"/components/"+c)}e(r,function(){n(i)})},i}),!window.jQuery)throw new Error("UIkit requires jQuery");window&&window.jQuery&&t(window,window.jQuery,window.document)}(function(t,i,e){"use strict";var n={},o=t.UIkit?Object.create(t.UIkit):void 0;if(n.version="2.26.4",n.noConflict=function(){return o&&(t.UIkit=o,i.UIkit=o,i.fn.uk=o.fn),n},n.prefix=function(t){return t},n.$=i,n.$doc=n.$(document),n.$win=n.$(window),n.$html=n.$("html"),n.support={},n.support.transition=function(){var t=function(){var t,i=e.body||e.documentElement,n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(t in n)if(void 0!==i.style[t])return n[t]}();return t&&{end:t}}(),n.support.animation=function(){var t=function(){var t,i=e.body||e.documentElement,n={WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(t in n)if(void 0!==i.style[t])return n[t]}();return t&&{end:t}}(),function(){Date.now=Date.now||function(){return(new Date).getTime()};for(var t=["webkit","moz"],i=0;i<t.length&&!window.requestAnimationFrame;++i){var e=t[i];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 n=0;window.requestAnimationFrame=function(t){var i=Date.now(),e=Math.max(n+16,i);return setTimeout(function(){t(n=e)},e-i)},window.cancelAnimationFrame=clearTimeout}}(),n.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,n.support.mutationobserver=t.MutationObserver||t.WebKitMutationObserver||null,n.Utils={},n.Utils.isFullscreen=function(){return document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.fullscreenElement||!1},n.Utils.str2json=function(t,i){try{return i?JSON.parse(t.replace(/([\$\w]+)\s*:/g,function(t,i){return'"'+i+'":'}).replace(/'([^']+)'/g,function(t,i){return'"'+i+'"'})):new Function("","var json = "+t+"; return JSON.parse(JSON.stringify(json));")()}catch(e){return!1}},n.Utils.debounce=function(t,i,e){var n;return function(){var o=this,s=arguments,a=function(){n=null,e||t.apply(o,s)},r=e&&!n;clearTimeout(n),n=setTimeout(a,i),r&&t.apply(o,s)}},n.Utils.throttle=function(t,i){var e=!1;return function(){e||(t.call(),e=!0,setTimeout(function(){e=!1},i))}},n.Utils.removeCssRules=function(t){var i,e,n,o,s,a,r,l,c,u;t&&setTimeout(function(){try{for(u=document.styleSheets,o=0,r=u.length;r>o;o++){for(n=u[o],e=[],n.cssRules=n.cssRules,i=s=0,l=n.cssRules.length;l>s;i=++s)n.cssRules[i].type===CSSRule.STYLE_RULE&&t.test(n.cssRules[i].selectorText)&&e.unshift(i);for(a=0,c=e.length;c>a;a++)n.deleteRule(e[a])}}catch(h){}},0)},n.Utils.isInView=function(t,e){var o=i(t);if(!o.is(":visible"))return!1;var s=n.$win.scrollLeft(),a=n.$win.scrollTop(),r=o.offset(),l=r.left,c=r.top;return e=i.extend({topoffset:0,leftoffset:0},e),c+o.height()>=a&&c-e.topoffset<=a+n.$win.height()&&l+o.width()>=s&&l-e.leftoffset<=s+n.$win.width()?!0:!1},n.Utils.checkDisplay=function(t,e){var o=n.$("[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]",t||document);return t&&!o.length&&(o=i(t)),o.trigger("display.uk.check"),e&&("string"!=typeof e&&(e='[class*="uk-animation-"]'),o.find(e).each(function(){var t=n.$(this),i=t.attr("class"),e=i.match(/uk-animation-(.+)/);t.removeClass(e[0]).width(),t.addClass(e[0])})),o},n.Utils.options=function(t){if("string"!=i.type(t))return t;-1!=t.indexOf(":")&&"}"!=t.trim().substr(-1)&&(t="{"+t+"}");var e=t?t.indexOf("{"):-1,o={};if(-1!=e)try{o=n.Utils.str2json(t.substr(e))}catch(s){}return o},n.Utils.animate=function(t,e){var o=i.Deferred();return t=n.$(t),t.css("display","none").addClass(e).one(n.support.animation.end,function(){t.removeClass(e),o.resolve()}),t.css("display",""),o.promise()},n.Utils.uid=function(t){return(t||"id")+(new Date).getTime()+"RAND"+Math.ceil(1e5*Math.random())},n.Utils.template=function(t,i){for(var e,n,o,s,a=t.replace(/\n/g,"\\n").replace(/\{\{\{\s*(.+?)\s*\}\}\}/g,"{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),r=0,l=[],c=0;r<a.length;){if(e=a[r],e.match(/\{\{\s*(.+?)\s*\}\}/))switch(r+=1,e=a[r],n=e[0],o=e.substring(e.match(/^(\^|\#|\!|\~|\:)/)?1:0),n){case"~":l.push("for(var $i=0;$i<"+o+".length;$i++) { var $item = "+o+"[$i];"),c++;break;case":":l.push("for(var $key in "+o+") { var $val = "+o+"[$key];"),c++;break;case"#":l.push("if("+o+") {"),c++;break;case"^":l.push("if(!"+o+") {"),c++;break;case"/":l.push("}"),c--;break;case"!":l.push("__ret.push("+o+");");break;default:l.push("__ret.push(escape("+o+"));")}else l.push("__ret.push('"+e.replace(/\'/g,"\\'")+"');");r+=1}return s=new Function("$data",["var __ret = [];","try {","with($data){",c?'__ret = ["Not all blocks are closed correctly."]':l.join(""),"};","}catch(e){__ret = [e.message];}",'return __ret.join("").replace(/\\n\\n/g, "\\n");',"function escape(html) { return String(html).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"].join("\n")),i?s(i):s},n.Utils.events={},n.Utils.events.click=n.support.touch?"tap":"click",t.UIkit=n,n.fn=function(t,e){var o=arguments,s=t.match(/^([a-z\-]+)(?:\.([a-z]+))?/i),a=s[1],r=s[2];return n[a]?this.each(function(){var t=i(this),s=t.data(a);s||t.data(a,s=n[a](this,r?void 0:e)),r&&s[r].apply(s,Array.prototype.slice.call(o,1))}):(i.error("UIkit component ["+a+"] does not exist."),this)},i.UIkit=n,i.fn.uk=n.fn,n.langdirection="rtl"==n.$html.attr("dir")?"right":"left",n.components={},n.component=function(t,e){var o=function(e,s){var a=this;return this.UIkit=n,this.element=e?n.$(e):null,this.options=i.extend(!0,{},this.defaults,s),this.plugins={},this.element&&this.element.data(t,this),this.init(),(this.options.plugins.length?this.options.plugins:Object.keys(o.plugins)).forEach(function(t){o.plugins[t].init&&(o.plugins[t].init(a),a.plugins[t]=!0)}),this.trigger("init.uk.component",[t,this]),this};return o.plugins={},i.extend(!0,o.prototype,{defaults:{plugins:[]},boot:function(){},init:function(){},on:function(t,i,e){return n.$(this.element||this).on(t,i,e)},one:function(t,i,e){return n.$(this.element||this).one(t,i,e)},off:function(t){return n.$(this.element||this).off(t)},trigger:function(t,i){return n.$(this.element||this).trigger(t,i)},find:function(t){return n.$(this.element?this.element:[]).find(t)},proxy:function(t,i){var e=this;i.split(" ").forEach(function(i){e[i]||(e[i]=function(){return t[i].apply(t,arguments)})})},mixin:function(t,i){var e=this;i.split(" ").forEach(function(i){e[i]||(e[i]=t[i].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]=o,this[t]=function(){var e,o;if(arguments.length)switch(arguments.length){case 1:"string"==typeof arguments[0]||arguments[0].nodeType||arguments[0]instanceof jQuery?e=i(arguments[0]):o=arguments[0];break;case 2:e=i(arguments[0]),o=arguments[1]}return e&&e.data(t)?e.data(t):new n.components[t](e,o)},n.domready&&n.component.boot(t),o},n.plugin=function(t,i,e){this.components[t].plugins[i]=e},n.component.boot=function(t){n.components[t].prototype&&n.components[t].prototype.boot&&!n.components[t].booted&&(n.components[t].prototype.boot.apply(n,[]),n.components[t].booted=!0)},n.component.bootComponents=function(){for(var t in n.components)n.component.boot(t)},n.domObservers=[],n.domready=!1,n.ready=function(t){n.domObservers.push(t),n.domready&&t(document)},n.on=function(t,i,e){return t&&t.indexOf("ready.uk.dom")>-1&&n.domready&&i.apply(n.$doc),n.$doc.on(t,i,e)},n.one=function(t,i,e){return t&&t.indexOf("ready.uk.dom")>-1&&n.domready?(i.apply(n.$doc),n.$doc):n.$doc.one(t,i,e)},n.trigger=function(t,i){return n.$doc.trigger(t,i)},n.domObserve=function(t,i){n.support.mutationobserver&&(i=i||function(){},n.$(t).each(function(){var t=this,e=n.$(t);if(!e.data("observer"))try{var o=new n.support.mutationobserver(n.Utils.debounce(function(){i.apply(t,[]),e.trigger("changed.uk.dom")},50),{childList:!0,subtree:!0});o.observe(t,{childList:!0,subtree:!0}),e.data("observer",o)}catch(s){}}))},n.init=function(t){t=t||document,n.domObservers.forEach(function(i){i(t)})},n.on("domready.uk.dom",function(){n.init(),n.domready&&n.Utils.checkDisplay()}),document.addEventListener("DOMContentLoaded",function(){var t=function(){n.$body=n.$("body"),n.trigger("beforeready.uk.dom"),n.component.bootComponents();var t=requestAnimationFrame(function(){var i={dir:{x:0,y:0},x:window.pageXOffset,y:window.pageYOffset},e=function(){var o=window.pageXOffset,s=window.pageYOffset;(i.x!=o||i.y!=s)&&(i.dir.x=o!=i.x?o>i.x?1:-1:0,i.dir.y=s!=i.y?s>i.y?1:-1:0,i.x=o,i.y=s,n.$doc.trigger("scrolling.uk.document",[{dir:{x:i.dir.x,y:i.dir.y},x:o,y:s}])),cancelAnimationFrame(t),t=requestAnimationFrame(e)};return n.support.touch&&n.$html.on("touchmove touchend MSPointerMove MSPointerUp pointermove pointerup",e),(i.x||i.y)&&e(),e}());if(n.trigger("domready.uk.dom"),n.support.touch&&navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&n.$win.on("load orientationchange resize",n.Utils.debounce(function(){var t=function(){return i(".uk-height-viewport").css("height",window.innerHeight),t};return t()}(),100)),n.trigger("afterready.uk.dom"),n.domready=!0,n.support.mutationobserver){var e=n.Utils.debounce(function(){requestAnimationFrame(function(){n.init(document.body)})},10);new n.support.mutationobserver(function(t){var i=!1;t.every(function(t){if("childList"!=t.type)return!0;for(var e,n=0;n<t.addedNodes.length;++n)if(e=t.addedNodes[n],e.outerHTML&&-1!==e.outerHTML.indexOf("data-uk-"))return(i=!0)&&!1;return!0}),i&&e()}).observe(document.body,{childList:!0,subtree:!0})}};return("complete"==document.readyState||"interactive"==document.readyState)&&setTimeout(t),t}()),n.$html.addClass(n.support.touch?"uk-touch":"uk-notouch"),n.support.touch){var s,a=!1,r="uk-hover",l=".uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover";n.$html.on("mouseenter touchstart MSPointerDown pointerdown",l,function(){a&&i("."+r).removeClass(r),a=i(this).addClass(r)}).on("mouseleave touchend MSPointerUp pointerup",function(t){s=i(t.target).parents(l),a&&a.not(s).removeClass(r)})}return n}),function(t){function i(t,i,e,n){return Math.abs(t-i)>=Math.abs(e-n)?t-i>0?"Left":"Right":e-n>0?"Up":"Down"}function e(){c=null,h.last&&(void 0!==h.el&&h.el.trigger("longTap"),h={})}function n(){c&&clearTimeout(c),c=null}function o(){a&&clearTimeout(a),r&&clearTimeout(r),l&&clearTimeout(l),c&&clearTimeout(c),a=r=l=c=null,h={}}function s(t){return t.pointerType==t.MSPOINTER_TYPE_TOUCH&&t.isPrimary}if(!t.fn.swipeLeft){var a,r,l,c,u,h={},d=750;t(function(){var p,f,m,g=0,v=0;"MSGesture"in window&&(u=new MSGesture,u.target=document.body),t(document).on("MSGestureEnd gestureend",function(t){var i=t.originalEvent.velocityX>1?"Right":t.originalEvent.velocityX<-1?"Left":t.originalEvent.velocityY>1?"Down":t.originalEvent.velocityY<-1?"Up":null;i&&void 0!==h.el&&(h.el.trigger("swipe"),h.el.trigger("swipe"+i))}).on("touchstart MSPointerDown pointerdown",function(i){("MSPointerDown"!=i.type||s(i.originalEvent))&&(m="MSPointerDown"==i.type||"pointerdown"==i.type?i:i.originalEvent.touches[0],p=Date.now(),f=p-(h.last||p),h.el=t("tagName"in m.target?m.target:m.target.parentNode),a&&clearTimeout(a),h.x1=m.pageX,h.y1=m.pageY,f>0&&250>=f&&(h.isDoubleTap=!0),h.last=p,c=setTimeout(e,d),!u||"MSPointerDown"!=i.type&&"pointerdown"!=i.type&&"touchstart"!=i.type||u.addPointer(i.originalEvent.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){("MSPointerMove"!=t.type||s(t.originalEvent))&&(m="MSPointerMove"==t.type||"pointermove"==t.type?t:t.originalEvent.touches[0],n(),h.x2=m.pageX,h.y2=m.pageY,g+=Math.abs(h.x1-h.x2),v+=Math.abs(h.y1-h.y2))}).on("touchend MSPointerUp pointerup",function(e){("MSPointerUp"!=e.type||s(e.originalEvent))&&(n(),h.x2&&Math.abs(h.x1-h.x2)>30||h.y2&&Math.abs(h.y1-h.y2)>30?l=setTimeout(function(){void 0!==h.el&&(h.el.trigger("swipe"),h.el.trigger("swipe"+i(h.x1,h.x2,h.y1,h.y2))),h={}},0):"last"in h&&(isNaN(g)||30>g&&30>v?r=setTimeout(function(){var i=t.Event("tap");i.cancelTouch=o,void 0!==h.el&&h.el.trigger(i),h.isDoubleTap?(void 0!==h.el&&h.el.trigger("doubleTap"),h={}):a=setTimeout(function(){a=null,void 0!==h.el&&h.el.trigger("singleTap"),h={}},250)},0):h={},g=v=0))}).on("touchcancel MSPointerCancel",o),t(window).on("scroll",o)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(i){t.fn[i]=function(e){return t(this).on(i,e)}})}}(jQuery),function(t){"use strict";var i=[];t.component("stackMargin",{defaults:{cls:"uk-margin-small-top",rowfirst:!1,observe:!1},boot:function(){t.ready(function(i){t.$("[data-uk-margin]",i).each(function(){var i=t.$(this);i.data("stackMargin")||t.stackMargin(i,t.Utils.options(i.attr("data-uk-margin")))})})},init:function(){var e=this;t.$win.on("resize orientationchange",function(){var i=function(){e.process()};return t.$(function(){i(),t.$win.on("load",i)}),t.Utils.debounce(i,20)}()),this.on("display.uk.check",function(){this.element.is(":visible")&&this.process()}.bind(this)),this.options.observe&&t.domObserve(this.element,function(){e.element.is(":visible")&&e.process()}),i.push(this)},process:function(){var i=this.element.children();if(t.Utils.stackMargin(i,this.options),!this.options.rowfirst||!i.length)return this;var e={},n=!1;return i.removeClass(this.options.rowfirst).each(function(i,o){o=t.$(this),"none"!=this.style.display&&(i=o.offset().left,((e[i]=e[i]||[])&&e[i]).push(this),n=n===!1?i:Math.min(n,i))}),t.$(e[n]).addClass(this.options.rowfirst),this}}),function(){var i=[],e=function(t){if(t.is(":visible")){var i=t.parent().width(),e=t.data("width"),n=i/e,o=Math.floor(n*t.data("height"));t.css({height:e>i?o:t.data("height")})}};t.component("responsiveElement",{defaults:{},boot:function(){t.ready(function(i){t.$("iframe.uk-responsive-width, [data-uk-responsive]",i).each(function(){var i,e=t.$(this);e.data("responsiveElement")||(i=t.responsiveElement(e,{}))})})},init:function(){var t=this.element;t.attr("width")&&t.attr("height")&&(t.data({width:t.attr("width"),height:t.attr("height")}).on("display.uk.check",function(){e(t)}),e(t),i.push(t))}}),t.$win.on("resize load",t.Utils.debounce(function(){i.forEach(function(t){e(t)})},15))}(),t.Utils.stackMargin=function(i,e){e=t.$.extend({cls:"uk-margin-small-top"},e),i=t.$(i).removeClass(e.cls);var n=!1;i.each(function(i,e,o,s){s=t.$(this),"none"!=s.css("display")&&(i=s.offset(),e=s.outerHeight(),o=i.top+e,s.data({ukMarginPos:o,ukMarginTop:i.top}),(n===!1||i.top<n.top)&&(n={top:i.top,left:i.left,pos:o}))}).each(function(i){i=t.$(this),"none"!=i.css("display")&&i.data("ukMarginTop")>n.top&&i.data("ukMarginPos")>n.pos&&i.addClass(e.cls)})},t.Utils.matchHeights=function(i,e){i=t.$(i).css("min-height",""),e=t.$.extend({row:!0},e);var n=function(i){if(!(i.length<2)){var e=0;i.each(function(){e=Math.max(e,t.$(this).outerHeight())}).each(function(){var i=t.$(this),n=e-("border-box"==i.css("box-sizing")?0:i.outerHeight()-i.height());i.css("min-height",n+"px")})}};e.row?(i.first().width(),setTimeout(function(){var e=!1,o=[];i.each(function(){var i=t.$(this),s=i.offset().top;s!=e&&o.length&&(n(t.$(o)),o=[],s=i.offset().top),o.push(i),e=s}),o.length&&n(t.$(o))},0)):n(i)},function(i){t.Utils.inlineSvg=function(e,n){t.$(e||'img[src$=".svg"]',n||document).each(function(){var e=t.$(this),n=e.attr("src");if(!i[n]){var o=t.$.Deferred();t.$.get(n,{nc:Math.random()},function(i){o.resolve(t.$(i).find("svg"))}),i[n]=o.promise()}i[n].then(function(i){var n=t.$(i).clone();e.attr("id")&&n.attr("id",e.attr("id")),e.attr("class")&&n.attr("class",e.attr("class")),e.attr("style")&&n.attr("style",e.attr("style")),e.attr("width")&&(n.attr("width",e.attr("width")),e.attr("height")||n.removeAttr("height")),e.attr("height")&&(n.attr("height",e.attr("height")),e.attr("width")||n.removeAttr("width")),e.replaceWith(n)})})},t.ready(function(i){t.Utils.inlineSvg("[data-uk-svg]",i)})}({})}(UIkit),function(t){"use strict";function i(i,e){e=t.$.extend({duration:1e3,transition:"easeOutExpo",offset:0,complete:function(){}},e);var n=i.offset().top-e.offset,o=t.$doc.height(),s=window.innerHeight;n+s>o&&(n=o-s),t.$("html,body").stop().animate({scrollTop:n},e.duration,e.transition).promise().done(e.complete)}t.component("smoothScroll",{boot:function(){t.$html.on("click.smooth-scroll.uikit","[data-uk-smooth-scroll]",function(){var i=t.$(this);if(!i.data("smoothScroll")){{t.smoothScroll(i,t.Utils.options(i.attr("data-uk-smooth-scroll")))}i.trigger("click")}return!1})},init:function(){var e=this;this.on("click",function(n){n.preventDefault(),i(t.$(this.hash).length?t.$(this.hash):t.$("body"),e.options)})}}),t.Utils.scrollToElement=i,t.$.easing.easeOutExpo||(t.$.easing.easeOutExpo=function(t,i,e,n,o){return i==o?e+n:n*(-Math.pow(2,-10*i/o)+1)+e})}(UIkit),function(t){"use strict";var i=t.$win,e=t.$doc,n=[],o=function(){for(var t=0;t<n.length;t++)window.requestAnimationFrame.apply(window,[n[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(){e.on("scrolling.uk.document",o),i.on("load resize orientationchange",t.Utils.debounce(o,50)),t.ready(function(i){t.$("[data-uk-scrollspy]",i).each(function(){var i=t.$(this);if(!i.data("scrollspy")){t.scrollspy(i,t.Utils.options(i.attr("data-uk-scrollspy")))}})})},init:function(){var i,e=this,o=this.options.cls.split(/,/),s=function(){var n=e.options.target?e.element.find(e.options.target):e.element,s=1===n.length?1:0,a=0;n.each(function(){var n=t.$(this),r=n.data("inviewstate"),l=t.Utils.isInView(n,e.options),c=n.data("ukScrollspyCls")||o[a].trim();!l||r||n.data("scrollspy-idle")||(i||(n.addClass(e.options.initcls),e.offset=n.offset(),i=!0,n.trigger("init.uk.scrollspy")),n.data("scrollspy-idle",setTimeout(function(){n.addClass("uk-scrollspy-inview").toggleClass(c).width(),n.trigger("inview.uk.scrollspy"),n.data("scrollspy-idle",!1),n.data("inviewstate",!0)},e.options.delay*s)),s++),!l&&r&&e.options.repeat&&(n.data("scrollspy-idle")&&(clearTimeout(n.data("scrollspy-idle")),n.data("scrollspy-idle",!1)),n.removeClass("uk-scrollspy-inview").toggleClass(c),n.data("inviewstate",!1),n.trigger("outview.uk.scrollspy")),a=o[a+1]?a+1:0})};s(),this.check=s,n.push(this)}});var s=[],a=function(){for(var t=0;t<s.length;t++)window.requestAnimationFrame.apply(window,[s[t].check])};t.component("scrollspynav",{defaults:{cls:"uk-active",closest:!1,topoffset:0,leftoffset:0,smoothscroll:!1},boot:function(){e.on("scrolling.uk.document",a),i.on("resize orientationchange",t.Utils.debounce(a,50)),t.ready(function(i){t.$("[data-uk-scrollspy-nav]",i).each(function(){var i=t.$(this);if(!i.data("scrollspynav")){t.scrollspynav(i,t.Utils.options(i.attr("data-uk-scrollspy-nav")))}})})},init:function(){var e,n=[],o=this.find("a[href^='#']").each(function(){"#"!==this.getAttribute("href").trim()&&n.push(this.getAttribute("href"))}),a=t.$(n.join(",")),r=this.options.cls,l=this.options.closest||this.options.closest,c=this,u=function(){e=[];for(var n=0;n<a.length;n++)t.Utils.isInView(a.eq(n),c.options)&&e.push(a.eq(n));if(e.length){var s,u=i.scrollTop(),h=function(){for(var t=0;t<e.length;t++)if(e[t].offset().top-c.options.topoffset>=u)return e[t]}();if(!h)return;c.options.closest?(o.blur().closest(l).removeClass(r),s=o.filter("a[href='#"+h.attr("id")+"']").closest(l).addClass(r)):s=o.removeClass(r).filter("a[href='#"+h.attr("id")+"']").addClass(r),c.element.trigger("inview.uk.scrollspynav",[h,s])}};this.options.smoothscroll&&t.smoothScroll&&o.each(function(){t.smoothScroll(this,c.options.smoothscroll)}),u(),this.element.data("scrollspynav",this),this.check=u,s.push(this)}})}(UIkit),function(t){"use strict";var i=[];t.component("toggle",{defaults:{target:!1,cls:"uk-hidden",animation:!1,duration:200},boot:function(){t.ready(function(e){t.$("[data-uk-toggle]",e).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,e=this.options.animation.split(",");1==e.length&&(e[1]=e[0]),e[0]=e[0].trim(),e[1]=e[1].trim(),this.totoggle.css("animation-duration",this.options.duration+"ms"),this.totoggle.each(function(){var n=t.$(this);n.hasClass(i.options.cls)?(n.toggleClass(i.options.cls),t.Utils.animate(n,e[0]).then(function(){n.css("animation-duration",""),t.Utils.checkDisplay(n)})):t.Utils.animate(this,e[1]+" uk-animation-reverse").then(function(){n.toggleClass(i.options.cls).css("animation-duration",""),t.Utils.checkDisplay(n)})})}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),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 e=t.$(this);if(!e.data("alert")){var n=t.alert(e,t.Utils.options(e.attr("data-uk-alert")));t.$(i.target).is(n.options.trigger)&&(i.preventDefault(),n.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),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 e=t.$(this);if(!e.data("buttonRadio")){var n=t.buttonRadio(e,t.Utils.options(e.attr("data-uk-button-radio"))),o=t.$(i.target);o.is(n.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(e){var n=t.$(this);n.is('a[href="#"]')&&e.preventDefault(),i.find(i.options.target).not(n).removeClass(i.options.activeClass).blur(),n.addClass(i.options.activeClass),i.find(i.options.target).not(n).attr("aria-checked","false"),n.attr("aria-checked","true"),i.trigger("change.uk.button",[n])})},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 e=t.$(this);if(!e.data("buttonCheckbox")){var n=t.buttonCheckbox(e,t.Utils.options(e.attr("data-uk-button-checkbox"))),o=t.$(i.target);o.is(n.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(e){var n=t.$(this);n.is('a[href="#"]')&&e.preventDefault(),n.toggleClass(i.options.activeClass).blur(),n.attr("aria-checked",n.hasClass(i.options.activeClass)),i.trigger("change.uk.button",[n])})},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),function(t){"use strict";function i(i,e,n,o){if(i=t.$(i),e=t.$(e),n=n||window.innerWidth,o=o||i.offset(),e.length){var s=e.outerWidth();if(i.css("min-width",s),"right"==t.langdirection){var a=n-(e.offset().left+s),r=n-(i.offset().left+i.outerWidth());i.css("margin-right",a-r)}else i.css("margin-left",e.offset().left-o.left)}}var e,n=!1,o={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 i=t.support.touch?"click":"mouseenter";t.$html.on(i+".dropdown.uikit","[data-uk-dropdown]",function(e){var n=t.$(this);if(!n.data("dropdown")){var o=t.dropdown(n,t.Utils.options(n.attr("data-uk-dropdown")));("click"==i||"mouseenter"==i&&"hover"==o.options.mode)&&o.element.trigger(i),o.element.find(o.options.dropdownSelector).length&&e.preventDefault()}})},init:function(){var i=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 n=t.$(e.target);n.parents(i.options.dropdownSelector).length||((n.is("a[href='#']")||n.parent().is("a[href='#']")||i.dropdown.length&&!i.dropdown.is(":visible"))&&e.preventDefault(),n.blur()),i.element.hasClass("uk-open")?(!i.dropdown.find(e.target).length||n.is(".uk-dropdown-close")||n.parents(".uk-dropdown-close").length)&&i.hide():i.show()}):this.on("mouseenter",function(){i.trigger("pointerenter.uk.dropdown",[i]),i.remainIdle&&clearTimeout(i.remainIdle),e&&clearTimeout(e),n&&n==i||(e=n&&n!=i?setTimeout(function(){e=setTimeout(i.show.bind(i),i.options.delay)},i.options.hoverDelayIdle):setTimeout(i.show.bind(i),i.options.delay))}).on("mouseleave",function(){e&&clearTimeout(e),i.remainIdle=setTimeout(function(){n&&n==i&&i.hide()},i.options.remaintime),i.trigger("pointerleave.uk.dropdown",[i])}).on("click",function(e){var o=t.$(e.target);return i.remainIdle&&clearTimeout(i.remainIdle),n&&n==i?((!i.dropdown.find(e.target).length||o.is(".uk-dropdown-close")||o.parents(".uk-dropdown-close").length)&&i.hide(),void 0):((o.is("a[href='#']")||o.parent().is("a[href='#']"))&&e.preventDefault(),i.show(),void 0)})},show:function(){t.$html.off("click.outer.dropdown"),n&&n!=this&&n.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),n=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]),n==this&&(n=!1)},registerOuterClick:function(){var i=this;t.$html.off("click.outer.dropdown"),setTimeout(function(){t.$html.on("click.outer.dropdown",function(o){e&&clearTimeout(e);t.$(o.target);n!=i||i.element.find(o.target).length||(i.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,n=t.$.extend({},this.offsetParent.offset(),{width:this.offsetParent[0].offsetWidth,height:this.offsetParent[0].offsetHeight}),s=this.options.offset,a=this.dropdown,r=(a.show().offset()||{left:0,top:0},a.outerWidth()),l=a.outerHeight(),c=this.boundary.width(),u=(this.boundary[0]!==window&&this.boundary.offset()?this.boundary.offset():{top:0,left:0},this.options.pos),h={"bottom-left":{top:0+n.height+s,left:0},"bottom-right":{top:0+n.height+s,left:0+n.width-r},"bottom-center":{top:0+n.height+s,left:0+n.width/2-r/2},"top-left":{top:0-l-s,left:0},"top-right":{top:0-l-s,left:0+n.width-r},"top-center":{top:0-l-s,left:0+n.width/2-r/2},"left-top":{top:0,left:0-r-s},"left-bottom":{top:0+n.height-l,left:0-r-s},"left-center":{top:0+n.height/2-l/2,left:0-r-s},"right-top":{top:0,left:0+n.width+s},"right-bottom":{top:0+n.height-l,left:0+n.width+s},"right-center":{top:0+n.height/2-l/2,left:0+n.width+s}},d={};if(e=u.split("-"),d=h[u]?h[u]:h["bottom-left"],this.justified&&this.justified.length)i(a.css({left:0}),this.justified,c);else if(this.options.preventflip!==!0){var p;switch(this.checkBoundary(n.left+d.left,n.top+d.top,r,l,c)){case"x":"x"!==this.options.preventflip&&(p=o.x[u]||"right-top");break;case"y":"y"!==this.options.preventflip&&(p=o.y[u]||"top-left");break;case"xy":this.options.preventflip||(p=o.xy[u]||"right-bottom")}p&&(e=p.split("-"),d=h[p]?h[p]:h["bottom-left"],this.checkBoundary(n.left+d.left,n.top+d.top,r,l,c)&&(e=u.split("-"),d=h[u]?h[u]:h["bottom-left"]))}r>c&&(a.addClass("uk-dropdown-stack"),this.trigger("stack.uk.dropdown",[this])),a.css(d).css("display","").addClass("uk-dropdown-"+e[0])
3}},checkBoundary:function(i,e,n,o,s){var a="";return(0>i||i-t.$win.scrollLeft()+n>s)&&(a+="x"),(e-t.$win.scrollTop()<0||e-t.$win.scrollTop()+o>window.innerHeight)&&(a+="y"),a}}),t.component("dropdownOverlay",{defaults:{justify:!1,cls:"",duration:200},boot:function(){t.ready(function(i){t.$("[data-uk-dropdown-overlay]",i).each(function(){var i=t.$(this);i.data("dropdownOverlay")||t.dropdownOverlay(i,t.Utils.options(i.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,n){e.dropdown=n,e.justified&&e.justified.length&&i(e.overlay.css({display:"block","margin-left":"","margin-right":""}),e.justified,e.justified.outerWidth())},"show.uk.dropdown":function(){var i=e.dropdown.dropdown.outerHeight(!0);e.dropdown.element.removeClass("uk-open"),e.overlay.stop().css("display","block").animate({height:i},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&&n&&(e.remainIdle=setTimeout(function(){n&&n.hide()},n.options.remaintime))}})}})}(UIkit),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,e=t.$(this);e.data("gridMatchHeight")||(i=t.gridMatchHeight(e,t.Utils.options(e.attr("data-uk-grid-match"))))})})},init:function(){var e=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(){e.element.is(":visible")&&e.match()};return t.$(function(){i()}),t.Utils.debounce(i,50)}()),this.options.observe&&t.domObserve(this.element,function(){e.element.is(":visible")&&e.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 e=Math.ceil(100*parseFloat(i.css("width"))/parseFloat(i.parent().css("width")))>=100;return e&&!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,e=t.$(this);e.data("gridMargin")||(i=t.gridMargin(e,t.Utils.options(e.attr("data-uk-grid-margin"))))})})},init:function(){t.stackMargin(this.element,this.options)}})}(UIkit),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,n=!1,o=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 n=t.$(e.target);n[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&&n&&n.hide(!0),this.element.removeClass("uk-open").show(),this.resize(!0),this.options.modal&&(n=this),this.active=!0,o++,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 n=this.dialog.outerHeight(),o=parseInt(this.dialog.css("margin-top"),10)+parseInt(this.dialog.css("margin-bottom"),10);n+o<window.innerHeight?this.dialog.css({top:window.innerHeight/2-n/2-o}):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(),n=window.innerHeight,o=n-2*(20>i?20:i)-e;return t.css({"max-height":o<this.options.minScrollHeight?"":o,height:""}),!0}return!1},_hide:function(){this.active=!1,o>0?o--:o=0,this.element.hide().removeClass("uk-open"),this.element.attr("aria-hidden","true"),o||(s.removeClass("uk-modal-page"),e.css(this.paddingdir,"")),n===this&&(n=!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 n=t.modalTrigger(e,t.Utils.options(e.attr("data-uk-modal")));n.show()}}),t.$html.on("keydown.modal.uikit",function(t){n&&27===t.keyCode&&n.options.keyboard&&(t.preventDefault(),n.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,n){var o=t.modal(t.$(t.modal.dialog.template).appendTo("body"),n);return o.on("hide.uk.modal",function(){o.persist&&(o.persist.appendTo(o.persist.data("modalPersistParent")),o.persist=!1),o.element.remove()}),i(e,o),o},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 n=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 n.on("show.uk.modal",function(){setTimeout(function(){n.element.find("button:first").focus()},50)}),n.show()},t.modal.confirm=function(i,e,n){var o=arguments.length>1&&arguments[arguments.length-1]?arguments[arguments.length-1]:{};e=t.$.isFunction(e)?e:function(){},n=t.$.isFunction(n)?n:function(){},o=t.$.extend(!0,{bgclose:!1,keyboard:!1,modal:!1,labels:t.modal.labels},t.$.isFunction(o)?{}:o);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">'+o.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+o.labels.Ok+"</button></div>"].join(""),o);return s.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click",function(){t.$(this).is(".js-modal-confirm")?e():n(),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,n,o){n=t.$.isFunction(n)?n:function(){},o=t.$.extend(!0,{bgclose:!1,keyboard:!1,modal:!1,labels:t.modal.labels},o);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">'+o.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-ok">'+o.labels.Ok+"</button></div>"].join(""),o),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(){n(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 n=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 n.content=n.element.find(".uk-modal-content:first"),n.show()},t.modal.labels={Ok:"Ok",Cancel:"Cancel"}}(UIkit),function(t){"use strict";function i(i){var e=t.$(i),n="auto";if(e.is(":visible"))n=e.outerHeight();else{var o={position:e.css("position"),visibility:e.css("visibility"),display:e.css("display")};n=e.css({position:"absolute",visibility:"hidden",display:"block"}).outerHeight(),e.css(o)}return n}t.component("nav",{defaults:{toggle:">li.uk-parent > a[href='#']",lists:">li.uk-parent > ul",multiple:!1},boot:function(){t.ready(function(i){t.$("[data-uk-nav]",i).each(function(){var i=t.$(this);if(!i.data("nav")){t.nav(i,t.Utils.options(i.attr("data-uk-nav")))}})})},init:function(){var i=this;this.on("click.uk.nav",this.options.toggle,function(e){e.preventDefault();var n=t.$(this);i.open(n.parent()[0]==i.element[0]?n:n.parent("li"))}),this.find(this.options.lists).each(function(){var e=t.$(this),n=e.parent(),o=n.hasClass("uk-active");e.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>'),n.data("list-container",e.parent()[o?"removeClass":"addClass"]("uk-hidden")),n.attr("aria-expanded",n.hasClass("uk-open")),o&&i.open(n,!0)})},open:function(e,n){var o=this,s=this.element,a=t.$(e),r=a.data("list-container");this.options.multiple||s.children(".uk-open").not(e).each(function(){var i=t.$(this);i.data("list-container")&&i.data("list-container").stop().animate({height:0},function(){t.$(this).parent().removeClass("uk-open").end().addClass("uk-hidden")})}),a.toggleClass("uk-open"),a.attr("aria-expanded",a.hasClass("uk-open")),r&&(a.hasClass("uk-open")&&r.removeClass("uk-hidden"),n?(r.stop().height(a.hasClass("uk-open")?"auto":0),a.hasClass("uk-open")||r.addClass("uk-hidden"),this.trigger("display.uk.check")):r.stop().animate({height:a.hasClass("uk-open")?i(r.find("ul:first")):0},function(){a.hasClass("uk-open")?r.css("height",""):r.addClass("uk-hidden"),o.trigger("display.uk.check")}))}})}(UIkit),function(t){"use strict";var i={x:window.scrollX,y:window.scrollY},e=(t.$win,t.$doc,t.$html),n={show:function(n){if(n=t.$(n),n.length){var o=t.$("body"),s=n.find(".uk-offcanvas-bar:first"),a="right"==t.langdirection,r=s.hasClass("uk-offcanvas-bar-flip")?-1:1,l=r*(a?-1:1),c=window.innerWidth-o.width();i={x:window.pageXOffset,y:window.pageYOffset},n.addClass("uk-active"),o.css({width:window.innerWidth-c,height:window.innerHeight}).addClass("uk-offcanvas-page"),o.css(a?"margin-right":"margin-left",(a?-1:1)*s.outerWidth()*l).width(),e.css("margin-top",-1*i.y),s.addClass("uk-offcanvas-bar-show"),this._initElement(n),s.trigger("show.uk.offcanvas",[n,s]),n.attr("aria-hidden","false")}},hide:function(n){var o=t.$("body"),s=t.$(".uk-offcanvas.uk-active"),a="right"==t.langdirection,r=s.find(".uk-offcanvas-bar:first"),l=function(){o.removeClass("uk-offcanvas-page").css({width:"",height:"","margin-left":"","margin-right":""}),s.removeClass("uk-active"),r.removeClass("uk-offcanvas-bar-show"),e.css("margin-top",""),window.scrollTo(i.x,i.y),r.trigger("hide.uk.offcanvas",[s,r]),s.attr("aria-hidden","true")};s.length&&(t.support.transition&&!n?(o.one(t.support.transition.end,function(){l()}).css(a?"margin-right":"margin-left",""),setTimeout(function(){r.removeClass("uk-offcanvas-bar-show")},0)):l())},_initElement:function(i){i.data("OffcanvasInit")||(i.on("click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas",function(i){var e=t.$(i.target);if(!i.type.match(/swipe/)&&!e.hasClass("uk-offcanvas-close")){if(e.hasClass("uk-offcanvas-bar"))return;if(e.parents(".uk-offcanvas-bar:first").length)return}i.stopImmediatePropagation(),n.hide()}),i.on("click","a[href*='#']",function(){var i=t.$(this),e=i.attr("href");"#"!=e&&(t.$doc.one("hide.uk.offcanvas",function(){var n;try{n=t.$(i[0].hash)}catch(o){n=""}n.length||(n=t.$('[name="'+i[0].hash.replace("#","")+'"]')),n.length&&t.Utils.scrollToElement?t.Utils.scrollToElement(n,t.Utils.options(i.attr("data-uk-smooth-scroll")||"{}")):window.location.href=e}),n.hide())}),i.data("OffcanvasInit",!0))}};t.component("offcanvasTrigger",{boot:function(){e.on("click.offcanvas.uikit","[data-uk-offcanvas]",function(i){i.preventDefault();var e=t.$(this);if(!e.data("offcanvasTrigger")){{t.offcanvasTrigger(e,t.Utils.options(e.attr("data-uk-offcanvas")))}e.trigger("click")}}),e.on("keydown.uk.offcanvas",function(t){27===t.keyCode&&n.hide()})},init:function(){var i=this;this.options=t.$.extend({target:i.element.is("a")?i.element.attr("href"):!1},this.options),this.on("click",function(t){t.preventDefault(),n.show(i.options.target)})}}),t.offcanvas=n}(UIkit),function(t){"use strict";function i(i,e,n){var o,s=t.$.Deferred(),a=i,r=i;return n[0]===e[0]?(s.resolve(),s.promise()):("object"==typeof i&&(a=i[0],r=i[1]||i[0]),t.$body.css("overflow-x","hidden"),o=function(){e&&e.hide().removeClass("uk-active "+r+" uk-animation-reverse"),n.addClass(a).one(t.support.animation.end,function(){setTimeout(function(){n.removeClass(""+a).css({opacity:"",display:""})},0),s.resolve(),t.$body.css("overflow-x",""),e&&e.css({opacity:"",display:""})}.bind(this)).show()},n.css("animation-duration",this.options.duration+"ms"),e&&e.length?(e.css("animation-duration",this.options.duration+"ms"),e.css("display","none").addClass(r+" uk-animation-reverse").one(t.support.animation.end,function(){o()}.bind(this)).css("display","")):(n.addClass("uk-active"),o()),s.promise())}var e;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(e){e.preventDefault();var n=t.$(this).attr("data-uk-switcher-item");if(i.index!=n)switch(n){case"next":case"previous":i.show(i.index+("next"==n?1:-1));break;default:i.show(parseInt(n,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 e=this.find(this.options.toggle),n=e.filter(".uk-active");if(n.length)this.show(n,!1);else{if(this.options.active===!1)return;n=e.eq(this.options.active),this.show(n.length?n:e.eq(0),!1)}e.not(n).attr("aria-expanded","false"),n.attr("aria-expanded","true")}},show:function(n,o){if(!this.animating){if(isNaN(n))n=t.$(n);else{var s=this.find(this.options.toggle);n=0>n?s.length-1:n,n=s.eq(s[n]?n:0)}var a=this,s=this.find(this.options.toggle),r=t.$(n),l=e[this.options.animation]||function(t,n){if(!a.options.animation)return e.none.apply(a);var o=a.options.animation.split(",");return 1==o.length&&(o[1]=o[0]),o[0]=o[0].trim(),o[1]=o[1].trim(),i.apply(a,[o,t,n])};o!==!1&&t.support.animation||(l=e.none),r.hasClass("uk-disabled")||(s.attr("aria-expanded","false"),r.attr("aria-expanded","true"),s.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),e=t.$(i.children()),n=t.$(e.filter(".uk-active")),o=t.$(e.eq(a.index));a.animating=!0,l.apply(a,[n,o]).then(function(){n.removeClass("uk-active"),o.addClass("uk-active"),n.attr("aria-hidden","true"),o.attr("aria-hidden","false"),t.Utils.checkDisplay(o,!0),a.animating=!1})})),this.trigger("show.uk.switcher",[r]))}}}),e={none:function(){var i=t.$.Deferred();return i.resolve(),i.promise()},fade:function(t,e){return i.apply(this,["uk-animation-fade",t,e])},"slide-bottom":function(t,e){return i.apply(this,["uk-animation-slide-bottom",t,e])},"slide-top":function(t,e){return i.apply(this,["uk-animation-slide-top",t,e])},"slide-vertical":function(t,e){var n=["uk-animation-slide-top","uk-animation-slide-bottom"];return t&&t.index()>e.index()&&n.reverse(),i.apply(this,[n,t,e])},"slide-left":function(t,e){return i.apply(this,["uk-animation-slide-left",t,e])},"slide-right":function(t,e){return i.apply(this,["uk-animation-slide-right",t,e])},"slide-horizontal":function(t,e){var n=["uk-animation-slide-right","uk-animation-slide-left"];return t&&t.index()>e.index()&&n.reverse(),i.apply(this,[n,t,e])},scale:function(t,e){return i.apply(this,["uk-animation-scale-up",t,e])}},t.switcher.animations=e}(UIkit),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 n=i.find(i.options.target).not(this);n.removeClass("uk-active").blur(),i.trigger("change.uk.tab",[t.$(this).addClass("uk-active"),i.current]),i.current=t.$(this),i.options.connect||(n.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 n=t.$(this);i.element.children("li:not(.uk-tab-responsive)").eq(n.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,n,o,s=i.eq(0).offset().top+Math.ceil(i.eq(0).height()/2),a=!1;if(this.responsivetab.lst.empty(),i.each(function(){t.$(this).offset().top>s&&(a=!0)}),a)for(var r=0;r<i.length;r++)e=t.$(i.eq(r)),n=e.find("a"),"none"==e.css("float")||e.attr("uk-dropdown")||(e.hasClass("uk-disabled")||(o=e[0].outerHTML.replace("<a ",'<a data-index="'+r+'" '),this.responsivetab.lst.append(o)),e.addClass("uk-hidden"));this.responsivetab[this.responsivetab.lst.children("li").length?"removeClass":"addClass"]("uk-hidden")}})}(UIkit),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