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