芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media.9/system/js/fields/calendar.min.js
!function(e,t){"use strict";var a=function(e){if(!e)throw new Error("Calendar setup failed:\n No valid element found, Please check your code");if("function"!=typeof Date.parseFieldDate)throw new Error("Calendar setup failed:\n No valid date helper, Please check your code");if(e._joomlaCalendar)throw new Error("JoomlaCalendar instance already exists for the element");e._joomlaCalendar=this;var a=this;if(this.writable=!0,this.hidden=!0,this.params={},this.element=e,this.inputField=e.getElementsByTagName("input")[0],this.button=e.getElementsByTagName("button")[0],!this.inputField)throw new Error("Calendar setup failed:\n No valid input found, Please check your code");this.params={debug:!1,clicked:!1,element:{style:{display:"none"}},writable:!0};var s=Joomla.Text._;this.strings={today:s("JLIB_HTML_BEHAVIOR_TODAY","Today"),wk:s("JLIB_HTML_BEHAVIOR_WK","wk"),days:["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],shortDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],months:["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"],shortMonths:["JANUARY_SHORT","FEBRUARY_SHORT","MARCH_SHORT","APRIL_SHORT","MAY_SHORT","JUNE_SHORT","JULY_SHORT","AUGUST_SHORT","SEPTEMBER_SHORT","OCTOBER_SHORT","NOVEMBER_SHORT","DECEMBER_SHORT"],am:s("JLIB_HTML_BEHAVIOR_AM","am"),pm:s("JLIB_HTML_BEHAVIOR_PM","pm"),exit:s("JCLOSE","Close"),clear:s("JCLEAR","Clear")},this.strings.days=this.strings.days.map((function(e){return s(e)})),this.strings.shortDays=this.strings.shortDays.map((function(e){return s(e)})),this.strings.months=this.strings.months.map((function(e){return s(e)})),this.strings.shortMonths=this.strings.shortMonths.map((function(e){return s(e)}));var i=this.button,r={inputField:this.inputField,dateType:i.dataset.dateType||"gregorian",direction:t.dir?t.dir:t.getElementsByTagName("html")[0].getAttribute("dir"),firstDayOfWeek:i.dataset.firstday?parseInt(i.dataset.firstday,10):0,dateFormat:i.dataset.dateFormat||"%Y-%m-%d %H:%M:%S",weekend:[0,6],minYear:1e3,maxYear:2100,time24:!0,showsOthers:!0,showsTime:!0,weekNumbers:!0,showsTodayBtn:!0,compressedHeader:!1};for(var n in"showOthers"in i.dataset&&(r.showsOthers=1===parseInt(i.dataset.showOthers,10)),"weekNumbers"in i.dataset&&(r.weekNumbers=1===parseInt(i.dataset.weekNumbers,10)),"onlyMonthsNav"in i.dataset&&(r.compressedHeader=1===parseInt(i.dataset.onlyMonthsNav,10)),"time24"in i.dataset&&(r.time24=24===parseInt(i.dataset.time24,10)),"showTime"in i.dataset&&(r.showsTime=1===parseInt(i.dataset.showTime,10)),"todayBtn"in i.dataset&&(r.showsTodayBtn=1===parseInt(i.dataset.todayBtn,10)),r)this.params[n]=r[n];i.dataset.minYear&&(a.params.minYear=parseInt(i.dataset.minYear,10)),i.dataset.maxYear&&(a.params.maxYear=parseInt(i.dataset.maxYear,10)),i.dataset.weekend&&(a.params.weekend=i.dataset.weekend.split(",").map((function(e){return parseInt(e,10)}))),"rtl"===this.params.direction&&(this.strings.days=this.strings.days.reverse(),this.strings.shortDays=this.strings.shortDays.reverse()),this.strings.months=Date.monthsToLocalOrder(this.strings.months,this.params.dateType),this.strings.shortMonths=Date.monthsToLocalOrder(this.strings.shortMonths,this.params.dateType),this._dayMouseDown=function(e){return a._handleDayMouseDown(e)},this._calKeyEvent=function(e){return a._handleCalKeyEvent(e)},this._documentClick=function(e){return a._handleDocumentClick(e)},this.checkInputs(),this.inputField.getAttribute("readonly")||(this._create(),this._bindEvents())};a.prototype.checkInputs=function(){var e=Date.parseFieldDate(this.inputField.getAttribute("data-alt-value"),this.params.dateFormat,"gregorian",this.strings);""!==this.inputField.value?(this.date=e,this.inputField.value=e.print(this.params.dateFormat,this.params.dateType,!0,this.strings)):this.date=new Date},a.prototype.recreate=function(){var e=this.element,t=e.querySelector(".js-calendar");t&&(e._joomlaCalendar=null,t.parentNode.removeChild(t),new a(e))},a.prototype.updateTime=function(e,t,a){var s=this,i=s.date,r=s.date.getLocalDate(s.params.dateType),n=s.date.getLocalMonth(s.params.dateType),d=s.date.getLocalFullYear(s.params.dateType),l=this.inputField.parentNode.parentNode.querySelectorAll(".time-ampm")[0];s.params.time24||(/pm/i.test(l.value)&&e<12?e=parseInt(e)+12:/am/i.test(l.value)&&12==e&&(e=0)),i.setHours(e),i.setMinutes(parseInt(t,10)),i.setSeconds(i.getSeconds()),i.setLocalFullYear(s.params.dateType,d),i.setLocalMonth(s.params.dateType,n),i.setLocalDate(s.params.dateType,r),s.dateClicked=!1,this.callHandler()},a.prototype.setDate=function(e){e.equalsTo(this.date)||(this.date=e,this.processCalendar(this.params.firstDayOfWeek,e))},a.prototype.moveCursorBy=function(e){var t=new Date(this.date);t.setDate(t.getDate()-e),this.setDate(t)},a.prototype.resetSelected=function(e){for(var t=e.options,a=t.length;a--;){var s=t[a];s.selected&&(s.selected=!1)}},a.prototype.callHandler=function(){this.inputField.setAttribute("data-alt-value",this.date.print(this.params.dateFormat,"gregorian",!1,this.strings)),this.inputField.getAttribute("data-alt-value")&&"0000-00-00 00:00:00"!==this.inputField.getAttribute("data-alt-value")&&(this.inputField.value=this.date.print(this.params.dateFormat,this.params.dateType,!0,this.strings),"gregorian"!==this.params.dateType&&this.inputField.setAttribute("data-local-value",this.date.print(this.params.dateFormat,this.params.dateType,!0,this.strings))),this.inputField.value=this.date.print(this.params.dateFormat,this.params.dateType,!0,this.strings),this.dateClicked&&"function"==typeof this.params.onUpdate&&this.params.onUpdate(this),this.inputField.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),this.dateClicked?this.close():this.processCalendar()},a.prototype.close=function(){this.hide()},a.prototype.show=function(){this.checkInputs(),this.inputField.focus(),this.dropdownElement.classList.add("open"),this.dropdownElement.removeAttribute("hidden"),this.hidden=!1,t.addEventListener("keydown",this._calKeyEvent,!0),t.addEventListener("keypress",this._calKeyEvent,!0),t.addEventListener("mousedown",this._documentClick,!0);var a=this.element.querySelector(".js-calendar");e.innerHeight
a.params.minYear&&r.setOtherFullYear(a.params.dateType,d-1);break;case-1:var o=r.getLocalDate(a.params.dateType);if(l>0)o>(p=r.getLocalMonthDays(a.params.dateType,l-1))&&r.setLocalDate(a.params.dateType,p),r.setLocalMonth(a.params.dateType,l-1);else if(d-- >a.params.minYear){r.setOtherFullYear(a.params.dateType,d),o>(p=r.getLocalMonthDays(a.params.dateType,11))&&r.setLocalDate(a.params.dateType,p),r.setLocalMonth(a.params.dateType,11)}break;case 1:o=r.getLocalDate(a.params.dateType);if(l<11)o>(p=r.getLocalMonthDays(a.params.dateType,l+1))&&r.setLocalDate(a.params.dateType,p),r.setLocalMonth(a.params.dateType,l+1);else if(d
(p=r.getLocalMonthDays(a.params.dateType,0))&&r.setLocalDate(a.params.dateType,p),r.setLocalMonth(a.params.dateType,0)}break;case 2:a.params.compressedHeader||d
48||a<57||186===a||189===a||190===a||32===a))return s(e)},a.prototype._create=function(){var e=this,t=this.element,a=i("table"),s=i("div");this.table=a,a.className="table",a.style.marginBottom=0,this.dropdownElement=s,t.appendChild(s),this.params.direction&&(s.style.direction=this.params.direction),s.className="js-calendar",s.style.position="absolute",s.style.boxShadow="0 0 70px 0 rgba(0,0,0,0.67)",s.style.minWidth=this.inputField.width,s.style.padding="0",s.setAttribute("hidden",""),s.style.left="auto",s.style.top="auto",s.style.zIndex=1060,s.style.borderRadius="20px",this.wrapper=i("div"),this.wrapper.className="calendar-container",s.appendChild(this.wrapper),this.wrapper.appendChild(a);var r=i("thead",a);r.className="calendar-header";var n=null,d=null,l=this,o=function(t,a,s,r,o,p,h){for(var m in o=o||{},n=i(r=r||"td",d),a&&(p=p?'class="'+p+'"':"",n.colSpan=a),o)n.style[m]=o[m];for(var m in h)n.setAttribute(m,h[m]);return 0!==s&&Math.abs(s)<=2&&(n.className+=" nav"),a&&n.addEventListener("mousedown",e._dayMouseDown,!0),n.calendar=l,n.navtype=s,0!==s&&Math.abs(s)<=2?n.innerHTML=Joomla.sanitizeHtml("
"+t+"
"):(n.innerHTML=a?Joomla.sanitizeHtml("
"+t+"
"):Joomla.sanitizeHtml(t),!a&&p&&(n.className=p)),n};!1===this.params.compressedHeader&&((d=i("tr",r)).className="calendar-head-row",this._nav_py=o("‹",1,-2,"",{"text-align":"center","font-size":"18px","line-height":"18px"},"js-btn btn-prev-year"),this.title=o('
',this.params.weekNumbers?6:5,300),this.title.className="title",this._nav_ny=o(" ›",1,2,"",{"text-align":"center","font-size":"18px","line-height":"18px"},"js-btn btn-next-year")),(d=i("tr",r)).className="calendar-head-row",this._nav_pm=o("‹",1,-1,"",{"text-align":"center","font-size":"2em","line-height":"1em"},"js-btn btn-prev-month"),this._nav_month=o('
',this.params.weekNumbers?6:5,888,"td",{textAlign:"center"}),this._nav_month.className="title",this._nav_nm=o(" ›",1,1,"",{"text-align":"center","font-size":"2em","line-height":"1em"},"js-btn btn-next-month"),(d=i("tr",r)).className=e.params.weekNumbers?"daynames wk":"daynames",this.params.weekNumbers&&((n=i("td",d)).className="day-name wn",n.textContent=e.strings.wk);for(var p=7;p>0;--p)n=i("td",d),p||(n.calendar=e);this.firstdayname=this.params.weekNumbers?d.firstChild.nextSibling:d.firstChild;var h=this.params.firstDayOfWeek,m=(n=this.firstdayname,this.params.weekend);for(p=0;p<7;++p){var c=(p+h)%7;n.classList.add("day-name"),this.params.weekNumbers&&n.classList.add("day-name-week"),p&&(n.calendar=e,n.fdow=c),-1!==m.indexOf(m)&&n.classList.add("weekend"),n.textContent=this.strings.shortDays[(p+h)%7],n=n.nextSibling}var u=i("tbody",a);for(this.tbody=u,p=6;p>0;--p){d=i("tr",u),this.params.weekNumbers&&(n=i("td",d));for(var y=7;y>0;--y)(n=i("td",d)).calendar=this,n.addEventListener("mousedown",this._dayMouseDown,!0)}if(this.params.showsTime){(d=i("tr",u)).className="time",(n=i("td",d)).className="time time-title",n.colSpan=1,n.style.verticalAlign="middle",n.innerHTML=" ";var v=i("td",d);v.className="time hours-select",v.colSpan=2;var g=i("td",d);g.className="time minutes-select",g.colSpan=2,function(){function t(t,a,s,r,n){var d,l=i("select",n);l.calendar=e,l.className=t,l.setAttribute("data-chosen",!0),l.style.width="100%",l.navtype=50,l._range=[];for(var o=s;o<=r;++o){var p,h="";o===a&&(h=!0),o<10&&r>=10?(d="0"+o,p=Date.convertNumbers("0")+Date.convertNumbers(o)):(d=""+o,p=""+Date.convertNumbers(o)),l.options.add(new Option(p,d,h,h))}return l}var a=e.date.getHours(),s=e.date.getMinutes(),r=!e.params.time24,l=e.date.getHours()>12;r&&l&&(a-=12);var o=t("time time-hours",a,r?1:0,r?12:23,v),p=t("time time-minutes",s,0,59,g);if((n=i("td",d)).className="time ampm-select",n.colSpan=e.params.weekNumbers?1:2,r){var h=!0;l=Date.parseFieldDate(e.inputField.getAttribute("data-alt-value"),e.params.dateFormat,"gregorian",e.strings).getHours()>=12;var m=i("select",n);m.className="time-ampm",m.style.width="100%",m.options.add(new Option(e.strings.pm,"pm",l?h:"",l?h:"")),m.options.add(new Option(e.strings.am,"am",l?"":h,l?"":h)),m.addEventListener("change",(function(t){e.updateTime(t.target.parentNode.parentNode.childNodes[1].childNodes[0].value,t.target.parentNode.parentNode.childNodes[2].childNodes[0].value,t.target.parentNode.parentNode.childNodes[3].childNodes[0].value)}),!1)}else n.innerHTML=" ",n.colSpan=e.params.weekNumbers?3:2;o.addEventListener("change",(function(t){e.updateTime(t.target.parentNode.parentNode.childNodes[1].childNodes[0].value,t.target.parentNode.parentNode.childNodes[2].childNodes[0].value,t.target.parentNode.parentNode.childNodes[3].childNodes[0].value)}),!1),p.addEventListener("change",(function(t){e.updateTime(t.target.parentNode.parentNode.childNodes[1].childNodes[0].value,t.target.parentNode.parentNode.childNodes[2].childNodes[0].value,t.target.parentNode.parentNode.childNodes[3].childNodes[0].value)}),!1)}()}((d=i("div",this.wrapper)).className="buttons-wrapper btn-group",this._nav_clear=o(this.strings.clear,"",100,"button","","js-btn btn btn-clear",{type:"button","data-action":"clear"}),d.querySelector('[data-action="clear"]').addEventListener("click",(function(t){t.preventDefault();for(var a=e.table.querySelectorAll("td"),s=0;s
this.params.maxYear&&(n=this.params.maxYear,t.setOtherFullYear(this.params.dateType,n)),this.params.firstDayOfWeek=e,this.date=new Date(t);var p=t.getLocalMonth(this.params.dateType),h=t.getLocalDate(this.params.dateType);t.setLocalDate(this.params.dateType,1);var m=(t.getLocalDay(this.params.dateType)-this.params.firstDayOfWeek)%7;m<0&&(m+=7),t.setLocalDate(this.params.dateType,-m),t.setLocalDate(this.params.dateType,t.getLocalDate(this.params.dateType)+1);for(var c=this.tbody.firstChild,u=this.ar_days=new Array,y=this.params.weekend,v=parseInt(t.getLocalWeekDays(this.params.dateType)),g=0;g
12&&o&&(d-=12),d=d<10?"0"+d:d,l=l<10?"0"+l:l;var E=this.table.querySelector(".time-hours"),k=this.table.querySelector(".time-minutes");if(this.resetSelected(E),this.params.time24?E.value=d:E.value="00"==d?"12":d,this.resetSelected(k),k.value=l,!this.params.time24){var C=new Date(this.inputField.getAttribute("data-alt-value")),A=this.table.querySelector(".time-ampm");C.getHours()>12&&(this.resetSelected(A),A.value="pm")}}if(this.params.compressedHeader){var _=Date.convertNumbers(n.toString());this._nav_month.getElementsByTagName("span")[0].textContent=this.params.monthBefore?_+" - "+this.strings.months[p]:this.strings.months[p]+" - "+_}else this._nav_month.getElementsByTagName("span")[0].textContent=this.params.debug?p+" "+this.strings.months[p]:this.strings.months[p],this.title.getElementsByTagName("span")[0].textContent=this.params.debug?n+" "+Date.convertNumbers(n.toString()):Date.convertNumbers(n.toString());this.table.style.visibility="visible"},a.prototype._bindEvents=function(){var e=this;this.inputField.addEventListener("blur",(function(t){var s=a.getCalObject(this)._joomlaCalendar;if(s.dropdownElement.hasAttribute("hidden")){if(s){if(s.inputField.value)if(void 0===s.params.dateClicked)if(s.inputField.setAttribute("data-local-value",s.inputField.value),"gregorian"!==s.params.dateType){var i,r=Date.parseFieldDate(s.inputField.value,s.params.dateFormat,s.params.dateType,s.strings);i=Date.localCalToGregorian(r.getFullYear(),r.getMonth(),r.getDate()),r.setFullYear(i[0]),r.setMonth(i[1]),r.setDate(i[2]),s.inputField.setAttribute("data-alt-value",r.print(s.params.dateFormat,"gregorian",!1,s.strings))}else s.inputField.setAttribute("data-alt-value",Date.parseFieldDate(s.inputField.value,s.params.dateFormat,s.params.dateType,s.strings).print(s.params.dateFormat,"gregorian",!1,s.strings));else s.inputField.setAttribute("data-alt-value",s.date.print(s.params.dateFormat,"gregorian",!1,s.strings));else s.inputField.setAttribute("data-alt-value","0000-00-00 00:00:00");s.date=Date.parseFieldDate(s.inputField.getAttribute("data-alt-value"),s.params.dateFormat,s.params.dateType,s.strings)}e.close()}else t.preventDefault()}),!0),this.button.addEventListener("click",(function(){e.show()}),!1)};var s=function(t){return t||(t=e.event),t.preventDefault(),t.stopPropagation(),!1},i=function(e,a){var s;return s=t.createElement(e),void 0!==a&&a.appendChild(s),s};function r(e){for(var t=e.target.querySelectorAll(".field-calendar"),s=0,i=t.length;s