-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.datepick.ext.min.js
7 lines (7 loc) · 6.34 KB
/
jquery.datepick.ext.min.js
1
2
3
4
5
6
7
/*! http://keith-wood.name/datepick.html
Datepicker extensions for jQuery v5.1.1.
Written by Keith Wood (wood.keith{at}optusnet.com.au) August 2009.
Licensed under the MIT (http://keith-wood.name/licence.html) licence.
Please attribute the author if you use it. */
!function(a){"use strict";var b={picker:'<div{popup:start} id="ui-datepicker-div"{popup:end} class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all{inline:start} ui-datepicker-inline{inline:end}"><div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">{link:prev}{link:today}{link:next}</div>{months}{popup:start}<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">{button:clear}{button:close}</div>{popup:end}<div class="ui-helper-clearfix"></div></div>',monthRow:'<div class="ui-datepicker-row-break">{months}</div>',month:'<div class="ui-datepicker-group"><div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">{monthHeader:MM yyyy}</div><table class="ui-datepicker-calendar"><thead>{weekHeader}</thead><tbody>{weeks}</tbody></table></div>',weekHeader:"<tr>{days}</tr>",dayHeader:"<th>{day}</th>",week:"<tr>{days}</tr>",day:"<td>{day}</td>",monthSelector:".ui-datepicker-group",daySelector:"td",rtlClass:"ui-datepicker-rtl",multiClass:"ui-datepicker-multi",defaultClass:"ui-state-default",selectedClass:"ui-state-active",highlightedClass:"ui-state-hover",todayClass:"ui-state-highlight",otherMonthClass:"ui-datepicker-other-month",weekendClass:"ui-datepicker-week-end",commandClass:"ui-datepicker-cmd",commandButtonClass:"ui-state-default ui-corner-all",commandLinkClass:"",disabledClass:"ui-datepicker-disabled"};a.extend(a.datepick,{weekOfYearRenderer:a.extend({},a.datepick.defaultRenderer,{weekHeader:'<tr><th class="datepick-week"><span title="{l10n:weekStatus}">{l10n:weekText}</span></th>{days}</tr>',week:'<tr><td class="datepick-week">{weekOfYear}</td>{days}</tr>'}),themeRollerRenderer:b,themeRollerWeekOfYearRenderer:a.extend({},b,{weekHeader:'<tr><th class="ui-state-hover"><span>{l10n:weekText}</span></th>{days}</tr>',week:'<tr><td class="ui-state-hover">{weekOfYear}</td>{days}</tr>'}),noWeekends:function(a){return{selectable:(a.getDay()||7)<6}},changeFirstDay:function(b,c){var d=a(this);b.find("th span").each(function(){var b=a(this).parent();b.is(".datepick-week")||b.is(".ui-state-hover")||a('<a href="#" class="'+this.className+'" title="Change first day of the week">'+a(this).text()+"</a>").click(function(){var a=parseInt(this.className.replace(/^.*datepick-dow-(\d+).*$/,"$1"),10);return d.datepick("option",{firstDay:a}),!1}).replaceAll(this)})},hoverCallback:function(b){return function(c,d){var e=this,f=d.get("renderer");c.find(f.daySelector+" a, "+f.daySelector+" span").hover(function(){b.apply(e,[a.datepick.retrieveDate(e,this),"a"===this.nodeName.toLowerCase()])},function(){b.apply(e,[])})}},highlightWeek:function(b,c){var d=c.get("renderer");b.find(d.daySelector+" a, "+d.daySelector+" span").hover(function(){a(this).parents("tr").find(d.daySelector+" *").addClass(d.highlightedClass)},function(){a(this).parents("tr").find(d.daySelector+" *").removeClass(d.highlightedClass)})},showStatus:function(c,d){var e=d.get("renderer"),f=e.selectedClass===b.selectedClass,g=d.get("defaultStatus")||" ",h=a('<div class="'+(f?"ui-datepicker-status ui-widget-header ui-helper-clearfix ui-corner-all":"datepick-status")+'">'+g+"</div>").insertAfter(c.find(".datepick-month-row:last,.ui-datepicker-row-break:last"));c.find("*[title]").each(function(){var b=a(this).attr("title");a(this).removeAttr("title").hover(function(){h.text(b||g)},function(){h.text(g)})})},monthNavigation:function(c,d){for(var e=a(this),f=d.get("renderer"),g=f.selectedClass===b.selectedClass,h=d.curMinDate(),i=d.get("maxDate"),j=d.get("monthNames"),k=d.get("monthNamesShort"),l=d.drawDate.getMonth(),m=d.drawDate.getFullYear(),n=!1,o='<div class="'+(g?"ui-datepicker-month-nav":"datepick-month-nav")+'" style="display: none;">',p=0;p<j.length;p++)n=(!h||new Date(m,p+1,0).getTime()>=h.getTime())&&(!i||new Date(m,p,1).getTime()<=i.getTime()),o+="<div>"+(n?'<a href="#" class="dp'+new Date(m,p,1).getTime()+'"':"<span")+' title="'+j[p]+'">'+k[p]+(n?"</a>":"</span>")+"</div>";for(p=-6;p<=6;p++)0!==p&&(n=(!h||new Date(m+p,11,31).getTime()>=h.getTime())&&(!i||new Date(m+p,0,1).getTime()<=i.getTime()),o+="<div>"+(n?'<a href="#" class="dp'+new Date(m+p,l,1).getTime()+'"':"<span")+' title="'+(m+p)+'">'+(m+p)+(n?"</a>":"</span>")+"</div>");o+="</div>",o=a(o).insertAfter(c.find("div.datepick-nav,div.ui-datepicker-header:first")),o.find("a").click(function(){var b=a.datepick.retrieveDate(e[0],this);return o.slideToggle(function(){e.datepick("showMonth",b.getFullYear(),b.getMonth()+1)}),!1}),c.find("div.datepick-month-header,div.ui-datepicker-month-header").click(function(){o.slideToggle()}).css("cursor","pointer")},selectWeek:function(b,c){var d=a(this);b.find("td.datepick-week span,td.ui-state-hover span").each(function(){a('<a href="#" class="'+this.className+'" title="Select the entire week">'+a(this).text()+"</a>").click(function(){for(var b=d.datepick("retrieveDate",this),e=[b],f=1;f<7;f++)e.push(b=a.datepick.add(a.datepick.newDate(b),1,"d"));return c.get("rangeSelect")&&e.splice(1,e.length-2),d.datepick("setDate",e).datepick("hide"),!1}).replaceAll(this)})},selectMonth:function(b,c){var d=a(this);b.find("th.datepick-week span,th.ui-state-hover span").each(function(){a('<a href="#" title="Select the entire month">'+a(this).text()+"</a>").click(function(){for(var b=d.datepick("retrieveDate",a(this).parents("table").find("td:not(.datepick-week):not(.ui-state-hover) *:not(.datepick-other-month):not(.ui-datepicker-other-month)")[0]),e=[b],f=a.datepick.daysInMonth(b),g=1;g<f;g++)e.push(b=a.datepick.add(a.datepick.newDate(b),1,"d"));return c.get("rangeSelect")&&e.splice(1,e.length-2),d.datepick("setDate",e).datepick("hide"),!1}).replaceAll(this)})},monthOnly:function(b,c){var d=a(this);a('<div style="text-align: center;"><button type="button">Select</button></div>').insertAfter(b.find(".datepick-month-row:last,.ui-datepicker-row-break:last")).children().click(function(){var c=b.find(".datepick-month-year:first").val().split("/");d.datepick("setDate",a.datepick.newDate(parseInt(c[1],10),parseInt(c[0],10),1)).datepick("hide")}),b.find(".datepick-month-row table,.ui-datepicker-row-break table").remove()}})}(jQuery);
//# sourceMappingURL=jquery.datepick.ext.min.map