Seditio Source
Root |
./othercms/xenForo 2.2.8/js/xf/date_input-compiled.js
/*
 * XenForo pikaday.min.js
 * Copyright 2010-2021 XenForo Ltd.
 * Released under the XenForo License Agreement: https://xenforo.com/license-agreement
 */
/*
 Pikaday

 Copyright ? 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday
*/
'use strict';(function(z,A){if("object"===typeof exports){try{var E=require("moment")}catch(k){}module.exports=A(E)}else"function"===typeof define&&define.amd?define(function(k){try{E=k("moment")}catch(K){}return A(E)}):z.Pikaday=A(z.moment)})(this,function(z){var A="function"===typeof z,E=!!window.addEventListener,k=window.document,K=window.setTimeout,x=function(a,b,d,c){E?a.addEventListener(b,d,!!c):a.attachEvent("on"+b,d)},B=function(a,b,d,c){E?a.removeEventListener(b,d,!!c):a.detachEvent("on"+
b,d)},q=function(a,b){return-1!==(" "+a.className+" ").indexOf(" "+b+" ")},O=function(a,b){q(a,b)||(a.className=""===a.className?b:a.className+" "+b)},P=function(a,b){b=(" "+a.className+" ").replace(" "+b+" "," ");b=b.trim?b.trim():b.replace(/^\s+|\s+$/g,"");a.className=b},Q=function(a){return/Array/.test(Object.prototype.toString.call(a))},r=function(a){return/Date/.test(Object.prototype.toString.call(a))&&!isNaN(a.getTime())},V=function(a,b){return[31,0===a%4&&0!==a%100||0===a%400?29:28,31,30,31,
30,31,31,30,31,30,31][b]},L=function(a){r(a)&&a.setHours(0,0,0,0)},M=function(a,b){return a.getTime()===b.getTime()},I=function(a,b,d){var c,e;for(c in b)if((e=void 0!==a[c])&&"object"===typeof b[c]&&null!==b[c]&&void 0===b[c].nodeName)r(b[c])?d&&(a[c]=new Date(b[c].getTime())):Q(b[c])?d&&(a[c]=b[c].slice(0)):a[c]=I({},b[c],d);else if(d||!e)a[c]=b[c];return a},W=function(a,b,d){if(k.createEvent){var c=k.createEvent("HTMLEvents");c.initEvent(b,!0,!1);c=I(c,d);a.dispatchEvent(c)}else k.createEventObject&&
(c=k.createEventObject(),c=I(c,d),a.fireEvent("on"+b,c))},X=function(a){0>a.month&&(a.year-=Math.ceil(Math.abs(a.month)/12),a.month+=12);11<a.month&&(a.year+=Math.floor(Math.abs(a.month)/12),a.month-=12);return a},y={field:null,bound:void 0,ariaLabel:"Use the arrow keys to pick a date",position:"bottom left",reposition:!0,format:"YYYY-MM-DD",toString:null,parse:null,defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,pickWholeWeek:!1,
minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,enableSelectionDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,blurFieldOnSelect:!0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:"January February March April May June July August September October November December".split(" "),weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" ")},theme:null,events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null,keyboardInput:!0},Y=function(a,b,d){for(b+=a.firstDay;7<=b;)b-=7;return d?a.i18n.weekdaysShort[b]:a.i18n.weekdays[b]},aa=function(a,b,d,c,e,l){var f,h=a._o,p=d===h.minYear,t=d===h.maxYear;l='<div id="'+l+'" class="pika-title" role="heading" aria-live="assertive">';var v=!0,J=!0;var F=[];for(f=0;12>f;f++)F.push('<option value="'+(d===e?f-b:12+f-b)+'"'+(f===c?' selected="selected"':
"")+(p&&f<h.minMonth||t&&f>h.maxMonth?' disabled="disabled"':"")+">"+h.i18n.months[f]+"</option>");e='<div class="pika-label">'+h.i18n.months[c]+'<select class="pika-select pika-select-month" tabindex="-1">'+F.join("")+"</select></div>";if(Q(h.yearRange)){f=h.yearRange[0];var N=h.yearRange[1]+1}else f=d-h.yearRange,N=1+d+h.yearRange;for(F=[];f<N&&f<=h.maxYear;f++)f>=h.minYear&&F.push('<option value="'+f+'"'+(f===d?' selected="selected"':"")+">"+f+"</option>");d='<div class="pika-label">'+d+h.yearSuffix+
'<select class="pika-select pika-select-year" tabindex="-1">'+F.join("")+"</select></div>";l=h.showMonthAfterYear?l+(d+e):l+(e+d);p&&(0===c||h.minMonth>=c)&&(v=!1);t&&(11===c||h.maxMonth<=c)&&(J=!1);0===b&&(l+='<button class="pika-prev'+(v?"":" is-disabled")+'" type="button">'+h.i18n.previousMonth+"</button>");b===a._o.numberOfMonths-1&&(l+='<button class="pika-next'+(J?"":" is-disabled")+'" type="button">'+h.i18n.nextMonth+"</button>");return l+"</div>"},Z=function(a){var b=this,d=b.config(a);b._onMouseDown=
function(c){if(b._v){c=c||window.event;var e=c.target||c.srcElement;if(e)if(q(e,"is-disabled")||(!q(e,"pika-button")||q(e,"is-empty")||q(e.parentNode,"is-disabled")?q(e,"pika-prev")?b.prevMonth():q(e,"pika-next")&&b.nextMonth():(b.setDate(new Date(e.getAttribute("data-pika-year"),e.getAttribute("data-pika-month"),e.getAttribute("data-pika-day"))),d.bound&&K(function(){b.hide();d.blurFieldOnSelect&&d.field&&d.field.blur()},100))),q(e,"pika-select"))b._c=!0;else if(c.preventDefault)c.preventDefault();
else return c.returnValue=!1}};b._onChange=function(c){c=c||window.event;(c=c.target||c.srcElement)&&(q(c,"pika-select-month")?b.gotoMonth(c.value):q(c,"pika-select-year")&&b.gotoYear(c.value))};b._onKeyChange=function(c){c=c||window.event;if(b.isVisible())switch(c.keyCode){case 13:case 27:d.field&&d.field.blur();break;case 37:b.adjustDate("subtract",1);break;case 38:b.adjustDate("subtract",7);break;case 39:b.adjustDate("add",1);break;case 40:b.adjustDate("add",7)}};b._parseFieldValue=function(){if(d.parse)return d.parse(d.field.value,
d.format);if(A){var c=z(d.field.value,d.format,d.formatStrict);return c&&c.isValid()?c.toDate():null}return new Date(Date.parse(d.field.value))};b._onInputChange=function(c){c.firedBy!==b&&(c=b._parseFieldValue(),r(c)&&b.setDate(c),b._v||b.show())};b._onInputFocus=function(){b.show()};b._onInputClick=function(){b.show()};b._onInputBlur=function(){var c=k.activeElement;do if(q(c,"pika-single"))return;while(c=c.parentNode);b._c||(b._b=K(function(){b.hide()},50));b._c=!1};b._onClick=function(c){c=c||
window.event;var e=c=c.target||c.srcElement;if(c){E||!q(c,"pika-select")||c.onchange||(c.setAttribute("onchange","return;"),x(c,"change",b._onChange));do if(q(e,"pika-single")||e===d.trigger)return;while(e=e.parentNode);b._v&&c!==d.trigger&&e!==d.trigger&&b.hide()}};b.el=k.createElement("div");b.el.className="pika-single"+(d.isRTL?" is-rtl":"")+(d.theme?" "+d.theme:"");x(b.el,"mousedown",b._onMouseDown,!0);x(b.el,"touchend",b._onMouseDown,!0);x(b.el,"change",b._onChange);d.keyboardInput&&x(k,"keydown",
b._onKeyChange);d.field&&(d.container?d.container.appendChild(b.el):d.bound?k.body.appendChild(b.el):d.field.parentNode.insertBefore(b.el,d.field.nextSibling),x(d.field,"change",b._onInputChange),d.defaultDate||(d.defaultDate=b._parseFieldValue(),d.setDefaultDate=!0));a=d.defaultDate;r(a)?d.setDefaultDate?b.setDate(a,!0):b.gotoDate(a):b.gotoDate(new Date);d.bound?(this.hide(),b.el.className+=" is-bound",x(d.trigger,"click",b._onInputClick),x(d.trigger,"focus",b._onInputFocus),x(d.trigger,"blur",b._onInputBlur)):
this.show()};Z.prototype={config:function(a){this._o||(this._o=I({},y,!0));a=I(this._o,a,!0);a.isRTL=!!a.isRTL;a.field=a.field&&a.field.nodeName?a.field:null;a.theme="string"===typeof a.theme&&a.theme?a.theme:null;a.bound=!!(void 0!==a.bound?a.field&&a.bound:a.field);a.trigger=a.trigger&&a.trigger.nodeName?a.trigger:a.field;a.disableWeekends=!!a.disableWeekends;a.disableDayFn="function"===typeof a.disableDayFn?a.disableDayFn:null;var b=parseInt(a.numberOfMonths,10)||1;a.numberOfMonths=4<b?4:b;r(a.minDate)||
(a.minDate=!1);r(a.maxDate)||(a.maxDate=!1);a.minDate&&a.maxDate&&a.maxDate<a.minDate&&(a.maxDate=a.minDate=!1);a.minDate&&this.setMinDate(a.minDate);a.maxDate&&this.setMaxDate(a.maxDate);Q(a.yearRange)?(b=(new Date).getFullYear()-10,a.yearRange[0]=parseInt(a.yearRange[0],10)||b,a.yearRange[1]=parseInt(a.yearRange[1],10)||b):(a.yearRange=Math.abs(parseInt(a.yearRange,10))||y.yearRange,100<a.yearRange&&(a.yearRange=100));return a},toString:function(a){a=a||this._o.format;return r(this._d)?this._o.toString?
this._o.toString(this._d,a):A?z(this._d).format(a):this._d.toDateString():""},getMoment:function(){return A?z(this._d):null},setMoment:function(a,b){A&&z.isMoment(a)&&this.setDate(a.toDate(),b)},getDate:function(){return r(this._d)?new Date(this._d.getTime()):null},setDate:function(a,b){if(!a)return this._d=null,this._o.field&&(this._o.field.value="",W(this._o.field,"change",{firedBy:this})),this.draw();"string"===typeof a&&(a=new Date(Date.parse(a)));if(r(a)){var d=this._o.minDate,c=this._o.maxDate;
r(d)&&a<d?a=d:r(c)&&a>c&&(a=c);this._d=new Date(a.getTime());L(this._d);this.gotoDate(this._d);this._o.field&&(this._o.field.value=this.toString(),W(this._o.field,"change",{firedBy:this}));b||"function"!==typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},clear:function(){this.setDate(null)},gotoDate:function(a){var b=!0;if(r(a)){if(this.calendars){b=new Date(this.calendars[0].year,this.calendars[0].month,1);var d=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-
1].month,1),c=a.getTime();d.setMonth(d.getMonth()+1);d.setDate(d.getDate()-1);b=c<b.getTime()||d.getTime()<c}b&&(this.calendars=[{month:a.getMonth(),year:a.getFullYear()}],"right"===this._o.mainCalendar&&(this.calendars[0].month+=1-this._o.numberOfMonths));this.adjustCalendars()}},adjustDate:function(a,b){var d=this.getDate()||new Date;b=864E5*parseInt(b);var c;"add"===a?c=new Date(d.valueOf()+b):"subtract"===a&&(c=new Date(d.valueOf()-b));this.setDate(c)},adjustCalendars:function(){this.calendars[0]=
X(this.calendars[0]);for(var a=1;a<this._o.numberOfMonths;a++)this.calendars[a]=X({month:this.calendars[0].month+a,year:this.calendars[0].year});this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(a){isNaN(a)||(this.calendars[0].month=parseInt(a,10),this.adjustCalendars())},nextMonth:function(){this.calendars[0].month++;this.adjustCalendars()},prevMonth:function(){this.calendars[0].month--;this.adjustCalendars()},gotoYear:function(a){isNaN(a)||(this.calendars[0].year=parseInt(a,
10),this.adjustCalendars())},setMinDate:function(a){a instanceof Date?(L(a),this._o.minDate=a,this._o.minYear=a.getFullYear(),this._o.minMonth=a.getMonth()):(this._o.minDate=y.minDate,this._o.minYear=y.minYear,this._o.minMonth=y.minMonth,this._o.startRange=y.startRange);this.draw()},setMaxDate:function(a){a instanceof Date?(L(a),this._o.maxDate=a,this._o.maxYear=a.getFullYear(),this._o.maxMonth=a.getMonth()):(this._o.maxDate=y.maxDate,this._o.maxYear=y.maxYear,this._o.maxMonth=y.maxMonth,this._o.endRange=
y.endRange);this.draw()},setStartRange:function(a){this._o.startRange=a},setEndRange:function(a){this._o.endRange=a},draw:function(a){if(this._v||a){var b=this._o,d=b.minYear,c=b.maxYear,e=b.minMonth,l=b.maxMonth;a="";this._y<=d&&(this._y=d,!isNaN(e)&&this._m<e&&(this._m=e));this._y>=c&&(this._y=c,!isNaN(l)&&this._m>l&&(this._m=l));for(c=0;c<b.numberOfMonths;c++)d="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2),a+='<div class="pika-lendar">'+aa(this,c,this.calendars[c].year,
this.calendars[c].month,this.calendars[0].year,d)+this.render(this.calendars[c].year,this.calendars[c].month,d)+"</div>";this.el.innerHTML=a;b.bound&&"hidden"!==b.field.type&&K(function(){b.trigger.focus()},1);if("function"===typeof this._o.onDraw)this._o.onDraw(this);b.bound&&b.field.setAttribute("aria-label",b.ariaLabel)}},adjustPosition:function(){var a,b;if(!this._o.container){this.el.style.position="absolute";var d=a=this._o.trigger;var c=this.el.offsetWidth;var e=this.el.offsetHeight;var l=
window.innerWidth||k.documentElement.clientWidth;var f=window.innerHeight||k.documentElement.clientHeight;var h=window.pageYOffset||k.body.scrollTop||k.documentElement.scrollTop;var p=b=!0;if("function"===typeof a.getBoundingClientRect){d=a.getBoundingClientRect();var t=d.left+window.pageXOffset;var v=d.bottom+window.pageYOffset}else for(t=d.offsetLeft,v=d.offsetTop+d.offsetHeight;d=d.offsetParent;)t+=d.offsetLeft,v+=d.offsetTop;if(this._o.reposition&&t+c>l||-1<this._o.position.indexOf("right")&&
0<t-c+a.offsetWidth)t=t-c+a.offsetWidth,b=!1;if(this._o.reposition&&v+e>f+h||-1<this._o.position.indexOf("top")&&0<v-e-a.offsetHeight)v=v-e-a.offsetHeight,p=!1;this.el.style.left=t+"px";this.el.style.top=v+"px";O(this.el,b?"left-aligned":"right-aligned");O(this.el,p?"bottom-aligned":"top-aligned");P(this.el,b?"right-aligned":"left-aligned");P(this.el,p?"top-aligned":"bottom-aligned")}},render:function(a,b,d){var c=this._o,e=new Date,l=V(a,b),f=(new Date(a,b,1)).getDay(),h=[],p=[];L(e);0<c.firstDay&&
(f-=c.firstDay,0>f&&(f+=7));for(var t=0===b?11:b-1,v=11===b?0:b+1,J=0===b?a-1:a,F=11===b?a+1:a,N=V(J,t),R=l+f,w=R;7<w;)w-=7;R+=7-w;for(var S=!1,D=w=0;w<R;w++){var u=new Date(a,b,1+(w-f)),C=r(this._d)?M(u,this._d):!1,m=M(u,e),g=-1!==c.events.indexOf(u.toDateString())?!0:!1,n=w<f||w>=l+f,G=1+(w-f),T=b,U=a,ba=c.startRange&&M(c.startRange,u),ca=c.endRange&&M(c.endRange,u),da=c.startRange&&c.endRange&&c.startRange<u&&u<c.endRange,H;!(H=c.minDate&&u<c.minDate||c.maxDate&&u>c.maxDate)&&(H=c.disableWeekends)&&
(H=u.getDay(),H=0===H||6===H);u=H||c.disableDayFn&&c.disableDayFn(u);n&&(w<f?(G=N+G,T=t,U=J):(G-=l,T=v,U=F));g={day:G,month:T,year:U,hasEvent:g,isSelected:C,isToday:m,isDisabled:u,isEmpty:n,isStartRange:ba,isEndRange:ca,isInRange:da,showDaysInNextAndPreviousMonths:c.showDaysInNextAndPreviousMonths,enableSelectionDaysInNextAndPreviousMonths:c.enableSelectionDaysInNextAndPreviousMonths};c.pickWholeWeek&&C&&(S=!0);C=p;m=C.push;a:{n=[];G="false";if(g.isEmpty)if(g.showDaysInNextAndPreviousMonths)n.push("is-outside-current-month"),
g.enableSelectionDaysInNextAndPreviousMonths||n.push("is-selection-disabled");else{g='<td class="is-empty"></td>';break a}g.isDisabled&&n.push("is-disabled");g.isToday&&n.push("is-today");g.isSelected&&(n.push("is-selected"),G="true");g.hasEvent&&n.push("has-event");g.isInRange&&n.push("is-inrange");g.isStartRange&&n.push("is-startrange");g.isEndRange&&n.push("is-endrange");g='<td data-day="'+g.day+'" class="'+n.join(" ")+'" aria-selected="'+G+'"><button class="pika-button pika-day" type="button" data-pika-year="'+
g.year+'" data-pika-month="'+g.month+'" data-pika-day="'+g.day+'">'+g.day+"</button></td>"}m.call(C,g);7===++D&&(c.showWeekNumber&&(D=p,C=D.unshift,m=new Date(a,b,w-f),A?m=z(m).isoWeek():(m.setHours(0,0,0,0),g=m.getDate(),n=m.getDay(),m.setDate(g+3-(n+7-1)%7),g=new Date(m.getFullYear(),0,4),m=(m.getTime()-g.getTime())/864E5,m=1+Math.round((m-3+(g.getDay()+7-1)%7)/7)),C.call(D,'<td class="pika-week">'+m+"</td>")),D=h,C=D.push,p='<tr class="pika-row'+(c.pickWholeWeek?" pick-whole-week":"")+(S?" is-selected":
"")+'">'+(c.isRTL?p.reverse():p).join("")+"</tr>",C.call(D,p),p=[],D=0,S=!1)}b=[];c.showWeekNumber&&b.push("<th></th>");for(a=0;7>a;a++)b.push('<th scope="col"><abbr title="'+Y(c,a)+'">'+Y(c,a,!0)+"</abbr></th>");c="<thead><tr>"+(c.isRTL?b.reverse():b).join("")+"</tr></thead>";return'<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="'+d+'">'+c+("<tbody>"+h.join("")+"</tbody></table>")},isVisible:function(){return this._v},show:function(){this.isVisible()||(this._v=
!0,this.draw(),P(this.el,"is-hidden"),this._o.bound&&(x(k,"click",this._onClick),this.adjustPosition()),"function"===typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var a=this._v;!1!==a&&(this._o.bound&&B(k,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",O(this.el,"is-hidden"),this._v=!1,void 0!==a&&"function"===typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){var a=this._o;this.hide();B(this.el,"mousedown",
this._onMouseDown,!0);B(this.el,"touchend",this._onMouseDown,!0);B(this.el,"change",this._onChange);a.keyboardInput&&B(k,"keydown",this._onKeyChange);a.field&&(B(a.field,"change",this._onInputChange),a.bound&&(B(a.trigger,"click",this._onInputClick),B(a.trigger,"focus",this._onInputFocus),B(a.trigger,"blur",this._onInputBlur)));this.el.parentNode&&this.el.parentNode.removeChild(this.el)}};return Z});

