芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/lot.mgaplay.com.br/web/dist/vendor/calendar/js/calendar.js
"use strict";Date.prototype.getWeek=function(t){if(t){var e=new Date(this.valueOf()),a=(this.getDay()+6)%7;e.setDate(e.getDate()-a+3);var o=e.valueOf();return e.setMonth(0,1),4!=e.getDay()&&e.setMonth(0,1+(4-e.getDay()+7)%7),1+Math.ceil((o-e)/6048e5)}var i=new Date(this.getFullYear(),0,1);return Math.ceil(((this.getTime()-i.getTime())/864e5+i.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},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,o){var l,p=null;if(l=/^(\d\d)-(\d\d)$/.exec(o))p=new Date(a,parseInt(l[2],10)-1,parseInt(l[1],10));else if(l=/^(\d\d)-(\d\d)-(\d\d\d\d)$/.exec(o))parseInt(l[3],10)==a&&(p=new Date(a,parseInt(l[2],10)-1,parseInt(l[1],10)));else if(l=/^easter(([+\-])(\d+))?$/.exec(o))p=function(t,e){var a=t%19,o=Math.floor(t/100),i=t%100,s=Math.floor(o/4),n=o%4,r=Math.floor((o+8)/25),l=(19*a+o-s-Math.floor((o-r+1)/3)+15)%30,p=(32+2*n+2*Math.floor(i/4)-l-i%4)%7,d=l+p+7*Math.floor((a+11*l+22*p)/451)+114,h=Math.floor(d/31)-1;return new Date(t,h,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(o)){var d=parseInt(l[1],10)-1,h=l[2],c=parseInt(l[3]),u=parseInt(l[4]);switch(h){case"+":for(var m=new Date(a,d,-6);m.getDay()!=u;)m=new Date(m.getFullYear(),m.getMonth(),m.getDate()+1);p=new Date(m.getFullYear(),m.getMonth(),m.getDate()+7*c);break;case"-":for(m=new Date(a,d+1,7);m.getDay()!=u;)m=new Date(m.getFullYear(),m.getMonth(),m.getDate()-1);p=new Date(m.getFullYear(),m.getMonth(),m.getDate()-7*c)}}if(!p)return r("Unknown holiday: "+e),n=!0,!1;switch(t){case 0:i=p;break;case 1:if(p.getTime()<=i.getTime())return r("Unknown holiday: "+e),n=!0,!1;s=p;break;default:return r("Unknown holiday: "+e),n=!0,!1}})),!n){var l=[];if(s)for(var d=new Date(i.getTime());d.getTime()<=s.getTime();d.setDate(d.getDate()+1))l.push(new Date(d.getTime()));else l.push(i);p.push({name:o,days:l})}})),n.cache[o]=p,n.cache[o]}function r(e){"object"==t.type(window.console)&&"function"==t.type(window.console.warn)&&window.console.warn("[Bootstrap-Calendar] "+e)}function l(a,o){return this.options=t.extend(!0,{position:{start:new Date,end:new Date}},e,a),this.setLanguage(this.options.language),this.context=o,o.css("width",this.options.width).addClass("cal-context"),this.view(),this}function p(e,a,o,i){e.stopPropagation();var s=(a=t(a)).closest(".cal-cell"),n=s.closest(".cal-before-eventlist"),r=s.data("cal-row");a.fadeOut("fast"),o.slideUp("fast",(function(){var e=t(".events-list",s);o.html(i.options.templates["events-list"]({cal:i,events:i.getEventsBetween(parseInt(e.data("cal-start")),parseInt(e.data("cal-end")))})),n.after(o),i.activecell=t("[data-cal-date]",s).text(),t("#cal-slide-tick").addClass("tick"+r).show(),o.slideDown("fast",(function(){t("body").one("click",(function(){o.slideUp("fast"),i.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"))})),i._update_modal()}),400)}n.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,{},o,calendar_languages[e]),this.options.language=e):(this.locale=o,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==s(this,"first_day")?t.days_name=[this.locale.d1,this.locale.d2,this.locale.d3,this.locale.d4,this.locale.d5,this.locale.d6,this.locale.d0]:t.days_name=[this.locale.d0,this.locale.d1,this.locale.d2,this.locale.d3,this.locale.d4,this.locale.d5,this.locale.d6];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._format_hour=function(t){var e=t.split(":"),a=parseInt(e[0]),o=parseInt(e[1]),i="";return this.options.format12&&(i=a<12?this.options.am_suffix:this.options.pm_suffix,0==(a%=12)&&(a=12)),a.toString().formatNum(2)+":"+o.toString().formatNum(2)+i},l.prototype._format_time=function(t){return this._format_hour(t.getHours()+":"+t.getMinutes())},l.prototype._calculate_hour_minutes=function(e){var a=this,o=parseInt(this.options.time_split),i=60/o,s=Math.min(i,1);(i>=1&&i%1!=0||i<1&&1440/o%1!=0)&&t.error(this.locale.error_timedevide);var n=this.options.time_start.split(":"),l=this.options.time_end.split(":");"00"===l[0]&&"00"===l[1]?e.hours=24*s:e.hours=(parseInt(l[0])-parseInt(n[0]))*s;var p=e.hours*i-parseInt(n[1])/o,d=6e4*o,h=new Date(this.options.position.start.getTime());h.setHours(n[0]),h.setMinutes(n[1]);var c=new Date(this.options.position.end.getTime()-864e5);"00"===l[0]&&"00"===l[1]?(c.setHours(l[0]),c.setMinutes(l[1]),c.setTime(c.getTime()+864e5)):(c.setHours(l[0]),c.setMinutes(l[1])),e.all_day=[],e.by_hour=[],e.after_time=[],e.before_time=[],t.each(e.events,(function(t,o){var i=new Date(parseInt(o.start)),s=new Date(parseInt(o.end));if(o.start_hour=moment(i).format(jsTimeFormat),o.end_hour=moment(s).format(jsTimeFormat),o.start
c.getTime()&&(r(1),o.end_hour=s.getDate()+" "+a.locale["ms"+s.getMonth()]+" "+o.end_hour),o.start
c.getTime())e.all_day.push(o);else if(o.end
c.getTime())e.after_time.push(o);else{var n=h.getTime()-o.start;o.top=n>=0?0:Math.abs(n)/d;var l=Math.abs(p-o.top),u=(o.end-o.start)/d;n>=0&&(u=(o.end-h.getTime())/d),o.lines=u,u>l&&(o.lines=l),e.by_hour.push(o)}}))},l.prototype._hour_min=function(t){var e=this.options.time_start.split(":"),a=parseInt(this.options.time_split),o=60/a;return 0==t?o-parseInt(e[1])/a:o},l.prototype._hour=function(t,e){var a=this.options.time_start.split(":"),o=parseInt(this.options.time_split),i=""+(parseInt(a[0])+t*Math.max(o/60,1)),s=""+o*e,n=this._format_hour(i.formatNum(2)+":"+s.formatNum(2));return moment(n,"HH:mm").format(jsTimeFormat)},l.prototype._week=function(e){this._loadTemplate("week-days");var a={},o=parseInt(this.options.position.start.getTime()),i=parseInt(this.options.position.end.getTime()),n=[],r=s(this,"first_day");return t.each(this.getEventsBetween(o,i),(function(t,e){var a=new Date(parseInt(e.start));a.setHours(0,0,0,0);var i=new Date(parseInt(e.end));i.setHours(23,59,59,999),e.start_day=new Date(parseInt(a.getTime())).getDay(),1==r&&(e.start_day=(e.start_day+6)%7),i.getTime()-a.getTime()<=864e5?e.days=1:e.days=(i.getTime()-a.getTime())/864e5,a.getTime()
7&&(e.days=7-e.start_day),n.push(e)})),a.events=n,a.cal=this,this.options.templates["week-days"](a)},l.prototype._month=function(t){this._loadTemplate("year-month");var e={cal:this},a=t+1;e.data_day=this.options.position.start.getFullYear()+"-"+(a<10?"0"+a:a)+"-01",e.month_name=this.locale["m"+t];var o=new Date(this.options.position.start.getFullYear(),t,1,0,0,0);return e.start=parseInt(o.getTime()),e.end=parseInt(new Date(this.options.position.start.getFullYear(),t+1,1,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 o={tooltip:"",cal:this},i=this.options.classes.months.outmonth,n=this.options.position.start.getDay();2==s(this,"first_day")?n++:n=0==n?7:n,a=a-n+1;var r=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),a,0,0,0),l=!1;a>0&&(l=!0,i=this.options.classes.months.inmonth);var p=new Date(this.options.position.end.getTime()-1).getDate();a+1>p&&(this.stop_cycling=!0),a>p&&(l=!1,a-=p,i=this.options.classes.months.outmonth),i=t.trim(i+" "+this._getDayClass("months",r)),a<=0&&(a=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),0).getDate()-Math.abs(a),i+=" cal-month-first-row");var d=this._getHoliday(r);return!1!==d&&(o.tooltip=d),o.data_day=r.getFullYear()+"-"+r.getMonthFormatted()+"-"+(a<10?"0"+a:a),o.cls=i,o.day=a,o.start=parseInt(r.getTime()),o.end=parseInt(o.start+864e5),o.events=l?this.getEventsBetween(o.start,o.end):[],this.options.templates["month-day"](o)},l.prototype._layouts=function(t,e,a){this._loadTemplate("agenda-layouts");for(var o={tooltip:"",cal:this},i=[],s=0,n=0;n
s&&t[n].eventTypeId==a&&(s=t[n].isPriority);for(n=0;n
0?(o.layouts=i,o.layouts.type=a,this.options.templates["agenda-layouts"](o)):""},l.prototype._displaygroups=function(t,e){this._loadTemplate("agenda-displaygroups");for(var a={tooltip:"",cal:this},o={},i=0,s=0;s
0?(a.displaygroups=o,this.options.templates["agenda-displaygroups"](a)):""},l.prototype._campaigns=function(t,e){this._loadTemplate("agenda-campaigns");for(var a={tooltip:"",cal:this},o={},i=0,s=0;s
0?(a.campaigns=o,this.options.templates["agenda-campaigns"](a)):""},l.prototype._breadcrumbTrail=function(t,e,a){this._loadTemplate("breadcrumb-trail");for(var o={},i={},s=e.results[e.selectedDisplayGroup],n=s.events,r=0;r
=0;r--){var d=i.intermediateDisplayGroupIds[r];void 0!==s.displayGroups[d]&&o.displayGroups.push({link:"",name:s.displayGroups[d].displayGroup})}return void 0!==s.displayGroups[p]&&o.displayGroups.push({link:"",name:s.displayGroups[p].displayGroup}),this.options.templates["breadcrumb-trail"](o)},l.prototype._getHoliday=function(e){var a=!1;return t.each(n(this,e.getFullYear()),(function(){var o=!1;if(t.each(this.days,(function(){if(this.toDateString()==e.toDateString())return o=!0,!1})),o)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,o=function(e,o){var i;"string"==typeof(i=a.options.classes&&t in a.options.classes&&e in a.options.classes[t]?a.options.classes[t][e]:"")&&i.length&&o.push(i)},i=[];switch(e.toDateString()==(new Date).toDateString()&&o("today",i),!1!==this._getHoliday(e)&&o("holidays",i),e.getDay()){case 0:o("sunday",i);break;case 6:o("saturday",i)}return o(e.toDateString(),i),i.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 o=t.extend({},this.options.position);if("next"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()+1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()+1);break;case"week":o.start.setDate(this.options.position.start.getDate()+7);break;case"day":case"agenda":o.start.setDate(this.options.position.start.getDate()+1)}else if("prev"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()-1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()-1);break;case"week":o.start.setDate(this.options.position.start.getDate()-7);break;case"day":case"agenda":o.start.setDate(this.options.position.start.getDate()-1)}else"today"==e?o.start.setTime((new Date).getTime()):"date"==e?o.start.setTime(a.format("x")):t.error(this.locale.error_where.format(e));this.options.day=o.start.getFullYear()+"-"+o.start.getMonthFormatted()+"-"+o.start.getDateFormatted(),this.view(),_.isFunction(a)&&a()},l.prototype._init_position=function(){var e,a,o;if("now"==this.options.day){var i=new Date;e=i.getFullYear(),a=i.getMonth(),o=i.getDate()}else if(this.options.day.match(/^\d{4}-\d{2}-\d{2}$/g)){var n=this.options.day.split("-");e=parseInt(n[0],10),a=parseInt(n[1],10)-1,o=parseInt(n[2],10)}else t.error(this.locale.error_dateformat.format(this.options.day));switch(this.options.view){case"year":this.options.position.start.setTime(new Date(e,0,1).getTime()),this.options.position.end.setTime(new Date(e+1,0,1).getTime());break;case"month":this.options.position.start.setTime(new Date(e,a,1).getTime()),this.options.position.end.setTime(new Date(e,a+1,1).getTime());break;case"day":this.options.position.start.setTime(new Date(e,a,o).getTime()),this.options.position.end.setTime(new Date(e,a,o+1).getTime());break;case"week":var r,l=new Date(e,a,o);r=1==s(this,"first_day")?l.getDate()-(l.getDay()+6)%7:l.getDate()-l.getDay(),this.options.position.start.setTime(new Date(e,a,r).getTime()),this.options.position.end.setTime(new Date(e,a,r+7).getTime());break;case"agenda":this.options.position.start.setTime(new Date(e,a,o).getTime()),this.options.position.end.setTime(new Date(e,a,o).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.getFullYear());case"month":return this.locale.title_month.format(this.locale["m"+t.getMonth()],t.getFullYear());case"week":return this.locale.title_week.format(t.getWeek(s(this,"week_numbers_iso_8601")),t.getFullYear());case"day":case"agenda":return this.locale.title_day.format(this.locale["d"+t.getDay()],t.getDate(),this.locale["m"+t.getMonth()],t.getFullYear())}},l.prototype.getYear=function(){return this.options.position.start.getFullYear()},l.prototype.getMonth=function(){var t=this.options.position.start;return this.locale["m"+t.getMonth()]},l.prototype.getDay=function(){var t=this.options.position.start;return this.locale["d"+t.getDay()]},l.prototype.isToday=function(){var t=(new Date).getTime();return t>this.options.position.start&&t
');e.context.find(".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(i){0!=t(".events-list",this).length&&t(this).children("[data-cal-date]").text()!=e.activecell&&p(i,a,o,e)}));var o=t(document.createElement("div")).attr("id","cal-slide-box");o.hide().click((function(t){t.stopPropagation()})),this._loadTemplate("events-list"),a.click((function(a){p(a,t(this),o,e)}))}},l.prototype.getEventsBetween=function(e,a){var o=[],i=moment(e,"x"),s=moment(a,"x");return t.each(this.options.events,(function(){if(null==this.start)return!0;let t=moment(this.scheduleEvent.fromDt,"YYYY-MM-DD HH:mm:ss"),e=null!=this.end?moment(this.scheduleEvent.toDt,"YYYY-MM-DD HH:mm:ss"):t;t.isBefore(s)&&e.isAfter(i)&&(this.start=t.valueOf(),this.end=e.valueOf(),o.push(this))})),o},t.fn.calendar=function(t){return new l(t,this)}}(jQuery);