/** * EasyUI for jQuery 1.6.10 * * Copyright (c) 2009-2018 www.jeasyui.com. All rights reserved. * * Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php * To use it on other terms please contact us: info@jeasyui.com * */ (function($){ function _1(_2){ var _3=$.data(_2,"timespinner").options; $(_2).addClass("timespinner-f").spinner(_3); var _4=_3.formatter.call(_2,_3.parser.call(_2,_3.value)); $(_2).timespinner("initValue",_4); }; function _5(e){ var _6=e.data.target; var _7=$.data(_6,"timespinner").options; var _8=$(_6).timespinner("getSelectionStart"); for(var i=0;i<_7.selections.length;i++){ var _9=_7.selections[i]; if(_8>=_9[0]&&_8<=_9[1]){ _a(_6,i); return; } } }; function _a(_b,_c){ var _d=$.data(_b,"timespinner").options; if(_c!=undefined){ _d.highlight=_c; } var _e=_d.selections[_d.highlight]; if(_e){ var tb=$(_b).timespinner("textbox"); $(_b).timespinner("setSelectionRange",{start:_e[0],end:_e[1]}); tb.focus(); } }; function _f(_10,_11){ var _12=$.data(_10,"timespinner").options; var _11=_12.parser.call(_10,_11); var _13=_12.formatter.call(_10,_11); $(_10).spinner("setValue",_13); }; function _14(_15,_16){ var _17=$.data(_15,"timespinner").options; var s=$(_15).timespinner("getValue"); var _18=_17.selections[_17.highlight]; var s1=s.substring(0,_18[0]); var s2=s.substring(_18[0],_18[1]); var s3=s.substring(_18[1]); var v=s1+((parseInt(s2,10)||0)+_17.increment*(_16?-1:1))+s3; $(_15).timespinner("setValue",v); _a(_15); }; $.fn.timespinner=function(_19,_1a){ if(typeof _19=="string"){ var _1b=$.fn.timespinner.methods[_19]; if(_1b){ return _1b(this,_1a); }else{ return this.spinner(_19,_1a); } } _19=_19||{}; return this.each(function(){ var _1c=$.data(this,"timespinner"); if(_1c){ $.extend(_1c.options,_19); }else{ $.data(this,"timespinner",{options:$.extend({},$.fn.timespinner.defaults,$.fn.timespinner.parseOptions(this),_19)}); } _1(this); }); }; $.fn.timespinner.methods={options:function(jq){ var _1d=jq.data("spinner")?jq.spinner("options"):{}; return $.extend($.data(jq[0],"timespinner").options,{width:_1d.width,value:_1d.value,originalValue:_1d.originalValue,disabled:_1d.disabled,readonly:_1d.readonly}); },setValue:function(jq,_1e){ return jq.each(function(){ _f(this,_1e); }); },getHours:function(jq){ var _1f=$.data(jq[0],"timespinner").options; var _20=_1f.parser.call(jq[0],jq.timespinner("getValue")); return _20?_20.getHours():null; },getMinutes:function(jq){ var _21=$.data(jq[0],"timespinner").options; var _22=_21.parser.call(jq[0],jq.timespinner("getValue")); return _22?_22.getMinutes():null; },getSeconds:function(jq){ var _23=$.data(jq[0],"timespinner").options; var _24=_23.parser.call(jq[0],jq.timespinner("getValue")); return _24?_24.getSeconds():null; }}; $.fn.timespinner.parseOptions=function(_25){ return $.extend({},$.fn.spinner.parseOptions(_25),$.parser.parseOptions(_25,["separator",{showSeconds:"boolean",highlight:"number"}])); }; $.fn.timespinner.defaults=$.extend({},$.fn.spinner.defaults,{inputEvents:$.extend({},$.fn.spinner.defaults.inputEvents,{click:function(e){ _5.call(this,e); },blur:function(e){ var t=$(e.data.target); t.timespinner("setValue",t.timespinner("getText")); },keydown:function(e){ if(e.keyCode==13){ var t=$(e.data.target); t.timespinner("setValue",t.timespinner("getText")); } }}),formatter:function(_26){ if(!_26){ return ""; } var _27=$(this).timespinner("options"); var tt=[_28(_26.getHours()),_28(_26.getMinutes())]; if(_27.showSeconds){ tt.push(_28(_26.getSeconds())); } return tt.join(_27.separator); function _28(_29){ return (_29<10?"0":"")+_29; }; },parser:function(s){ var _2a=$(this).timespinner("options"); var _2b=_2c(s); if(_2b){ var min=_2c(_2a.min); var max=_2c(_2a.max); if(min&&min>_2b){ _2b=min; } if(max&&max<_2b){ _2b=max; } } return _2b; function _2c(s){ if(!s){ return null; } var tt=s.split(_2a.separator); return new Date(1900,0,0,parseInt(tt[0],10)||0,parseInt(tt[1],10)||0,parseInt(tt[2],10)||0); }; },selections:[[0,2],[3,5],[6,8]],separator:":",showSeconds:false,highlight:0,spin:function(_2d){ _14(this,_2d); }}); })(jQuery);