'use strict';!function(k,l,m,n){XF.DateInput=XF.Element.newHandler({options:{weekStart:0,minDate:null,maxDate:null,disableWeekends:!1,yearRange:null,showWeekNumber:!1,showDaysInNextAndPreviousMonths:!0},picker:null,init:function(){var e=this.options.minDate,f=this.options.maxDate;if(e){var c=Date.parse(e.replace(/-/g,"/"));e=new Date(c)}f&&(c=Date.parse(f.replace(/-/g,"/")),f=new Date(c));var g=this,h=this.$target;c=h.val();e={format:"YYYY-MM-DD",toString:function(a,d){d=a.getDate();const b=a.getMonth()+
1;return a.getFullYear()+"-"+b+"-"+d},parse:function(a,d){var b=a.split("-");a=parseInt(b[0],10);d=parseInt(b[1],10)-1;b=parseInt(b[2],10);return new Date(a,d,b)},onSelect:function(){var a=this._d,d=String(a.getDate()),b=String(a.getMonth()+1);a=String(a.getFullYear());g.$target.val(a+"-"+(10>b?"0"+b:b)+"-"+(10>d?"0"+d:d))},onOpen:function(){h.prop("readonly")&&this.hide()},showTime:!1,firstDay:this.options.weekStart,minDate:e,maxDate:f,disableWeekends:this.options.disableWeekends,yearRange:this.options.yearRange,
showWeekNumber:this.options.showWeekNumber,showDaysInNextAndPreviousMonths:this.options.showDaysInNextAndPreviousMonths,i18n:{previousMonth:"",nextMonth:"",weekdays:[0,1,2,3,4,5,6].map(function(a){return XF.phrase("day"+a)}),weekdaysShort:[0,1,2,3,4,5,6].map(function(a){return XF.phrase("dayShort"+a)}),months:[0,1,2,3,4,5,6,7,8,9,10,11].map(function(a){return XF.phrase("month"+a)})},isRTL:!1,field:this.$target[0]};c&&(f=c.match(/^(\d{4})-(\d\d?)-(\d\d?)$/))&&(e.defaultDate=new Date(parseInt(f[1],
10),parseInt(f[2],10)-1,parseInt(f[3])),e.setDefaultDate=!0);this.picker=new Pikaday(e);this.$target.val(c);c=this.$target.parent().find(".js-dateTrigger");if(c.length)c.on("click",function(){g.picker.show()})}});XF.Element.register("date-input","XF.DateInput")}(jQuery,window,document);