芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/lot.mgaplay.com.br/web/dist/vendor/calendar/js/calendar-jalali.js
"use strict";Date.SECOND=1e3,Date.MINUTE=60*Date.SECOND,Date.HOUR=60*Date.MINUTE,Date.DAY=24*Date.HOUR,Date.WEEK=7*Date.DAY,Date.prototype.getWeek=function(){var t=new Date(this.getFullYear(),0,1);return Math.ceil(((this.getTime()-t.getTime())/864e5+t.getDay()+1)/7)},Date.prototype.getMonthFormatted=function(){var t=this.getMonth()+1;return t<10?"0"+t:t},Date.prototype.getDateFormatted=function(){var t=this.getDate();return t<10?"0"+t:t},Date.prototype.getJalaliFullYear=function(){var t=this.getDate(),e=this.getMonth(),a=this.getFullYear();return JalaliDate.gregorianToJalali(a,e+1,t)[0]},Date.prototype.getJalaliMonth=function(){var t=this.getDate(),e=this.getMonth(),a=this.getFullYear();return JalaliDate.gregorianToJalali(a,e+1,t)[1]},Date.prototype.getJalaliDate=function(){var t=this.getDate(),e=this.getMonth(),a=this.getFullYear();return JalaliDate.gregorianToJalali(a,e+1,t)[2]},Date.prototype.getJalaliWeek=function(){var t=JalaliDate.jalaliToGregorian(this.getJalaliFullYear(),1,1),e=new Date(t[0],t[1]-1,t[2],0,0,0),a=this.getJalaliDayOfYear()-(7-e.getJalaliDay())%7-1;return a<0?new Date(this-this.getJalaliDay()*Date.DAY).getJalaliWeek():Math.floor(a/7)+1},Date.prototype.getJalaliDayOfYear=function(){var t=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),e=JalaliDate.jalaliToGregorian(this.getJalaliFullYear(),1,0),a=t-new Date(e[0],e[1]-1,e[2],0,0,0);return Math.floor(a/Date.DAY)},Date.prototype.getJalaliDay=function(){var t=this.getDay();return(t+1)%7},Date.prototype.setJalaliMonth=function(t,e){var a=this.getDate(),i=this.getMonth(),o=this.getFullYear(),n=JalaliDate.gregorianToJalali(o,i+1,a);t>12&&(n[0]+=Math.floor(t/12),t%=12),n[1]=t,null!=e&&(n[2]=e);var s=JalaliDate.jalaliToGregorian(n[0],n[1],n[2]);return this.setFullYear(s[0],s[1]-1,s[2])},Date.prototype.setJalaliFullYear=function(t,e,a){var i=this.getDate(),o=this.getMonth(),n=this.getFullYear(),s=JalaliDate.gregorianToJalali(n,o+1,i);t<100&&(t+=1300),s[0]=t,null!=e&&(e>11&&(s[0]+=Math.floor(e/12),e%=12),s[1]=e+1),null!=a&&(s[2]=a);var r=JalaliDate.jalaliToGregorian(s[0],s[1],s[2]);return this.setFullYear(r[0],r[1]-1,r[2])},Date.prototype.setJalaliDate=function(t){var e=this.getDate(),a=this.getMonth(),i=this.getFullYear(),o=JalaliDate.gregorianToJalali(i,a+1,e);o[2]=t;var n=JalaliDate.jalaliToGregorian(o[0],o[1],o[2]);return this.setFullYear(n[0],n[1]-1,n[2])};var JalaliDate={g_days_in_month:[31,28,31,30,31,30,31,31,30,31,30,31],j_days_in_month:[31,31,31,31,31,31,30,30,30,30,30,29],gregorianToJalali:function(t,e,a){for(var i=(t=parseInt(t))-1600,o=(e=parseInt(e))-1,n=(a=parseInt(a))-1,s=365*i+parseInt((i+3)/4)-parseInt((i+99)/100)+parseInt((i+399)/400),r=0;r
1&&(i%4==0&&i%100!=0||i%400==0)&&++s;var l=(s+=n)-79,h=parseInt(l/12053);l%=12053;var d=979+33*h+4*parseInt(l/1461);for((l%=1461)>=366&&(d+=parseInt((l-1)/365),l=(l-1)%365),r=0;r<11&&l>=JalaliDate.j_days_in_month[r];++r)l-=JalaliDate.j_days_in_month[r];return[d,r+1,l+1]},jalaliToGregorian:function(t,e,a){t=parseInt(t),e>12&&t++;for(var i=t-979,o=(e=parseInt(e))-1,n=(a=parseInt(a))-1,s=365*i+8*parseInt(i/33)+parseInt((i%33+3)/4),r=0;r
=36525&&(l--,h+=100*parseInt(l/36524),(l%=36524)>=365?l++:d=!1),h+=4*parseInt(l/1461),(l%=1461)>=366&&(d=!1,l--,h+=parseInt(l/365),l%=365),r=0;l>=JalaliDate.g_days_in_month[r]+(1==r&&d);r++)l-=JalaliDate.g_days_in_month[r]+(1==r&&d);return[h,r+1,l+1]}};String.prototype.format||(String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,(function(e,a){return void 0!==t[a]?t[a]:e}))}),String.prototype.formatNum||(String.prototype.formatNum=function(t){for(var e=""+this;e.length
"),(function(t,i){var l,h=null;if(l=/^(\d\d)-(\d\d)$/.exec(i))h=new Date(a,parseInt(l[2],10)-1,parseInt(l[1],10));else if(l=/^(\d\d)-(\d\d)-(\d\d\d\d)$/.exec(i))parseInt(l[3],10)==a&&(h=new Date(a,parseInt(l[2],10)-1,parseInt(l[1],10)));else if(l=/^easter(([+\-])(\d+))?$/.exec(i))h=function(t,e){var a=t%19,i=Math.floor(t/100),o=t%100,n=Math.floor(i/4),s=i%4,r=Math.floor((i+8)/25),l=(19*a+i-n-Math.floor((i-r+1)/3)+15)%30,h=(32+2*s+2*Math.floor(o/4)-l-o%4)%7,d=l+h+7*Math.floor((a+11*l+22*h)/451)+114,p=Math.floor(d/31)-1;return new Date(t,p,d%31+1+(e||0),0,0,0)}(a,l[1]?parseInt(l[1],10):0);else if(l=/^(\d\d)([+\-])([1-5])\*([0-6])$/.exec(i)){var d=parseInt(l[1],10)-1,p=l[2],u=parseInt(l[3]),m=parseInt(l[4]);switch(p){case"+":for(var c=new Date(a,d,-6);c.getDay()!=m;)c=new Date(c.getFullYear(),c.getMonth(),c.getDate()+1);h=new Date(c.getFullYear(),c.getMonth(),c.getDate()+7*u);break;case"-":for(c=new Date(a,d+1,7);c.getDay()!=m;)c=new Date(c.getFullYear(),c.getMonth(),c.getDate()-1);h=new Date(c.getFullYear(),c.getMonth(),c.getDate()-7*u)}}if(!h)return r("Unknown holiday: "+e),s=!0,!1;switch(t){case 0:o=h;break;case 1:if(h.getTime()<=o.getTime())return r("Unknown holiday: "+e),s=!0,!1;n=h;break;default:return r("Unknown holiday: "+e),s=!0,!1}})),!s){var l=[];if(n)for(var d=new Date(o.getTime());d.getTime()<=n.getTime();d.setDate(d.getDate()+1))l.push(new Date(d.getTime()));else l.push(o);h.push({name:i,days:l})}})),s.cache[i]=h,s.cache[i]}function r(e){"object"==t.type(window.console)&&"function"==t.type(window.console.warn)&&window.console.warn("[Bootstrap-Calendar] "+e)}function l(a,i){return this.options=t.extend(!0,{position:{start:new Date,end:new Date}},e,a),this.setLanguage(this.options.language),this.context=i,i.css("width",this.options.width).addClass("cal-context"),this.view(),this}function h(e,a,i,o){e.stopPropagation();var n=(a=t(a)).closest(".cal-cell"),s=n.closest(".cal-before-eventlist"),r=n.data("cal-row");a.fadeOut("fast"),i.slideUp("fast",(function(){var e=t(".events-list",n);i.html(o.options.templates["events-list"]({cal:o,events:o.getEventsBetween(parseInt(e.data("cal-start")),parseInt(e.data("cal-end")))})),s.after(i),o.activecell=t("[data-cal-date]",n).text(),t("#cal-slide-tick").addClass("tick"+r).show(),i.slideDown("fast",(function(){t("body").one("click",(function(){i.slideUp("fast"),o.activecell=0}))}))})),setTimeout((function(){t("a.event-item").mouseenter((function(){t('a[data-event-id="'+t(this).data("event-id")+'"]').closest(".cal-cell1").addClass("day-highlight dh-"+t(this).data("event-class"))})),t("a.event-item").mouseleave((function(){t("div.cal-cell1").removeClass("day-highlight dh-"+t(this).data("event-class"))})),o._update_modal()}),400)}s.cache={},l.prototype.setOptions=function(e){t.extend(this.options,e),"language"in e&&this.setLanguage(e.language),"modal"in e&&this._update_modal()},l.prototype.setLanguage=function(e){window.calendar_languages&&e in window.calendar_languages?(this.locale=t.extend(!0,{},i,calendar_languages[e]),this.options.language=e):(this.locale=i,delete this.options.language)},l.prototype._render=function(){this.context.html(""),this._loadTemplate(this.options.view),this.stop_cycling=!1;var t={};if("agenda"!==this.options.view){t.cal=this,t.day=1,1==n(this,"first_day")?t.days_name=[this.locale.jd1,this.locale.jd2,this.locale.jd3,this.locale.jd4,this.locale.jd5,this.locale.jd6,this.locale.jd0]:t.days_name=[this.locale.jd0,this.locale.jd1,this.locale.jd2,this.locale.jd3,this.locale.jd4,this.locale.jd5,this.locale.jd6];var e=parseInt(this.options.position.start.getTime()),a=parseInt(this.options.position.end.getTime());switch(t.events=this.getEventsBetween(e,a),this.options.view){case"month":break;case"week":case"day":this._calculate_hour_minutes(t)}t.start=new Date(this.options.position.start.getTime()),t.lang=this.locale}else t.cal=this,t.agenda=this.options.events,t.lang=this.locale;this.context.append(this.options.templates[this.options.view](t)),this._update()},l.prototype._calculate_hour_minutes=function(e){var a=this,i=parseInt(this.options.time_split),o=60/i,n=Math.min(o,1);(o>=1&&o%1!=0||o<1&&1440/i%1!=0)&&t.error(this.locale.error_timedevide);var s=this.options.time_start.split(":"),r=this.options.time_end.split(":");"00"===r[0]&&"00"===r[1]?e.hours=24*n:e.hours=(parseInt(r[0])-parseInt(s[0]))*n;var l=e.hours*o-parseInt(s[1])/i,h=6e4*i,d=new Date(this.options.position.start.getTime());d.setHours(s[0]),d.setMinutes(s[1]);var p=new Date(this.options.position.end.getTime());"00"===r[0]&&"00"===r[1]?(p.setHours(r[0]),p.setMinutes(r[1]),p.setTime(p.getTime()+864e5)):(p.setHours(r[0]),p.setMinutes(r[1])),e.all_day=[],e.by_hour=[],e.after_time=[],e.before_time=[],t.each(e.events,(function(t,i){var o=new Date(parseInt(i.start)),n=new Date(parseInt(i.end));if(i.start_hour=o.getHours().toString().formatNum(2)+":"+o.getMinutes().toString().formatNum(2),i.end_hour=n.getHours().toString().formatNum(2)+":"+n.getMinutes().toString().formatNum(2),i.start
p.getTime()&&(i.end_hour=n.getJalaliDate()+" "+a.locale["jms"+(o.getJalaliMonth()-1)]+" "+i.end_hour),i.start
p.getTime())e.all_day.push(i);else if(i.end
p.getTime())e.after_time.push(i);else{var s=d.getTime()-i.start;i.top=s>=0?0:Math.abs(s)/h;var r=Math.abs(l-i.top),u=(i.end-i.start)/h;s>=0&&(u=(i.end-d.getTime())/h),i.lines=u,u>r&&(i.lines=r),e.by_hour.push(i)}}))},l.prototype._hour_min=function(t){var e=this.options.time_start.split(":"),a=parseInt(this.options.time_split),i=60/a;return 0==t?i-parseInt(e[1])/a:i},l.prototype._hour=function(t,e){var a=this.options.time_start.split(":"),i=parseInt(this.options.time_split),o=""+(parseInt(a[0])+t*Math.max(i/60,1)),n=""+(i*e+(0==t?parseInt(a[1]):0));return o.formatNum(2)+":"+n.formatNum(2)},l.prototype._week=function(e){this._loadTemplate("week-days");var a={},i=parseInt(this.options.position.start.getTime()),o=parseInt(this.options.position.end.getTime()),s=[],r=n(this,"first_day");return t.each(this.getEventsBetween(i,o),(function(t,e){e.start_day=new Date(parseInt(e.start)).getDay(),1==r&&(e.start_day=(e.start_day+6)%7),e.end-e.start<=864e5?e.days=1:e.days=(e.end-e.start)/864e5,e.start
7&&(e.days=7-e.start_day),s.push(e)})),a.events=s,a.cal=this,this.options.templates["week-days"](a)},l.prototype._month=function(t){this._loadTemplate("year-month");var e={cal:this};e.month_name=this.locale["jm"+t];var a=JalaliDate.jalaliToGregorian(this.options.position.start.getJalaliFullYear(),t+1,1),i=JalaliDate.jalaliToGregorian(this.options.position.start.getJalaliFullYear(),t+2,1);e.data_day=a[0]+"-"+(a[1]<10?"0"+a[1]:a[1])+"-"+(a[2]<10?"0"+a[2]:a[2]);var o=new Date(a[0],a[1]-1,a[2],0,0,0);return e.start=parseInt(o.getTime()),e.end=parseInt(new Date(i[0],i[1]-1,i[2],0,0,0).getTime()),e.events=this.getEventsBetween(e.start,e.end),this.options.templates["year-month"](e)},l.prototype._day=function(e,a){this._loadTemplate("month-day");var i={tooltip:"",cal:this},o=this.options.classes.months.outmonth,s=this.options.position.start.getDay();2==n(this,"first_day")?s++:s=0==s?7:s,a=a-s+1;var r=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),this.options.position.start.getDate()+a-1);a>0&&(o=this.options.classes.months.inmonth);var l=new Date(this.options.position.end.getTime()-1).getJalaliDate();a+1>l&&(this.stop_cycling=!0),a>l&&(a-=l,o=this.options.classes.months.outmonth),o=t.trim(o+" "+this._getDayClass("months",r)),a<=0&&(a=JalaliDate.j_days_in_month[new Date(this.options.position.start.getTime()-1).getJalaliMonth()-1]-Math.abs(a),o+=" cal-month-first-row");var h=this._getHoliday(r);return!1!==h&&(i.tooltip=h),i.data_day=r.getFullYear()+"-"+r.getMonthFormatted()+"-"+(r.getDate()<10?"0"+r.getDate():r.getDate()),i.cls=o,i.day=a,i.start=parseInt(r.getTime()),i.end=parseInt(i.start+864e5),i.events=this.getEventsBetween(i.start,i.end),this.options.templates["month-day"](i)},l.prototype._layouts=function(t,e,a){this._loadTemplate("agenda-layouts");for(var i={tooltip:"",cal:this},o=[],n=0,s=0;s
n&&t[s].eventTypeId==a&&(n=t[s].isPriority);for(s=0;s
0?(i.layouts=o,i.layouts.type=a,this.options.templates["agenda-layouts"](i)):""},l.prototype._displaygroups=function(t,e){this._loadTemplate("agenda-displaygroups");for(var a={tooltip:"",cal:this},i={},o=0,n=0;n
0?(a.displaygroups=i,this.options.templates["agenda-displaygroups"](a)):""},l.prototype._campaigns=function(t,e){this._loadTemplate("agenda-campaigns");for(var a={tooltip:"",cal:this},i={},o=0,n=0;n
0?(a.campaigns=i,this.options.templates["agenda-campaigns"](a)):""},l.prototype._breadcrumbTrail=function(t,e,a){this._loadTemplate("breadcrumb-trail");for(var i={},o={},n=e.results[e.selectedDisplayGroup],s=n.events,r=0;r
=0;r--){var d=o.intermediateDisplayGroupIds[r];void 0!==n.displayGroups[d]&&i.displayGroups.push({link:"",name:n.displayGroups[d].displayGroup})}return void 0!==n.displayGroups[h]&&i.displayGroups.push({link:"",name:n.displayGroups[h].displayGroup}),this.options.templates["breadcrumb-trail"](i)},l.prototype._getHoliday=function(e){var a=!1;return t.each(s(this,e.getFullYear()),(function(){var i=!1;if(t.each(this.days,(function(){if(this.toDateString()==e.toDateString())return i=!0,!1})),i)return a=this.name,!1})),a},l.prototype._getHolidayName=function(t){var e=this._getHoliday(t);return!1===e?"":e},l.prototype._getDayClass=function(t,e){var a=this,i=function(e,i){var o;"string"==typeof(o=a.options.classes&&t in a.options.classes&&e in a.options.classes[t]?a.options.classes[t][e]:"")&&o.length&&i.push(o)},o=[];switch(e.toDateString()==(new Date).toDateString()&&i("today",o),!1!==this._getHoliday(e)&&i("holidays",o),e.getDay()){case 0:i("sunday",o);break;case 6:i("saturday",o)}return i(e.toDateString(),o),o.join(" ")},l.prototype.view=function(t){if(t){if(!this.options.views[t].enable)return;this.options.view=t}this._init_position(),this._loadEvents(),this._render(),this.options.onAfterViewLoad.call(this,this.options.view)},l.prototype.navigate=function(e,a){var i=t.extend({},this.options.position);if("next"==e)switch(this.options.view){case"year":i.start.setJalaliFullYear(this.options.position.start.getJalaliFullYear()+1);break;case"month":i.start.setJalaliMonth(this.options.position.start.getJalaliMonth()+1);break;case"week":i.start.setDate(this.options.position.start.getDate()+7);break;case"day":i.start.setDate(this.options.position.start.getDate()+1)}else if("prev"==e)switch(this.options.view){case"year":i.start.setJalaliFullYear(this.options.position.start.getJalaliFullYear()-1);break;case"month":var o=this.options.position.start.getJalaliMonth()-1;i.start.setJalaliMonth(o||12),o||i.start.setJalaliFullYear(i.start.getJalaliFullYear()-1);break;case"week":i.start.setDate(this.options.position.start.getDate()-7);break;case"day":i.start.setDate(this.options.position.start.getDate()-1)}else"today"==e?i.start.setTime((new Date).getTime()):"date"==e?i.start.setTime(a.format("x")):t.error(this.locale.error_where.format(e));this.options.day=i.start.getFullYear()+"-"+i.start.getMonthFormatted()+"-"+i.start.getDateFormatted(),this.view(),_.isFunction(a)&&a()},l.prototype._init_position=function(){var e,a,i;if("now"==this.options.day){var o=new Date;e=o.getFullYear(),a=o.getMonth(),i=o.getDate()}else if(this.options.day.match(/^\d{4}-\d{2}-\d{2}$/g)){var s=this.options.day.split("-");e=parseInt(s[0],10),a=parseInt(s[1],10)-1,i=parseInt(s[2],10)}else t.error(this.locale.error_dateformat.format(this.options.day));var r,l,h=moment(new Date(e,a,i));switch(this.options.view){case"year":l=(r=h.clone().startOf("jYear")).clone().add(1,"jYear"),this.options.position.start.setTime(r.format("x")),this.options.position.end.setTime(l.format("x"));break;case"month":l=(r=h.clone().startOf("jMonth")).clone().add(1,"jMonth"),this.options.position.start.setTime(r.format("x")),this.options.position.end.setTime(l.format("x"));break;case"day":this.options.position.start.setTime(new Date(e,a,i).getTime()),this.options.position.end.setTime(new Date(e,a,i+1).getTime());break;case"week":var d,p=new Date(e,a,i);d=1==n(this,"first_day")?p.getDate()-(p.getDay()+6)%7:p.getDate()-p.getDay(),this.options.position.start.setTime(new Date(e,a,d).getTime()),this.options.position.end.setTime(new Date(e,a,d+7).getTime());break;case"agenda":this.options.position.start.setTime(new Date(e,a,i).getTime()),this.options.position.end.setTime(new Date(e,a,i+1).getTime());break;default:t.error(this.locale.error_noview.format(this.options.view))}return this},l.prototype.getTitle=function(){var t=this.options.position.start;switch(this.options.view){case"year":return this.locale.title_year.format(t.getJalaliFullYear());case"month":return this.locale.title_month.format(this.locale["jm"+(t.getJalaliMonth()-1)],t.getJalaliFullYear());case"week":return this.locale.title_week.format(t.getWeek()+40,t.getJalaliFullYear());case"day":case"agenda":return this.locale.title_day.format(this.locale["jd"+t.getDay()],t.getJalaliDate(),this.locale["jm"+(t.getJalaliMonth()-1)],t.getJalaliFullYear())}},l.prototype.isToday=function(){var t=(new Date).getTime();return t>this.options.position.start&&t
');t(".cal-month-day, .cal-year-box .span3").on("mouseenter",(function(){0!=t(".events-list",this).length&&t(this).children("[data-cal-date]").text()!=e.activecell&&a.show().appendTo(this)})).on("mouseleave",(function(){a.hide()})).on("click",(function(o){0!=t(".events-list",this).length&&t(this).children("[data-cal-date]").text()!=e.activecell&&h(o,a,i,e)}));var i=t(document.createElement("div")).attr("id","cal-slide-box");i.hide().click((function(t){t.stopPropagation()})),this._loadTemplate("events-list"),a.click((function(a){h(a,t(this),i,e)}))}},l.prototype.getEventsBetween=function(e,a){var i=[],o=moment(e/1e3,"X"),n=moment(a/1e3,"X");return t.each(this.options.events,(function(){if(null==this.start)return!0;var t=moment().tz?moment(moment(this.start/1e3,"X").tz(timezone).format("YYYY-MM-DD HH:mm:ss")):moment(moment(this.start/1e3,"X").format("YYYY-MM-DD HH:mm:ss")),e=this.end||this.start;e=moment().tz?moment(moment(e/1e3,"X").tz(timezone).format("YYYY-MM-DD HH:mm:ss")):moment(moment(e/1e3,"X").format("YYYY-MM-DD HH:mm:ss")),t.isBefore(n)&&e.isSameOrAfter(o)&&i.push(this)})),i},t.fn.calendar=function(t){return new l(t,this)}}(jQuery);