aboutsummaryrefslogtreecommitdiffstats
path: root/uikit/static/js/components
diff options
context:
space:
mode:
authorValentin Heinz <inktrap@users.noreply.github.com>2017-04-08 14:03:25 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2017-04-08 14:03:25 +0200
commit5c231ceade17e7f5b1bba90e845dd2d17e54da1c (patch)
treef4f07dbbac2c51c8a0af1e1a24f11e030a2e4155 /uikit/static/js/components
parent00986ab80df4b6be2d1306671907e2b2378e487f (diff)
downloadpelican-themes-5c231ceade17e7f5b1bba90e845dd2d17e54da1c.tar.gz
uikit demo theme ported to pelican (#385)
Diffstat (limited to 'uikit/static/js/components')
-rw-r--r--uikit/static/js/components/accordion.js172
-rw-r--r--uikit/static/js/components/accordion.min.js2
-rw-r--r--uikit/static/js/components/autocomplete.js336
-rw-r--r--uikit/static/js/components/autocomplete.min.js2
-rw-r--r--uikit/static/js/components/datepicker.js3168
-rw-r--r--uikit/static/js/components/datepicker.min.js3
-rw-r--r--uikit/static/js/components/form-password.js66
-rw-r--r--uikit/static/js/components/form-password.min.js2
-rw-r--r--uikit/static/js/components/form-select.js70
-rw-r--r--uikit/static/js/components/form-select.min.js2
-rw-r--r--uikit/static/js/components/grid.js524
-rw-r--r--uikit/static/js/components/grid.min.js2
-rw-r--r--uikit/static/js/components/htmleditor.js621
-rw-r--r--uikit/static/js/components/htmleditor.min.js2
-rw-r--r--uikit/static/js/components/lightbox.js544
-rw-r--r--uikit/static/js/components/lightbox.min.js2
-rw-r--r--uikit/static/js/components/nestable.js625
-rw-r--r--uikit/static/js/components/nestable.min.js2
-rw-r--r--uikit/static/js/components/notify.js191
-rw-r--r--uikit/static/js/components/notify.min.js2
-rw-r--r--uikit/static/js/components/pagination.js148
-rw-r--r--uikit/static/js/components/pagination.min.js2
-rw-r--r--uikit/static/js/components/parallax.js417
-rw-r--r--uikit/static/js/components/parallax.min.js2
-rw-r--r--uikit/static/js/components/search.js92
-rw-r--r--uikit/static/js/components/search.min.js2
-rw-r--r--uikit/static/js/components/slider.js482
-rw-r--r--uikit/static/js/components/slider.min.js2
-rw-r--r--uikit/static/js/components/slideset.js503
-rw-r--r--uikit/static/js/components/slideset.min.js2
-rw-r--r--uikit/static/js/components/slideshow-fx.js377
-rw-r--r--uikit/static/js/components/slideshow-fx.min.js2
-rw-r--r--uikit/static/js/components/slideshow.js545
-rw-r--r--uikit/static/js/components/slideshow.min.js2
-rw-r--r--uikit/static/js/components/sortable.js643
-rw-r--r--uikit/static/js/components/sortable.min.js2
-rw-r--r--uikit/static/js/components/sticky.js298
-rw-r--r--uikit/static/js/components/sticky.min.js2
-rw-r--r--uikit/static/js/components/timepicker.js192
-rw-r--r--uikit/static/js/components/timepicker.min.js2
-rw-r--r--uikit/static/js/components/tooltip.js234
-rw-r--r--uikit/static/js/components/tooltip.min.js2
-rw-r--r--uikit/static/js/components/upload.js256
-rw-r--r--uikit/static/js/components/upload.min.js2
44 files changed, 10549 insertions, 0 deletions
diff --git a/uikit/static/js/components/accordion.js b/uikit/static/js/components/accordion.js
new file mode 100644
index 0000000..d8a62c6
--- /dev/null
+++ b/uikit/static/js/components/accordion.js
@@ -0,0 +1,172 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-accordion", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+})(function(UI){
+
+ "use strict";
+
+ UI.component('accordion', {
+
+ defaults: {
+ showfirst : true,
+ collapse : true,
+ animate : true,
+ easing : 'swing',
+ duration : 300,
+ toggle : '.uk-accordion-title',
+ containers : '.uk-accordion-content',
+ clsactive : 'uk-active'
+ },
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ setTimeout(function(){
+
+ UI.$("[data-uk-accordion]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if(!ele.data("accordion")) {
+ UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
+ }
+ });
+
+ }, 0);
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ this.element.on('click.uikit.accordion', this.options.toggle, function(e) {
+
+ e.preventDefault();
+
+ $this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
+ });
+
+ this.update();
+
+ if (this.options.showfirst) {
+ this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
+ }
+ },
+
+ toggleItem: function(wrapper, animated, collapse) {
+
+ var $this = this;
+
+ wrapper.data('toggle').toggleClass(this.options.clsactive);
+
+ var active = wrapper.data('toggle').hasClass(this.options.clsactive);
+
+ if (collapse) {
+ this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
+ this.content.not(wrapper.data('content')).parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
+ }
+
+ wrapper.stop().css('overflow', 'hidden');
+
+ if (animated) {
+
+ wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
+
+ if (active) {
+ wrapper.css({'overflow': '', 'height': 'auto'});
+ UI.Utils.checkDisplay(wrapper.data('content'));
+ }
+
+ $this.trigger('display.uk.check');
+ }});
+
+ } else {
+
+ wrapper.height(active ? 'auto' : 0);
+
+ if (active) {
+ wrapper.css({'overflow': ''});
+ UI.Utils.checkDisplay(wrapper.data('content'));
+ }
+
+ this.trigger('display.uk.check');
+ }
+
+ // Update ARIA
+ wrapper.attr('aria-expanded', active);
+
+ this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
+ },
+
+ update: function() {
+
+ var $this = this, $content, $wrapper, $toggle;
+
+ this.toggle = this.find(this.options.toggle);
+ this.content = this.find(this.options.containers);
+
+ this.content.each(function(index) {
+
+ $content = UI.$(this);
+
+ if ($content.parent().data('wrapper')) {
+ $wrapper = $content.parent();
+ } else {
+ $wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
+
+ // Init ARIA
+ $wrapper.attr('aria-expanded', 'false');
+ }
+
+ $toggle = $this.toggle.eq(index);
+
+ $wrapper.data('toggle', $toggle);
+ $wrapper.data('content', $content);
+ $toggle.data('wrapper', $wrapper);
+ $content.data('wrapper', $wrapper);
+ });
+
+ this.element.trigger('update.uk.accordion', [this]);
+ }
+
+ });
+
+ // helper
+
+ function getHeight(ele) {
+
+ var $ele = UI.$(ele), height = "auto";
+
+ if ($ele.is(":visible")) {
+ height = $ele.outerHeight();
+ } else {
+
+ var tmp = {
+ position : $ele.css("position"),
+ visibility : $ele.css("visibility"),
+ display : $ele.css("display")
+ };
+
+ height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
+
+ $ele.css(tmp); // reset element
+ }
+
+ return height;
+ }
+
+ return UI.accordion;
+});
diff --git a/uikit/static/js/components/accordion.min.js b/uikit/static/js/components/accordion.min.js
new file mode 100644
index 0000000..7da0724
--- /dev/null
+++ b/uikit/static/js/components/accordion.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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.uikit.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);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")).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/uikit/static/js/components/autocomplete.js b/uikit/static/js/components/autocomplete.js
new file mode 100644
index 0000000..7031f94
--- /dev/null
+++ b/uikit/static/js/components/autocomplete.js
@@ -0,0 +1,336 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-autocomplete", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var active;
+
+ UI.component('autocomplete', {
+
+ defaults: {
+ minLength: 3,
+ param: 'search',
+ method: 'post',
+ delay: 300,
+ loadingClass: 'uk-loading',
+ flipDropdown: false,
+ skipClass: 'uk-skip',
+ hoverClass: 'uk-active',
+ source: null,
+ renderer: null,
+
+ // template
+
+ 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 : false,
+ value : null,
+ selected : null,
+
+ boot: function() {
+
+ // init code
+ UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
+
+ var ele = UI.$(this);
+
+ if (!ele.data("autocomplete")) {
+ var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
+ }
+ });
+
+ // register outer click for autocompletes
+ UI.$html.on("click.autocomplete.uikit", function(e) {
+ if (active && e.target!=active.input[0]) active.hide();
+ });
+ },
+
+ init: function() {
+
+ var $this = this,
+ select = false,
+ trigger = UI.Utils.debounce(function(e) {
+ if(select) {
+ return (select = false);
+ }
+ $this.handle();
+ }, this.options.delay);
+
+
+ this.dropdown = this.find('.uk-dropdown');
+ this.template = this.find('script[type="text/autocomplete"]').html();
+ this.template = UI.Utils.template(this.template || this.options.template);
+ this.input = this.find("input:first").attr("autocomplete", "off");
+
+ if (!this.dropdown.length) {
+ this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
+ }
+
+ if (this.options.flipDropdown) {
+ this.dropdown.addClass('uk-dropdown-flip');
+ }
+
+ this.dropdown.attr('aria-expanded', 'false');
+
+ this.input.on({
+ "keydown": function(e) {
+
+ if (e && e.which && !e.shiftKey) {
+
+ switch (e.which) {
+ case 13: // enter
+ select = true;
+
+ if ($this.selected) {
+ e.preventDefault();
+ $this.select();
+ }
+ break;
+ case 38: // up
+ e.preventDefault();
+ $this.pick('prev', true);
+ break;
+ case 40: // down
+ e.preventDefault();
+ $this.pick('next', true);
+ break;
+ case 27:
+ case 9: // esc, tab
+ $this.hide();
+ break;
+ default:
+ break;
+ }
+ }
+
+ },
+ "keyup": trigger
+ });
+
+ this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
+ $this.select();
+ });
+
+ this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
+ $this.pick(UI.$(this));
+ });
+
+ this.triggercomplete = trigger;
+ },
+
+ handle: function() {
+
+ var $this = this, old = this.value;
+
+ this.value = this.input.val();
+
+ if (this.value.length < this.options.minLength) return this.hide();
+
+ if (this.value != old) {
+ $this.request();
+ }
+
+ return this;
+ },
+
+ pick: function(item, scrollinview) {
+
+ var $this = this,
+ items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
+ selected = false;
+
+ if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
+ selected = item;
+ } else if (item == 'next' || item == 'prev') {
+
+ if (this.selected) {
+ var index = items.index(this.selected);
+
+ if (item == 'next') {
+ selected = items.eq(index + 1 < items.length ? index + 1 : 0);
+ } else {
+ selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
+ }
+
+ } else {
+ selected = items[(item == 'next') ? 'first' : 'last']();
+ }
+
+ selected = UI.$(selected);
+ }
+
+ if (selected && selected.length) {
+ this.selected = selected;
+ items.removeClass(this.options.hoverClass);
+ this.selected.addClass(this.options.hoverClass);
+
+ // jump to selected if not in view
+ if (scrollinview) {
+
+ var top = selected.position().top,
+ scrollTop = $this.dropdown.scrollTop(),
+ dpheight = $this.dropdown.height();
+
+ if (top > dpheight || top < 0) {
+ $this.dropdown.scrollTop(scrollTop + top);
+ }
+ }
+ }
+ },
+
+ select: function() {
+
+ if(!this.selected) return;
+
+ var data = this.selected.data();
+
+ this.trigger("selectitem.uk.autocomplete", [data, this]);
+
+ if (data.value) {
+ this.input.val(data.value).trigger('change');
+ }
+
+ this.hide();
+ },
+
+ show: function() {
+ if (this.visible) return;
+ this.visible = true;
+ this.element.addClass("uk-open");
+
+ if (active && active!==this) {
+ active.hide();
+ }
+
+ active = this;
+
+ // Update aria
+ this.dropdown.attr('aria-expanded', 'true');
+
+ return this;
+ },
+
+ hide: function() {
+ if (!this.visible) return;
+ this.visible = false;
+ this.element.removeClass("uk-open");
+
+ if (active === this) {
+ active = false;
+ }
+
+ // Update aria
+ this.dropdown.attr('aria-expanded', 'false');
+
+ return this;
+ },
+
+ request: function() {
+
+ var $this = this,
+ release = function(data) {
+
+ if(data) {
+ $this.render(data);
+ }
+
+ $this.element.removeClass($this.options.loadingClass);
+ };
+
+ this.element.addClass(this.options.loadingClass);
+
+ if (this.options.source) {
+
+ var source = this.options.source;
+
+ switch(typeof(this.options.source)) {
+ case 'function':
+
+ this.options.source.apply(this, [release]);
+
+ break;
+
+ case 'object':
+
+ if(source.length) {
+
+ var items = [];
+
+ source.forEach(function(item){
+ if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
+ items.push(item);
+ }
+ });
+
+ release(items);
+ }
+
+ break;
+
+ case 'string':
+
+ var params ={};
+
+ params[this.options.param] = this.value;
+
+ UI.$.ajax({
+ url: this.options.source,
+ data: params,
+ type: this.options.method,
+ dataType: 'json'
+ }).done(function(json) {
+ release(json || []);
+ });
+
+ break;
+
+ default:
+ release(null);
+ }
+
+ } else {
+ this.element.removeClass($this.options.loadingClass);
+ }
+ },
+
+ render: function(data) {
+
+ var $this = this;
+
+ this.dropdown.empty();
+
+ this.selected = false;
+
+ if (this.options.renderer) {
+
+ this.options.renderer.apply(this, [data]);
+
+ } else if(data && data.length) {
+
+ this.dropdown.append(this.template({"items":data}));
+ this.show();
+
+ this.trigger('show.uk.autocomplete');
+ }
+
+ return this;
+ }
+ });
+
+ return UI.autocomplete;
+});
diff --git a/uikit/static/js/components/autocomplete.min.js b/uikit/static/js/components/autocomplete.min.js
new file mode 100644
index 0000000..2752df4
--- /dev/null
+++ b/uikit/static/js/components/autocomplete.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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);if(!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/uikit/static/js/components/datepicker.js b/uikit/static/js/components/datepicker.js
new file mode 100644
index 0000000..6a260e1
--- /dev/null
+++ b/uikit/static/js/components/datepicker.js
@@ -0,0 +1,3168 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-datepicker", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ // Datepicker
+
+ var active = false, dropdown, moment;
+
+ UI.component('datepicker', {
+
+ defaults: {
+ mobile: false,
+ 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: "DD.MM.YYYY",
+ offsettop: 5,
+ maxDate: false,
+ minDate: false,
+ pos: 'auto',
+ template: function(data, opts) {
+
+ var content = '', maxDate, minDate, i;
+
+ if (opts.maxDate!==false){
+ maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add(opts.maxDate, 'days');
+ }
+
+ if (opts.minDate!==false){
+ minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add(opts.minDate-1, 'days');
+ }
+
+ content += '<div class="uk-datepicker-nav">';
+ content += '<a href="" class="uk-datepicker-previous"></a>';
+ content += '<a href="" class="uk-datepicker-next"></a>';
+
+ if (UI.formSelect) {
+
+ var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
+
+ for (i=0;i<opts.i18n.months.length;i++) {
+ if(i==data.month) {
+ options.push('<option value="'+i+'" selected>'+opts.i18n.months[i]+'</option>');
+ } else {
+ options.push('<option value="'+i+'">'+opts.i18n.months[i]+'</option>');
+ }
+ }
+
+ months = '<span class="uk-form-select">'+ opts.i18n.months[data.month] + '<select class="update-picker-month">'+options.join('')+'</select></span>';
+
+ // --
+
+ options = [];
+
+ minYear = minDate ? minDate.year() : currentyear - 50;
+ maxYear = maxDate ? maxDate.year() : currentyear + 20;
+
+ for (i=minYear;i<=maxYear;i++) {
+ if (i == data.year) {
+ options.push('<option value="'+i+'" selected>'+i+'</option>');
+ } else {
+ options.push('<option value="'+i+'">'+i+'</option>');
+ }
+ }
+
+ years = '<span class="uk-form-select">'+ data.year + '<select class="update-picker-year">'+options.join('')+'</select></span>';
+
+ content += '<div class="uk-datepicker-heading">'+ months + ' ' + years +'</div>';
+
+ } else {
+ content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
+ }
+
+ content += '</div>';
+
+ content += '<table class="uk-datepicker-table">';
+ content += '<thead>';
+ for(i = 0; i < data.weekdays.length; i++) {
+ if (data.weekdays[i]) {
+ content += '<th>'+data.weekdays[i]+'</th>';
+ }
+ }
+ content += '</thead>';
+
+ content += '<tbody>';
+ for(i = 0; i < data.days.length; i++) {
+ if (data.days[i] && data.days[i].length){
+ content += '<tr>';
+ for(var d = 0; d < data.days[i].length; d++) {
+ if (data.days[i][d]) {
+ var day = data.days[i][d],
+ cls = [];
+
+ if(!day.inmonth) cls.push("uk-datepicker-table-muted");
+ if(day.selected) cls.push("uk-active");
+
+ if (maxDate && day.day > maxDate) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
+ if (minDate && minDate > day.day) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
+
+ content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
+ }
+ }
+ content += '</tr>';
+ }
+ }
+ content += '</tbody>';
+
+ content += '</table>';
+
+ return content;
+ }
+ },
+
+ boot: function() {
+
+ UI.$win.on("resize orientationchange", function() {
+
+ if (active) {
+ active.hide();
+ }
+ });
+
+ // init code
+ UI.$html.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
+
+ var ele = UI.$(this);
+
+ if (!ele.data("datepicker")) {
+ e.preventDefault();
+ var obj = UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
+ ele.trigger("focus");
+ }
+ });
+
+ UI.$html.on("click.datepicker.uikit", function(e) {
+
+ var target = UI.$(e.target);
+
+ if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
+ active.hide();
+ }
+ });
+ },
+
+ init: function() {
+
+ // use native datepicker on touch devices
+ if (UI.support.touch && this.element.attr('type')=='date' && !this.options.mobile) {
+ return;
+ }
+
+ var $this = this;
+
+ this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
+
+ this.on("click focus", function(){
+ if (active!==$this) $this.pick(this.value ? this.value:($this.options.minDate ? $this.options.minDate :''));
+ }).on("change", function(){
+
+ if ($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
+ $this.element.val(moment().format($this.options.format));
+ }
+ });
+
+ // init dropdown
+ if (!dropdown) {
+
+ dropdown = UI.$('<div class="uk-dropdown uk-datepicker"></div>');
+
+ dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
+
+ e.stopPropagation();
+ e.preventDefault();
+
+ var ele = UI.$(this);
+
+ if (ele.hasClass('uk-datepicker-date-disabled')) return false;
+
+ if (ele.is('[data-date]')) {
+ active.element.val(moment(ele.data("date")).format(active.options.format)).trigger("change");
+ dropdown.hide();
+ active = false;
+ } else {
+ active.add(1 * (ele.hasClass("uk-datepicker-next") ? 1:-1), "months");
+ }
+ });
+
+ dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
+
+ var select = UI.$(this);
+ active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
+ });
+
+ dropdown.appendTo("body");
+ }
+ },
+
+ pick: function(initdate) {
+
+ var offset = this.element.offset(),
+ css = {"left": offset.left, "right":""};
+
+ this.current = initdate ? moment(initdate, this.options.format):moment();
+ this.initdate = this.current.format("YYYY-MM-DD");
+
+ this.update();
+
+ if (UI.langdirection == 'right') {
+ css.right = window.innerWidth - (css.left + this.element.outerWidth());
+ css.left = "";
+ }
+
+ var posTop = (offset.top - this.element.outerHeight() + this.element.height()) - this.options.offsettop - dropdown.outerHeight(),
+ posBottom = offset.top + this.element.outerHeight() + this.options.offsettop;
+
+ css.top = posBottom;
+
+ if (this.options.pos == 'top') {
+ css.top = posTop;
+ } else if(this.options.pos == 'auto' && (window.innerHeight - posBottom - dropdown.outerHeight() < 0 && posTop >= 0) ) {
+ css.top = posTop;
+ }
+
+ dropdown.css(css).show();
+ this.trigger('show.uk.datepicker');
+
+ active = this;
+ },
+
+ add: function(unit, value) {
+ this.current.add(unit, value);
+ this.update();
+ },
+
+ setMonth: function(month) {
+ this.current.month(month);
+ this.update();
+ },
+
+ setYear: function(year) {
+ this.current.year(year);
+ this.update();
+ },
+
+ update: function() {
+
+ var data = this.getRows(this.current.year(), this.current.month()),
+ tpl = this.options.template(data, this.options);
+
+ dropdown.html(tpl);
+
+ this.trigger('update.uk.datepicker');
+ },
+
+ getRows: function(year, month) {
+
+ var opts = this.options,
+ now = moment().format('YYYY-MM-DD'),
+ days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
+ before = new Date(year, month, 1).getDay(),
+ data = {"month":month, "year":year,"weekdays":[],"days":[]},
+ row = [];
+
+ data.weekdays = (function(){
+
+ for (var i=0, arr=[]; i < 7; i++) {
+
+ var day = i + (opts.weekstart || 0);
+
+ while (day >= 7) {
+ day -= 7;
+ }
+
+ arr.push(opts.i18n.weekdays[day]);
+ }
+
+ return arr;
+ })();
+
+ if (opts.weekstart && opts.weekstart > 0) {
+ before -= opts.weekstart;
+ if (before < 0) {
+ before += 7;
+ }
+ }
+
+ var cells = days + before, after = cells;
+
+ while(after > 7) { after -= 7; }
+
+ cells += 7 - after;
+
+ var day, isDisabled, isSelected, isToday, isInMonth;
+
+ for (var i = 0, r = 0; i < cells; i++) {
+
+ day = new Date(year, month, 1 + (i - before));
+ isDisabled = (opts.mindate && day < opts.mindate) || (opts.maxdate && day > opts.maxdate);
+ isInMonth = !(i < before || i >= (days + before));
+
+ day = moment(day);
+
+ isSelected = this.initdate == day.format("YYYY-MM-DD");
+ isToday = now == day.format("YYYY-MM-DD");
+
+ row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
+
+ if (++r === 7) {
+ data.days.push(row);
+ row = [];
+ r = 0;
+ }
+ }
+
+ return data;
+ },
+
+ hide: function() {
+
+ if (active && active === this) {
+ dropdown.hide();
+ active = false;
+
+ this.trigger('hide.uk.datepicker');
+ }
+ }
+ });
+
+ //! moment.js
+ //! version : 2.8.3
+ //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
+ //! license : MIT
+ //! momentjs.com
+
+ moment = (function (undefined) {
+ /************************************
+ Constants
+ ************************************/
+ var moment,
+ VERSION = '2.8.3',
+ // the global-scope this is NOT the global object in Node.js
+ globalScope = typeof global !== 'undefined' ? global : this,
+ oldGlobalMoment,
+ round = Math.round,
+ hasOwnProperty = Object.prototype.hasOwnProperty,
+ i,
+
+ YEAR = 0,
+ MONTH = 1,
+ DATE = 2,
+ HOUR = 3,
+ MINUTE = 4,
+ SECOND = 5,
+ MILLISECOND = 6,
+
+ // internal storage for locale config files
+ locales = {},
+
+ // extra moment internal properties (plugins register props here)
+ momentProperties = [],
+
+ // check for nodeJS
+ hasModule = (typeof module !== 'undefined' && module.exports),
+
+ // ASP.NET json date format regex
+ aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
+ aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
+
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
+ isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
+
+ // format tokens
+ 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,
+ localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
+
+ // parsing token regexes
+ parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
+ parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
+ parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
+ parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
+ parseTokenDigits = /\d+/, // nonzero number of digits
+ 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.
+ parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
+ parseTokenT = /T/i, // T (ISO separator)
+ parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
+ parseTokenOrdinal = /\d{1,2}/,
+
+ //strict parsing regexes
+ parseTokenOneDigit = /\d/, // 0 - 9
+ parseTokenTwoDigits = /\d\d/, // 00 - 99
+ parseTokenThreeDigits = /\d{3}/, // 000 - 999
+ parseTokenFourDigits = /\d{4}/, // 0000 - 9999
+ parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
+ parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
+
+ // iso 8601 regex
+ // 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)
+ 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)?)?$/,
+
+ isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
+
+ isoDates = [
+ ['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}/]
+ ],
+
+ // iso time formats and regexes
+ isoTimes = [
+ ['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/]
+ ],
+
+ // timezone chunker '+10:00' > ['10', '00'] or '-1530' > ['-15', '30']
+ parseTimezoneChunker = /([\+\-]|\d\d)/gi,
+
+ // getter and setter names
+ proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
+ unitMillisecondFactors = {
+ 'Milliseconds' : 1,
+ 'Seconds' : 1e3,
+ 'Minutes' : 6e4,
+ 'Hours' : 36e5,
+ 'Days' : 864e5,
+ 'Months' : 2592e6,
+ 'Years' : 31536e6
+ },
+
+ unitAliases = {
+ 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'
+ },
+
+ camelFunctions = {
+ dayofyear : 'dayOfYear',
+ isoweekday : 'isoWeekday',
+ isoweek : 'isoWeek',
+ weekyear : 'weekYear',
+ isoweekyear : 'isoWeekYear'
+ },
+
+ // format function strings
+ formatFunctions = {},
+
+ // default relative time thresholds
+ relativeTimeThresholds = {
+ s: 45, // seconds to minute
+ m: 45, // minutes to hour
+ h: 22, // hours to day
+ d: 26, // days to month
+ M: 11 // months to year
+ },
+
+ // tokens to ordinalize and pad
+ ordinalizeTokens = 'DDD w W M D d'.split(' '),
+ paddedTokens = 'M D H h m s w W'.split(' '),
+
+ formatTokenFunctions = {
+ M : function () {
+ return this.month() + 1;
+ },
+ MMM : function (format) {
+ return this.localeData().monthsShort(this, format);
+ },
+ MMMM : function (format) {
+ return this.localeData().months(this, format);
+ },
+ D : function () {
+ return this.date();
+ },
+ DDD : function () {
+ return this.dayOfYear();
+ },
+ d : function () {
+ return this.day();
+ },
+ dd : function (format) {
+ return this.localeData().weekdaysMin(this, format);
+ },
+ ddd : function (format) {
+ return this.localeData().weekdaysShort(this, format);
+ },
+ dddd : function (format) {
+ return this.localeData().weekdays(this, format);
+ },
+ w : function () {
+ return this.week();
+ },
+ W : function () {
+ return this.isoWeek();
+ },
+ YY : function () {
+ return leftZeroFill(this.year() % 100, 2);
+ },
+ YYYY : function () {
+ return leftZeroFill(this.year(), 4);
+ },
+ YYYYY : function () {
+ return leftZeroFill(this.year(), 5);
+ },
+ YYYYYY : function () {
+ var y = this.year(), sign = y >= 0 ? '+' : '-';
+ return sign + leftZeroFill(Math.abs(y), 6);
+ },
+ gg : function () {
+ return leftZeroFill(this.weekYear() % 100, 2);
+ },
+ gggg : function () {
+ return leftZeroFill(this.weekYear(), 4);
+ },
+ ggggg : function () {
+ return leftZeroFill(this.weekYear(), 5);
+ },
+ GG : function () {
+ return leftZeroFill(this.isoWeekYear() % 100, 2);
+ },
+ GGGG : function () {
+ return leftZeroFill(this.isoWeekYear(), 4);
+ },
+ GGGGG : function () {
+ return leftZeroFill(this.isoWeekYear(), 5);
+ },
+ e : function () {
+ return this.weekday();
+ },
+ E : function () {
+ return this.isoWeekday();
+ },
+ a : function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), true);
+ },
+ A : function () {
+ return this.localeData().meridiem(this.hours(), this.minutes(), false);
+ },
+ 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 toInt(this.milliseconds() / 100);
+ },
+ SS : function () {
+ return leftZeroFill(toInt(this.milliseconds() / 10), 2);
+ },
+ SSS : function () {
+ return leftZeroFill(this.milliseconds(), 3);
+ },
+ SSSS : function () {
+ return leftZeroFill(this.milliseconds(), 3);
+ },
+ Z : function () {
+ var a = -this.zone(),
+ b = '+';
+ if (a < 0) {
+ a = -a;
+ b = '-';
+ }
+ return b + leftZeroFill(toInt(a / 60), 2) + ':' + leftZeroFill(toInt(a) % 60, 2);
+ },
+ ZZ : function () {
+ var a = -this.zone(),
+ b = '+';
+ if (a < 0) {
+ a = -a;
+ b = '-';
+ }
+ return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
+ },
+ z : function () {
+ return this.zoneAbbr();
+ },
+ zz : function () {
+ return this.zoneName();
+ },
+ X : function () {
+ return this.unix();
+ },
+ Q : function () {
+ return this.quarter();
+ }
+ },
+
+ deprecations = {},
+
+ lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
+
+ // Pick the first defined of two or three arguments. dfl comes from
+ // default.
+ function dfl(a, b, c) {
+ switch (arguments.length) {
+ case 2: return a != null ? a : b;
+ case 3: return a != null ? a : b != null ? b : c;
+ default: throw new Error('Implement me');
+ }
+ }
+
+ function hasOwnProp(a, b) {
+ return hasOwnProperty.call(a, b);
+ }
+
+ function defaultParsingFlags() {
+ // We need to deep clone this object, and es5 standard is not very
+ // helpful.
+ return {
+ empty : false,
+ unusedTokens : [],
+ unusedInput : [],
+ overflow : -2,
+ charsLeftOver : 0,
+ nullInput : false,
+ invalidMonth : null,
+ invalidFormat : false,
+ userInvalidated : false,
+ iso: false
+ };
+ }
+
+ function printMsg(msg) {
+ if (moment.suppressDeprecationWarnings === false &&
+ typeof console !== 'undefined' && console.warn) {
+ console.warn('Deprecation warning: ' + msg);
+ }
+ }
+
+ function deprecate(msg, fn) {
+ var firstTime = true;
+ return extend(function () {
+ if (firstTime) {
+ printMsg(msg);
+ firstTime = false;
+ }
+ return fn.apply(this, arguments);
+ }, fn);
+ }
+
+ function deprecateSimple(name, msg) {
+ if (!deprecations[name]) {
+ printMsg(msg);
+ deprecations[name] = true;
+ }
+ }
+
+ function padToken(func, count) {
+ return function (a) {
+ return leftZeroFill(func.call(this, a), count);
+ };
+ }
+ function ordinalizeToken(func, period) {
+ return function (a) {
+ return this.localeData().ordinal(func.call(this, a), period);
+ };
+ }
+
+ while (ordinalizeTokens.length) {
+ i = ordinalizeTokens.pop();
+ formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
+ }
+ while (paddedTokens.length) {
+ i = paddedTokens.pop();
+ formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
+ }
+ formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
+
+
+ /************************************
+ Constructors
+ ************************************/
+
+ function Locale() {
+ }
+
+ // Moment prototype object
+ function Moment(config, skipOverflow) {
+ if (skipOverflow !== false) {
+ checkOverflow(config);
+ }
+ copyConfig(this, config);
+ this._d = new Date(+config._d);
+ }
+
+ // Duration Constructor
+ function Duration(duration) {
+ var normalizedInput = normalizeObjectUnits(duration),
+ years = normalizedInput.year || 0,
+ quarters = normalizedInput.quarter || 0,
+ months = normalizedInput.month || 0,
+ weeks = normalizedInput.week || 0,
+ days = normalizedInput.day || 0,
+ hours = normalizedInput.hour || 0,
+ minutes = normalizedInput.minute || 0,
+ seconds = normalizedInput.second || 0,
+ milliseconds = normalizedInput.millisecond || 0;
+
+ // representation for dateAddRemove
+ this._milliseconds = +milliseconds +
+ seconds * 1e3 + // 1000
+ minutes * 6e4 + // 1000 * 60
+ hours * 36e5; // 1000 * 60 * 60
+ // Because of dateAddRemove treats 24 hours as different from a
+ // day when working around DST, we need to store them separately
+ this._days = +days +
+ weeks * 7;
+ // It is impossible translate months into days without knowing
+ // which months you are are talking about, so we have to store
+ // it separately.
+ this._months = +months +
+ quarters * 3 +
+ years * 12;
+
+ this._data = {};
+
+ this._locale = moment.localeData();
+
+ this._bubble();
+ }
+
+ /************************************
+ Helpers
+ ************************************/
+
+
+ function extend(a, b) {
+ for (var i in b) {
+ if (hasOwnProp(b, i)) {
+ a[i] = b[i];
+ }
+ }
+
+ if (hasOwnProp(b, 'toString')) {
+ a.toString = b.toString;
+ }
+
+ if (hasOwnProp(b, 'valueOf')) {
+ a.valueOf = b.valueOf;
+ }
+
+ return a;
+ }
+
+ function copyConfig(to, from) {
+ var i, prop, val;
+
+ if (typeof from._isAMomentObject !== 'undefined') {
+ to._isAMomentObject = from._isAMomentObject;
+ }
+ if (typeof from._i !== 'undefined') {
+ to._i = from._i;
+ }
+ if (typeof from._f !== 'undefined') {
+ to._f = from._f;
+ }
+ if (typeof from._l !== 'undefined') {
+ to._l = from._l;
+ }
+ if (typeof from._strict !== 'undefined') {
+ to._strict = from._strict;
+ }
+ if (typeof from._tzm !== 'undefined') {
+ to._tzm = from._tzm;
+ }
+ if (typeof from._isUTC !== 'undefined') {
+ to._isUTC = from._isUTC;
+ }
+ if (typeof from._offset !== 'undefined') {
+ to._offset = from._offset;
+ }
+ if (typeof from._pf !== 'undefined') {
+ to._pf = from._pf;
+ }
+ if (typeof from._locale !== 'undefined') {
+ to._locale = from._locale;
+ }
+
+ if (momentProperties.length > 0) {
+ for (i in momentProperties) {
+ prop = momentProperties[i];
+ val = from[prop];
+ if (typeof val !== 'undefined') {
+ to[prop] = val;
+ }
+ }
+ }
+
+ return to;
+ }
+
+ function absRound(number) {
+ if (number < 0) {
+ return Math.ceil(number);
+ } else {
+ return Math.floor(number);
+ }
+ }
+
+ // left zero fill a number
+ // see http://jsperf.com/left-zero-filling for performance comparison
+ function leftZeroFill(number, targetLength, forceSign) {
+ var output = '' + Math.abs(number),
+ sign = number >= 0;
+
+ while (output.length < targetLength) {
+ output = '0' + output;
+ }
+ return (sign ? (forceSign ? '+' : '') : '-') + output;
+ }
+
+ function positiveMomentsDifference(base, other) {
+ var res = {milliseconds: 0, months: 0};
+
+ res.months = other.month() - base.month() +
+ (other.year() - base.year()) * 12;
+ if (base.clone().add(res.months, 'M').isAfter(other)) {
+ --res.months;
+ }
+
+ res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
+
+ return res;
+ }
+
+ function momentsDifference(base, other) {
+ var res;
+ other = makeAs(other, base);
+ if (base.isBefore(other)) {
+ res = positiveMomentsDifference(base, other);
+ } else {
+ res = positiveMomentsDifference(other, base);
+ res.milliseconds = -res.milliseconds;
+ res.months = -res.months;
+ }
+
+ return res;
+ }
+
+ // TODO: remove 'name' arg after deprecation is removed
+ function createAdder(direction, name) {
+ return function (val, period) {
+ var dur, tmp;
+ //invert the arguments, but complain about it
+ if (period !== null && !isNaN(+period)) {
+ deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
+ tmp = val; val = period; period = tmp;
+ }
+
+ val = typeof val === 'string' ? +val : val;
+ dur = moment.duration(val, period);
+ addOrSubtractDurationFromMoment(this, dur, direction);
+ return this;
+ };
+ }
+
+ function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
+ var milliseconds = duration._milliseconds,
+ days = duration._days,
+ months = duration._months;
+ updateOffset = updateOffset == null ? true : updateOffset;
+
+ if (milliseconds) {
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
+ }
+ if (days) {
+ rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
+ }
+ if (months) {
+ rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
+ }
+ if (updateOffset) {
+ moment.updateOffset(mom, days || months);
+ }
+ }
+
+ // check if is an array
+ function isArray(input) {
+ return Object.prototype.toString.call(input) === '[object Array]';
+ }
+
+ function isDate(input) {
+ return Object.prototype.toString.call(input) === '[object Date]' ||
+ input instanceof Date;
+ }
+
+ // compare two arrays, return the number of differences
+ function compareArrays(array1, array2, dontConvert) {
+ var len = Math.min(array1.length, array2.length),
+ lengthDiff = Math.abs(array1.length - array2.length),
+ diffs = 0,
+ i;
+ for (i = 0; i < len; i++) {
+ if ((dontConvert && array1[i] !== array2[i]) ||
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
+ diffs++;
+ }
+ }
+ return diffs + lengthDiff;
+ }
+
+ function normalizeUnits(units) {
+ if (units) {
+ var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
+ units = unitAliases[units] || camelFunctions[lowered] || lowered;
+ }
+ return units;
+ }
+
+ function normalizeObjectUnits(inputObject) {
+ var normalizedInput = {},
+ normalizedProp,
+ prop;
+
+ for (prop in inputObject) {
+ if (hasOwnProp(inputObject, prop)) {
+ normalizedProp = normalizeUnits(prop);
+ if (normalizedProp) {
+ normalizedInput[normalizedProp] = inputObject[prop];
+ }
+ }
+ }
+
+ return normalizedInput;
+ }
+
+ function makeList(field) {
+ var count, setter;
+
+ if (field.indexOf('week') === 0) {
+ count = 7;
+ setter = 'day';
+ }
+ else if (field.indexOf('month') === 0) {
+ count = 12;
+ setter = 'month';
+ }
+ else {
+ return;
+ }
+
+ moment[field] = function (format, index) {
+ var i, getter,
+ method = moment._locale[field],
+ results = [];
+
+ if (typeof format === 'number') {
+ index = format;
+ format = undefined;
+ }
+
+ getter = function (i) {
+ var m = moment().utc().set(setter, i);
+ return method.call(moment._locale, m, format || '');
+ };
+
+ if (index != null) {
+ return getter(index);
+ }
+ else {
+ for (i = 0; i < count; i++) {
+ results.push(getter(i));
+ }
+ return results;
+ }
+ };
+ }
+
+ function toInt(argumentForCoercion) {
+ var coercedNumber = +argumentForCoercion,
+ value = 0;
+
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+ if (coercedNumber >= 0) {
+ value = Math.floor(coercedNumber);
+ } else {
+ value = Math.ceil(coercedNumber);
+ }
+ }
+
+ return value;
+ }
+
+ function daysInMonth(year, month) {
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
+ }
+
+ function weeksInYear(year, dow, doy) {
+ return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
+ }
+
+ function daysInYear(year) {
+ return isLeapYear(year) ? 366 : 365;
+ }
+
+ function isLeapYear(year) {
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+ }
+
+ function checkOverflow(m) {
+ var overflow;
+ if (m._a && m._pf.overflow === -2) {
+ overflow =
+ m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
+ m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
+ m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
+ m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
+ m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
+ m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
+ -1;
+
+ if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
+ overflow = DATE;
+ }
+
+ m._pf.overflow = overflow;
+ }
+ }
+
+ function isValid(m) {
+ if (m._isValid == null) {
+ m._isValid = !isNaN(m._d.getTime()) &&
+ m._pf.overflow < 0 &&
+ !m._pf.empty &&
+ !m._pf.invalidMonth &&
+ !m._pf.nullInput &&
+ !m._pf.invalidFormat &&
+ !m._pf.userInvalidated;
+
+ if (m._strict) {
+ m._isValid = m._isValid &&
+ m._pf.charsLeftOver === 0 &&
+ m._pf.unusedTokens.length === 0;
+ }
+ }
+ return m._isValid;
+ }
+
+ function normalizeLocale(key) {
+ return key ? key.toLowerCase().replace('_', '-') : key;
+ }
+
+ // pick the locale from the array
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
+ function chooseLocale(names) {
+ var i = 0, j, next, locale, split;
+
+ while (i < names.length) {
+ split = normalizeLocale(names[i]).split('-');
+ j = split.length;
+ next = normalizeLocale(names[i + 1]);
+ next = next ? next.split('-') : null;
+ while (j > 0) {
+ locale = loadLocale(split.slice(0, j).join('-'));
+ if (locale) {
+ return locale;
+ }
+ if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
+ //the next array item is better than a shallower substring of this one
+ break;
+ }
+ j--;
+ }
+ i++;
+ }
+ return null;
+ }
+
+ function loadLocale(name) {
+ var oldLocale = null;
+ if (!locales[name] && hasModule) {
+ try {
+ oldLocale = moment.locale();
+ require('./locale/' + name);
+ // because defineLocale currently also sets the global locale, we want to undo that for lazy loaded locales
+ moment.locale(oldLocale);
+ } catch (e) { }
+ }
+ return locales[name];
+ }
+
+ // Return a moment from input, that is local/utc/zone equivalent to model.
+ function makeAs(input, model) {
+ return model._isUTC ? moment(input).zone(model._offset || 0) :
+ moment(input).local();
+ }
+
+ /************************************
+ Locale
+ ************************************/
+
+
+ extend(Locale.prototype, {
+
+ set : function (config) {
+ var prop, i;
+ for (i in config) {
+ prop = config[i];
+ if (typeof prop === 'function') {
+ this[i] = prop;
+ } else {
+ this['_' + i] = prop;
+ }
+ }
+ },
+
+ _months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
+ months : function (m) {
+ return this._months[m.month()];
+ },
+
+ _monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
+ monthsShort : function (m) {
+ return this._monthsShort[m.month()];
+ },
+
+ monthsParse : function (monthName) {
+ var i, mom, regex;
+
+ if (!this._monthsParse) {
+ this._monthsParse = [];
+ }
+
+ for (i = 0; i < 12; i++) {
+ // make the regex if we don't have it already
+ if (!this._monthsParse[i]) {
+ mom = moment.utc([2000, i]);
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (this._monthsParse[i].test(monthName)) {
+ return i;
+ }
+ }
+ },
+
+ _weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
+ weekdays : function (m) {
+ return this._weekdays[m.day()];
+ },
+
+ _weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
+ weekdaysShort : function (m) {
+ return this._weekdaysShort[m.day()];
+ },
+
+ _weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
+ weekdaysMin : function (m) {
+ return this._weekdaysMin[m.day()];
+ },
+
+ weekdaysParse : function (weekdayName) {
+ var i, mom, regex;
+
+ if (!this._weekdaysParse) {
+ this._weekdaysParse = [];
+ }
+
+ for (i = 0; i < 7; i++) {
+ // make the regex if we don't have it already
+ if (!this._weekdaysParse[i]) {
+ mom = moment([2000, 1]).day(i);
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
+ }
+ // test the regex
+ if (this._weekdaysParse[i].test(weekdayName)) {
+ return i;
+ }
+ }
+ },
+
+ _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 (key) {
+ var output = this._longDateFormat[key];
+ if (!output && this._longDateFormat[key.toUpperCase()]) {
+ output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
+ return val.slice(1);
+ });
+ this._longDateFormat[key] = output;
+ }
+ return output;
+ },
+
+ isPM : function (input) {
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
+ // Using charAt should be more compatible.
+ return ((input + '').toLowerCase().charAt(0) === 'p');
+ },
+
+ _meridiemParse : /[ap]\.?m?\.?/i,
+ meridiem : function (hours, minutes, isLower) {
+ if (hours > 11) {
+ return isLower ? 'pm' : 'PM';
+ } else {
+ return isLower ? '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 (key, mom) {
+ var output = this._calendar[key];
+ return typeof output === 'function' ? output.apply(mom) : output;
+ },
+
+ _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 (number, withoutSuffix, string, isFuture) {
+ var output = this._relativeTime[string];
+ return (typeof output === 'function') ?
+ output(number, withoutSuffix, string, isFuture) :
+ output.replace(/%d/i, number);
+ },
+
+ pastFuture : function (diff, output) {
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
+ return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
+ },
+
+ ordinal : function (number) {
+ return this._ordinal.replace('%d', number);
+ },
+ _ordinal : '%d',
+
+ preparse : function (string) {
+ return string;
+ },
+
+ postformat : function (string) {
+ return string;
+ },
+
+ week : function (mom) {
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
+ },
+
+ _week : {
+ dow : 0, // Sunday is the first day of the week.
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
+ },
+
+ _invalidDate: 'Invalid date',
+ invalidDate: function () {
+ return this._invalidDate;
+ }
+ });
+
+ /************************************
+ Formatting
+ ************************************/
+
+
+ function removeFormattingTokens(input) {
+ if (input.match(/\[[\s\S]/)) {
+ return input.replace(/^\[|\]$/g, '');
+ }
+ return input.replace(/\\/g, '');
+ }
+
+ function makeFormatFunction(format) {
+ var array = format.match(formattingTokens), i, length;
+
+ for (i = 0, length = array.length; i < length; i++) {
+ if (formatTokenFunctions[array[i]]) {
+ array[i] = formatTokenFunctions[array[i]];
+ } else {
+ array[i] = removeFormattingTokens(array[i]);
+ }
+ }
+
+ return function (mom) {
+ var output = '';
+ for (i = 0; i < length; i++) {
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
+ }
+ return output;
+ };
+ }
+
+ // format date using native date object
+ function formatMoment(m, format) {
+ if (!m.isValid()) {
+ return m.localeData().invalidDate();
+ }
+
+ format = expandFormat(format, m.localeData());
+
+ if (!formatFunctions[format]) {
+ formatFunctions[format] = makeFormatFunction(format);
+ }
+
+ return formatFunctions[format](m);
+ }
+
+ function expandFormat(format, locale) {
+ var i = 5;
+
+ function replaceLongDateFormatTokens(input) {
+ return locale.longDateFormat(input) || input;
+ }
+
+ localFormattingTokens.lastIndex = 0;
+ while (i >= 0 && localFormattingTokens.test(format)) {
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
+ localFormattingTokens.lastIndex = 0;
+ i -= 1;
+ }
+
+ return format;
+ }
+
+
+ /************************************
+ Parsing
+ ************************************/
+
+
+ // get the regex to find the next token
+ function getParseRegexForToken(token, config) {
+ var a, strict = config._strict;
+ switch (token) {
+ case 'Q':
+ return parseTokenOneDigit;
+ case 'DDDD':
+ return parseTokenThreeDigits;
+ case 'YYYY':
+ case 'GGGG':
+ case 'gggg':
+ return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
+ case 'Y':
+ case 'G':
+ case 'g':
+ return parseTokenSignedNumber;
+ case 'YYYYYY':
+ case 'YYYYY':
+ case 'GGGGG':
+ case 'ggggg':
+ return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
+ case 'S':
+ if (strict) {
+ return parseTokenOneDigit;
+ }
+ /* falls through */
+ case 'SS':
+ if (strict) {
+ return parseTokenTwoDigits;
+ }
+ /* falls through */
+ case 'SSS':
+ if (strict) {
+ return parseTokenThreeDigits;
+ }
+ /* falls through */
+ case 'DDD':
+ return parseTokenOneToThreeDigits;
+ case 'MMM':
+ case 'MMMM':
+ case 'dd':
+ case 'ddd':
+ case 'dddd':
+ return parseTokenWord;
+ case 'a':
+ case 'A':
+ return config._locale._meridiemParse;
+ case 'X':
+ return parseTokenTimestampMs;
+ case 'Z':
+ case 'ZZ':
+ return parseTokenTimezone;
+ case 'T':
+ return parseTokenT;
+ case 'SSSS':
+ return parseTokenDigits;
+ case 'MM':
+ case 'DD':
+ case 'YY':
+ case 'GG':
+ case 'gg':
+ case 'HH':
+ case 'hh':
+ case 'mm':
+ case 'ss':
+ case 'ww':
+ case 'WW':
+ return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
+ case 'M':
+ case 'D':
+ case 'd':
+ case 'H':
+ case 'h':
+ case 'm':
+ case 's':
+ case 'w':
+ case 'W':
+ case 'e':
+ case 'E':
+ return parseTokenOneOrTwoDigits;
+ case 'Do':
+ return parseTokenOrdinal;
+ default :
+ a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i'));
+ return a;
+ }
+ }
+
+ function timezoneMinutesFromString(string) {
+ string = string || '';
+ var possibleTzMatches = (string.match(parseTokenTimezone) || []),
+ tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
+ parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
+ minutes = +(parts[1] * 60) + toInt(parts[2]);
+
+ return parts[0] === '+' ? -minutes : minutes;
+ }
+
+ // function to convert string input to date
+ function addTimeToArrayFromToken(token, input, config) {
+ var a, datePartArray = config._a;
+
+ switch (token) {
+ // QUARTER
+ case 'Q':
+ if (input != null) {
+ datePartArray[MONTH] = (toInt(input) - 1) * 3;
+ }
+ break;
+ // MONTH
+ case 'M' : // fall through to MM
+ case 'MM' :
+ if (input != null) {
+ datePartArray[MONTH] = toInt(input) - 1;
+ }
+ break;
+ case 'MMM' : // fall through to MMMM
+ case 'MMMM' :
+ a = config._locale.monthsParse(input);
+ // if we didn't find a month name, mark the date as invalid.
+ if (a != null) {
+ datePartArray[MONTH] = a;
+ } else {
+ config._pf.invalidMonth = input;
+ }
+ break;
+ // DAY OF MONTH
+ case 'D' : // fall through to DD
+ case 'DD' :
+ if (input != null) {
+ datePartArray[DATE] = toInt(input);
+ }
+ break;
+ case 'Do' :
+ if (input != null) {
+ datePartArray[DATE] = toInt(parseInt(input, 10));
+ }
+ break;
+ // DAY OF YEAR
+ case 'DDD' : // fall through to DDDD
+ case 'DDDD' :
+ if (input != null) {
+ config._dayOfYear = toInt(input);
+ }
+
+ break;
+ // YEAR
+ case 'YY' :
+ datePartArray[YEAR] = moment.parseTwoDigitYear(input);
+ break;
+ case 'YYYY' :
+ case 'YYYYY' :
+ case 'YYYYYY' :
+ datePartArray[YEAR] = toInt(input);
+ break;
+ // AM / PM
+ case 'a' : // fall through to A
+ case 'A' :
+ config._isPm = config._locale.isPM(input);
+ break;
+ // 24 HOUR
+ case 'H' : // fall through to hh
+ case 'HH' : // fall through to hh
+ case 'h' : // fall through to hh
+ case 'hh' :
+ datePartArray[HOUR] = toInt(input);
+ break;
+ // MINUTE
+ case 'm' : // fall through to mm
+ case 'mm' :
+ datePartArray[MINUTE] = toInt(input);
+ break;
+ // SECOND
+ case 's' : // fall through to ss
+ case 'ss' :
+ datePartArray[SECOND] = toInt(input);
+ break;
+ // MILLISECOND
+ case 'S' :
+ case 'SS' :
+ case 'SSS' :
+ case 'SSSS' :
+ datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
+ break;
+ // UNIX TIMESTAMP WITH MS
+ case 'X':
+ config._d = new Date(parseFloat(input) * 1000);
+ break;
+ // TIMEZONE
+ case 'Z' : // fall through to ZZ
+ case 'ZZ' :
+ config._useUTC = true;
+ config._tzm = timezoneMinutesFromString(input);
+ break;
+ // WEEKDAY - human
+ case 'dd':
+ case 'ddd':
+ case 'dddd':
+ a = config._locale.weekdaysParse(input);
+ // if we didn't get a weekday name, mark the date as invalid
+ if (a != null) {
+ config._w = config._w || {};
+ config._w['d'] = a;
+ } else {
+ config._pf.invalidWeekday = input;
+ }
+ break;
+ // WEEK, WEEK DAY - numeric
+ case 'w':
+ case 'ww':
+ case 'W':
+ case 'WW':
+ case 'd':
+ case 'e':
+ case 'E':
+ token = token.substr(0, 1);
+ /* falls through */
+ case 'gggg':
+ case 'GGGG':
+ case 'GGGGG':
+ token = token.substr(0, 2);
+ if (input) {
+ config._w = config._w || {};
+ config._w[token] = toInt(input);
+ }
+ break;
+ case 'gg':
+ case 'GG':
+ config._w = config._w || {};
+ config._w[token] = moment.parseTwoDigitYear(input);
+ }
+ }
+
+ function dayOfYearFromWeekInfo(config) {
+ var w, weekYear, week, weekday, dow, doy, temp;
+
+ w = config._w;
+ if (w.GG != null || w.W != null || w.E != null) {
+ dow = 1;
+ doy = 4;
+
+ // TODO: We need to take the current isoWeekYear, but that depends on
+ // how we interpret now (local, utc, fixed offset). So create
+ // a now version of current config (take local/utc/offset flags, and
+ // create now).
+ weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year);
+ week = dfl(w.W, 1);
+ weekday = dfl(w.E, 1);
+ } else {
+ dow = config._locale._week.dow;
+ doy = config._locale._week.doy;
+
+ weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year);
+ week = dfl(w.w, 1);
+
+ if (w.d != null) {
+ // weekday -- low day numbers are considered next week
+ weekday = w.d;
+ if (weekday < dow) {
+ ++week;
+ }
+ } else if (w.e != null) {
+ // local weekday -- counting starts from begining of week
+ weekday = w.e + dow;
+ } else {
+ // default to begining of week
+ weekday = dow;
+ }
+ }
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
+
+ config._a[YEAR] = temp.year;
+ config._dayOfYear = temp.dayOfYear;
+ }
+
+ // convert an array to a date.
+ // the array should mirror the parameters below
+ // note: all values past the year are optional and will default to the lowest possible value.
+ // [year, month, day , hour, minute, second, millisecond]
+ function dateFromConfig(config) {
+ var i, date, input = [], currentDate, yearToUse;
+
+ if (config._d) {
+ return;
+ }
+
+ currentDate = currentDateArray(config);
+
+ //compute day of the year from weeks and weekdays
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
+ dayOfYearFromWeekInfo(config);
+ }
+
+ //if the day of the year is set, figure out what it is
+ if (config._dayOfYear) {
+ yearToUse = dfl(config._a[YEAR], currentDate[YEAR]);
+
+ if (config._dayOfYear > daysInYear(yearToUse)) {
+ config._pf._overflowDayOfYear = true;
+ }
+
+ date = makeUTCDate(yearToUse, 0, config._dayOfYear);
+ config._a[MONTH] = date.getUTCMonth();
+ config._a[DATE] = date.getUTCDate();
+ }
+
+ // Default to current date.
+ // * if no year, month, day of month are given, default to today
+ // * if day of month is given, default month and year
+ // * if month is given, default only year
+ // * if year is given, don't default anything
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
+ config._a[i] = input[i] = currentDate[i];
+ }
+
+ // Zero out whatever was not defaulted, including time
+ for (; i < 7; i++) {
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
+ }
+
+ config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
+ // Apply timezone offset from input. The actual zone can be changed
+ // with parseZone.
+ if (config._tzm != null) {
+ config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
+ }
+ }
+
+ function dateFromObject(config) {
+ var normalizedInput;
+
+ if (config._d) {
+ return;
+ }
+
+ normalizedInput = normalizeObjectUnits(config._i);
+ config._a = [
+ normalizedInput.year,
+ normalizedInput.month,
+ normalizedInput.day,
+ normalizedInput.hour,
+ normalizedInput.minute,
+ normalizedInput.second,
+ normalizedInput.millisecond
+ ];
+
+ dateFromConfig(config);
+ }
+
+ function currentDateArray(config) {
+ var now = new Date();
+ if (config._useUTC) {
+ return [
+ now.getUTCFullYear(),
+ now.getUTCMonth(),
+ now.getUTCDate()
+ ];
+ } else {
+ return [now.getFullYear(), now.getMonth(), now.getDate()];
+ }
+ }
+
+ // date from string and format string
+ function makeDateFromStringAndFormat(config) {
+ if (config._f === moment.ISO_8601) {
+ parseISO(config);
+ return;
+ }
+
+ config._a = [];
+ config._pf.empty = true;
+
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
+ var string = '' + config._i,
+ i, parsedInput, tokens, token, skipped,
+ stringLength = string.length,
+ totalParsedInputLength = 0;
+
+ tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
+
+ for (i = 0; i < tokens.length; i++) {
+ token = tokens[i];
+ parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
+ if (parsedInput) {
+ skipped = string.substr(0, string.indexOf(parsedInput));
+ if (skipped.length > 0) {
+ config._pf.unusedInput.push(skipped);
+ }
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
+ totalParsedInputLength += parsedInput.length;
+ }
+ // don't parse if it's not a known token
+ if (formatTokenFunctions[token]) {
+ if (parsedInput) {
+ config._pf.empty = false;
+ }
+ else {
+ config._pf.unusedTokens.push(token);
+ }
+ addTimeToArrayFromToken(token, parsedInput, config);
+ }
+ else if (config._strict && !parsedInput) {
+ config._pf.unusedTokens.push(token);
+ }
+ }
+
+ // add remaining unparsed input length to the string
+ config._pf.charsLeftOver = stringLength - totalParsedInputLength;
+ if (string.length > 0) {
+ config._pf.unusedInput.push(string);
+ }
+
+ // handle am pm
+ if (config._isPm && config._a[HOUR] < 12) {
+ config._a[HOUR] += 12;
+ }
+ // if is 12 am, change hours to 0
+ if (config._isPm === false && config._a[HOUR] === 12) {
+ config._a[HOUR] = 0;
+ }
+
+ dateFromConfig(config);
+ checkOverflow(config);
+ }
+
+ function unescapeFormat(s) {
+ return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
+ return p1 || p2 || p3 || p4;
+ });
+ }
+
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+ function regexpEscape(s) {
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ }
+
+ // date from string and array of format strings
+ function makeDateFromStringAndArray(config) {
+ var tempConfig,
+ bestMoment,
+
+ scoreToBeat,
+ i,
+ currentScore;
+
+ if (config._f.length === 0) {
+ config._pf.invalidFormat = true;
+ config._d = new Date(NaN);
+ return;
+ }
+
+ for (i = 0; i < config._f.length; i++) {
+ currentScore = 0;
+ tempConfig = copyConfig({}, config);
+ if (config._useUTC != null) {
+ tempConfig._useUTC = config._useUTC;
+ }
+ tempConfig._pf = defaultParsingFlags();
+ tempConfig._f = config._f[i];
+ makeDateFromStringAndFormat(tempConfig);
+
+ if (!isValid(tempConfig)) {
+ continue;
+ }
+
+ // if there is any input that was not parsed add a penalty for that format
+ currentScore += tempConfig._pf.charsLeftOver;
+
+ //or tokens
+ currentScore += tempConfig._pf.unusedTokens.length * 10;
+
+ tempConfig._pf.score = currentScore;
+
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
+ scoreToBeat = currentScore;
+ bestMoment = tempConfig;
+ }
+ }
+
+ extend(config, bestMoment || tempConfig);
+ }
+
+ // date from iso format
+ function parseISO(config) {
+ var i, l,
+ string = config._i,
+ match = isoRegex.exec(string);
+
+ if (match) {
+ config._pf.iso = true;
+ for (i = 0, l = isoDates.length; i < l; i++) {
+ if (isoDates[i][1].exec(string)) {
+ // match[5] should be 'T' or undefined
+ config._f = isoDates[i][0] + (match[6] || ' ');
+ break;
+ }
+ }
+ for (i = 0, l = isoTimes.length; i < l; i++) {
+ if (isoTimes[i][1].exec(string)) {
+ config._f += isoTimes[i][0];
+ break;
+ }
+ }
+ if (string.match(parseTokenTimezone)) {
+ config._f += 'Z';
+ }
+ makeDateFromStringAndFormat(config);
+ } else {
+ config._isValid = false;
+ }
+ }
+
+ // date from iso format or fallback
+ function makeDateFromString(config) {
+ parseISO(config);
+ if (config._isValid === false) {
+ delete config._isValid;
+ moment.createFromInputFallback(config);
+ }
+ }
+
+ function map(arr, fn) {
+ var res = [], i;
+ for (i = 0; i < arr.length; ++i) {
+ res.push(fn(arr[i], i));
+ }
+ return res;
+ }
+
+ function makeDateFromInput(config) {
+ var input = config._i, matched;
+ if (input === undefined) {
+ config._d = new Date();
+ } else if (isDate(input)) {
+ config._d = new Date(+input);
+ } else if ((matched = aspNetJsonRegex.exec(input)) !== null) {
+ config._d = new Date(+matched[1]);
+ } else if (typeof input === 'string') {
+ makeDateFromString(config);
+ } else if (isArray(input)) {
+ config._a = map(input.slice(0), function (obj) {
+ return parseInt(obj, 10);
+ });
+ dateFromConfig(config);
+ } else if (typeof(input) === 'object') {
+ dateFromObject(config);
+ } else if (typeof(input) === 'number') {
+ // from milliseconds
+ config._d = new Date(input);
+ } else {
+ moment.createFromInputFallback(config);
+ }
+ }
+
+ function makeDate(y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor doesn't accept years < 1970
+ if (y < 1970) {
+ date.setFullYear(y);
+ }
+ return date;
+ }
+
+ function makeUTCDate(y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+ if (y < 1970) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+ }
+
+ function parseWeekday(input, locale) {
+ if (typeof input === 'string') {
+ if (!isNaN(input)) {
+ input = parseInt(input, 10);
+ }
+ else {
+ input = locale.weekdaysParse(input);
+ if (typeof input !== 'number') {
+ return null;
+ }
+ }
+ }
+ return input;
+ }
+
+ /************************************
+ Relative Time
+ ************************************/
+
+
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
+ }
+
+ function relativeTime(posNegDuration, withoutSuffix, locale) {
+ var duration = moment.duration(posNegDuration).abs(),
+ seconds = round(duration.as('s')),
+ minutes = round(duration.as('m')),
+ hours = round(duration.as('h')),
+ days = round(duration.as('d')),
+ months = round(duration.as('M')),
+ years = round(duration.as('y')),
+
+ args = seconds < relativeTimeThresholds.s && ['s', seconds] ||
+ minutes === 1 && ['m'] ||
+ minutes < relativeTimeThresholds.m && ['mm', minutes] ||
+ hours === 1 && ['h'] ||
+ hours < relativeTimeThresholds.h && ['hh', hours] ||
+ days === 1 && ['d'] ||
+ days < relativeTimeThresholds.d && ['dd', days] ||
+ months === 1 && ['M'] ||
+ months < relativeTimeThresholds.M && ['MM', months] ||
+ years === 1 && ['y'] || ['yy', years];
+
+ args[2] = withoutSuffix;
+ args[3] = +posNegDuration > 0;
+ args[4] = locale;
+ return substituteTimeAgo.apply({}, args);
+ }
+
+
+ /************************************
+ Week of Year
+ ************************************/
+
+
+ // firstDayOfWeek 0 = sun, 6 = sat
+ // the day of the week that starts the week
+ // (usually sunday or monday)
+ // firstDayOfWeekOfYear 0 = sun, 6 = sat
+ // the first week is the week that contains the first
+ // of this day of the week
+ // (eg. ISO weeks use thursday (4))
+ function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
+ var end = firstDayOfWeekOfYear - firstDayOfWeek,
+ daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
+ adjustedMoment;
+
+
+ if (daysToDayOfWeek > end) {
+ daysToDayOfWeek -= 7;
+ }
+
+ if (daysToDayOfWeek < end - 7) {
+ daysToDayOfWeek += 7;
+ }
+
+ adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');
+ return {
+ week: Math.ceil(adjustedMoment.dayOfYear() / 7),
+ year: adjustedMoment.year()
+ };
+ }
+
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
+ function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
+ var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
+
+ d = d === 0 ? 7 : d;
+ weekday = weekday != null ? weekday : firstDayOfWeek;
+ daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
+ dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
+
+ return {
+ year: dayOfYear > 0 ? year : year - 1,
+ dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
+ };
+ }
+
+ /************************************
+ Top Level Functions
+ ************************************/
+
+ function makeMoment(config) {
+ var input = config._i,
+ format = config._f;
+
+ config._locale = config._locale || moment.localeData(config._l);
+
+ if (input === null || (format === undefined && input === '')) {
+ return moment.invalid({nullInput: true});
+ }
+
+ if (typeof input === 'string') {
+ config._i = input = config._locale.preparse(input);
+ }
+
+ if (moment.isMoment(input)) {
+ return new Moment(input, true);
+ } else if (format) {
+ if (isArray(format)) {
+ makeDateFromStringAndArray(config);
+ } else {
+ makeDateFromStringAndFormat(config);
+ }
+ } else {
+ makeDateFromInput(config);
+ }
+
+ return new Moment(config);
+ }
+
+ moment = function (input, format, locale, strict) {
+ var c;
+
+ if (typeof(locale) === 'boolean') {
+ strict = locale;
+ locale = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c = {};
+ c._isAMomentObject = true;
+ c._i = input;
+ c._f = format;
+ c._l = locale;
+ c._strict = strict;
+ c._isUTC = false;
+ c._pf = defaultParsingFlags();
+
+ return makeMoment(c);
+ };
+
+ moment.suppressDeprecationWarnings = false;
+
+ moment.createFromInputFallback = deprecate(
+ '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 (config) {
+ config._d = new Date(config._i);
+ }
+ );
+
+ // Pick a moment m from moments so that m[fn](other) is true for all
+ // other. This relies on the function fn to be transitive.
+ //
+ // moments should either be an array of moment objects or an array, whose
+ // first element is an array of moment objects.
+ function pickBy(fn, moments) {
+ var res, i;
+ if (moments.length === 1 && isArray(moments[0])) {
+ moments = moments[0];
+ }
+ if (!moments.length) {
+ return moment();
+ }
+ res = moments[0];
+ for (i = 1; i < moments.length; ++i) {
+ if (moments[i][fn](res)) {
+ res = moments[i];
+ }
+ }
+ return res;
+ }
+
+ moment.min = function () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isBefore', args);
+ };
+
+ moment.max = function () {
+ var args = [].slice.call(arguments, 0);
+
+ return pickBy('isAfter', args);
+ };
+
+ // creating with utc
+ moment.utc = function (input, format, locale, strict) {
+ var c;
+
+ if (typeof(locale) === 'boolean') {
+ strict = locale;
+ locale = undefined;
+ }
+ // object construction must be done this way.
+ // https://github.com/moment/moment/issues/1423
+ c = {};
+ c._isAMomentObject = true;
+ c._useUTC = true;
+ c._isUTC = true;
+ c._l = locale;
+ c._i = input;
+ c._f = format;
+ c._strict = strict;
+ c._pf = defaultParsingFlags();
+
+ return makeMoment(c).utc();
+ };
+
+ // creating with unix timestamp (in seconds)
+ moment.unix = function (input) {
+ return moment(input * 1000);
+ };
+
+ // duration
+ moment.duration = function (input, key) {
+ var duration = input,
+ // matching against regexp is expensive, do it on demand
+ match = null,
+ sign,
+ ret,
+ parseIso,
+ diffRes;
+
+ if (moment.isDuration(input)) {
+ duration = {
+ ms: input._milliseconds,
+ d: input._days,
+ M: input._months
+ };
+ } else if (typeof input === 'number') {
+ duration = {};
+ if (key) {
+ duration[key] = input;
+ } else {
+ duration.milliseconds = input;
+ }
+ } else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ duration = {
+ y: 0,
+ d: toInt(match[DATE]) * sign,
+ h: toInt(match[HOUR]) * sign,
+ m: toInt(match[MINUTE]) * sign,
+ s: toInt(match[SECOND]) * sign,
+ ms: toInt(match[MILLISECOND]) * sign
+ };
+ } else if (!!(match = isoDurationRegex.exec(input))) {
+ sign = (match[1] === '-') ? -1 : 1;
+ parseIso = function (inp) {
+ // We'd normally use ~~inp for this, but unfortunately it also
+ // converts floats to ints.
+ // inp may be undefined, so careful calling replace on it.
+ var res = inp && parseFloat(inp.replace(',', '.'));
+ // apply sign while we're at it
+ return (isNaN(res) ? 0 : res) * sign;
+ };
+ duration = {
+ y: parseIso(match[2]),
+ M: parseIso(match[3]),
+ d: parseIso(match[4]),
+ h: parseIso(match[5]),
+ m: parseIso(match[6]),
+ s: parseIso(match[7]),
+ w: parseIso(match[8])
+ };
+ } else if (typeof duration === 'object' &&
+ ('from' in duration || 'to' in duration)) {
+ diffRes = momentsDifference(moment(duration.from), moment(duration.to));
+
+ duration = {};
+ duration.ms = diffRes.milliseconds;
+ duration.M = diffRes.months;
+ }
+
+ ret = new Duration(duration);
+
+ if (moment.isDuration(input) && hasOwnProp(input, '_locale')) {
+ ret._locale = input._locale;
+ }
+
+ return ret;
+ };
+
+ // version number
+ moment.version = VERSION;
+
+ // default format
+ moment.defaultFormat = isoFormat;
+
+ // constant that refers to the ISO standard
+ moment.ISO_8601 = function () {};
+
+ // Plugins that add properties should also add the key here (null value),
+ // so we can properly clone ourselves.
+ moment.momentProperties = momentProperties;
+
+ // This function will be called whenever a moment is mutated.
+ // It is intended to keep the offset in sync with the timezone.
+ moment.updateOffset = function () {};
+
+ // This function allows you to set a threshold for relative time strings
+ moment.relativeTimeThreshold = function (threshold, limit) {
+ if (relativeTimeThresholds[threshold] === undefined) {
+ return false;
+ }
+ if (limit === undefined) {
+ return relativeTimeThresholds[threshold];
+ }
+ relativeTimeThresholds[threshold] = limit;
+ return true;
+ };
+
+ moment.lang = deprecate(
+ 'moment.lang is deprecated. Use moment.locale instead.',
+ function (key, value) {
+ return moment.locale(key, value);
+ }
+ );
+
+ // This function will load locale and then set the global locale. If
+ // no arguments are passed in, it will simply return the current global
+ // locale key.
+ moment.locale = function (key, values) {
+ var data;
+ if (key) {
+ if (typeof(values) !== 'undefined') {
+ data = moment.defineLocale(key, values);
+ }
+ else {
+ data = moment.localeData(key);
+ }
+
+ if (data) {
+ moment.duration._locale = moment._locale = data;
+ }
+ }
+
+ return moment._locale._abbr;
+ };
+
+ moment.defineLocale = function (name, values) {
+ if (values !== null) {
+ values.abbr = name;
+ if (!locales[name]) {
+ locales[name] = new Locale();
+ }
+ locales[name].set(values);
+
+ // backwards compat for now: also set the locale
+ moment.locale(name);
+
+ return locales[name];
+ } else {
+ // useful for testing
+ delete locales[name];
+ return null;
+ }
+ };
+
+ moment.langData = deprecate(
+ 'moment.langData is deprecated. Use moment.localeData instead.',
+ function (key) {
+ return moment.localeData(key);
+ }
+ );
+
+ // returns locale data
+ moment.localeData = function (key) {
+ var locale;
+
+ if (key && key._locale && key._locale._abbr) {
+ key = key._locale._abbr;
+ }
+
+ if (!key) {
+ return moment._locale;
+ }
+
+ if (!isArray(key)) {
+ //short-circuit everything else
+ locale = loadLocale(key);
+ if (locale) {
+ return locale;
+ }
+ key = [key];
+ }
+
+ return chooseLocale(key);
+ };
+
+ // compare moment object
+ moment.isMoment = function (obj) {
+ return obj instanceof Moment ||
+ (obj != null && hasOwnProp(obj, '_isAMomentObject'));
+ };
+
+ // for typechecking Duration objects
+ moment.isDuration = function (obj) {
+ return obj instanceof Duration;
+ };
+
+ for (i = lists.length - 1; i >= 0; --i) {
+ makeList(lists[i]);
+ }
+
+ moment.normalizeUnits = function (units) {
+ return normalizeUnits(units);
+ };
+
+ moment.invalid = function (flags) {
+ var m = moment.utc(NaN);
+ if (flags != null) {
+ extend(m._pf, flags);
+ }
+ else {
+ m._pf.userInvalidated = true;
+ }
+
+ return m;
+ };
+
+ moment.parseZone = function () {
+ return moment.apply(null, arguments).parseZone();
+ };
+
+ moment.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ };
+
+ /************************************
+ Moment Prototype
+ ************************************/
+
+
+ extend(moment.fn = Moment.prototype, {
+
+ clone : function () {
+ return moment(this);
+ },
+
+ valueOf : function () {
+ return +this._d + ((this._offset || 0) * 60000);
+ },
+
+ unix : function () {
+ return Math.floor(+this / 1000);
+ },
+
+ 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 m = moment(this).utc();
+ if (0 < m.year() && m.year() <= 9999) {
+ return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ } else {
+ return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ }
+ },
+
+ toArray : function () {
+ var m = this;
+ return [
+ m.year(),
+ m.month(),
+ m.date(),
+ m.hours(),
+ m.minutes(),
+ m.seconds(),
+ m.milliseconds()
+ ];
+ },
+
+ isValid : function () {
+ return isValid(this);
+ },
+
+ isDSTShifted : function () {
+ if (this._a) {
+ return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
+ }
+
+ return false;
+ },
+
+ parsingFlags : function () {
+ return extend({}, this._pf);
+ },
+
+ invalidAt: function () {
+ return this._pf.overflow;
+ },
+
+ utc : function (keepLocalTime) {
+ return this.zone(0, keepLocalTime);
+ },
+
+ local : function (keepLocalTime) {
+ if (this._isUTC) {
+ this.zone(0, keepLocalTime);
+ this._isUTC = false;
+
+ if (keepLocalTime) {
+ this.add(this._dateTzOffset(), 'm');
+ }
+ }
+ return this;
+ },
+
+ format : function (inputString) {
+ var output = formatMoment(this, inputString || moment.defaultFormat);
+ return this.localeData().postformat(output);
+ },
+
+ add : createAdder(1, 'add'),
+
+ subtract : createAdder(-1, 'subtract'),
+
+ diff : function (input, units, asFloat) {
+ var that = makeAs(input, this),
+ zoneDiff = (this.zone() - that.zone()) * 6e4,
+ diff, output, daysAdjust;
+
+ units = normalizeUnits(units);
+
+ if (units === 'year' || units === 'month') {
+ // average number of days in the months in the given dates
+ diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
+ // difference in months
+ output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
+ // adjust by taking difference in days, average number of days
+ // and dst in the given months.
+ daysAdjust = (this - moment(this).startOf('month')) -
+ (that - moment(that).startOf('month'));
+ // same as above but with zones, to negate all dst
+ daysAdjust -= ((this.zone() - moment(this).startOf('month').zone()) -
+ (that.zone() - moment(that).startOf('month').zone())) * 6e4;
+ output += daysAdjust / diff;
+ if (units === 'year') {
+ output = output / 12;
+ }
+ } else {
+ diff = (this - that);
+ output = units === 'second' ? diff / 1e3 : // 1000
+ units === 'minute' ? diff / 6e4 : // 1000 * 60
+ units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
+ units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
+ units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
+ diff;
+ }
+ return asFloat ? output : absRound(output);
+ },
+
+ from : function (time, withoutSuffix) {
+ return moment.duration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
+ },
+
+ fromNow : function (withoutSuffix) {
+ return this.from(moment(), withoutSuffix);
+ },
+
+ calendar : function (time) {
+ // We want to compare the start of today, vs this.
+ // Getting start-of-today depends on whether we're zone'd or not.
+ var now = time || moment(),
+ sod = makeAs(now, this).startOf('day'),
+ diff = this.diff(sod, 'days', true),
+ format = diff < -6 ? 'sameElse' :
+ diff < -1 ? 'lastWeek' :
+ diff < 0 ? 'lastDay' :
+ diff < 1 ? 'sameDay' :
+ diff < 2 ? 'nextDay' :
+ diff < 7 ? 'nextWeek' : 'sameElse';
+ return this.format(this.localeData().calendar(format, this));
+ },
+
+ isLeapYear : function () {
+ return isLeapYear(this.year());
+ },
+
+ isDST : function () {
+ return (this.zone() < this.clone().month(0).zone() ||
+ this.zone() < this.clone().month(5).zone());
+ },
+
+ day : function (input) {
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
+ if (input != null) {
+ input = parseWeekday(input, this.localeData());
+ return this.add(input - day, 'd');
+ } else {
+ return day;
+ }
+ },
+
+ month : makeAccessor('Month', true),
+
+ startOf : function (units) {
+ units = normalizeUnits(units);
+ // the following switch intentionally omits break keywords
+ // to utilize falling through the cases.
+ switch (units) {
+ case 'year':
+ this.month(0);
+ /* falls through */
+ case 'quarter':
+ case 'month':
+ this.date(1);
+ /* falls through */
+ case 'week':
+ case 'isoWeek':
+ case 'day':
+ this.hours(0);
+ /* falls through */
+ case 'hour':
+ this.minutes(0);
+ /* falls through */
+ case 'minute':
+ this.seconds(0);
+ /* falls through */
+ case 'second':
+ this.milliseconds(0);
+ /* falls through */
+ }
+
+ // weeks are a special case
+ if (units === 'week') {
+ this.weekday(0);
+ } else if (units === 'isoWeek') {
+ this.isoWeekday(1);
+ }
+
+ // quarters are also special
+ if (units === 'quarter') {
+ this.month(Math.floor(this.month() / 3) * 3);
+ }
+
+ return this;
+ },
+
+ endOf: function (units) {
+ units = normalizeUnits(units);
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
+ },
+
+ isAfter: function (input, units) {
+ units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
+ if (units === 'millisecond') {
+ input = moment.isMoment(input) ? input : moment(input);
+ return +this > +input;
+ } else {
+ return +this.clone().startOf(units) > +moment(input).startOf(units);
+ }
+ },
+
+ isBefore: function (input, units) {
+ units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
+ if (units === 'millisecond') {
+ input = moment.isMoment(input) ? input : moment(input);
+ return +this < +input;
+ } else {
+ return +this.clone().startOf(units) < +moment(input).startOf(units);
+ }
+ },
+
+ isSame: function (input, units) {
+ units = normalizeUnits(units || 'millisecond');
+ if (units === 'millisecond') {
+ input = moment.isMoment(input) ? input : moment(input);
+ return +this === +input;
+ } else {
+ return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
+ }
+ },
+
+ min: deprecate(
+ 'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
+ function (other) {
+ other = moment.apply(null, arguments);
+ return other < this ? this : other;
+ }
+ ),
+
+ max: deprecate(
+ 'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
+ function (other) {
+ other = moment.apply(null, arguments);
+ return other > this ? this : other;
+ }
+ ),
+
+ // keepLocalTime = true means only change the timezone, without
+ // affecting the local hour. So 5:31:26 +0300 --[zone(2, true)]-->
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist int zone
+ // +0200, so we adjust the time as needed, to be valid.
+ //
+ // Keeping the time actually adds/subtracts (one hour)
+ // from the actual represented time. That is why we call updateOffset
+ // a second time. In case it wants us to change the offset again
+ // _changeInProgress == true case, then we have to adjust, because
+ // there is no such time in the given timezone.
+ zone : function (input, keepLocalTime) {
+ var offset = this._offset || 0,
+ localAdjust;
+ if (input != null) {
+ if (typeof input === 'string') {
+ input = timezoneMinutesFromString(input);
+ }
+ if (Math.abs(input) < 16) {
+ input = input * 60;
+ }
+ if (!this._isUTC && keepLocalTime) {
+ localAdjust = this._dateTzOffset();
+ }
+ this._offset = input;
+ this._isUTC = true;
+ if (localAdjust != null) {
+ this.subtract(localAdjust, 'm');
+ }
+ if (offset !== input) {
+ if (!keepLocalTime || this._changeInProgress) {
+ addOrSubtractDurationFromMoment(this,
+ moment.duration(offset - input, 'm'), 1, false);
+ } else if (!this._changeInProgress) {
+ this._changeInProgress = true;
+ moment.updateOffset(this, true);
+ this._changeInProgress = null;
+ }
+ }
+ } else {
+ return this._isUTC ? offset : this._dateTzOffset();
+ }
+ return this;
+ },
+
+ zoneAbbr : function () {
+ return this._isUTC ? 'UTC' : '';
+ },
+
+ zoneName : function () {
+ return this._isUTC ? 'Coordinated Universal Time' : '';
+ },
+
+ parseZone : function () {
+ if (this._tzm) {
+ this.zone(this._tzm);
+ } else if (typeof this._i === 'string') {
+ this.zone(this._i);
+ }
+ return this;
+ },
+
+ hasAlignedHourOffset : function (input) {
+ if (!input) {
+ input = 0;
+ }
+ else {
+ input = moment(input).zone();
+ }
+
+ return (this.zone() - input) % 60 === 0;
+ },
+
+ daysInMonth : function () {
+ return daysInMonth(this.year(), this.month());
+ },
+
+ dayOfYear : function (input) {
+ var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
+ return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
+ },
+
+ quarter : function (input) {
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
+ },
+
+ weekYear : function (input) {
+ var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
+ return input == null ? year : this.add((input - year), 'y');
+ },
+
+ isoWeekYear : function (input) {
+ var year = weekOfYear(this, 1, 4).year;
+ return input == null ? year : this.add((input - year), 'y');
+ },
+
+ week : function (input) {
+ var week = this.localeData().week(this);
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ },
+
+ isoWeek : function (input) {
+ var week = weekOfYear(this, 1, 4).week;
+ return input == null ? week : this.add((input - week) * 7, 'd');
+ },
+
+ weekday : function (input) {
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
+ return input == null ? weekday : this.add(input - weekday, 'd');
+ },
+
+ isoWeekday : function (input) {
+ // behaves the same as moment#day except
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
+ // as a setter, sunday should belong to the previous week.
+ return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
+ },
+
+ isoWeeksInYear : function () {
+ return weeksInYear(this.year(), 1, 4);
+ },
+
+ weeksInYear : function () {
+ var weekInfo = this.localeData()._week;
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
+ },
+
+ get : function (units) {
+ units = normalizeUnits(units);
+ return this[units]();
+ },
+
+ set : function (units, value) {
+ units = normalizeUnits(units);
+ if (typeof this[units] === 'function') {
+ this[units](value);
+ }
+ return this;
+ },
+
+ // If passed a locale key, it will set the locale for this
+ // instance. Otherwise, it will return the locale configuration
+ // variables for this instance.
+ locale : function (key) {
+ var newLocaleData;
+
+ if (key === undefined) {
+ return this._locale._abbr;
+ } else {
+ newLocaleData = moment.localeData(key);
+ if (newLocaleData != null) {
+ this._locale = newLocaleData;
+ }
+ return this;
+ }
+ },
+
+ lang : deprecate(
+ 'moment().lang() is deprecated. Use moment().localeData() instead.',
+ function (key) {
+ if (key === undefined) {
+ return this.localeData();
+ } else {
+ return this.locale(key);
+ }
+ }
+ ),
+
+ localeData : function () {
+ return this._locale;
+ },
+
+ _dateTzOffset : function () {
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
+ // https://github.com/moment/moment/pull/1871
+ return Math.round(this._d.getTimezoneOffset() / 15) * 15;
+ }
+ });
+
+ function rawMonthSetter(mom, value) {
+ var dayOfMonth;
+
+ // TODO: Move this out of here!
+ if (typeof value === 'string') {
+ value = mom.localeData().monthsParse(value);
+ // TODO: Another silent failure?
+ if (typeof value !== 'number') {
+ return mom;
+ }
+ }
+
+ dayOfMonth = Math.min(mom.date(),
+ daysInMonth(mom.year(), value));
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ return mom;
+ }
+
+ function rawGetter(mom, unit) {
+ return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
+ }
+
+ function rawSetter(mom, unit, value) {
+ if (unit === 'Month') {
+ return rawMonthSetter(mom, value);
+ } else {
+ return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
+ }
+ }
+
+ function makeAccessor(unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ rawSetter(this, unit, value);
+ moment.updateOffset(this, keepTime);
+ return this;
+ } else {
+ return rawGetter(this, unit);
+ }
+ };
+ }
+
+ moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
+ moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
+ moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
+ // Setting the hour should keep the time, because the user explicitly
+ // specified which hour he wants. So trying to maintain the same hour (in
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
+ // this rule.
+ moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
+ // moment.fn.month is defined separately
+ moment.fn.date = makeAccessor('Date', true);
+ moment.fn.dates = deprecate('dates accessor is deprecated. Use date instead.', makeAccessor('Date', true));
+ moment.fn.year = makeAccessor('FullYear', true);
+ moment.fn.years = deprecate('years accessor is deprecated. Use year instead.', makeAccessor('FullYear', true));
+
+ // add plural methods
+ moment.fn.days = moment.fn.day;
+ moment.fn.months = moment.fn.month;
+ moment.fn.weeks = moment.fn.week;
+ moment.fn.isoWeeks = moment.fn.isoWeek;
+ moment.fn.quarters = moment.fn.quarter;
+
+ // add aliased format methods
+ moment.fn.toJSON = moment.fn.toISOString;
+
+ /************************************
+ Duration Prototype
+ ************************************/
+
+
+ function daysToYears (days) {
+ // 400 years have 146097 days (taking into account leap year rules)
+ return days * 400 / 146097;
+ }
+
+ function yearsToDays (years) {
+ // years * 365 + absRound(years / 4) -
+ // absRound(years / 100) + absRound(years / 400);
+ return years * 146097 / 400;
+ }
+
+ extend(moment.duration.fn = Duration.prototype, {
+
+ _bubble : function () {
+ var milliseconds = this._milliseconds,
+ days = this._days,
+ months = this._months,
+ data = this._data,
+ seconds, minutes, hours, years = 0;
+
+ // The following code bubbles up values, see the tests for
+ // examples of what that means.
+ data.milliseconds = milliseconds % 1000;
+
+ seconds = absRound(milliseconds / 1000);
+ data.seconds = seconds % 60;
+
+ minutes = absRound(seconds / 60);
+ data.minutes = minutes % 60;
+
+ hours = absRound(minutes / 60);
+ data.hours = hours % 24;
+
+ days += absRound(hours / 24);
+
+ // Accurately convert days to years, assume start from year 0.
+ years = absRound(daysToYears(days));
+ days -= absRound(yearsToDays(years));
+
+ // 30 days to a month
+ // TODO (iskren): Use anchor date (like 1st Jan) to compute this.
+ months += absRound(days / 30);
+ days %= 30;
+
+ // 12 months -> 1 year
+ years += absRound(months / 12);
+ months %= 12;
+
+ data.days = days;
+ data.months = months;
+ data.years = years;
+ },
+
+ abs : function () {
+ 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);
+
+ return this;
+ },
+
+ weeks : function () {
+ return absRound(this.days() / 7);
+ },
+
+ valueOf : function () {
+ return this._milliseconds +
+ this._days * 864e5 +
+ (this._months % 12) * 2592e6 +
+ toInt(this._months / 12) * 31536e6;
+ },
+
+ humanize : function (withSuffix) {
+ var output = relativeTime(this, !withSuffix, this.localeData());
+
+ if (withSuffix) {
+ output = this.localeData().pastFuture(+this, output);
+ }
+
+ return this.localeData().postformat(output);
+ },
+
+ add : function (input, val) {
+ // supports only 2.0-style add(1, 's') or add(moment)
+ var dur = moment.duration(input, val);
+
+ this._milliseconds += dur._milliseconds;
+ this._days += dur._days;
+ this._months += dur._months;
+
+ this._bubble();
+
+ return this;
+ },
+
+ subtract : function (input, val) {
+ var dur = moment.duration(input, val);
+
+ this._milliseconds -= dur._milliseconds;
+ this._days -= dur._days;
+ this._months -= dur._months;
+
+ this._bubble();
+
+ return this;
+ },
+
+ get : function (units) {
+ units = normalizeUnits(units);
+ return this[units.toLowerCase() + 's']();
+ },
+
+ as : function (units) {
+ var days, months;
+ units = normalizeUnits(units);
+
+ if (units === 'month' || units === 'year') {
+ days = this._days + this._milliseconds / 864e5;
+ months = this._months + daysToYears(days) * 12;
+ return units === 'month' ? months : months / 12;
+ } else {
+ // handle milliseconds separately because of floating point math errors (issue #1867)
+ days = this._days + yearsToDays(this._months / 12);
+ switch (units) {
+ case 'week': return days / 7 + this._milliseconds / 6048e5;
+ case 'day': return days + this._milliseconds / 864e5;
+ case 'hour': return days * 24 + this._milliseconds / 36e5;
+ case 'minute': return days * 24 * 60 + this._milliseconds / 6e4;
+ case 'second': return days * 24 * 60 * 60 + this._milliseconds / 1000;
+ // Math.floor prevents floating point math errors here
+ case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + this._milliseconds;
+ default: throw new Error('Unknown unit ' + units);
+ }
+ }
+ },
+
+ lang : moment.fn.lang,
+ locale : moment.fn.locale,
+
+ toIsoString : deprecate(
+ 'toIsoString() is deprecated. Please use toISOString() instead ' +
+ '(notice the capitals)',
+ function () {
+ return this.toISOString();
+ }
+ ),
+
+ toISOString : function () {
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
+ var years = Math.abs(this.years()),
+ months = Math.abs(this.months()),
+ days = Math.abs(this.days()),
+ hours = Math.abs(this.hours()),
+ minutes = Math.abs(this.minutes()),
+ seconds = Math.abs(this.seconds() + this.milliseconds() / 1000);
+
+ if (!this.asSeconds()) {
+ // this is the same as C#'s (Noda) and python (isodate)...
+ // but not other JS (goog.date)
+ return 'P0D';
+ }
+
+ return (this.asSeconds() < 0 ? '-' : '') +
+ 'P' +
+ (years ? years + 'Y' : '') +
+ (months ? months + 'M' : '') +
+ (days ? days + 'D' : '') +
+ ((hours || minutes || seconds) ? 'T' : '') +
+ (hours ? hours + 'H' : '') +
+ (minutes ? minutes + 'M' : '') +
+ (seconds ? seconds + 'S' : '');
+ },
+
+ localeData : function () {
+ return this._locale;
+ }
+ });
+
+ moment.duration.fn.toString = moment.duration.fn.toISOString;
+
+ function makeDurationGetter(name) {
+ moment.duration.fn[name] = function () {
+ return this._data[name];
+ };
+ }
+
+ for (i in unitMillisecondFactors) {
+ if (hasOwnProp(unitMillisecondFactors, i)) {
+ makeDurationGetter(i.toLowerCase());
+ }
+ }
+
+ moment.duration.fn.asMilliseconds = function () {
+ return this.as('ms');
+ };
+ moment.duration.fn.asSeconds = function () {
+ return this.as('s');
+ };
+ moment.duration.fn.asMinutes = function () {
+ return this.as('m');
+ };
+ moment.duration.fn.asHours = function () {
+ return this.as('h');
+ };
+ moment.duration.fn.asDays = function () {
+ return this.as('d');
+ };
+ moment.duration.fn.asWeeks = function () {
+ return this.as('weeks');
+ };
+ moment.duration.fn.asMonths = function () {
+ return this.as('M');
+ };
+ moment.duration.fn.asYears = function () {
+ return this.as('y');
+ };
+
+ /************************************
+ Default Locale
+ ************************************/
+
+
+ // Set default locale, other locale will inherit from English.
+ moment.locale('en', {
+ ordinal : function (number) {
+ var b = number % 10,
+ output = (toInt(number % 100 / 10) === 1) ? 'th' :
+ (b === 1) ? 'st' :
+ (b === 2) ? 'nd' :
+ (b === 3) ? 'rd' : 'th';
+ return number + output;
+ }
+ });
+
+ return moment;
+
+ }).call(this);
+
+ UI.Utils.moment = moment;
+
+ return UI.datepicker;
+});
diff --git a/uikit/static/js/components/datepicker.min.js b/uikit/static/js/components/datepicker.min.js
new file mode 100644
index 0000000..9a30a1f
--- /dev/null
+++ b/uikit/static/js/components/datepicker.min.js
@@ -0,0 +1,3 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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:"DD.MM.YYYY",offsettop:5,maxDate:!1,minDate:!1,pos:"auto",template:function(e,a){var s,i,r,o="";if(a.maxDate!==!1&&(s=isNaN(a.maxDate)?n(a.maxDate,a.format):n().add(a.maxDate,"days")),a.minDate!==!1&&(i=isNaN(a.minDate)?n(a.minDate,a.format):n().add(a.minDate-1,"days")),o+='<div class="uk-datepicker-nav">',o+='<a href="" class="uk-datepicker-previous"></a>',o+='<a href="" class="uk-datepicker-next"></a>',t.formSelect){var u,c,d,l,h=(new Date).getFullYear(),f=[];for(r=0;r<a.i18n.months.length;r++)r==e.month?f.push('<option value="'+r+'" selected>'+a.i18n.months[r]+"</option>"):f.push('<option value="'+r+'">'+a.i18n.months[r]+"</option>");for(u='<span class="uk-form-select">'+a.i18n.months[e.month]+'<select class="update-picker-month">'+f.join("")+"</select></span>",f=[],d=i?i.year():h-50,l=s?s.year():h+20,r=d;l>=r;r++)r==e.year?f.push('<option value="'+r+'" selected>'+r+"</option>"):f.push('<option value="'+r+'">'+r+"</option>");c='<span class="uk-form-select">'+e.year+'<select class="update-picker-year">'+f.join("")+"</select></span>",o+='<div class="uk-datepicker-heading">'+u+" "+c+"</div>"}else o+='<div class="uk-datepicker-heading">'+a.i18n.months[e.month]+" "+e.year+"</div>";for(o+="</div>",o+='<table class="uk-datepicker-table">',o+="<thead>",r=0;r<e.weekdays.length;r++)e.weekdays[r]&&(o+="<th>"+e.weekdays[r]+"</th>");for(o+="</thead>",o+="<tbody>",r=0;r<e.days.length;r++)if(e.days[r]&&e.days[r].length){o+="<tr>";for(var m=0;m<e.days[r].length;m++)if(e.days[r][m]){var _=e.days[r][m],p=[];_.inmonth||p.push("uk-datepicker-table-muted"),_.selected&&p.push("uk-active"),s&&_.day>s&&p.push("uk-datepicker-date-disabled uk-datepicker-table-muted"),i&&i>_.day&&p.push("uk-datepicker-date-disabled uk-datepicker-table-muted"),o+='<td><a href="" class="'+p.join(" ")+'" data-date="'+_.day.format()+'">'+_.day.format("D")+"</a></td>"}o+="</tr>"}return o+="</tbody>",o+="</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);if(!n.data("datepicker")){e.preventDefault();{t.datepicker(n,t.Utils.options(n.attr("data-uk-datepicker")))}n.trigger("focus")}}),t.$html.on("click.datepicker.uikit",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(s){s.stopPropagation(),s.preventDefault();var i=t.$(this);return i.hasClass("uk-datepicker-date-disabled")?!1:(i.is("[data-date]")?(a.element.val(n(i.data("date")).format(a.options.format)).trigger("change"),e.hide(),a=!1):a.add(1*(i.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=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).getDay(),o={month:e,year:t,weekdays:[],days:[]},u=[];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)),h=a.mindate&&l<a.mindate||a.maxdate&&l>a.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){ke.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=ke.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=H(e,t),t.isBefore(e)?n=p(t,e):(n=p(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n}function k(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=ke.duration(n,a),D(this,s,t),this}}function D(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&&ke.updateOffset(t,i||r)}function g(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"}ke[e]=function(s,i){var r,o,u=ke._locale[e],c=[];if("number"==typeof s&&(i=s,s=t),o=function(t){var e=ke().utc().set(a,t);return u.call(ke._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(ke([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=I(s.slice(0,e).join("-")))return a;if(n&&n.length>=e&&Y(s,n,!0)>=e-1)break;e--}i++}return null}function I(t){var e=null;if(!Ue[t]&&Ge)try{e=ke.locale(),require("./locale/"+t),ke.locale(e)}catch(n){}return Ue[t]}function H(t,e){return e._isUTC?ke(t).zone(e._offset||0):ke(t).local()}function x(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function L(t){var e,n,a=t.match(He);for(e=0,n=a.length;n>e;e++)a[e]=fn[a[e]]?fn[a[e]]:x(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(xe.lastIndex=0;a>=0&&xe.test(t);)t=t.replace(xe,n),xe.lastIndex=0,a-=1;return t}function Z(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:Ze;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 Ne;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 N(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]=ke.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=N(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]=ke.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(ke(),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(ke(),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===ke.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(He)||[],e=0;e<a.length;e++)s=a[e],n=(r.match(Z(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,ke.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):g(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):ke.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=ke.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=ke(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||ke.localeData(e._l),null===n||a===t&&""===n?ke.invalid({nullInput:!0}):("string"==typeof n&&(e._i=n=e._locale.preparse(n)),ke.isMoment(n)?new d(n,!0):(a?g(a)?X(e):q(e):ee(e),new d(e)))}function de(t,e){var n,a;if(1===e.length&&g(e[0])&&(e=e[0]),!e.length)return ke();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),ke.updateOffset(this,e),this):he(this,t)}}function _e(t){return 400*t/146097}function pe(t){return 146097*t/400}function ye(t){ke.duration.fn[t]=function(){return this._data[t]}}for(var ke,De,ge="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})?)?/,Ie=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,He=/(\[[^\[]*\])|(\\)?(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,xe=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Le=/\d\d?/,Pe=/\d{1,3}/,Ae=/\d{1,4}/,Ze=/[+\-]?\d{1,6}/,Ne=/\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;)De=ln.pop(),fn[De+"o"]=u(fn[De],De);for(;hn.length;)De=hn.pop(),fn[De+De]=o(fn[De],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=ke.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=ke([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}}),ke=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)},ke.suppressDeprecationWarnings=!1,ke.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)}),ke.min=function(){var t=[].slice.call(arguments,0);return de("isBefore",t)},ke.max=function(){var t=[].slice.call(arguments,0);return de("isAfter",t)},ke.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()},ke.unix=function(t){return ke(1e3*t)},ke.duration=function(t,e){var a,s,i,r,o=t,u=null;return ke.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=Ie.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(ke(o.from),ke(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),s=new l(o),ke.isDuration(t)&&n(t,"_locale")&&(s._locale=t._locale),s},ke.version=ge,ke.defaultFormat=en,ke.ISO_8601=function(){},ke.momentProperties=Fe,ke.updateOffset=function(){},ke.relativeTimeThreshold=function(e,n){return dn[e]===t?!1:n===t?dn[e]:(dn[e]=n,!0)},ke.lang=i("moment.lang is deprecated. Use moment.locale instead.",function(t,e){return ke.locale(t,e)}),ke.locale=function(t,e){var n;return t&&(n="undefined"!=typeof e?ke.defineLocale(t,e):ke.localeData(t),n&&(ke.duration._locale=ke._locale=n)),ke._locale._abbr},ke.defineLocale=function(t,e){return null!==e?(e.abbr=t,Ue[t]||(Ue[t]=new c),Ue[t].set(e),ke.locale(t),Ue[t]):(delete Ue[t],null)},ke.langData=i("moment.langData is deprecated. Use moment.localeData instead.",function(t){return ke.localeData(t)}),ke.localeData=function(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return ke._locale;if(!g(t)){if(e=I(t))return e;t=[t]}return z(t)},ke.isMoment=function(t){return t instanceof d||null!=t&&n(t,"_isAMomentObject")},ke.isDuration=function(t){return t instanceof l};for(De=_n.length-1;De>=0;--De)b(_n[De]);ke.normalizeUnits=function(t){return w(t)},ke.invalid=function(t){var e=ke.utc(0/0);return null!=t?h(e._pf,t):e._pf.userInvalidated=!0,e},ke.parseZone=function(){return ke.apply(null,arguments).parseZone()},ke.parseTwoDigitYear=function(t){return S(t)+(S(t)>68?1900:2e3)},h(ke.fn=d.prototype,{clone:function(){return ke(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=ke(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?ke.utc(this._a):ke(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||ke.defaultFormat);return this.localeData().postformat(e)},add:k(1,"add"),subtract:k(-1,"subtract"),diff:function(t,e,n){var a,s,i,r=H(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-ke(this).startOf("month")-(r-ke(r).startOf("month")),i-=6e4*(this.zone()-ke(this).startOf("month").zone()-(r.zone()-ke(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 ke.duration({to:this,from:t}).locale(this.locale()).humanize(!e)},fromNow:function(t){return this.from(ke(),t)},calendar:function(t){var e=t||ke(),n=H(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=ke.isMoment(t)?t:ke(t),+this>+t):+this.clone().startOf(e)>+ke(t).startOf(e)},isBefore:function(t,e){return e=w("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=ke.isMoment(t)?t:ke(t),+t>+this):+this.clone().startOf(e)<+ke(t).startOf(e)},isSame:function(t,e){return e=w(e||"millisecond"),"millisecond"===e?(t=ke.isMoment(t)?t:ke(t),+this===+t):+this.clone().startOf(e)===+H(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=ke.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=ke.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=N(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?D(this,ke.duration(a-t,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ke.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
+},hasAlignedHourOffset:function(t){return t=t?ke(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return T(this.year(),this.month())},dayOfYear:function(t){var e=Me((ke(this).startOf("day")-ke(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=ke.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)}}),ke.fn.millisecond=ke.fn.milliseconds=me("Milliseconds",!1),ke.fn.second=ke.fn.seconds=me("Seconds",!1),ke.fn.minute=ke.fn.minutes=me("Minutes",!1),ke.fn.hour=ke.fn.hours=me("Hours",!0),ke.fn.date=me("Date",!0),ke.fn.dates=i("dates accessor is deprecated. Use date instead.",me("Date",!0)),ke.fn.year=me("FullYear",!0),ke.fn.years=i("years accessor is deprecated. Use year instead.",me("FullYear",!0)),ke.fn.days=ke.fn.day,ke.fn.months=ke.fn.month,ke.fn.weeks=ke.fn.week,ke.fn.isoWeeks=ke.fn.isoWeek,ke.fn.quarters=ke.fn.quarter,ke.fn.toJSON=ke.fn.toISOString,h(ke.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=ke.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=ke.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:ke.fn.lang,locale:ke.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}}),ke.duration.fn.toString=ke.duration.fn.toISOString;for(De in rn)n(rn,De)&&ye(De.toLowerCase());return ke.duration.fn.asMilliseconds=function(){return this.as("ms")},ke.duration.fn.asSeconds=function(){return this.as("s")},ke.duration.fn.asMinutes=function(){return this.as("m")},ke.duration.fn.asHours=function(){return this.as("h")},ke.duration.fn.asDays=function(){return this.as("d")},ke.duration.fn.asWeeks=function(){return this.as("weeks")},ke.duration.fn.asMonths=function(){return this.as("M")},ke.duration.fn.asYears=function(){return this.as("y")},ke.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}}),ke}.call(this),t.Utils.moment=n,t.datepicker}); \ No newline at end of file
diff --git a/uikit/static/js/components/form-password.js b/uikit/static/js/components/form-password.js
new file mode 100644
index 0000000..38d0549
--- /dev/null
+++ b/uikit/static/js/components/form-password.js
@@ -0,0 +1,66 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-form-password", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.component('formPassword', {
+
+ defaults: {
+ "lblShow": "Show",
+ "lblHide": "Hide"
+ },
+
+ boot: function() {
+ // init code
+ UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
+
+ var ele = UI.$(this);
+
+ if (!ele.data("formPassword")) {
+
+ e.preventDefault();
+
+ var obj = UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
+ ele.trigger("click");
+ }
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ this.on("click", function(e) {
+
+ e.preventDefault();
+
+ if($this.input.length) {
+ var type = $this.input.attr("type");
+ $this.input.attr("type", type=="text" ? "password":"text");
+ $this.element.text($this.options[type=="text" ? "lblShow":"lblHide"]);
+ }
+ });
+
+ this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
+ this.element.text(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]);
+
+ this.element.data("formPassword", this);
+ }
+ });
+
+ return UI.formPassword;
+});
diff --git a/uikit/static/js/components/form-password.min.js b/uikit/static/js/components/form-password.min.js
new file mode 100644
index 0000000..a57ba50
--- /dev/null
+++ b/uikit/static/js/components/form-password.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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);if(!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.text(t.options["text"==e?"lblShow":"lblHide"])}}),this.input=this.element.next("input").length?this.element.next("input"):this.element.prev("input"),this.element.text(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/uikit/static/js/components/form-select.js b/uikit/static/js/components/form-select.js
new file mode 100644
index 0000000..ddafff8
--- /dev/null
+++ b/uikit/static/js/components/form-select.js
@@ -0,0 +1,70 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-form-select", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.component('formSelect', {
+
+ defaults: {
+ 'target': '>span:first',
+ 'activeClass': 'uk-active'
+ },
+
+ boot: function() {
+ // init code
+ UI.ready(function(context) {
+
+ UI.$("[data-uk-form-select]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if (!ele.data("formSelect")) {
+ var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+ var $this = this;
+
+ this.target = this.find(this.options.target);
+ this.select = this.find('select');
+
+ // init + on change event
+ this.select.on("change", (function(){
+
+ var select = $this.select[0], fn = function(){
+
+ try {
+ $this.target.text(select.options[select.selectedIndex].text);
+ } catch(e) {}
+
+ $this.element[$this.select.val() ? 'addClass':'removeClass']($this.options.activeClass);
+
+ return fn;
+ };
+
+ return fn();
+ })());
+
+ this.element.data("formSelect", this);
+ }
+ });
+
+ return UI.formSelect;
+});
diff --git a/uikit/static/js/components/form-select.min.js b/uikit/static/js/components/form-select.min.js
new file mode 100644
index 0000000..fc09bfb
--- /dev/null
+++ b/uikit/static/js/components/form-select.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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);if(!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{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/uikit/static/js/components/grid.js b/uikit/static/js/components/grid.js
new file mode 100644
index 0000000..3a7ae7a
--- /dev/null
+++ b/uikit/static/js/components/grid.js
@@ -0,0 +1,524 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-grid", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.component('grid', {
+
+ defaults: {
+ colwidth : 'auto',
+ animation : true,
+ duration : 300,
+ gutter : 0,
+ controls : false,
+ filter : false
+ },
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$('[data-uk-grid]', context).each(function(){
+
+ var ele = UI.$(this);
+
+ if(!ele.data("grid")) {
+ var plugin = UI.grid(ele, UI.Utils.options(ele.attr('data-uk-grid')));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = this, gutter = String(this.options.gutter).trim().split(' ');
+
+ this.gutterv = parseInt(gutter[0], 10);
+ this.gutterh = parseInt((gutter[1] || gutter[0]), 10);
+
+ // make sure parent element has the right position property
+ this.element.css({'position': 'relative'});
+
+ this.controls = null;
+
+ if (this.options.controls) {
+
+ this.controls = UI.$(this.options.controls);
+
+ // filter
+ this.controls.on('click', '[data-uk-filter]', function(e){
+ e.preventDefault();
+ $this.filter(UI.$(this).data('ukFilter'));
+ });
+
+ // sort
+ this.controls.on('click', '[data-uk-sort]', function(e){
+ e.preventDefault();
+ var cmd = UI.$(this).attr('data-uk-sort').split(':');
+ $this.sort(cmd[0], cmd[1]);
+ });
+ }
+
+ UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
+
+ if ($this.currentfilter) {
+ $this.filter($this.currentfilter);
+ } else {
+ this.updateLayout();
+ }
+
+ }.bind(this), 100));
+
+ this.on('display.uk.check', function(){
+ if ($this.element.is(":visible")) $this.updateLayout();
+ });
+
+ UI.$html.on("changed.uk.dom", function(e) {
+ $this.updateLayout();
+ });
+
+ if (this.options.filter !== false) {
+ this.filter(this.options.filter);
+ } else {
+ this.updateLayout();
+ }
+ },
+
+ _prepareElements: function() {
+
+ var children = this.element.children(':not([data-grid-prepared])'), css;
+
+ // exit if no already prepared elements found
+ if (!children.length) {
+ return;
+ }
+
+ css = {
+ 'position' : 'absolute',
+ 'box-sizing' : 'border-box',
+ 'width' : this.options.colwidth == 'auto' ? '' : this.options.colwidth
+ };
+
+ if (this.options.gutter) {
+
+ css['padding-left'] = this.gutterh;
+ css['padding-bottom'] = this.gutterv;
+
+ this.element.css('margin-left', this.gutterh * -1);
+ }
+
+ children.attr('data-grid-prepared', 'true').css(css);
+ },
+
+ updateLayout: function(elements) {
+
+ this._prepareElements();
+
+ elements = elements || this.element.children(':visible');
+
+ var $this = this,
+ children = elements,
+ maxwidth = this.element.width() + (2*this.gutterh) + 2,
+ left = 0,
+ top = 0,
+ positions = [],
+
+ item, width, height, pos, aX, aY, i, z, max, size;
+
+ this.trigger('beforeupdate.uk.grid', [children]);
+
+ children.each(function(index){
+
+ size = getElementSize(this);
+
+ item = UI.$(this);
+ width = size.outerWidth;
+ height = size.outerHeight;
+ left = 0;
+ top = 0;
+
+ for (i=0,max=positions.length;i<max;i++) {
+
+ pos = positions[i];
+
+ if (left <= pos.aX) { left = pos.aX; }
+ if (maxwidth < (left + width)) { left = 0; }
+ if (top <= pos.aY) { top = pos.aY; }
+ }
+
+ positions.push({
+ "ele" : item,
+ "top" : top,
+ "left" : left,
+ "width" : width,
+ "height" : height,
+ "aY" : (top + height),
+ "aX" : (left + width)
+ });
+ });
+
+ var posPrev, maxHeight = 0;
+
+ // fix top
+ for (i=0,max=positions.length;i<max;i++) {
+
+ pos = positions[i];
+ top = 0;
+
+ for (z=0;z<i;z++) {
+
+ posPrev = positions[z];
+
+ // (posPrev.left + 1) fixex 1px bug when using % based widths
+ if (pos.left < posPrev.aX && (posPrev.left +1) < pos.aX) {
+ top = posPrev.aY;
+ }
+ }
+
+ pos.top = top;
+ pos.aY = top + pos.height;
+
+ maxHeight = Math.max(maxHeight, pos.aY);
+ }
+
+ maxHeight = maxHeight - this.gutterv;
+
+ if (this.options.animation) {
+
+ this.element.stop().animate({'height': maxHeight}, 100);
+
+ positions.forEach(function(pos){
+ pos.ele.stop().animate({"top": pos.top, "left": pos.left, opacity: 1}, this.options.duration);
+ }.bind(this));
+
+ } else {
+
+ this.element.css('height', maxHeight);
+
+ positions.forEach(function(pos){
+ pos.ele.css({"top": pos.top, "left": pos.left, opacity: 1});
+ }.bind(this));
+ }
+
+ // make sure to trigger possible scrollpies etc.
+ setTimeout(function() {
+ UI.$doc.trigger('scrolling.uk.document');
+ }, 2 * this.options.duration * (this.options.animation ? 1:0));
+
+ this.trigger('afterupdate.uk.grid', [children]);
+ },
+
+ filter: function(filter) {
+
+ this.currentfilter = filter;
+
+ filter = filter || [];
+
+ if (typeof(filter) === 'string') {
+ filter = filter.split(/,/).map(function(item){ return item.trim(); });
+ }
+
+ var $this = this, children = this.element.children(), elements = {"visible": [], "hidden": []}, visible, hidden;
+
+ children.each(function(index){
+
+ var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
+
+ if (f) {
+
+ f = f.split(/,/).map(function(item){ return item.trim(); });
+
+ filter.forEach(function(item){
+ if (f.indexOf(item) > -1) infilter = true;
+ });
+ }
+
+ elements[infilter ? "visible":"hidden"].push(ele);
+ });
+
+ // convert to jQuery collections
+ elements.hidden = UI.$(elements.hidden).map(function () {return this[0];});
+ elements.visible = UI.$(elements.visible).map(function () {return this[0];});
+
+ elements.hidden.attr('aria-hidden', 'true').filter(':visible').fadeOut(this.options.duration);
+ elements.visible.attr('aria-hidden', 'false').filter(':hidden').css('opacity', 0).show();
+
+ $this.updateLayout(elements.visible);
+
+ if (this.controls && this.controls.length) {
+ this.controls.find('[data-uk-filter]').removeClass('uk-active').filter('[data-uk-filter="'+filter+'"]').addClass('uk-active');
+ }
+ },
+
+ sort: function(by, order){
+
+ order = order || 1;
+
+ // covert from string (asc|desc) to number
+ if (typeof(order) === 'string') {
+ order = order.toLowerCase() == 'desc' ? -1 : 1;
+ }
+
+ var elements = this.element.children();
+
+ elements.sort(function(a, b){
+
+ a = UI.$(a);
+ b = UI.$(b);
+
+ return (b.data(by) || '') < (a.data(by) || '') ? order : (order*-1);
+
+ }).appendTo(this.element);
+
+ this.updateLayout(elements.filter(':visible'));
+
+ if (this.controls && this.controls.length) {
+ this.controls.find('[data-uk-sort]').removeClass('uk-active').filter('[data-uk-sort="'+by+':'+(order == -1 ? 'desc':'asc')+'"]').addClass('uk-active');
+ }
+ }
+ });
+
+
+ /*!
+ * getSize v1.2.2
+ * measure size of elements
+ * MIT license
+ * https://github.com/desandro/get-size
+ */
+ var _getSize = (function(){
+
+ var prefixes = 'Webkit Moz ms Ms O'.split(' ');
+ var docElemStyle = document.documentElement.style;
+
+ function getStyleProperty( propName ) {
+ if ( !propName ) {
+ return;
+ }
+
+ // test standard property first
+ if ( typeof docElemStyle[ propName ] === 'string' ) {
+ return propName;
+ }
+
+ // capitalize
+ propName = propName.charAt(0).toUpperCase() + propName.slice(1);
+
+ // test vendor specific properties
+ var prefixed;
+ for ( var i=0, len = prefixes.length; i < len; i++ ) {
+ prefixed = prefixes[i] + propName;
+ if ( typeof docElemStyle[ prefixed ] === 'string' ) {
+ return prefixed;
+ }
+ }
+ }
+
+ // -------------------------- helpers -------------------------- //
+
+ // get a number from a string, not a percentage
+ function getStyleSize( value ) {
+ var num = parseFloat( value );
+ // not a percent like '100%', and a number
+ var isValid = value.indexOf('%') === -1 && !isNaN( num );
+ return isValid && num;
+ }
+
+ function noop() {}
+
+ var logError = typeof console === 'undefined' ? noop : function( message ) {
+ console.error( message );
+ };
+
+ // -------------------------- measurements -------------------------- //
+
+ var measurements = [
+ 'paddingLeft',
+ 'paddingRight',
+ 'paddingTop',
+ 'paddingBottom',
+ 'marginLeft',
+ 'marginRight',
+ 'marginTop',
+ 'marginBottom',
+ 'borderLeftWidth',
+ 'borderRightWidth',
+ 'borderTopWidth',
+ 'borderBottomWidth'
+ ];
+
+ function getZeroSize() {
+ var size = {
+ width: 0,
+ height: 0,
+ innerWidth: 0,
+ innerHeight: 0,
+ outerWidth: 0,
+ outerHeight: 0
+ };
+ for ( var i=0, len = measurements.length; i < len; i++ ) {
+ var measurement = measurements[i];
+ size[ measurement ] = 0;
+ }
+ return size;
+ }
+
+
+ // -------------------------- setup -------------------------- //
+
+ var isSetup = false;
+ var getStyle, boxSizingProp, isBoxSizeOuter;
+
+ /**
+ * setup vars and functions
+ * do it on initial getSize(), rather than on script load
+ * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397
+ */
+ function setup() {
+ // setup once
+ if ( isSetup ) {
+ return;
+ }
+ isSetup = true;
+
+ var getComputedStyle = window.getComputedStyle;
+ getStyle = ( function() {
+ var getStyleFn = getComputedStyle ?
+ function( elem ) {
+ return getComputedStyle( elem, null );
+ } :
+ function( elem ) {
+ return elem.currentStyle;
+ };
+
+ return function getStyle( elem ) {
+ var style = getStyleFn( elem );
+ if ( !style ) {
+ logError( 'Style returned ' + style +
+ '. Are you running this code in a hidden iframe on Firefox? ' +
+ 'See http://bit.ly/getsizebug1' );
+ }
+ return style;
+ };
+ })();
+
+ // -------------------------- box sizing -------------------------- //
+
+ boxSizingProp = getStyleProperty('boxSizing');
+
+ /**
+ * WebKit measures the outer-width on style.width on border-box elems
+ * IE & Firefox measures the inner-width
+ */
+ if ( boxSizingProp ) {
+ var div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.padding = '1px 2px 3px 4px';
+ div.style.borderStyle = 'solid';
+ div.style.borderWidth = '1px 2px 3px 4px';
+ div.style[ boxSizingProp ] = 'border-box';
+
+ var body = document.body || document.documentElement;
+ body.appendChild( div );
+ var style = getStyle( div );
+
+ isBoxSizeOuter = getStyleSize( style.width ) === 200;
+ body.removeChild( div );
+ }
+
+ }
+
+ // -------------------------- getSize -------------------------- //
+
+ function getSize( elem ) {
+ setup();
+
+ // use querySeletor if elem is string
+ if ( typeof elem === 'string' ) {
+ elem = document.querySelector( elem );
+ }
+
+ // do not proceed on non-objects
+ if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
+ return;
+ }
+
+ var style = getStyle( elem );
+
+ // if hidden, everything is 0
+ if ( style.display === 'none' ) {
+ return getZeroSize();
+ }
+
+ var size = {};
+ size.width = elem.offsetWidth;
+ size.height = elem.offsetHeight;
+
+ var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
+ style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
+
+ // get all measurements
+ for ( var i=0, len = measurements.length; i < len; i++ ) {
+ var measurement = measurements[i];
+ var value = style[ measurement ];
+
+ var num = parseFloat( value );
+ // any 'auto', 'medium' value will be 0
+ size[ measurement ] = !isNaN( num ) ? num : 0;
+ }
+
+ var paddingWidth = size.paddingLeft + size.paddingRight;
+ var paddingHeight = size.paddingTop + size.paddingBottom;
+ var marginWidth = size.marginLeft + size.marginRight;
+ var marginHeight = size.marginTop + size.marginBottom;
+ var borderWidth = size.borderLeftWidth + size.borderRightWidth;
+ var borderHeight = size.borderTopWidth + size.borderBottomWidth;
+
+ var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
+
+ // overwrite width and height if we can get it from style
+ var styleWidth = getStyleSize( style.width );
+ if ( styleWidth !== false ) {
+ size.width = styleWidth +
+ // add padding and border unless it's already including it
+ ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
+ }
+
+ var styleHeight = getStyleSize( style.height );
+ if ( styleHeight !== false ) {
+ size.height = styleHeight +
+ // add padding and border unless it's already including it
+ ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
+ }
+
+ size.innerWidth = size.width - ( paddingWidth + borderWidth );
+ size.innerHeight = size.height - ( paddingHeight + borderHeight );
+
+ size.outerWidth = size.width + marginWidth;
+ size.outerHeight = size.height + marginHeight;
+
+ return size;
+ }
+
+ return getSize;
+
+ })();
+
+ function getElementSize(ele) {
+ return _getSize(ele);
+ }
+});
diff --git a/uikit/static/js/components/grid.min.js b/uikit/static/js/components/grid.min.js
new file mode 100644
index 0000000..ce3bbde
--- /dev/null
+++ b/uikit/static/js/components/grid.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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(t){return e(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);if(!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).data("ukFilter"))}),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.$html.on("changed.uk.dom",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(e){this._prepareElements(),e=e||this.element.children(":visible");var n,r,o,a,s,d,h,u,l=e,f=this.element.width()+2*this.gutterh+2,c=0,p=0,g=[];this.trigger("beforeupdate.uk.grid",[l]),l.each(function(){for(u=i(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||[],"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")}});var e=function(){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}()}); \ No newline at end of file
diff --git a/uikit/static/js/components/htmleditor.js b/uikit/static/js/components/htmleditor.js
new file mode 100644
index 0000000..08586bd
--- /dev/null
+++ b/uikit/static/js/components/htmleditor.js
@@ -0,0 +1,621 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-htmleditor", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI) {
+
+ "use strict";
+
+ var editors = [];
+
+ UI.component('htmleditor', {
+
+ defaults: {
+ iframe : false,
+ mode : 'split',
+ markdown : false,
+ autocomplete : true,
+ height : 500,
+ maxsplitsize : 1000,
+ codemirror : { mode: 'htmlmixed', lineWrapping: true, dragDrop: false, autoCloseTags: true, matchTags: true, autoCloseBrackets: true, matchBrackets: true, indentUnit: 4, indentWithTabs: false, tabSize: 4, hintOptions: {completionSingle:false} },
+ toolbar : [ 'bold', 'italic', 'strike', 'link', 'image', 'blockquote', 'listUl', 'listOl' ],
+ lblPreview : 'Preview',
+ lblCodeview : 'HTML',
+ lblMarkedview: 'Markdown'
+ },
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$('textarea[data-uk-htmleditor]', context).each(function() {
+
+ var editor = UI.$(this), obj;
+
+ if (!editor.data('htmleditor')) {
+ obj = UI.htmleditor(editor, UI.Utils.options(editor.attr('data-uk-htmleditor')));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = this, tpl = UI.components.htmleditor.template;
+
+ this.CodeMirror = this.options.CodeMirror || CodeMirror;
+ this.buttons = {};
+
+ tpl = tpl.replace(/\{:lblPreview\}/g, this.options.lblPreview);
+ tpl = tpl.replace(/\{:lblCodeview\}/g, this.options.lblCodeview);
+
+ this.htmleditor = UI.$(tpl);
+ 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', UI.Utils.debounce(function() { $this.render(); }, 150));
+ this.editor.on('change', function() {
+ $this.editor.save();
+ $this.element.trigger('input');
+ });
+ this.code.find('.CodeMirror').css('height', this.options.height);
+
+ // iframe mode?
+ if (this.options.iframe) {
+
+ this.iframe = UI.$('<iframe class="uk-htmleditor-iframe" frameborder="0" scrolling="auto" height="100" width="100%"></iframe>');
+ this.preview.append(this.iframe);
+
+ // must open and close document object to start using it!
+ this.iframe[0].contentWindow.document.open();
+ this.iframe[0].contentWindow.document.close();
+
+ this.preview.container = UI.$(this.iframe[0].contentWindow.document).find('body');
+
+ // append custom stylesheet
+ if (typeof(this.options.iframe) === 'string') {
+ this.preview.container.parent().append('<link rel="stylesheet" href="'+this.options.iframe+'">');
+ }
+
+ } else {
+ this.preview.container = this.preview;
+ }
+
+ UI.$win.on('resize load', UI.Utils.debounce(function() { $this.fit(); }, 200));
+
+ var previewContainer = this.iframe ? this.preview.container:$this.preview.parent(),
+ codeContent = this.code.find('.CodeMirror-sizer'),
+ codeScroll = this.code.find('.CodeMirror-scroll').on('scroll', UI.Utils.debounce(function() {
+
+ if ($this.htmleditor.attr('data-mode') == 'tab') return;
+
+ // calc position
+ var codeHeight = codeContent.height() - codeScroll.height(),
+ previewHeight = previewContainer[0].scrollHeight - ($this.iframe ? $this.iframe.height() : previewContainer.height()),
+ ratio = previewHeight / codeHeight,
+ previewPostition = codeScroll.scrollTop() * ratio;
+
+ // apply new scroll
+ previewContainer.scrollTop(previewPostition);
+
+ }, 10));
+
+ this.htmleditor.on('click', '.uk-htmleditor-button-code, .uk-htmleditor-button-preview', function(e) {
+
+ e.preventDefault();
+
+ if ($this.htmleditor.attr('data-mode') == 'tab') {
+
+ $this.htmleditor.find('.uk-htmleditor-button-code, .uk-htmleditor-button-preview').removeClass('uk-active').filter(this).addClass('uk-active');
+
+ $this.activetab = UI.$(this).hasClass('uk-htmleditor-button-code') ? 'code' : 'preview';
+ $this.htmleditor.attr('data-active-tab', $this.activetab);
+ $this.editor.refresh();
+ }
+ });
+
+ // toolbar actions
+ this.htmleditor.on('click', 'a[data-htmleditor-button]', function() {
+
+ if (!$this.code.is(':visible')) return;
+
+ $this.trigger('action.' + UI.$(this).data('htmleditor-button'), [$this.editor]);
+ });
+
+ this.preview.parent().css('height', this.code.height());
+
+ // autocomplete
+ if (this.options.autocomplete && this.CodeMirror.showHint && this.CodeMirror.hint && this.CodeMirror.hint.html) {
+
+ this.editor.on('inputRead', UI.Utils.debounce(function() {
+ var doc = $this.editor.getDoc(), POS = doc.getCursor(), mode = $this.CodeMirror.innerMode($this.editor.getMode(), $this.editor.getTokenAt(POS).state).mode.name;
+
+ if (mode == 'xml') { //html depends on xml
+
+ var cur = $this.editor.getCursor(), token = $this.editor.getTokenAt(cur);
+
+ if (token.string.charAt(0) == '<' || token.type == 'attribute') {
+ $this.CodeMirror.showHint($this.editor, $this.CodeMirror.hint.html, { completeSingle: false });
+ }
+ }
+ }, 100));
+ }
+
+ this.debouncedRedraw = UI.Utils.debounce(function () { $this.redraw(); }, 5);
+
+ this.on('init.uk.component', function() {
+ $this.redraw();
+ });
+
+ this.element.attr('data-uk-check-display', 1).on('display.uk.check', function(e) {
+ if (this.htmleditor.is(":visible")) this.fit();
+ }.bind(this));
+
+ editors.push(this);
+ },
+
+ addButton: function(name, button) {
+ this.buttons[name] = button;
+ },
+
+ addButtons: function(buttons) {
+ UI.$.extend(this.buttons, buttons);
+ },
+
+ replaceInPreview: function(regexp, callback) {
+
+ var editor = this.editor, results = [], value = editor.getValue(), offset = -1;
+
+ this.currentvalue = this.currentvalue.replace(regexp, function() {
+
+ offset = value.indexOf(arguments[0], ++offset);
+
+ var match = {
+ matches: arguments,
+ from : translateOffset(offset),
+ to : translateOffset(offset + arguments[0].length),
+ replace: function(value) {
+ editor.replaceRange(value, match.from, match.to);
+ },
+ inRange: function(cursor) {
+
+ if (cursor.line === match.from.line && cursor.line === match.to.line) {
+ return cursor.ch >= match.from.ch && cursor.ch < match.to.ch;
+ }
+
+ return (cursor.line === match.from.line && cursor.ch >= match.from.ch) ||
+ (cursor.line > match.from.line && cursor.line < match.to.line) ||
+ (cursor.line === match.to.line && cursor.ch < match.to.ch);
+ }
+ };
+
+ var result = callback(match);
+
+ if (!result) {
+ return arguments[0];
+ }
+
+ results.push(match);
+ return result;
+ });
+
+ function translateOffset(offset) {
+ var result = editor.getValue().substring(0, offset).split('\n');
+ return { line: result.length - 1, ch: result[result.length - 1].length }
+ }
+
+ return results;
+ },
+
+ _buildtoolbar: function() {
+
+ if (!(this.options.toolbar && this.options.toolbar.length)) return;
+
+ var $this = this, bar = [];
+
+ this.toolbar.empty();
+
+ this.options.toolbar.forEach(function(button) {
+ if (!$this.buttons[button]) return;
+
+ var title = $this.buttons[button].title ? $this.buttons[button].title : button;
+
+ bar.push('<li><a data-htmleditor-button="'+button+'" title="'+title+'" data-uk-tooltip>'+$this.buttons[button].label+'</a></li>');
+ });
+
+ this.toolbar.html(bar.join('\n'));
+ },
+
+ fit: function() {
+
+ var mode = this.options.mode;
+
+ if (mode == 'split' && this.htmleditor.width() < this.options.maxsplitsize) {
+ mode = 'tab';
+ }
+
+ if (mode == 'tab') {
+ if (!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(this.activetab == 'code' ? '.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', mode);
+ },
+
+ redraw: function() {
+ this._buildtoolbar();
+ this.render();
+ this.fit();
+ },
+
+ getMode: function() {
+ return this.editor.getOption('mode');
+ },
+
+ getCursorMode: function() {
+ var param = { mode: 'html'};
+ this.trigger('cursorMode', [param]);
+ return param.mode;
+ },
+
+ render: function() {
+
+ this.currentvalue = this.editor.getValue();
+
+ // empty code
+ if (!this.currentvalue) {
+
+ this.element.val('');
+ this.preview.container.html('');
+
+ return;
+ }
+
+ this.trigger('render', [this]);
+ this.trigger('renderLate', [this]);
+
+ this.preview.container.html(this.currentvalue);
+ },
+
+ addShortcut: function(name, callback) {
+ var map = {};
+ if (!UI.$.isArray(name)) {
+ name = [name];
+ }
+
+ name.forEach(function(key) {
+ map[key] = callback;
+ });
+
+ this.editor.addKeyMap(map);
+
+ return map;
+ },
+
+ addShortcutAction: function(action, shortcuts) {
+ var editor = this;
+ this.addShortcut(shortcuts, function() {
+ editor.element.trigger('action.' + action, [editor.editor]);
+ });
+ },
+
+ replaceSelection: function(replace) {
+
+ var text = this.editor.getSelection();
+
+ if (!text.length) {
+
+ var cur = this.editor.getCursor(),
+ curLine = this.editor.getLine(cur.line),
+ start = cur.ch,
+ end = start;
+
+ while (end < curLine.length && /[\w$]+/.test(curLine.charAt(end))) ++end;
+ while (start && /[\w$]+/.test(curLine.charAt(start - 1))) --start;
+
+ var curWord = start != end && curLine.slice(start, end);
+
+ if (curWord) {
+ this.editor.setSelection({ line: cur.line, ch: start}, { line: cur.line, ch: end });
+ text = curWord;
+ }
+ }
+
+ var html = replace.replace('$1', text);
+
+ this.editor.replaceSelection(html, 'end');
+ this.editor.focus();
+ },
+
+ replaceLine: function(replace) {
+ var pos = this.editor.getDoc().getCursor(),
+ text = this.editor.getLine(pos.line),
+ html = replace.replace('$1', text);
+
+ this.editor.replaceRange(html , { line: pos.line, ch: 0 }, { line: pos.line, ch: text.length });
+ this.editor.setCursor({ line: pos.line, ch: html.length });
+ this.editor.focus();
+ },
+
+ save: function() {
+ this.editor.save();
+ }
+ });
+
+
+ UI.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('');
+
+
+ UI.plugin('htmleditor', 'base', {
+
+ init: function(editor) {
+
+ editor.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>'
+ }
+
+ });
+
+ addAction('bold', '<strong>$1</strong>');
+ addAction('italic', '<em>$1</em>');
+ addAction('strike', '<del>$1</del>');
+ addAction('blockquote', '<blockquote><p>$1</p></blockquote>', 'replaceLine');
+ addAction('link', '<a href="http://">$1</a>');
+ addAction('image', '<img src="http://" alt="$1">');
+
+ var listfn = function() {
+ if (editor.getCursorMode() == 'html') {
+
+ var cm = editor.editor,
+ pos = cm.getDoc().getCursor(true),
+ posend = cm.getDoc().getCursor(false);
+
+ for (var i=pos.line; i<(posend.line+1);i++) {
+ cm.replaceRange('<li>'+cm.getLine(i)+'</li>', { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
+ }
+
+ cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
+ cm.focus();
+ }
+ }
+
+ editor.on('action.listUl', function() {
+ listfn();
+ });
+
+ editor.on('action.listOl', function() {
+ listfn();
+ });
+
+ editor.htmleditor.on('click', 'a[data-htmleditor-button="fullscreen"]', function() {
+ editor.htmleditor.toggleClass('uk-htmleditor-fullscreen');
+
+ var wrap = editor.editor.getWrapperElement();
+
+ if (editor.htmleditor.hasClass('uk-htmleditor-fullscreen')) {
+
+ editor.editor.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, width: wrap.style.width, height: wrap.style.height};
+ wrap.style.width = '';
+ wrap.style.height = editor.content.height()+'px';
+ document.documentElement.style.overflow = 'hidden';
+
+ } else {
+
+ document.documentElement.style.overflow = '';
+ var info = editor.editor.state.fullScreenRestore;
+ wrap.style.width = info.width; wrap.style.height = info.height;
+ window.scrollTo(info.scrollLeft, info.scrollTop);
+ }
+
+ setTimeout(function() {
+ editor.fit();
+ UI.$win.trigger('resize');
+ }, 50);
+ });
+
+ editor.addShortcut(['Ctrl-S', 'Cmd-S'], function() { editor.element.trigger('htmleditor-save', [editor]); });
+ editor.addShortcutAction('bold', ['Ctrl-B', 'Cmd-B']);
+
+ function addAction(name, replace, mode) {
+ editor.on('action.'+name, function() {
+ if (editor.getCursorMode() == 'html') {
+ editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
+ }
+ });
+ }
+ }
+ });
+
+ UI.plugin('htmleditor', 'markdown', {
+
+ init: function(editor) {
+
+ var parser = editor.options.mdparser || marked || null;
+
+ if (!parser) return;
+
+ if (editor.options.markdown) {
+ enableMarkdown();
+ }
+
+ addAction('bold', '**$1**');
+ addAction('italic', '*$1*');
+ addAction('strike', '~~$1~~');
+ addAction('blockquote', '> $1', 'replaceLine');
+ addAction('link', '[$1](http://)');
+ addAction('image', '![$1](http://)');
+
+ editor.on('action.listUl', function() {
+
+ if (editor.getCursorMode() == 'markdown') {
+
+ var cm = editor.editor,
+ pos = cm.getDoc().getCursor(true),
+ posend = cm.getDoc().getCursor(false);
+
+ for (var i=pos.line; i<(posend.line+1);i++) {
+ cm.replaceRange('* '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
+ }
+
+ cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
+ cm.focus();
+ }
+ });
+
+ editor.on('action.listOl', function() {
+
+ if (editor.getCursorMode() == 'markdown') {
+
+ var cm = editor.editor,
+ pos = cm.getDoc().getCursor(true),
+ posend = cm.getDoc().getCursor(false),
+ prefix = 1;
+
+ if (pos.line > 0) {
+ var prevline = cm.getLine(pos.line-1), matches;
+
+ if(matches = prevline.match(/^(\d+)\./)) {
+ prefix = Number(matches[1])+1;
+ }
+ }
+
+ for (var i=pos.line; i<(posend.line+1);i++) {
+ cm.replaceRange(prefix+'. '+cm.getLine(i), { line: i, ch: 0 }, { line: i, ch: cm.getLine(i).length });
+ prefix++;
+ }
+
+ cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length });
+ cm.focus();
+ }
+ });
+
+ editor.on('renderLate', function() {
+ if (editor.editor.options.mode == 'gfm') {
+ editor.currentvalue = parser(editor.currentvalue);
+ }
+ });
+
+ editor.on('cursorMode', function(e, param) {
+ if (editor.editor.options.mode == 'gfm') {
+ var pos = editor.editor.getDoc().getCursor();
+ if (!editor.editor.getTokenAt(pos).state.base.htmlState) {
+ param.mode = 'markdown';
+ }
+ }
+ });
+
+ UI.$.extend(editor, {
+
+ enableMarkdown: function() {
+ enableMarkdown()
+ this.render();
+ },
+ disableMarkdown: function() {
+ this.editor.setOption('mode', 'htmlmixed');
+ this.htmleditor.find('.uk-htmleditor-button-code a').html(this.options.lblCodeview);
+ this.render();
+ }
+
+ });
+
+ // switch markdown mode on event
+ editor.on({
+ enableMarkdown : function() { editor.enableMarkdown(); },
+ disableMarkdown : function() { editor.disableMarkdown(); }
+ });
+
+ function enableMarkdown() {
+ editor.editor.setOption('mode', 'gfm');
+ editor.htmleditor.find('.uk-htmleditor-button-code a').html(editor.options.lblMarkedview);
+ }
+
+ function addAction(name, replace, mode) {
+ editor.on('action.'+name, function() {
+ if (editor.getCursorMode() == 'markdown') {
+ editor[mode == 'replaceLine' ? 'replaceLine' : 'replaceSelection'](replace);
+ }
+ });
+ }
+ }
+ });
+
+ return UI.htmleditor;
+});
diff --git a/uikit/static/js/components/htmleditor.min.js b/uikit/static/js/components/htmleditor.min.js
new file mode 100644
index 0000000..a33d65f
--- /dev/null
+++ b/uikit/static/js/components/htmleditor.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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,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,i=t.$(this);i.data("htmleditor")||(e=t.htmleditor(i,t.Utils.options(i.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 r=this.iframe?this.preview.container:i.preview.parent(),n=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=n.height()-l.height(),e=r[0].scrollHeight-(i.iframe?i.iframe.height():r.height()),o=e/t,s=l.scrollTop()*o;r.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 r=i.editor.getCursor(),n=i.editor.getTokenAt(r);("<"==n.string.charAt(0)||"attribute"==n.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.redraw()}),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,r=[],n=o.getValue(),l=-1;return this.currentvalue=this.currentvalue.replace(t,function(){l=n.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}},s=e(t);return s?(r.push(t),s):arguments[0]}),r},_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.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),r=i.ch,n=r;n<o.length&&/[\w$]+/.test(o.charAt(n));)++n;for(;r&&/[\w$]+/.test(o.charAt(r-1));)--r;var l=r!=n&&o.slice(r,n);l&&(this.editor.setSelection({line:i.line,ch:r},{line:i.line,ch:n}),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(){if("html"==e.getCursorMode()){for(var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),r=i.line;r<o.line+1;r++)t.replaceRange("<li>"+t.getLine(r)+"</li>",{line:r,ch:0},{line:r,ch:t.getLine(r).length});t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}};e.on("action.listUl",function(){o()}),e.on("action.listOl",function(){o()}),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"))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 o=e.editor.state.fullScreenRestore;i.style.width=o.width,i.style.height=o.height,window.scrollTo(o.scrollLeft,o.scrollTop)}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 r=e.options.mdparser||marked||null;r&&(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),r=i.line;r<o.line+1;r++)t.replaceRange("* "+t.getLine(r),{line:r,ch:0},{line:r,ch:t.getLine(r).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),r=1;if(i.line>0){var n,l=t.getLine(i.line-1);(n=l.match(/^(\d+)\./))&&(r=Number(n[1])+1)}for(var s=i.line;s<o.line+1;s++)t.replaceRange(r+". "+t.getLine(s),{line:s,ch:0},{line:s,ch:t.getLine(s).length}),r++;t.setCursor({line:o.line,ch:t.getLine(o.line).length}),t.focus()}}),e.on("renderLate",function(){"gfm"==e.editor.options.mode&&(e.currentvalue=r(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/uikit/static/js/components/lightbox.js b/uikit/static/js/components/lightbox.js
new file mode 100644
index 0000000..1abb1a5
--- /dev/null
+++ b/uikit/static/js/components/lightbox.js
@@ -0,0 +1,544 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) { // AMD
+ define("uikit-lightbox", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var modal, cache = {};
+
+ UI.component('lightbox', {
+
+ defaults: {
+ "group" : false,
+ "duration" : 400,
+ "keyboard" : true
+ },
+
+ index : 0,
+ items : false,
+
+ boot: function() {
+
+ UI.$html.on('click', '[data-uk-lightbox]', function(e){
+
+ e.preventDefault();
+
+ var link = UI.$(this);
+
+ if (!link.data("lightbox")) {
+
+ UI.lightbox(link, UI.Utils.options(link.attr("data-uk-lightbox")));
+ }
+
+ link.data("lightbox").show(link);
+ });
+
+ // keyboard navigation
+ UI.$doc.on('keyup', function(e) {
+
+ if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
+
+ e.preventDefault();
+
+ switch(e.keyCode) {
+ case 37:
+ modal.lightbox.previous();
+ break;
+ case 39:
+ modal.lightbox.next();
+ break;
+ }
+ }
+ });
+ },
+
+ init: function() {
+
+ var $this = this, siblings = [];
+
+ this.index = 0;
+ this.siblings = [];
+
+ if (this.element && this.element.length) {
+
+ var domSiblings = this.options.group ? UI.$([
+ '[data-uk-lightbox*="'+this.options.group+'"]',
+ "[data-uk-lightbox*='"+this.options.group+"']"
+ ].join(',')) : this.element;
+
+ domSiblings.each(function() {
+
+ var ele = UI.$(this);
+
+ siblings.push({
+ 'source': ele.attr('href'),
+ 'title' : ele.attr('title'),
+ 'type' : ele.attr("data-lightbox-type") || 'auto',
+ 'link' : ele
+ });
+ });
+
+ this.index = domSiblings.index(this.element);
+ this.siblings = siblings;
+
+ } else if (this.options.group && this.options.group.length) {
+ this.siblings = this.options.group;
+ }
+
+ this.trigger('lightbox-init', [this]);
+ },
+
+ show: function(index) {
+
+ this.modal = getModal(this);
+
+ // stop previous animation
+ this.modal.dialog.stop();
+ this.modal.content.stop();
+
+ var $this = this, promise = UI.$.Deferred(), data, item;
+
+ index = index || 0;
+
+ // index is a jQuery object or DOM element
+ if (typeof(index) == 'object') {
+
+ this.siblings.forEach(function(s, idx){
+
+ if (index[0] === s.link[0]) {
+ index = idx;
+ }
+ });
+ }
+
+ // fix index if needed
+ if ( index < 0 ) {
+ index = this.siblings.length - index;
+ } else if (!this.siblings[index]) {
+ index = 0;
+ }
+
+ item = this.siblings[index];
+
+ data = {
+ "lightbox" : $this,
+ "source" : item.source,
+ "type" : item.type,
+ "index" : index,
+ "promise" : promise,
+ "title" : item.title,
+ "item" : item,
+ "meta" : {
+ "content" : '',
+ "width" : null,
+ "height" : null
+ }
+ };
+
+ this.index = index;
+
+ this.modal.content.empty();
+
+ if (!this.modal.is(':visible')) {
+ this.modal.content.css({width:'', height:''}).empty();
+ this.modal.modal.show();
+ }
+
+ this.modal.loader.removeClass('uk-hidden');
+
+ promise.promise().done(function() {
+
+ $this.data = data;
+ $this.fitSize(data);
+
+ }).fail(function(){
+
+ data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
+ data.meta.width = 400;
+ data.meta.height = 300;
+
+ $this.data = data;
+ $this.fitSize(data);
+ });
+
+ $this.trigger('showitem.uk.lightbox', [data]);
+ },
+
+ fitSize: function() {
+
+ var $this = this,
+ data = this.data,
+ pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
+ dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
+ dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
+ dpad = dpadTop + dpadBot,
+ content = data.meta.content,
+ duration = $this.options.duration;
+
+ if (this.siblings.length > 1) {
+
+ content = [
+ content,
+ '<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('');
+ }
+
+ // calculate width
+ var tmp = UI.$('<div>&nbsp;</div>').css({
+ 'opacity' : 0,
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'width' : '100%',
+ 'max-width' : $this.modal.dialog.css('max-width'),
+ 'padding' : $this.modal.dialog.css('padding'),
+ 'margin' : $this.modal.dialog.css('margin')
+ }), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
+
+ tmp.appendTo('body').width();
+
+ maxwidth = tmp.width();
+ maxheight = window.innerHeight - dpad;
+
+ tmp.remove();
+
+ this.modal.dialog.find('.uk-modal-caption').remove();
+
+ if (data.title) {
+ this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
+ maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
+ }
+
+ if (maxwidth < data.meta.width) {
+
+ h = Math.floor( h * (maxwidth / w) );
+ w = maxwidth;
+ }
+
+ if (maxheight < h) {
+
+ h = Math.floor(maxheight);
+ w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
+ }
+
+ this.modal.content.css('opacity', 0).width(w).html(content);
+
+ if (data.type == 'iframe') {
+ this.modal.content.find('iframe:first').height(h);
+ }
+
+ var dh = h + pad,
+ t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
+
+ if (t < 0) { t = 0; }
+
+ this.modal.closer.addClass('uk-hidden');
+
+ if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
+ duration = 0;
+ }
+
+ this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
+ $this.modal.loader.addClass('uk-hidden');
+ $this.modal.content.css({width:''}).animate({'opacity': 1}, function() {
+ $this.modal.closer.removeClass('uk-hidden');
+ });
+
+ $this.modal.data({'mwidth': w, 'mheight': h});
+ });
+ },
+
+ 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);
+ }
+ });
+
+
+ // Plugins
+
+ UI.plugin('lightbox', 'image', {
+
+ init: function(lightbox) {
+
+ lightbox.on("showitem.uk.lightbox", function(e, data){
+
+ if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
+
+ var resolve = function(source, width, height) {
+
+ data.meta = {
+ "content" : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
+ "width" : width,
+ "height" : height
+ };
+
+ data.type = 'image';
+
+ data.promise.resolve();
+ };
+
+ if (!cache[data.source]) {
+
+ var img = new Image();
+
+ img.onerror = function(){
+ data.promise.reject('Loading image failed');
+ };
+
+ img.onload = function(){
+ cache[data.source] = {width: img.width, height: img.height};
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
+ };
+
+ img.src = data.source;
+
+ } else {
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
+ }
+ }
+ });
+ }
+ });
+
+ UI.plugin("lightbox", "youtube", {
+
+ init: function(lightbox) {
+
+ var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
+ youtubeRegExpShort = /youtu\.be\/(.*)/;
+
+
+ lightbox.on("showitem.uk.lightbox", function(e, data){
+
+ var id, matches, resolve = function(id, width, height) {
+
+ data.meta = {
+ 'content': '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"></iframe>',
+ 'width': width,
+ 'height': height
+ };
+
+ data.type = 'iframe';
+
+ data.promise.resolve();
+ };
+
+ if (matches = data.source.match(youtubeRegExp)) {
+ id = matches[2];
+ }
+
+ if (matches = data.source.match(youtubeRegExpShort)) {
+ id = matches[1];
+ }
+
+ if (id) {
+
+ if(!cache[id]) {
+
+ var img = new Image();
+
+ img.onerror = function(){
+ cache[id] = {width:640, height:320};
+ resolve(id, cache[id].width, cache[id].height);
+ };
+
+ img.onload = function(){
+ cache[id] = {width:img.width, height:img.height};
+ resolve(id, img.width, img.height);
+ };
+
+ img.src = '//img.youtube.com/vi/'+id+'/0.jpg';
+
+ } else {
+ resolve(id, cache[id].width, cache[id].height);
+ }
+
+ e.stopImmediatePropagation();
+ }
+ });
+ }
+ });
+
+
+ UI.plugin("lightbox", "vimeo", {
+
+ init: function(lightbox) {
+
+ var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
+
+
+ lightbox.on("showitem.uk.lightbox", function(e, data){
+
+ var id, resolve = function(id, width, height) {
+
+ data.meta = {
+ 'content': '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"></iframe>',
+ 'width': width,
+ 'height': height
+ };
+
+ data.type = 'iframe';
+
+ data.promise.resolve();
+ };
+
+ if (matches = data.source.match(regex)) {
+
+ id = matches[2];
+
+ if(!cache[id]) {
+
+ UI.$.ajax({
+ type : 'GET',
+ url : 'http://vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
+ jsonp : 'callback',
+ dataType : 'jsonp',
+ success : function(data) {
+ cache[id] = {width:data.width, height:data.height};
+ resolve(id, cache[id].width, cache[id].height);
+ }
+ });
+
+ } else {
+ resolve(id, cache[id].width, cache[id].height);
+ }
+
+ e.stopImmediatePropagation();
+ }
+ });
+ }
+ });
+
+ UI.plugin("lightbox", "video", {
+
+ init: function(lightbox) {
+
+ lightbox.on("showitem.uk.lightbox", function(e, data){
+
+
+ var resolve = function(source, width, height) {
+
+ data.meta = {
+ 'content': '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
+ 'width': width,
+ 'height': height
+ };
+
+ data.type = 'video';
+
+ data.promise.resolve();
+ };
+
+ if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
+
+ if (!cache[data.source]) {
+
+ var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
+
+ var idle = setInterval(function() {
+
+ if (vid[0].videoWidth) {
+ clearInterval(idle);
+ cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
+ vid.remove();
+ }
+
+ }, 20);
+
+ } else {
+ resolve(data.source, cache[data.source].width, cache[data.source].height);
+ }
+ }
+ });
+ }
+ });
+
+
+ function getModal(lightbox) {
+
+ if (modal) {
+ modal.lightbox = lightbox;
+ return modal;
+ }
+
+ // init lightbox container
+ modal = UI.$([
+ '<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');
+
+ modal.dialog = modal.find('.uk-modal-dialog:first');
+ modal.content = modal.find('.uk-lightbox-content:first');
+ modal.loader = modal.find('.uk-modal-spinner:first');
+ modal.closer = modal.find('.uk-close.uk-close-alt');
+ modal.modal = UI.modal(modal, {modal:false});
+
+ // next / previous
+ modal.on("swipeRight swipeLeft", function(e) {
+ modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
+ }).on("click", "[data-lightbox-previous], [data-lightbox-next]", function(e){
+ e.preventDefault();
+ modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
+ });
+
+ // destroy content on modal hide
+ modal.on("hide.uk.modal", function(e) {
+ modal.content.html('');
+ });
+
+ UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
+ if (modal.is(':visible') && !UI.Utils.isFullscreen()) modal.lightbox.fitSize();
+ }.bind(this), 100));
+
+ modal.lightbox = lightbox;
+
+ return modal;
+ }
+
+ UI.lightbox.create = function(items, options) {
+
+ if (!items) return;
+
+ var group = [], o;
+
+ items.forEach(function(item) {
+
+ group.push(UI.$.extend({
+ 'source' : '',
+ 'title' : '',
+ 'type' : 'auto',
+ 'link' : false
+ }, (typeof(item) == 'string' ? {'source': item} : item)));
+ });
+
+ o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
+
+ return o;
+ };
+
+ return UI.lightbox;
+});
diff --git a/uikit/static/js/components/lightbox.min.js b/uikit/static/js/components/lightbox.min.js
new file mode 100644
index 0000000..a6aeeb4
--- /dev/null
+++ b/uikit/static/js/components/lightbox.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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){return e?(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("")}),i.$win.on("load resize orientationchange",i.Utils.debounce(function(){e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize()}.bind(this),100)),e.lightbox=t,e)}var e,o={};return i.component("lightbox",{defaults:{group:!1,duration:400,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("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,d=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 l,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(),l=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()),l<e.meta.width&&(g=Math.floor(g*(l/c)),c=l),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&&(d=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},d,"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=([^&]+)&?(.*)/,e=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,n){var s,h,a=function(i,t,e){n.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+e+'" style="max-width:100%;"></iframe>',width:t,height:e},n.type="iframe",n.promise.resolve()};if((h=n.source.match(t))&&(s=h[2]),(h=n.source.match(e))&&(s=h[1]),s){if(o[s])a(s,o[s].width,o[s].height);else{var d=new Image;d.onerror=function(){o[s]={width:640,height:320},a(s,o[s].width,o[s].height)},d.onload=function(){o[s]={width:d.width,height:d.height},a(s,d.width,d.height)},d.src="//img.youtube.com/vi/"+s+"/0.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var e,n=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,s){var h,a=function(i,t,e){s.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+e+'" style="width:100%;box-sizing:border-box;"></iframe>',width:t,height:e},s.type="iframe",s.promise.resolve()};(e=s.source.match(n))&&(h=e[2],o[h]?a(h,o[h].width,o[h].height):i.$.ajax({type:"GET",url:"http://vimeo.com/api/oembed.json?url="+encodeURI(s.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[h]={width:i.width,height:i.height},a(h,o[h].width,o[h].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)})}}),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/uikit/static/js/components/nestable.js b/uikit/static/js/components/nestable.js
new file mode 100644
index 0000000..a7f423f
--- /dev/null
+++ b/uikit/static/js/components/nestable.js
@@ -0,0 +1,625 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+/*
+ * Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
+ */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-nestable", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI) {
+
+ "use strict";
+
+ var hasTouch = 'ontouchstart' in window,
+ html = UI.$html,
+ touchedlists = [],
+ $win = UI.$win,
+ draggingElement, dragSource;
+
+ var eStart = hasTouch ? 'touchstart' : 'mousedown',
+ eMove = hasTouch ? 'touchmove' : 'mousemove',
+ eEnd = hasTouch ? 'touchend' : 'mouseup',
+ eCancel = hasTouch ? 'touchcancel' : 'mouseup';
+
+
+ UI.component('nestable', {
+
+ defaults: {
+ listBaseClass : 'uk-nestable',
+ listClass : 'uk-nestable-list',
+ listItemClass : 'uk-nestable-item',
+ dragClass : 'uk-nestable-dragged',
+ movingClass : 'uk-nestable-moving',
+ handleClass : '',
+ collapsedClass : 'uk-collapsed',
+ placeholderClass: 'uk-nestable-placeholder',
+ noDragClass : 'uk-nestable-nodrag',
+ group : false,
+ maxDepth : 10,
+ threshold : 20,
+ idlethreshold : 10
+ },
+
+ boot: function() {
+
+ // adjust document scrolling
+ UI.$html.on('mousemove touchmove', function(e) {
+
+ if (draggingElement) {
+
+ var top = draggingElement.offset().top;
+
+ if (top < UI.$win.scrollTop()) {
+ UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
+ } else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
+ UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
+ }
+ }
+ });
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$("[data-uk-nestable]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if (!ele.data("nestable")) {
+ UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ Object.keys(this.options).forEach(function(key){
+
+ if(String(key).indexOf('Class')!=-1) {
+ $this.options['_'+key] = '.' + $this.options[key];
+ }
+ });
+
+ this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass);
+
+ this.checkEmptyList();
+
+ this.reset();
+ this.element.data('nestable-group', this.options.group || UI.Utils.uid('nestable-group'));
+
+ this.find(this.options._listItemClass).each(function() {
+ $this.setParent(UI.$(this));
+ });
+
+ this.on('click', '[data-nestable-action]', function(e) {
+
+ if ($this.dragEl || (!hasTouch && e.button !== 0)) {
+ return;
+ }
+
+ e.preventDefault();
+
+ var target = UI.$(e.currentTarget),
+ action = target.data('nestableAction'),
+ item = target.closest($this.options._listItemClass);
+
+ if (action === 'collapse') {
+ $this.collapseItem(item);
+ }
+ if (action === 'expand') {
+ $this.expandItem(item);
+ }
+ if (action === 'toggle') {
+ $this.toggleItem(item);
+ }
+ });
+
+ var onStartEvent = function(e) {
+
+ var handle = UI.$(e.target);
+
+ if (e.target === $this.element[0]) {
+ return;
+ }
+
+ if (handle.is($this.options._noDragClass) || handle.closest($this.options._noDragClass).length) {
+ return;
+ }
+
+ if (handle.is('[data-nestable-action]') || handle.closest('[data-nestable-action]').length) {
+ return;
+ }
+
+ if ($this.options.handleClass && !handle.hasClass($this.options.handleClass)) {
+
+ if ($this.options.handleClass) {
+ handle = handle.closest($this.options._handleClass);
+ }
+ }
+
+ if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
+ return;
+ }
+
+ if (e.originalEvent && e.originalEvent.touches) {
+ e = evt.originalEvent.touches[0];
+ }
+
+ $this.delayMove = function(evt) {
+
+ evt.preventDefault();
+ $this.dragStart(e);
+ $this.trigger('start.uk.nestable', [$this]);
+
+ $this.delayMove = false;
+ };
+
+ $this.delayMove.x = parseInt(e.pageX, 10);
+ $this.delayMove.y = parseInt(e.pageY, 10);
+ $this.delayMove.threshold = $this.options.idlethreshold;
+
+ e.preventDefault();
+ };
+
+ var onMoveEvent = function(e) {
+
+ if (e.originalEvent && e.originalEvent.touches) {
+ e = e.originalEvent.touches[0];
+ }
+
+ if ($this.delayMove && (Math.abs(e.pageX - $this.delayMove.x) > $this.delayMove.threshold || Math.abs(e.pageY - $this.delayMove.y) > $this.delayMove.threshold)) {
+
+ if (!window.getSelection().toString()) {
+ $this.delayMove(e);
+ } else {
+ $this.delayMove = false;
+ }
+ }
+
+ if ($this.dragEl) {
+ e.preventDefault();
+ $this.dragMove(e);
+ $this.trigger('move.uk.nestable', [$this]);
+ }
+ };
+
+ var onEndEvent = function(e) {
+
+ if ($this.dragEl) {
+ e.preventDefault();
+ $this.dragStop(hasTouch ? e.touches[0] : e);
+ }
+
+ draggingElement = false;
+ $this.delayMove = false;
+ };
+
+ if (hasTouch) {
+ this.element[0].addEventListener(eStart, onStartEvent, false);
+ window.addEventListener(eMove, onMoveEvent, false);
+ window.addEventListener(eEnd, onEndEvent, false);
+ window.addEventListener(eCancel, onEndEvent, false);
+ } else {
+ this.on(eStart, onStartEvent);
+ $win.on(eMove, onMoveEvent);
+ $win.on(eEnd, onEndEvent);
+ }
+
+ },
+
+ serialize: function() {
+
+ var data,
+ depth = 0,
+ list = this,
+ step = function(level, depth) {
+
+ var array = [ ], items = level.children(list.options._listItemClass);
+
+ items.each(function() {
+
+ var li = UI.$(this),
+ item = {}, attribute,
+ sub = li.children(list.options._listClass);
+
+ for (var i = 0; i < li[0].attributes.length; i++) {
+ attribute = li[0].attributes[i];
+ if (attribute.name.indexOf('data-') === 0) {
+ item[attribute.name.substr(5)] = UI.Utils.str2json(attribute.value);
+ }
+ }
+
+ if (sub.length) {
+ item.children = step(sub, depth + 1);
+ }
+
+ array.push(item);
+
+ });
+ return array;
+ };
+
+ data = step(list.element, depth);
+
+ return data;
+ },
+
+ list: function(options) {
+
+ var data = [],
+ list = this,
+ depth = 0,
+ step = function(level, depth, parent) {
+
+ var items = level.children(options._listItemClass);
+
+ items.each(function(index) {
+ var li = UI.$(this),
+ item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
+ sub = li.children(options._listClass);
+
+ data.push(item);
+
+ if (sub.length) {
+ step(sub, depth + 1, li.data(options.idProperty || 'id'));
+ }
+ });
+ };
+
+ options = UI.$.extend({}, list.options, options);
+
+ step(list.element, depth);
+
+ return data;
+ },
+
+ 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 = false;
+ this.dragEl = null;
+ this.dragRootEl = null;
+ this.dragDepth = 0;
+ this.hasNewRoot = false;
+ this.pointEl = null;
+
+ for (var i=0; i<touchedlists.length; i++) {
+ this.checkEmptyList(touchedlists[i]);
+ }
+
+ touchedlists = [];
+ },
+
+ toggleItem: function(li) {
+ this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
+ },
+
+ expandItem: function(li) {
+ li.removeClass(this.options.collapsedClass);
+ },
+
+ collapseItem: function(li) {
+ var lists = li.children(this.options._listClass);
+ if (lists.length) {
+ li.addClass(this.options.collapsedClass);
+ }
+ },
+
+ expandAll: function() {
+ var list = this;
+ this.find(list.options._listItemClass).each(function() {
+ list.expandItem(UI.$(this));
+ });
+ },
+
+ collapseAll: function() {
+ var list = this;
+ this.find(list.options._listItemClass).each(function() {
+ list.collapseItem(UI.$(this));
+ });
+ },
+
+ setParent: function(li) {
+
+ if (li.children(this.options._listClass).length) {
+ li.addClass("uk-parent");
+ }
+ },
+
+ unsetParent: function(li) {
+ li.removeClass('uk-parent '+this.options.collapsedClass);
+ li.children(this.options._listClass).remove();
+ },
+
+ dragStart: function(e) {
+
+ var mouse = this.mouse,
+ target = UI.$(e.target),
+ dragItem = target.closest(this.options._listItemClass),
+ offset = dragItem.offset();
+
+ this.placeEl = dragItem;
+
+ mouse.offsetX = e.pageX - offset.left;
+ mouse.offsetY = e.pageY - offset.top;
+
+ mouse.startX = mouse.lastX = offset.left;
+ mouse.startY = mouse.lastY = offset.top;
+
+ this.dragRootEl = this.element;
+
+ this.dragEl = UI.$('<ul></ul>').addClass(this.options.listClass + ' ' + this.options.dragClass).append(dragItem.clone());
+ this.dragEl.css('width', dragItem.width());
+ this.placeEl.addClass(this.options.placeholderClass);
+
+ draggingElement = this.dragEl;
+
+ this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
+
+ UI.$body.append(this.dragEl);
+
+ this.dragEl.css({
+ left : offset.left,
+ top : offset.top
+ });
+
+ // total depth of dragging item
+ var i, depth, items = this.dragEl.find(this.options._listItemClass);
+
+ for (i = 0; i < items.length; i++) {
+ depth = UI.$(items[i]).parents(this.options._listClass+','+this.options._listBaseClass).length;
+ if (depth > this.dragDepth) {
+ this.dragDepth = depth;
+ }
+ }
+
+ html.addClass(this.options.movingClass);
+ },
+
+ dragStop: function(e) {
+
+ var el = this.placeEl,
+ root = this.placeEl.parents(this.options._listBaseClass+':first');
+
+ this.placeEl.removeClass(this.options.placeholderClass);
+ this.dragEl.remove();
+
+ if (this.element[0] !== root[0]) {
+
+ root.trigger('change.uk.nestable',[el, "added", root, root.data('nestable')]);
+ this.element.trigger('change.uk.nestable', [el, "removed", this.element, this]);
+
+ } else {
+ this.element.trigger('change.uk.nestable',[el, "moved", this.element, this]);
+ }
+
+ this.trigger('stop.uk.nestable', [this, el]);
+
+ this.reset();
+
+ html.removeClass(this.options.movingClass);
+ },
+
+ dragMove: function(e) {
+ var list, parent, prev, next, depth,
+ opt = this.options,
+ mouse = this.mouse,
+ maxDepth = this.dragRootEl ? this.dragRootEl.data('nestable').options.maxDepth : opt.maxDepth;
+
+ this.dragEl.css({
+ left : e.pageX - mouse.offsetX,
+ top : e.pageY - mouse.offsetY
+ });
+
+ // mouse position last events
+ mouse.lastX = mouse.nowX;
+ mouse.lastY = mouse.nowY;
+ // mouse position this events
+ mouse.nowX = e.pageX;
+ mouse.nowY = e.pageY;
+ // distance mouse moved between events
+ mouse.distX = mouse.nowX - mouse.lastX;
+ mouse.distY = mouse.nowY - mouse.lastY;
+ // direction mouse was moving
+ mouse.lastDirX = mouse.dirX;
+ mouse.lastDirY = mouse.dirY;
+ // direction mouse is now moving (on both axis)
+ mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
+ mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
+ // axis mouse is now moving on
+ var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
+
+ // do nothing on first move
+ if (!mouse.moving) {
+ mouse.dirAx = newAx;
+ mouse.moving = true;
+ return;
+ }
+
+ // calc distance moved on this axis (and direction)
+ if (mouse.dirAx !== newAx) {
+ mouse.distAxX = 0;
+ mouse.distAxY = 0;
+ } else {
+ mouse.distAxX += Math.abs(mouse.distX);
+ if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
+ mouse.distAxX = 0;
+ }
+ mouse.distAxY += Math.abs(mouse.distY);
+ if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
+ mouse.distAxY = 0;
+ }
+ }
+ mouse.dirAx = newAx;
+
+ /**
+ * move horizontal
+ */
+ if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
+ // reset move distance on x-axis for new phase
+ mouse.distAxX = 0;
+ prev = this.placeEl.prev('li');
+
+ // increase horizontal level if previous sibling exists and is not collapsed
+ if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass)) {
+
+ // cannot increase level when item above is collapsed
+ list = prev.find(opt._listClass).last();
+
+ // check if depth limit has reached
+ depth = this.placeEl.parents(opt._listClass+','+opt._listBaseClass).length;
+
+ if (depth + this.dragDepth <= maxDepth) {
+
+ // create new sub-level if one doesn't exist
+ if (!list.length) {
+ list = UI.$('<ul/>').addClass(opt.listClass);
+ list.append(this.placeEl);
+ prev.append(list);
+ this.setParent(prev);
+ } else {
+ // else append to next level up
+ list = prev.children(opt._listClass).last();
+ list.append(this.placeEl);
+ }
+ }
+ }
+ // decrease horizontal level
+ if (mouse.distX < 0) {
+ // we can't decrease a level if an item preceeds the current one
+ next = this.placeEl.next('li');
+ if (!next.length) {
+ parent = this.placeEl.parent();
+ this.placeEl.closest(opt._listItemClass).after(this.placeEl);
+ if (!parent.children().length) {
+ this.unsetParent(parent.parent());
+ }
+ }
+ }
+ }
+
+ var isEmpty = false;
+
+ // find list item under cursor
+ var pointX = this.dragEl.offset().left - (window.pageXOffset || document.scrollLeft || 0),
+ pointY = e.pageY - (window.pageYOffset || document.documentElement.scrollTop);
+ this.pointEl = UI.$(document.elementFromPoint(pointX, pointY));
+
+ if (opt.handleClass && this.pointEl.hasClass(opt.handleClass)) {
+
+ this.pointEl = this.pointEl.closest(opt._listItemClass);
+
+ } else {
+
+ var nestableitem = this.pointEl.closest(opt._listItemClass);
+
+ if (nestableitem.length) {
+ this.pointEl = nestableitem;
+ }
+ }
+
+ if (this.placeEl.find(this.pointEl).length) {
+ return;
+ }
+
+ if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
+ isEmpty = true;
+ this.checkEmptyList(this.pointEl);
+ } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listItemClass)) {
+ return;
+ }
+
+ // find parent list of item under cursor
+ var pointElRoot = this.element,
+ tmpRoot = this.pointEl.closest(this.options._listBaseClass),
+ isNewRoot = pointElRoot[0] !== this.pointEl.closest(this.options._listBaseClass)[0];
+
+ /**
+ * move vertical
+ */
+ if (!mouse.dirAx || isNewRoot || isEmpty) {
+
+ // check if groups match if dragging over new root
+ if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
+ return;
+ } else {
+ touchedlists.push(pointElRoot);
+ }
+
+ // check depth limit
+ depth = this.dragDepth - 1 + this.pointEl.parents(opt._listClass+','+opt._listBaseClass).length;
+
+ if (depth > maxDepth) {
+ return;
+ }
+
+ var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
+
+ parent = this.placeEl.parent();
+
+ if (isEmpty) {
+ this.pointEl.append(this.placeEl);
+ } else if (before) {
+ this.pointEl.before(this.placeEl);
+ } else {
+ this.pointEl.after(this.placeEl);
+ }
+
+ if (!parent.children().length) {
+ if (!parent.data("nestable")) this.unsetParent(parent.parent());
+ }
+
+ this.checkEmptyList(this.dragRootEl);
+ this.checkEmptyList(pointElRoot);
+
+ // parent root list has changed
+ if (isNewRoot) {
+ this.dragRootEl = tmpRoot;
+ this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
+ }
+ }
+ },
+
+ checkEmptyList: function(list) {
+
+ list = list ? UI.$(list) : this.element;
+
+ if (!list.children().length) {
+ list.html('');
+ }
+ }
+
+ });
+
+ return UI.nestable;
+});
diff --git a/uikit/static/js/components/nestable.min.js b/uikit/static/js/components/nestable.min.js
new file mode 100644
index 0000000..30629de
--- /dev/null
+++ b/uikit/static/js/components/nestable.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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",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);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){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,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=t.$(this),o={},h=n.children(i.options._listClass),r=0;r<n[0].attributes.length;r++)s=n[0].attributes[r],0===s.name.indexOf("data-")&&(o[s.name.substr(5)]=t.Utils.str2json(s.value));h.length&&(o.children=l(h,e+1)),a.push(o)}),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 t=this.placeEl,s=this.placeEl.parents(this.options._listBaseClass+":first");this.placeEl.removeClass(this.options.placeholderClass),this.dragEl.remove(),this.element[0]!==s[0]?(s.trigger("change.uk.nestable",[t,"added",s,s.data("nestable")]),this.element.trigger("change.uk.nestable",[t,"removed",this.element,this])):this.element.trigger("change.uk.nestable",[t,"moved",this.element,this]),this.trigger("stop.uk.nestable",[this,t]),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;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)&&(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("li"),n.length||(i=this.placeEl.parent(),this.placeEl.closest(h._listItemClass).after(this.placeEl),i.children().length||this.unsetParent(i.parent()))));var c=!1,g=this.dragEl.offset().left-(window.pageXOffset||document.scrollLeft||0),u=s.pageY-(window.pageYOffset||document.documentElement.scrollTop);if(this.pointEl=t.$(document.elementFromPoint(g,u)),h.handleClass&&this.pointEl.hasClass(h.handleClass))this.pointEl=this.pointEl.closest(h._listItemClass);else{var f=this.pointEl.closest(h._listItemClass);f.length&&(this.pointEl=f)}if(!this.placeEl.find(this.pointEl).length){if(this.pointEl.data("nestable")&&!this.pointEl.children().length)c=!0,this.checkEmptyList(this.pointEl);else if(!this.pointEl.length||!this.pointEl.hasClass(h.listItemClass))return;var m=this.element,v=this.pointEl.closest(this.options._listBaseClass),E=m[0]!==this.pointEl.closest(this.options._listBaseClass)[0];if(!r.dirAx||E||c){if(E&&h.group!==v.data("nestable-group"))return;if(l.push(m),o=this.dragDepth-1+this.pointEl.parents(h._listClass+","+h._listBaseClass).length,o>d)return;var C=s.pageY<this.pointEl.offset().top+this.pointEl.height()/2;i=this.placeEl.parent(),c?this.pointEl.append(this.placeEl):C?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(m),E&&(this.dragRootEl=v,this.hasNewRoot=this.element[0]!==this.dragRootEl[0])}}},checkEmptyList:function(s){s=s?t.$(s):this.element,s.children().length||s.html("")}}),t.nestable}); \ No newline at end of file
diff --git a/uikit/static/js/components/notify.js b/uikit/static/js/components/notify.js
new file mode 100644
index 0000000..b4fba05
--- /dev/null
+++ b/uikit/static/js/components/notify.js
@@ -0,0 +1,191 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-notify", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var containers = {},
+ messages = {},
+
+ notify = function(options){
+
+ if (UI.$.type(options) == 'string') {
+ options = { message: options };
+ }
+
+ if (arguments[1]) {
+ options = UI.$.extend(options, UI.$.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
+ }
+
+ return (new Message(options)).show();
+ },
+ closeAll = function(group, instantly){
+
+ var id;
+
+ if (group) {
+ for(id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
+ } else {
+ for(id in messages) { messages[id].close(instantly); }
+ }
+ };
+
+ var Message = function(options){
+
+ var $this = this;
+
+ this.options = UI.$.extend({}, Message.defaults, options);
+
+ this.uuid = UI.Utils.uid("notifymsg");
+ this.element = UI.$([
+
+ '<div class="uk-notify-message">',
+ '<a class="uk-close"></a>',
+ '<div></div>',
+ '</div>'
+
+ ].join('')).data("notifyMessage", this);
+
+ this.content(this.options.message);
+
+ // status
+ if (this.options.status) {
+ this.element.addClass('uk-notify-message-'+this.options.status);
+ this.currentstatus = this.options.status;
+ }
+
+ this.group = this.options.group;
+
+ messages[this.uuid] = this;
+
+ if(!containers[this.options.pos]) {
+ containers[this.options.pos] = UI.$('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
+
+ var message = UI.$(this).data("notifyMessage");
+
+ message.element.trigger('manualclose.uk.notify', [message]);
+ message.close();
+ });
+ }
+ };
+
+
+ UI.$.extend(Message.prototype, {
+
+ uuid: false,
+ element: false,
+ timout: false,
+ currentstatus: "",
+ group: false,
+
+ show: function() {
+
+ if (this.element.is(":visible")) return;
+
+ var $this = this;
+
+ containers[this.options.pos].show().prepend(this.element);
+
+ var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
+
+ this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
+
+ if ($this.options.timeout) {
+
+ var closefn = function(){ $this.close(); };
+
+ $this.timeout = setTimeout(closefn, $this.options.timeout);
+
+ $this.element.hover(
+ function() { clearTimeout($this.timeout); },
+ function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
+ );
+ }
+
+ });
+
+ return this;
+ },
+
+ close: function(instantly) {
+
+ var $this = this,
+ finalize = function(){
+ $this.element.remove();
+
+ if (!containers[$this.options.pos].children().length) {
+ containers[$this.options.pos].hide();
+ }
+
+ $this.options.onClose.apply($this, []);
+ $this.element.trigger('close.uk.notify', [$this]);
+
+ delete messages[$this.uuid];
+ };
+
+ if (this.timeout) clearTimeout(this.timeout);
+
+ if (instantly) {
+ finalize();
+ } else {
+ this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
+ finalize();
+ });
+ }
+ },
+
+ content: function(html){
+
+ var container = this.element.find(">div");
+
+ if(!html) {
+ return container.html();
+ }
+
+ container.html(html);
+
+ return this;
+ },
+
+ status: function(status) {
+
+ if (!status) {
+ return this.currentstatus;
+ }
+
+ this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
+
+ this.currentstatus = status;
+
+ return this;
+ }
+ });
+
+ Message.defaults = {
+ message: "",
+ status: "",
+ timeout: 5000,
+ group: null,
+ pos: 'top-center',
+ onClose: function() {}
+ };
+
+ UI.notify = notify;
+ UI.notify.message = Message;
+ UI.notify.closeAll = closeAll;
+
+ return notify;
+});
diff --git a/uikit/static/js/components/notify.min.js b/uikit/static/js/components/notify.min.js
new file mode 100644
index 0000000..1289116
--- /dev/null
+++ b/uikit/static/js/components/notify.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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/uikit/static/js/components/pagination.js b/uikit/static/js/components/pagination.js
new file mode 100644
index 0000000..fa01908
--- /dev/null
+++ b/uikit/static/js/components/pagination.js
@@ -0,0 +1,148 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+/*
+ * Based on simplePagination - Copyright (c) 2012 Flavius Matis - http://flaviusmatis.github.com/simplePagination.js/ (MIT)
+ */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-pagination", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.component('pagination', {
+
+ defaults: {
+ items : 1,
+ itemsOnPage : 1,
+ pages : 0,
+ displayedPages : 3,
+ edges : 3,
+ currentPage : 1,
+ lblPrev : false,
+ lblNext : false,
+ onSelectPage : function() {}
+ },
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$("[data-uk-pagination]", context).each(function(){
+ var ele = UI.$(this);
+
+ if (!ele.data("pagination")) {
+ var obj = UI.pagination(ele, UI.Utils.options(ele.attr("data-uk-pagination")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = 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 - 1;
+ this.halfDisplayed = this.options.displayedPages / 2;
+
+ this.on("click", "a[data-page]", function(e){
+ e.preventDefault();
+ $this.selectPage(UI.$(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(pages) {
+ this.pages = pages ? pages : this.pages;
+ this._render();
+ },
+
+ selectPage: function(pageIndex, pages) {
+ this.currentPage = pageIndex;
+ this.render(pages);
+
+ this.options.onSelectPage.apply(this, [pageIndex]);
+ this.trigger('select.uk.pagination', [pageIndex, this]);
+ },
+
+ _render: function() {
+
+ var o = this.options, interval = this._getInterval(), i;
+
+ this.element.empty();
+
+ // Generate Prev link
+ if (o.lblPrev) this._append(o.currentPage - 1, {text: o.lblPrev});
+
+ // Generate start edges
+ if (interval.start > 0 && o.edges > 0) {
+
+ var end = Math.min(o.edges, interval.start);
+
+ for (i = 0; i < end; i++) this._append(i);
+
+ if (o.edges < interval.start && (interval.start - o.edges != 1)) {
+ this.element.append('<li><span>...</span></li>');
+ } else if (interval.start - o.edges == 1) {
+ this._append(o.edges);
+ }
+ }
+
+ // Generate interval links
+ for (i = interval.start; i < interval.end; i++) this._append(i);
+
+ // Generate end edges
+ if (interval.end < this.pages && o.edges > 0) {
+
+ if (this.pages - o.edges > interval.end && (this.pages - o.edges - interval.end != 1)) {
+ this.element.append('<li><span>...</span></li>');
+ } else if (this.pages - o.edges - interval.end == 1) {
+ this._append(interval.end++);
+ }
+
+ var begin = Math.max(this.pages - o.edges, interval.end);
+
+ for (i = begin; i < this.pages; i++) this._append(i);
+ }
+
+ // Generate Next link (unless option is set for at front)
+ if (o.lblNext) this._append(o.currentPage + 1, {text: o.lblNext});
+ },
+
+ _append: function(pageIndex, opts) {
+
+ var $this = this, item, link, options;
+
+ pageIndex = pageIndex < 0 ? 0 : (pageIndex < this.pages ? pageIndex : this.pages - 1);
+ options = UI.$.extend({ text: pageIndex + 1 }, opts);
+
+ 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>';
+
+ this.element.append(item);
+ }
+ });
+
+ return UI.pagination;
+});
diff --git a/uikit/static/js/components/pagination.min.js b/uikit/static/js/components/pagination.min.js
new file mode 100644
index 0000000..220310b
--- /dev/null
+++ b/uikit/static/js/components/pagination.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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:3,edges:3,currentPage:1,lblPrev:!1,lblNext:!1,onSelectPage:function(){}},boot:function(){t.ready(function(e){t.$("[data-uk-pagination]",e).each(function(){var e=t.$(this);if(!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-1,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(e.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(e.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/uikit/static/js/components/parallax.js b/uikit/static/js/components/parallax.js
new file mode 100644
index 0000000..3175027
--- /dev/null
+++ b/uikit/static/js/components/parallax.js
@@ -0,0 +1,417 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-parallax", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var parallaxes = [],
+ supports3d = false,
+ scrolltop = 0,
+ wh = window.innerHeight,
+ checkParallaxes = function() {
+
+ scrolltop = UI.$win.scrollTop();
+
+ window.requestAnimationFrame.apply(window, [function(){
+ for (var i=0; i < parallaxes.length; i++) {
+ parallaxes[i].process();
+ }
+ }]);
+ };
+
+
+ UI.component('parallax', {
+
+ defaults: {
+ velocity : 0.5,
+ target : false,
+ viewport : false,
+ media : false
+ },
+
+ boot: function() {
+
+ supports3d = (function(){
+
+ var el = document.createElement('div'),
+ has3d,
+ transforms = {
+ 'WebkitTransform':'-webkit-transform',
+ 'MSTransform':'-ms-transform',
+ 'MozTransform':'-moz-transform',
+ 'Transform':'transform'
+ };
+
+ // Add it to the body to get the computed style.
+ document.body.insertBefore(el, null);
+
+ for (var t in transforms) {
+ if (el.style[t] !== undefined) {
+ el.style[t] = "translate3d(1px,1px,1px)";
+ has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
+ }
+ }
+
+ document.body.removeChild(el);
+
+ return (has3d !== undefined && has3d.length > 0 && has3d !== "none");
+ })();
+
+ // listen to scroll and resize
+ UI.$doc.on("scrolling.uk.document", checkParallaxes);
+ UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
+ wh = window.innerHeight;
+ checkParallaxes();
+ }, 50));
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$('[data-uk-parallax]', context).each(function() {
+
+ var parallax = UI.$(this);
+
+ if (!parallax.data("parallax")) {
+ var obj = UI.parallax(parallax, UI.Utils.options(parallax.attr("data-uk-parallax")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ this.base = this.options.target ? UI.$(this.options.target) : this.element;
+ this.props = {};
+ this.velocity = (this.options.velocity || 1);
+
+ var reserved = ['target','velocity','viewport','plugins','media'];
+
+ Object.keys(this.options).forEach(function(prop){
+
+ if (reserved.indexOf(prop) !== -1) {
+ return;
+ }
+
+ var start, end, dir, diff, startend = String(this.options[prop]).split(',');
+
+ if (prop.match(/color/i)) {
+ start = startend[1] ? startend[0] : this._getStartValue(prop),
+ end = startend[1] ? startend[1] : startend[0];
+
+ if (!start) {
+ start = 'rgba(255,255,255,0)';
+ }
+
+ } else {
+ start = parseFloat(startend[1] ? startend[0] : this._getStartValue(prop)),
+ end = parseFloat(startend[1] ? startend[1] : startend[0]);
+ diff = (start < end ? (end-start):(start-end));
+ dir = (start < end ? 1:-1);
+ }
+
+ this.props[prop] = { 'start': start, 'end': end, 'dir': dir, 'diff': diff };
+
+ }.bind(this));
+
+ parallaxes.push(this);
+ },
+
+ process: function() {
+
+ if (this.options.media) {
+
+ switch(typeof(this.options.media)) {
+ case 'number':
+ if (window.innerWidth < this.options.media) {
+ return false;
+ }
+ break;
+ case 'string':
+ if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
+ return false;
+ }
+ break;
+ }
+ }
+
+ var percent = this.percentageInViewport();
+
+ if (this.options.viewport !== false) {
+ percent = (this.options.viewport === 0) ? 1 : percent / this.options.viewport;
+ }
+
+ this.update(percent);
+ },
+
+ percentageInViewport: function() {
+
+ var top = this.base.offset().top,
+ height = this.base.outerHeight(),
+ distance, percentage, percent;
+
+ if (top > (scrolltop + wh)) {
+ percent = 0;
+ } else if ((top + height) < scrolltop) {
+ percent = 1;
+ } else {
+
+ if ((top + height) < wh) {
+
+ percent = (scrolltop < wh ? scrolltop : scrolltop - wh) / (top+height);
+
+ } else {
+
+ distance = (scrolltop + wh) - top;
+ percentage = Math.round(distance / ((wh + height) / 100));
+ percent = percentage/100;
+ }
+ }
+
+ return percent;
+ },
+
+ update: function(percent) {
+
+ var css = {'transform':''},
+ compercent = percent * (1 - (this.velocity - (this.velocity * percent))),
+ opts, val;
+
+ if (compercent < 0) compercent = 0;
+ if (compercent > 1) compercent = 1;
+
+ if (this._percent !== undefined && this._percent == compercent) {
+ return;
+ }
+
+ Object.keys(this.props).forEach(function(prop) {
+
+ opts = this.props[prop];
+
+ if (percent === 0) {
+ val = opts.start;
+ } else if(percent === 1) {
+ val = opts.end;
+ } else if(opts.diff !== undefined) {
+ val = opts.start + (opts.diff * compercent * opts.dir);
+ }
+
+ if ((prop == 'bg' || prop == 'bgp') && !this._bgcover) {
+ this._bgcover = initBgImageParallax(this, prop, opts);
+ }
+
+ switch(prop) {
+
+ // transforms
+ case "x":
+ css.transform += supports3d ? ' translate3d('+val+'px, 0, 0)':' translateX('+val+'px)';
+ break;
+ case "xp":
+ css.transform += supports3d ? ' translate3d('+val+'%, 0, 0)':' translateX('+val+'%)';
+ break;
+ case "y":
+ css.transform += supports3d ? ' translate3d(0, '+val+'px, 0)':' translateY('+val+'px)';
+ break;
+ case "yp":
+ css.transform += supports3d ? ' translate3d(0, '+val+'%, 0)':' translateY('+val+'%)';
+ break;
+ case "rotate":
+ css.transform += ' rotate('+val+'deg)';
+ break;
+ case "scale":
+ css.transform += ' scale('+val+')';
+ break;
+
+ // bg image
+ case "bg":
+ css['background-position'] = '50% '+val+'px';
+ break;
+ case "bgp":
+ css['background-position'] = '50% '+val+'%';
+ break;
+
+ // color
+ case "color":
+ case "background-color":
+ case "border-color":
+ css[prop] = calcColor(opts.start, opts.end, compercent);
+ break;
+
+ default:
+ css[prop] = val;
+ break;
+ }
+
+ }.bind(this));
+
+ this.element.css(css);
+
+ this._percent = compercent;
+ },
+
+ _getStartValue: function(prop) {
+
+ var value = 0;
+
+ switch(prop) {
+ case 'scale':
+ value = 1;
+ break;
+ default:
+ value = this.element.css(prop);
+ }
+
+ return (value || 0);
+ }
+
+ });
+
+
+ // helper
+
+ function initBgImageParallax(obj, prop, opts) {
+
+ var img = new Image(), url, loaded, element, size, check, ratio, width, height;
+
+ element = obj.element.css({'background-size': 'cover', 'background-repeat': 'no-repeat'});
+ url = element.css('background-image').replace(/^url\(/g, '').replace(/\)$/g, '').replace(/("|')/g, '');
+ check = function() {
+
+ var w = element.width(), h = element.height(), extra = (prop=='bg') ? opts.diff : (opts.diff/100) * h;
+
+ h += extra;
+ w += Math.ceil(extra * ratio);
+
+ // if element height < parent height (gap underneath)
+ if ((w / ratio) < h) {
+ width = Math.ceil(h * ratio);
+ height = h;
+
+ // element width < parent width (gap to right)
+ } else {
+ width = w;
+ height = Math.ceil(w / ratio);
+ }
+
+ obj.element.css({'background-size': (width+'px '+height+'px')});
+ };
+
+ img.onerror = function(){
+ // image url doesn't exist
+ };
+
+ img.onload = function(){
+ size = {w:img.width, height:img.height};
+ ratio = img.width / img.height;
+
+ UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){
+ check();
+ }, 50));
+
+ check();
+ };
+
+ img.src = url;
+
+ return true;
+ }
+
+
+ // Some named colors to work with, added by Bradley Ayers
+ // From Interface by Stefan Petre
+ // http://interface.eyecon.ro/
+ var colors = {
+ '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]
+ };
+
+ function calcColor(start, end, pos) {
+
+ start = parseColor(start);
+ end = parseColor(end);
+ pos = pos || 0;
+
+ return calculateColor(start, end, pos);
+ }
+
+ /**!
+ * @preserve Color animation 1.6.0
+ * http://www.bitstorm.org/jquery/color-animation/
+ * Copyright 2011, 2013 Edwin Martin <edwin@bitstorm.org>
+ * Released under the MIT and GPL licenses.
+ */
+
+ // Calculate an in-between color. Returns "#aabbcc"-like string.
+ function calculateColor(begin, end, pos) {
+ var color = 'rgba('
+ + parseInt((begin[0] + pos * (end[0] - begin[0])), 10) + ','
+ + parseInt((begin[1] + pos * (end[1] - begin[1])), 10) + ','
+ + parseInt((begin[2] + pos * (end[2] - begin[2])), 10) + ','
+ + (begin && end ? parseFloat(begin[3] + pos * (end[3] - begin[3])) : 1);
+
+ color += ')';
+ return color;
+ }
+
+ // Parse an CSS-syntax color. Outputs an array [r, g, b]
+ function parseColor(color) {
+
+ var match, quadruplet;
+
+ // Match #aabbcc
+ if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) {
+ quadruplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1];
+
+ // Match #abc
+ } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) {
+ quadruplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1];
+
+ // Match rgb(n, n, n)
+ } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+ quadruplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1];
+
+ } 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)) {
+ quadruplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])];
+
+ // No browser returns rgb(n%, n%, n%), so little reason to support this format.
+ } else {
+ quadruplet = colors[color] || [255,255,255,0];
+ }
+ return quadruplet;
+ }
+
+ return UI.parallax;
+});
diff --git a/uikit/static/js/components/parallax.min.js b/uikit/static/js/components/parallax.min.js
new file mode 100644
index 0000000..9964ffa
--- /dev/null
+++ b/uikit/static/js/components/parallax.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-parallax",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";function e(e,a,r){var n,i,o,s,c,p,l,d=new Image;return i=e.element.css({"background-size":"cover","background-repeat":"no-repeat"}),n=i.css("background-image").replace(/^url\(/g,"").replace(/\)$/g,"").replace(/("|')/g,""),s=function(){var t=i.width(),n=i.height(),o="bg"==a?r.diff:r.diff/100*n;n+=o,t+=Math.ceil(o*c),n>t/c?(p=Math.ceil(n*c),l=n):(p=t,l=Math.ceil(t/c)),e.element.css({"background-size":p+"px "+l+"px"})},d.onerror=function(){},d.onload=function(){o={w:d.width,height:d.height},c=d.width/d.height,t.$win.on("load resize orientationchange",t.Utils.debounce(function(){s()},50)),s()},d.src=n,!0}function a(t,e,a){return t=n(t),e=n(e),a=a||0,r(t,e,a)}function r(t,e,a){var r="rgba("+parseInt(t[0]+a*(e[0]-t[0]),10)+","+parseInt(t[1]+a*(e[1]-t[1]),10)+","+parseInt(t[2]+a*(e[2]-t[2]),10)+","+(t&&e?parseFloat(t[3]+a*(e[3]-t[3])):1);return r+=")"}function n(t){var e,a;return a=(e=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(t))?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16),1]:(e=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(t))?[17*parseInt(e[1],16),17*parseInt(e[2],16),17*parseInt(e[3],16),1]:(e=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(t))?[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),1]:(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(t))?[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10),parseFloat(e[4])]:l[t]||[255,255,255,0]}var i=[],o=!1,s=0,c=window.innerHeight,p=function(){s=t.$win.scrollTop(),window.requestAnimationFrame.apply(window,[function(){for(var t=0;t<i.length;t++)i[t].process()}])};t.component("parallax",{defaults:{velocity:.5,target:!1,viewport:!1,media:!1},boot:function(){o=function(){var t,e=document.createElement("div"),a={WebkitTransform:"-webkit-transform",MSTransform:"-ms-transform",MozTransform:"-moz-transform",Transform:"transform"};document.body.insertBefore(e,null);for(var r in a)void 0!==e.style[r]&&(e.style[r]="translate3d(1px,1px,1px)",t=window.getComputedStyle(e).getPropertyValue(a[r]));return document.body.removeChild(e),void 0!==t&&t.length>0&&"none"!==t}(),t.$doc.on("scrolling.uk.document",p),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){c=window.innerHeight,p()},50)),t.ready(function(e){t.$("[data-uk-parallax]",e).each(function(){var e=t.$(this);if(!e.data("parallax")){t.parallax(e,t.Utils.options(e.attr("data-uk-parallax")))}})})},init:function(){this.base=this.options.target?t.$(this.options.target):this.element,this.props={},this.velocity=this.options.velocity||1;var e=["target","velocity","viewport","plugins","media"];Object.keys(this.options).forEach(function(t){if(-1===e.indexOf(t)){var a,r,n,i,o=String(this.options[t]).split(",");t.match(/color/i)?(a=o[1]?o[0]:this._getStartValue(t),r=o[1]?o[1]:o[0],a||(a="rgba(255,255,255,0)")):(a=parseFloat(o[1]?o[0]:this._getStartValue(t)),r=parseFloat(o[1]?o[1]:o[0]),i=r>a?r-a:a-r,n=r>a?1:-1),this.props[t]={start:a,end:r,dir:n,diff:i}}}.bind(this)),i.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 t=this.percentageInViewport();this.options.viewport!==!1&&(t=0===this.options.viewport?1:t/this.options.viewport),this.update(t)},percentageInViewport:function(){var t,e,a,r=this.base.offset().top,n=this.base.outerHeight();return r>s+c?a=0:s>r+n?a=1:c>r+n?a=(c>s?s:s-c)/(r+n):(t=s+c-r,e=Math.round(t/((c+n)/100)),a=e/100),a},update:function(t){var r,n,i={transform:""},s=t*(1-(this.velocity-this.velocity*t));0>s&&(s=0),s>1&&(s=1),(void 0===this._percent||this._percent!=s)&&(Object.keys(this.props).forEach(function(c){switch(r=this.props[c],0===t?n=r.start:1===t?n=r.end:void 0!==r.diff&&(n=r.start+r.diff*s*r.dir),"bg"!=c&&"bgp"!=c||this._bgcover||(this._bgcover=e(this,c,r)),c){case"x":i.transform+=o?" translate3d("+n+"px, 0, 0)":" translateX("+n+"px)";break;case"xp":i.transform+=o?" translate3d("+n+"%, 0, 0)":" translateX("+n+"%)";break;case"y":i.transform+=o?" translate3d(0, "+n+"px, 0)":" translateY("+n+"px)";break;case"yp":i.transform+=o?" translate3d(0, "+n+"%, 0)":" translateY("+n+"%)";break;case"rotate":i.transform+=" rotate("+n+"deg)";break;case"scale":i.transform+=" scale("+n+")";break;case"bg":i["background-position"]="50% "+n+"px";break;case"bgp":i["background-position"]="50% "+n+"%";break;case"color":case"background-color":case"border-color":i[c]=a(r.start,r.end,s);break;default:i[c]=n}}.bind(this)),this.element.css(i),this._percent=s)},_getStartValue:function(t){var e=0;switch(t){case"scale":e=1;break;default:e=this.element.css(t)}return e||0}});var l={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 t.parallax}); \ No newline at end of file
diff --git a/uikit/static/js/components/search.js b/uikit/static/js/components/search.js
new file mode 100644
index 0000000..8de251c
--- /dev/null
+++ b/uikit/static/js/components/search.js
@@ -0,0 +1,92 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-search", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.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(data) {
+
+ var $this = this, opts = this.options;
+
+ this.dropdown.append(this.template({"items":data.results || [], "msgResultsHeader":opts.msgResultsHeader, "msgMoreResults": opts.msgMoreResults, "msgNoResults": opts.msgNoResults}));
+ this.show();
+ }
+ },
+
+ boot: function() {
+
+ // init code
+ UI.$html.on("focus.search.uikit", "[data-uk-search]", function(e) {
+ var ele =UI.$(this);
+
+ if (!ele.data("search")) {
+ var obj = UI.search(ele, UI.Utils.options(ele.attr("data-uk-search")));
+ }
+ });
+ },
+
+ init: function() {
+ var $this = this;
+
+ this.autocomplete = UI.autocomplete(this.element, this.options);
+
+ this.autocomplete.dropdown.addClass('uk-dropdown-search');
+
+ this.autocomplete.input.on("keyup", function(){
+ $this.element[$this.autocomplete.input.val() ? "addClass":"removeClass"]("uk-active");
+ }).closest("form").on("reset", function(){
+ $this.value="";
+ $this.element.removeClass("uk-active");
+ });
+
+ this.on('selectitem.uk.autocomplete', function(e, data) {
+ if (data.url) {
+ location.href = data.url;
+ } else if(data.moreresults) {
+ $this.autocomplete.input.closest('form').submit();
+ }
+ });
+
+ this.element.data("search", this);
+ }
+ });
+});
diff --git a/uikit/static/js/components/search.min.js b/uikit/static/js/components/search.min.js
new file mode 100644
index 0000000..09fedd7
--- /dev/null
+++ b/uikit/static/js/components/search.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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);if(!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/uikit/static/js/components/slider.js b/uikit/static/js/components/slider.js
new file mode 100644
index 0000000..dc77cd4
--- /dev/null
+++ b/uikit/static/js/components/slider.js
@@ -0,0 +1,482 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-slider", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var dragging, delayIdle, anchor, dragged, store = {};
+
+ UI.component('slider', {
+
+ defaults: {
+ center : false,
+ threshold : 10,
+ infinite : true,
+ activecls : 'uk-active'
+ },
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ setTimeout(function(){
+
+ UI.$("[data-uk-slider]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if (!ele.data("slider")) {
+ UI.slider(ele, UI.Utils.options(ele.attr('data-uk-slider')));
+ }
+ });
+
+ }, 0);
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ this.container = this.element.find('.uk-slider');
+ this.focus = 0;
+
+ UI.$win.on("resize load", UI.Utils.debounce(function() {
+ $this.resize(true);
+ }, 100));
+
+ this.on("click.uikit.slider", '[data-uk-slider-item]', function(e) {
+
+ e.preventDefault();
+
+ var item = UI.$(this).attr('data-uk-slider-item');
+
+ if ($this.focus == item) return;
+
+ switch(item) {
+ case 'next':
+ case 'previous':
+ $this[item=='next' ? 'next':'previous']();
+ break;
+ default:
+ $this.updateFocus(parseInt(slide, 10));
+ }
+ });
+
+ this.container.on('touchstart mousedown', function(evt) {
+
+ if (evt.originalEvent && evt.originalEvent.touches) {
+ evt = evt.originalEvent.touches[0];
+ }
+
+ // ignore right click button
+ if (evt.button && evt.button==2 || !$this.active) {
+ return;
+ }
+
+ anchor = UI.$(evt.target).is('a') ? UI.$(evt.target) : UI.$(evt.target).parents('a:first');
+ dragged = false;
+
+ if (anchor.length) {
+
+ anchor.one('click', function(e){
+ if (dragged) e.preventDefault();
+ });
+ }
+
+ delayIdle = function(e) {
+
+ dragged = true;
+ dragging = $this;
+ store = {
+ touchx : parseInt(e.pageX, 10),
+ dir : 1,
+ focus : $this.focus,
+ base : $this.options.center ? 'center':'area'
+ };
+
+ if (e.originalEvent && e.originalEvent.touches) {
+ e = e.originalEvent.touches[0];
+ }
+
+ dragging.element.data({
+ 'pointer-start': {x: parseInt(e.pageX, 10), y: parseInt(e.pageY, 10)},
+ 'pointer-pos-start': $this.pos
+ });
+
+ $this.container.addClass('uk-drag');
+
+ delayIdle = false;
+ };
+
+ delayIdle.x = parseInt(evt.pageX, 10);
+ delayIdle.threshold = $this.options.threshold;
+
+ });
+
+ this.resize(true);
+
+ this.on('display.uk.check', function(){
+ if ($this.element.is(":visible")) {
+ $this.resize(true);
+ }
+ });
+
+ // prevent dragging links + images
+ this.element.find('a,img').attr('draggable', 'false');
+ },
+
+ resize: function(focus) {
+
+ var $this = this, pos = 0, maxheight = 0, item, width, cwidth, size;
+
+ 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(idx){
+
+ item = UI.$(this);
+ size = item.css({'left': '', 'width':''})[0].getBoundingClientRect();
+ width = size.width;
+ cwidth = item.width();
+ maxheight = Math.max(maxheight, size.height);
+
+ 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))});
+
+ pos += width;
+ });
+
+ this.container.css({'min-width': pos, 'min-height': maxheight});
+
+ if (this.options.infinite && pos <= (2*this.vp) && !this.itemsResized) {
+
+ // fill with cloned items
+ this.container.children().each(function(idx){
+ $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
+ }).each(function(idx){
+ $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
+ });
+
+ this.itemsResized = true;
+
+ return this.resize();
+ }
+
+ this.cw = pos;
+ this.pos = 0;
+ this.active = pos >= this.vp;
+
+ this.container.css({
+ '-ms-transform': '',
+ '-webkit-transform': '',
+ 'transform': ''
+ });
+
+ this.updateFocus(0);
+ },
+
+ updatePos: function(pos) {
+ this.pos = pos;
+ this.container.css({
+ '-ms-transform': 'translateX('+pos+'px)',
+ '-webkit-transform': 'translateX('+pos+'px)',
+ 'transform': 'translateX('+pos+'px)'
+ });
+ },
+
+ updateFocus: function(idx, dir) {
+
+ if (!this.active) {
+ return;
+ }
+
+ dir = dir || (idx > this.focus ? 1:-1);
+
+ var $this = this, item = this.items.eq(idx), area, i;
+
+ if (this.options.infinite) {
+ this.infinite(idx, dir);
+ }
+
+ if (this.options.center) {
+
+ this.updatePos(item.data('center')*-1);
+
+ this.items.filter('.'+this.options.activecls).removeClass(this.options.activecls);
+ item.addClass(this.options.activecls);
+
+ } else {
+
+ if (this.options.infinite) {
+
+ this.updatePos(item.data('left')*-1);
+
+ } else {
+
+ area = 0;
+
+ for (i=idx;i<this.items.length;i++) {
+ area += this.items.eq(i).data('width');
+ }
+
+
+ if (area > this.vp) {
+
+ this.updatePos(item.data('left')*-1);
+
+ } else {
+
+ if (dir == 1) {
+
+ area = 0;
+
+ for (i=this.items.length-1;i>=0;i--) {
+
+ area += this.items.eq(i).data('width');
+
+ if (area >= this.vp) {
+ idx = i;
+ break;
+ }
+ }
+
+ this.updatePos(this.items.eq(idx).data('left')*-1);
+ }
+ }
+ }
+ }
+
+ this.focus = idx;
+
+ this.trigger('focusitem.uk.slider', [idx,this.items.eq(idx),this]);
+ },
+
+ next: function() {
+
+ var focus = this.items[this.focus + 1] ? (this.focus + 1) : (this.options.infinite ? 0:this.focus);
+
+ this.updateFocus(focus, 1);
+ },
+
+ previous: function() {
+
+ 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);
+
+ this.updateFocus(focus, -1);
+ },
+
+ infinite: function(baseidx, direction) {
+
+ var $this = this, item = this.items.eq(baseidx), i, z = baseidx, move = [], lastvisible, area = 0;
+
+ if (direction == 1) {
+
+
+ for (i=0;i<this.items.length;i++) {
+
+ if (z != baseidx) {
+ area += this.items.eq(z).data('width');
+ move.push(this.items.eq(z));
+ }
+
+ if (area > this.vp) {
+ break;
+ }
+
+ z = z+1 == this.items.length ? 0:z+1;
+ }
+
+ if (move.length) {
+
+ move.forEach(function(itm){
+
+ var left = item.data('area');
+
+ itm.css({'left': left}).data({
+ 'left' : left,
+ 'area' : (left+itm.data('width')),
+ 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
+ });
+
+ item = itm;
+ });
+ }
+
+
+ } else {
+
+ for (i=this.items.length-1;i >-1 ;i--) {
+
+ area += this.items.eq(z).data('width');
+
+ if (z != baseidx) {
+ move.push(this.items.eq(z));
+ }
+
+ if (area > this.vp) {
+ break;
+ }
+
+ z = z-1 == -1 ? this.items.length-1:z-1;
+ }
+
+ if (move.length) {
+
+ move.forEach(function(itm){
+
+ var left = item.data('left') - itm.data('width');
+
+ itm.css({'left': left}).data({
+ 'left' : left,
+ 'area' : (left+itm.data('width')),
+ 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
+ });
+
+ item = itm;
+ });
+ }
+ }
+ }
+ });
+
+ // handle dragging
+ UI.$doc.on('mousemove.uikit.slider touchmove.uikit.slider', function(e) {
+
+ if (e.originalEvent && e.originalEvent.touches) {
+ e = e.originalEvent.touches[0];
+ }
+
+ if (delayIdle && Math.abs(e.pageX - delayIdle.x) > delayIdle.threshold) {
+
+ if (!window.getSelection().toString()) {
+ delayIdle(e);
+ } else {
+ dragging = delayIdle = false;
+ }
+ }
+
+ if (!dragging) {
+ return;
+ }
+
+ var x, xDiff, pos, dir, focus, item, next, diff, i, z, itm;
+
+ if (e.clientX || e.clientY) {
+ x = e.clientX;
+ } else if (e.pageX || e.pageY) {
+ x = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft;
+ }
+
+ focus = store.focus;
+ xDiff = x - dragging.element.data('pointer-start').x;
+ pos = dragging.element.data('pointer-pos-start') + xDiff;
+ dir = x > dragging.element.data('pointer-start').x ? -1:1;
+ item = dragging.items.eq(store.focus);
+
+ if (dir == 1) {
+
+ diff = item.data('left') + Math.abs(xDiff);
+
+ for (i=0,z=store.focus;i<dragging.items.length;i++) {
+
+ itm = dragging.items.eq(z);
+
+ if (z != store.focus && itm.data('left') < diff && itm.data('area') > diff) {
+ focus = z;
+ break;
+ }
+
+ z = z+1 == dragging.items.length ? 0:z+1;
+ }
+
+ } else {
+
+ diff = item.data('left') - Math.abs(xDiff);
+
+ for (i=0,z=store.focus;i<dragging.items.length;i++) {
+
+ itm = dragging.items.eq(z);
+
+ if (z != store.focus && itm.data('area') <= item.data('left') && itm.data('center') < diff) {
+ focus = z;
+ break;
+ }
+
+ z = z-1 == -1 ? dragging.items.length-1:z-1;
+ }
+ }
+
+ if (dragging.options.infinite && focus!=store._focus) {
+ dragging.infinite(focus, dir);
+ }
+
+ dragging.updatePos(pos);
+
+ store.dir = dir;
+ store._focus = focus;
+ store.touchx = parseInt(e.pageX, 10);
+ store.diff = diff;
+ });
+
+ UI.$doc.on('mouseup.uikit.slider touchend.uikit.slider', function(e) {
+
+ if (dragging) {
+
+ dragging.container.removeClass('uk-drag');
+
+ var item = dragging.items.eq(store.focus), itm, focus = false, i, z;
+
+ if (store.dir == 1) {
+
+ for (i=0,z=store.focus;i<dragging.items.length;i++) {
+
+ itm = dragging.items.eq(z);
+
+ if (z != store.focus && itm.data('left') > store.diff) {
+ focus = z;
+ break;
+ }
+
+ z = z+1 == dragging.items.length ? 0:z+1;
+ }
+
+ } else {
+
+ for (i=0,z=store.focus;i<dragging.items.length;i++) {
+
+ itm = dragging.items.eq(z);
+
+ if (z != store.focus && itm.data('left') < store.diff) {
+ focus = z;
+ break;
+ }
+
+ z = z-1 == -1 ? dragging.items.length-1:z-1;
+ }
+ }
+
+ dragging.updateFocus(focus!==false ? focus:store._focus);
+
+ }
+
+ dragging = delayIdle = false;
+ });
+
+ return UI.slider;
+});
diff --git a/uikit/static/js/components/slider.min.js b/uikit/static/js/components/slider.min.js
new file mode 100644
index 0000000..5159096
--- /dev/null
+++ b/uikit/static/js/components/slider.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slider",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";var i,e,s,n,a={};return t.component("slider",{defaults:{center:!1,threshold:10,infinite:!0,activecls:"uk-active"},boot:function(){t.ready(function(i){setTimeout(function(){t.$("[data-uk-slider]",i).each(function(){var i=t.$(this);i.data("slider")||t.slider(i,t.Utils.options(i.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.uikit.slider","[data-uk-slider-item]",function(i){i.preventDefault();var e=t.$(this).attr("data-uk-slider-item");if(o.focus!=e)switch(e){case"next":case"previous":o["next"==e?"next":"previous"]();break;default:o.updateFocus(parseInt(slide,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||(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()}),e=function(t){n=!0,i=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]),i.element.data({"pointer-start":{x:parseInt(t.pageX,10),y:parseInt(t.pageY,10)},"pointer-pos-start":o.pos}),o.container.addClass("uk-drag"),e=!1},e.x=parseInt(h.pageX,10),e.threshold=o.options.threshold)}),this.resize(!0),this.on("display.uk.check",function(){o.element.is(":visible")&&o.resize(!0)}),this.element.find("a,img").attr("draggable","false")},resize:function(){var i,e,s,n,a=this,o=0,h=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(r){i=t.$(this),n=i.css({left:"",width:""})[0].getBoundingClientRect(),e=n.width,s=i.width(),h=Math.max(h,n.height),i.css({left:o,width:e}).data({idx:r,left:o,width:e,cwidth:s,area:o+e,center:o-(a.vp/2-s/2)}),o+=e}),this.container.css({"min-width":o,"min-height":h}),this.options.infinite&&o<=2*this.vp&&!this.itemsResized?(this.container.children().each(function(t){a.container.append(a.items.eq(t).clone(!0).attr("id",""))}).each(function(t){a.container.append(a.items.eq(t).clone(!0).attr("id",""))}),this.itemsResized=!0,this.resize()):(this.cw=o,this.pos=0,this.active=o>=this.vp,this.container.css({"-ms-transform":"","-webkit-transform":"",transform:""}),this.updateFocus(0),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(t,i){if(this.active){i=i||(t>this.focus?1:-1);var e,s,n=this.items.eq(t);if(this.options.infinite&&this.infinite(t,i),this.options.center)this.updatePos(-1*n.data("center")),this.items.filter("."+this.options.activecls).removeClass(this.options.activecls),n.addClass(this.options.activecls);else if(this.options.infinite)this.updatePos(-1*n.data("left"));else{for(e=0,s=t;s<this.items.length;s++)e+=this.items.eq(s).data("width");if(e>this.vp)this.updatePos(-1*n.data("left"));else if(1==i){for(e=0,s=this.items.length-1;s>=0;s--)if(e+=this.items.eq(s).data("width"),e>=this.vp){t=s;break}this.updatePos(-1*this.items.eq(t).data("left"))}}this.focus=t,this.trigger("focusitem.uk.slider",[t,this.items.eq(t),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)},infinite:function(t,i){var e,s=this,n=this.items.eq(t),a=t,o=[],h=0;if(1==i){for(e=0;e<this.items.length&&(a!=t&&(h+=this.items.eq(a).data("width"),o.push(this.items.eq(a))),!(h>this.vp));e++)a=a+1==this.items.length?0:a+1;o.length&&o.forEach(function(t){var i=n.data("area");t.css({left:i}).data({left:i,area:i+t.data("width"),center:i-(s.vp/2-t.data("cwidth")/2)}),n=t})}else{for(e=this.items.length-1;e>-1&&(h+=this.items.eq(a).data("width"),a!=t&&o.push(this.items.eq(a)),!(h>this.vp));e--)a=a-1==-1?this.items.length-1:a-1;o.length&&o.forEach(function(t){var i=n.data("left")-t.data("width");t.css({left:i}).data({left:i,area:i+t.data("width"),center:i-(s.vp/2-t.data("cwidth")/2)}),n=t})}}}),t.$doc.on("mousemove.uikit.slider touchmove.uikit.slider",function(t){if(t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),e&&Math.abs(t.pageX-e.x)>e.threshold&&(window.getSelection().toString()?i=e=!1:e(t)),i){var s,n,o,h,r,c,f,d,u,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-i.element.data("pointer-start").x,o=i.element.data("pointer-pos-start")+n,h=s>i.element.data("pointer-start").x?-1:1,c=i.items.eq(a.focus),1==h)for(f=c.data("left")+Math.abs(n),d=0,u=a.focus;d<i.items.length;d++){if(l=i.items.eq(u),u!=a.focus&&l.data("left")<f&&l.data("area")>f){r=u;break}u=u+1==i.items.length?0:u+1}else for(f=c.data("left")-Math.abs(n),d=0,u=a.focus;d<i.items.length;d++){if(l=i.items.eq(u),u!=a.focus&&l.data("area")<=c.data("left")&&l.data("center")<f){r=u;break}u=u-1==-1?i.items.length-1:u-1}i.options.infinite&&r!=a._focus&&i.infinite(r,h),i.updatePos(o),a.dir=h,a._focus=r,a.touchx=parseInt(t.pageX,10),a.diff=f}}),t.$doc.on("mouseup.uikit.slider touchend.uikit.slider",function(){if(i){i.container.removeClass("uk-drag");var t,s,n,o=(i.items.eq(a.focus),!1);if(1==a.dir)for(s=0,n=a.focus;s<i.items.length;s++){if(t=i.items.eq(n),n!=a.focus&&t.data("left")>a.diff){o=n;break}n=n+1==i.items.length?0:n+1}else for(s=0,n=a.focus;s<i.items.length;s++){if(t=i.items.eq(n),n!=a.focus&&t.data("left")<a.diff){o=n;break}n=n-1==-1?i.items.length-1:n-1}i.updateFocus(o!==!1?o:a._focus)}i=e=!1}),t.slider}); \ No newline at end of file
diff --git a/uikit/static/js/components/slideset.js b/uikit/static/js/components/slideset.js
new file mode 100644
index 0000000..b6693d7
--- /dev/null
+++ b/uikit/static/js/components/slideset.js
@@ -0,0 +1,503 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-slideset", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var Animations;
+
+ UI.component('slideset', {
+
+ defaults: {
+ default : 1,
+ animation : 'fade',
+ duration : 200,
+ filter : '',
+ delay : false,
+ controls : false,
+ autoplay : false,
+ autoplayInterval : 7000,
+ pauseOnHover : true
+ },
+
+ sets: [],
+
+ boot: function() {
+
+ // auto init
+ UI.ready(function(context) {
+
+ UI.$("[data-uk-slideset]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if(!ele.data("slideset")) {
+ var plugin = UI.slideset(ele, UI.Utils.options(ele.attr("data-uk-slideset")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ this.activeSet = false;
+ this.list = this.element.find('.uk-slideset');
+ this.nav = this.element.find('.uk-slideset-nav');
+ this.controls = this.options.controls ? UI.$(this.options.controls) : this.element;
+
+ UI.$win.on("resize load", UI.Utils.debounce(function() {
+ $this.updateSets();
+ }, 100));
+
+ $this.list.addClass('uk-grid-width-1-'+$this.options.default);
+
+ ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
+
+ if (!$this.options[bp]) {
+ return;
+ }
+
+ $this.list.addClass('uk-grid-width-'+bp+'-1-'+$this.options[bp]);
+ });
+
+ this.on("click.uikit.slideset", '[data-uk-slideset-item]', function(e) {
+
+ e.preventDefault();
+
+ if ($this.animating) {
+ return;
+ }
+
+ var set = UI.$(this).attr('data-uk-slideset-item');
+
+ if ($this.activeSet === set) return;
+
+ switch(set) {
+ case 'next':
+ case 'previous':
+ $this[set=='next' ? 'next':'previous']();
+ break;
+ default:
+ $this.show(parseInt(set, 10));
+ }
+
+ });
+
+ this.controls.on('click.uikit.slideset', '[data-uk-filter]', function(e) {
+
+ var ele = UI.$(this);
+
+ if (ele.parent().hasClass('uk-slideset')) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if ($this.animating || $this.currentFilter == ele.attr('data-uk-filter')) {
+ return;
+ }
+
+ $this.updateFilter(ele.attr('data-uk-filter'));
+
+ $this._hide().then(function(){
+
+ $this.updateSets(true, true);
+ });
+ });
+
+ this.on('swipeRight swipeLeft', function(e) {
+ $this[e.type=='swipeLeft' ? 'next' : 'previous']();
+ });
+
+ this.updateFilter(this.options.filter);
+ this.updateSets();
+
+ this.element.on({
+ mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
+ mouseleave: function() { $this.hovering = false; }
+ });
+
+ // Set autoplay
+ if (this.options.autoplay) {
+ this.start();
+ }
+ },
+
+ updateSets: function(animate, force) {
+
+ var $this = this, visible = this.visible, i;
+
+ this.visible = this.getVisibleOnCurrenBreakpoint();
+
+ if (visible == this.visible && !force) {
+ return;
+ }
+
+ this.children = this.list.children().hide();
+ this.items = this.getItems();
+ this.sets = array_chunk(this.items, this.visible);
+
+ for (i=0;i<this.sets.length;i++) {
+ this.sets[i].css({'display': 'none'});
+ }
+
+ // update nav
+ if (this.nav.length && this.nav.empty()) {
+
+ for (i=0;i<this.sets.length;i++) {
+ this.nav.append('<li data-uk-slideset-item="'+i+'"><a></a></li>');
+ }
+
+ this.nav[this.nav.children().length==1 ? 'addClass':'removeClass']('uk-invisible');
+ }
+
+ this.activeSet = false;
+ this.show(0, !animate);
+ },
+
+ updateFilter: function(currentfilter) {
+
+ var $this = this, filter;
+
+ this.currentFilter = currentfilter;
+
+ this.controls.find('[data-uk-filter]').each(function(){
+
+ filter = UI.$(this);
+
+ if (!filter.parent().hasClass('uk-slideset')) {
+
+ if (filter.attr('data-uk-filter') == $this.currentFilter) {
+ filter.addClass('uk-active');
+ } else {
+ filter.removeClass('uk-active');
+ }
+ }
+ });
+ },
+
+ getVisibleOnCurrenBreakpoint: function() {
+
+ var breakpoint = null,
+ tmp = UI.$('<div style="position:absolute;height:1px;top:-1000px;width:100px"><div></div></div>').appendTo('body'),
+ testdiv = tmp.children().eq(0),
+ breakpoints = this.options;
+
+ ['xlarge', 'large', 'medium', 'small'].forEach(function(bp) {
+
+ if (!breakpoints[bp] || breakpoint) {
+ return;
+ }
+
+ tmp.attr('class', 'uk-grid-width-'+bp+'-1-2').width();
+
+ if (testdiv.width() == 50) {
+ breakpoint = bp;
+ }
+ });
+
+ tmp.remove();
+
+ return this.options[breakpoint] || this.options['default'];
+ },
+
+ getItems: function() {
+
+ var items = [], filter;
+
+ if (this.currentFilter) {
+
+ filter = this.currentFilter || [];
+
+ if (typeof(filter) === 'string') {
+ filter = filter.split(/,/).map(function(item){ return item.trim(); });
+ }
+
+ this.children.each(function(index){
+
+ var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
+
+ if (f) {
+
+ f = f.split(/,/).map(function(item){ return item.trim(); });
+
+ filter.forEach(function(item){
+ if (f.indexOf(item) > -1) infilter = true;
+ });
+ }
+
+ if(infilter) items.push(ele[0]);
+ });
+
+ items = UI.$(items);
+
+ } else {
+ items = this.list.children();
+ }
+
+ return items;
+ },
+
+ show: function(setIndex, noanimate, dir) {
+
+ var $this = this;
+
+ if (this.activeSet === setIndex || this.animating) {
+ return;
+ }
+
+ dir = dir || (setIndex < this.activeSet ? -1:1);
+
+ var current = this.sets[this.activeSet] || [],
+ next = this.sets[setIndex],
+ animation = this._getAnimation();
+
+ if (noanimate || !UI.support.animation) {
+ animation = Animations.none;
+ }
+
+ this.animating = true;
+
+ if (this.nav.length) {
+ this.nav.children().removeClass('uk-active').eq(setIndex).addClass('uk-active');
+ }
+
+ animation.apply($this, [current, next, dir]).then(function(){
+
+ UI.Utils.checkDisplay(next, true);
+
+ $this.children.hide().removeClass('uk-active');
+ next.addClass('uk-active').css({'display': '', 'opacity':''});
+
+ $this.animating = false;
+ $this.activeSet = setIndex;
+
+ UI.Utils.checkDisplay(next, true);
+
+ $this.trigger('show.uk.slideset', [next]);
+ });
+
+ },
+
+ _getAnimation: function() {
+
+ var $this = this,
+ animation = Animations[this.options.animation] || Animations.none;
+
+ if (!UI.support.animation) {
+ animation = Animations.none;
+ }
+
+ return animation;
+ },
+
+ _hide: function() {
+
+ var $this = this,
+ current = this.sets[this.activeSet] || [],
+ animation = this._getAnimation();
+
+ this.animating = true;
+
+ return animation.apply($this, [current, [], 1]).then(function(){
+ $this.animating = false;
+ });
+ },
+
+ next: function() {
+ this.show(this.sets[this.activeSet + 1] ? (this.activeSet + 1) : 0, false, 1);
+ },
+
+ previous: function() {
+ this.show(this.sets[this.activeSet - 1] ? (this.activeSet - 1) : (this.sets.length - 1), false, -1);
+ },
+
+ start: function() {
+
+ this.stop();
+
+ var $this = this;
+
+ this.interval = setInterval(function() {
+ if (!$this.hovering && !$this.animating) $this.next();
+ }, this.options.autoplayInterval);
+
+ },
+
+ stop: function() {
+ if (this.interval) clearInterval(this.interval);
+ }
+ });
+
+ Animations = {
+
+ 'none': function() {
+ var d = UI.$.Deferred();
+ d.resolve();
+ return d.promise();
+ },
+
+ 'fade': function(current, next) {
+ return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
+ },
+
+ 'slide-bottom': function(current, next) {
+ return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
+ },
+
+ 'slide-top': function(current, next) {
+ return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
+ },
+
+ 'slide-vertical': function(current, next, dir) {
+
+ var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
+
+ if (dir == -1) {
+ anim.reverse();
+ }
+
+ return coreAnimation.apply(this, [anim, current, next]);
+ },
+
+ 'slide-horizontal': function(current, next, dir) {
+
+ var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
+
+ if (dir == -1) {
+ anim.reverse();
+ }
+
+ return coreAnimation.apply(this, [anim, current, next, dir]);
+ },
+
+ 'scale': function(current, next) {
+ return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
+ }
+ };
+
+ UI.slideset.animations = Animations;
+
+ // helpers
+
+ function coreAnimation(cls, current, next, dir) {
+
+ var d = UI.$.Deferred(),
+ delay = (this.options.delay === false) ? Math.floor(this.options.duration/2) : this.options.delay,
+ $this = this, clsIn, clsOut, release, i;
+
+ dir = dir || 1;
+
+ this.element.css('min-height', this.element.height());
+
+ if (next[0]===current[0]) {
+ d.resolve();
+ return d.promise();
+ }
+
+ if (typeof(cls) == 'object') {
+ clsIn = cls[0];
+ clsOut = cls[1] || cls[0];
+ } else {
+ clsIn = cls;
+ clsOut = clsIn;
+ }
+
+ release = function() {
+
+ if (current && current.length) {
+ current.hide().removeClass(clsOut+' uk-animation-reverse').css({'opacity':'', 'animation-delay': '', 'animation':''});
+ }
+
+ if (!next.length) {
+ d.resolve();
+ return;
+ }
+
+ for (i=0;i<next.length;i++) {
+ next.eq(dir == 1 ? i:(next.length - i)-1).css('animation-delay', (i*delay)+'ms');
+ }
+
+ next.addClass(clsIn)[dir==1 ? 'last':'first']().one(UI.support.animation.end, function() {
+
+ next.removeClass(''+clsIn+'').css({opacity:'', display:'', 'animation-delay':'', 'animation':''});
+ d.resolve();
+ $this.element.css('min-height', '');
+
+ }).end().css('display', '');
+ };
+
+ if (next.length) {
+ next.css('animation-duration', this.options.duration+'ms');
+ }
+
+ if (current && current.length) {
+
+ current.css('animation-duration', this.options.duration+'ms')[dir==1 ? 'last':'first']().one(UI.support.animation.end, function() {
+ release();
+ });
+
+ for (i=0;i<current.length;i++) {
+
+ (function (index, ele){
+
+ setTimeout(function(){
+ ele.css('display', 'none').css('display', '').css('opacity', 0).addClass(clsOut+' uk-animation-reverse');
+ }.bind(this), i * delay);
+
+ })(i, current.eq(dir == 1 ? i:(current.length - i)-1));
+ }
+
+ } else {
+ release();
+ }
+
+ return d.promise();
+ }
+
+ function array_chunk(input, size) {
+
+ var x, i = 0, c = -1, l = input.length || 0, n = [];
+
+ if (size < 1) return null;
+
+ while (i < l) {
+
+ x = i % size;
+
+ if(x) {
+ n[c][x] = input[i];
+ } else {
+ n[++c] = [input[i]];
+ }
+
+ i++;
+ }
+
+ i = 0;
+ l = n.length;
+
+ while (i < l) {
+ n[i] = jQuery(n[i]);
+ i++;
+ }
+
+ return n;
+ }
+
+});
diff --git a/uikit/static/js/components/slideset.min.js b/uikit/static/js/components/slideset.min.js
new file mode 100644
index 0000000..0117b1a
--- /dev/null
+++ b/uikit/static/js/components/slideset.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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");s.addClass(a)[1==n?"last":"first"]().one(t.support.animation.end,function(){s.removeClass(""+a).css({opacity:"",display:"","animation-delay":"",animation:""}),h.resolve(),d.element.css("min-height","")}).end().css("display","")},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(t,i){setTimeout(function(){i.css("display","none").css("display","").css("opacity",0).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);if(!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.uikit.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.uikit.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/uikit/static/js/components/slideshow-fx.js b/uikit/static/js/components/slideshow-fx.js
new file mode 100644
index 0000000..78ed161
--- /dev/null
+++ b/uikit/static/js/components/slideshow-fx.js
@@ -0,0 +1,377 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-slideshow-fx", ["uikit"], function() {
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI) {
+
+ "use strict";
+
+ var Animations = UI.slideshow.animations;
+
+ UI.$.extend(UI.slideshow.animations, {
+ 'slice': function(current, next, dir, fromfx) {
+
+ if (!current.data('cover')) {
+ return Animations.fade.apply(this, arguments);
+ }
+
+ var d = UI.$.Deferred();
+
+ var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
+ bgimage = next.data('cover').css('background-image'),
+ ghost = UI.$('<li></li>').css({
+ top : 0,
+ left : 0,
+ width : this.container.width(),
+ height : this.container.height(),
+ opacity: 1,
+ zIndex : 15
+ }),
+ ghostWidth = ghost.width(),
+ ghostHeight = ghost.height(),
+ pos = fromfx == 'slice-up' ? ghostHeight:'0',
+ bar;
+
+ for (var i = 0; i < this.options.slices; i++) {
+
+ if (fromfx == 'slice-up-down') {
+ pos = ((i % 2) + 2) % 2==0 ? '0':ghostHeight;
+ }
+
+ var width = (i == this.options.slices-1) ? sliceWidth : sliceWidth,
+ clipto = ('rect(0px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
+ clipfrom;
+
+ //slice-down - default
+ clipfrom = ('rect(0px, '+(width*(i+1))+'px, 0px, '+(sliceWidth*i)+'px)');
+
+ if (fromfx == 'slice-up' || (fromfx == 'slice-up-down' && ((i % 2) + 2) % 2==0 )) {
+ clipfrom = ('rect('+ghostHeight+'px, '+(width*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)');
+ }
+
+ bar = UI.$('<div class="uk-cover-background"></div>').css({
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'width' : ghostWidth,
+ 'height' : ghostHeight,
+ 'background-image' : bgimage,
+ 'clip' : clipfrom,
+ 'opacity' : 0,
+ 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms',
+ '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(i*60)+'ms'
+
+ }).data('clip', clipto);
+
+ ghost.append(bar);
+ }
+
+ this.container.append(ghost);
+
+ ghost.children().last().on(UI.support.transition.end, function() {
+ ghost.remove();
+ d.resolve();
+ });
+
+ ghost.width();
+
+ ghost.children().each(function() {
+ var bar = UI.$(this);
+
+ bar.css({
+ 'clip': bar.data('clip'),
+ 'opacity': 1
+ });
+ });
+
+ return d.promise();
+ },
+
+ 'slice-up': function(current, next, dir) {
+ return Animations.slice.apply(this, [current, next, dir, 'slice-up']);
+ },
+
+ 'slice-down': function(current, next, dir) {
+ return Animations.slice.apply(this, [current, next, dir, 'slice-down']);
+ },
+
+ 'slice-up-down': function(current, next, dir) {
+ return Animations.slice.apply(this, [current, next, dir, 'slice-up-down']);
+ },
+
+ 'fold': function(current, next, dir) {
+
+ if (!next.data('cover')) {
+ return Animations.fade.apply(this, arguments);
+ }
+
+ var d = UI.$.Deferred();
+
+ var sliceWidth = Math.ceil(this.element.width() / this.options.slices),
+ bgimage = next.data('cover').css('background-image'),
+ ghost = UI.$('<li></li>').css({
+ width : next.width(),
+ height : next.height(),
+ opacity: 1,
+ zIndex : 15
+ }),
+ ghostWidth = next.width(),
+ ghostHeight = next.height(),
+ bar;
+
+ for (var i = 0; i < this.options.slices; i++) {
+
+ var width = (i == this.options.slices-1) ? (ghostWidth - (sliceWidth*i)) : sliceWidth;
+
+ bar = UI.$('<div class="uk-cover-background"></div>').css({
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'width' : ghostWidth,
+ 'height' : ghostHeight,
+ 'background-image' : bgimage,
+ 'transform-origin' : (sliceWidth*i)+'px 0 0',
+ 'clip' : ('rect(0px, '+(sliceWidth*(i+1))+'px, '+ghostHeight+'px, '+(sliceWidth*i)+'px)'),
+ 'opacity' : 0,
+ 'transform' : 'scaleX(0.000001)',
+ 'transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms',
+ '-webkit-transition' : 'all '+this.options.duration+'ms ease-in-out '+(100+i*60)+'ms'
+ });
+
+ ghost.prepend(bar);
+ }
+
+ this.container.append(ghost);
+
+ ghost.width();
+
+ ghost.children().first().on(UI.support.transition.end, function() {
+ ghost.remove();
+ d.resolve();
+ }).end().css({
+ 'transform': 'scaleX(1)',
+ 'opacity': 1
+ });
+
+ return d.promise();
+ },
+
+ 'puzzle': function(current, next, dir) {
+
+ if (!next.data('cover')) {
+ return Animations.fade.apply(this, arguments);
+ }
+
+ var d = UI.$.Deferred(), $this = this;
+
+ var boxCols = Math.round(this.options.slices/2),
+ boxWidth = Math.round(next.width()/boxCols),
+ boxRows = Math.round(next.height()/boxWidth),
+ boxHeight = Math.round(next.height()/boxRows)+1,
+ bgimage = next.data('cover').css('background-image'),
+ ghost = UI.$('<li></li>').css({
+ width : this.container.width(),
+ height : this.container.height(),
+ opacity : 1,
+ zIndex : 15
+ }),
+ ghostWidth = this.container.width(),
+ ghostHeight = this.container.height(),
+ box, rect, width;
+
+ for (var rows = 0; rows < boxRows; rows++) {
+
+ for (var cols = 0; cols < boxCols; cols++) {
+
+ width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
+
+ rect = [
+ (boxHeight * rows) +'px', // top
+ (width * (cols+1)) +'px', // right
+ (boxHeight * (rows + 1)) +'px', // bottom
+ (boxWidth * cols) +'px' // left
+ ];
+
+ box = UI.$('<div class="uk-cover-background"></div>').css({
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'opacity' : 0,
+ 'width' : ghostWidth,
+ 'height' : ghostHeight,
+ 'background-image' : bgimage,
+ 'clip' : ('rect('+rect.join(',')+')'),
+ '-webkit-transform' : 'translateZ(0)', // fixes webkit opacity flickering bug
+ 'transform' : 'translateZ(0)' // fixes moz opacity flickering bug
+ });
+
+ ghost.append(box);
+ }
+ }
+
+ this.container.append(ghost);
+
+ var boxes = shuffle(ghost.children());
+
+ boxes.each(function(i) {
+ UI.$(this).css({
+ 'transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms',
+ '-webkit-transition': 'all '+$this.options.duration+'ms ease-in-out '+(50+i*25)+'ms'
+ });
+ }).last().on(UI.support.transition.end, function() {
+ ghost.remove();
+ d.resolve();
+ });
+
+ ghost.width();
+
+ boxes.css({'opacity': 1});
+
+ return d.promise();
+ },
+
+ 'boxes': function(current, next, dir, fromfx) {
+
+ if (!next.data('cover')) {
+ return Animations.fade.apply(this, arguments);
+ }
+
+ var d = UI.$.Deferred();
+
+ var boxCols = Math.round(this.options.slices/2),
+ boxWidth = Math.round(next.width()/boxCols),
+ boxRows = Math.round(next.height()/boxWidth),
+ boxHeight = Math.round(next.height()/boxRows)+1,
+ bgimage = next.data('cover').css('background-image'),
+ ghost = UI.$('<li></li>').css({
+ width : next.width(),
+ height : next.height(),
+ opacity : 1,
+ zIndex : 15
+ }),
+ ghostWidth = next.width(),
+ ghostHeight = next.height(),
+ box, rect, width, cols;
+
+ for (var rows = 0; rows < boxRows; rows++) {
+
+ for (cols = 0; cols < boxCols; cols++) {
+
+ width = (cols == boxCols-1) ? (boxWidth + 2) : boxWidth;
+
+ rect = [
+ (boxHeight * rows) +'px', // top
+ (width * (cols+1)) +'px', // right
+ (boxHeight * (rows + 1)) +'px', // bottom
+ (boxWidth * cols) +'px' // left
+ ];
+
+ box = UI.$('<div class="uk-cover-background"></div>').css({
+ 'position' : 'absolute',
+ 'top' : 0,
+ 'left' : 0,
+ 'opacity' : 1,
+ 'width' : ghostWidth,
+ 'height' : ghostHeight,
+ 'background-image' : bgimage,
+ 'transform-origin' : rect[3]+' '+rect[0]+' 0',
+ 'clip' : ('rect('+rect.join(',')+')'),
+ '-webkit-transform' : 'scale(0.0000000000000001)',
+ 'transform' : 'scale(0.0000000000000001)'
+ });
+
+ ghost.append(box);
+ }
+ }
+
+ this.container.append(ghost);
+
+ var rowIndex = 0, colIndex = 0, timeBuff = 0, box2Darr = [[]], boxes = ghost.children(), prevCol;
+
+ if (fromfx == 'boxes-reverse') {
+ boxes = [].reverse.apply(boxes);
+ }
+
+ boxes.each(function() {
+
+ box2Darr[rowIndex][colIndex] = UI.$(this);
+ colIndex++;
+
+ if(colIndex == boxCols) {
+ rowIndex++;
+ colIndex = 0;
+ box2Darr[rowIndex] = [];
+ }
+ });
+
+ for (cols = 0, prevCol = 0; cols < (boxCols * boxRows); cols++) {
+
+ prevCol = cols;
+
+ for (var row = 0; row < boxRows; row++) {
+
+ if (prevCol >= 0 && prevCol < boxCols) {
+
+ box2Darr[row][prevCol].css({
+ 'transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms',
+ '-webkit-transition': 'all '+this.options.duration+'ms linear '+(50+timeBuff)+'ms'
+ });
+ }
+ prevCol--;
+ }
+ timeBuff += 100;
+ }
+
+ boxes.last().on(UI.support.transition.end, function() {
+ ghost.remove();
+ d.resolve();
+ });
+
+ ghost.width();
+
+ boxes.css({
+ '-webkit-transform': 'scale(1)',
+ 'transform': 'scale(1)'
+ });
+
+ return d.promise();
+ },
+
+ 'boxes-reverse': function(current, next, dir) {
+ return Animations.boxes.apply(this, [current, next, dir, 'boxes-reverse']);
+ },
+
+ 'random-fx': function(){
+
+ var animations = ['slice-up', 'fold', 'puzzle', 'slice-down', 'boxes', 'slice-up-down', 'boxes-reverse'];
+
+ this.fxIndex = (this.fxIndex === undefined ? -1 : this.fxIndex) + 1;
+
+ if (!animations[this.fxIndex]) this.fxIndex = 0;
+
+ return Animations[animations[this.fxIndex]].apply(this, arguments);
+ },
+ });
+
+
+ // helper functions
+
+ // Shuffle an array
+ var shuffle = function(arr) {
+ for (var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x) {}
+ return arr;
+ };
+
+ return UI.slideshow.animations;
+});
diff --git a/uikit/static/js/components/slideshow-fx.min.js b/uikit/static/js/components/slideshow-fx.min.js
new file mode 100644
index 0000000..cb18577
--- /dev/null
+++ b/uikit/static/js/components/slideshow-fx.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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),h=s.data("cover").css("background-image"),p=i.$("<li></li>").css({top:0,left:0,width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),d=p.width(),l=p.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:d,height:l,"background-image":h,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),p.append(r)}return this.container.append(p),p.children().last().on(i.support.transition.end,function(){p.remove(),a.resolve()}),p.width(),p.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}),h=s.width(),p=s.height(),d=0;d<this.options.slices;d++){{d==this.options.slices-1?h-r*d:r}n=i.$('<div class="uk-cover-background"></div>').css({position:"absolute",top:0,left:0,width:h,height:p,"background-image":a,"transform-origin":r*d+"px 0 0",clip:"rect(0px, "+r*(d+1)+"px, "+p+"px, "+r*d+"px)",opacity:0,transform:"scaleX(0.000001)",transition:"all "+this.options.duration+"ms ease-in-out "+(100+60*d)+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+(100+60*d)+"ms"}),c.prepend(n)}return this.container.append(c),c.width(),c.children().first().on(i.support.transition.end,function(){c.remove(),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(),h=this,p=Math.round(this.options.slices/2),d=Math.round(n.width()/p),l=Math.round(n.height()/d),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;p>w;w++)a=w==p-1?d+2:d,r=[u*g+"px",a*(w+1)+"px",u*(g+1)+"px",d*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 "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms","-webkit-transition":"all "+h.options.duration+"ms ease-in-out "+(50+25*t)+"ms"})}).last().on(i.support.transition.end,function(){m.remove(),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,h,p=i.$.Deferred(),d=Math.round(this.options.slices/2),l=Math.round(s.width()/d),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(h=0;d>h;h++)c=h==d-1?l+2:l,a=[f*w+"px",c*(h+1)+"px",f*(w+1)+"px",l*h+"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==d&&(k++,y=0,I[k]=[])}),h=0,b=0;d*u>h;h++){b=h;for(var z=0;u>z;z++)b>=0&&d>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(){x.remove(),p.resolve()}),x.width(),M.css({"-webkit-transform":"scale(1)",transform:"scale(1)"}),p.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/uikit/static/js/components/slideshow.js b/uikit/static/js/components/slideshow.js
new file mode 100644
index 0000000..d897bc9
--- /dev/null
+++ b/uikit/static/js/components/slideshow.js
@@ -0,0 +1,545 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-slideshow", ["uikit"], function() {
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI) {
+
+ "use strict";
+
+ var Animations, playerId = 0;
+
+ UI.component('slideshow', {
+
+ defaults: {
+ animation : "fade",
+ duration : 500,
+ height : "auto",
+ start : 0,
+ autoplay : false,
+ autoplayInterval : 7000,
+ videoautoplay : true,
+ videomute : true,
+ slices : 15,
+ pauseOnHover : true,
+ kenburns : false,
+ kenburnsanimations : [
+ 'uk-animation-middle-left',
+ 'uk-animation-top-right',
+ 'uk-animation-bottom-left',
+ 'uk-animation-top-center',
+ '', // middle-center
+ 'uk-animation-bottom-right'
+ ],
+ },
+
+ current : false,
+ interval : null,
+ hovering : false,
+
+ boot: function() {
+
+ // init code
+ UI.ready(function(context) {
+
+ UI.$('[data-uk-slideshow]', context).each(function() {
+
+ var slideshow = UI.$(this);
+
+ if (!slideshow.data("slideshow")) {
+ var obj = UI.slideshow(slideshow, UI.Utils.options(slideshow.attr("data-uk-slideshow")));
+ }
+ });
+ });
+ },
+
+ init: function() {
+
+ var $this = this, canvas, kbanimduration;
+
+ this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow'));
+ this.slides = this.container.children();
+ this.slidesCount = this.slides.length;
+ this.current = this.options.start;
+ this.animating = false;
+ this.triggers = this.find('[data-uk-slideshow-item]');
+ 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
+
+ if (this.options.kenburns) {
+
+ kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
+
+ if (!String(kbanimduration).match(/(ms|s)$/)) {
+ kbanimduration += 'ms';
+ }
+
+ if (typeof(this.options.kenburnsanimations) == 'string') {
+ this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
+ }
+ }
+
+ this.slides.each(function(index) {
+
+ var slide = UI.$(this),
+ media = slide.children('img,video,iframe').eq(0);
+
+ slide.data('media', media);
+ slide.data('sizer', media);
+
+ if (media.length) {
+
+ var placeholder;
+
+ switch(media[0].nodeName) {
+ case 'IMG':
+
+ var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
+
+ media.css({'width': '100%','height': 'auto'});
+ slide.prepend(cover).data('cover', cover);
+ break;
+
+ case 'IFRAME':
+
+ var src = media[0].src, iframeId = 'sw-'+(++playerId);
+
+ media
+ .attr('src', '').on('load', function(){
+
+ if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
+ $this.pausemedia(media);
+ }
+
+ if ($this.options.videomute) {
+
+ $this.mutemedia(media);
+
+ var inv = setInterval((function(ic) {
+ return function() {
+ $this.mutemedia(media);
+ if (++ic >= 4) clearInterval(inv);
+ }
+ })(0), 250);
+ }
+
+ })
+ .data('slideshow', $this) // add self-reference for the vimeo-ready listener
+ .attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
+ .attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
+ .addClass('uk-position-absolute');
+
+ // disable pointer events
+ if(!UI.support.touch) media.css('pointer-events', 'none');
+
+ placeholder = true;
+
+ if (UI.cover) {
+ UI.cover(media);
+ media.attr('data-uk-cover', '{}');
+ }
+
+ break;
+
+ case 'VIDEO':
+ media.addClass('uk-cover-object uk-position-absolute');
+ placeholder = true;
+
+ if ($this.options.videomute) $this.mutemedia(media);
+ }
+
+ if (placeholder) {
+
+ canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
+ var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
+
+ slide.prepend(img);
+ slide.data('sizer', img);
+ }
+
+ } else {
+ slide.data('sizer', slide);
+ }
+
+ if ($this.hasKenBurns(slide)) {
+
+ slide.data('cover').css({
+ '-webkit-animation-duration': kbanimduration,
+ 'animation-duration': kbanimduration
+ });
+ }
+ });
+
+ this.on("click.uikit.slideshow", '[data-uk-slideshow-item]', function(e) {
+
+ e.preventDefault();
+
+ var slide = UI.$(this).attr('data-uk-slideshow-item');
+
+ if ($this.current == slide) return;
+
+ switch(slide) {
+ case 'next':
+ case 'previous':
+ $this[slide=='next' ? 'next':'previous']();
+ break;
+ default:
+ $this.show(parseInt(slide, 10));
+ }
+
+ $this.stop();
+ });
+
+ // Set start slide
+ 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');
+
+ UI.$win.on("resize load", UI.Utils.debounce(function() {
+ $this.resize();
+
+ if ($this.fixFullscreen) {
+ $this.container.css('height', window.innerHeight);
+ $this.slides.css('height', window.innerHeight);
+ }
+ }, 100));
+
+ // chrome image load fix
+ setTimeout(function(){
+ $this.resize();
+ }, 80);
+
+ // Set autoplay
+ if (this.options.autoplay) {
+ this.start();
+ }
+
+ if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
+ this.playmedia(this.slides.eq(this.current).data('media'));
+ }
+
+ if (this.options.kenburns) {
+ this.applyKenBurns(this.slides.eq(this.current));
+ }
+
+ this.container.on({
+ mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
+ mouseleave: function() { $this.hovering = false; }
+ });
+
+ this.on('swipeRight swipeLeft', function(e) {
+ $this[e.type=='swipeLeft' ? 'next' : 'previous']();
+ });
+
+ this.on('display.uk.check', function(){
+ if ($this.element.is(":visible")) {
+
+ $this.resize();
+
+ if ($this.fixFullscreen) {
+ $this.container.css('height', window.innerHeight);
+ $this.slides.css('height', window.innerHeight);
+ }
+ }
+ });
+ },
+
+
+ resize: function() {
+
+ if (this.container.hasClass('uk-slideshow-fullscreen')) return;
+
+ var $this = this, height = this.options.height;
+
+ if (this.options.height === 'auto') {
+
+ height = 0;
+
+ this.slides.css('height', '').each(function() {
+ height = Math.max(height, UI.$(this).height());
+ });
+ }
+
+ this.container.css('height', height);
+ this.slides.css('height', height);
+ },
+
+ show: function(index, direction) {
+
+ if (this.animating || this.current == index) return;
+
+ this.animating = true;
+
+ var $this = this,
+ current = this.slides.eq(this.current),
+ next = this.slides.eq(index),
+ dir = direction ? direction : this.current < index ? -1 : 1,
+ currentmedia = current.data('media'),
+ animation = Animations[this.options.animation] ? this.options.animation : 'fade',
+ nextmedia = next.data('media'),
+ finalize = function() {
+
+ if (!$this.animating) return;
+
+ if (currentmedia && currentmedia.is('video,iframe')) {
+ $this.pausemedia(currentmedia);
+ }
+
+ if (nextmedia && nextmedia.is('video,iframe')) {
+ $this.playmedia(nextmedia);
+ }
+
+ next.addClass("uk-active").attr('aria-hidden', 'false');
+ current.removeClass("uk-active").attr('aria-hidden', 'true');
+
+ $this.animating = false;
+ $this.current = index;
+
+ UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
+
+ $this.trigger('show.uk.slideshow', [next]);
+ };
+
+ $this.applyKenBurns(next);
+
+ // animation fallback
+ if (!UI.support.animation) {
+ animation = 'none';
+ }
+
+ current = UI.$(current);
+ next = UI.$(next);
+
+ Animations[animation].apply(this, [current, next, dir]).then(finalize);
+
+ $this.triggers.removeClass('uk-active');
+ $this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
+ },
+
+ applyKenBurns: function(slide) {
+
+ if (!this.hasKenBurns(slide)) {
+ return;
+ }
+
+ var animations = this.options.kenburnsanimations,
+ index = this.kbindex || 0;
+
+
+ slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
+ slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
+
+ this.kbindex = animations[index + 1] ? (index+1):0;
+ },
+
+ hasKenBurns: function(slide) {
+ return (this.options.kenburns && slide.data('cover'));
+ },
+
+ next: function() {
+ this.show(this.slides[this.current + 1] ? (this.current + 1) : 0);
+ },
+
+ previous: function() {
+ this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1));
+ },
+
+ start: function() {
+
+ this.stop();
+
+ var $this = this;
+
+ this.interval = setInterval(function() {
+ if (!$this.hovering) $this.next();
+ }, this.options.autoplayInterval);
+
+ },
+
+ stop: function() {
+ if (this.interval) clearInterval(this.interval);
+ },
+
+ playmedia: function(media) {
+
+ if (!(media && media[0])) return;
+
+ switch(media[0].nodeName) {
+ case 'VIDEO':
+
+ if (!this.options.videomute) {
+ media[0].muted = false;
+ }
+
+ media[0].play();
+ break;
+ case 'IFRAME':
+
+ if (!this.options.videomute) {
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
+ }
+
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
+ break;
+ }
+ },
+
+ pausemedia: function(media) {
+
+ switch(media[0].nodeName) {
+ case 'VIDEO':
+ media[0].pause();
+ break;
+ case 'IFRAME':
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
+ break;
+ }
+ },
+
+ mutemedia: function(media) {
+
+ switch(media[0].nodeName) {
+ case 'VIDEO':
+ media[0].muted = true;
+ break;
+ case 'IFRAME':
+ media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
+ break;
+ }
+ }
+ });
+
+ Animations = {
+
+ 'none': function() {
+
+ var d = UI.$.Deferred();
+ d.resolve();
+ return d.promise();
+ },
+
+ 'scroll': function(current, next, dir) {
+
+ var d = UI.$.Deferred();
+
+ current.css('animation-duration', this.options.duration+'ms');
+ next.css('animation-duration', this.options.duration+'ms');
+
+ next.css('opacity', 1).one(UI.support.animation.end, function() {
+
+ current.removeClass(dir === 1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
+ next.css('opacity', '').removeClass(dir === 1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
+ d.resolve();
+
+ }.bind(this));
+
+ current.addClass(dir == 1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
+ next.addClass(dir == 1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
+ next.width(); // force redraw
+
+ return d.promise();
+ },
+
+ 'swipe': function(current, next, dir) {
+
+ var d = UI.$.Deferred();
+
+ current.css('animation-duration', this.options.duration+'ms');
+ next.css('animation-duration', this.options.duration+'ms');
+
+ next.css('opacity', 1).one(UI.support.animation.end, function() {
+
+ current.removeClass(dir === 1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
+ next.css('opacity', '').removeClass(dir === 1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
+ d.resolve();
+
+ }.bind(this));
+
+ current.addClass(dir == 1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
+ next.addClass(dir == 1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
+ next.width(); // force redraw
+
+ return d.promise();
+ },
+
+ 'scale': function(current, next, dir) {
+
+ var d = UI.$.Deferred();
+
+ current.css('animation-duration', this.options.duration+'ms');
+ next.css('animation-duration', this.options.duration+'ms');
+
+ next.css('opacity', 1);
+
+ current.one(UI.support.animation.end, function() {
+
+ current.removeClass('uk-slideshow-scale-out');
+ next.css('opacity', '');
+ d.resolve();
+
+ }.bind(this));
+
+ current.addClass('uk-slideshow-scale-out');
+ current.width(); // force redraw
+
+ return d.promise();
+ },
+
+ 'fade': function(current, next, dir) {
+
+ var d = UI.$.Deferred();
+
+ current.css('animation-duration', this.options.duration+'ms');
+ next.css('animation-duration', this.options.duration+'ms');
+
+ next.css('opacity', 1);
+
+ current.one(UI.support.animation.end, function() {
+
+ current.removeClass('uk-slideshow-fade-out');
+ next.css('opacity', '');
+ d.resolve();
+
+ }.bind(this));
+
+ current.addClass('uk-slideshow-fade-out');
+ current.width(); // force redraw
+
+ return d.promise();
+ }
+ };
+
+ UI.slideshow.animations = Animations;
+
+ // Listen for messages from the vimeo player
+ window.addEventListener('message', function onMessageReceived(e) {
+
+ var data = e.data, iframe;
+
+ if (typeof(data) == 'string') {
+
+ try {
+ data = JSON.parse(data);
+ } catch(err) {
+ data = {};
+ }
+ }
+
+ if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
+ iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
+
+ if (iframe.length) {
+ iframe.data('slideshow').mutemedia(iframe);
+ }
+ }
+ }, false);
+
+});
diff --git a/uikit/static/js/components/slideshow.min.js b/uikit/static/js/components/slideshow.min.js
new file mode 100644
index 0000000..e7af4f0
--- /dev/null
+++ b/uikit/static/js/components/slideshow.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!function(i){var s;window.UIkit&&(s=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow",["uikit"],function(){return s||i(UIkit)})}(function(i){"use strict";var s,t=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(s){i.$("[data-uk-slideshow]",s).each(function(){var s=i.$(this);if(!s.data("slideshow")){i.slideshow(s,i.Utils.options(s.attr("data-uk-slideshow")))}})})},init:function(){var s,e,n=this;this.container=this.element.hasClass("uk-slideshow")?this.element:i.$(this.find(".uk-slideshow")),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(a){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.css({width:"100%",height:"auto"}),o.prepend(u).data("cover",u);break;case"IFRAME":var h=r[0].src,c="sw-"+ ++t;r.attr("src","").on("load",function(){if((a!==n.current||a==n.current&&!n.options.videoautoplay)&&n.pausemedia(r),n.options.videomute){n.mutemedia(r);var i=setInterval(function(s){return function(){n.mutemedia(r),++s>=4&&clearInterval(i)}}(0),250)}}).data("slideshow",n).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,n.options.videomute&&n.mutemedia(r)}if(d){s=i.$("<canvas></canvas>").attr({width:r[0].width,height:r[0].height});var l=i.$('<img style="width:100%;height:auto;">').attr("src",s[0].toDataURL());o.prepend(l),o.data("sizer",l)}}else o.data("sizer",o);n.hasKenBurns(o)&&o.data("cover").css({"-webkit-animation-duration":e,"animation-duration":e})}),this.on("click.uikit.slideshow","[data-uk-slideshow-item]",function(s){s.preventDefault();var t=i.$(this).attr("data-uk-slideshow-item");if(n.current!=t){switch(t){case"next":case"previous":n["next"==t?"next":"previous"]();break;default:n.show(parseInt(t,10))}n.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(){n.resize(),n.fixFullscreen&&(n.container.css("height",window.innerHeight),n.slides.css("height",window.innerHeight))},100)),setTimeout(function(){n.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(){n.options.pauseOnHover&&(n.hovering=!0)},mouseleave:function(){n.hovering=!1}}),this.on("swipeRight swipeLeft",function(i){n["swipeLeft"==i.type?"next":"previous"]()}),this.on("display.uk.check",function(){n.element.is(":visible")&&(n.resize(),n.fixFullscreen&&(n.container.css("height",window.innerHeight),n.slides.css("height",window.innerHeight)))})},resize:function(){if(!this.container.hasClass("uk-slideshow-fullscreen")){var s=this.options.height;"auto"===this.options.height&&(s=0,this.slides.css("height","").each(function(){s=Math.max(s,i.$(this).height())})),this.container.css("height",s),this.slides.css("height",s)}},show:function(t,e){if(!this.animating&&this.current!=t){this.animating=!0;var n=this,a=this.slides.eq(this.current),o=this.slides.eq(t),r=e?e:this.current<t?-1:1,d=a.data("media"),u=s[this.options.animation]?this.options.animation:"fade",h=o.data("media"),c=function(){n.animating&&(d&&d.is("video,iframe")&&n.pausemedia(d),h&&h.is("video,iframe")&&n.playmedia(h),o.addClass("uk-active").attr("aria-hidden","false"),a.removeClass("uk-active").attr("aria-hidden","true"),n.animating=!1,n.current=t,i.Utils.checkDisplay(o,'[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)'),n.trigger("show.uk.slideshow",[o]))};n.applyKenBurns(o),i.support.animation||(u="none"),a=i.$(a),o=i.$(o),s[u].apply(this,[a,o,r]).then(c),n.triggers.removeClass("uk-active"),n.triggers.filter('[data-uk-slideshow-item="'+t+'"]').addClass("uk-active")}},applyKenBurns:function(i){if(this.hasKenBurns(i)){var s=this.options.kenburnsanimations,t=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",s[t].trim()].join(" ")),this.kbindex=s[t+1]?t+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)},previous:function(){this.show(this.slides[this.current-1]?this.current-1:this.slides.length-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}',"*")}}}),s={none:function(){var s=i.$.Deferred();return s.resolve(),s.promise()},scroll:function(s,t,e){var n=i.$.Deferred();return s.css("animation-duration",this.options.duration+"ms"),t.css("animation-duration",this.options.duration+"ms"),t.css("opacity",1).one(i.support.animation.end,function(){s.removeClass(1===e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),t.css("opacity","").removeClass(1===e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),n.resolve()}.bind(this)),s.addClass(1==e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),t.addClass(1==e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),t.width(),n.promise()},swipe:function(s,t,e){var n=i.$.Deferred();return s.css("animation-duration",this.options.duration+"ms"),t.css("animation-duration",this.options.duration+"ms"),t.css("opacity",1).one(i.support.animation.end,function(){s.removeClass(1===e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),t.css("opacity","").removeClass(1===e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),n.resolve()}.bind(this)),s.addClass(1==e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),t.addClass(1==e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),t.width(),n.promise()},scale:function(s,t){var e=i.$.Deferred();return s.css("animation-duration",this.options.duration+"ms"),t.css("animation-duration",this.options.duration+"ms"),t.css("opacity",1),s.one(i.support.animation.end,function(){s.removeClass("uk-slideshow-scale-out"),t.css("opacity",""),e.resolve()}.bind(this)),s.addClass("uk-slideshow-scale-out"),s.width(),e.promise()},fade:function(s,t){var e=i.$.Deferred();return s.css("animation-duration",this.options.duration+"ms"),t.css("animation-duration",this.options.duration+"ms"),t.css("opacity",1),s.one(i.support.animation.end,function(){s.removeClass("uk-slideshow-fade-out"),t.css("opacity",""),e.resolve()}.bind(this)),s.addClass("uk-slideshow-fade-out"),s.width(),e.promise()}},i.slideshow.animations=s,window.addEventListener("message",function(s){var t,e=s.data;if("string"==typeof e)try{e=JSON.parse(e)}catch(n){e={}}s.origin&&s.origin.indexOf("vimeo")>-1&&"ready"==e.event&&e.player_id&&(t=i.$('[data-player-id="'+e.player_id+'"]'),t.length&&t.data("slideshow").mutemedia(t))},!1)}); \ No newline at end of file
diff --git a/uikit/static/js/components/sortable.js b/uikit/static/js/components/sortable.js
new file mode 100644
index 0000000..37a369b
--- /dev/null
+++ b/uikit/static/js/components/sortable.js
@@ -0,0 +1,643 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+/*
+ * Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
+ */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-sortable", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var supportsTouch = ('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
+ draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved;
+
+ function closestSortable(ele) {
+
+ ele = UI.$(ele);
+
+ do {
+ if (ele.data('sortable')) {
+ return ele;
+ }
+ ele = UI.$(ele).parent();
+ } while(ele.length);
+
+ return ele;
+ }
+
+ UI.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',
+ dragCustomClass : '',
+ handleClass : false,
+ group : false,
+
+ stop : function() {},
+ start : function() {},
+ change : function() {}
+ },
+
+ boot: function() {
+
+ // auto init
+ UI.ready(function(context) {
+
+ UI.$("[data-uk-sortable]", context).each(function(){
+
+ var ele = UI.$(this);
+
+ if(!ele.data("sortable")) {
+ var plugin = UI.sortable(ele, UI.Utils.options(ele.attr("data-uk-sortable")));
+ }
+ });
+ });
+
+ UI.$html.on('mousemove touchmove', function(e) {
+
+ if (delayIdle) {
+
+ var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e;
+
+ if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) {
+ delayIdle.apply(src);
+ }
+ }
+
+ if (draggingPlaceholder) {
+
+ if (!moving) {
+ moving = true;
+ draggingPlaceholder.show();
+
+ draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
+ draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
+
+ UI.$html.addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
+ }
+
+ var offset = draggingPlaceholder.data('mouse-offset'),
+ left = parseInt(e.originalEvent.pageX, 10) + offset.left,
+ top = parseInt(e.originalEvent.pageY, 10) + offset.top;
+
+ draggingPlaceholder.css({'left': left, 'top': top });
+
+ // adjust document scrolling
+ if (top < UI.$win.scrollTop()) {
+ UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/2));
+ } else if ( (top + draggingPlaceholder.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
+ UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/2));
+ }
+ }
+ });
+
+ UI.$html.on('mouseup touchend', function(e) {
+
+ delayIdle = clickedlink = false;
+
+ // dragging?
+ if (!currentlyDraggingElement || !draggingPlaceholder) {
+ // completely reset dragging attempt. will cause weird delay behavior elsewise
+ currentlyDraggingElement = draggingPlaceholder = null;
+ return;
+ }
+
+ // inside or outside of sortable?
+ var sortable = closestSortable(e.target),
+ component = draggingPlaceholder.$sortable,
+ ev = { type: e.type };
+
+ if (sortable[0]) {
+ component.dragDrop(ev, component.element);
+ }
+ component.dragEnd(ev, component.element);
+ });
+ },
+
+ init: function() {
+
+ var $this = this,
+ element = this.element[0],
+ children;
+
+ touchedlists = [];
+
+ // make sure :empty selector works on empty lists
+ if (this.element.children().length === 0) {
+ this.element.html('');
+ }
+
+ this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group'));
+
+ var handleDragStart = delegate(function(e) {
+
+ var $target = UI.$(e.target),
+ $link = $target.is('a[href]') ? $target:$target.parents('a[href]');
+
+ if ($target.is(':input')) {
+ return;
+ }
+
+ e.preventDefault();
+
+ if (!supportsTouch && $link.length) {
+
+ $link.one('click', function(e){
+ e.preventDefault();
+ }).one('mouseup', function(){
+ if(!moved) $link.trigger('click');
+ });
+ }
+
+ return $this.dragStart(e, this);
+ });
+
+ var handleDragOver = delegate(function(e) {
+
+ if (!currentlyDraggingElement) {
+ return true;
+ }
+
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+
+ return false;
+ });
+
+ var handleDragEnter = delegate(UI.Utils.debounce(function(e) {
+ return $this.dragEnter(e, this);
+ }), 40);
+
+ var handleDragLeave = delegate(function(e) {
+
+ // Prevent dragenter on a child from allowing a dragleave on the container
+ var previousCounter = $this.dragenterData(this);
+ $this.dragenterData(this, previousCounter - 1);
+
+ // This is a fix for child elements firing dragenter before the parent fires dragleave
+ if (!$this.dragenterData(this)) {
+ UI.$(this).removeClass($this.options.overClass);
+ $this.dragenterData(this, false);
+ }
+ });
+
+ var handleTouchMove = delegate(function(e) {
+
+ if (!currentlyDraggingElement ||
+ currentlyDraggingElement === this ||
+ currentlyDraggingTarget === this) {
+ return true;
+ }
+
+ $this.element.children().removeClass($this.options.overClass);
+ currentlyDraggingTarget = this;
+
+ $this.moveElementNextTo(currentlyDraggingElement, this);
+
+ return prevent(e);
+ });
+
+ // Bind/unbind standard mouse/touch events as a polyfill.
+ function addDragHandlers() {
+ if (supportsTouch) {
+ element.addEventListener("touchmove", handleTouchMove, false);
+ } else {
+ element.addEventListener('mouseover', handleDragEnter, false);
+ element.addEventListener('mouseout', handleDragLeave, false);
+ }
+
+ // document.addEventListener("selectstart", prevent, false);
+ }
+
+ function removeDragHandlers() {
+ if (supportsTouch) {
+ element.removeEventListener("touchmove", handleTouchMove, false);
+ } else {
+ element.removeEventListener('mouseover', handleDragEnter, false);
+ element.removeEventListener('mouseout', handleDragLeave, false);
+ }
+
+ // document.removeEventListener("selectstart", prevent, false);
+ }
+
+ this.addDragHandlers = addDragHandlers;
+ this.removeDragHandlers = removeDragHandlers;
+
+ function handleDragMove(e) {
+
+ if (!currentlyDraggingElement) {
+ return;
+ }
+
+ $this.dragMove(e, $this);
+ }
+
+ function delegate(fn) {
+
+ return function(e) {
+
+ var touch, target, context;
+
+ if (e) {
+ touch = (supportsTouch && e.touches && e.touches[0]) || { };
+ target = touch.target || e.target;
+
+ // Fix event.target for a touch event
+ if (supportsTouch && document.elementFromPoint) {
+ target = document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - document.body.scrollTop);
+ }
+ }
+
+ if (UI.$(target).hasClass($this.options.childClass)) {
+ fn.apply(target, [e]);
+ } else if (target !== element) {
+
+ // If a child is initiating the event or ending it, then use the container as context for the callback.
+ context = moveUpToChildNode(element, target);
+
+ if (context) {
+ fn.apply(context, [e]);
+ }
+ }
+ };
+ }
+
+ window.addEventListener(supportsTouch ? 'touchmove' : 'mousemove', handleDragMove, false);
+ element.addEventListener(supportsTouch ? 'touchstart': 'mousedown', handleDragStart, false);
+ },
+
+ dragStart: function(e, elem) {
+
+ moved = false;
+ moving = false;
+ dragging = false;
+
+ var $this = this,
+ target = UI.$(e.target),
+ children = $this.element.children();
+
+ if (!supportsTouch && e.button==2) {
+ return;
+ }
+
+ if ($this.options.handleClass) {
+
+ var handle = target.hasClass($this.options.handleClass) ? target : target.closest('.'+$this.options.handleClass, $this.element);
+
+ if (!handle.length) {
+ //e.preventDefault();
+ return;
+ }
+ }
+
+ if (target.is('.'+$this.options.noDragClass) || target.closest('.'+$this.options._noDragClass).length) {
+ return;
+ }
+
+ // prevent dragging if taget is a form field
+ if (target.is(':input')) {
+ return;
+ }
+
+ currentlyDraggingElement = elem;
+
+ // init drag placeholder
+ if (draggingPlaceholder) {
+ draggingPlaceholder.remove();
+ }
+
+ var $current = UI.$(currentlyDraggingElement), offset = $current.offset();
+
+ delayIdle = {
+
+ pos : { x:e.pageX, y:e.pageY },
+ threshold : $this.options.threshold,
+ apply : function(evt) {
+
+ draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
+ display : 'none',
+ top : offset.top,
+ left : offset.left,
+ width : $current.width(),
+ height : $current.height(),
+ padding : $current.css('padding')
+ }).data({
+ 'mouse-offset': {
+ 'left' : offset.left - parseInt(evt.pageX, 10),
+ 'top' : offset.top - parseInt(evt.pageY, 10)
+ },
+ 'origin' : $this.element,
+ 'index' : $current.index()
+ }).append($current.html()).appendTo('body');
+
+ draggingPlaceholder.$current = $current;
+ draggingPlaceholder.$sortable = $this;
+ $current.data('sortable-group', $this.options.group);
+
+ $this.addDragHandlers();
+
+ $this.options.start(this, currentlyDraggingElement);
+ $this.trigger('start.uk.sortable', [$this, currentlyDraggingElement]);
+
+ moved = true;
+ delayIdle = false;
+ }
+ };
+ },
+
+ dragMove: function(e, elem) {
+ var overEl = UI.$(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop))),
+ overRoot = overEl.closest('.'+this.options.baseClass),
+ groupOver = overRoot.data("sortable-group"),
+ $current = UI.$(currentlyDraggingElement),
+ currentRoot = $current.parent(),
+ groupCurrent = $current.data("sortable-group"),
+ overChild;
+
+ if (overRoot[0] !== currentRoot[0] && groupCurrent !== undefined && groupOver === groupCurrent) {
+ overRoot.data('sortable').addDragHandlers();
+
+ touchedlists.push(overRoot);
+ overRoot.children().addClass(this.options.childClass);
+
+ // swap root
+ if (overRoot.children().length > 0) {
+ overChild = overEl.closest('.'+this.options.childClass);
+ overChild.before($current);
+ } else { // empty list
+ overEl.append($current);
+ }
+
+ // list empty? remove inner whitespace to make sure :empty selector works
+ if (currentRoot.children().length === 0) {
+ currentRoot.html('');
+ }
+
+ UIkit.$doc.trigger('mouseover');
+ }
+ },
+
+ dragEnter: function(e, elem) {
+
+ if (!currentlyDraggingElement || currentlyDraggingElement === elem) {
+ return true;
+ }
+
+ // Prevent dragenter on a child from allowing a dragleave on the container
+ var previousCounter = this.dragenterData(elem);
+
+ this.dragenterData(elem, previousCounter + 1);
+
+ if (previousCounter === 0) {
+
+ UI.$(elem).addClass(this.options.overClass);
+
+ this.moveElementNextTo(currentlyDraggingElement, elem);
+ }
+
+ return false;
+ },
+
+ dragEnd: function(e, elem) {
+
+ var $this = this;
+
+ // avoid triggering event twice
+ if (currentlyDraggingElement) {
+ // TODO: trigger on right element?
+ this.options.stop(elem);
+ this.trigger('stop.uk.sortable', [this]);
+ }
+
+ currentlyDraggingElement = null;
+ currentlyDraggingTarget = null;
+
+ touchedlists.push(this.element);
+ touchedlists.forEach(function(el, i) {
+ UI.$(el).children().each(function() {
+ if (this.nodeType === 1) {
+ UI.$(this).removeClass($this.options.overClass)
+ .removeClass($this.options.placeholderClass)
+ .removeClass($this.options.childClass);
+ $this.dragenterData(this, false);
+ }
+ });
+ });
+
+ touchedlists = [];
+
+ UI.$html.removeClass(this.options.dragMovingClass);
+
+ this.removeDragHandlers();
+
+ if (draggingPlaceholder) {
+ draggingPlaceholder.remove();
+ draggingPlaceholder = null;
+ }
+ },
+
+ dragDrop: function(e, elem) {
+
+ if (e.type === 'drop') {
+
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ }
+
+ this.triggerChangeEvents();
+ },
+
+ triggerChangeEvents: function() {
+
+ // trigger events once
+ if (!currentlyDraggingElement) return;
+
+ var $current = UI.$(currentlyDraggingElement),
+ oldRoot = draggingPlaceholder.data("origin"),
+ newRoot = $current.closest('.'+this.options.baseClass),
+ triggers = [];
+
+ // events depending on move inside lists or across lists
+ if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) {
+ triggers.push({el: this, mode: 'moved'});
+ } else if (oldRoot[0] != newRoot[0]) {
+ triggers.push({el: newRoot, mode: 'added'}, {el: oldRoot, mode: 'removed'});
+ }
+
+ triggers.forEach(function (trigger, i) {
+ trigger.el.trigger('change.uk.sortable', [trigger.el, currentlyDraggingElement, trigger.mode]);
+ });
+ },
+
+ dragenterData: function(element, val) {
+
+ element = UI.$(element);
+
+ if (arguments.length == 1) {
+ return parseInt(element.data('child-dragenter'), 10) || 0;
+ } else if (!val) {
+ element.removeData('child-dragenter');
+ } else {
+ element.data('child-dragenter', Math.max(0, val));
+ }
+ },
+
+ moveElementNextTo: function(element, elementToMoveNextTo) {
+
+ dragging = true;
+
+ var $this = this,
+ list = UI.$(element).parent().css('min-height', ''),
+ next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
+ children = list.children(),
+ count = children.length;
+
+ if (!$this.options.animation) {
+ elementToMoveNextTo.parentNode.insertBefore(element, next);
+ UI.Utils.checkDisplay($this.element.parent());
+ return;
+ }
+
+ list.css('min-height', list.height());
+
+ children.stop().each(function(){
+ var ele = UI.$(this),
+ offset = ele.position();
+
+ offset.width = ele.width();
+
+ ele.data('offset-before', offset);
+ });
+
+ elementToMoveNextTo.parentNode.insertBefore(element, next);
+
+ UI.Utils.checkDisplay($this.element.parent());
+
+ children = list.children().each(function() {
+ var ele = UI.$(this);
+ ele.data('offset-after', ele.position());
+ }).each(function() {
+ var ele = UI.$(this),
+ before = ele.data('offset-before');
+ ele.css({'position':'absolute', 'top':before.top, 'left':before.left, 'min-width':before.width });
+ });
+
+ children.each(function(){
+
+ var ele = UI.$(this),
+ before = ele.data('offset-before'),
+ offset = ele.data('offset-after');
+
+ ele.css('pointer-events', 'none').width();
+
+ setTimeout(function(){
+ ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
+ ele.css({'position':'','top':'', 'left':'', 'min-width': '', 'pointer-events':''}).removeClass($this.options.overClass).removeData('child-dragenter');
+ count--;
+ if (!count) {
+ list.css('min-height', '');
+ UI.Utils.checkDisplay($this.element.parent());
+ }
+ });
+ }, 0);
+ });
+ },
+
+ serialize: function() {
+
+ var data = [], item, attribute;
+
+ this.element.children().each(function(j, child) {
+ item = {};
+ for (var i = 0; i < child.attributes.length; i++) {
+ attribute = child.attributes[i];
+ if (attribute.name.indexOf('data-') === 0) {
+ item[attribute.name.substr(5)] = UI.Utils.str2json(attribute.value);
+ }
+ }
+ data.push(item);
+ });
+
+ return data;
+ }
+ });
+
+ // helpers
+
+ function isBelow(el1, el2) {
+
+ var parent = el1.parentNode;
+
+ if (el2.parentNode != parent) {
+ return false;
+ }
+
+ var cur = el1.previousSibling;
+
+ while (cur && cur.nodeType !== 9) {
+ if (cur === el2) {
+ return true;
+ }
+ cur = cur.previousSibling;
+ }
+
+ return false;
+ }
+
+ function moveUpToChildNode(parent, child) {
+ var cur = child;
+ if (cur == parent) { return null; }
+
+ while (cur) {
+ if (cur.parentNode === parent) {
+ return cur;
+ }
+
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
+ break;
+ }
+ }
+ return null;
+ }
+
+ function prevent(e) {
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ }
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ e.returnValue = false;
+ }
+
+ return UI.sortable;
+});
diff --git a/uikit/static/js/components/sortable.min.js b/uikit/static/js/components/sortable.min.js
new file mode 100644
index 0000000..7bd90d7
--- /dev/null
+++ b/uikit/static/js/components/sortable.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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 a(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}var s,r,i,l,d,h,u,p,c,g="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;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",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);if(!e.data("sortable")){t.sortable(e,t.Utils.options(e.attr("data-uk-sortable")))}})}),t.$html.on("mousemove touchmove",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(s){d||(d=!0,s.show(),s.$current.addClass(s.$sortable.options.placeholderClass),s.$sortable.element.children().addClass(s.$sortable.options.childClass),t.$html.addClass(s.$sortable.options.dragMovingClass));var n=s.data("mouse-offset"),a=parseInt(e.originalEvent.pageX,10)+n.left,r=parseInt(e.originalEvent.pageY,10)+n.top;s.css({left:a,top:r}),r<t.$win.scrollTop()?t.$win.scrollTop(t.$win.scrollTop()-Math.ceil(s.height()/2)):r+s.height()>window.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(s.height()/2))}}),t.$html.on("mouseup touchend",function(t){if(u=h=!1,!r||!s)return r=s=null,void 0;var o=e(t.target),n=s.$sortable,a={type:t.type};o[0]&&n.dragDrop(a,n.element),n.dragEnd(a,n.element)})},init:function(){function e(){g?h.addEventListener("touchmove",v,!1):(h.addEventListener("mouseover",f,!1),h.addEventListener("mouseout",m,!1))}function o(){g?h.removeEventListener("touchmove",v,!1):(h.removeEventListener("mouseover",f,!1),h.removeEventListener("mouseout",m,!1))}function s(t){r&&d.dragMove(t,d)}function l(e){return function(o){var a,s,r;o&&(a=g&&o.touches&&o.touches[0]||{},s=a.target||o.target,g&&document.elementFromPoint&&(s=document.elementFromPoint(o.pageX-document.body.scrollLeft,o.pageY-document.body.scrollTop))),t.$(s).hasClass(d.options.childClass)?e.apply(s,[o]):s!==h&&(r=n(h,s),r&&e.apply(r,[o]))}}var d=this,h=this.element[0];p=[],0===this.element.children().length&&this.element.html(""),this.element.data("sortable-group",this.options.group?this.options.group:t.Utils.uid("sortable-group"));var u=l(function(e){var o=t.$(e.target),n=o.is("a[href]")?o:o.parents("a[href]");if(!o.is(":input"))return e.preventDefault(),!g&&n.length&&n.one("click",function(t){t.preventDefault()}).one("mouseup",function(){c||n.trigger("click")}),d.dragStart(e,this)}),f=(l(function(t){return r?(t.preventDefault&&t.preventDefault(),!1):!0}),l(t.Utils.debounce(function(t){return d.dragEnter(t,this)}),40)),m=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))}),v=l(function(t){return r&&r!==this&&i!==this?(d.element.children().removeClass(d.options.overClass),i=this,d.moveElementNextTo(r,this),a(t)):!0});this.addDragHandlers=e,this.removeDragHandlers=o,window.addEventListener(g?"touchmove":"mousemove",s,!1),h.addEventListener(g?"touchstart":"mousedown",u,!1)},dragStart:function(e,o){c=!1,d=!1,l=!1;{var n=this,a=t.$(e.target);n.element.children()}if(g||2!=e.button){if(n.options.handleClass){var i=a.hasClass(n.options.handleClass)?a:a.closest("."+n.options.handleClass,n.element);if(!i.length)return}if(!a.is("."+n.options.noDragClass)&&!a.closest("."+n.options._noDragClass).length&&!a.is(":input")){r=o,s&&s.remove();var h=t.$(r),p=h.offset();u={pos:{x:e.pageX,y:e.pageY},threshold:n.options.threshold,apply:function(e){s=t.$('<div class="'+[n.options.draggingClass,n.options.dragCustomClass].join(" ")+'"></div>').css({display:"none",top:p.top,left:p.left,width:h.width(),height:h.height(),padding:h.css("padding")}).data({"mouse-offset":{left:p.left-parseInt(e.pageX,10),top:p.top-parseInt(e.pageY,10)},origin:n.element,index:h.index()}).append(h.html()).appendTo("body"),s.$current=h,s.$sortable=n,h.data("sortable-group",n.options.group),n.addDragHandlers(),n.options.start(this,r),n.trigger("start.uk.sortable",[n,r]),c=!0,u=!1}}}}},dragMove:function(e){var o,n=t.$(document.elementFromPoint(e.pageX-document.body.scrollLeft,e.pageY-(window.pageYOffset||document.documentElement.scrollTop))),a=n.closest("."+this.options.baseClass),s=a.data("sortable-group"),i=t.$(r),l=i.parent(),d=i.data("sortable-group");a[0]!==l[0]&&void 0!==d&&s===d&&(a.data("sortable").addDragHandlers(),p.push(a),a.children().addClass(this.options.childClass),a.children().length>0?(o=n.closest("."+this.options.childClass),o.before(i)):n.append(i),0===l.children().length&&l.html(""),UIkit.$doc.trigger("mouseover"))},dragEnter:function(e,o){if(!r||r===o)return!0;var n=this.dragenterData(o);return this.dragenterData(o,n+1),0===n&&(t.$(o).addClass(this.options.overClass),this.moveElementNextTo(r,o)),!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(),s&&(s.remove(),s=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=s.data("origin"),n=e.closest("."+this.options.baseClass),a=[];o[0]===n[0]&&s.data("index")!=e.index()?a.push({el:this,mode:"moved"}):o[0]!=n[0]&&a.push({el:n,mode:"added"},{el:o,mode:"removed"}),a.forEach(function(t){t.el.trigger("change.uk.sortable",[t.el,r,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 a=this,s=t.$(e).parent().css("min-height",""),r=o(e,n)?n:n.nextSibling,i=s.children(),d=i.length;return a.options.animation?(s.css("min-height",s.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(a.element.parent()),i=s.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},a.options.animation,function(){e.css({position:"",top:"",left:"","min-width":"","pointer-events":""}).removeClass(a.options.overClass).removeData("child-dragenter"),d--,d||(s.css("min-height",""),t.Utils.checkDisplay(a.element.parent()))})},0)}),void 0):(n.parentNode.insertBefore(e,r),t.Utils.checkDisplay(a.element.parent()),void 0)},serialize:function(){var e,o,n=[];return this.element.children().each(function(a,s){e={};for(var r=0;r<s.attributes.length;r++)o=s.attributes[r],0===o.name.indexOf("data-")&&(e[o.name.substr(5)]=t.Utils.str2json(o.value));n.push(e)}),n}}),t.sortable}); \ No newline at end of file
diff --git a/uikit/static/js/components/sticky.js b/uikit/static/js/components/sticky.js
new file mode 100644
index 0000000..a335a5e
--- /dev/null
+++ b/uikit/static/js/components/sticky.js
@@ -0,0 +1,298 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-sticky", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var $win = UI.$win,
+ $doc = UI.$doc,
+ sticked = [];
+
+ UI.component('sticky', {
+
+ defaults: {
+ top : 0,
+ bottom : 0,
+ animation : '',
+ clsinit : 'uk-sticky-init',
+ clsactive : 'uk-active',
+ getWidthFrom : '',
+ boundary : false,
+ media : false,
+ target : false,
+ disabled : false
+ },
+
+ boot: function() {
+
+ // should be more efficient than using $win.scroll(checkscrollposition):
+ UI.$doc.on('scrolling.uk.document', function() { checkscrollposition(); });
+ UI.$win.on('resize orientationchange', UI.Utils.debounce(function() {
+
+ if (!sticked.length) return;
+
+ for (var i = 0; i < sticked.length; i++) {
+ sticked[i].reset(true);
+ sticked[i].self.computeWrapper();
+ }
+
+ checkscrollposition();
+ }, 100));
+
+ // init code
+ UI.ready(function(context) {
+
+ setTimeout(function(){
+
+ UI.$("[data-uk-sticky]", context).each(function(){
+
+ var $ele = UI.$(this);
+
+ if(!$ele.data("sticky")) {
+ UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
+ }
+ });
+
+ checkscrollposition();
+ }, 0);
+ });
+ },
+
+ init: function() {
+
+ var wrapper = UI.$('<div class="uk-sticky-placeholder"></div>'), boundary = this.options.boundary, boundtoparent;
+
+ this.wrapper = this.element.css('margin', 0).wrap(wrapper).parent();
+
+ this.computeWrapper();
+
+ if (boundary) {
+
+ if (boundary === true) {
+
+ boundary = this.wrapper.parent();
+ boundtoparent = true;
+
+ } else if (typeof boundary === "string") {
+ boundary = UI.$(boundary);
+ }
+ }
+
+ this.sticky = {
+ self : this,
+ options : this.options,
+ element : this.element,
+ currentTop : null,
+ wrapper : this.wrapper,
+ init : false,
+ getWidthFrom : this.options.getWidthFrom || this.wrapper,
+ boundary : boundary,
+ boundtoparent : boundtoparent,
+ reset : function(force) {
+
+ var finalize = function() {
+ this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
+ this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
+
+ this.currentTop = null;
+ this.animate = false;
+ }.bind(this);
+
+
+ if (!force && this.options.animation && UI.support.animation) {
+
+ this.animate = true;
+
+ this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
+ finalize();
+ }).width(); // force redraw
+
+ this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
+ } else {
+ finalize();
+ }
+ },
+
+ check: function() {
+
+ if (this.options.disabled) {
+ return false;
+ }
+
+ if (this.options.media) {
+
+ switch(typeof(this.options.media)) {
+ case 'number':
+ if (window.innerWidth < this.options.media) {
+ return false;
+ }
+ break;
+ case 'string':
+ if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
+ return false;
+ }
+ break;
+ }
+ }
+
+ var scrollTop = $win.scrollTop(),
+ documentHeight = $doc.height(),
+ dwh = documentHeight - window.innerHeight,
+ extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
+ elementTop = this.wrapper.offset().top,
+ etse = elementTop - this.options.top - extra;
+
+ return (scrollTop >= etse);
+ }
+ };
+
+ sticked.push(this.sticky);
+ },
+
+ update: function() {
+ checkscrollposition(this.sticky);
+ },
+
+ enable: function() {
+ this.options.disabled = false;
+ this.update();
+ },
+
+ disable: function(force) {
+ this.options.disabled = true;
+ this.sticky.reset(force);
+ },
+
+ computeWrapper: function() {
+
+ this.wrapper.css({
+ 'height' : this.element.css('position') != 'absolute' ? this.element.outerHeight() : '',
+ 'float' : this.element.css("float") != "none" ? this.element.css("float") : '',
+ 'margin' : this.element.css("margin")
+ });
+ }
+ });
+
+ function checkscrollposition() {
+
+ var stickies = arguments.length ? arguments : sticked;
+
+ if (!stickies.length || $win.scrollTop() < 0) return;
+
+ var scrollTop = $win.scrollTop(),
+ documentHeight = $doc.height(),
+ windowHeight = $win.height(),
+ dwh = documentHeight - windowHeight,
+ extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
+ newTop, containerBottom, stickyHeight, sticky;
+
+ for (var i = 0; i < stickies.length; i++) {
+
+ sticky = stickies[i];
+
+ if (!sticky.element.is(":visible") || sticky.animate) {
+ continue;
+ }
+
+ if (!sticky.check()) {
+
+ if (sticky.currentTop !== null) {
+ sticky.reset();
+ }
+
+ } else {
+
+ if (sticky.options.top < 0) {
+ newTop = 0;
+ } else {
+ stickyHeight = sticky.element.outerHeight();
+ newTop = documentHeight - stickyHeight - sticky.options.top - sticky.options.bottom - scrollTop - extra;
+ newTop = newTop < 0 ? newTop + sticky.options.top : sticky.options.top;
+ }
+
+ if (sticky.boundary && sticky.boundary.length) {
+
+ var bTop = sticky.boundary.position().top;
+
+ if (sticky.boundtoparent) {
+ containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
+ } else {
+ containerBottom = documentHeight - bTop - parseInt(sticky.boundary.css('margin-top'));
+ }
+
+ newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.options.top < 0 ? 0 : sticky.options.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
+ }
+
+
+ if (sticky.currentTop != newTop) {
+
+ sticky.element.css({
+ "position" : "fixed",
+ "top" : newTop,
+ "width" : (typeof sticky.getWidthFrom !== 'undefined') ? UI.$(sticky.getWidthFrom).width() : sticky.element.width(),
+ "left" : sticky.wrapper.offset().left
+ });
+
+ if (!sticky.init) {
+
+ sticky.element.addClass(sticky.options.clsinit);
+
+ if (location.hash && scrollTop > 0 && sticky.options.target) {
+
+ var $target = UI.$(location.hash);
+
+ if ($target.length) {
+
+ setTimeout((function($target, sticky){
+
+ return function() {
+
+ sticky.element.width(); // force redraw
+
+ var offset = $target.offset(),
+ maxoffset = offset.top + $target.outerHeight(),
+ stickyOffset = sticky.element.offset(),
+ stickyHeight = sticky.element.outerHeight(),
+ stickyMaxOffset = stickyOffset.top + stickyHeight;
+
+ if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
+ scrollTop = offset.top - stickyHeight - sticky.options.target;
+ window.scrollTo(0, scrollTop);
+ }
+ };
+
+ })($target, sticky), 0);
+ }
+ }
+ }
+
+ sticky.element.addClass(sticky.options.clsactive);
+ sticky.element.css('margin', '');
+
+ if (sticky.options.animation && sticky.init) {
+ sticky.element.addClass(sticky.options.animation);
+ }
+
+ sticky.currentTop = newTop;
+ }
+ }
+
+ sticky.init = true;
+ }
+ }
+
+ return UI.sticky;
+});
diff --git a/uikit/static/js/components/sticky.min.js b/uikit/static/js/components/sticky.min.js
new file mode 100644
index 0000000..a0f318e
--- /dev/null
+++ b/uikit/static/js/components/sticky.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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:o;if(i.length&&!(e.scrollTop()<0))for(var s,a,r,p,h=e.scrollTop(),c=n.height(),l=e.height(),u=c-l,d=h>u?u-h:0,m=0;m<i.length;m++)if(p=i[m],p.element.is(":visible")&&!p.animate){if(p.check()){if(p.options.top<0?s=0:(r=p.element.outerHeight(),s=c-r-p.options.top-p.options.bottom-h-d,s=0>s?s+p.options.top:p.options.top),p.boundary&&p.boundary.length){var f=p.boundary.position().top;a=p.boundtoparent?c-(f+p.boundary.outerHeight())+parseInt(p.boundary.css("padding-bottom")):c-f-parseInt(p.boundary.css("margin-top")),s=h+r>c-a-(p.options.top<0?0:p.options.top)?c-a-(h+r):s}if(p.currentTop!=s){if(p.element.css({position:"fixed",top:s,width:"undefined"!=typeof p.getWidthFrom?t.$(p.getWidthFrom).width():p.element.width(),left:p.wrapper.offset().left}),!p.init&&(p.element.addClass(p.options.clsinit),location.hash&&h>0&&p.options.target)){var g=t.$(location.hash);g.length&&setTimeout(function(t,i){return function(){i.element.width();var e=t.offset(),n=e.top+t.outerHeight(),o=i.element.offset(),s=i.element.outerHeight(),a=o.top+s;o.top<n&&e.top<a&&(h=e.top-s-i.options.target,window.scrollTo(0,h))}}(g,p),0)}p.element.addClass(p.options.clsactive),p.element.css("margin",""),p.options.animation&&p.init&&p.element.addClass(p.options.animation),p.currentTop=s}}else null!==p.currentTop&&p.reset();p.init=!0}}var e=t.$win,n=t.$doc,o=[];return t.component("sticky",{defaults:{top:0,bottom:0,animation:"",clsinit:"uk-sticky-init",clsactive:"uk-active",getWidthFrom:"",boundary:!1,media:!1,target:!1,disabled:!1},boot:function(){t.$doc.on("scrolling.uk.document",function(){i()}),t.$win.on("resize orientationchange",t.Utils.debounce(function(){if(o.length){for(var t=0;t<o.length;t++)o[t].reset(!0),o[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,s=t.$('<div class="uk-sticky-placeholder"></div>'),a=this.options.boundary;this.wrapper=this.element.css("margin",0).wrap(s).parent(),this.computeWrapper(),a&&(a===!0?(a=this.wrapper.parent(),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:this.options.getWidthFrom||this.wrapper,boundary:a,boundtoparent:i,reset:function(i){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.currentTop=null,this.animate=!1}.bind(this);!i&&this.options.animation&&t.support.animation?(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 t=e.scrollTop(),i=n.height(),o=i-window.innerHeight,s=t>o?o-t:0,a=this.wrapper.offset().top,r=a-this.options.top-s;return t>=r}},o.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:"absolute"!=this.element.css("position")?this.element.outerHeight():"","float":"none"!=this.element.css("float")?this.element.css("float"):"",margin:this.element.css("margin")})}}),t.sticky}); \ No newline at end of file
diff --git a/uikit/static/js/components/timepicker.js b/uikit/static/js/components/timepicker.js
new file mode 100644
index 0000000..4f48c3f
--- /dev/null
+++ b/uikit/static/js/components/timepicker.js
@@ -0,0 +1,192 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-search", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+
+ UI.component('timepicker', {
+
+ defaults: {
+ format : '24h',
+ delay : 0,
+ start : 0,
+ end : 24
+ },
+
+ boot: function() {
+
+ // init code
+ UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
+
+ var ele = UI.$(this);
+
+ if (!ele.data("timepicker")) {
+ var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
+
+ setTimeout(function(){
+ obj.autocomplete.input.focus();
+ }, 40);
+ }
+ });
+ },
+
+ init: function() {
+
+ var $this = this, times = getTimeRange(this.options.start, this.options.end), container;
+
+ 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(release) {
+ release(times[$this.options.format] || times['12h']);
+ };
+
+ if (this.element.is('input')) {
+ this.element.wrap('<div class="uk-autocomplete"></div>');
+ container = this.element.parent();
+ } else {
+ container = this.element.addClass('uk-autocomplete');
+ }
+
+ this.autocomplete = UI.autocomplete(container, this.options);
+ this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
+
+ this.autocomplete.on('show.uk.autocomplete', function() {
+
+ var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
+
+ setTimeout(function(){
+ $this.autocomplete.pick(selected, true);
+ }, 10);
+ });
+
+ this.autocomplete.input.on('focus', function(){
+
+ $this.autocomplete.value = Math.random();
+ $this.autocomplete.triggercomplete();
+
+ }).on('blur', function() {
+ $this.checkTime();
+ });
+
+ this.element.data("timepicker", this);
+ },
+
+ checkTime: function() {
+
+ var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
+
+ if (this.options.format == '12h') {
+ arr = time.split(' ');
+ timeArray = arr[0].split(':');
+ meridian = arr[1];
+ } else {
+ timeArray = time.split(':');
+ }
+
+ hour = parseInt(timeArray[0], 10);
+ minute = parseInt(timeArray[1], 10);
+
+ if (isNaN(hour)) hour = 0;
+ if (isNaN(minute)) minute = 0;
+
+ if (this.options.format == '12h') {
+ if (hour > 12) {
+ hour = 12;
+ } else if (hour < 0) {
+ hour = 12;
+ }
+
+ if (meridian === 'am' || meridian === 'a') {
+ meridian = 'AM';
+ } else if (meridian === 'pm' || meridian === 'p') {
+ meridian = 'PM';
+ }
+
+ if (meridian !== 'AM' && meridian !== 'PM') {
+ meridian = 'AM';
+ }
+
+ } else {
+
+ if (hour >= 24) {
+ hour = 23;
+ } else if (hour < 0) {
+ hour = 0;
+ }
+ }
+
+ if (minute < 0) {
+ minute = 0;
+ } else if (minute >= 60) {
+ minute = 0;
+ }
+
+ this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
+ },
+
+ formatTime: function(hour, minute, meridian) {
+ hour = hour < 10 ? '0' + hour : hour;
+ minute = minute < 10 ? '0' + minute : minute;
+ return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
+ }
+ });
+
+ // helper
+
+ function getTimeRange(start, end) {
+
+ start = start || 0;
+ end = end || 24;
+
+ var times = {'12h':[], '24h':[]}, i, h;
+
+ for (i = start, h=''; i<end; i++) {
+
+ h = ''+i;
+
+ if (i<10) h = '0'+h;
+
+ times['24h'].push({value: (h+':00')});
+ times['24h'].push({value: (h+':30')});
+
+ if (i === 0) {
+ h = 12;
+ times['12h'].push({value: (h+':00 AM')});
+ times['12h'].push({value: (h+':30 AM')});
+ }
+
+ if (i > 0 && i<13 && i!==12) {
+ times['12h'].push({value: (h+':00 AM')});
+ times['12h'].push({value: (h+':30 AM')});
+ }
+
+ if (i >= 12) {
+
+ h = h-12;
+ if (h === 0) h = 12;
+ if (h < 10) h = '0'+String(h);
+
+ times['12h'].push({value: (h+':00 PM')});
+ times['12h'].push({value: (h+':30 PM')});
+ }
+ }
+
+ return times;
+ }
+
+});
diff --git a/uikit/static/js/components/timepicker.min.js b/uikit/static/js/components/timepicker.min.js
new file mode 100644
index 0000000..f11f4a8
--- /dev/null
+++ b/uikit/static/js/components/timepicker.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-search",["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",function(){o.checkTime()}),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/uikit/static/js/components/tooltip.js b/uikit/static/js/components/tooltip.js
new file mode 100644
index 0000000..8e704f7
--- /dev/null
+++ b/uikit/static/js/components/tooltip.js
@@ -0,0 +1,234 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-tooltip", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ var $tooltip, // tooltip container
+ tooltipdelay, checkdelay;
+
+ UI.component('tooltip', {
+
+ defaults: {
+ "offset": 5,
+ "pos": "top",
+ "animation": false,
+ "delay": 0, // in miliseconds
+ "cls": "",
+ "activeClass": "uk-active",
+ "src": function(ele, title) {
+
+ title = ele.attr('title');
+
+ if (title) {
+ ele.data('cached-title', title).removeAttr('title');
+ }
+
+ return ele.data("cached-title");
+ }
+ },
+
+ tip: "",
+
+ boot: function() {
+
+ // init code
+ UI.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
+ var ele = UI.$(this);
+
+ if (!ele.data("tooltip")) {
+ var obj = UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
+ ele.trigger("mouseenter");
+ }
+ });
+ },
+
+ init: function() {
+
+ var $this = this;
+
+ if (!$tooltip) {
+ $tooltip = UI.$('<div class="uk-tooltip"></div>').appendTo("body");
+ }
+
+ this.on({
+ focus : function(e) { $this.show(); },
+ blur : function(e) { $this.hide(); },
+ mouseenter : function(e) { $this.show(); },
+ mouseleave : function(e) { $this.hide(); }
+ });
+ },
+
+ show: function() {
+
+ this.tip = typeof(this.options.src) === "function" ? this.options.src(this.element) : this.options.src;
+
+ if (tooltipdelay) clearTimeout(tooltipdelay);
+ if (checkdelay) clearTimeout(checkdelay);
+ if (!this.tip.length) return;
+
+ $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).removeClass(this.options.activeClass).show();
+ $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
+
+ var $this = this,
+ pos = UI.$.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
+ width = $tooltip[0].offsetWidth,
+ height = $tooltip[0].offsetHeight,
+ offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
+ position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
+ tmppos = position.split("-"),
+ tcss = {
+ "display" : "none",
+ "visibility" : "visible",
+ "top" : (pos.top + pos.height + height),
+ "left" : pos.left
+ };
+
+
+ // prevent strange position
+ // when tooltip is in offcanvas etc.
+ if (UI.$html.css('position')=='fixed' || UI.$body.css('position')=='fixed'){
+ var bodyoffset = UI.$('body').offset(),
+ htmloffset = UI.$('html').offset(),
+ docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
+
+ pos.left -= docoffset.left;
+ pos.top -= docoffset.top;
+ }
+
+
+ if ((tmppos[0] == "left" || tmppos[0] == "right") && UI.langdirection == 'right') {
+ tmppos[0] = tmppos[0] == "left" ? "right" : "left";
+ }
+
+ var variants = {
+ "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
+ "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
+ "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
+ "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
+ };
+
+ UI.$.extend(tcss, variants[tmppos[0]]);
+
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
+
+ var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
+
+ if(boundary) {
+
+ switch(boundary) {
+ case "x":
+
+ if (tmppos.length == 2) {
+ position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
+ } else {
+ position = tcss.left < 0 ? "right": "left";
+ }
+
+ break;
+
+ case "y":
+ if (tmppos.length == 2) {
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
+ } else {
+ position = (tcss.top < 0 ? "bottom": "top");
+ }
+
+ break;
+
+ case "xy":
+ if (tmppos.length == 2) {
+ position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
+ } else {
+ position = tcss.left < 0 ? "right": "left";
+ }
+
+ break;
+
+ }
+
+ tmppos = position.split("-");
+
+ UI.$.extend(tcss, variants[tmppos[0]]);
+
+ if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
+ }
+
+
+ tcss.left -= UI.$body.position().left;
+
+ tooltipdelay = setTimeout(function(){
+
+ $tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
+
+ if ($this.options.animation) {
+ $tooltip.css({opacity: 0, display: 'block'}).addClass($this.options.activeClass).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
+ } else {
+ $tooltip.show().addClass($this.options.activeClass);
+ }
+
+ tooltipdelay = false;
+
+ // close tooltip if element was removed or hidden
+ checkdelay = setInterval(function(){
+ if(!$this.element.is(':visible')) $this.hide();
+ }, 150);
+
+ }, parseInt(this.options.delay, 10) || 0);
+ },
+
+ hide: function() {
+ if(this.element.is("input") && this.element[0]===document.activeElement) return;
+
+ if(tooltipdelay) clearTimeout(tooltipdelay);
+ if (checkdelay) clearTimeout(checkdelay);
+
+ $tooltip.stop();
+
+ if (this.options.animation) {
+
+ var $this = this;
+
+ $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400, function(){
+ $tooltip.removeClass($this.options.activeClass)
+ });
+
+ } else {
+ $tooltip.hide().removeClass(this.options.activeClass);
+ }
+ },
+
+ content: function() {
+ return this.tip;
+ },
+
+ checkBoundary: function(left, top, width, height) {
+
+ var axis = "";
+
+ if(left < 0 || ((left - UI.$win.scrollLeft())+width) > window.innerWidth) {
+ axis += "x";
+ }
+
+ if(top < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
+ axis += "y";
+ }
+
+ return axis;
+ }
+ });
+
+ return UI.tooltip;
+});
diff --git a/uikit/static/js/components/tooltip.min.js b/uikit/static/js/components/tooltip.min.js
new file mode 100644
index 0000000..80a1f05
--- /dev/null
+++ b/uikit/static/js/components/tooltip.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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,i){return i=t.attr("title"),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);if(!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),this.tip.length){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/uikit/static/js/components/upload.js b/uikit/static/js/components/upload.js
new file mode 100644
index 0000000..21699b0
--- /dev/null
+++ b/uikit/static/js/components/upload.js
@@ -0,0 +1,256 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+(function(addon) {
+
+ var component;
+
+ if (window.UIkit) {
+ component = addon(UIkit);
+ }
+
+ if (typeof define == "function" && define.amd) {
+ define("uikit-upload", ["uikit"], function(){
+ return component || addon(UIkit);
+ });
+ }
+
+})(function(UI){
+
+ "use strict";
+
+ UI.component('uploadSelect', {
+
+ init: function() {
+
+ var $this = this;
+
+ this.on("change", function() {
+ xhrupload($this.element[0].files, $this.options);
+ var twin = $this.element.clone(true).data('uploadSelect', $this);
+ $this.element.replaceWith(twin);
+ $this.element = twin;
+ });
+ }
+ });
+
+ UI.component('uploadDrop', {
+
+ defaults: {
+ 'dragoverClass': 'uk-dragover'
+ },
+
+ init: function() {
+
+ var $this = this, hasdragCls = false;
+
+ this.on("drop", function(e){
+
+ if (e.dataTransfer && e.dataTransfer.files) {
+
+ e.stopPropagation();
+ e.preventDefault();
+
+ $this.element.removeClass($this.options.dragoverClass);
+ $this.element.trigger('dropped.uk.upload', [e.dataTransfer.files]);
+
+ xhrupload(e.dataTransfer.files, $this.options);
+ }
+
+ }).on("dragenter", function(e){
+ e.stopPropagation();
+ e.preventDefault();
+ }).on("dragover", function(e){
+ e.stopPropagation();
+ e.preventDefault();
+
+ if (!hasdragCls) {
+ $this.element.addClass($this.options.dragoverClass);
+ hasdragCls = true;
+ }
+ }).on("dragleave", function(e){
+ e.stopPropagation();
+ e.preventDefault();
+ $this.element.removeClass($this.options.dragoverClass);
+ hasdragCls = false;
+ });
+ }
+ });
+
+
+ UI.support.ajaxupload = (function() {
+
+ function supportFileAPI() {
+ var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
+ }
+
+ function supportAjaxUploadProgressEvents() {
+ var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
+ }
+
+ function supportFormData() {
+ return !! window.FormData;
+ }
+
+ return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
+ })();
+
+ if (UI.support.ajaxupload){
+ UI.$.event.props.push("dataTransfer");
+ }
+
+ function xhrupload(files, settings) {
+
+ if (!UI.support.ajaxupload){
+ return this;
+ }
+
+ settings = UI.$.extend({}, xhrupload.defaults, settings);
+
+ if (!files.length){
+ return;
+ }
+
+ if (settings.allow !== '*.*') {
+
+ for(var i=0,file;file=files[i];i++) {
+
+ if(!matchName(settings.allow, file.name)) {
+
+ if(typeof(settings.notallowed) == 'string') {
+ alert(settings.notallowed);
+ } else {
+ settings.notallowed(file, settings);
+ }
+ return;
+ }
+ }
+ }
+
+ var complete = settings.complete;
+
+ if (settings.single){
+
+ var count = files.length,
+ uploaded = 0,
+ allow = true;
+
+ settings.beforeAll(files);
+
+ settings.complete = function(response, xhr){
+
+ uploaded = uploaded + 1;
+
+ complete(response, xhr);
+
+ if (settings.filelimit && uploaded >= settings.filelimit){
+ allow = false;
+ }
+
+ if (allow && uploaded<count){
+ upload([files[uploaded]], settings);
+ } else {
+ settings.allcomplete(response, xhr);
+ }
+ };
+
+ upload([files[0]], settings);
+
+ } else {
+
+ settings.complete = function(response, xhr){
+ complete(response, xhr);
+ settings.allcomplete(response, xhr);
+ };
+
+ upload(files, settings);
+ }
+
+ function upload(files, settings){
+
+ // upload all at once
+ var formData = new FormData(), xhr = new XMLHttpRequest();
+
+ if (settings.before(settings, files)===false) return;
+
+ for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
+ for (var p in settings.params) { formData.append(p, settings.params[p]); }
+
+ // Add any event handlers here...
+ xhr.upload.addEventListener("progress", function(e){
+ var percent = (e.loaded / e.total)*100;
+ settings.progress(percent, e);
+ }, false);
+
+ xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
+ xhr.addEventListener("load", function(e){ settings.load(e); }, false);
+ xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
+ xhr.addEventListener("error", function(e){ settings.error(e); }, false);
+ xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
+
+ xhr.open(settings.method, settings.action, true);
+
+ xhr.onreadystatechange = function() {
+
+ settings.readystatechange(xhr);
+
+ if (xhr.readyState==4){
+
+ var response = xhr.responseText;
+
+ if (settings.type=="json") {
+ try {
+ response = UI.$.parseJSON(response);
+ } catch(e) {
+ response = false;
+ }
+ }
+
+ settings.complete(response, xhr);
+ }
+ };
+ settings.beforeSend(xhr);
+ xhr.send(formData);
+ }
+ }
+
+ xhrupload.defaults = {
+ 'action': '',
+ 'single': true,
+ 'method': 'POST',
+ 'param' : 'files[]',
+ 'params': {},
+ 'allow' : '*.*',
+ 'type' : 'text',
+ 'filelimit': false,
+
+ // events
+ 'before' : function(o){},
+ 'beforeSend' : function(xhr){},
+ 'beforeAll' : function(){},
+ 'loadstart' : function(){},
+ 'load' : function(){},
+ 'loadend' : function(){},
+ 'error' : function(){},
+ 'abort' : function(){},
+ 'progress' : function(){},
+ 'complete' : function(){},
+ 'allcomplete' : function(){},
+ 'readystatechange': function(){},
+ 'notallowed' : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
+ };
+
+ function matchName(pattern, path) {
+
+ var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
+ replace(/\*\*/g, '(\\/[^\\/]+)*').
+ replace(/\*/g, '[^\\/]+').
+ replace(/((?!\\))\?/g, '$1.') + '$';
+
+ parsedPattern = '^' + parsedPattern + '$';
+
+ return (path.match(new RegExp(parsedPattern, 'i')) !== null);
+ }
+
+ UI.Utils.xhrupload = xhrupload;
+
+ return xhrupload;
+});
diff --git a/uikit/static/js/components/upload.min.js b/uikit/static/js/components/upload.min.js
new file mode 100644
index 0000000..e9b4759
--- /dev/null
+++ b/uikit/static/js/components/upload.min.js
@@ -0,0 +1,2 @@
+/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
+!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,l=0;r=t[l];l++)o.append(n.param,r);for(var i in n.params)o.append(i,n.params[i]);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),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 l,i=0;l=o[i];i++)if(!n(a.allow,l.name))return"string"==typeof a.notallowed?alert(a.notallowed):a.notallowed(l,a),void 0;var f=a.complete;if(a.single){var d=o.length,s=0,p=!0;a.beforeAll(o),a.complete=function(e,t){s+=1,f(e,t),a.filelimit&&s>=a.filelimit&&(p=!1),p&&d>s?r([o[s]],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.dataTransfer&&n.dataTransfer.files&&(n.stopPropagation(),n.preventDefault(),e.element.removeClass(e.options.dragoverClass),e.element.trigger("dropped.uk.upload",[n.dataTransfer.files]),t(n.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()}(),e.support.ajaxupload&&e.$.event.props.push("dataTransfer"),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