uikit2-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/uikit2/rails.rb +8 -0
- data/lib/uikit2/rails/version.rb +5 -0
- data/uikit2-rails.gemspec +25 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +3537 -0
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +334 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.js +3166 -0
- data/vendor/assets/javascripts/uikit/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/uikit/components/form-password.js +67 -0
- data/vendor/assets/javascripts/uikit/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/form-select.js +70 -0
- data/vendor/assets/javascripts/uikit/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/grid.js +523 -0
- data/vendor/assets/javascripts/uikit/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +623 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.js +555 -0
- data/vendor/assets/javascripts/uikit/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +638 -0
- data/vendor/assets/javascripts/uikit/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/notify.js +189 -0
- data/vendor/assets/javascripts/uikit/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/pagination.js +147 -0
- data/vendor/assets/javascripts/uikit/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/parallax.js +417 -0
- data/vendor/assets/javascripts/uikit/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/search.js +92 -0
- data/vendor/assets/javascripts/uikit/components/search.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slider.js +520 -0
- data/vendor/assets/javascripts/uikit/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +502 -0
- data/vendor/assets/javascripts/uikit/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +375 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +545 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +664 -0
- data/vendor/assets/javascripts/uikit/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/sticky.js +349 -0
- data/vendor/assets/javascripts/uikit/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/uikit/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.js +234 -0
- data/vendor/assets/javascripts/uikit/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +260 -0
- data/vendor/assets/javascripts/uikit/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/button.js +157 -0
- data/vendor/assets/javascripts/uikit/core/button.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/core.js +725 -0
- data/vendor/assets/javascripts/uikit/core/core.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/cover.js +95 -0
- data/vendor/assets/javascripts/uikit/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.js +421 -0
- data/vendor/assets/javascripts/uikit/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +114 -0
- data/vendor/assets/javascripts/uikit/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +372 -0
- data/vendor/assets/javascripts/uikit/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +136 -0
- data/vendor/assets/javascripts/uikit/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +180 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +304 -0
- data/vendor/assets/javascripts/uikit/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +165 -0
- data/vendor/assets/javascripts/uikit/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +120 -0
- data/vendor/assets/javascripts/uikit/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +239 -0
- data/vendor/assets/javascripts/uikit/core/utility.min.js +2 -0
- data/vendor/assets/stylesheets/uikit.almost-flat.css +8551 -0
- data/vendor/assets/stylesheets/uikit.css +8252 -0
- data/vendor/assets/stylesheets/uikit.gradient.css +8614 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.css +37 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.css +39 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.css +50 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.css +52 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.css +129 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.css +123 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.css +124 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.css +128 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.css +78 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.css +34 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.css +35 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.css +222 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.css +164 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.css +229 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.css +135 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.css +132 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.css +139 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.css +92 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/notify.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.css +29 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.css +104 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.css +94 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.css +112 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/progress.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.css +189 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.css +191 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/search.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.css +98 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.css +85 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slider.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.css +140 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.css +62 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.css +31 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.css +116 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.css +118 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.css +10 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.min.css +2 -0
- data/vendor/assets/stylesheets/uikit/components/upload.min.css +2 -0
- metadata +295 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-sortable",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";function e(e){e=t.$(e);do{if(e.data("sortable"))return e;e=t.$(e).parent()}while(e.length);return e}function o(t,e){var o=t.parentNode;if(e.parentNode!=o)return!1;for(var n=t.previousSibling;n&&9!==n.nodeType;){if(n===e)return!0;n=n.previousSibling}return!1}function n(t,e){var o=e;if(o==t)return null;for(;o;){if(o.parentNode===t)return o;if(o=o.parentNode,!o||!o.ownerDocument||11===o.nodeType)break}return null}function s(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}var a,r,i,l,d,h,u,p,c,g="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch;return t.component("sortable",{defaults:{animation:150,threshold:10,childClass:"uk-sortable-item",placeholderClass:"uk-sortable-placeholder",overClass:"uk-sortable-over",draggingClass:"uk-sortable-dragged",dragMovingClass:"uk-sortable-moving",baseClass:"uk-sortable",noDragClass:"uk-sortable-nodrag",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("mousemove touchmove",function(e){if(u){var o=e.originalEvent.targetTouches?e.originalEvent.targetTouches[0]:e;(Math.abs(o.pageX-u.pos.x)>u.threshold||Math.abs(o.pageY-u.pos.y)>u.threshold)&&u.apply(o)}if(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=parseInt(e.originalEvent.pageX,10)+n.left,r=parseInt(e.originalEvent.pageY,10)+n.top;if(a.css({left:s,top:r}),r+a.height()/3>document.body.offsetHeight)return;r<t.$win.scrollTop()?t.$win.scrollTop(t.$win.scrollTop()-Math.ceil(a.height()/3)):r+a.height()/3>window.innerHeight+t.$win.scrollTop()&&t.$win.scrollTop(t.$win.scrollTop()+Math.ceil(a.height()/3))}}),t.$html.on("mouseup touchend",function(t){if(u=h=!1,!r||!a)return r=a=null,void 0;var o=e(t.target),n=a.$sortable,s={type:t.type};o[0]&&n.dragDrop(s,n.element),n.dragEnd(s,n.element)})},init:function(){function e(){g?h.addEventListener("touchmove",v,!1):(h.addEventListener("mouseover",f,!1),h.addEventListener("mouseout",m,!1))}function o(){g?h.removeEventListener("touchmove",v,!1):(h.removeEventListener("mouseover",f,!1),h.removeEventListener("mouseout",m,!1))}function a(t){r&&d.dragMove(t,d)}function l(e){return function(o){var s,a,r;o&&(s=g&&o.touches&&o.touches[0]||{},a=s.target||o.target,g&&document.elementFromPoint&&(a=document.elementFromPoint(o.pageX-document.body.scrollLeft,o.pageY-document.body.scrollTop))),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){var o=t.$(e.target),n=o.is("a[href]")?o:o.parents("a[href]");if(!o.is(":input"))return e.preventDefault(),!g&&n.length&&n.one("click",function(t){t.preventDefault()}).one("mouseup",function(){c||n.trigger("click")}),d.dragStart(e,this)}),f=(l(function(t){return r?(t.preventDefault&&t.preventDefault(),!1):!0}),l(t.Utils.debounce(function(t){return d.dragEnter(t,this)}),40)),m=l(function(){var e=d.dragenterData(this);d.dragenterData(this,e-1),d.dragenterData(this)||(t.$(this).removeClass(d.options.overClass),d.dragenterData(this,!1))}),v=l(function(t){return r&&r!==this&&i!==this?(d.element.children().removeClass(d.options.overClass),i=this,d.moveElementNextTo(r,this),s(t)):!0});this.addDragHandlers=e,this.removeDragHandlers=o,window.addEventListener(g?"touchmove":"mousemove",a,!1),h.addEventListener(g?"touchstart":"mousedown",u,!1)},dragStart:function(e,o){c=!1,d=!1,l=!1;var n=this,s=t.$(e.target);if(g||2!=e.button){if(n.options.handleClass){var i=s.hasClass(n.options.handleClass)?s:s.closest("."+n.options.handleClass,n.element);if(!i.length)return}if(!s.is("."+n.options.noDragClass)&&!s.closest("."+n.options._noDragClass).length&&!s.is(":input")){r=o,a&&a.remove();var h=t.$(r),p=h.offset();u={pos:{x:e.pageX,y:e.pageY},threshold:n.options.threshold,apply:function(e){a=t.$('<div class="'+[n.options.draggingClass,n.options.dragCustomClass].join(" ")+'"></div>').css({display:"none",top:p.top,left:p.left,width:h.width(),height:h.height(),padding:h.css("padding")}).data({"mouse-offset":{left:p.left-parseInt(e.pageX,10),top:p.top-parseInt(e.pageY,10)},origin:n.element,index:h.index()}).append(h.html()).appendTo("body"),a.$current=h,a.$sortable=n,h.data({"start-list":h.parent(),"start-index":h.index(),"sortable-group":n.options.group}),n.addDragHandlers(),n.options.start(this,r),n.trigger("start.uk.sortable",[n,r]),c=!0,u=!1}}}}},dragMove:function(e){var o,n=t.$(document.elementFromPoint(e.pageX-document.body.scrollLeft,e.pageY-(window.pageYOffset||document.documentElement.scrollTop))),s=n.closest("."+this.options.baseClass),a=s.data("sortable-group"),i=t.$(r),l=i.parent(),d=i.data("sortable-group");s[0]!==l[0]&&void 0!==d&&a===d&&(s.data("sortable").addDragHandlers(),p.push(s),s.children().addClass(this.options.childClass),s.children().length>0?(o=n.closest("."+this.options.childClass),o.length?o.before(i):s.append(i)):n.append(i),UIkit.$doc.trigger("mouseover")),this.checkEmptyList(),this.checkEmptyList(l)},dragEnter:function(e,o){if(!r||r===o)return!0;var n=this.dragenterData(o);return this.dragenterData(o,n+1),0===n&&(t.$(o).addClass(this.options.overClass),this.moveElementNextTo(r,o)),!1},dragEnd:function(e,o){var n=this;r&&(this.options.stop(o),this.trigger("stop.uk.sortable",[this])),r=null,i=null,p.push(this.element),p.forEach(function(e){t.$(e).children().each(function(){1===this.nodeType&&(t.$(this).removeClass(n.options.overClass).removeClass(n.options.placeholderClass).removeClass(n.options.childClass),n.dragenterData(this,!1))})}),p=[],t.$html.removeClass(this.options.dragMovingClass),this.removeDragHandlers(),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.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=0;r<a.attributes.length;r++)o=a.attributes[r],0===o.name.indexOf("data-")&&(e[o.name.substr(5)]=t.Utils.str2json(o.value));n.push(e)}),n},checkEmptyList:function(e){e=e?t.$(e):this.element,this.options.emptyClass&&e[e.children().length?"removeClass":"addClass"](this.options.emptyClass)}}),t.sortable});
|
@@ -0,0 +1,349 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == "function" && define.amd) {
|
11
|
+
define("uikit-sticky", ["uikit"], function(){
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
var $win = UI.$win,
|
21
|
+
$doc = UI.$doc,
|
22
|
+
sticked = [],
|
23
|
+
direction = 1;
|
24
|
+
|
25
|
+
UI.component('sticky', {
|
26
|
+
|
27
|
+
defaults: {
|
28
|
+
top : 0,
|
29
|
+
bottom : 0,
|
30
|
+
animation : '',
|
31
|
+
clsinit : 'uk-sticky-init',
|
32
|
+
clsactive : 'uk-active',
|
33
|
+
clsinactive : '',
|
34
|
+
getWidthFrom : '',
|
35
|
+
showup : false,
|
36
|
+
boundary : false,
|
37
|
+
media : false,
|
38
|
+
target : false,
|
39
|
+
disabled : false
|
40
|
+
},
|
41
|
+
|
42
|
+
boot: function() {
|
43
|
+
|
44
|
+
// should be more efficient than using $win.scroll(checkscrollposition):
|
45
|
+
UI.$doc.on('scrolling.uk.document', function(e, data) {
|
46
|
+
direction = data.dir.y;
|
47
|
+
checkscrollposition();
|
48
|
+
});
|
49
|
+
|
50
|
+
UI.$win.on('resize orientationchange', UI.Utils.debounce(function() {
|
51
|
+
|
52
|
+
if (!sticked.length) return;
|
53
|
+
|
54
|
+
for (var i = 0; i < sticked.length; i++) {
|
55
|
+
sticked[i].reset(true);
|
56
|
+
sticked[i].self.computeWrapper();
|
57
|
+
}
|
58
|
+
|
59
|
+
checkscrollposition();
|
60
|
+
}, 100));
|
61
|
+
|
62
|
+
// init code
|
63
|
+
UI.ready(function(context) {
|
64
|
+
|
65
|
+
setTimeout(function(){
|
66
|
+
|
67
|
+
UI.$("[data-uk-sticky]", context).each(function(){
|
68
|
+
|
69
|
+
var $ele = UI.$(this);
|
70
|
+
|
71
|
+
if(!$ele.data("sticky")) {
|
72
|
+
UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
checkscrollposition();
|
77
|
+
}, 0);
|
78
|
+
});
|
79
|
+
},
|
80
|
+
|
81
|
+
init: function() {
|
82
|
+
|
83
|
+
var wrapper = UI.$('<div class="uk-sticky-placeholder"></div>'), boundary = this.options.boundary, boundtoparent;
|
84
|
+
|
85
|
+
this.wrapper = this.element.css('margin', 0).wrap(wrapper).parent();
|
86
|
+
|
87
|
+
this.computeWrapper();
|
88
|
+
|
89
|
+
if (boundary) {
|
90
|
+
|
91
|
+
if (boundary === true) {
|
92
|
+
|
93
|
+
boundary = this.wrapper.parent();
|
94
|
+
boundtoparent = true;
|
95
|
+
|
96
|
+
} else if (typeof boundary === "string") {
|
97
|
+
boundary = UI.$(boundary);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
this.sticky = {
|
102
|
+
self : this,
|
103
|
+
options : this.options,
|
104
|
+
element : this.element,
|
105
|
+
currentTop : null,
|
106
|
+
wrapper : this.wrapper,
|
107
|
+
init : false,
|
108
|
+
getWidthFrom : this.options.getWidthFrom || this.wrapper,
|
109
|
+
boundary : boundary,
|
110
|
+
boundtoparent : boundtoparent,
|
111
|
+
top : 0,
|
112
|
+
calcTop : function() {
|
113
|
+
|
114
|
+
var top = this.options.top;
|
115
|
+
|
116
|
+
// dynamic top parameter
|
117
|
+
if (this.options.top && typeof(this.options.top) == 'string') {
|
118
|
+
|
119
|
+
// e.g. 50vh
|
120
|
+
if (this.options.top.match(/^(-|)(\d+)vh$/)) {
|
121
|
+
top = window.innerHeight * parseInt(this.options.top, 10)/100;
|
122
|
+
// e.g. #elementId, or .class-1,class-2,.class-3 (first found is used)
|
123
|
+
} else {
|
124
|
+
|
125
|
+
var topElement = UI.$(this.options.top).first();
|
126
|
+
|
127
|
+
if (topElement.length && topElement.is(':visible')) {
|
128
|
+
top = -1 * ((topElement.offset().top + topElement.outerHeight()) - this.wrapper.offset().top);
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
this.top = top;
|
135
|
+
},
|
136
|
+
reset : function(force) {
|
137
|
+
|
138
|
+
this.calcTop();
|
139
|
+
|
140
|
+
var finalize = function() {
|
141
|
+
this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
|
142
|
+
this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
|
143
|
+
this.element.addClass(this.options.clsinactive);
|
144
|
+
|
145
|
+
this.currentTop = null;
|
146
|
+
this.animate = false;
|
147
|
+
}.bind(this);
|
148
|
+
|
149
|
+
|
150
|
+
if (!force && this.options.animation && UI.support.animation && !UI.Utils.isInView(this.wrapper)) {
|
151
|
+
|
152
|
+
this.animate = true;
|
153
|
+
|
154
|
+
this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
|
155
|
+
finalize();
|
156
|
+
}).width(); // force redraw
|
157
|
+
|
158
|
+
this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
|
159
|
+
} else {
|
160
|
+
finalize();
|
161
|
+
}
|
162
|
+
},
|
163
|
+
|
164
|
+
check: function() {
|
165
|
+
|
166
|
+
if (this.options.disabled) {
|
167
|
+
return false;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (this.options.media) {
|
171
|
+
|
172
|
+
switch(typeof(this.options.media)) {
|
173
|
+
case 'number':
|
174
|
+
if (window.innerWidth < this.options.media) {
|
175
|
+
return false;
|
176
|
+
}
|
177
|
+
break;
|
178
|
+
case 'string':
|
179
|
+
if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
|
180
|
+
return false;
|
181
|
+
}
|
182
|
+
break;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
var scrollTop = $win.scrollTop(),
|
187
|
+
documentHeight = $doc.height(),
|
188
|
+
dwh = documentHeight - window.innerHeight,
|
189
|
+
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
190
|
+
elementTop = this.wrapper.offset().top,
|
191
|
+
etse = elementTop - this.top - extra,
|
192
|
+
active = (scrollTop >= etse);
|
193
|
+
|
194
|
+
if (active && this.options.showup) {
|
195
|
+
|
196
|
+
// set inactiv if scrolling down
|
197
|
+
if (direction == 1) {
|
198
|
+
active = false;
|
199
|
+
}
|
200
|
+
|
201
|
+
// set inactive when wrapper is still in view
|
202
|
+
if (direction == -1 && !this.element.hasClass(this.options.clsactive) && UI.Utils.isInView(this.wrapper)) {
|
203
|
+
active = false;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
return active;
|
208
|
+
}
|
209
|
+
};
|
210
|
+
|
211
|
+
this.sticky.calcTop();
|
212
|
+
|
213
|
+
sticked.push(this.sticky);
|
214
|
+
},
|
215
|
+
|
216
|
+
update: function() {
|
217
|
+
checkscrollposition(this.sticky);
|
218
|
+
},
|
219
|
+
|
220
|
+
enable: function() {
|
221
|
+
this.options.disabled = false;
|
222
|
+
this.update();
|
223
|
+
},
|
224
|
+
|
225
|
+
disable: function(force) {
|
226
|
+
this.options.disabled = true;
|
227
|
+
this.sticky.reset(force);
|
228
|
+
},
|
229
|
+
|
230
|
+
computeWrapper: function() {
|
231
|
+
|
232
|
+
this.wrapper.css({
|
233
|
+
'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
|
234
|
+
'float' : this.element.css('float') != 'none' ? this.element.css('float') : '',
|
235
|
+
'margin' : this.element.css('margin')
|
236
|
+
});
|
237
|
+
}
|
238
|
+
});
|
239
|
+
|
240
|
+
function checkscrollposition(direction) {
|
241
|
+
|
242
|
+
var stickies = arguments.length ? arguments : sticked;
|
243
|
+
|
244
|
+
if (!stickies.length || $win.scrollTop() < 0) return;
|
245
|
+
|
246
|
+
var scrollTop = $win.scrollTop(),
|
247
|
+
documentHeight = $doc.height(),
|
248
|
+
windowHeight = $win.height(),
|
249
|
+
dwh = documentHeight - windowHeight,
|
250
|
+
extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
|
251
|
+
newTop, containerBottom, stickyHeight, sticky;
|
252
|
+
|
253
|
+
for (var i = 0; i < stickies.length; i++) {
|
254
|
+
|
255
|
+
sticky = stickies[i];
|
256
|
+
|
257
|
+
if (!sticky.element.is(":visible") || sticky.animate) {
|
258
|
+
continue;
|
259
|
+
}
|
260
|
+
|
261
|
+
if (!sticky.check()) {
|
262
|
+
|
263
|
+
if (sticky.currentTop !== null) {
|
264
|
+
sticky.reset();
|
265
|
+
}
|
266
|
+
|
267
|
+
} else {
|
268
|
+
|
269
|
+
if (sticky.top < 0) {
|
270
|
+
newTop = 0;
|
271
|
+
} else {
|
272
|
+
stickyHeight = sticky.element.outerHeight();
|
273
|
+
newTop = documentHeight - stickyHeight - sticky.top - sticky.options.bottom - scrollTop - extra;
|
274
|
+
newTop = newTop < 0 ? newTop + sticky.top : sticky.top;
|
275
|
+
}
|
276
|
+
|
277
|
+
if (sticky.boundary && sticky.boundary.length) {
|
278
|
+
|
279
|
+
var bTop = sticky.boundary.offset().top;
|
280
|
+
|
281
|
+
if (sticky.boundtoparent) {
|
282
|
+
containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
|
283
|
+
} else {
|
284
|
+
containerBottom = documentHeight - bTop - parseInt(sticky.boundary.css('margin-top'));
|
285
|
+
}
|
286
|
+
|
287
|
+
newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
|
288
|
+
}
|
289
|
+
|
290
|
+
|
291
|
+
if (sticky.currentTop != newTop) {
|
292
|
+
|
293
|
+
sticky.element.css({
|
294
|
+
"position" : "fixed",
|
295
|
+
"top" : newTop,
|
296
|
+
"width" : (typeof sticky.getWidthFrom !== 'undefined') ? UI.$(sticky.getWidthFrom).width() : sticky.element.width(),
|
297
|
+
"left" : sticky.wrapper.offset().left
|
298
|
+
});
|
299
|
+
|
300
|
+
if (!sticky.init) {
|
301
|
+
|
302
|
+
sticky.element.addClass(sticky.options.clsinit);
|
303
|
+
|
304
|
+
if (location.hash && scrollTop > 0 && sticky.options.target) {
|
305
|
+
|
306
|
+
var $target = UI.$(location.hash);
|
307
|
+
|
308
|
+
if ($target.length) {
|
309
|
+
|
310
|
+
setTimeout((function($target, sticky){
|
311
|
+
|
312
|
+
return function() {
|
313
|
+
|
314
|
+
sticky.element.width(); // force redraw
|
315
|
+
|
316
|
+
var offset = $target.offset(),
|
317
|
+
maxoffset = offset.top + $target.outerHeight(),
|
318
|
+
stickyOffset = sticky.element.offset(),
|
319
|
+
stickyHeight = sticky.element.outerHeight(),
|
320
|
+
stickyMaxOffset = stickyOffset.top + stickyHeight;
|
321
|
+
|
322
|
+
if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
|
323
|
+
scrollTop = offset.top - stickyHeight - sticky.options.target;
|
324
|
+
window.scrollTo(0, scrollTop);
|
325
|
+
}
|
326
|
+
};
|
327
|
+
|
328
|
+
})($target, sticky), 0);
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
sticky.element.addClass(sticky.options.clsactive).removeClass(sticky.options.clsinactive);
|
334
|
+
sticky.element.css('margin', '');
|
335
|
+
|
336
|
+
if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) {
|
337
|
+
sticky.element.addClass(sticky.options.animation);
|
338
|
+
}
|
339
|
+
|
340
|
+
sticky.currentTop = newTop;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
sticky.init = true;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
348
|
+
return UI.sticky;
|
349
|
+
});
|
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(t){var i;window.UIkit&&(i=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-sticky",["uikit"],function(){return i||t(UIkit)})}(function(t){"use strict";function i(){var i=arguments.length?arguments:o;if(i.length&&!(e.scrollTop()<0))for(var s,a,r,p,h=e.scrollTop(),c=n.height(),l=e.height(),u=c-l,d=h>u?u-h:0,m=0;m<i.length;m++)if(p=i[m],p.element.is(":visible")&&!p.animate){if(p.check()){if(p.top<0?s=0:(r=p.element.outerHeight(),s=c-r-p.top-p.options.bottom-h-d,s=0>s?s+p.top:p.top),p.boundary&&p.boundary.length){var f=p.boundary.offset().top;a=p.boundtoparent?c-(f+p.boundary.outerHeight())+parseInt(p.boundary.css("padding-bottom")):c-f-parseInt(p.boundary.css("margin-top")),s=h+r>c-a-(p.top<0?0:p.top)?c-a-(h+r):s}if(p.currentTop!=s){if(p.element.css({position:"fixed",top:s,width:"undefined"!=typeof p.getWidthFrom?t.$(p.getWidthFrom).width():p.element.width(),left:p.wrapper.offset().left}),!p.init&&(p.element.addClass(p.options.clsinit),location.hash&&h>0&&p.options.target)){var g=t.$(location.hash);g.length&&setTimeout(function(t,i){return function(){i.element.width();var e=t.offset(),n=e.top+t.outerHeight(),o=i.element.offset(),s=i.element.outerHeight(),a=o.top+s;o.top<n&&e.top<a&&(h=e.top-s-i.options.target,window.scrollTo(0,h))}}(g,p),0)}p.element.addClass(p.options.clsactive).removeClass(p.options.clsinactive),p.element.css("margin",""),p.options.animation&&p.init&&!t.Utils.isInView(p.wrapper)&&p.element.addClass(p.options.animation),p.currentTop=s}}else null!==p.currentTop&&p.reset();p.init=!0}}var e=t.$win,n=t.$doc,o=[],s=1;return t.component("sticky",{defaults:{top:0,bottom:0,animation:"",clsinit:"uk-sticky-init",clsactive:"uk-active",clsinactive:"",getWidthFrom:"",showup:!1,boundary:!1,media:!1,target:!1,disabled:!1},boot:function(){t.$doc.on("scrolling.uk.document",function(t,e){s=e.dir.y,i()}),t.$win.on("resize orientationchange",t.Utils.debounce(function(){if(o.length){for(var t=0;t<o.length;t++)o[t].reset(!0),o[t].self.computeWrapper();i()}},100)),t.ready(function(e){setTimeout(function(){t.$("[data-uk-sticky]",e).each(function(){var i=t.$(this);i.data("sticky")||t.sticky(i,t.Utils.options(i.attr("data-uk-sticky")))}),i()},0)})},init:function(){var i,a=t.$('<div class="uk-sticky-placeholder"></div>'),r=this.options.boundary;this.wrapper=this.element.css("margin",0).wrap(a).parent(),this.computeWrapper(),r&&(r===!0?(r=this.wrapper.parent(),i=!0):"string"==typeof r&&(r=t.$(r))),this.sticky={self:this,options:this.options,element:this.element,currentTop:null,wrapper:this.wrapper,init:!1,getWidthFrom:this.options.getWidthFrom||this.wrapper,boundary:r,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.currentTop=null,this.animate=!1}.bind(this);!i&&this.options.animation&&t.support.animation&&!t.Utils.isInView(this.wrapper)?(this.animate=!0,this.element.removeClass(this.options.animation).one(t.support.animation.end,function(){e()}).width(),this.element.addClass(this.options.animation+" uk-animation-reverse")):e()},check:function(){if(this.options.disabled)return!1;if(this.options.media)switch(typeof this.options.media){case"number":if(window.innerWidth<this.options.media)return!1;break;case"string":if(window.matchMedia&&!window.matchMedia(this.options.media).matches)return!1}var i=e.scrollTop(),o=n.height(),a=o-window.innerHeight,r=i>a?a-i:0,p=this.wrapper.offset().top,h=p-this.top-r,c=i>=h;return c&&this.options.showup&&(1==s&&(c=!1),-1==s&&!this.element.hasClass(this.options.clsactive)&&t.Utils.isInView(this.wrapper)&&(c=!1)),c}},this.sticky.calcTop(),o.push(this.sticky)},update:function(){i(this.sticky)},enable:function(){this.options.disabled=!1,this.update()},disable:function(t){this.options.disabled=!0,this.sticky.reset(t)},computeWrapper:function(){this.wrapper.css({height:-1==["absolute","fixed"].indexOf(this.element.css("position"))?this.element.outerHeight():"","float":"none"!=this.element.css("float")?this.element.css("float"):"",margin:this.element.css("margin")})}}),t.sticky});
|
@@ -0,0 +1,192 @@
|
|
1
|
+
/*! UIkit 2.22.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
|
4
|
+
var component;
|
5
|
+
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
|
+
}
|
9
|
+
|
10
|
+
if (typeof define == "function" && define.amd) {
|
11
|
+
define("uikit-search", ["uikit"], function(){
|
12
|
+
return component || addon(UIkit);
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
19
|
+
|
20
|
+
|
21
|
+
UI.component('timepicker', {
|
22
|
+
|
23
|
+
defaults: {
|
24
|
+
format : '24h',
|
25
|
+
delay : 0,
|
26
|
+
start : 0,
|
27
|
+
end : 24
|
28
|
+
},
|
29
|
+
|
30
|
+
boot: function() {
|
31
|
+
|
32
|
+
// init code
|
33
|
+
UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
|
34
|
+
|
35
|
+
var ele = UI.$(this);
|
36
|
+
|
37
|
+
if (!ele.data("timepicker")) {
|
38
|
+
var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
|
39
|
+
|
40
|
+
setTimeout(function(){
|
41
|
+
obj.autocomplete.input.focus();
|
42
|
+
}, 40);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
},
|
46
|
+
|
47
|
+
init: function() {
|
48
|
+
|
49
|
+
var $this = this, times = getTimeRange(this.options.start, this.options.end), container;
|
50
|
+
|
51
|
+
this.options.minLength = 0;
|
52
|
+
this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>';
|
53
|
+
|
54
|
+
this.options.source = function(release) {
|
55
|
+
release(times[$this.options.format] || times['12h']);
|
56
|
+
};
|
57
|
+
|
58
|
+
if (this.element.is('input')) {
|
59
|
+
this.element.wrap('<div class="uk-autocomplete"></div>');
|
60
|
+
container = this.element.parent();
|
61
|
+
} else {
|
62
|
+
container = this.element.addClass('uk-autocomplete');
|
63
|
+
}
|
64
|
+
|
65
|
+
this.autocomplete = UI.autocomplete(container, this.options);
|
66
|
+
this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
|
67
|
+
|
68
|
+
this.autocomplete.on('show.uk.autocomplete', function() {
|
69
|
+
|
70
|
+
var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
|
71
|
+
|
72
|
+
setTimeout(function(){
|
73
|
+
$this.autocomplete.pick(selected, true);
|
74
|
+
}, 10);
|
75
|
+
});
|
76
|
+
|
77
|
+
this.autocomplete.input.on('focus', function(){
|
78
|
+
|
79
|
+
$this.autocomplete.value = Math.random();
|
80
|
+
$this.autocomplete.triggercomplete();
|
81
|
+
|
82
|
+
}).on('blur', UI.Utils.debounce(function() {
|
83
|
+
$this.checkTime();
|
84
|
+
}, 100));
|
85
|
+
|
86
|
+
this.element.data("timepicker", this);
|
87
|
+
},
|
88
|
+
|
89
|
+
checkTime: function() {
|
90
|
+
|
91
|
+
var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
|
92
|
+
|
93
|
+
if (this.options.format == '12h') {
|
94
|
+
arr = time.split(' ');
|
95
|
+
timeArray = arr[0].split(':');
|
96
|
+
meridian = arr[1];
|
97
|
+
} else {
|
98
|
+
timeArray = time.split(':');
|
99
|
+
}
|
100
|
+
|
101
|
+
hour = parseInt(timeArray[0], 10);
|
102
|
+
minute = parseInt(timeArray[1], 10);
|
103
|
+
|
104
|
+
if (isNaN(hour)) hour = 0;
|
105
|
+
if (isNaN(minute)) minute = 0;
|
106
|
+
|
107
|
+
if (this.options.format == '12h') {
|
108
|
+
if (hour > 12) {
|
109
|
+
hour = 12;
|
110
|
+
} else if (hour < 0) {
|
111
|
+
hour = 12;
|
112
|
+
}
|
113
|
+
|
114
|
+
if (meridian === 'am' || meridian === 'a') {
|
115
|
+
meridian = 'AM';
|
116
|
+
} else if (meridian === 'pm' || meridian === 'p') {
|
117
|
+
meridian = 'PM';
|
118
|
+
}
|
119
|
+
|
120
|
+
if (meridian !== 'AM' && meridian !== 'PM') {
|
121
|
+
meridian = 'AM';
|
122
|
+
}
|
123
|
+
|
124
|
+
} else {
|
125
|
+
|
126
|
+
if (hour >= 24) {
|
127
|
+
hour = 23;
|
128
|
+
} else if (hour < 0) {
|
129
|
+
hour = 0;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
if (minute < 0) {
|
134
|
+
minute = 0;
|
135
|
+
} else if (minute >= 60) {
|
136
|
+
minute = 0;
|
137
|
+
}
|
138
|
+
|
139
|
+
this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
|
140
|
+
},
|
141
|
+
|
142
|
+
formatTime: function(hour, minute, meridian) {
|
143
|
+
hour = hour < 10 ? '0' + hour : hour;
|
144
|
+
minute = minute < 10 ? '0' + minute : minute;
|
145
|
+
return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
|
146
|
+
}
|
147
|
+
});
|
148
|
+
|
149
|
+
// helper
|
150
|
+
|
151
|
+
function getTimeRange(start, end) {
|
152
|
+
|
153
|
+
start = start || 0;
|
154
|
+
end = end || 24;
|
155
|
+
|
156
|
+
var times = {'12h':[], '24h':[]}, i, h;
|
157
|
+
|
158
|
+
for (i = start, h=''; i<end; i++) {
|
159
|
+
|
160
|
+
h = ''+i;
|
161
|
+
|
162
|
+
if (i<10) h = '0'+h;
|
163
|
+
|
164
|
+
times['24h'].push({value: (h+':00')});
|
165
|
+
times['24h'].push({value: (h+':30')});
|
166
|
+
|
167
|
+
if (i === 0) {
|
168
|
+
h = 12;
|
169
|
+
times['12h'].push({value: (h+':00 AM')});
|
170
|
+
times['12h'].push({value: (h+':30 AM')});
|
171
|
+
}
|
172
|
+
|
173
|
+
if (i > 0 && i<13 && i!==12) {
|
174
|
+
times['12h'].push({value: (h+':00 AM')});
|
175
|
+
times['12h'].push({value: (h+':30 AM')});
|
176
|
+
}
|
177
|
+
|
178
|
+
if (i >= 12) {
|
179
|
+
|
180
|
+
h = h-12;
|
181
|
+
if (h === 0) h = 12;
|
182
|
+
if (h < 10) h = '0'+String(h);
|
183
|
+
|
184
|
+
times['12h'].push({value: (h+':00 PM')});
|
185
|
+
times['12h'].push({value: (h+':30 PM')});
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
return times;
|
190
|
+
}
|
191
|
+
|
192
|
+
});
|