All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.plugins.jquery-ui-timepicker-addon.min.js Maven / Gradle / Ivy

There is a newer version: 5.0.5
Show newest version
'use strict';(function(e){"function"===typeof define&&define.amd?define(["jquery","jquery-ui"],e):e(jQuery)})(function(e){e.ui.timepicker=e.ui.timepicker||{};if(!e.ui.timepicker.version){e.extend(e.ui,{timepicker:{version:"1.6.3"}});var t=function(){this.regional=[];this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",
microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1};this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,
maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null};e.extend(this._defaults,this.regional[""])};e.extend(t.prototype,
{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",
formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(c){s(this._defaults,c||{});return this},_newInst:function(c,b){var a=new t,d={},f={},g,h;for(g in this._defaults)if(this._defaults.hasOwnProperty(g)){var k=c.attr("time:"+g);if(k)try{d[g]=eval(k)}catch(l){d[g]=k}}g={beforeShow:function(b,d){if(e.isFunction(a._defaults.evnts.beforeShow))return a._defaults.evnts.beforeShow.call(c[0],b,d,a)},onChangeMonthYear:function(b,
d,f){e.isFunction(a._defaults.evnts.onChangeMonthYear)&&a._defaults.evnts.onChangeMonthYear.call(c[0],b,d,f,a)},onClose:function(b,d){!0===a.timeDefined&&""!==c.val()&&a._updateDateTime(d);e.isFunction(a._defaults.evnts.onClose)&&a._defaults.evnts.onClose.call(c[0],b,d,a)}};for(h in g)g.hasOwnProperty(h)&&(f[h]=b[h]||this._defaults[h]||null);a._defaults=e.extend({},this._defaults,d,b,g,{evnts:f,timepicker:a});a.amNames=e.map(a._defaults.amNames,function(a){return a.toUpperCase()});a.pmNames=e.map(a._defaults.pmNames,
function(a){return a.toUpperCase()});a.support=y(a._defaults.timeFormat+(a._defaults.pickerTimeFormat?a._defaults.pickerTimeFormat:"")+(a._defaults.altTimeFormat?a._defaults.altTimeFormat:""));"string"===typeof a._defaults.controlType?("slider"===a._defaults.controlType&&"undefined"===typeof e.ui.slider&&(a._defaults.controlType="select"),a.control=a._controls[a._defaults.controlType]):a.control=a._defaults.controlType;d=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,
60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==a._defaults.timezoneList&&(d=a._defaults.timezoneList);f=d.length;h=0;g=null;if(0a._defaults.hourMax?a._defaults.hourMax:a._defaults.hour;a.minute=a._defaults.minutea._defaults.minuteMax?a._defaults.minuteMax:a._defaults.minute;a.second=a._defaults.seconda._defaults.secondMax?a._defaults.secondMax:a._defaults.second;a.millisec=a._defaults.millisec
a._defaults.millisecMax?a._defaults.millisecMax:a._defaults.millisec;a.microsec=a._defaults.microseca._defaults.microsecMax?a._defaults.microsecMax:a._defaults.microsec;a.ampm="";a.$input=c;a._defaults.altField&&(a.$altInput=e(a._defaults.altField),!0===a._defaults.altRedirectFocus&&a.$altInput.css({cursor:"pointer"}).focus(function(){c.trigger("focus")}));if(0===a._defaults.minDate||0===a._defaults.minDateTime)a._defaults.minDate=
new Date;if(0===a._defaults.maxDate||0===a._defaults.maxDateTime)a._defaults.maxDate=new Date;void 0!==a._defaults.minDate&&a._defaults.minDate instanceof Date&&(a._defaults.minDateTime=new Date(a._defaults.minDate.getTime()));void 0!==a._defaults.minDateTime&&a._defaults.minDateTime instanceof Date&&(a._defaults.minDate=new Date(a._defaults.minDateTime.getTime()));void 0!==a._defaults.maxDate&&a._defaults.maxDate instanceof Date&&(a._defaults.maxDateTime=new Date(a._defaults.maxDate.getTime()));
void 0!==a._defaults.maxDateTime&&a._defaults.maxDateTime instanceof Date&&(a._defaults.maxDate=new Date(a._defaults.maxDateTime.getTime()));a.$input.bind("focus",function(){a._onFocus()});return a},_addTimePicker:function(c){var b=e.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(b);this._limitMinMaxDateTime(c,!1);this._injectTimePicker();this._afterInject()},_parseTime:function(c,b){this.inst||(this.inst=
e.datepicker._getInst(this.$input[0]));if(b||!this._defaults.timeOnly){var a=e.datepicker._get(this.inst,"dateFormat");try{var d=u(a,this._defaults.timeFormat,c,e.datepicker._getFormatConfig(this.inst),this._defaults);if(!d.timeObj)return!1;e.extend(this,d.timeObj)}catch(f){return e.timepicker.log("Error parsing the date/time string: "+f+"\ndate/time string \x3d "+c+"\ntimeFormat \x3d "+this._defaults.timeFormat+"\ndateFormat \x3d "+a),!1}}else{a=e.datepicker.parseTime(this._defaults.timeFormat,c,
this._defaults);if(!a)return!1;e.extend(this,a)}return!0},_afterInject:function(){var c=this.inst.settings;e.isFunction(c.afterInject)&&c.afterInject.call(this)},_injectTimePicker:function(){var c=this.inst.dpDiv,b=this.inst.settings,a=this,d="",f="",g=null,h={},k={},l=null,n=0,m=0;if(0===c.find("div.ui-timepicker-div").length&&b.showTimepicker){l='\x3cdiv class\x3d"ui-timepicker-div'+(b.isRTL?" ui-timepicker-rtl":"")+(b.oneLine&&"select"===b.controlType?" ui-timepicker-oneLine":"")+'"\x3e\x3cdl\x3e\x3cdt class\x3d"ui_tpicker_time_label'+
(b.showTime?"":" ui_tpicker_unit_hide")+'"\x3e'+b.timeText+'\x3c/dt\x3e\x3cdd class\x3d"ui_tpicker_time '+(b.showTime?"":" ui_tpicker_unit_hide")+'"\x3e\x3cinput class\x3d"ui_tpicker_time_input" '+(b.timeInput?"":"disabled")+"/\x3e\x3c/dd\x3e";n=0;for(m=this.units.length;nf?"0":"")+f+"\x3c/td\x3e";l+="\x3c/tr\x3e\x3c/table\x3e\x3c/div\x3e"}l+="\x3c/dd\x3e"}var n=null!==b.showTimezone?b.showTimezone:this.support.timezone,l=l+('\x3cdt class\x3d"ui_tpicker_timezone_label'+(n?"":" ui_tpicker_unit_hide")+'"\x3e'+b.timezoneText+"\x3c/dt\x3e"),l=l+('\x3cdd class\x3d"ui_tpicker_timezone'+(n?"":" ui_tpicker_unit_hide")+'"\x3e\x3c/dd\x3e')+"\x3c/dl\x3e\x3c/div\x3e",
p=e(l);!0===b.timeOnly&&(p.prepend('\x3cdiv class\x3d"ui-widget-header ui-helper-clearfix ui-corner-all"\x3e\x3cdiv class\x3d"ui-datepicker-title"\x3e'+b.timeOnlyTitle+"\x3c/div\x3e\x3c/div\x3e"),c.find(".ui-datepicker-header, .ui-datepicker-calendar").hide());n=0;for(m=a.units.length;nb?b+=12:-1!==f.indexOf("a")&&12===b&&(b=0));a.control.value(a,a[c+"_slider"],d,b);a._onTimeChange();a._onSelectHandler()}).css({cursor:"pointer",
width:100/k[d]+"%",textAlign:"center",overflow:"hidden"}));this.timezone_select=p.find(".ui_tpicker_timezone").append("\x3cselect\x3e\x3c/select\x3e").find("select");e.fn.append.apply(this.timezone_select,e.map(b.timezoneList,function(a,b){return e("\x3coption /\x3e").val("object"===typeof a?a.value:a).text("object"===typeof a?a.label:a)}));"undefined"!==typeof this.timezone&&null!==this.timezone&&""!==this.timezone?-1*(new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,
12)).getTimezoneOffset()===this.timezone?v(a):this.timezone_select.val(this.timezone):"undefined"!==typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(b.timezone):v(a);this.timezone_select.change(function(){a._onTimeChange();a._onSelectHandler();a._afterInject()});b=c.find(".ui-datepicker-buttonpane");b.length?b.before(p):c.append(p);this.$timeObj=p.find(".ui_tpicker_time_input");this.$timeObj.change(function(){var b=e.datepicker.parseTime(a.inst.settings.timeFormat,this.value),
c=new Date;b?(c.setHours(b.hour),c.setMinutes(b.minute),c.setSeconds(b.second),e.datepicker._setTime(a.inst,c)):(this.value=a.formattedTime,this.blur())});null!==this.inst&&(c=this.timeDefined,this._onTimeChange(),this.timeDefined=c);if(this._defaults.addSliderAccess){var r=this._defaults.sliderAccessArgs,q=this._defaults.isRTL;r.isRTL=q;setTimeout(function(){if(0===p.find(".ui-slider-access").length){p.find(".ui-slider:visible").sliderAccess(r);var a=p.find(".ui-slider-access:eq(0)").outerWidth(!0);
a&&p.find("table:visible").each(function(){var b=e(this),c=b.outerWidth(),d=b.css(q?"marginRight":"marginLeft").toString().replace("%",""),f=c-a,g={width:f,marginRight:0,marginLeft:0};g[q?"marginRight":"marginLeft"]=d*f/c+"%";b.css(g)})}},10)}a._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(c,b){var a=this._defaults,d=new Date(c.selectedYear,c.selectedMonth,c.selectedDay);if(this._defaults.showTimepicker){if(null!==e.datepicker._get(c,"minDateTime")&&void 0!==e.datepicker._get(c,
"minDateTime")&&d){var f=e.datepicker._get(c,"minDateTime"),g=new Date(f.getFullYear(),f.getMonth(),f.getDate(),0,0,0,0);if(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)this.hourMinOriginal=a.hourMin,this.minuteMinOriginal=a.minuteMin,this.secondMinOriginal=a.secondMin,this.millisecMinOriginal=a.millisecMin,this.microsecMinOriginal=a.microsecMin;c.settings.timeOnly||g.getTime()===d.getTime()?
(this._defaults.hourMin=f.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=f.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=f.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=f.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=f.getMicroseconds()):
(this.microsec=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=f.getMinutes(),
this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=f.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=f.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=f.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):
(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,
this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}null!==c.settings.minTime&&(a=new Date("01/01/1970 "+c.settings.minTime),this.houra.getHours()?(this.hour=this._defaults.hourMax=a.getHours(),this.minute=this._defaults.minuteMax=a.getMinutes()):this.hour===a.getHours()&&this.minute>
a.getMinutes()?this.minute=this._defaults.minuteMax=a.getMinutes():this._defaults.hourMax>a.getHours()?(this._defaults.hourMax=a.getHours(),this._defaults.minuteMax=a.getMinutes()):this._defaults.hourMax===a.getHours()===this.hour&&this._defaults.minuteMax>a.getMinutes()?this._defaults.minuteMax=a.getMinutes():this._defaults.minuteMax=59);if(void 0!==b&&!0===b){var a=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),d=parseInt(this._defaults.minuteMax-
(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),f=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),g=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),h=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,
"hour",{min:this._defaults.hourMin,max:a,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour));this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:d,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute));this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,
max:f,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond));this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:g,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec));this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,
max:h,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var c=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,b=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,a=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,d=this.millisec_slider?this.control.value(this,this.millisec_slider,
"millisec"):!1,f=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,g=this.timezone_select?this.timezone_select.val():!1,h=this._defaults,k=h.pickerTimeFormat||h.timeFormat,l=h.pickerTimeSuffix||h.timeSuffix;"object"===typeof c&&(c=!1);"object"===typeof b&&(b=!1);"object"===typeof a&&(a=!1);"object"===typeof d&&(d=!1);"object"===typeof f&&(f=!1);"object"===typeof g&&(g=!1);!1!==c&&(c=parseInt(c,10));!1!==b&&(b=parseInt(b,10));!1!==a&&(a=parseInt(a,10));!1!==d&&(d=parseInt(d,
10));!1!==f&&(f=parseInt(f,10));!1!==g&&(g=g.toString());var n=h[12>c?"amNames":"pmNames"][0],m=c!==parseInt(this.hour,10)||b!==parseInt(this.minute,10)||a!==parseInt(this.second,10)||d!==parseInt(this.millisec,10)||f!==parseInt(this.microsec,10)||0c!==(-1!==e.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&g!==this.timezone.toString();m&&(!1!==c&&(this.hour=c),!1!==b&&(this.minute=b),!1!==a&&(this.second=a),!1!==d&&(this.millisec=d),!1!==f&&(this.microsec=
f),!1!==g&&(this.timezone=g),this.inst||(this.inst=e.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0));this.support.ampm&&(this.ampm=n);this.formattedTime=e.datepicker.formatTime(h.timeFormat,this,h);this.$timeObj&&(k===h.timeFormat?this.$timeObj.val(this.formattedTime+l):this.$timeObj.val(e.datepicker.formatTime(k,this,h)+l),this.$timeObj[0].setSelectionRange&&this.$timeObj[0].setSelectionRange(this.$timeObj[0].selectionStart,this.$timeObj[0].selectionEnd));this.timeDefined=
!0;m&&this._updateDateTime()}},_onSelectHandler:function(){var c=this._defaults.onSelect||this.inst.settings.onSelect,b=this.$input?this.$input[0]:null;c&&b&&c.apply(b,[this.formattedDateTime,this])},_updateDateTime:function(c){c=this.inst||c;var b=e.datepicker._daylightSavingAdjust(0d||!b||-1c)return c;var a=c%
60,d=b?":":"",a=(0<=c?"+":"-")+("0"+Math.abs((c-a)/60)).slice(-2)+d+("0"+Math.abs(a)).slice(-2);return"+00:00"===a?"Z":a};e.timepicker.timezoneOffsetNumber=function(c){var b=c.toString().replace(":","");return"Z"===b.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(b)?("-"===b.substr(0,1)?-1:1)*(60*parseInt(b.substr(1,2),10)+parseInt(b.substr(3,2),10)):parseInt(c,10)};e.timepicker.timezoneAdjust=function(c,b,a){b=e.timepicker.timezoneOffsetNumber(b);a=e.timepicker.timezoneOffsetNumber(a);isNaN(a)||c.setMinutes(c.getMinutes()+
-b- -a);return c};e.timepicker.timeRange=function(c,b,a){return e.timepicker.handleRange("timepicker",c,b,a)};e.timepicker.datetimeRange=function(c,b,a){e.timepicker.handleRange("datetimepicker",c,b,a)};e.timepicker.dateRange=function(c,b,a){e.timepicker.handleRange("datepicker",c,b,a)};e.timepicker.handleRange=function(c,b,a,d){function f(e,f){var g=b[c]("getDate"),h=a[c]("getDate"),p=e[c]("getDate");if(null!==g){var r=new Date(g.getTime()),q=new Date(g.getTime());r.setMilliseconds(r.getMilliseconds()+
d.minInterval);q.setMilliseconds(q.getMilliseconds()+d.maxInterval);if(0h)a[c]("setDate",r);else if(0h)f[c]("setDate",p)}}function g(a,b,e){a.val()&&(a=a[c].call(a,"getDate"),null!==a&&0




© 2015 - 2024 Weber Informatics LLC | Privacy Policy