adminlte2-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/README.md +19 -0
  4. data/lib/adminlte2/rails/version.rb +1 -1
  5. data/lib/generators/admin_lte_plugins/USAGE +28 -0
  6. data/lib/generators/admin_lte_plugins/admin_lte_plugins_generator.rb +100 -0
  7. data/lib/generators/admin_lte_plugins/templates/ChartJS/Chart.js +3457 -0
  8. data/lib/generators/admin_lte_plugins/templates/Sparkline/jquery.sparkline.js +3054 -0
  9. data/lib/generators/admin_lte_plugins/templates/bootstrap-slider/bootstrap-slider.js +1167 -0
  10. data/lib/generators/admin_lte_plugins/templates/bootstrap-slider/slider.css +169 -0
  11. data/lib/generators/admin_lte_plugins/templates/bootstrap-wysihtml5/bootstrap3-wysihtml5.css +102 -0
  12. data/lib/generators/admin_lte_plugins/templates/bootstrap-wysihtml5/bootstrap3-wysihtml5.js +350 -0
  13. data/lib/generators/admin_lte_plugins/templates/colorpicker/bootstrap-colorpicker.css +214 -0
  14. data/lib/generators/admin_lte_plugins/templates/colorpicker/bootstrap-colorpicker.js +949 -0
  15. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/alpha-horizontal.png +0 -0
  16. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/alpha.png +0 -0
  17. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/hue-horizontal.png +0 -0
  18. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/hue.png +0 -0
  19. data/lib/generators/admin_lte_plugins/templates/colorpicker/img/saturation.png +0 -0
  20. data/lib/generators/admin_lte_plugins/templates/datepicker/bootstrap-datepicker.js +1671 -0
  21. data/lib/generators/admin_lte_plugins/templates/datepicker/datepicker3.css +790 -0
  22. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ar.js +15 -0
  23. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.az.js +12 -0
  24. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.bg.js +14 -0
  25. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ca.js +14 -0
  26. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.cs.js +15 -0
  27. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.cy.js +14 -0
  28. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.da.js +15 -0
  29. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.de.js +17 -0
  30. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.el.js +13 -0
  31. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.es.js +14 -0
  32. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.et.js +18 -0
  33. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fa.js +17 -0
  34. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fi.js +16 -0
  35. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.fr.js +17 -0
  36. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.gl.js +11 -0
  37. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.he.js +15 -0
  38. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.hr.js +13 -0
  39. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.hu.js +16 -0
  40. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.id.js +15 -0
  41. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.is.js +14 -0
  42. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.it.js +17 -0
  43. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ja.js +15 -0
  44. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ka.js +17 -0
  45. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.kk.js +15 -0
  46. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.kr.js +13 -0
  47. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.lt.js +16 -0
  48. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.lv.js +16 -0
  49. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.mk.js +15 -0
  50. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ms.js +14 -0
  51. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nb.js +14 -0
  52. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nl-BE.js +17 -0
  53. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.nl.js +14 -0
  54. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.no.js +16 -0
  55. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pl.js +15 -0
  56. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pt-BR.js +15 -0
  57. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.pt.js +16 -0
  58. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ro.js +16 -0
  59. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.rs-latin.js +14 -0
  60. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.rs.js +14 -0
  61. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ru.js +15 -0
  62. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sk.js +15 -0
  63. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sl.js +14 -0
  64. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sq.js +15 -0
  65. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sv.js +16 -0
  66. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.sw.js +15 -0
  67. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.th.js +14 -0
  68. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.tr.js +16 -0
  69. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.ua.js +15 -0
  70. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.vi.js +16 -0
  71. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.zh-CN.js +16 -0
  72. data/lib/generators/admin_lte_plugins/templates/datepicker/locales/bootstrap-datepicker.zh-TW.js +17 -0
  73. data/lib/generators/admin_lte_plugins/templates/daterangepicker/daterangepicker-bs3.css +245 -0
  74. data/lib/generators/admin_lte_plugins/templates/daterangepicker/daterangepicker.js +883 -0
  75. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.css +977 -0
  76. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.js +9732 -0
  77. data/lib/generators/admin_lte_plugins/templates/fullcalendar/fullcalendar.print.css +202 -0
  78. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-1.2.2.css +40 -0
  79. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-1.2.2.min.js +8 -0
  80. data/lib/generators/admin_lte_plugins/templates/jVectorMap/jquery-jvectormap-world-mill-en.js +1 -0
  81. data/lib/generators/admin_lte_plugins/templates/knob/jquery.knob.js +805 -0
  82. data/lib/generators/admin_lte_plugins/templates/morris/morris.css +2 -0
  83. data/lib/generators/admin_lte_plugins/templates/morris/morris.js +1892 -0
  84. data/lib/generators/admin_lte_plugins/templates/pace/pace.js +2 -0
  85. data/lib/generators/admin_lte_plugins/templates/timepicker/bootstrap-timepicker.css +121 -0
  86. data/lib/generators/admin_lte_plugins/templates/timepicker/bootstrap-timepicker.js +903 -0
  87. metadata +83 -1
