mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
3 lines
15 KiB
JavaScript
3 lines
15 KiB
JavaScript
|
!function(e){"object"==typeof exports&&exports&&"object"==typeof module&&module&&module.exports===exports?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e){function i(e){var i=e[0];return i.offsetWidth>0&&i.offsetHeight>0}function t(i){if(i.minTime&&(i.minTime=T(i.minTime)),i.maxTime&&(i.maxTime=T(i.maxTime)),i.durationTime&&"function"!=typeof i.durationTime&&(i.durationTime=T(i.durationTime)),"now"==i.scrollDefault)i.scrollDefault=function(){return i.roundingFunction(T(new Date),i)};else if(i.scrollDefault&&"function"!=typeof i.scrollDefault){var t=i.scrollDefault;i.scrollDefault=function(){return i.roundingFunction(T(t),i)}}else i.minTime&&(i.scrollDefault=function(){return i.roundingFunction(i.minTime,i)});if("string"===e.type(i.timeFormat)&&i.timeFormat.match(/[gh]/)&&(i._twelveHourTime=!0),i.showOnFocus===!1&&i.showOn.indexOf("focus")!=-1&&i.showOn.splice(i.showOn.indexOf("focus"),1),i.disableTimeRanges.length>0){for(var r in i.disableTimeRanges)i.disableTimeRanges[r]=[T(i.disableTimeRanges[r][0]),T(i.disableTimeRanges[r][1])];i.disableTimeRanges=i.disableTimeRanges.sort(function(e,i){return e[0]-i[0]});for(var r=i.disableTimeRanges.length-1;r>0;r--)i.disableTimeRanges[r][0]<=i.disableTimeRanges[r-1][1]&&(i.disableTimeRanges[r-1]=[Math.min(i.disableTimeRanges[r][0],i.disableTimeRanges[r-1][0]),Math.max(i.disableTimeRanges[r][1],i.disableTimeRanges[r-1][1])],i.disableTimeRanges.splice(r,1))}return i}function r(i){var t=i.data("timepicker-settings"),r=i.data("timepicker-list");if(r&&r.length&&(r.remove(),i.data("timepicker-list",!1)),t.useSelect){r=e("<select />",{"class":"ui-timepicker-select"});var s=r}else{r=e("<ul />",{"class":"ui-timepicker-list"});var s=e("<div />",{"class":"ui-timepicker-wrapper",tabindex:-1});s.css({display:"none",position:"absolute"}).append(r)}if(t.noneOption)if(t.noneOption===!0&&(t.noneOption=t.useSelect?"Time...":"None"),e.isArray(t.noneOption)){for(var c in t.noneOption)if(parseInt(c,10)==c){var u=n(t.noneOption[c],t.useSelect);r.append(u)}}else{var u=n(t.noneOption,t.useSelect);r.append(u)}if(t.className&&s.addClass(t.className),(null!==t.minTime||null!==t.durationTime)&&t.showDuration){"function"==typeof t.step?"function":t.step;s.addClass("ui-timepicker-with-duration"),s.addClass("ui-timepicker-step-"+t.step)}var p=t.minTime;"function"==typeof t.durationTime?p=T(t.durationTime()):null!==t.durationTime&&(p=t.durationTime);var d=null!==t.minTime?t.minTime:0,f=null!==t.maxTime?t.maxTime:d+w-1;f<d&&(f+=w),f===w-1&&"string"===e.type(t.timeFormat)&&t.show2400&&(f=w);var h=t.disableTimeRanges,y=0,x=h.length,C=t.step;"function"!=typeof C&&(C=function(){return t.step});for(var c=d,O=0;c<=f;O++,c+=60*C(O)){var D=c,R=v(D,t);if(t.useSelect){var S=e("<option />",{value:R});S.text(R)}else{var S=e("<li />");S.addClass(D%w<w/2?"ui-timepicker-am":"ui-timepicker-pm"),S.data("time",b(D,t)),S.text(R)}if((null!==t.minTime||null!==t.durationTime)&&t.showDuration){var M=k(c-p,t.step);if(t.useSelect)S.text(S.text()+" ("+M+")");else{var F=e("<span />",{"class":"ui-timepicker-duration"});F.text(" ("+M+")"),S.append(F)}}y<x&&(D>=h[y][1]&&(y+=1),h[y]&&D>=h[y][0]&&D<h[y][1]&&(t.useSelect?S.prop("disabled",!0):S.addClass("ui-timepicker-disabled"))),r.append(S)}if(s.data("timepicker-input",i),i.data("timepicker-list",s),t.useSelect)i.val()&&r.val(a(T(i.val()),t)),r.on("focus",function(){e(this).data("timepicker-input").trigger("showTimepicker")}),r.on("blur",function(){e(this).data("timepicker-input").trigger("hideTimepicker")}),r.on("change",function(){m(i,e(this).val(),"select")}),m(i,r.val(),"initial"),i.hide().after(r);else{var I=t.appendTo;"string"==typeof I?I=e(I):"function"==typeof I&&(I=I(i)),I.append(s),l(i,r),r.on("mousedown click","li",function(t){i.off("focus.timepicker"),i.on("focus.timepicker-ie-hack",function(){i.off("focus.timepicker-ie-hack"),i.on("focus.timepicker",H.show)}),o(i)||i[0].focus(),r.find("li").removeClass("ui-timepicker-selected"),e(this).addClass("ui-timepicker-selected"),g(i)&&(i.trigger("hideTimepicker"),r.on("mouseup.timepicker
|
||
|
//# sourceMappingURL=jquery.timepicker.js.map
|