Files
sysPass/app/modules/web/themes/material-blue/js/bootstrap-material-datetimepicker.min.js
Rubén D 6197c52af1 * [MOD] Update copyright date
* [MOD] Code cleanup

Signed-off-by: Rubén D <nuxsmin@syspass.org>
2019-04-27 02:48:18 +02:00

49 lines
25 KiB
JavaScript

var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,d,g){c instanceof String&&(c=String(c));for(var a=c.length,b=0;b<a;b++){var f=c[b];if(d.call(g,f,b,c))return{i:b,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,d,g){c!=Array.prototype&&c!=Object.prototype&&(c[d]=g.value)};
$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,d,g,a){if(d){g=$jscomp.global;c=c.split(".");for(a=0;a<c.length-1;a++){var b=c[a];b in g||(g[b]={});g=g[b]}c=c[c.length-1];a=g[c];d=d(a);d!=a&&null!=d&&$jscomp.defineProperty(g,c,{configurable:!0,writable:!0,value:d})}};
$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,g){return $jscomp.findInternal(this,c,g).v}},"es6","es3");
(function(c,d){function g(a,b){this.currentView=0;this.minDate;this.maxDate;this._attachedEvents=[];this.element=a;this.$element=c(a);this.params={date:!0,time:!0,format:"YYYY-MM-DD",minDate:null,maxDate:null,currentDate:null,lang:"en",weekStart:0,shortTime:!1,clearButton:!1,nowButton:!1,cancelText:"Cancel",okText:"OK",clearText:"Clear",nowText:"Now",switchOnClick:!1,triggerEvent:"focus"};this.params=c.fn.extend(this.params,b);this.name="dtp_"+this.setName();this.$element.attr("data-dtp",this.name);
d.locale(this.params.lang);this.init()}d.locale("en");c.fn.bootstrapMaterialDatePicker=function(a,b){this.each(function(){if(c.data(this,"plugin_bootstrapMaterialDatePicker")){if("function"===typeof c.data(this,"plugin_bootstrapMaterialDatePicker")[a])c.data(this,"plugin_bootstrapMaterialDatePicker")[a](b);"destroy"===a&&c.removeData(this)}else c.data(this,"plugin_bootstrapMaterialDatePicker",new g(this,a))});return this};g.prototype={init:function(){this.initDays();this.initDates();this.initTemplate();
this.initButtons();this._attachEvent(c(window),"resize",this._centerBox.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-content"),"click",this._onElementClick.bind(this));this._attachEvent(this.$dtpElement,"click",this._onBackgroundClick.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-close > a"),"click",this._onCloseClick.bind(this));this._attachEvent(this.$element,this.params.triggerEvent,this._fireCalendar.bind(this))},initDays:function(){this.days=[];for(var a=this.params.weekStart;7>
this.days.length;a++)6<a&&(a=0),this.days.push(a.toString())},initDates:function(){if(0<this.$element.val().length)this.currentDate="undefined"!==typeof this.params.format&&null!==this.params.format?d(this.$element.val(),this.params.format).locale(this.params.lang):d(this.$element.val()).locale(this.params.lang);else if("undefined"!==typeof this.$element.attr("value")&&null!==this.$element.attr("value")&&""!==this.$element.attr("value"))"string"===typeof this.$element.attr("value")&&(this.currentDate=
"undefined"!==typeof this.params.format&&null!==this.params.format?d(this.$element.attr("value"),this.params.format).locale(this.params.lang):d(this.$element.attr("value")).locale(this.params.lang));else if("undefined"!==typeof this.params.currentDate&&null!==this.params.currentDate){if("string"===typeof this.params.currentDate)this.currentDate="undefined"!==typeof this.params.format&&null!==this.params.format?d(this.params.currentDate,this.params.format).locale(this.params.lang):d(this.params.currentDate).locale(this.params.lang);
else if("undefined"===typeof this.params.currentDate.isValid||"function"!==typeof this.params.currentDate.isValid){var a=this.params.currentDate.getTime();this.currentDate=d(a,"x").locale(this.params.lang)}else this.currentDate=this.params.currentDate;this.$element.val(this.currentDate.format(this.params.format))}else this.currentDate=d();"undefined"!==typeof this.params.minDate&&null!==this.params.minDate?"string"===typeof this.params.minDate?this.minDate="undefined"!==typeof this.params.format&&
null!==this.params.format?d(this.params.minDate,this.params.format).locale(this.params.lang):d(this.params.minDate).locale(this.params.lang):"undefined"===typeof this.params.minDate.isValid||"function"!==typeof this.params.minDate.isValid?(a=this.params.minDate.getTime(),this.minDate=d(a,"x").locale(this.params.lang)):this.minDate=this.params.minDate:null===this.params.minDate&&(this.minDate=null);"undefined"!==typeof this.params.maxDate&&null!==this.params.maxDate?"string"===typeof this.params.maxDate?
this.maxDate="undefined"!==typeof this.params.format&&null!==this.params.format?d(this.params.maxDate,this.params.format).locale(this.params.lang):d(this.params.maxDate).locale(this.params.lang):"undefined"===typeof this.params.maxDate.isValid||"function"!==typeof this.params.maxDate.isValid?(a=this.params.maxDate.getTime(),this.maxDate=d(a,"x").locale(this.params.lang)):this.maxDate=this.params.maxDate:null===this.params.maxDate&&(this.maxDate=null);this.isAfterMinDate(this.currentDate)||(this.currentDate=
d(this.minDate));this.isBeforeMaxDate(this.currentDate)||(this.currentDate=d(this.maxDate))},initTemplate:function(){this.template='<div class="dtp hidden" id="'+this.name+'"><div class="dtp-content"><div class="dtp-date-view"><header class="dtp-header"><div class="dtp-actual-day">Lundi</div><div class="dtp-close"><a href="javascript:void(0);"><i class="material-icons">clear</i></a></div></header><div class="dtp-date hidden"><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-month-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-month p80">MAR</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-month-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div><div class="dtp-actual-num">13</div><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-year-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-year p80">2014</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-year-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div></div><div class="dtp-time hidden"><div class="dtp-actual-maxtime">23:55</div></div><div class="dtp-picker"><div class="dtp-picker-calendar"></div><div class="dtp-picker-datetime hidden"><div class="dtp-actual-meridien"><div class="left p20"><a class="dtp-meridien-am" href="javascript:void(0);">AM</a></div><div class="dtp-actual-time p60"></div><div class="right p20"><a class="dtp-meridien-pm" href="javascript:void(0);">PM</a></div><div class="clearfix"></div></div><div id="dtp-svg-clock"></div></div></div></div><div class="dtp-buttons"><button class="dtp-btn-now btn btn-flat hidden mdl-button mdl-js-button">'+
this.params.nowText+'</button><button class="dtp-btn-clear btn btn-flat hidden mdl-button mdl-js-button">'+this.params.clearText+'</button><button class="dtp-btn-cancel btn btn-flat mdl-button mdl-js-button mdl-button--primary">'+this.params.cancelText+'</button><button class="dtp-btn-ok btn btn-flat mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--primary">'+this.params.okText+'</button><div class="clearfix"></div></div></div></div>';var a=c("body");0>=a.find("#"+this.name).length&&(a.append(this.template),
this&&(this.dtpElement=a.find("#"+this.name)),this.$dtpElement=c(this.dtpElement))},initButtons:function(){this._attachEvent(this.$dtpElement.find(".dtp-btn-cancel"),"click",this._onCancelClick.bind(this));this._attachEvent(this.$dtpElement.find(".dtp-btn-ok"),"click",this._onOKClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-month-before"),"click",this._onMonthBeforeClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-month-after"),"click",this._onMonthAfterClick.bind(this));
this._attachEvent(this.$dtpElement.find("a.dtp-select-year-before"),"click",this._onYearBeforeClick.bind(this));this._attachEvent(this.$dtpElement.find("a.dtp-select-year-after"),"click",this._onYearAfterClick.bind(this));!0===this.params.clearButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-clear"),"click",this._onClearClick.bind(this)),this.$dtpElement.find(".dtp-btn-clear").removeClass("hidden"));!0===this.params.nowButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-now"),"click",
this._onNowClick.bind(this)),this.$dtpElement.find(".dtp-btn-now").removeClass("hidden"));!0===this.params.nowButton&&!0===this.params.clearButton?this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-xs"):(!0===this.params.nowButton||!0===this.params.clearButton)&&this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-sm")},initMeridienButtons:function(){this.$dtpElement.find("a.dtp-meridien-am").off("click").on("click",
this._onSelectAM.bind(this));this.$dtpElement.find("a.dtp-meridien-pm").off("click").on("click",this._onSelectPM.bind(this))},initDate:function(a){this.currentView=0;this.$dtpElement.find(".dtp-picker-calendar").removeClass("hidden");this.$dtpElement.find(".dtp-picker-datetime").addClass("hidden");a="undefined"!==typeof this.currentDate&&null!==this.currentDate?this.currentDate:null;var b=this.generateCalendar(this.currentDate);"undefined"!==typeof b.week&&"undefined"!==typeof b.days&&(b=this.constructHTMLCalendar(a,
b),this.$dtpElement.find("a.dtp-select-day").off("click"),this.$dtpElement.find(".dtp-picker-calendar").html(b),this.$dtpElement.find("a.dtp-select-day").on("click",this._onSelectDate.bind(this)),this.toggleButtons(a));this._centerBox();this.showDate(a)},initHours:function(){this.currentView=1;this.showTime(this.currentDate);this.initMeridienButtons();12>this.currentDate.hour()?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click();var a=this.params.shortTime?
"h":"H";this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden");this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden");for(var b=this.createSVGClock(!0),f=0;12>f;f++){var e=-(162*Math.sin(f/12*-Math.PI*2)),c=-(162*Math.cos(f/12*-Math.PI*2)),d=this.currentDate.format(a)==f?"#8BC34A":"transparent",g=this.currentDate.format(a)==f?"#fff":"#000";d=this.createSVGElement("circle",{id:"h-"+f,"class":"dtp-select-hour",style:"cursor:pointer",r:"30",cx:e,cy:c,fill:d,"data-hour":f});e=this.createSVGElement("text",
{id:"th-"+f,"class":"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"20",x:e,y:c+7,fill:g,"data-hour":f});e.textContent=0===f?this.params.shortTime?12:f:f;this.toggleTime(f,!0)?(d.addEventListener("click",this._onSelectHour.bind(this)),e.addEventListener("click",this._onSelectHour.bind(this))):(d.className+=" disabled",e.className+=" disabled",e.setAttribute("fill","#bdbdbd"));b.appendChild(d);b.appendChild(e)}if(!this.params.shortTime){for(f=
0;12>f;f++)e=-(110*Math.sin(f/12*-Math.PI*2)),c=-(110*Math.cos(f/12*-Math.PI*2)),d=this.currentDate.format(a)==f+12?"#8BC34A":"transparent",g=this.currentDate.format(a)==f+12?"#fff":"#000",d=this.createSVGElement("circle",{id:"h-"+(f+12),"class":"dtp-select-hour",style:"cursor:pointer",r:"30",cx:e,cy:c,fill:d,"data-hour":f+12}),e=this.createSVGElement("text",{id:"th-"+(f+12),"class":"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"22",x:e,y:c+
7,fill:g,"data-hour":f+12}),e.textContent=f+12,this.toggleTime(f+12,!0)?(d.addEventListener("click",this._onSelectHour.bind(this)),e.addEventListener("click",this._onSelectHour.bind(this))):(d.className+=" disabled",e.className+=" disabled",e.setAttribute("fill","#bdbdbd")),b.appendChild(d),b.appendChild(e);this.$dtpElement.find("a.dtp-meridien-am").addClass("hidden");this.$dtpElement.find("a.dtp-meridien-pm").addClass("hidden")}this._centerBox()},initMinutes:function(){this.currentView=2;this.showTime(this.currentDate);
this.initMeridienButtons();12>this.currentDate.hour()?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click();this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden");this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden");for(var a=this.createSVGClock(!1),b=0;60>b;b++){var f=0===b%5?162:158,e=0===b%5?30:20,c=-(f*Math.sin(b/60*-Math.PI*2));f=-(f*Math.cos(b/60*-Math.PI*2));var d=this.currentDate.format("m")==b?"#8BC34A":"transparent";
e=this.createSVGElement("circle",{id:"m-"+b,"class":"dtp-select-minute",style:"cursor:pointer",r:e,cx:c,cy:f,fill:d,"data-minute":b});this.toggleTime(b,!1)?e.addEventListener("click",this._onSelectMinute.bind(this)):e.className+=" disabled";a.appendChild(e)}for(b=0;60>b;b++)0===b%5&&(c=-(162*Math.sin(b/60*-Math.PI*2)),f=-(162*Math.cos(b/60*-Math.PI*2)),d=this.currentDate.format("m")==b?"#fff":"#000",e=this.createSVGElement("text",{id:"tm-"+b,"class":"dtp-select-minute-text","text-anchor":"middle",
style:"cursor:pointer","font-weight":"bold","font-size":"20",x:c,y:f+7,fill:d,"data-minute":b}),e.textContent=b,this.toggleTime(b,!1)?e.addEventListener("click",this._onSelectMinute.bind(this)):(e.className+=" disabled",e.setAttribute("fill","#bdbdbd")),a.appendChild(e));this._centerBox()},animateHands:function(){var a=this.currentDate.hour(),b=this.currentDate.minute();this.$dtpElement.find(".hour-hand")[0].setAttribute("transform","rotate("+360*a/12+")");this.$dtpElement.find(".minute-hand")[0].setAttribute("transform",
"rotate("+360*b/60+")")},createSVGClock:function(a){var b=this.params.shortTime?-120:-90,f=this.createSVGElement("svg",{class:"svg-clock",viewBox:"0,0,400,400"}),e=this.createSVGElement("g",{transform:"translate(200,200) "}),c=this.createSVGElement("circle",{r:"192",fill:"#eee",stroke:"#bdbdbd","stroke-width":2}),d=this.createSVGElement("circle",{r:"15",fill:"#757575"});e.appendChild(c);a?(a=this.createSVGElement("line",{class:"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#bdbdbd","stroke-width":2}),
b=this.createSVGElement("line",{class:"hour-hand",x1:0,y1:0,x2:0,y2:b,stroke:"#8BC34A","stroke-width":8}),e.appendChild(a),e.appendChild(b)):(a=this.createSVGElement("line",{class:"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#8BC34A","stroke-width":2}),b=this.createSVGElement("line",{class:"hour-hand",x1:0,y1:0,x2:0,y2:b,stroke:"#bdbdbd","stroke-width":8}),e.appendChild(b),e.appendChild(a));e.appendChild(d);f.appendChild(e);this.$dtpElement.find("#dtp-svg-clock").empty();this.$dtpElement.find("#dtp-svg-clock")[0].appendChild(f);
this.animateHands();return e},createSVGElement:function(a,b){a=document.createElementNS("http://www.w3.org/2000/svg",a);for(var f in b)a.setAttribute(f,b[f]);return a},isAfterMinDate:function(a,b,f){var c=!0;"undefined"!==typeof this.minDate&&null!==this.minDate&&(c=d(this.minDate),a=d(a),b||f||(c.hour(0),c.minute(0),a.hour(0),a.minute(0)),c.second(0),a.second(0),c.millisecond(0),a.millisecond(0),f||(a.minute(0),c.minute(0)),c=parseInt(a.format("X"))>=parseInt(c.format("X")));return c},isBeforeMaxDate:function(a,
b,c){var f=!0;"undefined"!==typeof this.maxDate&&null!==this.maxDate&&(f=d(this.maxDate),a=d(a),b||c||(f.hour(0),f.minute(0),a.hour(0),a.minute(0)),f.second(0),a.second(0),f.millisecond(0),a.millisecond(0),c||(a.minute(0),f.minute(0)),f=parseInt(a.format("X"))<=parseInt(f.format("X")));return f},rotateElement:function(a,b){c(a).css({WebkitTransform:"rotate("+b+"deg)","-moz-transform":"rotate("+b+"deg)"})},showDate:function(a){a&&(this.$dtpElement.find(".dtp-actual-day").html(a.locale(this.params.lang).format("dddd")),
this.$dtpElement.find(".dtp-actual-month").html(a.locale(this.params.lang).format("MMM").toUpperCase()),this.$dtpElement.find(".dtp-actual-num").html(a.locale(this.params.lang).format("DD")),this.$dtpElement.find(".dtp-actual-year").html(a.locale(this.params.lang).format("YYYY")))},showTime:function(a){if(a){var b=a.minute();b=(this.params.shortTime?a.format("hh"):a.format("HH"))+":"+(2==b.toString().length?b:"0"+b)+(this.params.shortTime?" "+a.format("A"):"");this.params.date?this.$dtpElement.find(".dtp-actual-time").html(b):
(this.params.shortTime?this.$dtpElement.find(".dtp-actual-day").html(a.format("A")):this.$dtpElement.find(".dtp-actual-day").html("&nbsp;"),this.$dtpElement.find(".dtp-actual-maxtime").html(b))}},selectDate:function(a){a&&(this.currentDate.date(a),this.showDate(this.currentDate),this.$element.trigger("dateSelected",this.currentDate))},generateCalendar:function(a){var b={};if(null!==a){var c=d(a).locale(this.params.lang).startOf("month");a=d(a).locale(this.params.lang).endOf("month");var e=c.format("d");
b.week=this.days;b.days=[];for(var g=c.date();g<=a.date();g++){if(g===c.date()){var h=b.week.indexOf(e.toString());if(0<h)for(var k=0;k<h;k++)b.days.push(0)}b.days.push(d(c).locale(this.params.lang).date(g))}}return b},constructHTMLCalendar:function(a,b){a='<div class="dtp-picker-month">'+a.locale(this.params.lang).format("MMMM YYYY")+"</div>";a+='<table class="table dtp-picker-days"><thead>';for(var c=0;c<b.week.length;c++)a+="<th>"+d(parseInt(b.week[c]),"d").locale(this.params.lang).format("dd").substring(0,
1)+"</th>";a+="</thead><tbody><tr>";for(c=0;c<b.days.length;c++)0==c%7&&(a+="</tr><tr>"),a+='<td data-date="'+d(b.days[c]).locale(this.params.lang).format("D")+'">',0!=b.days[c]&&(a=!1===this.isBeforeMaxDate(d(b.days[c]),!1,!1)||!1===this.isAfterMinDate(d(b.days[c]),!1,!1)?a+('<span class="dtp-select-day">'+d(b.days[c]).locale(this.params.lang).format("DD")+"</span>"):d(b.days[c]).locale(this.params.lang).format("DD")===d(this.currentDate).locale(this.params.lang).format("DD")?a+('<a href="javascript:void(0);" class="dtp-select-day selected">'+
d(b.days[c]).locale(this.params.lang).format("DD")+"</a>"):a+('<a href="javascript:void(0);" class="dtp-select-day">'+d(b.days[c]).locale(this.params.lang).format("DD")+"</a>"),a+="</td>");return a+"</tr></tbody></table>"},setName:function(){for(var a="",b=0;5>b;b++)a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return a},isPM:function(){return this.$dtpElement.find("a.dtp-meridien-pm").hasClass("selected")},setElementValue:function(){this.$element.trigger("beforeChange",
this.currentDate);this.$element.hasClass("mdl-textfield__input")&&(this.$element.removeClass("empty"),this.$element.parent().addClass("is-dirty"));this.$element.val(d(this.currentDate).locale(this.params.lang).format(this.params.format));this.$element.trigger("change",this.currentDate)},toggleButtons:function(a){if(a&&a.isValid()){var b=d(a).locale(this.params.lang).startOf("month"),c=d(a).locale(this.params.lang).endOf("month");this.isAfterMinDate(b,!1,!1)?this.$dtpElement.find("a.dtp-select-month-before").removeClass("invisible"):
this.$dtpElement.find("a.dtp-select-month-before").addClass("invisible");this.isBeforeMaxDate(c,!1,!1)?this.$dtpElement.find("a.dtp-select-month-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-month-after").addClass("invisible");b=d(a).locale(this.params.lang).startOf("year");a=d(a).locale(this.params.lang).endOf("year");this.isAfterMinDate(b,!1,!1)?this.$dtpElement.find("a.dtp-select-year-before").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-before").addClass("invisible");
this.isBeforeMaxDate(a,!1,!1)?this.$dtpElement.find("a.dtp-select-year-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-after").addClass("invisible")}},toggleTime:function(a,b){b?(b=d(this.currentDate),b.hour(this.convertHours(a)).minute(0).second(0),a=!(!1===this.isAfterMinDate(b,!0,!1)||!1===this.isBeforeMaxDate(b,!0,!1))):(b=d(this.currentDate),b.minute(a).second(0),a=!(!1===this.isAfterMinDate(b,!0,!0)||!1===this.isBeforeMaxDate(b,!0,!0)));return a},_attachEvent:function(a,
b,c){a.on(b,null,null,c);this._attachedEvents.push([a,b,c])},_detachEvents:function(){for(var a=this._attachedEvents.length-1;0<=a;a--)this._attachedEvents[a][0].off(this._attachedEvents[a][1],this._attachedEvents[a][2]),this._attachedEvents.splice(a,1)},_fireCalendar:function(){this.currentView=0;this.$element.blur();this.initDates();this.show();this.params.date?(this.$dtpElement.find(".dtp-date").removeClass("hidden"),this.initDate()):this.params.time&&(this.$dtpElement.find(".dtp-time").removeClass("hidden"),
this.initHours())},_onBackgroundClick:function(a){a.stopPropagation();this.hide()},_onElementClick:function(a){a.stopPropagation()},_onKeydown:function(a){27===a.which&&this.hide()},_onCloseClick:function(){this.hide()},_onClearClick:function(){this.currentDate=null;this.$element.trigger("beforeChange",this.currentDate);this.hide();"undefined"!==typeof c.material&&this.$element.addClass("empty");this.$element.val("");this.$element.trigger("change",this.currentDate)},_onNowClick:function(){this.currentDate=
d();!0===this.params.date&&(this.showDate(this.currentDate),0===this.currentView&&this.initDate());if(!0===this.params.time){this.showTime(this.currentDate);switch(this.currentView){case 1:this.initHours();break;case 2:this.initMinutes()}this.animateHands()}},_onOKClick:function(){switch(this.currentView){case 0:!0===this.params.time?this.initHours():(this.setElementValue(),this.hide());break;case 1:this.initMinutes();break;case 2:this.setElementValue(),this.hide()}},_onCancelClick:function(){if(this.params.time)switch(this.currentView){case 0:this.hide();
break;case 1:this.params.date?this.initDate():this.hide();break;case 2:this.initHours()}else this.hide()},_onMonthBeforeClick:function(){this.currentDate.subtract(1,"months");this.initDate(this.currentDate)},_onMonthAfterClick:function(){this.currentDate.add(1,"months");this.initDate(this.currentDate)},_onYearBeforeClick:function(){this.currentDate.subtract(1,"years");this.initDate(this.currentDate)},_onYearAfterClick:function(){this.currentDate.add(1,"years");this.initDate(this.currentDate)},_onSelectDate:function(a){this.$dtpElement.find("a.dtp-select-day").removeClass("selected");
c(a.currentTarget).addClass("selected");this.selectDate(c(a.currentTarget).parent().data("date"));!0===this.params.switchOnClick&&!0===this.params.time&&setTimeout(this.initHours.bind(this),200);!0===this.params.switchOnClick&&!1===this.params.time&&setTimeout(this._onOKClick.bind(this),200)},_onSelectHour:function(a){if(!c(a.target).hasClass("disabled")){var b=c(a.target).data("hour");a=c(a.target).parent();for(var d=a.find(".dtp-select-hour"),e=0;e<d.length;e++)c(d[e]).attr("fill","transparent");
d=a.find(".dtp-select-hour-text");for(e=0;e<d.length;e++)c(d[e]).attr("fill","#000");c(a.find("#h-"+b)).attr("fill","#8BC34A");c(a.find("#th-"+b)).attr("fill","#fff");this.currentDate.hour(parseInt(b));!0===this.params.shortTime&&this.isPM()&&this.currentDate.add(12,"hours");this.showTime(this.currentDate);this.animateHands();!0===this.params.switchOnClick&&setTimeout(this.initMinutes.bind(this),200)}},_onSelectMinute:function(a){if(!c(a.target).hasClass("disabled")){var b=c(a.target).data("minute");
a=c(a.target).parent();for(var d=a.find(".dtp-select-minute"),e=0;e<d.length;e++)c(d[e]).attr("fill","transparent");d=a.find(".dtp-select-minute-text");for(e=0;e<d.length;e++)c(d[e]).attr("fill","#000");c(a.find("#m-"+b)).attr("fill","#8BC34A");c(a.find("#tm-"+b)).attr("fill","#fff");this.currentDate.minute(parseInt(b));this.showTime(this.currentDate);this.animateHands();!0===this.params.switchOnClick&&setTimeout(function(){this.setElementValue();this.hide()}.bind(this),200)}},_onSelectAM:function(a){c(".dtp-actual-meridien").find("a").removeClass("selected");
c(a.currentTarget).addClass("selected");12<=this.currentDate.hour()&&this.currentDate.subtract(12,"hours")&&this.showTime(this.currentDate);this.toggleTime(1===this.currentView)},_onSelectPM:function(a){c(".dtp-actual-meridien").find("a").removeClass("selected");c(a.currentTarget).addClass("selected");12>this.currentDate.hour()&&this.currentDate.add(12,"hours")&&this.showTime(this.currentDate);this.toggleTime(1===this.currentView)},convertHours:function(a){var b=a;!0===this.params.shortTime&&12>a&&
this.isPM()&&(b+=12);return b},setDate:function(a){this.params.currentDate=a;this.initDates()},setMinDate:function(a){this.params.minDate=a;this.initDates()},setMaxDate:function(a){this.params.maxDate=a;this.initDates()},destroy:function(){this._detachEvents();this.$dtpElement.remove()},show:function(){this.$dtpElement.removeClass("hidden");this._attachEvent(c(window),"keydown",this._onKeydown.bind(this));this._centerBox()},hide:function(){c(window).off("keydown",null,null,this._onKeydown.bind(this));
this.$dtpElement.addClass("hidden")},_centerBox:function(){var a=(this.$dtpElement.height()-this.$dtpElement.find(".dtp-content").height())/2;this.$dtpElement.find(".dtp-content").css("marginLeft",-(this.$dtpElement.find(".dtp-content").width()/2)+"px");this.$dtpElement.find(".dtp-content").css("top",a+"px")},enableDays:function(){var a=this.params.enableDays;a&&c(".dtp-picker-days tbody tr td").each(function(){0<=c.inArray(c(this).index(),a)||c(this).find("a").css({background:"#e3e3e3",cursor:"no-drop",
opacity:"0.5"}).off("click")})}}})(jQuery,moment);