From 2653f6a943a6ed74e2b72246ba8211c5fb699a7f Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 7 Aug 2016 02:17:47 +0200 Subject: restructured ;) --- js/components/accordion.js | 174 -- js/components/accordion.min.js | 2 - js/components/autocomplete.js | 334 ---- js/components/autocomplete.min.js | 2 - js/components/datepicker.js | 3166 ------------------------------------ js/components/datepicker.min.js | 3 - js/components/form-password.js | 67 - js/components/form-password.min.js | 2 - js/components/form-select.js | 77 - js/components/form-select.min.js | 2 - js/components/grid-parallax.js | 168 -- js/components/grid-parallax.min.js | 2 - js/components/grid.js | 527 ------ js/components/grid.min.js | 2 - js/components/htmleditor.js | 679 -------- js/components/htmleditor.min.js | 2 - js/components/lightbox.js | 591 ------- js/components/lightbox.min.js | 2 - js/components/nestable.js | 653 -------- js/components/nestable.min.js | 2 - js/components/notify.js | 189 --- js/components/notify.min.js | 2 - js/components/pagination.js | 147 -- js/components/pagination.min.js | 2 - js/components/parallax.js | 462 ------ js/components/parallax.min.js | 2 - js/components/search.js | 92 -- js/components/search.min.js | 2 - js/components/slider.js | 540 ------ js/components/slider.min.js | 2 - js/components/slideset.js | 514 ------ js/components/slideset.min.js | 2 - js/components/slideshow-fx.js | 383 ----- js/components/slideshow-fx.min.js | 2 - js/components/slideshow.js | 560 ------- js/components/slideshow.min.js | 2 - js/components/sortable.js | 688 -------- js/components/sortable.min.js | 2 - js/components/sticky.js | 364 ----- js/components/sticky.min.js | 2 - js/components/timepicker.js | 192 --- js/components/timepicker.min.js | 2 - js/components/tooltip.js | 234 --- js/components/tooltip.min.js | 2 - js/components/upload.js | 257 --- js/components/upload.min.js | 2 - 46 files changed, 11105 deletions(-) delete mode 100755 js/components/accordion.js delete mode 100755 js/components/accordion.min.js delete mode 100755 js/components/autocomplete.js delete mode 100755 js/components/autocomplete.min.js delete mode 100755 js/components/datepicker.js delete mode 100755 js/components/datepicker.min.js delete mode 100755 js/components/form-password.js delete mode 100755 js/components/form-password.min.js delete mode 100755 js/components/form-select.js delete mode 100755 js/components/form-select.min.js delete mode 100755 js/components/grid-parallax.js delete mode 100755 js/components/grid-parallax.min.js delete mode 100755 js/components/grid.js delete mode 100755 js/components/grid.min.js delete mode 100755 js/components/htmleditor.js delete mode 100755 js/components/htmleditor.min.js delete mode 100755 js/components/lightbox.js delete mode 100755 js/components/lightbox.min.js delete mode 100755 js/components/nestable.js delete mode 100755 js/components/nestable.min.js delete mode 100755 js/components/notify.js delete mode 100755 js/components/notify.min.js delete mode 100755 js/components/pagination.js delete mode 100755 js/components/pagination.min.js delete mode 100755 js/components/parallax.js delete mode 100755 js/components/parallax.min.js delete mode 100755 js/components/search.js delete mode 100755 js/components/search.min.js delete mode 100755 js/components/slider.js delete mode 100755 js/components/slider.min.js delete mode 100755 js/components/slideset.js delete mode 100755 js/components/slideset.min.js delete mode 100755 js/components/slideshow-fx.js delete mode 100755 js/components/slideshow-fx.min.js delete mode 100755 js/components/slideshow.js delete mode 100755 js/components/slideshow.min.js delete mode 100755 js/components/sortable.js delete mode 100755 js/components/sortable.min.js delete mode 100755 js/components/sticky.js delete mode 100755 js/components/sticky.min.js delete mode 100755 js/components/timepicker.js delete mode 100755 js/components/timepicker.min.js delete mode 100755 js/components/tooltip.js delete mode 100755 js/components/tooltip.min.js delete mode 100755 js/components/upload.js delete mode 100755 js/components/upload.min.js (limited to 'js/components') diff --git a/js/components/accordion.js b/js/components/accordion.js deleted file mode 100755 index 2401780..0000000 --- a/js/components/accordion.js +++ /dev/null @@ -1,174 +0,0 @@ -/*! UIkit 2.26.4 | 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.uk.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); - wrapper.data('content').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')).removeClass(this.options.clsactive) - .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('
').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/js/components/accordion.min.js b/js/components/accordion.min.js deleted file mode 100755 index ca3e452..0000000 --- a/js/components/accordion.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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.uk.accordion",this.options.toggle,function(o){o.preventDefault(),i.toggleItem(t.$(this).data("wrapper"),i.options.animate,i.options.collapse)}),this.update(),this.options.showfirst&&this.toggleItem(this.toggle.eq(0).data("wrapper"),!1,!1)},toggleItem:function(o,e,a){var n=this;o.data("toggle").toggleClass(this.options.clsactive),o.data("content").toggleClass(this.options.clsactive);var s=o.data("toggle").hasClass(this.options.clsactive);a&&(this.toggle.not(o.data("toggle")).removeClass(this.options.clsactive),this.content.not(o.data("content")).removeClass(this.options.clsactive).parent().stop().css("overflow","hidden").animate({height:0},{easing:this.options.easing,duration:e?this.options.duration:0}).attr("aria-expanded","false")),o.stop().css("overflow","hidden"),e?o.animate({height:s?i(o.data("content")):0},{easing:this.options.easing,duration:this.options.duration,complete:function(){s&&(o.css({overflow:"",height:"auto"}),t.Utils.checkDisplay(o.data("content"))),n.trigger("display.uk.check")}}):(o.height(s?"auto":0),s&&(o.css({overflow:""}),t.Utils.checkDisplay(o.data("content"))),this.trigger("display.uk.check")),o.attr("aria-expanded",s),this.element.trigger("toggle.uk.accordion",[s,o.data("toggle"),o.data("content")])},update:function(){var i,o,e,a=this;this.toggle=this.find(this.options.toggle),this.content=this.find(this.options.containers),this.content.each(function(n){i=t.$(this),i.parent().data("wrapper")?o=i.parent():(o=t.$(this).wrap('
').parent(),o.attr("aria-expanded","false")),e=a.toggle.eq(n),o.data("toggle",e),o.data("content",i),e.data("wrapper",o),i.data("wrapper",o)}),this.element.trigger("update.uk.accordion",[this])}}),t.accordion}); \ No newline at end of file diff --git a/js/components/autocomplete.js b/js/components/autocomplete.js deleted file mode 100755 index 58a405d..0000000 --- a/js/components/autocomplete.js +++ /dev/null @@ -1,334 +0,0 @@ -/*! UIkit 2.26.4 | 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: '' - }, - - 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")) { - 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.$('
').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) { - - 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/js/components/autocomplete.min.js b/js/components/autocomplete.min.js deleted file mode 100755 index 10eed9a..0000000 --- a/js/components/autocomplete.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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:''},visible:!1,value:null,selected:null,boot:function(){t.$html.on("focus.autocomplete.uikit","[data-uk-autocomplete]",function(){var e=t.$(this);e.data("autocomplete")||t.autocomplete(e,t.Utils.options(e.attr("data-uk-autocomplete")))}),t.$html.on("click.autocomplete.uikit",function(t){e&&t.target!=e.input[0]&&e.hide()})},init:function(){var e=this,i=!1,s=t.Utils.debounce(function(){return i?i=!1:(e.handle(),void 0)},this.options.delay);this.dropdown=this.find(".uk-dropdown"),this.template=this.find('script[type="text/autocomplete"]').html(),this.template=t.Utils.template(this.template||this.options.template),this.input=this.find("input:first").attr("autocomplete","off"),this.dropdown.length||(this.dropdown=t.$('
').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.lengtha-1?o.length-1:a-1)}else n=o["next"==e?"first":"last"]();n=t.$(n)}}else n=e;if(n&&n.length&&(this.selected=n,o.removeClass(this.options.hoverClass),this.selected.addClass(this.options.hoverClass),i)){var l=n.position().top,h=s.dropdown.scrollTop(),r=s.dropdown.height();(l>r||0>l)&&s.dropdown.scrollTop(h+l)}},select:function(){if(this.selected){var t=this.selected.data();this.trigger("selectitem.uk.autocomplete",[t,this]),t.value&&this.input.val(t.value).trigger("change"),this.hide()}},show:function(){return this.visible?void 0:(this.visible=!0,this.element.addClass("uk-open"),e&&e!==this&&e.hide(),e=this,this.dropdown.attr("aria-expanded","true"),this)},hide:function(){return this.visible?(this.visible=!1,this.element.removeClass("uk-open"),e===this&&(e=!1),this.dropdown.attr("aria-expanded","false"),this):void 0},request:function(){var e=this,i=function(t){t&&e.render(t),e.element.removeClass(e.options.loadingClass)};if(this.element.addClass(this.options.loadingClass),this.options.source){var s=this.options.source;switch(typeof this.options.source){case"function":this.options.source.apply(this,[i]);break;case"object":if(s.length){var o=[];s.forEach(function(t){t.value&&-1!=t.value.toLowerCase().indexOf(e.value.toLowerCase())&&o.push(t)}),i(o)}break;case"string":var n={};n[this.options.param]=this.value,t.$.ajax({url:this.options.source,data:n,type:this.options.method,dataType:"json"}).done(function(t){i(t||[])});break;default:i(null)}}else this.element.removeClass(e.options.loadingClass)},render:function(t){return this.dropdown.empty(),this.selected=!1,this.options.renderer?this.options.renderer.apply(this,[t]):t&&t.length&&(this.dropdown.append(this.template({items:t})),this.show(),this.trigger("show.uk.autocomplete")),this}}),t.autocomplete}); \ No newline at end of file diff --git a/js/components/datepicker.js b/js/components/datepicker.js deleted file mode 100755 index 31890b4..0000000 --- a/js/components/datepicker.js +++ /dev/null @@ -1,3166 +0,0 @@ -/*! UIkit 2.26.4 | 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: "YYYY-MM-DD", - offsettop: 5, - maxDate: false, - minDate: false, - pos: 'auto', - template: function(data, opts) { - - var content = '', i; - - content += '
'; - content += ''; - content += ''; - - if (UI.formSelect) { - - var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear; - - for (i=0;i'+opts.i18n.months[i]+''); - } else { - options.push(''); - } - } - - months = ''+ opts.i18n.months[data.month] + ''; - - // -- - - options = []; - - minYear = data.minDate ? data.minDate.year() : currentyear - 50; - maxYear = data.maxDate ? data.maxDate.year() : currentyear + 20; - - for (i=minYear;i<=maxYear;i++) { - if (i == data.year) { - options.push(''); - } else { - options.push(''); - } - } - - years = ''+ data.year + ''; - - content += '
'+ months + ' ' + years +'
'; - - } else { - content += '
'+ opts.i18n.months[data.month] +' '+ data.year+'
'; - } - - content += '
'; - - content += ''; - content += ''; - for(i = 0; i < data.weekdays.length; i++) { - if (data.weekdays[i]) { - content += ''; - } - } - content += ''; - - content += ''; - for(i = 0; i < data.days.length; i++) { - if (data.days[i] && data.days[i].length){ - content += ''; - 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(day.disabled) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted'); - - content += ''; - } - } - content += ''; - } - } - content += ''; - - content += '
'+data.weekdays[i]+'
'+day.day.format("D")+'
'; - - 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(); - UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker"))); - ele.trigger("focus"); - } - }); - - UI.$html.on("click focus", '*', 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.$('
'); - - 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.current = moment(ele.data("date")); - active.element.val(active.current.isValid() ? active.current.format(active.options.format) : null).trigger("change"); - active.hide(); - } else { - active.add((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 = isNaN(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, 12).getDay(), - data = {"month":month, "year":year,"weekdays":[],"days":[], "maxDate": false, "minDate": false}, - row = []; - - if (opts.maxDate!==false){ - data.maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add(opts.maxDate, 'days'); - } - - if (opts.minDate!==false){ - data.minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add(opts.minDate-1, 'days'); - } - - 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), 12); - isDisabled = (data.minDate && data.minDate > day) || (data.maxDate && day > data.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/js/components/datepicker.min.js b/js/components/datepicker.min.js deleted file mode 100755 index f8dfe47..0000000 --- a/js/components/datepicker.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! UIkit 2.26.4 | 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:"YYYY-MM-DD",offsettop:5,maxDate:!1,minDate:!1,pos:"auto",template:function(e,n){var a,s="";if(s+='
',s+='',s+='',t.formSelect){var i,r,o,u,c=(new Date).getFullYear(),d=[];for(a=0;a'+n.i18n.months[a]+""):d.push('");for(i=''+n.i18n.months[e.month]+'",d=[],o=e.minDate?e.minDate.year():c-50,u=e.maxDate?e.maxDate.year():c+20,a=o;u>=a;a++)a==e.year?d.push('"):d.push('");r=''+e.year+'",s+='
'+i+" "+r+"
"}else s+='
'+n.i18n.months[e.month]+" "+e.year+"
";for(s+="
",s+='',s+="",a=0;a"+e.weekdays[a]+"");for(s+="",s+="",a=0;a";for(var l=0;l'+h.day.format("D")+""}s+=""}return s+="",s+="
"}},boot:function(){t.$win.on("resize orientationchange",function(){a&&a.hide()}),t.$html.on("focus.datepicker.uikit","[data-uk-datepicker]",function(e){var n=t.$(this);n.data("datepicker")||(e.preventDefault(),t.datepicker(n,t.Utils.options(n.attr("data-uk-datepicker"))),n.trigger("focus"))}),t.$html.on("click focus","*",function(n){var s=t.$(n.target);!a||s[0]==e[0]||s.data("datepicker")||s.parents(".uk-datepicker:first").length||a.hide()})},init:function(){if(!t.support.touch||"date"!=this.element.attr("type")||this.options.mobile){var s=this;this.current=this.element.val()?n(this.element.val(),this.options.format):n(),this.on("click focus",function(){a!==s&&s.pick(this.value?this.value:s.options.minDate?s.options.minDate:"")}).on("change",function(){s.element.val()&&!n(s.element.val(),s.options.format).isValid()&&s.element.val(n().format(s.options.format))}),e||(e=t.$('
'),e.on("click",".uk-datepicker-next, .uk-datepicker-previous, [data-date]",function(e){e.stopPropagation(),e.preventDefault();var s=t.$(this);return s.hasClass("uk-datepicker-date-disabled")?!1:(s.is("[data-date]")?(a.current=n(s.data("date")),a.element.val(a.current.isValid()?a.current.format(a.options.format):null).trigger("change"),a.hide()):a.add(s.hasClass("uk-datepicker-next")?1:-1,"months"),void 0)}),e.on("change",".update-picker-month, .update-picker-year",function(){var e=t.$(this);a[e.is(".update-picker-year")?"setYear":"setMonth"](Number(e.val()))}),e.appendTo("body"))}},pick:function(s){var i=this.element.offset(),r={left:i.left,right:""};this.current=isNaN(s)?n(s,this.options.format):n(),this.initdate=this.current.format("YYYY-MM-DD"),this.update(),"right"==t.langdirection&&(r.right=window.innerWidth-(r.left+this.element.outerWidth()),r.left="");var o=i.top-this.element.outerHeight()+this.element.height()-this.options.offsettop-e.outerHeight(),u=i.top+this.element.outerHeight()+this.options.offsettop;r.top=u,"top"==this.options.pos?r.top=o:"auto"==this.options.pos&&window.innerHeight-u-e.outerHeight()<0&&o>=0&&(r.top=o),e.css(r).show(),this.trigger("show.uk.datepicker"),a=this},add:function(t,e){this.current.add(t,e),this.update()},setMonth:function(t){this.current.month(t),this.update()},setYear:function(t){this.current.year(t),this.update()},update:function(){var t=this.getRows(this.current.year(),this.current.month()),n=this.options.template(t,this.options);e.html(n),this.trigger("update.uk.datepicker")},getRows:function(t,e){var a=this.options,s=n().format("YYYY-MM-DD"),i=[31,t%4===0&&t%100!==0||t%400===0?29:28,31,30,31,30,31,31,30,31,30,31][e],r=new Date(t,e,1,12).getDay(),o={month:e,year:t,weekdays:[],days:[],maxDate:!1,minDate:!1},u=[];a.maxDate!==!1&&(o.maxDate=isNaN(a.maxDate)?n(a.maxDate,a.format):n().add(a.maxDate,"days")),a.minDate!==!1&&(o.minDate=isNaN(a.minDate)?n(a.minDate,a.format):n().add(a.minDate-1,"days")),o.weekdays=function(){for(var t=0,e=[];7>t;t++){for(var n=t+(a.weekstart||0);n>=7;)n-=7;e.push(a.i18n.weekdays[n])}return e}(),a.weekstart&&a.weekstart>0&&(r-=a.weekstart,0>r&&(r+=7));for(var c=i+r,d=c;d>7;)d-=7;c+=7-d;for(var l,h,f,m,_,p=0,y=0;c>p;p++)l=new Date(t,e,1+(p-r),12),h=o.minDate&&o.minDate>l||o.maxDate&&l>o.maxDate,_=!(r>p||p>=i+r),l=n(l),f=this.initdate==l.format("YYYY-MM-DD"),m=s==l.format("YYYY-MM-DD"),u.push({selected:f,today:m,disabled:h,day:l,inmonth:_}),7===++y&&(o.days.push(u),u=[],y=0);return o},hide:function(){a&&a===this&&(e.hide(),a=!1,this.trigger("hide.uk.datepicker"))}}),n=function(t){function e(t,e,n){switch(arguments.length){case 2:return null!=t?t:e;case 3:return null!=t?t:null!=e?e:n;default:throw new Error("Implement me")}}function n(t,e){return Ye.call(t,e)}function a(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function s(t){De.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function i(t,e){var n=!0;return h(function(){return n&&(s(t),n=!1),e.apply(this,arguments)},e)}function r(t,e){mn[t]||(s(e),mn[t]=!0)}function o(t,e){return function(n){return _(t.call(this,n),e)}}function u(t,e){return function(n){return this.localeData().ordinal(t.call(this,n),e)}}function c(){}function d(t,e){e!==!1&&F(t),f(this,t),this._d=new Date(+t._d)}function l(t){var e=v(t),n=e.year||0,a=e.quarter||0,s=e.month||0,i=e.week||0,r=e.day||0,o=e.hour||0,u=e.minute||0,c=e.second||0,d=e.millisecond||0;this._milliseconds=+d+1e3*c+6e4*u+36e5*o,this._days=+r+7*i,this._months=+s+3*a+12*n,this._data={},this._locale=De.localeData(),this._bubble()}function h(t,e){for(var a in e)n(e,a)&&(t[a]=e[a]);return n(e,"toString")&&(t.toString=e.toString),n(e,"valueOf")&&(t.valueOf=e.valueOf),t}function f(t,e){var n,a,s;if("undefined"!=typeof e._isAMomentObject&&(t._isAMomentObject=e._isAMomentObject),"undefined"!=typeof e._i&&(t._i=e._i),"undefined"!=typeof e._f&&(t._f=e._f),"undefined"!=typeof e._l&&(t._l=e._l),"undefined"!=typeof e._strict&&(t._strict=e._strict),"undefined"!=typeof e._tzm&&(t._tzm=e._tzm),"undefined"!=typeof e._isUTC&&(t._isUTC=e._isUTC),"undefined"!=typeof e._offset&&(t._offset=e._offset),"undefined"!=typeof e._pf&&(t._pf=e._pf),"undefined"!=typeof e._locale&&(t._locale=e._locale),Fe.length>0)for(n in Fe)a=Fe[n],s=e[a],"undefined"!=typeof s&&(t[a]=s);return t}function m(t){return 0>t?Math.ceil(t):Math.floor(t)}function _(t,e,n){for(var a=""+Math.abs(t),s=t>=0;a.lengtha;a++)(n&&t[a]!==e[a]||!n&&S(t[a])!==S(e[a]))&&r++;return r+i}function w(t){if(t){var e=t.toLowerCase().replace(/(.)s$/,"$1");t=on[t]||un[e]||e}return t}function v(t){var e,a,s={};for(a in t)n(t,a)&&(e=w(a),e&&(s[e]=t[a]));return s}function b(e){var n,a;if(0===e.indexOf("week"))n=7,a="day";else{if(0!==e.indexOf("month"))return;n=12,a="month"}De[e]=function(s,i){var r,o,u=De._locale[e],c=[];if("number"==typeof s&&(i=s,s=t),o=function(t){var e=De().utc().set(a,t);return u.call(De._locale,e,s||"")},null!=i)return o(i);for(r=0;n>r;r++)c.push(o(r));return c}}function S(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=e>=0?Math.floor(e):Math.ceil(e)),n}function T(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function O(t,e,n){return oe(De([t,11,31+e-n]),e,n).week}function W(t){return U(t)?366:365}function U(t){return t%4===0&&t%100!==0||t%400===0}function F(t){var e;t._a&&-2===t._pf.overflow&&(e=t._a[ve]<0||t._a[ve]>11?ve:t._a[be]<1||t._a[be]>T(t._a[we],t._a[ve])?be:t._a[Se]<0||t._a[Se]>23?Se:t._a[Te]<0||t._a[Te]>59?Te:t._a[Oe]<0||t._a[Oe]>59?Oe:t._a[We]<0||t._a[We]>999?We:-1,t._pf._overflowDayOfYear&&(we>e||e>be)&&(e=be),t._pf.overflow=e)}function G(t){return null==t._isValid&&(t._isValid=!isNaN(t._d.getTime())&&t._pf.overflow<0&&!t._pf.empty&&!t._pf.invalidMonth&&!t._pf.nullInput&&!t._pf.invalidFormat&&!t._pf.userInvalidated,t._strict&&(t._isValid=t._isValid&&0===t._pf.charsLeftOver&&0===t._pf.unusedTokens.length)),t._isValid}function C(t){return t?t.toLowerCase().replace("_","-"):t}function z(t){for(var e,n,a,s,i=0;i0;){if(a=x(s.slice(0,e).join("-")))return a;if(n&&n.length>=e&&Y(s,n,!0)>=e-1)break;e--}i++}return null}function x(t){var e=null;if(!Ue[t]&&Ge)try{e=De.locale(),require("./locale/"+t),De.locale(e)}catch(n){}return Ue[t]}function I(t,e){return e._isUTC?De(t).zone(e._offset||0):De(t).local()}function H(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function L(t){var e,n,a=t.match(Ie);for(e=0,n=a.length;n>e;e++)a[e]=fn[a[e]]?fn[a[e]]:H(a[e]);return function(s){var i="";for(e=0;n>e;e++)i+=a[e]instanceof Function?a[e].call(s,t):a[e];return i}}function P(t,e){return t.isValid()?(e=A(e,t.localeData()),cn[e]||(cn[e]=L(e)),cn[e](t)):t.localeData().invalidDate()}function A(t,e){function n(t){return e.longDateFormat(t)||t}var a=5;for(He.lastIndex=0;a>=0&&He.test(t);)t=t.replace(He,n),He.lastIndex=0,a-=1;return t}function N(t,e){var n,a=e._strict;switch(t){case"Q":return qe;case"DDDD":return Re;case"YYYY":case"GGGG":case"gggg":return a?Xe:Ae;case"Y":case"G":case"g":return Ke;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return a?Be:Ne;case"S":if(a)return qe;case"SS":if(a)return Qe;case"SSS":if(a)return Re;case"DDD":return Pe;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return je;case"a":case"A":return e._locale._meridiemParse;case"X":return Ve;case"Z":case"ZZ":return Ee;case"T":return $e;case"SSSS":return Ze;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return a?Qe:Le;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Le;case"Do":return Je;default:return n=new RegExp(R(Q(t.replace("\\","")),"i"))}}function Z(t){t=t||"";var e=t.match(Ee)||[],n=e[e.length-1]||[],a=(n+"").match(sn)||["-",0,0],s=+(60*a[1])+S(a[2]);return"+"===a[0]?-s:s}function j(t,e,n){var a,s=n._a;switch(t){case"Q":null!=e&&(s[ve]=3*(S(e)-1));break;case"M":case"MM":null!=e&&(s[ve]=S(e)-1);break;case"MMM":case"MMMM":a=n._locale.monthsParse(e),null!=a?s[ve]=a:n._pf.invalidMonth=e;break;case"D":case"DD":null!=e&&(s[be]=S(e));break;case"Do":null!=e&&(s[be]=S(parseInt(e,10)));break;case"DDD":case"DDDD":null!=e&&(n._dayOfYear=S(e));break;case"YY":s[we]=De.parseTwoDigitYear(e);break;case"YYYY":case"YYYYY":case"YYYYYY":s[we]=S(e);break;case"a":case"A":n._isPm=n._locale.isPM(e);break;case"H":case"HH":case"h":case"hh":s[Se]=S(e);break;case"m":case"mm":s[Te]=S(e);break;case"s":case"ss":s[Oe]=S(e);break;case"S":case"SS":case"SSS":case"SSSS":s[We]=S(1e3*("0."+e));break;case"X":n._d=new Date(1e3*parseFloat(e));break;case"Z":case"ZZ":n._useUTC=!0,n._tzm=Z(e);break;case"dd":case"ddd":case"dddd":a=n._locale.weekdaysParse(e),null!=a?(n._w=n._w||{},n._w.d=a):n._pf.invalidWeekday=e;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":t=t.substr(0,1);case"gggg":case"GGGG":case"GGGGG":t=t.substr(0,2),e&&(n._w=n._w||{},n._w[t]=S(e));break;case"gg":case"GG":n._w=n._w||{},n._w[t]=De.parseTwoDigitYear(e)}}function E(t){var n,a,s,i,r,o,u;n=t._w,null!=n.GG||null!=n.W||null!=n.E?(r=1,o=4,a=e(n.GG,t._a[we],oe(De(),1,4).year),s=e(n.W,1),i=e(n.E,1)):(r=t._locale._week.dow,o=t._locale._week.doy,a=e(n.gg,t._a[we],oe(De(),r,o).year),s=e(n.w,1),null!=n.d?(i=n.d,r>i&&++s):i=null!=n.e?n.e+r:r),u=ue(a,s,i,o,r),t._a[we]=u.year,t._dayOfYear=u.dayOfYear}function $(t){var n,a,s,i,r=[];if(!t._d){for(s=J(t),t._w&&null==t._a[be]&&null==t._a[ve]&&E(t),t._dayOfYear&&(i=e(t._a[we],s[we]),t._dayOfYear>W(i)&&(t._pf._overflowDayOfYear=!0),a=ae(i,0,t._dayOfYear),t._a[ve]=a.getUTCMonth(),t._a[be]=a.getUTCDate()),n=0;3>n&&null==t._a[n];++n)t._a[n]=r[n]=s[n];for(;7>n;n++)t._a[n]=r[n]=null==t._a[n]?2===n?1:0:t._a[n];t._d=(t._useUTC?ae:ne).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()+t._tzm)}}function V(t){var e;t._d||(e=v(t._i),t._a=[e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond],$(t))}function J(t){var e=new Date;return t._useUTC?[e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()]:[e.getFullYear(),e.getMonth(),e.getDate()]}function q(t){if(t._f===De.ISO_8601)return B(t),void 0;t._a=[],t._pf.empty=!0;var e,n,a,s,i,r=""+t._i,o=r.length,u=0;for(a=A(t._f,t._locale).match(Ie)||[],e=0;e0&&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;ir)&&(s=r,n=e));h(t,n||e)}function B(t){var e,n,a=t._i,s=tn.exec(a);if(s){for(t._pf.iso=!0,e=0,n=nn.length;n>e;e++)if(nn[e][1].exec(a)){t._f=nn[e][0]+(s[6]||" ");break}for(e=0,n=an.length;n>e;e++)if(an[e][1].exec(a)){t._f+=an[e][0];break}a.match(Ee)&&(t._f+="Z"),q(t)}else t._isValid=!1}function K(t){B(t),t._isValid===!1&&(delete t._isValid,De.createFromInputFallback(t))}function te(t,e){var n,a=[];for(n=0;nt&&o.setFullYear(t),o}function ae(t){var e=new Date(Date.UTC.apply(null,arguments));return 1970>t&&e.setUTCFullYear(t),e}function se(t,e){if("string"==typeof t)if(isNaN(t)){if(t=e.weekdaysParse(t),"number"!=typeof t)return null}else t=parseInt(t,10);return t}function ie(t,e,n,a,s){return s.relativeTime(e||1,!!n,t,a)}function re(t,e,n){var a=De.duration(t).abs(),s=Me(a.as("s")),i=Me(a.as("m")),r=Me(a.as("h")),o=Me(a.as("d")),u=Me(a.as("M")),c=Me(a.as("y")),d=s0,d[4]=n,ie.apply({},d)}function oe(t,e,n){var a,s=n-e,i=n-t.day();return i>s&&(i-=7),s-7>i&&(i+=7),a=De(t).add(i,"d"),{week:Math.ceil(a.dayOfYear()/7),year:a.year()}}function ue(t,e,n,a,s){var i,r,o=ae(t,0,1).getUTCDay();return o=0===o?7:o,n=null!=n?n:s,i=s-o+(o>a?7:0)-(s>o?7:0),r=7*(e-1)+(n-s)+i+1,{year:r>0?t:t-1,dayOfYear:r>0?r:W(t-1)+r}}function ce(e){var n=e._i,a=e._f;return e._locale=e._locale||De.localeData(e._l),null===n||a===t&&""===n?De.invalid({nullInput:!0}):("string"==typeof n&&(e._i=n=e._locale.preparse(n)),De.isMoment(n)?new d(n,!0):(a?k(a)?X(e):q(e):ee(e),new d(e)))}function de(t,e){var n,a;if(1===e.length&&k(e[0])&&(e=e[0]),!e.length)return De();for(n=e[0],a=1;a=0?"+":"-";return e+_(Math.abs(t),6)},gg:function(){return _(this.weekYear()%100,2)},gggg:function(){return _(this.weekYear(),4)},ggggg:function(){return _(this.weekYear(),5)},GG:function(){return _(this.isoWeekYear()%100,2)},GGGG:function(){return _(this.isoWeekYear(),4)},GGGGG:function(){return _(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return S(this.milliseconds()/100)},SS:function(){return _(S(this.milliseconds()/10),2)},SSS:function(){return _(this.milliseconds(),3)},SSSS:function(){return _(this.milliseconds(),3)},Z:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+_(S(t/60),2)+":"+_(S(t)%60,2)},ZZ:function(){var t=-this.zone(),e="+";return 0>t&&(t=-t,e="-"),e+_(S(t/60),2)+_(S(t)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},mn={},_n=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];ln.length;)ge=ln.pop(),fn[ge+"o"]=u(fn[ge],ge);for(;hn.length;)ge=hn.pop(),fn[ge+ge]=o(fn[ge],2);fn.DDDD=o(fn.DDD,3),h(c.prototype,{set:function(t){var e,n;for(n in t)e=t[n],"function"==typeof e?this[n]=e:this["_"+n]=e},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(t){return this._months[t.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(t){return this._monthsShort[t.month()]},monthsParse:function(t){var e,n,a;for(this._monthsParse||(this._monthsParse=[]),e=0;12>e;e++)if(this._monthsParse[e]||(n=De.utc([2e3,e]),a="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[e]=new RegExp(a.replace(".",""),"i")),this._monthsParse[e].test(t))return e},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(t){return this._weekdays[t.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(t){return this._weekdaysShort[t.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(t){return this._weekdaysMin[t.day()]},weekdaysParse:function(t){var e,n,a;for(this._weekdaysParse||(this._weekdaysParse=[]),e=0;7>e;e++)if(this._weekdaysParse[e]||(n=De([2e3,1]).day(e),a="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[e]=new RegExp(a.replace(".",""),"i")),this._weekdaysParse[e].test(t))return e},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(t){var e=this._longDateFormat[t];return!e&&this._longDateFormat[t.toUpperCase()]&&(e=this._longDateFormat[t.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t]=e),e},isPM:function(t){return"p"===(t+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(t,e){var n=this._calendar[t];return"function"==typeof n?n.apply(e):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(t,e,n,a){var s=this._relativeTime[n];return"function"==typeof s?s(t,e,n,a):s.replace(/%d/i,t)},pastFuture:function(t,e){var n=this._relativeTime[t>0?"future":"past"];return"function"==typeof n?n(e):n.replace(/%s/i,e)},ordinal:function(t){return this._ordinal.replace("%d",t)},_ordinal:"%d",preparse:function(t){return t},postformat:function(t){return t},week:function(t){return oe(t,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),De=function(e,n,s,i){var r;return"boolean"==typeof s&&(i=s,s=t),r={},r._isAMomentObject=!0,r._i=e,r._f=n,r._l=s,r._strict=i,r._isUTC=!1,r._pf=a(),ce(r)},De.suppressDeprecationWarnings=!1,De.createFromInputFallback=i("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(t){t._d=new Date(t._i)}),De.min=function(){var t=[].slice.call(arguments,0);return de("isBefore",t)},De.max=function(){var t=[].slice.call(arguments,0);return de("isAfter",t)},De.utc=function(e,n,s,i){var r;return"boolean"==typeof s&&(i=s,s=t),r={},r._isAMomentObject=!0,r._useUTC=!0,r._isUTC=!0,r._l=s,r._i=e,r._f=n,r._strict=i,r._pf=a(),ce(r).utc()},De.unix=function(t){return De(1e3*t)},De.duration=function(t,e){var a,s,i,r,o=t,u=null;return De.isDuration(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:"number"==typeof t?(o={},e?o[e]=t:o.milliseconds=t):(u=ze.exec(t))?(a="-"===u[1]?-1:1,o={y:0,d:S(u[be])*a,h:S(u[Se])*a,m:S(u[Te])*a,s:S(u[Oe])*a,ms:S(u[We])*a}):(u=xe.exec(t))?(a="-"===u[1]?-1:1,i=function(t){var e=t&&parseFloat(t.replace(",","."));return(isNaN(e)?0:e)*a},o={y:i(u[2]),M:i(u[3]),d:i(u[4]),h:i(u[5]),m:i(u[6]),s:i(u[7]),w:i(u[8])}):"object"==typeof o&&("from"in o||"to"in o)&&(r=y(De(o.from),De(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),s=new l(o),De.isDuration(t)&&n(t,"_locale")&&(s._locale=t._locale),s},De.version=ke,De.defaultFormat=en,De.ISO_8601=function(){},De.momentProperties=Fe,De.updateOffset=function(){},De.relativeTimeThreshold=function(e,n){return dn[e]===t?!1:n===t?dn[e]:(dn[e]=n,!0)},De.lang=i("moment.lang is deprecated. Use moment.locale instead.",function(t,e){return De.locale(t,e)}),De.locale=function(t,e){var n;return t&&(n="undefined"!=typeof e?De.defineLocale(t,e):De.localeData(t),n&&(De.duration._locale=De._locale=n)),De._locale._abbr},De.defineLocale=function(t,e){return null!==e?(e.abbr=t,Ue[t]||(Ue[t]=new c),Ue[t].set(e),De.locale(t),Ue[t]):(delete Ue[t],null)},De.langData=i("moment.langData is deprecated. Use moment.localeData instead.",function(t){return De.localeData(t)}),De.localeData=function(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return De._locale;if(!k(t)){if(e=x(t))return e;t=[t]}return z(t)},De.isMoment=function(t){return t instanceof d||null!=t&&n(t,"_isAMomentObject")},De.isDuration=function(t){return t instanceof l};for(ge=_n.length-1;ge>=0;--ge)b(_n[ge]);De.normalizeUnits=function(t){return w(t)},De.invalid=function(t){var e=De.utc(0/0);return null!=t?h(e._pf,t):e._pf.userInvalidated=!0,e},De.parseZone=function(){return De.apply(null,arguments).parseZone()},De.parseTwoDigitYear=function(t){return S(t)+(S(t)>68?1900:2e3)},h(De.fn=d.prototype,{clone:function(){return De(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var t=De(this).utc();return 00:!1},parsingFlags:function(){return h({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(t){return this.zone(0,t)},local:function(t){return this._isUTC&&(this.zone(0,t),this._isUTC=!1,t&&this.add(this._dateTzOffset(),"m")),this},format:function(t){var e=P(this,t||De.defaultFormat);return this.localeData().postformat(e)},add:D(1,"add"),subtract:D(-1,"subtract"),diff:function(t,e,n){var a,s,i,r=I(t,this),o=6e4*(this.zone()-r.zone());return e=w(e),"year"===e||"month"===e?(a=432e5*(this.daysInMonth()+r.daysInMonth()),s=12*(this.year()-r.year())+(this.month()-r.month()),i=this-De(this).startOf("month")-(r-De(r).startOf("month")),i-=6e4*(this.zone()-De(this).startOf("month").zone()-(r.zone()-De(r).startOf("month").zone())),s+=i/a,"year"===e&&(s/=12)):(a=this-r,s="second"===e?a/1e3:"minute"===e?a/6e4:"hour"===e?a/36e5:"day"===e?(a-o)/864e5:"week"===e?(a-o)/6048e5:a),n?s:m(s)},from:function(t,e){return De.duration({to:this,from:t}).locale(this.locale()).humanize(!e)},fromNow:function(t){return this.from(De(),t)},calendar:function(t){var e=t||De(),n=I(e,this).startOf("day"),a=this.diff(n,"days",!0),s=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.localeData().calendar(s,this))},isLeapYear:function(){return U(this.year())},isDST:function(){return this.zone()+t):+this.clone().startOf(e)>+De(t).startOf(e)},isBefore:function(t,e){return e=w("undefined"!=typeof e?e:"millisecond"),"millisecond"===e?(t=De.isMoment(t)?t:De(t),+t>+this):+this.clone().startOf(e)<+De(t).startOf(e)},isSame:function(t,e){return e=w(e||"millisecond"),"millisecond"===e?(t=De.isMoment(t)?t:De(t),+this===+t):+this.clone().startOf(e)===+I(t,this).startOf(e)},min:i("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(t){return t=De.apply(null,arguments),this>t?this:t}),max:i("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(t){return t=De.apply(null,arguments),t>this?this:t}),zone:function(t,e){var n,a=this._offset||0;return null==t?this._isUTC?a:this._dateTzOffset():("string"==typeof t&&(t=Z(t)),Math.abs(t)<16&&(t=60*t),!this._isUTC&&e&&(n=this._dateTzOffset()),this._offset=t,this._isUTC=!0,null!=n&&this.subtract(n,"m"),a!==t&&(!e||this._changeInProgress?g(this,De.duration(a-t,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,De.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this -},hasAlignedHourOffset:function(t){return t=t?De(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return T(this.year(),this.month())},dayOfYear:function(t){var e=Me((De(this).startOf("day")-De(this).startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},quarter:function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},weekYear:function(t){var e=oe(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==t?e:this.add(t-e,"y")},isoWeekYear:function(t){var e=oe(this,1,4).year;return null==t?e:this.add(t-e,"y")},week:function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},isoWeek:function(t){var e=oe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},weekday:function(t){var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},isoWeeksInYear:function(){return O(this.year(),1,4)},weeksInYear:function(){var t=this.localeData()._week;return O(this.year(),t.dow,t.doy)},get:function(t){return t=w(t),this[t]()},set:function(t,e){return t=w(t),"function"==typeof this[t]&&this[t](e),this},locale:function(e){var n;return e===t?this._locale._abbr:(n=De.localeData(e),null!=n&&(this._locale=n),this)},lang:i("moment().lang() is deprecated. Use moment().localeData() instead.",function(e){return e===t?this.localeData():this.locale(e)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),De.fn.millisecond=De.fn.milliseconds=me("Milliseconds",!1),De.fn.second=De.fn.seconds=me("Seconds",!1),De.fn.minute=De.fn.minutes=me("Minutes",!1),De.fn.hour=De.fn.hours=me("Hours",!0),De.fn.date=me("Date",!0),De.fn.dates=i("dates accessor is deprecated. Use date instead.",me("Date",!0)),De.fn.year=me("FullYear",!0),De.fn.years=i("years accessor is deprecated. Use year instead.",me("FullYear",!0)),De.fn.days=De.fn.day,De.fn.months=De.fn.month,De.fn.weeks=De.fn.week,De.fn.isoWeeks=De.fn.isoWeek,De.fn.quarters=De.fn.quarter,De.fn.toJSON=De.fn.toISOString,h(De.duration.fn=l.prototype,{_bubble:function(){var t,e,n,a=this._milliseconds,s=this._days,i=this._months,r=this._data,o=0;r.milliseconds=a%1e3,t=m(a/1e3),r.seconds=t%60,e=m(t/60),r.minutes=e%60,n=m(e/60),r.hours=n%24,s+=m(n/24),o=m(_e(s)),s-=m(pe(o)),i+=m(s/30),s%=30,o+=m(i/12),i%=12,r.days=s,r.months=i,r.years=o},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return m(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},humanize:function(t){var e=re(this,!t,this.localeData());return t&&(e=this.localeData().pastFuture(+this,e)),this.localeData().postformat(e)},add:function(t,e){var n=De.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=De.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=w(t),this[t.toLowerCase()+"s"]()},as:function(t){var e,n;if(t=w(t),"month"===t||"year"===t)return e=this._days+this._milliseconds/864e5,n=this._months+12*_e(e),"month"===t?n:n/12;switch(e=this._days+pe(this._months/12),t){case"week":return e/7+this._milliseconds/6048e5;case"day":return e+this._milliseconds/864e5;case"hour":return 24*e+this._milliseconds/36e5;case"minute":return 24*e*60+this._milliseconds/6e4;case"second":return 24*e*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*e*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+t)}},lang:De.fn.lang,locale:De.fn.locale,toIsoString:i("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var t=Math.abs(this.years()),e=Math.abs(this.months()),n=Math.abs(this.days()),a=Math.abs(this.hours()),s=Math.abs(this.minutes()),i=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(t?t+"Y":"")+(e?e+"M":"")+(n?n+"D":"")+(a||s||i?"T":"")+(a?a+"H":"")+(s?s+"M":"")+(i?i+"S":""):"P0D"},localeData:function(){return this._locale}}),De.duration.fn.toString=De.duration.fn.toISOString;for(ge in rn)n(rn,ge)&&ye(ge.toLowerCase());return De.duration.fn.asMilliseconds=function(){return this.as("ms")},De.duration.fn.asSeconds=function(){return this.as("s")},De.duration.fn.asMinutes=function(){return this.as("m")},De.duration.fn.asHours=function(){return this.as("h")},De.duration.fn.asDays=function(){return this.as("d")},De.duration.fn.asWeeks=function(){return this.as("weeks")},De.duration.fn.asMonths=function(){return this.as("M")},De.duration.fn.asYears=function(){return this.as("y")},De.locale("en",{ordinal:function(t){var e=t%10,n=1===S(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),De}.call(this),t.Utils.moment=n,t.datepicker}); \ No newline at end of file diff --git a/js/components/form-password.js b/js/components/form-password.js deleted file mode 100755 index b0b0e60..0000000 --- a/js/components/form-password.js +++ /dev/null @@ -1,67 +0,0 @@ -/*! UIkit 2.26.4 | 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(); - - 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.html($this.options[type=="text" ? "lblShow":"lblHide"]); - } - }); - - this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input"); - this.element.html(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]); - - - this.element.data("formPassword", this); - } - }); - - return UI.formPassword; -}); diff --git a/js/components/form-password.min.js b/js/components/form-password.min.js deleted file mode 100755 index b358994..0000000 --- a/js/components/form-password.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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);e.data("formPassword")||(i.preventDefault(),t.formPassword(e,t.Utils.options(e.attr("data-uk-form-password"))),e.trigger("click"))})},init:function(){var t=this;this.on("click",function(i){if(i.preventDefault(),t.input.length){var e=t.input.attr("type");t.input.attr("type","text"==e?"password":"text"),t.element.html(t.options["text"==e?"lblShow":"lblHide"])}}),this.input=this.element.next("input").length?this.element.next("input"):this.element.prev("input"),this.element.html(this.options[this.input.is("[type='password']")?"lblShow":"lblHide"]),this.element.data("formPassword",this)}}),t.formPassword}); \ No newline at end of file diff --git a/js/components/form-select.js b/js/components/form-select.js deleted file mode 100755 index 8f081fb..0000000 --- a/js/components/form-select.js +++ /dev/null @@ -1,77 +0,0 @@ -/*! UIkit 2.26.4 | 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")) { - 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 { - if($this.options.target === 'input') - { - $this.target.val(select.options[select.selectedIndex].text); - } - else - { - $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/js/components/form-select.min.js b/js/components/form-select.min.js deleted file mode 100755 index ee92f53..0000000 --- a/js/components/form-select.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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);e.data("formSelect")||t.formSelect(e,t.Utils.options(e.attr("data-uk-form-select")))})})},init:function(){var t=this;this.target=this.find(this.options.target),this.select=this.find("select"),this.select.on("change",function(){var e=t.select[0],i=function(){try{"input"===t.options.target?t.target.val(e.options[e.selectedIndex].text):t.target.text(e.options[e.selectedIndex].text)}catch(n){}return t.element[t.select.val()?"addClass":"removeClass"](t.options.activeClass),i};return i()}()),this.element.data("formSelect",this)}}),t.formSelect}); \ No newline at end of file diff --git a/js/components/grid-parallax.js b/js/components/grid-parallax.js deleted file mode 100755 index 45b7a9e..0000000 --- a/js/components/grid-parallax.js +++ /dev/null @@ -1,168 +0,0 @@ -/*! UIkit 2.26.4 | 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-parallax", ["uikit"], function(){ - return component || addon(UIkit); - }); - } - -})(function(UI){ - - var parallaxes = [], checkParallaxes = function() { - - requestAnimationFrame(function(){ - for (var i=0; i < parallaxes.length; i++) { - parallaxes[i].process(); - } - }); - }; - - - UI.component('gridparallax', { - - defaults: { - target : false, - smooth : 150, - translate : 150 - }, - - boot: function() { - - // listen to scroll and resize - UI.$doc.on("scrolling.uk.document", checkParallaxes); - UI.$win.on("load resize orientationchange", UI.Utils.debounce(function(){ - checkParallaxes(); - }, 50)); - - // init code - UI.ready(function(context) { - - UI.$('[data-uk-grid-parallax]', context).each(function() { - - var parallax = UI.$(this); - - if (!parallax.data("gridparallax")) { - UI.gridparallax(parallax, UI.Utils.options(parallax.attr("data-uk-grid-parallax"))); - } - }); - }); - }, - - init: function() { - - var $this = this; - - this.initItems().process(); - parallaxes.push(this); - - UI.$win.on('load resize orientationchange', (function() { - - var fn = function() { - var columns = getcolumns($this.element); - - $this.element.css('margin-bottom', ''); - - if (columns > 1) { - $this.element.css('margin-bottom', $this.options.translate + parseInt($this.element.css('margin-bottom'))); - } - }; - - UI.$(function() { fn(); }); - - return UI.Utils.debounce(fn, 50); - })()); - }, - - initItems: function() { - - var smooth = this.options.smooth; - - this.items = (this.options.target ? this.element.find(this.options.target) : this.element.children()).each(function(){ - UI.$(this).css({ - transition: 'transform '+smooth+'ms linear', - transform: '' - }); - }); - - return this; - }, - - process: function() { - - var percent = percentageInViewport(this.element), - columns = getcolumns(this.element), - items = this.items, - mods = [(columns-1)]; - - if (columns == 1 || !percent) { - items.css('transform', ''); - return; - } - - while(mods.length < columns) { - if(!(mods[mods.length-1] - 2)) break; - mods.push(mods[mods.length-1] - 2); - } - - var translate = this.options.translate, percenttranslate = percent * translate; - - items.each(function(idx, ele, translate){ - translate = mods.indexOf((idx+1) % columns) != -1 ? percenttranslate : percenttranslate / 8; - UI.$(this).css('transform', 'translate3d(0,'+(translate)+'px, 0)'); - }); - } - - }); - - - function getcolumns(element) { - - var children = element.children(), - first = children.filter(':visible:first'), - top = first[0].offsetTop + first.outerHeight(); - - for (var column=0;column= top) break; - } - - return column || 1; - } - - function percentageInViewport(element) { - - var top = element.offset().top, - height = element.outerHeight(), - scrolltop = UIkit.$win.scrollTop(), - wh = window.innerHeight, - 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; - } - - if (top < wh) { - percent = percent * scrolltop / ((top + height) - wh); - } - } - - return percent > 1 ? 1:percent; - } -}); \ No newline at end of file diff --git a/js/components/grid-parallax.min.js b/js/components/grid-parallax.min.js deleted file mode 100755 index fddc517..0000000 --- a/js/components/grid-parallax.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ -!function(t){var n;window.UIkit&&(n=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-grid-parallax",["uikit"],function(){return n||t(UIkit)})}(function(t){function n(t){for(var n=t.children(),i=n.filter(":visible:first"),e=i[0].offsetTop+i.outerHeight(),o=0;o=e);o++);return o||1}function i(t){var n,i,e,o=t.offset().top,r=t.outerHeight(),s=UIkit.$win.scrollTop(),a=window.innerHeight;return o>s+a?e=0:s>o+r?e=1:(a>o+r?e=(a>s?s:s-a)/(o+r):(n=s+a-o,i=Math.round(n/((a+r)/100)),e=i/100),a>o&&(e=e*s/(o+r-a))),e>1?1:e}var e=[],o=function(){requestAnimationFrame(function(){for(var t=0;t1&&i.element.css("margin-bottom",i.options.translate+parseInt(i.element.css("margin-bottom")))};return t.$(function(){e()}),t.Utils.debounce(e,50)}())},initItems:function(){var n=this.options.smooth;return this.items=(this.options.target?this.element.find(this.options.target):this.element.children()).each(function(){t.$(this).css({transition:"transform "+n+"ms linear",transform:""})}),this},process:function(){var e=i(this.element),o=n(this.element),r=this.items,s=[o-1];if(1==o||!e)return r.css("transform",""),void 0;for(;s.length -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 - */ - function _getSize() { - - 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/js/components/grid.min.js b/js/components/grid.min.js deleted file mode 100755 index 3eeedfe..0000000 --- a/js/components/grid.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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(){function t(t){if(t){if("string"==typeof u[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var i,e=0,n=h.length;n>e;e++)if(i=h[e]+t,"string"==typeof u[i])return i}}function i(t){var i=parseFloat(t),e=-1===t.indexOf("%")&&!isNaN(i);return e&&i}function e(){}function n(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},i=0,e=f.length;e>i;i++){var n=f[i];t[n]=0}return t}function r(){if(!c){c=!0;var e=window.getComputedStyle;if(a=function(){var t=e?function(t){return e(t,null)}:function(t){return t.currentStyle};return function(i){var e=t(i);return e||l("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),e}}(),s=t("boxSizing")){var n=document.createElement("div");n.style.width="200px",n.style.padding="1px 2px 3px 4px",n.style.borderStyle="solid",n.style.borderWidth="1px 2px 3px 4px",n.style[s]="border-box";var r=document.body||document.documentElement;r.appendChild(n);var o=a(n);d=200===i(o.width),r.removeChild(n)}}}function o(t){if(r(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=a(t);if("none"===e.display)return n();var o={};o.width=t.offsetWidth,o.height=t.offsetHeight;for(var h=o.isBorderBox=!(!s||!e[s]||"border-box"!==e[s]),u=0,l=f.length;l>u;u++){var c=f[u],p=e[c],g=parseFloat(p);o[c]=isNaN(g)?0:g}var m=o.paddingLeft+o.paddingRight,v=o.paddingTop+o.paddingBottom,b=o.marginLeft+o.marginRight,y=o.marginTop+o.marginBottom,k=o.borderLeftWidth+o.borderRightWidth,w=o.borderTopWidth+o.borderBottomWidth,x=h&&d,W=i(e.width);W!==!1&&(o.width=W+(x?0:m+k));var L=i(e.height);return L!==!1&&(o.height=L+(x?0:v+w)),o.innerWidth=o.width-(m+k),o.innerHeight=o.height-(v+w),o.outerWidth=o.width+b,o.outerHeight=o.height+y,o}}var a,s,d,h="Webkit Moz ms Ms O".split(" "),u=document.documentElement.style,l="undefined"==typeof console?e:function(t){console.error(t)},f=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],c=!1;return o}function e(t){return i()(t)}t.component("grid",{defaults:{colwidth:"auto",animation:!0,duration:300,gutter:0,controls:!1,filter:!1},boot:function(){t.ready(function(i){t.$("[data-uk-grid]",i).each(function(){var i=t.$(this);i.data("grid")||t.grid(i,t.Utils.options(i.attr("data-uk-grid")))})})},init:function(){var i=this,e=String(this.options.gutter).trim().split(" ");this.gutterv=parseInt(e[0],10),this.gutterh=parseInt(e[1]||e[0],10),this.element.css({position:"relative"}),this.controls=null,this.options.controls&&(this.controls=t.$(this.options.controls),this.controls.on("click","[data-uk-filter]",function(e){e.preventDefault(),i.filter(t.$(this).attr("data-uk-filter"))}),this.controls.on("click","[data-uk-sort]",function(e){e.preventDefault();var n=t.$(this).attr("data-uk-sort").split(":");i.sort(n[0],n[1])})),t.$win.on("load resize orientationchange",t.Utils.debounce(function(){i.currentfilter?i.filter(i.currentfilter):this.updateLayout()}.bind(this),100)),this.on("display.uk.check",function(){i.element.is(":visible")&&i.updateLayout()}),t.domObserve(this.element,function(){i.updateLayout()}),this.options.filter!==!1?this.filter(this.options.filter):this.updateLayout()},_prepareElements:function(){var t,i=this.element.children(":not([data-grid-prepared])");i.length&&(t={position:"absolute","box-sizing":"border-box",width:"auto"==this.options.colwidth?"":this.options.colwidth},this.options.gutter&&(t["padding-left"]=this.gutterh,t["padding-bottom"]=this.gutterv,this.element.css("margin-left",-1*this.gutterh)),i.attr("data-grid-prepared","true").css(t))},updateLayout:function(i){this._prepareElements(),i=i||this.element.children(":visible");var n,r,o,a,s,d,h,u,l=i,f=this.element.width()+2*this.gutterh+2,c=0,p=0,g=[];this.trigger("beforeupdate.uk.grid",[l]),l.each(function(){for(u=e(this),n=t.$(this),r=u.outerWidth,o=u.outerHeight,c=0,p=0,s=0,h=g.length;h>s;s++)a=g[s],c<=a.aX&&(c=a.aX),c+r>f&&(c=0),p<=a.aY&&(p=a.aY);g.push({ele:n,top:p,left:c,width:r,height:o,aY:p+o,aX:c+r})});var m,v=0;for(s=0,h=g.length;h>s;s++){for(a=g[s],p=0,d=0;s>d;d++)m=g[d],a.left-1&&(o=!0)})),r[o?"visible":"hidden"].push(e)}),r.hidden=t.$(r.hidden).map(function(){return this[0]}),r.visible=t.$(r.visible).map(function(){return this[0]}),r.hidden.attr("aria-hidden","true").filter(":visible").fadeOut(this.options.duration),r.visible.attr("aria-hidden","false").filter(":hidden").css("opacity",0).show(),e.updateLayout(r.visible),this.controls&&this.controls.length&&this.controls.find("[data-uk-filter]").removeClass("uk-active").filter('[data-uk-filter="'+i+'"]').addClass("uk-active")},sort:function(i,e){e=e||1,"string"==typeof e&&(e="desc"==e.toLowerCase()?-1:1);var n=this.element.children();n.sort(function(n,r){return n=t.$(n),r=t.$(r),(r.data(i)||"")<(n.data(i)||"")?e:-1*e}).appendTo(this.element),this.updateLayout(n.filter(":visible")),this.controls&&this.controls.length&&this.controls.find("[data-uk-sort]").removeClass("uk-active").filter('[data-uk-sort="'+i+":"+(-1==e?"desc":"asc")+'"]').addClass("uk-active")}})}); \ No newline at end of file diff --git a/js/components/htmleditor.js b/js/components/htmleditor.js deleted file mode 100755 index 68b5b52..0000000 --- a/js/components/htmleditor.js +++ /dev/null @@ -1,679 +0,0 @@ -/*! UIkit 2.26.4 | 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, - enablescripts: false, - 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); - - if (!editor.data('htmleditor')) { - 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.$(''); - 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(''); - } - - } 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, - previewPosition = codeScroll.scrollTop() * ratio; - - // apply new scroll - previewContainer.scrollTop(previewPosition); - - }, 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.debouncedRedraw(); - }); - - 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, index = 0; - - 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 = typeof(callback) === 'string' ? callback : callback(match, index); - - if (!result && result !== '') { - return arguments[0]; - } - - index++; - - 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('
  • '+$this.buttons[button].label+'
  • '); - }); - - 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(); - - if (!this.options.enablescripts) { - this.currentvalue = this.currentvalue.replace(/<(script|style)\b[^<]*(?:(?!<\/(script|style)>)<[^<]*)*<\/(script|style)>/img, ''); - } - - // 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 = [ - '
    ', - '
    ', - '
      ', - '
      ', - '', - '
      ', - '
      ', - '
      ', - '
      ', - '
      ', - '
      ', - '
      ' - ].join(''); - - - UI.plugin('htmleditor', 'base', { - - init: function(editor) { - - editor.addButtons({ - - fullscreen: { - title : 'Fullscreen', - label : '' - }, - bold : { - title : 'Bold', - label : '' - }, - italic : { - title : 'Italic', - label : '' - }, - strike : { - title : 'Strikethrough', - label : '' - }, - blockquote : { - title : 'Blockquote', - label : '' - }, - link : { - title : 'Link', - label : '' - }, - image : { - title : 'Image', - label : '' - }, - listUl : { - title : 'Unordered List', - label : '' - }, - listOl : { - title : 'Ordered List', - label : '' - } - - }); - - addAction('bold', '$1'); - addAction('italic', '$1'); - addAction('strike', '$1'); - addAction('blockquote', '

      $1

      ', 'replaceLine'); - addAction('link', '$1'); - addAction('image', '$1'); - - var listfn = function(tag) { - if (editor.getCursorMode() == 'html') { - - tag = tag || 'ul'; - - var cm = editor.editor, - doc = cm.getDoc(), - pos = doc.getCursor(true), - posend = doc.getCursor(false), - im = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(cm.getCursor()).state), - inList = im && im.state && im.state.context && ['ul','ol'].indexOf(im.state.context.tagName) != -1; - - 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 }); - } - - if (!inList) { - cm.replaceRange('<'+tag+'>'+"\n"+cm.getLine(pos.line), { line: pos.line, ch: 0 }, { line: pos.line, ch: cm.getLine(pos.line).length }); - cm.replaceRange(cm.getLine((posend.line+1))+"\n"+'', { line: (posend.line+1), ch: 0 }, { line: (posend.line+1), ch: cm.getLine((posend.line+1)).length }); - cm.setCursor({ line: posend.line+1, ch: cm.getLine(posend.line+1).length }); - } else { - cm.setCursor({ line: posend.line, ch: cm.getLine(posend.line).length }); - } - - cm.focus(); - } - }; - - editor.on('action.listUl', function() { - listfn('ul'); - }); - - editor.on('action.listOl', function() { - listfn('ol'); - }); - - 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')) { - - var fixedParent = false, parents = editor.htmleditor.parents().each(function(){ - if (UI.$(this).css('position')=='fixed' && !UI.$(this).is('html')) { - fixedParent = UI.$(this); - } - }); - - editor.htmleditor.data('fixedParents', false); - - if (fixedParent) { - - var transformed = []; - - fixedParent = fixedParent.parent().find(parents).each(function(){ - - if (UI.$(this).css('transform') != 'none') { - transformed.push(UI.$(this).data('transform-reset', { - 'transform': this.style.transform, - '-webkit-transform': this.style.webkitTransform, - '-webkit-transition':this.style.webkitTransition, - 'transition':this.style.transition - }).css({ - 'transform': 'none', - '-webkit-transform': 'none', - '-webkit-transition':'none', - 'transition':'none' - })); - } - }); - - editor.htmleditor.data('fixedParents', transformed); - } - - 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); - - if (editor.htmleditor.data('fixedParents')) { - editor.htmleditor.data('fixedParents').forEach(function(parent){ - parent.css(parent.data('transform-reset')); - }); - } - } - - 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 || window.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/js/components/htmleditor.min.js b/js/components/htmleditor.min.js deleted file mode 100755 index a62f47e..0000000 --- a/js/components/htmleditor.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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,enablescripts:!1,height:500,maxsplitsize:1e3,codemirror:{mode:"htmlmixed",lineWrapping:!0,dragDrop:!1,autoCloseTags:!0,matchTags:!0,autoCloseBrackets:!0,matchBrackets:!0,indentUnit:4,indentWithTabs:!1,tabSize:4,hintOptions:{completionSingle:!1}},toolbar:["bold","italic","strike","link","image","blockquote","listUl","listOl"],lblPreview:"Preview",lblCodeview:"HTML",lblMarkedview:"Markdown"},boot:function(){t.ready(function(e){t.$("textarea[data-uk-htmleditor]",e).each(function(){var e=t.$(this);e.data("htmleditor")||t.htmleditor(e,t.Utils.options(e.attr("data-uk-htmleditor")))})})},init:function(){var i=this,o=t.components.htmleditor.template;this.CodeMirror=this.options.CodeMirror||CodeMirror,this.buttons={},o=o.replace(/\{:lblPreview}/g,this.options.lblPreview),o=o.replace(/\{:lblCodeview}/g,this.options.lblCodeview),this.htmleditor=t.$(o),this.content=this.htmleditor.find(".uk-htmleditor-content"),this.toolbar=this.htmleditor.find(".uk-htmleditor-toolbar"),this.preview=this.htmleditor.find(".uk-htmleditor-preview").children().eq(0),this.code=this.htmleditor.find(".uk-htmleditor-code"),this.element.before(this.htmleditor).appendTo(this.code),this.editor=this.CodeMirror.fromTextArea(this.element[0],this.options.codemirror),this.editor.htmleditor=this,this.editor.on("change",t.Utils.debounce(function(){i.render()},150)),this.editor.on("change",function(){i.editor.save(),i.element.trigger("input")}),this.code.find(".CodeMirror").css("height",this.options.height),this.options.iframe?(this.iframe=t.$(''),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('')):this.preview.container=this.preview,t.$win.on("resize load",t.Utils.debounce(function(){i.fit()},200));var n=this.iframe?this.preview.container:i.preview.parent(),r=this.code.find(".CodeMirror-sizer"),l=this.code.find(".CodeMirror-scroll").on("scroll",t.Utils.debounce(function(){if("tab"!=i.htmleditor.attr("data-mode")){var t=r.height()-l.height(),e=n[0].scrollHeight-(i.iframe?i.iframe.height():n.height()),o=e/t,s=l.scrollTop()*o;n.scrollTop(s)}},10));this.htmleditor.on("click",".uk-htmleditor-button-code, .uk-htmleditor-button-preview",function(e){e.preventDefault(),"tab"==i.htmleditor.attr("data-mode")&&(i.htmleditor.find(".uk-htmleditor-button-code, .uk-htmleditor-button-preview").removeClass("uk-active").filter(this).addClass("uk-active"),i.activetab=t.$(this).hasClass("uk-htmleditor-button-code")?"code":"preview",i.htmleditor.attr("data-active-tab",i.activetab),i.editor.refresh())}),this.htmleditor.on("click","a[data-htmleditor-button]",function(){i.code.is(":visible")&&i.trigger("action."+t.$(this).data("htmleditor-button"),[i.editor])}),this.preview.parent().css("height",this.code.height()),this.options.autocomplete&&this.CodeMirror.showHint&&this.CodeMirror.hint&&this.CodeMirror.hint.html&&this.editor.on("inputRead",t.Utils.debounce(function(){var t=i.editor.getDoc(),e=t.getCursor(),o=i.CodeMirror.innerMode(i.editor.getMode(),i.editor.getTokenAt(e).state).mode.name;if("xml"==o){var n=i.editor.getCursor(),r=i.editor.getTokenAt(n);("<"==r.string.charAt(0)||"attribute"==r.type)&&i.CodeMirror.showHint(i.editor,i.CodeMirror.hint.html,{completeSingle:!1})}},100)),this.debouncedRedraw=t.Utils.debounce(function(){i.redraw()},5),this.on("init.uk.component",function(){i.debouncedRedraw()}),this.element.attr("data-uk-check-display",1).on("display.uk.check",function(){this.htmleditor.is(":visible")&&this.fit()}.bind(this)),e.push(this)},addButton:function(t,e){this.buttons[t]=e},addButtons:function(e){t.$.extend(this.buttons,e)},replaceInPreview:function(t,e){function i(t){var e=o.getValue().substring(0,t).split("\n");return{line:e.length-1,ch:e[e.length-1].length}}var o=this.editor,n=[],r=o.getValue(),l=-1,s=0;return this.currentvalue=this.currentvalue.replace(t,function(){l=r.indexOf(arguments[0],++l);var t={matches:arguments,from:i(l),to:i(l+arguments[0].length),replace:function(e){o.replaceRange(e,t.from,t.to)},inRange:function(e){return e.line===t.from.line&&e.line===t.to.line?e.ch>=t.from.ch&&e.ch=t.from.ch||e.line>t.from.line&&e.line'+t.buttons[i].label+"")}}),this.toolbar.html(e.join("\n"))}},fit:function(){var t=this.options.mode;"split"==t&&this.htmleditor.width())<[^<]*)*<\/(script|style)>/gim,"")),this.currentvalue?(this.trigger("render",[this]),this.trigger("renderLate",[this]),this.preview.container.html(this.currentvalue),void 0):(this.element.val(""),this.preview.container.html(""),void 0)},addShortcut:function(e,i){var o={};return t.$.isArray(e)||(e=[e]),e.forEach(function(t){o[t]=i}),this.editor.addKeyMap(o),o},addShortcutAction:function(t,e){var i=this;this.addShortcut(e,function(){i.element.trigger("action."+t,[i.editor])})},replaceSelection:function(t){var e=this.editor.getSelection();if(!e.length){for(var i=this.editor.getCursor(),o=this.editor.getLine(i.line),n=i.ch,r=n;r','
      ','
        ','
        ','","
        ","
        ",'
        ','
        ','
        ',"
        ",""].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:''},bold:{title:"Bold",label:''},italic:{title:"Italic",label:''},strike:{title:"Strikethrough",label:''},blockquote:{title:"Blockquote",label:''},link:{title:"Link",label:''},image:{title:"Image",label:''},listUl:{title:"Unordered List",label:''},listOl:{title:"Ordered List",label:''}}),i("bold","$1"),i("italic","$1"),i("strike","$1"),i("blockquote","

        $1

        ","replaceLine"),i("link",'$1'),i("image",'$1');var o=function(t){if("html"==e.getCursorMode()){t=t||"ul";for(var i=e.editor,o=i.getDoc(),n=o.getCursor(!0),r=o.getCursor(!1),l=CodeMirror.innerMode(i.getMode(),i.getTokenAt(i.getCursor()).state),s=l&&l.state&&l.state.context&&-1!=["ul","ol"].indexOf(l.state.context.tagName),a=n.line;a"+i.getLine(a)+"",{line:a,ch:0},{line:a,ch:i.getLine(a).length});s?i.setCursor({line:r.line,ch:i.getLine(r.line).length}):(i.replaceRange("<"+t+">\n"+i.getLine(n.line),{line:n.line,ch:0},{line:n.line,ch:i.getLine(n.line).length}),i.replaceRange(i.getLine(r.line+1)+"\n",{line:r.line+1,ch:0},{line:r.line+1,ch:i.getLine(r.line+1).length}),i.setCursor({line:r.line+1,ch:i.getLine(r.line+1).length})),i.focus()}};e.on("action.listUl",function(){o("ul")}),e.on("action.listOl",function(){o("ol")}),e.htmleditor.on("click",'a[data-htmleditor-button="fullscreen"]',function(){e.htmleditor.toggleClass("uk-htmleditor-fullscreen");var i=e.editor.getWrapperElement();if(e.htmleditor.hasClass("uk-htmleditor-fullscreen")){var o=!1,n=e.htmleditor.parents().each(function(){"fixed"!=t.$(this).css("position")||t.$(this).is("html")||(o=t.$(this))});if(e.htmleditor.data("fixedParents",!1),o){var r=[];o=o.parent().find(n).each(function(){"none"!=t.$(this).css("transform")&&r.push(t.$(this).data("transform-reset",{transform:this.style.transform,"-webkit-transform":this.style.webkitTransform,"-webkit-transition":this.style.webkitTransition,transition:this.style.transition}).css({transform:"none","-webkit-transform":"none","-webkit-transition":"none",transition:"none"}))}),e.htmleditor.data("fixedParents",r)}e.editor.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:i.style.width,height:i.style.height},i.style.width="",i.style.height=e.content.height()+"px",document.documentElement.style.overflow="hidden"}else{document.documentElement.style.overflow="";var l=e.editor.state.fullScreenRestore;i.style.width=l.width,i.style.height=l.height,window.scrollTo(l.scrollLeft,l.scrollTop),e.htmleditor.data("fixedParents")&&e.htmleditor.data("fixedParents").forEach(function(t){t.css(t.data("transform-reset"))})}setTimeout(function(){e.fit(),t.$win.trigger("resize")},50)}),e.addShortcut(["Ctrl-S","Cmd-S"],function(){e.element.trigger("htmleditor-save",[e])}),e.addShortcutAction("bold",["Ctrl-B","Cmd-B"])}}),t.plugin("htmleditor","markdown",{init:function(e){function i(){e.editor.setOption("mode","gfm"),e.htmleditor.find(".uk-htmleditor-button-code a").html(e.options.lblMarkedview)}function o(t,i,o){e.on("action."+t,function(){"markdown"==e.getCursorMode()&&e["replaceLine"==o?"replaceLine":"replaceSelection"](i)})}var n=e.options.mdparser||window.marked||null;n&&(e.options.markdown&&i(),o("bold","**$1**"),o("italic","*$1*"),o("strike","~~$1~~"),o("blockquote","> $1","replaceLine"),o("link","[$1](http://)"),o("image","![$1](http://)"),e.on("action.listUl",function(){if("markdown"==e.getCursorMode()){for(var t=e.editor,i=t.getDoc().getCursor(!0),o=t.getDoc().getCursor(!1),n=i.line;n0){var r,l=t.getLine(i.line-1);(r=l.match(/^(\d+)\./))&&(n=Number(r[1])+1)}for(var s=i.line;s 1) { - - content = [ - content, - '', - '' - ].join(''); - } - - // calculate width - var tmp = UI.$('
         
        ').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('
        '+data.title+'
        '); - 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" : '', - "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': '', - '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(), lowres = false; - - img.onerror = function(){ - cache[id] = {width:640, height:320}; - resolve(id, cache[id].width, cache[id].height); - }; - - img.onload = function(){ - //youtube default 404 thumb, fall back to lowres - if (img.width == 120 && img.height == 90) { - if (!lowres) { - lowres = true; - img.src = '//img.youtube.com/vi/' + id + '/0.jpg'; - } else { - cache[id] = {width: 640, height: 320}; - resolve(id, cache[id].width, cache[id].height); - } - } else { - cache[id] = {width: img.width, height: img.height}; - resolve(id, img.width, img.height); - } - }; - - img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.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': '', - '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': '', - '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.$('').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); - } - } - }); - } - }); - - - UIkit.plugin("lightbox", "iframe", { - - init: function (lightbox) { - - lightbox.on("showitem.uk.lightbox", function (e, data) { - - var resolve = function (source, width, height) { - - data.meta = { - 'content': '', - 'width': width, - 'height': height - }; - - data.type = 'iframe'; - - data.promise.resolve(); - }; - - if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) { - resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600)); - } - }); - - } - }); - - function getModal(lightbox) { - - if (modal) { - modal.lightbox = lightbox; - return modal; - } - - // init lightbox container - modal = UI.$([ - '
        ', - '
        ', - '', - '
        ', - '
        ', - '
        ', - '
        ' - ].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(''); - }); - - var resizeCache = {w: window.innerWidth, h:window.innerHeight}; - - UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){ - - if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) { - modal.lightbox.fitSize(); - } - - resizeCache = {w: window.innerWidth, h:window.innerHeight}; - - }, 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/js/components/lightbox.min.js b/js/components/lightbox.min.js deleted file mode 100755 index 5075244..0000000 --- a/js/components/lightbox.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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){if(e)return e.lightbox=t,e;e=i.$(['
        ','
        ','','
        ','
        ',"
        ","
        "].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(",")):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='
        Loading resource failed!
        ',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'',''].join(""));var d,r,u=i.$("
         
        ").css({opacity:0,position:"absolute",top:0,left:0,width:"100%","max-width":t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('
        '+e.title+"
        "),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),dr&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"http://vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'',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.$('').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox}); \ No newline at end of file diff --git a/js/components/nestable.js b/js/components/nestable.js deleted file mode 100755 index 573345d..0000000 --- a/js/components/nestable.js +++ /dev/null @@ -1,653 +0,0 @@ -/*! UIkit 2.26.4 | 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; - - 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', - noChildrenClass : 'uk-nestable-nochildren', - emptyClass : 'uk-nestable-empty', - 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), - link = handle.is('a[href]') ? handle:handle.parents('a[href]'); - - 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) { - - link = false; - - 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; - - if (link.length && eEnd == 'touchend') { - - $this.one(eEnd, function(){ - if (link && link.attr('href').trim()) { - location.href = link.attr('href'); - } - }); - } - - 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, attr, val; i < li[0].attributes.length; i++) { - attribute = li[0].attributes[i]; - if (attribute.name.indexOf('data-') === 0) { - attr = attribute.name.substr(5); - val = UI.Utils.str2json(attribute.value); - item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val: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').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 = UI.$(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',[root.data('nestable'), el, 'added']); - this.element.trigger('change.uk.nestable', [this, el, 'removed']); - - } else { - this.element.trigger('change.uk.nestable',[this, el, "moved"]); - } - - 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, is not collapsed, and does not have a 'no children' class - if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) { - - // 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.$('
          ').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 cannot decrease the level if an item precedes the current one - next = this.placeEl.next(opt._listItemClass); - if (!next.length) { - - // get parent ul of the list item - var parentUl = this.placeEl.closest([opt._listBaseClass, opt._listClass].join(',')); - // try to get the li surrounding the ul - var surroundingLi = parentUl.closest(opt._listItemClass); - - // if the ul is inside of a li (meaning it is nested) - if (surroundingLi.length) { - // we can decrease the horizontal level - surroundingLi.after(this.placeEl); - // if the previous parent ul is now empty - if (!parentUl.children().length) { - this.unsetParent(surroundingLi); - } - } - } - } - } - - var isEmpty = false; - - // find list item under cursor - var pointX = e.pageX - (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] != tmpRoot[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 (this.options.emptyClass) { - list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass); - } - } - - }); - - return UI.nestable; -}); diff --git a/js/components/nestable.min.js b/js/components/nestable.min.js deleted file mode 100755 index e0d4da2..0000000 --- a/js/components/nestable.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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",noChildrenClass:"uk-nestable-nochildren",emptyClass:"uk-nestable-empty",handleClass:"",collapsedClass:"uk-collapsed",placeholderClass:"uk-nestable-placeholder",noDragClass:"uk-nestable-nodrag",group:!1,maxDepth:10,threshold:20,idlethreshold:10},boot:function(){t.$html.on("mousemove touchmove",function(){if(s){var e=s.offset().top;ewindow.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(s.height()/2))}}),t.ready(function(s){t.$("[data-uk-nestable]",s).each(function(){var s=t.$(this);s.data("nestable")||t.nestable(s,t.Utils.options(s.attr("data-uk-nestable")))})})},init:function(){var i=this;Object.keys(this.options).forEach(function(t){-1!=String(t).indexOf("Class")&&(i.options["_"+t]="."+i.options[t])}),this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass),this.checkEmptyList(),this.reset(),this.element.data("nestable-group",this.options.group||t.Utils.uid("nestable-group")),this.find(this.options._listItemClass).each(function(){i.setParent(t.$(this))}),this.on("click","[data-nestable-action]",function(s){if(!i.dragEl&&(e||0===s.button)){s.preventDefault();var l=t.$(s.currentTarget),a=l.data("nestableAction"),n=l.closest(i.options._listItemClass);"collapse"===a&&i.collapseItem(n),"expand"===a&&i.expandItem(n),"toggle"===a&&i.toggleItem(n)}});var l=function(s){var l=t.$(s.target),a=l.is("a[href]")?l:l.parents("a[href]");s.target!==i.element[0]&&(l.is(i.options._noDragClass)||l.closest(i.options._noDragClass).length||l.is("[data-nestable-action]")||l.closest("[data-nestable-action]").length||(i.options.handleClass&&!l.hasClass(i.options.handleClass)&&i.options.handleClass&&(l=l.closest(i.options._handleClass)),!l.length||i.dragEl||!e&&0!==s.button||e&&1!==s.touches.length||(s.originalEvent&&s.originalEvent.touches&&(s=evt.originalEvent.touches[0]),i.delayMove=function(t){a=!1,t.preventDefault(),i.dragStart(s),i.trigger("start.uk.nestable",[i]),i.delayMove=!1},i.delayMove.x=parseInt(s.pageX,10),i.delayMove.y=parseInt(s.pageY,10),i.delayMove.threshold=i.options.idlethreshold,a.length&&"touchend"==h&&i.one(h,function(){a&&a.attr("href").trim()&&(location.href=a.attr("href"))}),s.preventDefault())))},d=function(t){t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),i.delayMove&&(Math.abs(t.pageX-i.delayMove.x)>i.delayMove.threshold||Math.abs(t.pageY-i.delayMove.y)>i.delayMove.threshold)&&(window.getSelection().toString()?i.delayMove=!1:i.delayMove(t)),i.dragEl&&(t.preventDefault(),i.dragMove(t),i.trigger("move.uk.nestable",[i]))},p=function(t){i.dragEl&&(t.preventDefault(),i.dragStop(e?t.touches[0]:t)),s=!1,i.delayMove=!1};e?(this.element[0].addEventListener(n,l,!1),window.addEventListener(o,d,!1),window.addEventListener(h,p,!1),window.addEventListener(r,p,!1)):(this.on(n,l),a.on(o,d),a.on(h,p))},serialize:function(){var s,e=0,i=this,l=function(s,e){var a=[],n=s.children(i.options._listItemClass);return n.each(function(){for(var s,n,o,h=t.$(this),r={},d=h.children(i.options._listClass),p=0;p
        ").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;hthis.dragDepth&&(this.dragDepth=r);i.addClass(this.options.movingClass)},dragStop:function(){var s=t.$(this.placeEl),e=this.placeEl.parents(this.options._listBaseClass+":first");this.placeEl.removeClass(this.options.placeholderClass),this.dragEl.remove(),this.element[0]!==e[0]?(e.trigger("change.uk.nestable",[e.data("nestable"),s,"added"]),this.element.trigger("change.uk.nestable",[this,s,"removed"])):this.element.trigger("change.uk.nestable",[this,s,"moved"]),this.trigger("stop.uk.nestable",[this,s]),this.reset(),i.removeClass(this.options.movingClass)},dragMove:function(s){var e,i,a,n,o,h=this.options,r=this.mouse,d=this.dragRootEl?this.dragRootEl.data("nestable").options.maxDepth:h.maxDepth;this.dragEl.css({left:s.pageX-r.offsetX,top:s.pageY-r.offsetY}),r.lastX=r.nowX,r.lastY=r.nowY,r.nowX=s.pageX,r.nowY=s.pageY,r.distX=r.nowX-r.lastX,r.distY=r.nowY-r.lastY,r.lastDirX=r.dirX,r.lastDirY=r.dirY,r.dirX=0===r.distX?0:r.distX>0?1:-1,r.dirY=0===r.distY?0:r.distY>0?1:-1;var p=Math.abs(r.distX)>Math.abs(r.distY)?1:0;if(!r.moving)return r.dirAx=p,r.moving=!0,void 0;if(r.dirAx!==p?(r.distAxX=0,r.distAxY=0):(r.distAxX+=Math.abs(r.distX),0!==r.dirX&&r.dirX!==r.lastDirX&&(r.distAxX=0),r.distAxY+=Math.abs(r.distY),0!==r.dirY&&r.dirY!==r.lastDirY&&(r.distAxY=0)),r.dirAx=p,r.dirAx&&r.distAxX>=h.threshold&&(r.distAxX=0,a=this.placeEl.prev("li"),r.distX>0&&a.length&&!a.hasClass(h.collapsedClass)&&!a.hasClass(h.noChildrenClass)&&(e=a.find(h._listClass).last(),o=this.placeEl.parents(h._listClass+","+h._listBaseClass).length,o+this.dragDepth<=d&&(e.length?(e=a.children(h._listClass).last(),e.append(this.placeEl)):(e=t.$("
          ").addClass(h.listClass),e.append(this.placeEl),a.append(e),this.setParent(a)))),r.distX<0&&(n=this.placeEl.next(h._listItemClass),!n.length))){var c=this.placeEl.closest([h._listBaseClass,h._listClass].join(",")),g=c.closest(h._listItemClass);g.length&&(g.after(this.placeEl),c.children().length||this.unsetParent(g))}var u=!1,f=s.pageX-(window.pageXOffset||document.scrollLeft||0),m=s.pageY-(window.pageYOffset||document.documentElement.scrollTop);if(this.pointEl=t.$(document.elementFromPoint(f,m)),h.handleClass&&this.pointEl.hasClass(h.handleClass))this.pointEl=this.pointEl.closest(h._listItemClass);else{var C=this.pointEl.closest(h._listItemClass);C.length&&(this.pointEl=C)}if(!this.placeEl.find(this.pointEl).length){if(this.pointEl.data("nestable")&&!this.pointEl.children().length)u=!0,this.checkEmptyList(this.pointEl);else if(!this.pointEl.length||!this.pointEl.hasClass(h.listItemClass))return;var v=this.element,E=this.pointEl.closest(this.options._listBaseClass),b=v[0]!=E[0];if(!r.dirAx||b||u){if(b&&h.group!==E.data("nestable-group"))return;if(l.push(v),o=this.dragDepth-1+this.pointEl.parents(h._listClass+","+h._listBaseClass).length,o>d)return;var X=s.pageY', - '', - '
          ', - '' - - ].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.$('
          ').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/js/components/notify.min.js b/js/components/notify.min.js deleted file mode 100755 index 6c24ebb..0000000 --- a/js/components/notify.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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.$(['
          ','',"
          ","
          "].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.$('
          ').appendTo("body").on("click",".uk-notify-message",function(){var e=t.$(this).data("notifyMessage");e.element.trigger("manualclose.uk.notify",[e]),e.close()}))};return t.$.extend(n.prototype,{uuid:!1,element:!1,timout:!1,currentstatus:"",group:!1,show:function(){if(!this.element.is(":visible")){var t=this;e[this.options.pos].show().prepend(this.element);var i=parseInt(this.element.css("margin-bottom"),10);return this.element.css({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0}).animate({opacity:1,"margin-top":0,"margin-bottom":i},function(){if(t.options.timeout){var e=function(){t.close()};t.timeout=setTimeout(e,t.options.timeout),t.element.hover(function(){clearTimeout(t.timeout)},function(){t.timeout=setTimeout(e,t.options.timeout)})}}),this}},close:function(t){var s=this,o=function(){s.element.remove(),e[s.options.pos].children().length||e[s.options.pos].hide(),s.options.onClose.apply(s,[]),s.element.trigger("close.uk.notify",[s]),delete i[s.uuid]};this.timeout&&clearTimeout(this.timeout),t?o():this.element.animate({opacity:0,"margin-top":-1*this.element.outerHeight(),"margin-bottom":0},function(){o()})},content:function(t){var e=this.element.find(">div");return t?(e.html(t),this):e.html()},status:function(t){return t?(this.element.removeClass("uk-notify-message-"+this.currentstatus).addClass("uk-notify-message-"+t),this.currentstatus=t,this):this.currentstatus}}),n.defaults={message:"",status:"",timeout:5e3,group:null,pos:"top-center",onClose:function(){}},t.notify=s,t.notify.message=n,t.notify.closeAll=o,s}); \ No newline at end of file diff --git a/js/components/pagination.js b/js/components/pagination.js deleted file mode 100755 index f5a8478..0000000 --- a/js/components/pagination.js +++ /dev/null @@ -1,147 +0,0 @@ -/*! UIkit 2.26.4 | 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 : 7, - edges : 1, - currentPage : 0, - 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")) { - 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; - 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(this.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('
        • ...
        • '); - } 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('
        • ...
        • '); - } 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(this.currentPage + 1, {text: o.lblNext}); - }, - - _append: function(pageIndex, opts) { - - var item, options; - - pageIndex = pageIndex < 0 ? 0 : (pageIndex < this.pages ? pageIndex : this.pages - 1); - options = UI.$.extend({ text: pageIndex + 1 }, opts); - - item = (pageIndex == this.currentPage) ? '
        • ' + (options.text) + '
        • ' : '
        • '+options.text+'
        • '; - - this.element.append(item); - } - }); - - return UI.pagination; -}); diff --git a/js/components/pagination.min.js b/js/components/pagination.min.js deleted file mode 100755 index 7361066..0000000 --- a/js/components/pagination.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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:7,edges:1,currentPage:0,lblPrev:!1,lblNext:!1,onSelectPage:function(){}},boot:function(){t.ready(function(e){t.$("[data-uk-pagination]",e).each(function(){var e=t.$(this);e.data("pagination")||t.pagination(e,t.Utils.options(e.attr("data-uk-pagination")))})})},init:function(){var e=this;this.pages=this.options.pages?this.options.pages:Math.ceil(this.options.items/this.options.itemsOnPage)?Math.ceil(this.options.items/this.options.itemsOnPage):1,this.currentPage=this.options.currentPage,this.halfDisplayed=this.options.displayedPages/2,this.on("click","a[data-page]",function(i){i.preventDefault(),e.selectPage(t.$(this).data("page"))}),this._render()},_getInterval:function(){return{start:Math.ceil(this.currentPage>this.halfDisplayed?Math.max(Math.min(this.currentPage-this.halfDisplayed,this.pages-this.options.displayedPages),0):0),end:Math.ceil(this.currentPage>this.halfDisplayed?Math.min(this.currentPage+this.halfDisplayed,this.pages):Math.min(this.options.displayedPages,this.pages))}},render:function(t){this.pages=t?t:this.pages,this._render()},selectPage:function(t,e){this.currentPage=t,this.render(e),this.options.onSelectPage.apply(this,[t]),this.trigger("select.uk.pagination",[t,this])},_render:function(){var t,e=this.options,i=this._getInterval();if(this.element.empty(),e.lblPrev&&this._append(this.currentPage-1,{text:e.lblPrev}),i.start>0&&e.edges>0){var s=Math.min(e.edges,i.start);for(t=0;s>t;t++)this._append(t);e.edges..."):i.start-e.edges==1&&this._append(e.edges)}for(t=i.start;t0){this.pages-e.edges>i.end&&this.pages-e.edges-i.end!=1?this.element.append("
        • ...
        • "):this.pages-e.edges-i.end==1&&this._append(i.end++);var a=Math.max(this.pages-e.edges,i.end);for(t=a;te?0:e'+a.text+"":'
        • '+a.text+"
        • ",this.element.append(s)}}),t.pagination}); \ No newline at end of file diff --git a/js/components/parallax.js b/js/components/parallax.js deleted file mode 100755 index e706abb..0000000 --- a/js/components/parallax.js +++ /dev/null @@ -1,462 +0,0 @@ -/*! UIkit 2.26.4 | 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(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")) { - 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 $this = this, - css = {transform:'', filter:''}, - 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': - - // don't move if image height is too small - // if ($this.element.data('bgsize') && ($this.element.data('bgsize').h + val - window.innerHeight) < 0) { - // break; - // } - - 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; - - // CSS Filter - case 'blur': - css.filter += ' blur('+val+'px)'; - break; - case 'hue': - css.filter += ' hue-rotate('+val+'deg)'; - break; - case 'grayscale': - css.filter += ' grayscale('+val+'%)'; - break; - case 'invert': - css.filter += ' invert('+val+'%)'; - break; - case 'fopacity': - css.filter += ' opacity('+val+'%)'; - break; - case 'saturate': - css.filter += ' saturate('+val+'%)'; - break; - case 'sepia': - css.filter += ' sepia('+val+'%)'; - break; - - default: - css[prop] = val; - break; - } - - }.bind(this)); - - if (css.filter) { - css['-webkit-filter'] = css.filter; - } - - 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, 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.innerWidth(), h = element.innerHeight(), extra = (prop=='bg') ? opts.diff : (opts.diff/100) * h; - - h += extra; - w += Math.ceil(extra * ratio); - - if (w-extra < size.w && h < size.h) { - return obj.element.css({'background-size': 'auto'}); - } - - // if element height < parent height (gap underneath) - if ((w / ratio) < h) { - - width = Math.ceil(h * ratio); - height = h; - - if (h > window.innerHeight) { - width = width * 1.2; - height = height * 1.2; - } - - // element width < parent width (gap to right) - } else { - - width = w; - height = Math.ceil(w / ratio); - } - - element.css({'background-size': (width+'px '+height+'px')}).data('bgsize', {w:width,h:height}); - }; - - img.onerror = function(){ - // image url doesn't exist - }; - - img.onload = function(){ - size = {w:img.width, h: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 - * 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/js/components/parallax.min.js b/js/components/parallax.min.js deleted file mode 100755 index aa290a1..0000000 --- a/js/components/parallax.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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-parallax",["uikit"],function(){return t||e(UIkit)})}(function(e){"use strict";function t(t,a,r){var i,n,s,o,c,l,p,f=new Image;return n=t.element.css({"background-size":"cover","background-repeat":"no-repeat"}),i=n.css("background-image").replace(/^url\(/g,"").replace(/\)$/g,"").replace(/("|')/g,""),o=function(){var e=n.innerWidth(),i=n.innerHeight(),o="bg"==a?r.diff:r.diff/100*i;return i+=o,e+=Math.ceil(o*c),e-oe/c?(l=Math.ceil(i*c),p=i,i>window.innerHeight&&(l=1.2*l,p=1.2*p)):(l=e,p=Math.ceil(e/c)),n.css({"background-size":l+"px "+p+"px"}).data("bgsize",{w:l,h:p}),void 0)},f.onerror=function(){},f.onload=function(){s={w:f.width,h:f.height},c=f.width/f.height,e.$win.on("load resize orientationchange",e.Utils.debounce(function(){o()},50)),o()},f.src=i,!0}function a(e,t,a){return e=i(e),t=i(t),a=a||0,r(e,t,a)}function r(e,t,a){var r="rgba("+parseInt(e[0]+a*(t[0]-e[0]),10)+","+parseInt(e[1]+a*(t[1]-e[1]),10)+","+parseInt(e[2]+a*(t[2]-e[2]),10)+","+(e&&t?parseFloat(e[3]+a*(t[3]-e[3])):1);return r+=")"}function i(e){var t,a;return a=(t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),1]:(t=/#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(e))?[17*parseInt(t[1],16),17*parseInt(t[2],16),17*parseInt(t[3],16),1]:(t=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),1]:(t=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(e))?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),parseFloat(t[4])]:p[e]||[255,255,255,0]}var n=[],s=!1,o=0,c=window.innerHeight,l=function(){o=e.$win.scrollTop(),window.requestAnimationFrame(function(){for(var e=0;e0&&"none"!==e}(),e.$doc.on("scrolling.uk.document",l),e.$win.on("load resize orientationchange",e.Utils.debounce(function(){c=window.innerHeight,l()},50)),e.ready(function(t){e.$("[data-uk-parallax]",t).each(function(){var t=e.$(this);t.data("parallax")||e.parallax(t,e.Utils.options(t.attr("data-uk-parallax")))})})},init:function(){this.base=this.options.target?e.$(this.options.target):this.element,this.props={},this.velocity=this.options.velocity||1;var t=["target","velocity","viewport","plugins","media"];Object.keys(this.options).forEach(function(e){if(-1===t.indexOf(e)){var a,r,i,n,s=String(this.options[e]).split(",");e.match(/color/i)?(a=s[1]?s[0]:this._getStartValue(e),r=s[1]?s[1]:s[0],a||(a="rgba(255,255,255,0)")):(a=parseFloat(s[1]?s[0]:this._getStartValue(e)),r=parseFloat(s[1]?s[1]:s[0]),n=r>a?r-a:a-r,i=r>a?1:-1),this.props[e]={start:a,end:r,dir:i,diff:n}}}.bind(this)),n.push(this)},process:function(){if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidtho+c?a=0:o>r+i?a=1:c>r+i?a=(c>o?o:o-c)/(r+i):(e=o+c-r,t=Math.round(e/((c+i)/100)),a=t/100),a},update:function(e){var r,i,n={transform:"",filter:""},o=e*(1-(this.velocity-this.velocity*e));0>o&&(o=0),o>1&&(o=1),(void 0===this._percent||this._percent!=o)&&(Object.keys(this.props).forEach(function(c){switch(r=this.props[c],0===e?i=r.start:1===e?i=r.end:void 0!==r.diff&&(i=r.start+r.diff*o*r.dir),"bg"!=c&&"bgp"!=c||this._bgcover||(this._bgcover=t(this,c,r)),c){case"x":n.transform+=s?" translate3d("+i+"px, 0, 0)":" translateX("+i+"px)";break;case"xp":n.transform+=s?" translate3d("+i+"%, 0, 0)":" translateX("+i+"%)";break;case"y":n.transform+=s?" translate3d(0, "+i+"px, 0)":" translateY("+i+"px)";break;case"yp":n.transform+=s?" translate3d(0, "+i+"%, 0)":" translateY("+i+"%)";break;case"rotate":n.transform+=" rotate("+i+"deg)";break;case"scale":n.transform+=" scale("+i+")";break;case"bg":n["background-position"]="50% "+i+"px";break;case"bgp":n["background-position"]="50% "+i+"%";break;case"color":case"background-color":case"border-color":n[c]=a(r.start,r.end,o);break;case"blur":n.filter+=" blur("+i+"px)";break;case"hue":n.filter+=" hue-rotate("+i+"deg)";break;case"grayscale":n.filter+=" grayscale("+i+"%)";break;case"invert":n.filter+=" invert("+i+"%)";break;case"fopacity":n.filter+=" opacity("+i+"%)";break;case"saturate":n.filter+=" saturate("+i+"%)";break;case"sepia":n.filter+=" sepia("+i+"%)";break;default:n[c]=i}}.bind(this)),n.filter&&(n["-webkit-filter"]=n.filter),this.element.css(n),this._percent=o)},_getStartValue:function(e){var t=0;switch(e){case"scale":t=1;break;default:t=this.element.css(e)}return t||0}});var p={black:[0,0,0,1],blue:[0,0,255,1],brown:[165,42,42,1],cyan:[0,255,255,1],fuchsia:[255,0,255,1],gold:[255,215,0,1],green:[0,128,0,1],indigo:[75,0,130,1],khaki:[240,230,140,1],lime:[0,255,0,1],magenta:[255,0,255,1],maroon:[128,0,0,1],navy:[0,0,128,1],olive:[128,128,0,1],orange:[255,165,0,1],pink:[255,192,203,1],purple:[128,0,128,1],violet:[128,0,128,1],red:[255,0,0,1],silver:[192,192,192,1],white:[255,255,255,1],yellow:[255,255,0,1],transparent:[255,255,255,0]};return e.parallax}); \ No newline at end of file diff --git a/js/components/search.js b/js/components/search.js deleted file mode 100755 index 6f8a46e..0000000 --- a/js/components/search.js +++ /dev/null @@ -1,92 +0,0 @@ -/*! UIkit 2.26.4 | 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 : '', - - renderer: function(data) { - - var 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")) { - 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/js/components/search.min.js b/js/components/search.min.js deleted file mode 100755 index d74b4ac..0000000 --- a/js/components/search.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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:'',renderer:function(e){var s=this.options;this.dropdown.append(this.template({items:e.results||[],msgResultsHeader:s.msgResultsHeader,msgMoreResults:s.msgMoreResults,msgNoResults:s.msgNoResults})),this.show()}},boot:function(){e.$html.on("focus.search.uikit","[data-uk-search]",function(){var s=e.$(this);s.data("search")||e.search(s,e.Utils.options(s.attr("data-uk-search")))})},init:function(){var s=this;this.autocomplete=e.autocomplete(this.element,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-search"),this.autocomplete.input.on("keyup",function(){s.element[s.autocomplete.input.val()?"addClass":"removeClass"]("uk-active")}).closest("form").on("reset",function(){s.value="",s.element.removeClass("uk-active")}),this.on("selectitem.uk.autocomplete",function(e,t){t.url?location.href=t.url:t.moreresults&&s.autocomplete.input.closest("form").submit()}),this.element.data("search",this)}})}); \ No newline at end of file diff --git a/js/components/slider.js b/js/components/slider.js deleted file mode 100755 index f89b588..0000000 --- a/js/components/slider.js +++ /dev/null @@ -1,540 +0,0 @@ -/*! UIkit 2.26.4 | 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, - autoplay : false, - autoplayInterval : 7000, - pauseOnHover : 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.uk.slider', '[data-uk-slider-item]', function(e) { - - e.preventDefault(); - - var item = UI.$(this).attr('data-uk-slider-item'); - - if ($this.focus == item) return; - - // stop autoplay - $this.stop(); - - switch(item) { - case 'next': - case 'previous': - $this[item=='next' ? 'next':'previous'](); - break; - default: - $this.updateFocus(parseInt(item, 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; - } - - // stop autoplay - $this.stop(); - - 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; - - }, - - mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; }, - mouseleave: function() { $this.hovering = false; } - }); - - 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'); - - // Set autoplay - if (this.options.autoplay) { - this.start(); - } - - }, - - 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.items.length < 5) && !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': '' - }); - - if (focus) this.updateFocus(this.focus); - }, - - 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 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.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; - } - - if (area > this.vp) { - idx = (i < this.items.length-1) ? i+1 : i; - break; - } - } - - if (area > this.vp) { - this.updatePos((this.container.width() - this.vp) * -1); - } else { - this.updatePos(this.items.eq(idx).data('left')*-1); - } - } - } - } - } - - // mark elements - var left = this.items.eq(idx).data('left'); - - this.items.removeClass('uk-slide-before uk-slide-after').each(function(i){ - if (i!==idx) { - UI.$(this).addClass(UI.$(this).data('left') < left ? 'uk-slide-before':'uk-slide-after'); - } - }); - - 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); - }, - - 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); - }, - - infinite: function(baseidx, direction) { - - var $this = this, item = this.items.eq(baseidx), i, z = baseidx, move = [], area = 0; - - if (direction == 1) { - - - for (i=0;i 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.uk.slider touchmove.uk.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 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 store.diff) { - focus = z; - break; - } - - z = z+1 == dragging.items.length ? 0:z+1; - } - - } else { - - for (i=0,z=store.focus;i=this.vp,this.container.css({"-ms-transform":"","-webkit-transform":"",transform:""}),e&&this.updateFocus(this.focus),void 0)},updatePos:function(t){this.pos=t,this.container.css({"-ms-transform":"translateX("+t+"px)","-webkit-transform":"translateX("+t+"px)",transform:"translateX("+t+"px)"})},updateFocus:function(e,i){if(this.active){i=i||(e>this.focus?1:-1);var s,n,a=this.items.eq(e);if(this.options.infinite&&this.infinite(e,i),this.options.center)this.updatePos(-1*a.data("center")),this.items.filter("."+this.options.activecls).removeClass(this.options.activecls),a.addClass(this.options.activecls);else if(this.options.infinite)this.updatePos(-1*a.data("left"));else{for(s=0,n=e;nthis.vp)this.updatePos(-1*a.data("left"));else if(1==i){for(s=0,n=this.items.length-1;n>=0;n--){if(s+=this.items.eq(n).data("width"),s==this.vp){e=n;break}if(s>this.vp){e=nthis.vp?this.updatePos(-1*(this.container.width()-this.vp)):this.updatePos(-1*this.items.eq(e).data("left"))}}var o=this.items.eq(e).data("left");this.items.removeClass("uk-slide-before uk-slide-after").each(function(i){i!==e&&t.$(this).addClass(t.$(this).data("left")this.vp));i++)a=a+1==this.items.length?0:a+1;o.length&&o.forEach(function(t){var e=n.data("area");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}else{for(i=this.items.length-1;i>-1&&(h+=this.items.eq(a).data("width"),a!=t&&o.push(this.items.eq(a)),!(h>this.vp));i--)a=a-1==-1?this.items.length-1:a-1;o.length&&o.forEach(function(t){var e=n.data("left")-t.data("width");t.css({left:e}).data({left:e,area:e+t.data("width"),center:e-(s.vp/2-t.data("cwidth")/2)}),n=t})}}}),t.$doc.on("mousemove.uk.slider touchmove.uk.slider",function(t){if(t.originalEvent&&t.originalEvent.touches&&(t=t.originalEvent.touches[0]),i&&Math.abs(t.pageX-i.x)>i.threshold&&(window.getSelection().toString()?e=i=!1:i(t)),e){var s,n,o,h,r,c,f,u,d,l;if(t.clientX||t.clientY?s=t.clientX:(t.pageX||t.pageY)&&(s=t.pageX-document.body.scrollLeft-document.documentElement.scrollLeft),r=a.focus,n=s-e.element.data("pointer-start").x,o=e.element.data("pointer-pos-start")+n,h=s>e.element.data("pointer-start").x?-1:1,c=e.items.eq(a.focus),1==h)for(f=c.data("left")+Math.abs(n),u=0,d=a.focus;uf){r=d;break}d=d+1==e.items.length?0:d+1}else for(f=c.data("left")-Math.abs(n),u=0,d=a.focus;ua.diff){o=n;break}n=n+1==e.items.length?0:n+1}else for(s=0,n=a.focus;s'); - } - - 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.$('
          ').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 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;ii)return null;for(;a>s;)e=s%i,e?o[n][e]=t[s]:o[++n]=[t[s]],s++;for(s=0,a=o.length;a>s;)o[s]=jQuery(o[s]),s++;return o}var s;t.component("slideset",{defaults:{"default":1,animation:"fade",duration:200,filter:"",delay:!1,controls:!1,autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},sets:[],boot:function(){t.ready(function(i){t.$("[data-uk-slideset]",i).each(function(){var i=t.$(this);i.data("slideset")||t.slideset(i,t.Utils.options(i.attr("data-uk-slideset")))})})},init:function(){var i=this;this.activeSet=!1,this.list=this.element.find(".uk-slideset"),this.nav=this.element.find(".uk-slideset-nav"),this.controls=this.options.controls?t.$(this.options.controls):this.element,t.$win.on("resize load",t.Utils.debounce(function(){i.updateSets()},100)),i.list.addClass("uk-grid-width-1-"+i.options.default),["xlarge","large","medium","small"].forEach(function(t){i.options[t]&&i.list.addClass("uk-grid-width-"+t+"-1-"+i.options[t])}),this.on("click.uk.slideset","[data-uk-slideset-item]",function(e){if(e.preventDefault(),!i.animating){var s=t.$(this).attr("data-uk-slideset-item");if(i.activeSet!==s)switch(s){case"next":case"previous":i["next"==s?"next":"previous"]();break;default:i.show(parseInt(s,10))}}}),this.controls.on("click.uk.slideset","[data-uk-filter]",function(e){var s=t.$(this);s.parent().hasClass("uk-slideset")||(e.preventDefault(),i.animating||i.currentFilter==s.attr("data-uk-filter")||(i.updateFilter(s.attr("data-uk-filter")),i._hide().then(function(){i.updateSets(!0,!0)})))}),this.on("swipeRight swipeLeft",function(t){i["swipeLeft"==t.type?"next":"previous"]()}),this.updateFilter(this.options.filter),this.updateSets(),this.element.on({mouseenter:function(){i.options.pauseOnHover&&(i.hovering=!0)},mouseleave:function(){i.hovering=!1}}),this.options.autoplay&&this.start()},updateSets:function(t,i){var s,n=this.visible;if(this.visible=this.getVisibleOnCurrenBreakpoint(),n!=this.visible||i){for(this.children=this.list.children().hide(),this.items=this.getItems(),this.sets=e(this.items,this.visible),s=0;s');this.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.$('
          ').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').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.$('
          ').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() { - - setTimeout(ghost.remove.bind(ghost), 0); - - 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.$('
        • ').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++) { - - bar = UI.$('
          ').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() { - - setTimeout(ghost.remove.bind(ghost), 0); - - 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.$('
        • ').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.$('
          ').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() { - - setTimeout(ghost.remove.bind(ghost), 0); - - 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.$('
        • ').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.$('
          ').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() { - - setTimeout(ghost.remove.bind(ghost), 0); - - 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/js/components/slideshow-fx.min.js b/js/components/slideshow-fx.min.js deleted file mode 100755 index 72340d1..0000000 --- a/js/components/slideshow-fx.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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),d=s.data("cover").css("background-image"),h=i.$("
        • ").css({top:0,left:0,width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),p=h.width(),l=h.height(),u="slice-up"==o?l:"0",f=0;f').css({position:"absolute",top:0,left:0,width:p,height:l,"background-image":d,clip:m,opacity:0,transition:"all "+this.options.duration+"ms ease-in-out "+60*f+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+60*f+"ms"}).data("clip",v),h.append(r)}return this.container.append(h),h.children().last().on(i.support.transition.end,function(){setTimeout(h.remove.bind(h),0),a.resolve()}),h.width(),h.children().each(function(){var t=i.$(this);t.css({clip:t.data("clip"),opacity:1})}),a.promise()},"slice-up":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up"])},"slice-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-down"])},"slice-up-down":function(i,e,s){return t.slice.apply(this,[i,e,s,"slice-up-down"])},fold:function(e,s){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var n,o=i.$.Deferred(),r=Math.ceil(this.element.width()/this.options.slices),a=s.data("cover").css("background-image"),c=i.$("
        • ").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),d=s.width(),h=s.height(),p=0;p').css({position:"absolute",top:0,left:0,width:d,height:h,"background-image":a,"transform-origin":r*p+"px 0 0",clip:"rect(0px, "+r*(p+1)+"px, "+h+"px, "+r*p+"px)",opacity:0,transform:"scaleX(0.000001)",transition:"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms","-webkit-transition":"all "+this.options.duration+"ms ease-in-out "+(100+60*p)+"ms"}),c.prepend(n);return this.container.append(c),c.width(),c.children().first().on(i.support.transition.end,function(){setTimeout(c.remove.bind(c),0),o.resolve()}).end().css({transform:"scaleX(1)",opacity:1}),o.promise()},puzzle:function(s,n){if(!n.data("cover"))return t.fade.apply(this,arguments);for(var o,r,a,c=i.$.Deferred(),d=this,h=Math.round(this.options.slices/2),p=Math.round(n.width()/h),l=Math.round(n.height()/p),u=Math.round(n.height()/l)+1,f=n.data("cover").css("background-image"),m=i.$("
        • ").css({width:this.container.width(),height:this.container.height(),opacity:1,zIndex:15}),x=this.container.width(),v=this.container.height(),g=0;l>g;g++)for(var w=0;h>w;w++)a=w==h-1?p+2:p,r=[u*g+"px",a*(w+1)+"px",u*(g+1)+"px",p*w+"px"],o=i.$('
          ').css({position:"absolute",top:0,left:0,opacity:0,width:x,height:v,"background-image":f,clip:"rect("+r.join(",")+")","-webkit-transform":"translateZ(0)",transform:"translateZ(0)"}),m.append(o);this.container.append(m);var b=e(m.children());return b.each(function(t){i.$(this).css({transition:"all "+d.options.duration+"ms ease-in-out "+(50+25*t)+"ms","-webkit-transition":"all "+d.options.duration+"ms ease-in-out "+(50+25*t)+"ms"})}).last().on(i.support.transition.end,function(){setTimeout(m.remove.bind(m),0),c.resolve()}),m.width(),b.css({opacity:1}),c.promise()},boxes:function(e,s,n,o){if(!s.data("cover"))return t.fade.apply(this,arguments);for(var r,a,c,d,h=i.$.Deferred(),p=Math.round(this.options.slices/2),l=Math.round(s.width()/p),u=Math.round(s.height()/l),f=Math.round(s.height()/u)+1,m=s.data("cover").css("background-image"),x=i.$("
        • ").css({width:s.width(),height:s.height(),opacity:1,zIndex:15}),v=s.width(),g=s.height(),w=0;u>w;w++)for(d=0;p>d;d++)c=d==p-1?l+2:l,a=[f*w+"px",c*(d+1)+"px",f*(w+1)+"px",l*d+"px"],r=i.$('
          ').css({position:"absolute",top:0,left:0,opacity:1,width:v,height:g,"background-image":m,"transform-origin":a[3]+" "+a[0]+" 0",clip:"rect("+a.join(",")+")","-webkit-transform":"scale(0.0000000000000001)",transform:"scale(0.0000000000000001)"}),x.append(r);this.container.append(x);var b,k=0,y=0,$=0,I=[[]],M=x.children();for("boxes-reverse"==o&&(M=[].reverse.apply(M)),M.each(function(){I[k][y]=i.$(this),y++,y==p&&(k++,y=0,I[k]=[])}),d=0,b=0;p*u>d;d++){b=d;for(var z=0;u>z;z++)b>=0&&p>b&&I[z][b].css({transition:"all "+this.options.duration+"ms linear "+(50+$)+"ms","-webkit-transition":"all "+this.options.duration+"ms linear "+(50+$)+"ms"}),b--;$+=100}return M.last().on(i.support.transition.end,function(){setTimeout(x.remove.bind(x),0),h.resolve()}),x.width(),M.css({"-webkit-transform":"scale(1)",transform:"scale(1)"}),h.promise()},"boxes-reverse":function(i,e,s){return t.boxes.apply(this,[i,e,s,"boxes-reverse"])},"random-fx":function(){var i=["slice-up","fold","puzzle","slice-down","boxes","slice-up-down","boxes-reverse"];return this.fxIndex=(void 0===this.fxIndex?-1:this.fxIndex)+1,i[this.fxIndex]||(this.fxIndex=0),t[i[this.fxIndex]].apply(this,arguments)}});var e=function(i){for(var t,e,s=i.length;s;t=parseInt(Math.random()*s),e=i[--s],i[s]=i[t],i[t]=e);return i};return i.slideshow.animations}); \ No newline at end of file diff --git a/js/components/slideshow.js b/js/components/slideshow.js deleted file mode 100755 index 88cd4e7..0000000 --- a/js/components/slideshow.js +++ /dev/null @@ -1,560 +0,0 @@ -/*! UIkit 2.26.4 | 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")) { - 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:first')); - 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.$('
          ').css({'background-image':'url('+ media.attr('src') + ')'}); - - if (media.attr('width') && media.attr('height')) { - placeholder = UI.$('').attr({width:media.attr('width'), height:media.attr('height')}); - media.replaceWith(placeholder); - media = placeholder; - placeholder = undefined; - } - - media.css({width: '100%',height: 'auto', opacity:0}); - 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.$('').attr({'width': media[0].width, 'height': media[0].height}); - var img = UI.$('').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.uk.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 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, current, $this]); - }; - - $this.applyKenBurns(next); - - // animation fallback - if (!UI.support.animation) { - animation = 'none'; - } - - current = UI.$(current); - next = UI.$(next); - - $this.trigger('beforeshow.uk.slideshow', [next, current, $this]); - - 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, 1); - }, - - previous: function() { - this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -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.css('opacity', 0).removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out'); - next.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.css('opacity', 0).removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out'); - next.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.css('opacity', 0).removeClass('uk-slideshow-scale-out'); - 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); - - // for plain text content slides - looks smoother - if (!(next.data('cover') || next.data('placeholder'))) { - - next.css('opacity', 1).one(UI.support.animation.end, function() { - next.removeClass('uk-slideshow-fade-in'); - }).addClass('uk-slideshow-fade-in'); - } - - current.one(UI.support.animation.end, function() { - - current.css('opacity', 0).removeClass('uk-slideshow-fade-out'); - 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/js/components/slideshow.min.js b/js/components/slideshow.min.js deleted file mode 100755 index 0dc7037..0000000 --- a/js/components/slideshow.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t,s=0;i.component("slideshow",{defaults:{animation:"fade",duration:500,height:"auto",start:0,autoplay:!1,autoplayInterval:7e3,videoautoplay:!0,videomute:!0,slices:15,pauseOnHover:!0,kenburns:!1,kenburnsanimations:["uk-animation-middle-left","uk-animation-top-right","uk-animation-bottom-left","uk-animation-top-center","","uk-animation-bottom-right"]},current:!1,interval:null,hovering:!1,boot:function(){i.ready(function(t){i.$("[data-uk-slideshow]",t).each(function(){var t=i.$(this);t.data("slideshow")||i.slideshow(t,i.Utils.options(t.attr("data-uk-slideshow")))})})},init:function(){var t,e,a=this;this.container=this.element.hasClass("uk-slideshow")?this.element:i.$(this.find(".uk-slideshow:first")),this.slides=this.container.children(),this.slidesCount=this.slides.length,this.current=this.options.start,this.animating=!1,this.triggers=this.find("[data-uk-slideshow-item]"),this.fixFullscreen=navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&this.container.hasClass("uk-slideshow-fullscreen"),this.options.kenburns&&(e=this.options.kenburns===!0?"15s":this.options.kenburns,String(e).match(/(ms|s)$/)||(e+="ms"),"string"==typeof this.options.kenburnsanimations&&(this.options.kenburnsanimations=this.options.kenburnsanimations.split(","))),this.slides.each(function(n){var o=i.$(this),r=o.children("img,video,iframe").eq(0);if(o.data("media",r),o.data("sizer",r),r.length){var d;switch(r[0].nodeName){case"IMG":var u=i.$('
          ').css({"background-image":"url("+r.attr("src")+")"});r.attr("width")&&r.attr("height")&&(d=i.$("").attr({width:r.attr("width"),height:r.attr("height")}),r.replaceWith(d),r=d,d=void 0),r.css({width:"100%",height:"auto",opacity:0}),o.prepend(u).data("cover",u);break;case"IFRAME":var h=r[0].src,c="sw-"+ ++s;r.attr("src","").on("load",function(){if((n!==a.current||n==a.current&&!a.options.videoautoplay)&&a.pausemedia(r),a.options.videomute){a.mutemedia(r);var i=setInterval(function(t){return function(){a.mutemedia(r),++t>=4&&clearInterval(i)}}(0),250)}}).data("slideshow",a).attr("data-player-id",c).attr("src",[h,h.indexOf("?")>-1?"&":"?","enablejsapi=1&api=1&player_id="+c].join("")).addClass("uk-position-absolute"),i.support.touch||r.css("pointer-events","none"),d=!0,i.cover&&(i.cover(r),r.attr("data-uk-cover","{}"));break;case"VIDEO":r.addClass("uk-cover-object uk-position-absolute"),d=!0,a.options.videomute&&a.mutemedia(r)}if(d){t=i.$("").attr({width:r[0].width,height:r[0].height});var l=i.$('').attr("src",t[0].toDataURL());o.prepend(l),o.data("sizer",l)}}else o.data("sizer",o);a.hasKenBurns(o)&&o.data("cover").css({"-webkit-animation-duration":e,"animation-duration":e})}),this.on("click.uk.slideshow","[data-uk-slideshow-item]",function(t){t.preventDefault();var s=i.$(this).attr("data-uk-slideshow-item");if(a.current!=s){switch(s){case"next":case"previous":a["next"==s?"next":"previous"]();break;default:a.show(parseInt(s,10))}a.stop()}}),this.slides.attr("aria-hidden","true").eq(this.current).addClass("uk-active").attr("aria-hidden","false"),this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass("uk-active"),i.$win.on("resize load",i.Utils.debounce(function(){a.resize(),a.fixFullscreen&&(a.container.css("height",window.innerHeight),a.slides.css("height",window.innerHeight))},100)),setTimeout(function(){a.resize()},80),this.options.autoplay&&this.start(),this.options.videoautoplay&&this.slides.eq(this.current).data("media")&&this.playmedia(this.slides.eq(this.current).data("media")),this.options.kenburns&&this.applyKenBurns(this.slides.eq(this.current)),this.container.on({mouseenter:function(){a.options.pauseOnHover&&(a.hovering=!0)},mouseleave:function(){a.hovering=!1}}),this.on("swipeRight swipeLeft",function(i){a["swipeLeft"==i.type?"next":"previous"]()}),this.on("display.uk.check",function(){a.element.is(":visible")&&(a.resize(),a.fixFullscreen&&(a.container.css("height",window.innerHeight),a.slides.css("height",window.innerHeight)))})},resize:function(){if(!this.container.hasClass("uk-slideshow-fullscreen")){var t=this.options.height;"auto"===this.options.height&&(t=0,this.slides.css("height","").each(function(){t=Math.max(t,i.$(this).height())})),this.container.css("height",t),this.slides.css("height",t)}},show:function(s,e){if(!this.animating&&this.current!=s){this.animating=!0;var a=this,n=this.slides.eq(this.current),o=this.slides.eq(s),r=e?e:this.current-1&&"ready"==e.event&&e.player_id&&(s=i.$('[data-player-id="'+e.player_id+'"]'),s.length&&s.data("slideshow").mutemedia(s))},!1)}); \ No newline at end of file diff --git a/js/components/sortable.js b/js/components/sortable.js deleted file mode 100755 index de378d9..0000000 --- a/js/components/sortable.js +++ /dev/null @@ -1,688 +0,0 @@ -/*! UIkit 2.26.4 | 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 || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch), - draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement, startEvent; - - var POINTER_DOWN = supportsTouch ? ('MSGesture' in window ? 'pointerdown':'touchstart') : 'mousedown', - POINTER_MOVE = supportsTouch ? ('MSGesture' in window ? 'pointermove':'touchmove') : 'mousemove', - POINTER_UP = supportsTouch ? ('MSGesture' in window ? 'pointerup':'touchend') : 'mouseup'; - - 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', - emptyClass : 'uk-sortable-empty', - 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")) { - UI.sortable(ele, UI.Utils.options(ele.attr("data-uk-sortable"))); - } - }); - }); - - UI.$html.on(POINTER_MOVE, 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'), - ev = e.originalEvent.touches && e.originalEvent.touches[0] || e.originalEvent, - left = parseInt(ev.pageX, 10) + offset.left, - top = parseInt(ev.pageY, 10) + offset.top; - - draggingPlaceholder.css({'left': left, 'top': top }); - - // adjust document scrolling - - if (top + (draggingPlaceholder.height()/3) > document.body.offsetHeight) { - return; - } - - if (top < UI.$win.scrollTop()) { - UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/3)); - } else if ( (top + (draggingPlaceholder.height()/3)) > (window.innerHeight + UI.$win.scrollTop()) ) { - UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/3)); - } - } - }); - - UI.$html.on(POINTER_UP, 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(currentlyDraggingElement), - 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]; - - touchedlists = []; - - this.checkEmptyList(); - - this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group')); - - var handleDragStart = delegate(function(e) { - - if (e.data && e.data.sortable) { - return; - } - - var $target = UI.$(e.target), - $link = $target.is('a[href]') ? $target:$target.parents('a[href]'); - - if ($target.is(':input')) { - return; - } - - if ($this.options.handleClass) { - var handle = $target.hasClass($this.options.handleClass) ? $target : $target.closest('.'+$this.options.handleClass, $this.element); - if (!handle.length) return; - } - - e.preventDefault(); - - if ($link.length) { - - $link.one('click', function(e){ - e.preventDefault(); - }).one(POINTER_UP, function(){ - - if (!moved) { - $link.trigger('click'); - if (supportsTouch && $link.attr('href').trim()) { - location.href = $link.attr('href'); - } - } - }); - } - - e.data = e.data || {}; - - e.data.sortable = element; - - return $this.dragStart(e, this); - }); - - 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 && startEvent.touches && startEvent.touches.length) { - element.addEventListener(POINTER_MOVE, handleTouchMove, false); - } else { - element.addEventListener('mouseover', handleDragEnter, false); - element.addEventListener('mouseout', handleDragLeave, false); - } - - // document.addEventListener("selectstart", prevent, false); - } - - function removeDragHandlers() { - if (supportsTouch && startEvent.touches && startEvent.touches.length) { - element.removeEventListener(POINTER_MOVE, 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; - - startEvent = e; - - if (e) { - touch = e.touches && e.touches[0] || e; - target = touch.target || e.target; - - // Fix event.target for a touch event - if (supportsTouch && document.elementFromPoint) { - target = document.elementFromPoint(touch.pageX - document.body.scrollLeft, touch.pageY - document.body.scrollTop); - } - - overElement = UI.$(target); - } - - 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(POINTER_MOVE, handleDragMove, false); - element.addEventListener(POINTER_DOWN, handleDragStart, false); - }, - - dragStart: function(e, elem) { - - moved = false; - moving = false; - dragging = false; - - var $this = this, - target = UI.$(e.target); - - if (!supportsTouch && e.button==2) { - 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(), ev = e.touches && e.touches[0] || e; - - delayIdle = { - - pos : { x:ev.pageX, y:ev.pageY }, - threshold : $this.options.handleClass ? 1 : $this.options.threshold, - apply : function(evt) { - - draggingPlaceholder = UI.$('
          ').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(ev.pageX, 10), - 'top' : offset.top - parseInt(ev.pageY, 10) - }, - 'origin' : $this.element, - 'index' : $current.index() - }).append($current.html()).appendTo('body'); - - draggingPlaceholder.$current = $current; - draggingPlaceholder.$sortable = $this; - - $current.data({ - 'start-list': $current.parent(), - 'start-index': $current.index(), - 'sortable-group': $this.options.group - }); - - $this.addDragHandlers(); - - $this.options.start(this, currentlyDraggingElement); - $this.trigger('start.uk.sortable', [$this, currentlyDraggingElement, draggingPlaceholder]); - - moved = true; - delayIdle = false; - } - }; - }, - - dragMove: function(e, elem) { - - overElement = UI.$(document.elementFromPoint(e.pageX - (document.body.scrollLeft || document.scrollLeft || 0), e.pageY - (document.body.scrollTop || document.documentElement.scrollTop || 0))); - - var overRoot = overElement.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 = overElement.closest('.'+this.options.childClass); - - if (overChild.length) { - overChild.before($current); - } else { - overRoot.append($current); - } - - } else { // empty list - overElement.append($current); - } - - UIkit.$doc.trigger('mouseover'); - } - - this.checkEmptyList(); - this.checkEmptyList(currentRoot); - }, - - dragEnter: function(e, elem) { - - if (!currentlyDraggingElement || currentlyDraggingElement === elem) { - return true; - } - - var previousCounter = this.dragenterData(elem); - - this.dragenterData(elem, previousCounter + 1); - - // Prevent dragenter on a child from allowing a dragleave on the container - if (previousCounter === 0) { - - var currentlist = UI.$(elem).parent(), - startlist = UI.$(currentlyDraggingElement).data("start-list"); - - if (currentlist[0] !== startlist[0]) { - - var groupOver = currentlist.data('sortable-group'), - groupCurrent = UI.$(currentlyDraggingElement).data("sortable-group"); - - if ((groupOver || groupCurrent) && (groupOver != groupCurrent)) { - return false; - } - } - - 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 = [], - el = UI.$(currentlyDraggingElement); - - // events depending on move inside lists or across lists - if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) { - triggers.push({sortable: this, mode: 'moved'}); - } else if (oldRoot[0] != newRoot[0]) { - triggers.push({sortable: UI.$(newRoot).data('sortable'), mode: 'added'}, {sortable: UI.$(oldRoot).data('sortable'), mode: 'removed'}); - } - - triggers.forEach(function (trigger, i) { - if (trigger.sortable) { - trigger.sortable.element.trigger('change.uk.sortable', [trigger.sortable, el, 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, attr, val; i < child.attributes.length; i++) { - attribute = child.attributes[i]; - if (attribute.name.indexOf('data-') === 0) { - attr = attribute.name.substr(5); - val = UI.Utils.str2json(attribute.value); - item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value; - } - } - data.push(item); - }); - - return data; - }, - - checkEmptyList: function(list) { - - list = list ? UI.$(list) : this.element; - - if (this.options.emptyClass) { - list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass); - } - } - }); - - // 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/js/components/sortable.min.js b/js/components/sortable.min.js deleted file mode 100755 index 3807ff1..0000000 --- a/js/components/sortable.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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 s(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}var a,r,i,l,d,h,u,p,c,g,f,m="ontouchstart"in window||"MSGesture"in window||window.DocumentTouch&&document instanceof DocumentTouch,v=m?"MSGesture"in window?"pointerdown":"touchstart":"mousedown",b=m?"MSGesture"in window?"pointermove":"touchmove":"mousemove",C=m?"MSGesture"in window?"pointerup":"touchend":"mouseup";return t.component("sortable",{defaults:{animation:150,threshold:10,childClass:"uk-sortable-item",placeholderClass:"uk-sortable-placeholder",overClass:"uk-sortable-over",draggingClass:"uk-sortable-dragged",dragMovingClass:"uk-sortable-moving",baseClass:"uk-sortable",noDragClass:"uk-sortable-nodrag",emptyClass:"uk-sortable-empty",dragCustomClass:"",handleClass:!1,group:!1,stop:function(){},start:function(){},change:function(){}},boot:function(){t.ready(function(e){t.$("[data-uk-sortable]",e).each(function(){var e=t.$(this);e.data("sortable")||t.sortable(e,t.Utils.options(e.attr("data-uk-sortable")))})}),t.$html.on(b,function(e){if(u){var o=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e;(Math.abs(o.pageX-u.pos.x)>u.threshold||Math.abs(o.pageY-u.pos.y)>u.threshold)&&u.apply(o)}if(a){d||(d=!0,a.show(),a.$current.addClass(a.$sortable.options.placeholderClass),a.$sortable.element.children().addClass(a.$sortable.options.childClass),t.$html.addClass(a.$sortable.options.dragMovingClass));var n=a.data("mouse-offset"),s=e.originalEvent.touches&&e.originalEvent.touches[0]||e.originalEvent,r=parseInt(s.pageX,10)+n.left,i=parseInt(s.pageY,10)+n.top;if(a.css({left:r,top:i}),i+a.height()/3>document.body.offsetHeight)return;iwindow.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(a.height()/3))}}),t.$html.on(C,function(t){if(u=h=!1,!r||!a)return r=a=null,void 0;var o=e(r),n=a.$sortable,s={type:t.type};o[0]&&n.dragDrop(s,n.element),n.dragEnd(s,n.element)})},init:function(){function e(){m&&f.touches&&f.touches.length?h.addEventListener(b,y,!1):(h.addEventListener("mouseover",$,!1),h.addEventListener("mouseout",w,!1))}function o(){m&&f.touches&&f.touches.length?h.removeEventListener(b,y,!1):(h.removeEventListener("mouseover",$,!1),h.removeEventListener("mouseout",w,!1))}function a(t){r&&d.dragMove(t,d)}function l(e){return function(o){var s,a,r;f=o,o&&(s=o.touches&&o.touches[0]||o,a=s.target||o.target,m&&document.elementFromPoint&&(a=document.elementFromPoint(s.pageX-document.body.scrollLeft,s.pageY-document.body.scrollTop)),g=t.$(a)),t.$(a).hasClass("."+d.options.childClass)?e.apply(a,[o]):a!==h&&(r=n(h,a),r&&e.apply(r,[o]))}}var d=this,h=this.element[0];p=[],this.checkEmptyList(),this.element.data("sortable-group",this.options.group?this.options.group:t.Utils.uid("sortable-group"));var u=l(function(e){if(!e.data||!e.data.sortable){var o=t.$(e.target),n=o.is("a[href]")?o:o.parents("a[href]");if(!o.is(":input")){if(d.options.handleClass){var s=o.hasClass(d.options.handleClass)?o:o.closest("."+d.options.handleClass,d.element);if(!s.length)return}return e.preventDefault(),n.length&&n.one("click",function(t){t.preventDefault()}).one(C,function(){c||(n.trigger("click"),m&&n.attr("href").trim()&&(location.href=n.attr("href")))}),e.data=e.data||{},e.data.sortable=h,d.dragStart(e,this)}}}),$=l(t.Utils.debounce(function(t){return d.dragEnter(t,this)}),40),w=l(function(){var e=d.dragenterData(this);d.dragenterData(this,e-1),d.dragenterData(this)||(t.$(this).removeClass(d.options.overClass),d.dragenterData(this,!1))}),y=l(function(t){return r&&r!==this&&i!==this?(d.element.children().removeClass(d.options.overClass),i=this,d.moveElementNextTo(r,this),s(t)):!0});this.addDragHandlers=e,this.removeDragHandlers=o,window.addEventListener(b,a,!1),h.addEventListener(v,u,!1)},dragStart:function(e,o){c=!1,d=!1,l=!1;var n=this,s=t.$(e.target);if(!(!m&&2==e.button||s.is("."+n.options.noDragClass)||s.closest("."+n.options.noDragClass).length||s.is(":input"))){r=o,a&&a.remove();var i=t.$(r),h=i.offset(),p=e.touches&&e.touches[0]||e;u={pos:{x:p.pageX,y:p.pageY},threshold:n.options.handleClass?1:n.options.threshold,apply:function(){a=t.$('
          ').css({display:"none",top:h.top,left:h.left,width:i.width(),height:i.height(),padding:i.css("padding")}).data({"mouse-offset":{left:h.left-parseInt(p.pageX,10),top:h.top-parseInt(p.pageY,10)},origin:n.element,index:i.index()}).append(i.html()).appendTo("body"),a.$current=i,a.$sortable=n,i.data({"start-list":i.parent(),"start-index":i.index(),"sortable-group":n.options.group}),n.addDragHandlers(),n.options.start(this,r),n.trigger("start.uk.sortable",[n,r,a]),c=!0,u=!1}}}},dragMove:function(e){g=t.$(document.elementFromPoint(e.pageX-(document.body.scrollLeft||document.scrollLeft||0),e.pageY-(document.body.scrollTop||document.documentElement.scrollTop||0)));var o,n=g.closest("."+this.options.baseClass),s=n.data("sortable-group"),a=t.$(r),i=a.parent(),l=a.data("sortable-group");n[0]!==i[0]&&void 0!==l&&s===l&&(n.data("sortable").addDragHandlers(),p.push(n),n.children().addClass(this.options.childClass),n.children().length>0?(o=g.closest("."+this.options.childClass),o.length?o.before(a):n.append(a)):g.append(a),UIkit.$doc.trigger("mouseover")),this.checkEmptyList(),this.checkEmptyList(i)},dragEnter:function(e,o){if(!r||r===o)return!0;var n=this.dragenterData(o);if(this.dragenterData(o,n+1),0===n){var s=t.$(o).parent(),a=t.$(r).data("start-list");if(s[0]!==a[0]){var i=s.data("sortable-group"),l=t.$(r).data("sortable-group");if((i||l)&&i!=l)return!1}t.$(o).addClass(this.options.overClass),this.moveElementNextTo(r,o)}return!1},dragEnd:function(e,o){var n=this;r&&(this.options.stop(o),this.trigger("stop.uk.sortable",[this])),r=null,i=null,p.push(this.element),p.forEach(function(e){t.$(e).children().each(function(){1===this.nodeType&&(t.$(this).removeClass(n.options.overClass).removeClass(n.options.placeholderClass).removeClass(n.options.childClass),n.dragenterData(this,!1))})}),p=[],t.$html.removeClass(this.options.dragMovingClass),this.removeDragHandlers(),a&&(a.remove(),a=null)},dragDrop:function(t){"drop"===t.type&&(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault()),this.triggerChangeEvents()},triggerChangeEvents:function(){if(r){var e=t.$(r),o=a.data("origin"),n=e.closest("."+this.options.baseClass),s=[],i=t.$(r);o[0]===n[0]&&a.data("index")!=e.index()?s.push({sortable:this,mode:"moved"}):o[0]!=n[0]&&s.push({sortable:t.$(n).data("sortable"),mode:"added"},{sortable:t.$(o).data("sortable"),mode:"removed"}),s.forEach(function(t){t.sortable&&t.sortable.element.trigger("change.uk.sortable",[t.sortable,i,t.mode])})}},dragenterData:function(e,o){return e=t.$(e),1==arguments.length?parseInt(e.data("child-dragenter"),10)||0:(o?e.data("child-dragenter",Math.max(0,o)):e.removeData("child-dragenter"),void 0)},moveElementNextTo:function(e,n){l=!0;var s=this,a=t.$(e).parent().css("min-height",""),r=o(e,n)?n:n.nextSibling,i=a.children(),d=i.length;return s.options.animation?(a.css("min-height",a.height()),i.stop().each(function(){var e=t.$(this),o=e.position();o.width=e.width(),e.data("offset-before",o)}),n.parentNode.insertBefore(e,r),t.Utils.checkDisplay(s.element.parent()),i=a.children().each(function(){var e=t.$(this);e.data("offset-after",e.position())}).each(function(){var e=t.$(this),o=e.data("offset-before");e.css({position:"absolute",top:o.top,left:o.left,"min-width":o.width})}),i.each(function(){var e=t.$(this),o=(e.data("offset-before"),e.data("offset-after"));e.css("pointer-events","none").width(),setTimeout(function(){e.animate({top:o.top,left:o.left},s.options.animation,function(){e.css({position:"",top:"",left:"","min-width":"","pointer-events":""}).removeClass(s.options.overClass).removeData("child-dragenter"),d--,d||(a.css("min-height",""),t.Utils.checkDisplay(s.element.parent()))})},0)}),void 0):(n.parentNode.insertBefore(e,r),t.Utils.checkDisplay(s.element.parent()),void 0)},serialize:function(){var e,o,n=[];return this.element.children().each(function(s,a){e={};for(var r,i,l=0;l').parent(); - this.computeWrapper(); - this.wrapper.css({ - 'margin-top' : this.element.css('margin-top'), - 'margin-bottom' : this.element.css('margin-bottom'), - 'margin-left' : this.element.css('margin-left'), - 'margin-right' : this.element.css('margin-right') - }) - this.element.css('margin', 0); - - if (boundary) { - - if (boundary === true || boundary[0] === '!') { - - boundary = boundary === true ? this.wrapper.parent() : this.wrapper.closest(boundary.substr(1)); - 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 : UI.$(this.options.getWidthFrom || this.wrapper), - boundary : boundary, - boundtoparent : boundtoparent, - top : 0, - calcTop : function() { - - var top = this.options.top; - - // dynamic top parameter - if (this.options.top && typeof(this.options.top) == 'string') { - - // e.g. 50vh - if (this.options.top.match(/^(-|)(\d+)vh$/)) { - top = window.innerHeight * parseInt(this.options.top, 10)/100; - // e.g. #elementId, or .class-1,class-2,.class-3 (first found is used) - } else { - - var topElement = UI.$(this.options.top).first(); - - if (topElement.length && topElement.is(':visible')) { - top = -1 * ((topElement.offset().top + topElement.outerHeight()) - this.wrapper.offset().top); - } - } - - } - - this.top = top; - }, - - reset: function(force) { - - this.calcTop(); - - 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.element.addClass(this.options.clsinactive); - this.element.trigger('inactive.uk.sticky'); - - this.currentTop = null; - this.animate = false; - - }.bind(this); - - - if (!force && this.options.animation && UI.support.animation && !UI.Utils.isInView(this.wrapper)) { - - 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.top - extra, - active = (scrollTop >= etse); - - if (active && this.options.showup) { - - // set inactiv if scrolling down - if (direction == 1) { - active = false; - } - - // set inactive when wrapper is still in view - if (direction == -1 && !this.element.hasClass(this.options.clsactive) && UI.Utils.isInView(this.wrapper)) { - active = false; - } - } - - return active; - } - }; - - this.sticky.calcTop(); - - 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' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '', - 'float' : this.element.css('float') != 'none' ? this.element.css('float') : '' - }); - - if (this.element.css('position') == 'fixed') { - this.element.css({ - width: this.sticky.getWidthFrom.length ? this.sticky.getWidthFrom.width() : this.element.width() - }); - } - } - }); - - function checkscrollposition(direction) { - - 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.top < 0) { - newTop = 0; - } else { - stickyHeight = sticky.element.outerHeight(); - newTop = documentHeight - stickyHeight - sticky.top - sticky.options.bottom - scrollTop - extra; - newTop = newTop < 0 ? newTop + sticky.top : sticky.top; - } - - if (sticky.boundary && sticky.boundary.length) { - - var bTop = sticky.boundary.offset().top; - - if (sticky.boundtoparent) { - containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom')); - } else { - containerBottom = documentHeight - bTop; - } - - newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop; - } - - - if (sticky.currentTop != newTop) { - - sticky.element.css({ - position : "fixed", - top : newTop, - width : sticky.getWidthFrom.length ? sticky.getWidthFrom.width() : sticky.element.width() - }); - - 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).removeClass(sticky.options.clsinactive); - sticky.element.trigger('active.uk.sticky'); - sticky.element.css('margin', ''); - - if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) { - sticky.element.addClass(sticky.options.animation); - } - - sticky.currentTop = newTop; - } - } - - sticky.init = true; - } - } - - return UI.sticky; -}); diff --git a/js/components/sticky.min.js b/js/components/sticky.min.js deleted file mode 100755 index 0fa4ead..0000000 --- a/js/components/sticky.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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:n;if(i.length&&!(e.scrollTop()<0))for(var o,a,r,h,p=e.scrollTop(),c=s.height(),l=e.height(),m=c-l,d=p>m?m-p:0,u=0;uo?o+h.top:h.top),h.boundary&&h.boundary.length){var f=h.boundary.offset().top;a=h.boundtoparent?c-(f+h.boundary.outerHeight())+parseInt(h.boundary.css("padding-bottom")):c-f,o=p+r>c-a-(h.top<0?0:h.top)?c-a-(p+r):o}if(h.currentTop!=o){if(h.element.css({position:"fixed",top:o,width:h.getWidthFrom.length?h.getWidthFrom.width():h.element.width()}),!h.init&&(h.element.addClass(h.options.clsinit),location.hash&&p>0&&h.options.target)){var g=t.$(location.hash);g.length&&setTimeout(function(t,i){return function(){i.element.width();var e=t.offset(),s=e.top+t.outerHeight(),n=i.element.offset(),o=i.element.outerHeight(),a=n.top+o;n.top').parent(),this.computeWrapper(),this.wrapper.css({"margin-top":this.element.css("margin-top"),"margin-bottom":this.element.css("margin-bottom"),"margin-left":this.element.css("margin-left"),"margin-right":this.element.css("margin-right")}),this.element.css("margin",0),a&&(a===!0||"!"===a[0]?(a=a===!0?this.wrapper.parent():this.wrapper.closest(a.substr(1)),i=!0):"string"==typeof a&&(a=t.$(a))),this.sticky={self:this,options:this.options,element:this.element,currentTop:null,wrapper:this.wrapper,init:!1,getWidthFrom:t.$(this.options.getWidthFrom||this.wrapper),boundary:a,boundtoparent:i,top:0,calcTop:function(){var i=this.options.top;if(this.options.top&&"string"==typeof this.options.top)if(this.options.top.match(/^(-|)(\d+)vh$/))i=window.innerHeight*parseInt(this.options.top,10)/100;else{var e=t.$(this.options.top).first();e.length&&e.is(":visible")&&(i=-1*(e.offset().top+e.outerHeight()-this.wrapper.offset().top))}this.top=i},reset:function(i){this.calcTop();var e=function(){this.element.css({position:"",top:"",width:"",left:"",margin:"0"}),this.element.removeClass([this.options.animation,"uk-animation-reverse",this.options.clsactive].join(" ")),this.element.addClass(this.options.clsinactive),this.element.trigger("inactive.uk.sticky"),this.currentTop=null,this.animate=!1}.bind(this);!i&&this.options.animation&&t.support.animation&&!t.Utils.isInView(this.wrapper)?(this.animate=!0,this.element.removeClass(this.options.animation).one(t.support.animation.end,function(){e()}).width(),this.element.addClass(this.options.animation+" uk-animation-reverse")):e()},check:function(){if(this.options.disabled)return!1;if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidtha?a-i:0,h=this.wrapper.offset().top,p=h-this.top-r,c=i>=p;return c&&this.options.showup&&(1==o&&(c=!1),-1==o&&!this.element.hasClass(this.options.clsactive)&&t.Utils.isInView(this.wrapper)&&(c=!1)),c}},this.sticky.calcTop(),n.push(this.sticky)},update:function(){i(this.sticky)},enable:function(){this.options.disabled=!1,this.update()},disable:function(t){this.options.disabled=!0,this.sticky.reset(t)},computeWrapper:function(){this.wrapper.css({height:-1==["absolute","fixed"].indexOf(this.element.css("position"))?this.element.outerHeight():"","float":"none"!=this.element.css("float")?this.element.css("float"):""}),"fixed"==this.element.css("position")&&this.element.css({width:this.sticky.getWidthFrom.length?this.sticky.getWidthFrom.width():this.element.width()})}}),t.sticky}); \ No newline at end of file diff --git a/js/components/timepicker.js b/js/components/timepicker.js deleted file mode 100755 index 1b7a808..0000000 --- a/js/components/timepicker.js +++ /dev/null @@ -1,192 +0,0 @@ -/*! UIkit 2.26.4 | 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-timepicker", ["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 = ''; - - this.options.source = function(release) { - release(times[$this.options.format] || times['12h']); - }; - - if (this.element.is('input')) { - this.element.wrap('
          '); - 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', UI.Utils.debounce(function() { - $this.checkTime(); - }, 100)); - - 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 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/js/components/timepicker.min.js b/js/components/timepicker.min.js deleted file mode 100755 index df160db..0000000 --- a/js/components/timepicker.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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-timepicker",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";function e(t,e){t=t||0,e=e||24;var i,o,a={"12h":[],"24h":[]};for(i=t,o="";e>i;i++)o=""+i,10>i&&(o="0"+o),a["24h"].push({value:o+":00"}),a["24h"].push({value:o+":30"}),0===i&&(o=12,a["12h"].push({value:o+":00 AM"}),a["12h"].push({value:o+":30 AM"})),i>0&&13>i&&12!==i&&(a["12h"].push({value:o+":00 AM"}),a["12h"].push({value:o+":30 AM"})),i>=12&&(o-=12,0===o&&(o=12),10>o&&(o="0"+String(o)),a["12h"].push({value:o+":00 PM"}),a["12h"].push({value:o+":30 PM"}));return a}t.component("timepicker",{defaults:{format:"24h",delay:0,start:0,end:24},boot:function(){t.$html.on("focus.timepicker.uikit","[data-uk-timepicker]",function(){var e=t.$(this);if(!e.data("timepicker")){var i=t.timepicker(e,t.Utils.options(e.attr("data-uk-timepicker")));setTimeout(function(){i.autocomplete.input.focus()},40)}})},init:function(){var i,o=this,a=e(this.options.start,this.options.end);this.options.minLength=0,this.options.template='',this.options.source=function(t){t(a[o.options.format]||a["12h"])},this.element.is("input")?(this.element.wrap('
          '),i=this.element.parent()):i=this.element.addClass("uk-autocomplete"),this.autocomplete=t.autocomplete(i,this.options),this.autocomplete.dropdown.addClass("uk-dropdown-small uk-dropdown-scrollable"),this.autocomplete.on("show.uk.autocomplete",function(){var t=o.autocomplete.dropdown.find('[data-value="'+o.autocomplete.input.val()+'"]');setTimeout(function(){o.autocomplete.pick(t,!0)},10)}),this.autocomplete.input.on("focus",function(){o.autocomplete.value=Math.random(),o.autocomplete.triggercomplete()}).on("blur",t.Utils.debounce(function(){o.checkTime()},100)),this.element.data("timepicker",this)},checkTime:function(){var t,e,i,o,a="AM",u=this.autocomplete.input.val();"12h"==this.options.format?(t=u.split(" "),e=t[0].split(":"),a=t[1]):e=u.split(":"),i=parseInt(e[0],10),o=parseInt(e[1],10),isNaN(i)&&(i=0),isNaN(o)&&(o=0),"12h"==this.options.format?(i>12?i=12:0>i&&(i=12),"am"===a||"a"===a?a="AM":("pm"===a||"p"===a)&&(a="PM"),"AM"!==a&&"PM"!==a&&(a="AM")):i>=24?i=23:0>i&&(i=0),0>o?o=0:o>=60&&(o=0),this.autocomplete.input.val(this.formatTime(i,o,a)).trigger("change")},formatTime:function(t,e,i){return t=10>t?"0"+t:t,e=10>e?"0"+e:e,t+":"+e+("12h"==this.options.format?" "+i:"")}})}); \ No newline at end of file diff --git a/js/components/tooltip.js b/js/components/tooltip.js deleted file mode 100755 index a38d49d..0000000 --- a/js/components/tooltip.js +++ /dev/null @@ -1,234 +0,0 @@ -/*! UIkit 2.26.4 | 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) { - var title = ele.attr('title'); - - if (title !== undefined) { - 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")) { - UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip"))); - ele.trigger("mouseenter"); - } - }); - }, - - init: function() { - - var $this = this; - - if (!$tooltip) { - $tooltip = UI.$('
          ').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 (typeof(this.tip) === 'string' ? !this.tip.length:true) return; - - $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).removeClass(this.options.activeClass).show(); - $tooltip.html('
          ' + this.tip + '
          '); - - 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/js/components/tooltip.min.js b/js/components/tooltip.min.js deleted file mode 100755 index 130ea2e..0000000 --- a/js/components/tooltip.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! UIkit 2.26.4 | 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){var i=t.attr("title");return void 0!==i&&t.data("cached-title",i).removeAttr("title"),t.data("cached-title")}},tip:"",boot:function(){t.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit","[data-uk-tooltip]",function(){var i=t.$(this);i.data("tooltip")||(t.tooltip(i,t.Utils.options(i.attr("data-uk-tooltip"))),i.trigger("mouseenter"))})},init:function(){var o=this;i||(i=t.$('
          ').appendTo("body")),this.on({focus:function(){o.show()},blur:function(){o.hide()},mouseenter:function(){o.show()},mouseleave:function(){o.hide()}})},show:function(){if(this.tip="function"==typeof this.options.src?this.options.src(this.element):this.options.src,o&&clearTimeout(o),e&&clearTimeout(e),"string"==typeof this.tip?this.tip.length:0){i.stop().css({top:-2e3,visibility:"hidden"}).removeClass(this.options.activeClass).show(),i.html('
          '+this.tip+"
          ");var s=this,n=t.$.extend({},this.element.offset(),{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}),l=i[0].offsetWidth,f=i[0].offsetHeight,p="function"==typeof this.options.offset?this.options.offset.call(this.element):this.options.offset,a="function"==typeof this.options.pos?this.options.pos.call(this.element):this.options.pos,h=a.split("-"),c={display:"none",visibility:"visible",top:n.top+n.height+f,left:n.left};if("fixed"==t.$html.css("position")||"fixed"==t.$body.css("position")){var r=t.$("body").offset(),d=t.$("html").offset(),u={top:d.top+r.top,left:d.left+r.left};n.left-=u.left,n.top-=u.top}"left"!=h[0]&&"right"!=h[0]||"right"!=t.langdirection||(h[0]="left"==h[0]?"right":"left");var m={bottom:{top:n.top+n.height+p,left:n.left+n.width/2-l/2},top:{top:n.top-f-p,left:n.left+n.width/2-l/2},left:{top:n.top+n.height/2-f/2,left:n.left-l-p},right:{top:n.top+n.height/2-f/2,left:n.left+n.width+p}};t.$.extend(c,m[h[0]]),2==h.length&&(c.left="left"==h[1]?n.left:n.left+n.width-l);var v=this.checkBoundary(c.left,c.top,l,f);if(v){switch(v){case"x":a=2==h.length?h[0]+"-"+(c.left<0?"left":"right"):c.left<0?"right":"left";break;case"y":a=2==h.length?(c.top<0?"bottom":"top")+"-"+h[1]:c.top<0?"bottom":"top";break;case"xy":a=2==h.length?(c.top<0?"bottom":"top")+"-"+(c.left<0?"left":"right"):c.left<0?"right":"left"}h=a.split("-"),t.$.extend(c,m[h[0]]),2==h.length&&(c.left="left"==h[1]?n.left:n.left+n.width-l)}c.left-=t.$body.position().left,o=setTimeout(function(){i.css(c).attr("class",["uk-tooltip","uk-tooltip-"+a,s.options.cls].join(" ")),s.options.animation?i.css({opacity:0,display:"block"}).addClass(s.options.activeClass).animate({opacity:1},parseInt(s.options.animation,10)||400):i.show().addClass(s.options.activeClass),o=!1,e=setInterval(function(){s.element.is(":visible")||s.hide()},150)},parseInt(this.options.delay,10)||0)}},hide:function(){if(!this.element.is("input")||this.element[0]!==document.activeElement)if(o&&clearTimeout(o),e&&clearTimeout(e),i.stop(),this.options.animation){var t=this;i.fadeOut(parseInt(this.options.animation,10)||400,function(){i.removeClass(t.options.activeClass)})}else i.hide().removeClass(this.options.activeClass)},content:function(){return this.tip},checkBoundary:function(i,o,e,s){var n="";return(0>i||i-t.$win.scrollLeft()+e>window.innerWidth)&&(n+="x"),(0>o||o-t.$win.scrollTop()+s>window.innerHeight)&&(n+="y"),n}}),t.tooltip}); \ No newline at end of file diff --git a/js/components/upload.js b/js/components/upload.js deleted file mode 100755 index f80f26e..0000000 --- a/js/components/upload.js +++ /dev/null @@ -1,257 +0,0 @@ -/*! UIkit 2.26.4 | 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.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) { - - e.stopPropagation(); - e.preventDefault(); - - $this.element.removeClass($this.options.dragoverClass); - $this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]); - - xhrupload(e.originalEvent.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(); - })(); - - - 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=a.filelimit&&(p=!1),p&&s>d?r([o[d]],a):a.allcomplete(e,t)},r([o[0]],a)}else a.complete=function(e,t){f(e,t),a.allcomplete(e,t)},r(o,a)}}function n(e,t){var n="^"+e.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return n="^"+n+"$",null!==t.match(new RegExp(n,"i"))}return e.component("uploadSelect",{init:function(){var e=this;this.on("change",function(){t(e.element[0].files,e.options);var n=e.element.clone(!0).data("uploadSelect",e);e.element.replaceWith(n),e.element=n})}}),e.component("uploadDrop",{defaults:{dragoverClass:"uk-dragover"},init:function(){var e=this,n=!1;this.on("drop",function(n){n.originalEvent.dataTransfer&&n.originalEvent.dataTransfer.files&&(n.stopPropagation(),n.preventDefault(),e.element.removeClass(e.options.dragoverClass),e.element.trigger("dropped.uk.upload",[n.originalEvent.dataTransfer.files]),t(n.originalEvent.dataTransfer.files,e.options))}).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}).on("dragover",function(t){t.stopPropagation(),t.preventDefault(),n||(e.element.addClass(e.options.dragoverClass),n=!0)}).on("dragleave",function(t){t.stopPropagation(),t.preventDefault(),e.element.removeClass(e.options.dragoverClass),n=!1})}}),e.support.ajaxupload=function(){function e(){var e=document.createElement("INPUT");return e.type="file","files"in e}function t(){var e=new XMLHttpRequest;return!!(e&&"upload"in e&&"onprogress"in e.upload)}function n(){return!!window.FormData}return e()&&t()&&n()}(),t.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",filelimit:!1,before:function(){},beforeSend:function(){},beforeAll:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(e,t){alert("Only the following file types are allowed: "+t.allow)}},e.Utils.xhrupload=t,t}); \ No newline at end of file -- cgit v1.2.3