summaryrefslogtreecommitdiff
path: root/js/components
diff options
context:
space:
mode:
Diffstat (limited to 'js/components')
-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
46 files changed, 11105 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