@@ -0,0 +1,2 @@
1
+ /*! pace 1.0.0 */
2
+ (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].slice,Y={}.hasOwnProperty,Z=function(a,b){function c(){this.constructor=a}for(var d in b)Y.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},$=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(u={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!0,ignoreURLs:[]}},C=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?a:+new Date},E=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,t=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==E&&(E=function(a){return setTimeout(a,50)},t=function(a){return clearTimeout(a)}),G=function(a){var b,c;return b=C(),(c=function(){var d;return d=C()-b,d>=33?(b=C(),a(d,function(){return E(c)})):setTimeout(c,33-d)})()},F=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?X.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},v=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?X.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)Y.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?v(b[a],e):b[a]=e);return b},q=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},x=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)e.push(this.bindings[a][c].handler===b?this.bindings[a].splice(c,1):c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),i.push(f?this.bindings[c].splice(e,1):e++);return i}},a}(),j=window.Pace||{},window.Pace=j,v(j,g.prototype),D=j.options=v({},u,window.paceOptions,x()),U=["ajax","document","eventLag","elements"],Q=0,S=U.length;S>Q;Q++)K=U[Q],D[K]===!0&&(D[K]=u[K]);i=function(a){function b(){return V=b.__super__.constructor.apply(this,arguments)}return Z(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(D.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace(/pace-done/g,""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b,c,d,e,f,g;if(null==document.querySelector(D.target))return!1;for(a=this.getElement(),d="translate3d("+this.progress+"%, 0, 0)",g=["webkitTransform","msTransform","transform"],e=0,f=g.length;f>e;e++)b=g[e],a.children[0].style[b]=d;return(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?c="99":(c=this.progress<10?"0":"",c+=0|this.progress),a.children[0].setAttribute("data-progress",""+c)),this.lastRenderedProgress=this.progress},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),P=window.XMLHttpRequest,O=window.XDomainRequest,N=window.WebSocket,w=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],f.push(null==a[d]&&"function"!=typeof e?a[d]=e:void 0)}catch(g){c=g}return f},A=[],j.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("ignore"),c=b.apply(null,a),A.shift(),c},j.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?X.call(arguments,1):[],A.unshift("track"),c=b.apply(null,a),A.shift(),c},J=function(a){var b;if(null==a&&(a="GET"),"track"===A[0])return"force";if(!A.length&&D.ajax){if("socket"===a&&D.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),$.call(D.ajax.trackMethods,b)>=0)return!0}return!1},k=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return J(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new P(b),a(c),c};try{w(window.XMLHttpRequest,P)}catch(d){}if(null!=O){window.XDomainRequest=function(){var b;return b=new O,a(b),b};try{w(window.XDomainRequest,O)}catch(d){}}if(null!=N&&D.ajax.trackWebSockets){window.WebSocket=function(a,b){var d;return d=null!=b?new N(a,b):new N(a),J("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d};try{w(window.WebSocket,N)}catch(d){}}}return Z(b,a),b}(h),R=null,y=function(){return null==R&&(R=new k),R},I=function(a){var b,c,d,e;for(e=D.ajax.ignoreURLs,c=0,d=e.length;d>c;c++)if(b=e[c],"string"==typeof b){if(-1!==a.indexOf(b))return!0}else if(b.test(a))return!0;return!1},y().on("request",function(b){var c,d,e,f,g;return f=b.type,e=b.request,g=b.url,I(g)?void 0:j.running||D.restartOnRequestAfter===!1&&"force"!==J(f)?void 0:(d=arguments,c=D.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,k;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(j.restart(),i=j.sources,k=[],c=0,g=i.length;g>c;c++){if(K=i[c],K instanceof a){K.watch.apply(K,d);break}k.push(void 0)}return k}},c))}),a=function(){function a(){var a=this;this.elements=[],y().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d,e;return d=a.type,b=a.request,e=a.url,I(e)?void 0:(c="socket"===d?new n(b):new o(b),this.elements.push(c))},a}(),o=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2},!1),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100},!1);else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),n=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100},!1)}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},D.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=C(),b=setInterval(function(){var g;return g=C()-c-50,c=C(),e.push(g),e.length>D.eventLag.sampleCount&&e.shift(),a=q(e),++d>=D.eventLag.minSamples&&a<D.eventLag.lagThreshold?(f.progress=100,clearInterval(b)):f.progress=100*(3/(a+3))},50)}return a}(),m=function(){function a(a){this.source=a,this.last=this.sinceLastUpdate=0,this.rate=D.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=F(this.source,"progress"))}return a.prototype.tick=function(a,b){var c;return null==b&&(b=F(this.source,"progress")),b>=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/D.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,D.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+D.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),L=null,H=null,r=null,M=null,p=null,s=null,j.running=!1,z=function(){return D.restartOnPushState?j.restart():void 0},null!=window.history.pushState&&(T=window.history.pushState,window.history.pushState=function(){return z(),T.apply(window.history,arguments)}),null!=window.history.replaceState&&(W=window.history.replaceState,window.history.replaceState=function(){return z(),W.apply(window.history,arguments)}),l={ajax:a,elements:d,document:c,eventLag:f},(B=function(){var a,c,d,e,f,g,h,i;for(j.sources=L=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],D[a]!==!1&&L.push(new l[a](D[a]));for(i=null!=(h=D.extraSources)?h:[],d=0,f=i.length;f>d;d++)K=i[d],L.push(new K(D));return j.bar=r=new b,H=[],M=new m})(),j.stop=function(){return j.trigger("stop"),j.running=!1,r.destroy(),s=!0,null!=p&&("function"==typeof t&&t(p),p=null),B()},j.restart=function(){return j.trigger("restart"),j.stop(),j.start()},j.go=function(){var a;return j.running=!0,r.render(),a=C(),s=!1,p=G(function(b,c){var d,e,f,g,h,i,k,l,n,o,p,q,t,u,v,w;for(l=100-r.progress,e=p=0,f=!0,i=q=0,u=L.length;u>q;i=++q)for(K=L[i],o=null!=H[i]?H[i]:H[i]=[],h=null!=(w=K.elements)?w:[K],k=t=0,v=h.length;v>t;k=++t)g=h[k],n=null!=o[k]?o[k]:o[k]=new m(g),f&=n.done,n.done||(e++,p+=n.tick(b));return d=p/e,r.update(M.tick(b,d)),r.done()||f||s?(r.update(100),j.trigger("done"),setTimeout(function(){return r.finish(),j.running=!1,j.trigger("hide")},Math.max(D.ghostTime,Math.max(D.minTime-(C()-a),0)))):c()})},j.start=function(a){v(D,a),j.running=!0;try{r.render()}catch(b){i=b}return document.querySelector(".pace")?(j.trigger("start"),j.go()):setTimeout(j.start,50)},"function"==typeof define&&define.amd?define(function(){return j}):"object"==typeof exports?module.exports=j:D.startOnPageLoad&&j.start()}).call(this);
@@ -0,0 +1,121 @@
1
+ /*!
2
+ * Timepicker Component for Twitter Bootstrap
3
+ *
4
+ * Copyright 2013 Joris de Wit
5
+ *
6
+ * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+ .bootstrap-timepicker {
12
+ position: relative;
13
+ }
14
+ .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu {
15
+ left: auto;
16
+ right: 0;
17
+ }
18
+ .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:before {
19
+ left: auto;
20
+ right: 12px;
21
+ }
22
+ .bootstrap-timepicker.pull-right .bootstrap-timepicker-widget.dropdown-menu:after {
23
+ left: auto;
24
+ right: 13px;
25
+ }
26
+ .bootstrap-timepicker .add-on {
27
+ cursor: pointer;
28
+ }
29
+ .bootstrap-timepicker .add-on i {
30
+ display: inline-block;
31
+ width: 16px;
32
+ height: 16px;
33
+ }
34
+ .bootstrap-timepicker-widget.dropdown-menu {
35
+ padding: 2px 3px 2px 2px;
36
+ }
37
+ .bootstrap-timepicker-widget.dropdown-menu.open {
38
+ display: inline-block;
39
+ }
40
+ .bootstrap-timepicker-widget.dropdown-menu:before {
41
+ border-bottom: 7px solid rgba(0, 0, 0, 0.2);
42
+ border-left: 7px solid transparent;
43
+ border-right: 7px solid transparent;
44
+ content: "";
45
+ display: inline-block;
46
+ left: 9px;
47
+ position: absolute;
48
+ top: -7px;
49
+ }
50
+ .bootstrap-timepicker-widget.dropdown-menu:after {
51
+ border-bottom: 6px solid #FFFFFF;
52
+ border-left: 6px solid transparent;
53
+ border-right: 6px solid transparent;
54
+ content: "";
55
+ display: inline-block;
56
+ left: 10px;
57
+ position: absolute;
58
+ top: -6px;
59
+ }
60
+ .bootstrap-timepicker-widget a.btn,
61
+ .bootstrap-timepicker-widget input {
62
+ border-radius: 4px;
63
+ }
64
+ .bootstrap-timepicker-widget table {
65
+ width: 100%;
66
+ margin: 0;
67
+ }
68
+ .bootstrap-timepicker-widget table td {
69
+ text-align: center;
70
+ height: 30px;
71
+ margin: 0;
72
+ padding: 2px;
73
+ }
74
+ .bootstrap-timepicker-widget table td:not(.separator) {
75
+ min-width: 30px;
76
+ }
77
+ .bootstrap-timepicker-widget table td span {
78
+ width: 100%;
79
+ }
80
+ .bootstrap-timepicker-widget table td a {
81
+ border: 1px transparent solid;
82
+ width: 100%;
83
+ display: inline-block;
84
+ margin: 0;
85
+ padding: 8px 0;
86
+ outline: 0;
87
+ color: #333;
88
+ }
89
+ .bootstrap-timepicker-widget table td a:hover {
90
+ text-decoration: none;
91
+ background-color: #eee;
92
+ -webkit-border-radius: 4px;
93
+ -moz-border-radius: 4px;
94
+ border-radius: 4px;
95
+ border-color: #ddd;
96
+ }
97
+ .bootstrap-timepicker-widget table td a i {
98
+ margin-top: 2px;
99
+ }
100
+ .bootstrap-timepicker-widget table td input {
101
+ width: 25px;
102
+ margin: 0;
103
+ text-align: center;
104
+ }
105
+ .bootstrap-timepicker-widget .modal-content {
106
+ padding: 4px;
107
+ }
108
+ @media (min-width: 767px) {
109
+ .bootstrap-timepicker-widget.modal {
110
+ width: 200px;
111
+ margin-left: -100px;
112
+ }
113
+ }
114
+ @media (max-width: 767px) {
115
+ .bootstrap-timepicker {
116
+ width: 100%;
117
+ }
118
+ .bootstrap-timepicker .dropdown-menu {
119
+ width: 100%;
120
+ }
121
+ }
@@ -0,0 +1,903 @@
1
+ //TODO: move arrow styles and button click code into configurable items, with defaults matching the existing code
2
+
3
+ /*!
4
+ * Timepicker Component for Twitter Bootstrap
5
+ *
6
+ * Copyright 2013 Joris de Wit
7
+ *
8
+ * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+ (function($, window, document, undefined) {
14
+ 'use strict';
15
+
16
+ // TIMEPICKER PUBLIC CLASS DEFINITION
17
+ var Timepicker = function(element, options) {
18
+ this.widget = '';
19
+ this.$element = $(element);
20
+ this.defaultTime = options.defaultTime;
21
+ this.disableFocus = options.disableFocus;
22
+ this.isOpen = options.isOpen;
23
+ this.minuteStep = options.minuteStep;
24
+ this.modalBackdrop = options.modalBackdrop;
25
+ this.secondStep = options.secondStep;
26
+ this.showInputs = options.showInputs;
27
+ this.showMeridian = options.showMeridian;
28
+ this.showSeconds = options.showSeconds;
29
+ this.template = options.template;
30
+ this.appendWidgetTo = options.appendWidgetTo;
31
+ this.upArrowStyle = options.upArrowStyle;
32
+ this.downArrowStyle = options.downArrowStyle;
33
+ this.containerClass = options.containerClass;
34
+
35
+ this._init();
36
+ };
37
+
38
+ Timepicker.prototype = {
39
+
40
+ constructor: Timepicker,
41
+
42
+ _init: function() {
43
+ var self = this;
44
+
45
+ if (this.$element.parent().hasClass('input-append') || this.$element.parent().hasClass('input-prepend')) {
46
+ if (this.$element.parent('.input-append, .input-prepend').find('.add-on').length) {
47
+ this.$element.parent('.input-append, .input-prepend').find('.add-on').on({
48
+ 'click.timepicker': $.proxy(this.showWidget, this)
49
+ });
50
+ } else {
51
+ this.$element.closest(this.containerClass).find('.add-on').on({
52
+ 'click.timepicker': $.proxy(this.showWidget, this)
53
+ });
54
+ }
55
+
56
+ this.$element.on({
57
+ 'focus.timepicker': $.proxy(this.highlightUnit, this),
58
+ 'click.timepicker': $.proxy(this.highlightUnit, this),
59
+ 'keydown.timepicker': $.proxy(this.elementKeydown, this),
60
+ 'blur.timepicker': $.proxy(this.blurElement, this)
61
+ });
62
+ } else {
63
+ if (this.template) {
64
+ this.$element.on({
65
+ 'focus.timepicker': $.proxy(this.showWidget, this),
66
+ 'click.timepicker': $.proxy(this.showWidget, this),
67
+ 'blur.timepicker': $.proxy(this.blurElement, this)
68
+ });
69
+ } else {
70
+ this.$element.on({
71
+ 'focus.timepicker': $.proxy(this.highlightUnit, this),
72
+ 'click.timepicker': $.proxy(this.highlightUnit, this),
73
+ 'keydown.timepicker': $.proxy(this.elementKeydown, this),
74
+ 'blur.timepicker': $.proxy(this.blurElement, this)
75
+ });
76
+ }
77
+ }
78
+
79
+ if (this.template !== false) {
80
+ this.$widget = $(this.getTemplate()).prependTo(this.$element.parents(this.appendWidgetTo)).on('click', $.proxy(this.widgetClick, this));
81
+ } else {
82
+ this.$widget = false;
83
+ }
84
+
85
+ if (this.showInputs && this.$widget !== false) {
86
+ this.$widget.find('input').each(function() {
87
+ $(this).on({
88
+ 'click.timepicker': function() { $(this).select(); },
89
+ 'keydown.timepicker': $.proxy(self.widgetKeydown, self)
90
+ });
91
+ });
92
+ }
93
+
94
+ this.setDefaultTime(this.defaultTime);
95
+ },
96
+
97
+ blurElement: function() {
98
+ this.highlightedUnit = undefined;
99
+ this.updateFromElementVal();
100
+ },
101
+
102
+ decrementHour: function() {
103
+ if (this.showMeridian) {
104
+ if (this.hour === 1) {
105
+ this.hour = 12;
106
+ } else if (this.hour === 12) {
107
+ this.hour--;
108
+
109
+ return this.toggleMeridian();
110
+ } else if (this.hour === 0) {
111
+ this.hour = 11;
112
+
113
+ return this.toggleMeridian();
114
+ } else {
115
+ this.hour--;
116
+ }
117
+ } else {
118
+ if (this.hour === 0) {
119
+ this.hour = 23;
120
+ } else {
121
+ this.hour--;
122
+ }
123
+ }
124
+ this.update();
125
+ },
126
+
127
+ decrementMinute: function(step) {
128
+ var newVal;
129
+
130
+ if (step) {
131
+ newVal = this.minute - step;
132
+ } else {
133
+ newVal = this.minute - this.minuteStep;
134
+ }
135
+
136
+ if (newVal < 0) {
137
+ this.decrementHour();
138
+ this.minute = newVal + 60;
139
+ } else {
140
+ this.minute = newVal;
141
+ }
142
+ this.update();
143
+ },
144
+
145
+ decrementSecond: function() {
146
+ var newVal = this.second - this.secondStep;
147
+
148
+ if (newVal < 0) {
149
+ this.decrementMinute(true);
150
+ this.second = newVal + 60;
151
+ } else {
152
+ this.second = newVal;
153
+ }
154
+ this.update();
155
+ },
156
+
157
+ elementKeydown: function(e) {
158
+ switch (e.keyCode) {
159
+ case 9: //tab
160
+ this.updateFromElementVal();
161
+
162
+ switch (this.highlightedUnit) {
163
+ case 'hour':
164
+ e.preventDefault();
165
+ this.highlightNextUnit();
166
+ break;
167
+ case 'minute':
168
+ if (this.showMeridian || this.showSeconds) {
169
+ e.preventDefault();
170
+ this.highlightNextUnit();
171
+ }
172
+ break;
173
+ case 'second':
174
+ if (this.showMeridian) {
175
+ e.preventDefault();
176
+ this.highlightNextUnit();
177
+ }
178
+ break;
179
+ }
180
+ break;
181
+ case 27: // escape
182
+ this.updateFromElementVal();
183
+ break;
184
+ case 37: // left arrow
185
+ e.preventDefault();
186
+ this.highlightPrevUnit();
187
+ this.updateFromElementVal();
188
+ break;
189
+ case 38: // up arrow
190
+ e.preventDefault();
191
+ switch (this.highlightedUnit) {
192
+ case 'hour':
193
+ this.incrementHour();
194
+ this.highlightHour();
195
+ break;
196
+ case 'minute':
197
+ this.incrementMinute();
198
+ this.highlightMinute();
199
+ break;
200
+ case 'second':
201
+ this.incrementSecond();
202
+ this.highlightSecond();
203
+ break;
204
+ case 'meridian':
205
+ this.toggleMeridian();
206
+ this.highlightMeridian();
207
+ break;
208
+ }
209
+ break;
210
+ case 39: // right arrow
211
+ e.preventDefault();
212
+ this.updateFromElementVal();
213
+ this.highlightNextUnit();
214
+ break;
215
+ case 40: // down arrow
216
+ e.preventDefault();
217
+ switch (this.highlightedUnit) {
218
+ case 'hour':
219
+ this.decrementHour();
220
+ this.highlightHour();
221
+ break;
222
+ case 'minute':
223
+ this.decrementMinute();
224
+ this.highlightMinute();
225
+ break;
226
+ case 'second':
227
+ this.decrementSecond();
228
+ this.highlightSecond();
229
+ break;
230
+ case 'meridian':
231
+ this.toggleMeridian();
232
+ this.highlightMeridian();
233
+ break;
234
+ }
235
+ break;
236
+ }
237
+ },
238
+
239
+ formatTime: function(hour, minute, second, meridian) {
240
+ hour = hour < 10 ? '0' + hour : hour;
241
+ minute = minute < 10 ? '0' + minute : minute;
242
+ second = second < 10 ? '0' + second : second;
243
+
244
+ return hour + ':' + minute + (this.showSeconds ? ':' + second : '') + (this.showMeridian ? ' ' + meridian : '');
245
+ },
246
+
247
+ getCursorPosition: function() {
248
+ var input = this.$element.get(0);
249
+
250
+ if ('selectionStart' in input) {// Standard-compliant browsers
251
+
252
+ return input.selectionStart;
253
+ } else if (document.selection) {// IE fix
254
+ input.focus();
255
+ var sel = document.selection.createRange(),
256
+ selLen = document.selection.createRange().text.length;
257
+
258
+ sel.moveStart('character', - input.value.length);
259
+
260
+ return sel.text.length - selLen;
261
+ }
262
+ },
263
+
264
+ getTemplate: function() {
265
+ var template,
266
+ hourTemplate,
267
+ minuteTemplate,
268
+ secondTemplate,
269
+ meridianTemplate,
270
+ templateContent;
271
+
272
+ if (this.showInputs) {
273
+ hourTemplate = '<input type="text" name="hour" class="bootstrap-timepicker-hour form-control" maxlength="2"/>';
274
+ minuteTemplate = '<input type="text" name="minute" class="bootstrap-timepicker-minute form-control" maxlength="2"/>';
275
+ secondTemplate = '<input type="text" name="second" class="bootstrap-timepicker-second form-control" maxlength="2"/>';
276
+ meridianTemplate = '<input type="text" name="meridian" class="bootstrap-timepicker-meridian form-control" maxlength="2"/>';
277
+ } else {
278
+ hourTemplate = '<span class="bootstrap-timepicker-hour"></span>';
279
+ minuteTemplate = '<span class="bootstrap-timepicker-minute"></span>';
280
+ secondTemplate = '<span class="bootstrap-timepicker-second"></span>';
281
+ meridianTemplate = '<span class="bootstrap-timepicker-meridian"></span>';
282
+ }
283
+
284
+ templateContent = '<table>'+
285
+ '<tr>'+
286
+ '<td><a href="#" data-action="incrementHour"><i class="' + this.upArrowStyle + '"></i></a></td>'+
287
+ '<td class="separator">&nbsp;</td>'+
288
+ '<td><a href="#" data-action="incrementMinute"><i class="' + this.upArrowStyle + '"></i></a></td>'+
289
+ (this.showSeconds ?
290
+ '<td class="separator">&nbsp;</td>'+
291
+ '<td><a href="#" data-action="incrementSecond"><i class="' + this.upArrowStyle + '"></i></a></td>'
292
+ : '') +
293
+ (this.showMeridian ?
294
+ '<td class="separator">&nbsp;</td>'+
295
+ '<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="' + this.upArrowStyle + '"></i></a></td>'
296
+ : '') +
297
+ '</tr>'+
298
+ '<tr>'+
299
+ '<td>'+ hourTemplate +'</td> '+
300
+ '<td class="separator">:</td>'+
301
+ '<td>'+ minuteTemplate +'</td> '+
302
+ (this.showSeconds ?
303
+ '<td class="separator">:</td>'+
304
+ '<td>'+ secondTemplate +'</td>'
305
+ : '') +
306
+ (this.showMeridian ?
307
+ '<td class="separator">&nbsp;</td>'+
308
+ '<td>'+ meridianTemplate +'</td>'
309
+ : '') +
310
+ '</tr>'+
311
+ '<tr>'+
312
+ '<td><a href="#" data-action="decrementHour"><i class="' + this.downArrowStyle + '"></i></a></td>'+
313
+ '<td class="separator"></td>'+
314
+ '<td><a href="#" data-action="decrementMinute"><i class="' + this.downArrowStyle + '"></i></a></td>'+
315
+ (this.showSeconds ?
316
+ '<td class="separator">&nbsp;</td>'+
317
+ '<td><a href="#" data-action="decrementSecond"><i class="' + this.downArrowStyle + '"></i></a></td>'
318
+ : '') +
319
+ (this.showMeridian ?
320
+ '<td class="separator">&nbsp;</td>'+
321
+ '<td><a href="#" data-action="toggleMeridian"><i class="' + this.downArrowStyle + '"></i></a></td>'
322
+ : '') +
323
+ '</tr>'+
324
+ '</table>';
325
+
326
+ switch(this.template) {
327
+ case 'modal':
328
+ template = '<div class="bootstrap-timepicker-widget modal hide fade in" data-backdrop="'+ (this.modalBackdrop ? 'true' : 'false') +'">'+
329
+ '<div class="modal-header">'+
330
+ '<a href="#" class="close" data-dismiss="modal">×</a>'+
331
+ '<h3>Pick a Time</h3>'+
332
+ '</div>'+
333
+ '<div class="modal-content">'+
334
+ templateContent +
335
+ '</div>'+
336
+ '<div class="modal-footer">'+
337
+ '<a href="#" class="btn btn-primary" data-dismiss="modal">OK</a>'+
338
+ '</div>'+
339
+ '</div>';
340
+ break;
341
+ case 'dropdown':
342
+ template = '<div class="bootstrap-timepicker-widget dropdown-menu">'+ templateContent +'</div>';
343
+ break;
344
+ }
345
+
346
+ return template;
347
+ },
348
+
349
+ getTime: function() {
350
+ return this.formatTime(this.hour, this.minute, this.second, this.meridian);
351
+ },
352
+
353
+ hideWidget: function() {
354
+ if (this.isOpen === false) {
355
+ return;
356
+ }
357
+
358
+ if (this.showInputs) {
359
+ this.updateFromWidgetInputs();
360
+ }
361
+
362
+ this.$element.trigger({
363
+ 'type': 'hide.timepicker',
364
+ 'time': {
365
+ 'value': this.getTime(),
366
+ 'hours': this.hour,
367
+ 'minutes': this.minute,
368
+ 'seconds': this.second,
369
+ 'meridian': this.meridian
370
+ }
371
+ });
372
+
373
+ if (this.template === 'modal' && this.$widget.modal) {
374
+ this.$widget.modal('hide');
375
+ } else {
376
+ this.$widget.removeClass('open');
377
+ }
378
+
379
+ $(document).off('mousedown.timepicker');
380
+
381
+ this.isOpen = false;
382
+ },
383
+
384
+ highlightUnit: function() {
385
+ this.position = this.getCursorPosition();
386
+ if (this.position >= 0 && this.position <= 2) {
387
+ this.highlightHour();
388
+ } else if (this.position >= 3 && this.position <= 5) {
389
+ this.highlightMinute();
390
+ } else if (this.position >= 6 && this.position <= 8) {
391
+ if (this.showSeconds) {
392
+ this.highlightSecond();
393
+ } else {
394
+ this.highlightMeridian();
395
+ }
396
+ } else if (this.position >= 9 && this.position <= 11) {
397
+ this.highlightMeridian();
398
+ }
399
+ },
400
+
401
+ highlightNextUnit: function() {
402
+ switch (this.highlightedUnit) {
403
+ case 'hour':
404
+ this.highlightMinute();
405
+ break;
406
+ case 'minute':
407
+ if (this.showSeconds) {
408
+ this.highlightSecond();
409
+ } else if (this.showMeridian){
410
+ this.highlightMeridian();
411
+ } else {
412
+ this.highlightHour();
413
+ }
414
+ break;
415
+ case 'second':
416
+ if (this.showMeridian) {
417
+ this.highlightMeridian();
418
+ } else {
419
+ this.highlightHour();
420
+ }
421
+ break;
422
+ case 'meridian':
423
+ this.highlightHour();
424
+ break;
425
+ }
426
+ },
427
+
428
+ highlightPrevUnit: function() {
429
+ switch (this.highlightedUnit) {
430
+ case 'hour':
431
+ this.highlightMeridian();
432
+ break;
433
+ case 'minute':
434
+ this.highlightHour();
435
+ break;
436
+ case 'second':
437
+ this.highlightMinute();
438
+ break;
439
+ case 'meridian':
440
+ if (this.showSeconds) {
441
+ this.highlightSecond();
442
+ } else {
443
+ this.highlightMinute();
444
+ }
445
+ break;
446
+ }
447
+ },
448
+
449
+ highlightHour: function() {
450
+ var $element = this.$element.get(0);
451
+
452
+ this.highlightedUnit = 'hour';
453
+
454
+ if ($element.setSelectionRange) {
455
+ setTimeout(function() {
456
+ $element.setSelectionRange(0,2);
457
+ }, 0);
458
+ }
459
+ },
460
+
461
+ highlightMinute: function() {
462
+ var $element = this.$element.get(0);
463
+
464
+ this.highlightedUnit = 'minute';
465
+
466
+ if ($element.setSelectionRange) {
467
+ setTimeout(function() {
468
+ $element.setSelectionRange(3,5);
469
+ }, 0);
470
+ }
471
+ },
472
+
473
+ highlightSecond: function() {
474
+ var $element = this.$element.get(0);
475
+
476
+ this.highlightedUnit = 'second';
477
+
478
+ if ($element.setSelectionRange) {
479
+ setTimeout(function() {
480
+ $element.setSelectionRange(6,8);
481
+ }, 0);
482
+ }
483
+ },
484
+
485
+ highlightMeridian: function() {
486
+ var $element = this.$element.get(0);
487
+
488
+ this.highlightedUnit = 'meridian';
489
+
490
+ if ($element.setSelectionRange) {
491
+ if (this.showSeconds) {
492
+ setTimeout(function() {
493
+ $element.setSelectionRange(9,11);
494
+ }, 0);
495
+ } else {
496
+ setTimeout(function() {
497
+ $element.setSelectionRange(6,8);
498
+ }, 0);
499
+ }
500
+ }
501
+ },
502
+
503
+ incrementHour: function() {
504
+ if (this.showMeridian) {
505
+ if (this.hour === 11) {
506
+ this.hour++;
507
+ return this.toggleMeridian();
508
+ } else if (this.hour === 12) {
509
+ this.hour = 0;
510
+ }
511
+ }
512
+ if (this.hour === 23) {
513
+ this.hour = 0;
514
+
515
+ return;
516
+ }
517
+ this.hour++;
518
+ this.update();
519
+ },
520
+
521
+ incrementMinute: function(step) {
522
+ var newVal;
523
+
524
+ if (step) {
525
+ newVal = this.minute + step;
526
+ } else {
527
+ newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
528
+ }
529
+
530
+ if (newVal > 59) {
531
+ this.incrementHour();
532
+ this.minute = newVal - 60;
533
+ } else {
534
+ this.minute = newVal;
535
+ }
536
+ this.update();
537
+ },
538
+
539
+ incrementSecond: function() {
540
+ var newVal = this.second + this.secondStep - (this.second % this.secondStep);
541
+
542
+ if (newVal > 59) {
543
+ this.incrementMinute(true);
544
+ this.second = newVal - 60;
545
+ } else {
546
+ this.second = newVal;
547
+ }
548
+ this.update();
549
+ },
550
+
551
+ remove: function() {
552
+ $('document').off('.timepicker');
553
+ if (this.$widget) {
554
+ this.$widget.remove();
555
+ }
556
+ delete this.$element.data().timepicker;
557
+ },
558
+
559
+ setDefaultTime: function(defaultTime){
560
+ if (!this.$element.val()) {
561
+ if (defaultTime === 'current') {
562
+ var dTime = new Date(),
563
+ hours = dTime.getHours(),
564
+ minutes = Math.floor(dTime.getMinutes() / this.minuteStep) * this.minuteStep,
565
+ seconds = Math.floor(dTime.getSeconds() / this.secondStep) * this.secondStep,
566
+ meridian = 'AM';
567
+
568
+ if (this.showMeridian) {
569
+ if (hours === 0) {
570
+ hours = 12;
571
+ } else if (hours >= 12) {
572
+ if (hours > 12) {
573
+ hours = hours - 12;
574
+ }
575
+ meridian = 'PM';
576
+ } else {
577
+ meridian = 'AM';
578
+ }
579
+ }
580
+
581
+ this.hour = hours;
582
+ this.minute = minutes;
583
+ this.second = seconds;
584
+ this.meridian = meridian;
585
+
586
+ this.update();
587
+
588
+ } else if (defaultTime === false) {
589
+ this.hour = 0;
590
+ this.minute = 0;
591
+ this.second = 0;
592
+ this.meridian = 'AM';
593
+ } else {
594
+ this.setTime(defaultTime);
595
+ }
596
+ } else {
597
+ this.updateFromElementVal();
598
+ }
599
+ },
600
+
601
+ setTime: function(time) {
602
+ var arr,
603
+ timeArray;
604
+
605
+ if (this.showMeridian) {
606
+ arr = time.split(' ');
607
+ timeArray = arr[0].split(':');
608
+ this.meridian = arr[1];
609
+ } else {
610
+ timeArray = time.split(':');
611
+ }
612
+
613
+ this.hour = parseInt(timeArray[0], 10);
614
+ this.minute = parseInt(timeArray[1], 10);
615
+ this.second = parseInt(timeArray[2], 10);
616
+
617
+ if (isNaN(this.hour)) {
618
+ this.hour = 0;
619
+ }
620
+ if (isNaN(this.minute)) {
621
+ this.minute = 0;
622
+ }
623
+
624
+ if (this.showMeridian) {
625
+ if (this.hour > 12) {
626
+ this.hour = 12;
627
+ } else if (this.hour < 1) {
628
+ this.hour = 12;
629
+ }
630
+
631
+ if (this.meridian === 'am' || this.meridian === 'a') {
632
+ this.meridian = 'AM';
633
+ } else if (this.meridian === 'pm' || this.meridian === 'p') {
634
+ this.meridian = 'PM';
635
+ }
636
+
637
+ if (this.meridian !== 'AM' && this.meridian !== 'PM') {
638
+ this.meridian = 'AM';
639
+ }
640
+ } else {
641
+ if (this.hour >= 24) {
642
+ this.hour = 23;
643
+ } else if (this.hour < 0) {
644
+ this.hour = 0;
645
+ }
646
+ }
647
+
648
+ if (this.minute < 0) {
649
+ this.minute = 0;
650
+ } else if (this.minute >= 60) {
651
+ this.minute = 59;
652
+ }
653
+
654
+ if (this.showSeconds) {
655
+ if (isNaN(this.second)) {
656
+ this.second = 0;
657
+ } else if (this.second < 0) {
658
+ this.second = 0;
659
+ } else if (this.second >= 60) {
660
+ this.second = 59;
661
+ }
662
+ }
663
+
664
+ this.update();
665
+ },
666
+
667
+ showWidget: function() {
668
+ if (this.isOpen) {
669
+ return;
670
+ }
671
+
672
+ if (this.$element.is(':disabled')) {
673
+ return;
674
+ }
675
+
676
+ var self = this;
677
+ $(document).on('mousedown.timepicker', function (e) {
678
+ // Clicked outside the timepicker, hide it
679
+ if ($(e.target).closest('.bootstrap-timepicker-widget').length === 0) {
680
+ self.hideWidget();
681
+ }
682
+ });
683
+
684
+ this.$element.trigger({
685
+ 'type': 'show.timepicker',
686
+ 'time': {
687
+ 'value': this.getTime(),
688
+ 'hours': this.hour,
689
+ 'minutes': this.minute,
690
+ 'seconds': this.second,
691
+ 'meridian': this.meridian
692
+ }
693
+ });
694
+
695
+ if (this.disableFocus) {
696
+ this.$element.blur();
697
+ }
698
+
699
+ this.updateFromElementVal();
700
+
701
+ if (this.template === 'modal' && this.$widget.modal) {
702
+ this.$widget.modal('show').on('hidden', $.proxy(this.hideWidget, this));
703
+ } else {
704
+ if (this.isOpen === false) {
705
+ this.$widget.addClass('open');
706
+ }
707
+ }
708
+
709
+ this.isOpen = true;
710
+ },
711
+
712
+ toggleMeridian: function() {
713
+ this.meridian = this.meridian === 'AM' ? 'PM' : 'AM';
714
+ this.update();
715
+ },
716
+
717
+ update: function() {
718
+ this.$element.trigger({
719
+ 'type': 'changeTime.timepicker',
720
+ 'time': {
721
+ 'value': this.getTime(),
722
+ 'hours': this.hour,
723
+ 'minutes': this.minute,
724
+ 'seconds': this.second,
725
+ 'meridian': this.meridian
726
+ }
727
+ });
728
+
729
+ this.updateElement();
730
+ this.updateWidget();
731
+ },
732
+
733
+ updateElement: function() {
734
+ this.$element.val(this.getTime()).change();
735
+ },
736
+
737
+ updateFromElementVal: function() {
738
+ var val = this.$element.val();
739
+
740
+ if (val) {
741
+ this.setTime(val);
742
+ }
743
+ },
744
+
745
+ updateWidget: function() {
746
+ if (this.$widget === false) {
747
+ return;
748
+ }
749
+
750
+ var hour = this.hour < 10 ? '0' + this.hour : this.hour,
751
+ minute = this.minute < 10 ? '0' + this.minute : this.minute,
752
+ second = this.second < 10 ? '0' + this.second : this.second;
753
+
754
+ if (this.showInputs) {
755
+ this.$widget.find('input.bootstrap-timepicker-hour').val(hour);
756
+ this.$widget.find('input.bootstrap-timepicker-minute').val(minute);
757
+
758
+ if (this.showSeconds) {
759
+ this.$widget.find('input.bootstrap-timepicker-second').val(second);
760
+ }
761
+ if (this.showMeridian) {
762
+ this.$widget.find('input.bootstrap-timepicker-meridian').val(this.meridian);
763
+ }
764
+ } else {
765
+ this.$widget.find('span.bootstrap-timepicker-hour').text(hour);
766
+ this.$widget.find('span.bootstrap-timepicker-minute').text(minute);
767
+
768
+ if (this.showSeconds) {
769
+ this.$widget.find('span.bootstrap-timepicker-second').text(second);
770
+ }
771
+ if (this.showMeridian) {
772
+ this.$widget.find('span.bootstrap-timepicker-meridian').text(this.meridian);
773
+ }
774
+ }
775
+ },
776
+
777
+ updateFromWidgetInputs: function() {
778
+ if (this.$widget === false) {
779
+ return;
780
+ }
781
+ var time = $('input.bootstrap-timepicker-hour', this.$widget).val() + ':' +
782
+ $('input.bootstrap-timepicker-minute', this.$widget).val() +
783
+ (this.showSeconds ? ':' + $('input.bootstrap-timepicker-second', this.$widget).val() : '') +
784
+ (this.showMeridian ? ' ' + $('input.bootstrap-timepicker-meridian', this.$widget).val() : '');
785
+
786
+ this.setTime(time);
787
+ },
788
+
789
+ widgetClick: function(e) {
790
+ e.stopPropagation();
791
+ e.preventDefault();
792
+
793
+ var action = $(e.target).closest('a').data('action');
794
+ if (action) {
795
+ this[action]();
796
+ }
797
+ },
798
+
799
+ widgetKeydown: function(e) {
800
+ var $input = $(e.target).closest('input'),
801
+ name = $input.attr('name');
802
+
803
+ switch (e.keyCode) {
804
+ case 9: //tab
805
+ if (this.showMeridian) {
806
+ if (name === 'meridian') {
807
+ return this.hideWidget();
808
+ }
809
+ } else {
810
+ if (this.showSeconds) {
811
+ if (name === 'second') {
812
+ return this.hideWidget();
813
+ }
814
+ } else {
815
+ if (name === 'minute') {
816
+ return this.hideWidget();
817
+ }
818
+ }
819
+ }
820
+
821
+ this.updateFromWidgetInputs();
822
+ break;
823
+ case 27: // escape
824
+ this.hideWidget();
825
+ break;
826
+ case 38: // up arrow
827
+ e.preventDefault();
828
+ switch (name) {
829
+ case 'hour':
830
+ this.incrementHour();
831
+ break;
832
+ case 'minute':
833
+ this.incrementMinute();
834
+ break;
835
+ case 'second':
836
+ this.incrementSecond();
837
+ break;
838
+ case 'meridian':
839
+ this.toggleMeridian();
840
+ break;
841
+ }
842
+ break;
843
+ case 40: // down arrow
844
+ e.preventDefault();
845
+ switch (name) {
846
+ case 'hour':
847
+ this.decrementHour();
848
+ break;
849
+ case 'minute':
850
+ this.decrementMinute();
851
+ break;
852
+ case 'second':
853
+ this.decrementSecond();
854
+ break;
855
+ case 'meridian':
856
+ this.toggleMeridian();
857
+ break;
858
+ }
859
+ break;
860
+ }
861
+ }
862
+ };
863
+
864
+
865
+ //TIMEPICKER PLUGIN DEFINITION
866
+ $.fn.timepicker = function(option) {
867
+ var args = Array.apply(null, arguments);
868
+ args.shift();
869
+ return this.each(function() {
870
+ var $this = $(this),
871
+ data = $this.data('timepicker'),
872
+ options = typeof option === 'object' && option;
873
+
874
+ if (!data) {
875
+ $this.data('timepicker', (data = new Timepicker(this, $.extend({}, $.fn.timepicker.defaults, options, $(this).data()))));
876
+ }
877
+
878
+ if (typeof option === 'string') {
879
+ data[option].apply(data, args);
880
+ }
881
+ });
882
+ };
883
+
884
+ $.fn.timepicker.defaults = {
885
+ defaultTime: 'current',
886
+ disableFocus: false,
887
+ isOpen: false,
888
+ minuteStep: 15,
889
+ modalBackdrop: false,
890
+ secondStep: 15,
891
+ showSeconds: false,
892
+ showInputs: true,
893
+ showMeridian: true,
894
+ template: 'dropdown',
895
+ appendWidgetTo: '.bootstrap-timepicker',
896
+ upArrowStyle: 'glyphicon glyphicon-chevron-up',
897
+ downArrowStyle: 'glyphicon glyphicon-chevron-down',
898
+ containerClass: 'bootstrap-timepicker'
899
+ };
900
+
901
+ $.fn.timepicker.Constructor = Timepicker;
902
+
903
+ })(jQuery, window, document);