Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

var factory;factory=function($,undefined$1){function UTCDate(){return new Date(Date.UTC.apply(Date,arguments))}function UTCToday(){var today=new Date;return UTCDate(today.getFullYear(),today.getMonth(),today.getDate())}function isUTCEquals(date1,date2){return date1.getUTCFullYear()===date2.getUTCFullYear()&&date1.getUTCMonth()===date2.getUTCMonth()&&date1.getUTCDate()===date2.getUTCDate()}function alias(method,deprecationMsg){return function(){return deprecationMsg!==undefined$1&&$.fn.datepicker2.deprecated(deprecationMsg),this[method].apply(this,arguments)}}var extras,DateArray=(extras={get:function(i){return this.slice(i)[0]},contains:function(d){for(var val=d&&d.valueOf(),i=0,l=this.length;i<l;i++)if(0<=this[i].valueOf()-val&&this[i].valueOf()-val<864e5)return i;return-1},remove:function(i){this.splice(i,1)},replace:function(new_array){new_array&&($.isArray(new_array)||(new_array=[new_array]),this.clear(),this.push.apply(this,new_array))},clear:function(){this.length=0},copy:function(){var a=new DateArray;return a.replace(this),a}},function(){var a=[];return a.push.apply(a,arguments),$.extend(a,extras),a}),Datepicker2=function(element,options){$.data(element,"datepicker2",this),this._events=[],this._secondaryEvents=[],this._process_options(options),this.dates=new DateArray,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=$(element),this.isInput=this.element.is("input"),this.inputField=this.isInput?this.element:this.element.find("input"),this.component=!!this.element.hasClass("date")&&this.element.find(".add-on, .input-group-addon, .input-group-append, .input-group-prepend, .btn"),this.component&&0===this.component.length&&(this.component=!1),this.isInline=!this.component&&this.element.is("div"),this.picker=$(DPGlobal.template),this._check_template(this.o.templates.leftArrow)&&this.picker.find(".prev").html(this.o.templates.leftArrow),this._check_template(this.o.templates.rightArrow)&&this.picker.find(".next").html(this.o.templates.rightArrow),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker2-inline").appendTo(this.element):this.picker.addClass("datepicker2-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker2-rtl"),this.o.calendarWeeks&&this.picker.find(".datepicker2-days .datepicker2-switch, thead .datepicker2-title, tfoot .today, tfoot .clear").attr("colspan",(function(i,val){return Number(val)+1})),this._process_options({startDate:this._o.startDate,endDate:this._o.endDate,daysOfWeekDisabled:this.o.daysOfWeekDisabled,daysOfWeekHighlighted:this.o.daysOfWeekHighlighted,datesDisabled:this.o.datesDisabled}),this._allow_update=!1,this.setViewMode(this.o.startView),this._allow_update=!0,this.fillDow(),this.fillMonths(),this.update(),this.isInline&&this.show()};Datepicker2.prototype={constructor:Datepicker2,_resolveViewName:function(view){return $.each(DPGlobal.viewModes,(function(i,viewMode){if(view===i||-1!==$.inArray(view,viewMode.names))return view=i,!1})),view},_resolveDaysOfWeek:function(daysOfWeek){return $.isArray(daysOfWeek)||(daysOfWeek=daysOfWeek.split(/[,\s]*/)),$.map(daysOfWeek,Number)},_check_template:function(tmp){try{return tmp!==undefined$1&&""!==tmp&&((tmp.match(/[<>]/g)||[]).length<=0||$(tmp).length>0)}catch(ex){return!1}},_process_options:function(opts){this._o=$.extend({},this._o,opts);var o=this.o=$.extend({},this._o),lang=o.language;dates[lang]||(lang=lang.split("-")[0],dates[lang]||(lang=defaults.language)),o.language=lang,o.startView=this._resolveViewName(o.startView),o.minViewMode=this._resolveViewName(o.minViewMode),o.maxViewMode=this._resolveViewName(o.maxViewMode),o.startView=Math.max(this.o.minViewMode,Math.min(this.o.maxViewMode,o.startView)),!0!==o.multidate&&(o.multidate=Number(o.multidate)||!1,!1!==o.multidate&&(o.multidate=Math.max(0,o.multidate))),o.multidateSeparator=String(o.multidateSeparator),o.weekStart%=7,o.weekEnd=(o.weekStart+6)%7;var format=DPGlobal.parseFormat(o.format);o.startDate!==-1/0&&(o.startDate?o.startDate instanceof Date?o.startDate=this._local_to_utc(this._zero_time(o.startDate)):o.startDate=DPGlobal.parseDate(o.startDate,format,o.language,o.assumeNearbyYear):o.startDate=-1/0),o.endDate!==1/0&&(o.endDate?o.endDate instanceof Date?o.endDate=this._local_to_utc(this._zero_time(o.endDate)):o.endDate=DPGlobal.parseDate(o.endDate,format,o.language,o.assumeNearbyYear):o.endDate=1/0),o.daysOfWeekDisabled=this._resolveDaysOfWeek(o.daysOfWeekDisabled||[]),o.daysOfWeekHighlighted=this._resolveDaysOfWeek(o.daysOfWeekHighlighted||[]),o.datesDisabled=o.datesDisabled||[],$.isArray(o.datesDisabled)||(o.datesDisabled=o.datesDisabled.split(",")),o.datesDisabled=$.map(o.datesDisabled,(function(d){return DPGlobal.parseDate(d,format,o.language,o.assumeNearbyYear)}));var plc=String(o.orientation).toLowerCase().split(/\s+/g),_plc=o.orientation.toLowerCase();if(plc=$.grep(plc,(function(word){return/^auto|left|right|top|bottom$/.test(word)})),o.orientation={x:"auto",y:"auto"},_plc&&"auto"!==_plc)if(1===plc.length)switch(plc[0]){case"top":case"bottom":o.orientation.y=plc[0];break;case"left":case"right":o.orientation.x=plc[0]}else _plc=$.grep(plc,(function(word){return/^left|right$/.test(word)})),o.orientation.x=_plc[0]||"auto",_plc=$.grep(plc,(function(word){return/^top|bottom$/.test(word)})),o.orientation.y=_plc[0]||"auto";if(o.defaultViewDate instanceof Date||"string"==typeof o.defaultViewDate)o.defaultViewDate=DPGlobal.parseDate(o.defaultViewDate,format,o.language,o.assumeNearbyYear);else if(o.defaultViewDate){var year=o.defaultViewDate.year||(new Date).getFullYear(),month=o.defaultViewDate.month||0,day=o.defaultViewDate.day||1;o.defaultViewDate=UTCDate(year,month,day)}else o.defaultViewDate=UTCToday()},_applyEvents:function(evs){for(var el,ch,ev,i=0;i<evs.length;i++)el=evs[i][0],2===evs[i].length?(ch=undefined$1,ev=evs[i][1]):3===evs[i].length&&(ch=evs[i][1],ev=evs[i][2]),el.on(ev,ch)},_unapplyEvents:function(evs){for(var el,ev,ch,i=0;i<evs.length;i++)el=evs[i][0],2===evs[i].length?(ch=undefined$1,ev=evs[i][1]):3===evs[i].length&&(ch=evs[i][1],ev=evs[i][2]),el.off(ev,ch)},_buildEvents:function(){var events={keyup:$.proxy((function(e){-1===$.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()}),this),keydown:$.proxy(this.keydown,this),paste:$.proxy(this.paste,this)};!0===this.o.showOnFocus&&(events.focus=$.proxy(this.show,this)),this.isInput?this._events=[[this.element,events]]:this.component&&this.inputField.length?this._events=[[this.inputField,events],[this.component,{click:$.proxy(this.show,this)}]]:this._events=[[this.element,{click:$.proxy(this.show,this),keydown:$.proxy(this.keydown,this)}]],this._events.push([this.element,"*",{blur:$.proxy((function(e){this._focused_from=e.target}),this)}],[this.element,{blur:$.proxy((function(e){this._focused_from=e.target}),this)}]),this.o.immediateUpdates&&this._events.push([this.element,{"changeYear changeMonth":$.proxy((function(e){this.update(e.date)}),this)}]),this._secondaryEvents=[[this.picker,{click:$.proxy(this.click,this)}],[this.picker,".prev, .next",{click:$.proxy(this.navArrowsClick,this)}],[this.picker,".day:not(.disabled)",{click:$.proxy(this.dayCellClick,this)}],[$(window),{resize:$.proxy(this.place,this)}],[$(document),{"mousedown touchstart":$.proxy((function(e){this.element.is(e.target)||this.element.find(e.target).length||this.picker.is(e.target)||this.picker.find(e.target).length||this.isInline||this.hide()}),this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(event,altdate){var date=altdate||this.dates.get(-1),local_date=this._utc_to_local(date);this.element.trigger({type:event,date:local_date,viewMode:this.viewMode,dates:$.map(this.dates,this._utc_to_local),format:$.proxy((function(ix,format){0===arguments.length?(ix=this.dates.length-1,format=this.o.format):"string"==typeof ix&&(format=ix,ix=this.dates.length-1),format=format||this.o.format;var date=this.dates.get(ix);return DPGlobal.formatDate(date,format,this.o.language)}),this)})},show:function(){if(!(this.inputField.is(":disabled")||this.inputField.prop("readonly")&&!1===this.o.enableOnReadonly))return this.isInline||this.picker.appendTo(this.o.container),this.place(),this.picker.show(),this._attachSecondaryEvents(),this._trigger("show"),(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.o.disableTouchKeyboard&&$(this.element).blur(),this},hide:function(){return this.isInline||!this.picker.is(":visible")||(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.setViewMode(this.o.startView),this.o.forceParse&&this.inputField.val()&&this.setValue(),this._trigger("hide")),this},destroy:function(){return this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker2,this.isInput||delete this.element.data().date,this},paste:function(e){var dateString;if(e.originalEvent.clipboardData&&e.originalEvent.clipboardData.types&&-1!==$.inArray("text/plain",e.originalEvent.clipboardData.types))dateString=e.originalEvent.clipboardData.getData("text/plain");else{if(!window.clipboardData)return;dateString=window.clipboardData.getData("Text")}this.setDate(dateString),this.update(),e.preventDefault()},_utc_to_local:function(utc){if(!utc)return utc;var local=new Date(utc.getTime()+6e4*utc.getTimezoneOffset());return local.getTimezoneOffset()!==utc.getTimezoneOffset()&&(local=new Date(utc.getTime()+6e4*local.getTimezoneOffset())),local},_local_to_utc:function(local){return local&&new Date(local.getTime()-6e4*local.getTimezoneOffset())},_zero_time:function(local){return local&&new Date(local.getFullYear(),local.getMonth(),local.getDate())},_zero_utc_time:function(utc){return utc&&UTCDate(utc.getUTCFullYear(),utc.getUTCMonth(),utc.getUTCDate())},getDates:function(){return $.map(this.dates,this._utc_to_local)},getUTCDates:function(){return $.map(this.dates,(function(d){return new Date(d)}))},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){var selected_date=this.dates.get(-1);return selected_date!==undefined$1?new Date(selected_date):null},clearDates:function(){this.inputField.val(""),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()},setDates:function(){var args=$.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,args),this._trigger("changeDate"),this.setValue(),this},setUTCDates:function(){var args=$.isArray(arguments[0])?arguments[0]:arguments;return this.setDates.apply(this,$.map(args,this._utc_to_local)),this},setDate:alias("setDates"),setUTCDate:alias("setUTCDates"),remove:alias("destroy","Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead"),setValue:function(){var formatted=this.getFormattedDate();return this.inputField.val(formatted),this},getFormattedDate:function(format){format===undefined$1&&(format=this.o.format);var lang=this.o.language;return $.map(this.dates,(function(d){return DPGlobal.formatDate(d,format,lang)})).join(this.o.multidateSeparator)},getStartDate:function(){return this.o.startDate},setStartDate:function(startDate){return this._process_options({startDate:startDate}),this.update(),this.updateNavArrows(),this},getEndDate:function(){return this.o.endDate},setEndDate:function(endDate){return this._process_options({endDate:endDate}),this.update(),this.updateNavArrows(),this},setDaysOfWeekDisabled:function(daysOfWeekDisabled){return this._process_options({daysOfWeekDisabled:daysOfWeekDisabled}),this.update(),this},setDaysOfWeekHighlighted:function(daysOfWeekHighlighted){return this._process_options({daysOfWeekHighlighted:daysOfWeekHighlighted}),this.update(),this},setDatesDisabled:function(datesDisabled){return this._process_options({datesDisabled:datesDisabled}),this.update(),this},place:function(){if(this.isInline)return this;var calendarWidth=this.picker.outerWidth(),calendarHeight=this.picker.outerHeight(),container=$(this.o.container),windowWidth=container.width(),scrollTop="body"===this.o.container?$(document).scrollTop():container.scrollTop(),appendOffset=container.offset(),parentsZindex=[0];this.element.parents().each((function(){var itemZIndex=$(this).css("z-index");"auto"!==itemZIndex&&0!==Number(itemZIndex)&&parentsZindex.push(Number(itemZIndex))}));var zIndex=Math.max.apply(Math,parentsZindex)+this.o.zIndexOffset,offset=this.component?this.component.parent().offset():this.element.offset(),height=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),width=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),left=offset.left-appendOffset.left,top=offset.top-appendOffset.top;"body"!==this.o.container&&(top+=scrollTop),this.picker.removeClass("datepicker2-orient-top datepicker2-orient-bottom datepicker2-orient-right datepicker2-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("datepicker2-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(left-=calendarWidth-width)):offset.left<0?(this.picker.addClass("datepicker2-orient-left"),left-=offset.left-10):left+calendarWidth>windowWidth?(this.picker.addClass("datepicker2-orient-right"),left+=width-calendarWidth):this.o.rtl?this.picker.addClass("datepicker2-orient-right"):this.picker.addClass("datepicker2-orient-left");var yorient=this.o.orientation.y;if("auto"===yorient&&(yorient=-scrollTop+top-calendarHeight<0?"bottom":"top"),this.picker.addClass("datepicker2-orient-"+yorient),"top"===yorient?top-=calendarHeight+parseInt(this.picker.css("padding-top")):top+=height,this.o.rtl){var right=windowWidth-(left+width);this.picker.css({top:top,right:right,zIndex:zIndex})}else this.picker.css({top:top,left:left,zIndex:zIndex});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var oldDates=this.dates.copy(),dates=[],fromArgs=!1;return arguments.length?($.each(arguments,$.proxy((function(i,date){date instanceof Date&&(date=this._local_to_utc(date)),dates.push(date)}),this)),fromArgs=!0):(dates=(dates=this.isInput?this.element.val():this.element.data("date")||this.inputField.val())&&this.o.multidate?dates.split(this.o.multidateSeparator):[dates],delete this.element.data().date),dates=$.map(dates,$.proxy((function(date){return DPGlobal.parseDate(date,this.o.format,this.o.language,this.o.assumeNearbyYear)}),this)),dates=$.grep(dates,$.proxy((function(date){return!this.dateWithinRange(date)||!date}),this),!0),this.dates.replace(dates),this.o.updateViewDate&&(this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=this.o.defaultViewDate),fromArgs?(this.setValue(),this.element.change()):this.dates.length&&String(oldDates)!==String(this.dates)&&fromArgs&&(this._trigger("changeDate"),this.element.change()),!this.dates.length&&oldDates.length&&(this._trigger("clearDate"),this.element.change()),this.fill(),this},fillDow:function(){if(this.o.showWeekDays){var dowCnt=this.o.weekStart,html="<tr>";for(this.o.calendarWeeks&&(html+='<th class="cw">&#160;</th>');dowCnt<this.o.weekStart+7;)html+='<th class="dow',-1!==$.inArray(dowCnt,this.o.daysOfWeekDisabled)&&(html+=" disabled"),html+='">'+dates[this.o.language].daysMin[dowCnt++%7]+"</th>";html+="</tr>",this.picker.find(".datepicker2-days thead").append(html)}},fillMonths:function(){for(var localDate=this._utc_to_local(this.viewDate),html="",i=0;i<12;i++)html+='<span class="month'+(localDate&&localDate.getMonth()===i?" focused":"")+'">'+dates[this.o.language].monthsShort[i]+"</span>";this.picker.find(".datepicker2-months td").html(html)},setRange:function(range){range&&range.length?this.range=$.map(range,(function(d){return d.valueOf()})):delete this.range,this.fill()},getClassNames:function(date){var cls=[],year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth(),today=UTCToday();return date.getUTCFullYear()<year||date.getUTCFullYear()===year&&date.getUTCMonth()<month?cls.push("old"):(date.getUTCFullYear()>year||date.getUTCFullYear()===year&&date.getUTCMonth()>month)&&cls.push("new"),this.focusDate&&date.valueOf()===this.focusDate.valueOf()&&cls.push("focused"),this.o.todayHighlight&&isUTCEquals(date,today)&&cls.push("today"),-1!==this.dates.contains(date)&&cls.push("active"),this.dateWithinRange(date)||cls.push("disabled"),this.dateIsDisabled(date)&&cls.push("disabled","disabled-date"),-1!==$.inArray(date.getUTCDay(),this.o.daysOfWeekHighlighted)&&cls.push("highlighted"),this.range&&(date>this.range[0]&&date<this.range[this.range.length-1]&&cls.push("range"),-1!==$.inArray(date.valueOf(),this.range)&&cls.push("selected"),date.valueOf()===this.range[0]&&cls.push("range-start"),date.valueOf()===this.range[this.range.length-1]&&cls.push("range-end")),cls},_fill_yearsView:function(selector,cssClass,factor,year,startYear,endYear,beforeFn){for(var classes,tooltip,before,html="",step=factor/10,view=this.picker.find(selector),startVal=Math.floor(year/factor)*factor,endVal=startVal+9*step,focusedVal=Math.floor(this.viewDate.getFullYear()/step)*step,selected=$.map(this.dates,(function(d){return Math.floor(d.getUTCFullYear()/step)*step})),currVal=startVal-step;currVal<=endVal+step;currVal+=step)classes=[cssClass],tooltip=null,currVal===startVal-step?classes.push("old"):currVal===endVal+step&&classes.push("new"),-1!==$.inArray(currVal,selected)&&classes.push("active"),(currVal<startYear||currVal>endYear)&&classes.push("disabled"),currVal===focusedVal&&classes.push("focused"),beforeFn!==$.noop&&((before=beforeFn(new Date(currVal,0,1)))===undefined$1?before={}:"boolean"==typeof before?before={enabled:before}:"string"==typeof before&&(before={classes:before}),!1===before.enabled&&classes.push("disabled"),before.classes&&(classes=classes.concat(before.classes.split(/\s+/))),before.tooltip&&(tooltip=before.tooltip)),html+='<span class="'+classes.join(" ")+'"'+(tooltip?' title="'+tooltip+'"':"")+">"+currVal+"</span>";view.find(".datepicker2-switch").text(startVal+"-"+endVal),view.find("td").html(html)},fill:function(){var tooltip,before,d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth(),startYear=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,startMonth=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,endYear=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,endMonth=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,todaytxt=dates[this.o.language].today||dates.en.today||"",cleartxt=dates[this.o.language].clear||dates.en.clear||"",titleFormat=dates[this.o.language].titleFormat||dates.en.titleFormat,todayDate=UTCToday(),titleBtnVisible=(!0===this.o.todayBtn||"linked"===this.o.todayBtn)&&todayDate>=this.o.startDate&&todayDate<=this.o.endDate&&!this.weekOfDateIsDisabled(todayDate);if(!isNaN(year)&&!isNaN(month)){this.picker.find(".datepicker2-days .datepicker2-switch").text(DPGlobal.formatDate(d,titleFormat,this.o.language)),this.picker.find("tfoot .today").text(todaytxt).css("display",titleBtnVisible?"table-cell":"none"),this.picker.find("tfoot .clear").text(cleartxt).css("display",!0===this.o.clearBtn?"table-cell":"none"),this.picker.find("thead .datepicker2-title").text(this.o.title).css("display","string"==typeof this.o.title&&""!==this.o.title?"table-cell":"none"),this.updateNavArrows(),this.fillMonths();var prevMonth=UTCDate(year,month,0),day=prevMonth.getUTCDate();prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.o.weekStart+7)%7);var nextMonth=new Date(prevMonth);prevMonth.getUTCFullYear()<100&&nextMonth.setUTCFullYear(prevMonth.getUTCFullYear()),nextMonth.setUTCDate(nextMonth.getUTCDate()+42),nextMonth=nextMonth.valueOf();for(var weekDay,clsName,html=[];prevMonth.valueOf()<nextMonth;){if((weekDay=prevMonth.getUTCDay())===this.o.weekStart&&(html.push("<tr>"),this.o.calendarWeeks)){var ws=new Date(+prevMonth+(this.o.weekStart-weekDay-7)%7*864e5),th=new Date(Number(ws)+(11-ws.getUTCDay())%7*864e5),yth=new Date(Number(yth=UTCDate(th.getUTCFullYear(),0,1))+(11-yth.getUTCDay())%7*864e5),calWeek=(th-yth)/864e5/7+1;html.push('<td class="cw">'+calWeek+"</td>")}(clsName=this.getClassNames(prevMonth)).push("day");var content=prevMonth.getUTCDate();this.o.beforeShowDay!==$.noop&&((before=this.o.beforeShowDay(this._utc_to_local(prevMonth)))===undefined$1?before={}:"boolean"==typeof before?before={enabled:before}:"string"==typeof before&&(before={classes:before}),!1===before.enabled&&clsName.push("disabled"),before.classes&&(clsName=clsName.concat(before.classes.split(/\s+/))),before.tooltip&&(tooltip=before.tooltip),before.content&&(content=before.content)),clsName=$.isFunction($.uniqueSort)?$.uniqueSort(clsName):$.unique(clsName),html.push('<td class="'+clsName.join(" ")+'"'+(tooltip?' title="'+tooltip+'"':"")+' data-date="'+prevMonth.getTime().toString()+'">'+content+"</td>"),tooltip=null,weekDay===this.o.weekEnd&&html.push("</tr>"),prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}this.picker.find(".datepicker2-days tbody").html(html.join(""));var monthsTitle=dates[this.o.language].monthsTitle||dates.en.monthsTitle||"Months",months=this.picker.find(".datepicker2-months").find(".datepicker2-switch").text(this.o.maxViewMode<2?monthsTitle:year).end().find("tbody span").removeClass("active");if($.each(this.dates,(function(i,d){d.getUTCFullYear()===year&&months.eq(d.getUTCMonth()).addClass("active")})),(year<startYear||year>endYear)&&months.addClass("disabled"),year===startYear&&months.slice(0,startMonth).addClass("disabled"),year===endYear&&months.slice(endMonth+1).addClass("disabled"),this.o.beforeShowMonth!==$.noop){var that=this;$.each(months,(function(i,month){var moDate=new Date(year,i,1),before=that.o.beforeShowMonth(moDate);before===undefined$1?before={}:"boolean"==typeof before?before={enabled:before}:"string"==typeof before&&(before={classes:before}),!1!==before.enabled||$(month).hasClass("disabled")||$(month).addClass("disabled"),before.classes&&$(month).addClass(before.classes),before.tooltip&&$(month).prop("title",before.tooltip)}))}this._fill_yearsView(".datepicker2-years","year",10,year,startYear,endYear,this.o.beforeShowYear),this._fill_yearsView(".datepicker2-decades","decade",100,year,startYear,endYear,this.o.beforeShowDecade),this._fill_yearsView(".datepicker2-centuries","century",1e3,year,startYear,endYear,this.o.beforeShowCentury)}},updateNavArrows:function(){if(this._allow_update){var prevIsDisabled,nextIsDisabled,d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth(),startYear=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,startMonth=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,endYear=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,endMonth=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,factor=1;switch(this.viewMode){case 4:factor*=10;case 3:factor*=10;case 2:factor*=10;case 1:prevIsDisabled=Math.floor(year/factor)*factor<=startYear,nextIsDisabled=Math.floor(year/factor)*factor+factor>endYear;break;case 0:prevIsDisabled=year<=startYear&&month<=startMonth,nextIsDisabled=year>=endYear&&month>=endMonth}this.picker.find(".prev").toggleClass("disabled",prevIsDisabled),this.picker.find(".next").toggleClass("disabled",nextIsDisabled)}},click:function(e){var target,year,month;e.preventDefault(),e.stopPropagation(),(target=$(e.target)).hasClass("datepicker2-switch")&&this.viewMode!==this.o.maxViewMode&&this.setViewMode(this.viewMode+1),target.hasClass("today")&&!target.hasClass("day")&&(this.setViewMode(0),this._setDate(UTCToday(),"linked"===this.o.todayBtn?null:"view")),target.hasClass("clear")&&this.clearDates(),target.hasClass("disabled")||(target.hasClass("month")||target.hasClass("year")||target.hasClass("decade")||target.hasClass("century"))&&(this.viewDate.setUTCDate(1),1===this.viewMode?(month=target.parent().find("span").index(target),year=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(month)):(month=0,year=Number(target.text()),this.viewDate.setUTCFullYear(year)),this._trigger(DPGlobal.viewModes[this.viewMode-1].e,this.viewDate),this.viewMode===this.o.minViewMode?this._setDate(UTCDate(year,month,1)):(this.setViewMode(this.viewMode-1),this.fill())),this.picker.is(":visible")&&this._focused_from&&this._focused_from.focus(),delete this._focused_from},dayCellClick:function(e){var timestamp=$(e.currentTarget).data("date"),date=new Date(timestamp);this.o.updateViewDate&&(date.getUTCFullYear()!==this.viewDate.getUTCFullYear()&&this._trigger("changeYear",this.viewDate),date.getUTCMonth()!==this.viewDate.getUTCMonth()&&this._trigger("changeMonth",this.viewDate)),this._setDate(date)},navArrowsClick:function(e){var dir=$(e.currentTarget).hasClass("prev")?-1:1;0!==this.viewMode&&(dir*=12*DPGlobal.viewModes[this.viewMode].navStep),this.viewDate=this.moveMonth(this.viewDate,dir),this._trigger(DPGlobal.viewModes[this.viewMode].e,this.viewDate),this.fill()},_toggle_multidate:function(date){var ix=this.dates.contains(date);if(date||this.dates.clear(),-1!==ix?(!0===this.o.multidate||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(ix):!1===this.o.multidate?(this.dates.clear(),this.dates.push(date)):this.dates.push(date),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(date,which){which&&"date"!==which||this._toggle_multidate(date&&new Date(date)),(!which&&this.o.updateViewDate||"view"===which)&&(this.viewDate=date&&new Date(date)),this.fill(),this.setValue(),which&&"view"===which||this._trigger("changeDate"),this.inputField.trigger("change"),!this.o.autoclose||which&&"date"!==which||this.hide()},moveDay:function(date,dir){var newDate=new Date(date);return newDate.setUTCDate(date.getUTCDate()+dir),newDate},moveWeek:function(date,dir){return this.moveDay(date,7*dir)},moveMonth:function(date,dir){if(!(d=date)||isNaN(d.getTime()))return this.o.defaultViewDate;var d;if(!dir)return date;var new_month,test,new_date=new Date(date.valueOf()),day=new_date.getUTCDate(),month=new_date.getUTCMonth(),mag=Math.abs(dir);if(dir=dir>0?1:-1,1===mag)test=-1===dir?function(){return new_date.getUTCMonth()===month}:function(){return new_date.getUTCMonth()!==new_month},new_month=month+dir,new_date.setUTCMonth(new_month),new_month=(new_month+12)%12;else{for(var i=0;i<mag;i++)new_date=this.moveMonth(new_date,dir);new_month=new_date.getUTCMonth(),new_date.setUTCDate(day),test=function(){return new_month!==new_date.getUTCMonth()}}for(;test();)new_date.setUTCDate(--day),new_date.setUTCMonth(new_month);return new_date},moveYear:function(date,dir){return this.moveMonth(date,12*dir)},moveAvailableDate:function(date,dir,fn){do{if(date=this[fn](date,dir),!this.dateWithinRange(date))return!1;fn="moveDay"}while(this.dateIsDisabled(date));return date},weekOfDateIsDisabled:function(date){return-1!==$.inArray(date.getUTCDay(),this.o.daysOfWeekDisabled)},dateIsDisabled:function(date){return this.weekOfDateIsDisabled(date)||$.grep(this.o.datesDisabled,(function(d){return isUTCEquals(date,d)})).length>0},dateWithinRange:function(date){return date>=this.o.startDate&&date<=this.o.endDate},keydown:function(e){if(this.picker.is(":visible")){var dir,newViewDate,dateChanged=!1,focusDate=this.focusDate||this.viewDate;switch(e.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),e.preventDefault(),e.stopPropagation();break;case 37:case 38:case 39:case 40:if(!this.o.keyboardNavigation||7===this.o.daysOfWeekDisabled.length)break;dir=37===e.keyCode||38===e.keyCode?-1:1,0===this.viewMode?e.ctrlKey?(newViewDate=this.moveAvailableDate(focusDate,dir,"moveYear"))&&this._trigger("changeYear",this.viewDate):e.shiftKey?(newViewDate=this.moveAvailableDate(focusDate,dir,"moveMonth"))&&this._trigger("changeMonth",this.viewDate):37===e.keyCode||39===e.keyCode?newViewDate=this.moveAvailableDate(focusDate,dir,"moveDay"):this.weekOfDateIsDisabled(focusDate)||(newViewDate=this.moveAvailableDate(focusDate,dir,"moveWeek")):1===this.viewMode?(38!==e.keyCode&&40!==e.keyCode||(dir*=4),newViewDate=this.moveAvailableDate(focusDate,dir,"moveMonth")):2===this.viewMode&&(38!==e.keyCode&&40!==e.keyCode||(dir*=4),newViewDate=this.moveAvailableDate(focusDate,dir,"moveYear")),newViewDate&&(this.focusDate=this.viewDate=newViewDate,this.setValue(),this.fill(),e.preventDefault());break;case 13:if(!this.o.forceParse)break;focusDate=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(focusDate),dateChanged=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(e.preventDefault(),e.stopPropagation(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}dateChanged&&(this.dates.length?this._trigger("changeDate"):this._trigger("clearDate"),this.inputField.trigger("change"))}else 40!==e.keyCode&&27!==e.keyCode||(this.show(),e.stopPropagation())},setViewMode:function(viewMode){this.viewMode=viewMode,this.picker.children("div").hide().filter(".datepicker2-"+DPGlobal.viewModes[this.viewMode].clsName).show(),this.updateNavArrows(),this._trigger("changeViewMode",new Date(this.viewDate))}};var DateRangePicker=function(element,options){$.data(element,"datepicker2",this),this.element=$(element),this.inputs=$.map(options.inputs,(function(i){return i.jquery?i[0]:i})),delete options.inputs,this.keepEmptyValues=options.keepEmptyValues,delete options.keepEmptyValues,datepicker2Plugin.call($(this.inputs),options).on("changeDate",$.proxy(this.dateUpdated,this)),this.pickers=$.map(this.inputs,(function(i){return $.data(i,"datepicker2")})),this.updateDates()};function opts_from_el(el,prefix){var data=$(el).data(),out={},replace=new RegExp("^"+prefix.toLowerCase()+"([A-Z])");function re_lower(_,a){return a.toLowerCase()}for(var key in prefix=new RegExp("^"+prefix.toLowerCase()),data)prefix.test(key)&&(out[key.replace(replace,re_lower)]=data[key]);return out}function opts_from_locale(lang){var out={};if(dates[lang]||(lang=lang.split("-")[0],dates[lang])){var d=dates[lang];return $.each(locale_opts,(function(i,k){k in d&&(out[k]=d[k])})),out}}DateRangePicker.prototype={updateDates:function(){this.dates=$.map(this.pickers,(function(i){return i.getUTCDate()})),this.updateRanges()},updateRanges:function(){var range=$.map(this.dates,(function(d){return d.valueOf()}));$.each(this.pickers,(function(i,p){p.setRange(range)}))},clearDates:function(){$.each(this.pickers,(function(i,p){p.clearDates()}))},dateUpdated:function(e){if(!this.updating){this.updating=!0;var dp=$.data(e.target,"datepicker2");if(dp!==undefined$1){var new_date=dp.getUTCDate(),keep_empty_values=this.keepEmptyValues,i=$.inArray(e.target,this.inputs),j=i-1,k=i+1,l=this.inputs.length;if(-1!==i){if($.each(this.pickers,(function(i,p){p.getUTCDate()||p!==dp&&keep_empty_values||p.setUTCDate(new_date)})),new_date<this.dates[j])for(;j>=0&&new_date<this.dates[j];)this.pickers[j--].setUTCDate(new_date);else if(new_date>this.dates[k])for(;k<l&&new_date>this.dates[k];)this.pickers[k++].setUTCDate(new_date);this.updateDates(),delete this.updating}}}},destroy:function(){$.map(this.pickers,(function(p){p.destroy()})),$(this.inputs).off("changeDate",this.dateUpdated),delete this.element.data().datepicker2},remove:alias("destroy","Method `remove` is deprecated and will be removed in version 2.0. Use `destroy` instead")};var old=$.fn.datepicker2,datepicker2Plugin=function(option){var internal_return,args=Array.apply(null,arguments);if(args.shift(),this.each((function(){var $this=$(this),data=$this.data("datepicker2"),options="object"==typeof option&&option;if(!data){var elopts=opts_from_el(this,"date"),locopts=opts_from_locale($.extend({},defaults,elopts,options).language),opts=$.extend({},defaults,locopts,elopts,options);$this.hasClass("input-daterange")||opts.inputs?($.extend(opts,{inputs:opts.inputs||$this.find("input").toArray()}),data=new DateRangePicker(this,opts)):data=new Datepicker2(this,opts),$this.data("datepicker2",data)}"string"==typeof option&&"function"==typeof data[option]&&(internal_return=data[option].apply(data,args))})),internal_return===undefined$1||internal_return instanceof Datepicker2||internal_return instanceof DateRangePicker)return this;if(this.length>1)throw new Error("Using only allowed for the collection of a single element ("+option+" function)");return internal_return};$.fn.datepicker2=datepicker2Plugin;var defaults=$.fn.datepicker2.defaults={assumeNearbyYear:!1,autoclose:!1,beforeShowDay:$.noop,beforeShowMonth:$.noop,beforeShowYear:$.noop,beforeShowDecade:$.noop,beforeShowCentury:$.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],daysOfWeekHighlighted:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keepEmptyValues:!1,keyboardNavigation:!0,language:"en",minViewMode:0,maxViewMode:4,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,updateViewDate:!0,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,showOnFocus:!0,zIndexOffset:10,container:"body",immediateUpdates:!1,title:"",templates:{leftArrow:"&#x00AB;",rightArrow:"&#x00BB;"},showWeekDays:!0},locale_opts=$.fn.datepicker2.locale_opts=["format","rtl","weekStart"];$.fn.datepicker2.Constructor=Datepicker2;var dates=$.fn.datepicker2.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear",titleFormat:"MM yyyy"}},DPGlobal={viewModes:[{names:["days","month"],clsName:"days",e:"changeMonth"},{names:["months","year"],clsName:"months",e:"changeYear",navStep:1},{names:["years","decade"],clsName:"years",e:"changeDecade",navStep:10},{names:["decades","century"],clsName:"decades",e:"changeCentury",navStep:100},{names:["centuries","millennium"],clsName:"centuries",e:"changeMillennium",navStep:1e3}],validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,parseFormat:function(format){if("function"==typeof format.toValue&&"function"==typeof format.toDisplay)return format;var separators=format.replace(this.validParts,"\0").split("\0"),parts=format.match(this.validParts);if(!separators||!separators.length||!parts||0===parts.length)throw new Error("Invalid date format.");return{separators:separators,parts:parts}},parseDate:function(date,format,language,assumeNearby){if(!date)return undefined$1;if(date instanceof Date)return date;if("string"==typeof format&&(format=DPGlobal.parseFormat(format)),format.toValue)return format.toValue(date,format,language);var parts,part,dir,i,fn,fn_map={d:"moveDay",m:"moveMonth",w:"moveWeek",y:"moveYear"},dateAliases={yesterday:"-1d",today:"+0d",tomorrow:"+1d"};if(date in dateAliases&&(date=dateAliases[date]),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/i.test(date)){for(parts=date.match(/([\-+]\d+)([dmwy])/gi),date=new Date,i=0;i<parts.length;i++)part=parts[i].match(/([\-+]\d+)([dmwy])/i),dir=Number(part[1]),fn=fn_map[part[2].toLowerCase()],date=Datepicker2.prototype[fn](date,dir);return Datepicker2.prototype._zero_utc_time(date)}parts=date&&date.match(this.nonpunctuation)||[];var val,filtered,parsed={},setters_order=["yyyy","yy","M","MM","m","mm","d","dd"],setters_map={yyyy:function(d,v){return d.setUTCFullYear(assumeNearby?(!0===(threshold=assumeNearby)&&(threshold=10),(year=v)<100&&(year+=2e3)>(new Date).getFullYear()+threshold&&(year-=100),year):v);var year,threshold},m:function(d,v){if(isNaN(d))return d;for(v-=1;v<0;)v+=12;for(v%=12,d.setUTCMonth(v);d.getUTCMonth()!==v;)d.setUTCDate(d.getUTCDate()-1);return d},d:function(d,v){return d.setUTCDate(v)}};setters_map.yy=setters_map.yyyy,setters_map.M=setters_map.MM=setters_map.mm=setters_map.m,setters_map.dd=setters_map.d,date=UTCToday();var fparts=format.parts.slice();function match_part(){var m=this.slice(0,parts[i].length),p=parts[i].slice(0,m.length);return m.toLowerCase()===p.toLowerCase()}if(parts.length!==fparts.length&&(fparts=$(fparts).filter((function(i,p){return-1!==$.inArray(p,setters_order)})).toArray()),parts.length===fparts.length){var cnt,_date,s;for(i=0,cnt=fparts.length;i<cnt;i++){if(val=parseInt(parts[i],10),part=fparts[i],isNaN(val))switch(part){case"MM":filtered=$(dates[language].months).filter(match_part),val=$.inArray(filtered[0],dates[language].months)+1;break;case"M":filtered=$(dates[language].monthsShort).filter(match_part),val=$.inArray(filtered[0],dates[language].monthsShort)+1}parsed[part]=val}for(i=0;i<setters_order.length;i++)(s=setters_order[i])in parsed&&!isNaN(parsed[s])&&(_date=new Date(date),setters_map[s](_date,parsed[s]),isNaN(_date)||(date=_date))}return date},formatDate:function(date,format,language){if(!date)return"";if("string"==typeof format&&(format=DPGlobal.parseFormat(format)),format.toDisplay)return format.toDisplay(date,format,language);var val={d:date.getUTCDate(),D:dates[language].daysShort[date.getUTCDay()],DD:dates[language].days[date.getUTCDay()],m:date.getUTCMonth()+1,M:dates[language].monthsShort[date.getUTCMonth()],MM:dates[language].months[date.getUTCMonth()],yy:date.getUTCFullYear().toString().substring(2),yyyy:date.getUTCFullYear()};val.dd=(val.d<10?"0":"")+val.d,val.mm=(val.m<10?"0":"")+val.m,date=[];for(var seps=$.extend([],format.separators),i=0,cnt=format.parts.length;i<=cnt;i++)seps.length&&date.push(seps.shift()),date.push(val[format.parts[i]]);return date.join("")},headTemplate:'<thead><tr><th colspan="7" class="datepicker2-title"></th></tr><tr><th class="prev">'+defaults.templates.leftArrow+'</th><th colspan="5" class="datepicker2-switch"></th><th class="next">'+defaults.templates.rightArrow+"</th></tr></thead>",contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};DPGlobal.template='<div class="datepicker2"><div class="datepicker2-days"><table class="table-condensed">'+DPGlobal.headTemplate+"<tbody></tbody>"+DPGlobal.footTemplate+'</table></div><div class="datepicker2-months"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+'</table></div><div class="datepicker2-years"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+'</table></div><div class="datepicker2-decades"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+'</table></div><div class="datepicker2-centuries"><table class="table-condensed">'+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"</table></div></div>",$.fn.datepicker2.DPGlobal=DPGlobal,$.fn.datepicker2.noConflict=function(){return $.fn.datepicker2=old,this},$.fn.datepicker2.version="1.9.0",$.fn.datepicker2.deprecated=function(msg){var console=window.console;console&&console.warn&&console.warn("DEPRECATED: "+msg)},$(document).on("focus.datepicker2.data-api click.datepicker2.data-api",'[data-provide="datepicker2"]',(function(e){var $this=$(this);$this.data("datepicker2")||(e.preventDefault(),datepicker2Plugin.call($this,"show"))})),$((function(){datepicker2Plugin.call($('[data-provide="datepicker2-inline"]'))}))},"function"==typeof define&&define.amd?define("block_dash/datepicker",["jquery"],factory):"object"==typeof exports?factory(require("jquery")):factory(jQuery);

//# sourceMappingURL=datepicker.min.js.map