A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
7.4 KiB

  1. /*! UIkit 2.3.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2. (function(t,e,i){var n=function(t,i){var s=e(t);s.data("timepicker")||(this.$element=s,this.element=this.$element[0],this.options=e.extend({},n.defaults,i),this.$element.on({"focus.timepicker.uikit":e.proxy(this.highlightUnit,this),"click.timepicker.uikit":e.proxy(this.highlightUnit,this),"keydown.timepicker.uikit":e.proxy(this.onKeydown,this),"blur.timepicker.uikit":e.proxy(this.blurElement,this)}),this.setDefaultTime(this.options.defaultTime),this.element.data("timepicker",this))};n.defaults={defaultTime:"current",disableFocus:!1,minuteStep:15,secondStep:15,showSeconds:!1,showMeridian:!1},e.extend(n.prototype,{setDefaultTime:function(t){if(this.element.value)this.updateFromElementVal();else if("current"===t){var e=new Date;this.hour=e.getHours(),this.minute=Math.floor(e.getMinutes()/this.options.minuteStep)*this.options.minuteStep,this.second=Math.floor(e.getSeconds()/this.options.secondStep)*this.options.secondStep,this.meridian="AM",this.options.showMeridian&&(0===this.hour?this.hour=12:this.hour>=12?(this.hour>12&&(this.hour=this.hour-12),this.meridian="PM"):this.meridian="AM"),this.update()}else t===!1?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t){var e,i;this.options.showMeridian?(e=t.split(" "),i=e[0].split(":"),this.meridian=e[1]):i=t.split(":"),this.hour=parseInt(i[0],10),this.minute=parseInt(i[1],10),this.second=parseInt(i[2],10),isNaN(this.hour)&&(this.hour=0),isNaN(this.minute)&&(this.minute=0),this.options.showMeridian?(this.hour>12?this.hour=12:1>this.hour&&(this.hour=12),"am"===this.meridian||"a"===this.meridian?this.meridian="AM":("pm"===this.meridian||"p"===this.meridian)&&(this.meridian="PM"),"AM"!==this.meridian&&"PM"!==this.meridian&&(this.meridian="AM")):this.hour>=24?this.hour=23:0>this.hour&&(this.hour=0),0>this.minute?this.minute=0:this.minute>=60&&(this.minute=59),this.options.showSeconds&&(isNaN(this.second)?this.second=0:0>this.second?this.second=0:this.second>=60&&(this.second=59)),this.update()},blurElement:function(){this.highlightedUnit=void 0,this.updateFromElementVal()},decrementHour:function(){if(this.options.showMeridian)if(1===this.hour)this.hour=12;else{if(12===this.hour)return this.hour--,this.toggleMeridian();if(0===this.hour)return this.hour=11,this.toggleMeridian();this.hour--}else 0===this.hour?this.hour=23:this.hour--;this.update()},decrementMinute:function(t){var e=t?this.minute-t:this.minute-this.options.minuteStep;0>e?(this.decrementHour(),this.minute=e+60):this.minute=e,this.update()},decrementSecond:function(){var t=this.second-this.options.secondStep;0>t?(this.decrementMinute(!0),this.second=t+60):this.second=t,this.update()},onKeydown:function(t){switch(t.keyCode){case 9:switch(this.updateFromElementVal(),this.highlightedUnit){case"hour":t.preventDefault(),this.highlightNextUnit();break;case"minute":(this.options.showMeridian||this.options.showSeconds)&&(t.preventDefault(),this.highlightNextUnit());break;case"second":this.options.showMeridian&&(t.preventDefault(),this.highlightNextUnit())}break;case 27:this.updateFromElementVal();break;case 37:t.preventDefault(),this.highlightPrevUnit(),this.updateFromElementVal();break;case 38:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.incrementHour(),this.highlightHour();break;case"minute":this.incrementMinute(),this.highlightMinute();break;case"second":this.incrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}break;case 39:t.preventDefault(),this.updateFromElementVal(),this.highlightNextUnit();break;case 40:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.decrementHour(),this.highlightHour();break;case"minute":this.decrementMinute(),this.highlightMinute();break;case"second":this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}}},formatTime:function(t,e,i,n){return t=10>t?"0"+t:t,e=10>e?"0"+e:e,i=10>i?"0"+i:i,t+":"+e+(this.options.showSeconds?":"+i:"")+(this.options.showMeridian?" "+n:"")},getCursorPosition:function(){if("selectionSt