mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 22:58:33 +02:00
This includes an update to the underlying version of uglify which causes all of the JS to be modified. See #34177 Built from https://develop.svn.wordpress.org/trunk@35538 git-svn-id: http://core.svn.wordpress.org/trunk@35502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
366 lines
51 KiB
JavaScript
366 lines
51 KiB
JavaScript
/*!
|
|
* jQuery UI Datepicker 1.11.4
|
|
* http://jqueryui.com
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*
|
|
* http://api.jqueryui.com/datepicker/
|
|
*/
|
|
!function(a){"function"==typeof define&&define.amd?
|
|
// AMD. Register as an anonymous module.
|
|
define(["jquery","./core"],a):
|
|
// Browser globals
|
|
a(jQuery)}(function(a){function b(a){for(var b,c;a.length&&a[0]!==document;){if(b=a.css("position"),("absolute"===b||"relative"===b||"fixed"===b)&&(c=parseInt(a.css("zIndex"),10),!isNaN(c)&&0!==c))return c;a=a.parent()}return 0}/* Date picker manager.
|
|
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
|
|
Settings for (groups of) date pickers are maintained in an instance object,
|
|
allowing multiple different settings on the same page. */
|
|
function c(){this._curInst=null,// The current instance in use
|
|
this._keyEvent=!1,// If the last event was a key event
|
|
this._disabledInputs=[],// List of date picker inputs that have been disabled
|
|
this._datepickerShowing=!1,// True if the popup picker is showing , false if not
|
|
this._inDialog=!1,// True if showing within a "dialog", false if not
|
|
this._mainDivId="ui-datepicker-div",// The ID of the main datepicker division
|
|
this._inlineClass="ui-datepicker-inline",// The name of the inline marker class
|
|
this._appendClass="ui-datepicker-append",// The name of the append marker class
|
|
this._triggerClass="ui-datepicker-trigger",// The name of the trigger marker class
|
|
this._dialogClass="ui-datepicker-dialog",// The name of the dialog marker class
|
|
this._disableClass="ui-datepicker-disabled",// The name of the disabled covering marker class
|
|
this._unselectableClass="ui-datepicker-unselectable",// The name of the unselectable cell marker class
|
|
this._currentClass="ui-datepicker-current-day",// The name of the current day marker class
|
|
this._dayOverClass="ui-datepicker-days-cell-over",// The name of the day hover marker class
|
|
this.regional=[],// Available regional settings, indexed by language code
|
|
this.regional[""]={// Default regional settings
|
|
closeText:"Done",// Display text for close link
|
|
prevText:"Prev",// Display text for previous month link
|
|
nextText:"Next",// Display text for next month link
|
|
currentText:"Today",// Display text for current month link
|
|
monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],// Names of months for drop-down and formatting
|
|
monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],// For formatting
|
|
dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],// For formatting
|
|
dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],// For formatting
|
|
dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],// Column headings for days starting at Sunday
|
|
weekHeader:"Wk",// Column header for week of the year
|
|
dateFormat:"mm/dd/yy",// See format options on parseDate
|
|
firstDay:0,// The first day of the week, Sun = 0, Mon = 1, ...
|
|
isRTL:!1,// True if right-to-left language, false if left-to-right
|
|
showMonthAfterYear:!1,// True if the year select precedes month, false for month then year
|
|
yearSuffix:""},this._defaults={// Global defaults for all the date picker instances
|
|
showOn:"focus",// "focus" for popup on focus,
|
|
// "button" for trigger button, or "both" for either
|
|
showAnim:"fadeIn",// Name of jQuery animation for popup
|
|
showOptions:{},// Options for enhanced animations
|
|
defaultDate:null,// Used when field is blank: actual date,
|
|
// +/-number for offset from today, null for today
|
|
appendText:"",// Display text following the input box, e.g. showing the format
|
|
buttonText:"...",// Text for trigger button
|
|
buttonImage:"",// URL for trigger button image
|
|
buttonImageOnly:!1,// True if the image appears alone, false if it appears on a button
|
|
hideIfNoPrevNext:!1,// True to hide next/previous month links
|
|
// if not applicable, false to just disable them
|
|
navigationAsDateFormat:!1,// True if date formatting applied to prev/today/next links
|
|
gotoCurrent:!1,// True if today link goes back to current selection instead
|
|
changeMonth:!1,// True if month can be selected directly, false if only prev/next
|
|
changeYear:!1,// True if year can be selected directly, false if only prev/next
|
|
yearRange:"c-10:c+10",// Range of years to display in drop-down,
|
|
// either relative to today's year (-nn:+nn), relative to currently displayed year
|
|
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
|
|
showOtherMonths:!1,// True to show dates in other months, false to leave blank
|
|
selectOtherMonths:!1,// True to allow selection of dates in other months, false for unselectable
|
|
showWeek:!1,// True to show week of the year, false to not show it
|
|
calculateWeek:this.iso8601Week,// How to calculate the week of the year,
|
|
// takes a Date and returns the number of the week for it
|
|
shortYearCutoff:"+10",// Short year values < this are in the current century,
|
|
// > this are in the previous century,
|
|
// string value starting with "+" for current year + value
|
|
minDate:null,// The earliest selectable date, or null for no limit
|
|
maxDate:null,// The latest selectable date, or null for no limit
|
|
duration:"fast",// Duration of display/closure
|
|
beforeShowDay:null,// Function that takes a date and returns an array with
|
|
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
|
|
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
|
|
beforeShow:null,// Function that takes an input field and
|
|
// returns a set of custom settings for the date picker
|
|
onSelect:null,// Define a callback function when a date is selected
|
|
onChangeMonthYear:null,// Define a callback function when the month or year is changed
|
|
onClose:null,// Define a callback function when the datepicker is closed
|
|
numberOfMonths:1,// Number of months to show at a time
|
|
showCurrentAtPos:0,// The position in multipe months at which to show the current month (starting at 0)
|
|
stepMonths:1,// Number of months to step back/forward
|
|
stepBigMonths:12,// Number of months to step back/forward for the big links
|
|
altField:"",// Selector for an alternate field to store selected dates into
|
|
altFormat:"",// The date format to use for the alternate field
|
|
constrainInput:!0,// The input is constrained by the current date format
|
|
showButtonPanel:!1,// True to show button panel, false to not show it
|
|
autoSize:!1,// True to size the input for the date format, false to leave as is
|
|
disabled:!1},a.extend(this._defaults,this.regional[""]),this.regional.en=a.extend(!0,{},this.regional[""]),this.regional["en-US"]=a.extend(!0,{},this.regional.en),this.dpDiv=d(a("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}/*
|
|
* Bind hover events for datepicker elements.
|
|
* Done via delegate so the binding only occurs once in the lifetime of the parent div.
|
|
* Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
|
|
*/
|
|
function d(b){var c="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return b.delegate(c,"mouseout",function(){a(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&a(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&a(this).removeClass("ui-datepicker-next-hover")}).delegate(c,"mouseover",e)}function e(){a.datepicker._isDisabledDatepicker(g.inline?g.dpDiv.parent()[0]:g.input[0])||(a(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),a(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&a(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&a(this).addClass("ui-datepicker-next-hover"))}/* jQuery extend now ignores nulls! */
|
|
function f(b,c){a.extend(b,c);for(var d in c)null==c[d]&&(b[d]=c[d]);return b}a.extend(a.ui,{datepicker:{version:"1.11.4"}});var g;/* Invoke the datepicker functionality.
|
|
@param options string - a command, optionally followed by additional parameters or
|
|
Object - settings for attaching new datepicker functionality
|
|
@return jQuery object */
|
|
// singleton instance
|
|
return a.extend(c.prototype,{/* Class name added to elements to indicate already configured with a date picker. */
|
|
markerClassName:"hasDatepicker",
|
|
//Keep track of the maximum number of rows displayed (see #7043)
|
|
maxRows:4,
|
|
// TODO rename to "widget" when switching to widget factory
|
|
_widgetDatepicker:function(){return this.dpDiv},/* Override the default settings for all instances of the date picker.
|
|
* @param settings object - the new settings to use as defaults (anonymous object)
|
|
* @return the manager object
|
|
*/
|
|
setDefaults:function(a){return f(this._defaults,a||{}),this},/* Attach the date picker to a jQuery selection.
|
|
* @param target element - the target input field or division or span
|
|
* @param settings object - the new settings to use for this date picker instance (anonymous)
|
|
*/
|
|
_attachDatepicker:function(b,c){var d,e,f;d=b.nodeName.toLowerCase(),e="div"===d||"span"===d,b.id||(this.uuid+=1,b.id="dp"+this.uuid),f=this._newInst(a(b),e),f.settings=a.extend({},c||{}),"input"===d?this._connectDatepicker(b,f):e&&this._inlineDatepicker(b,f)},/* Create a new instance object. */
|
|
_newInst:function(b,c){var e=b[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");// escape jQuery meta chars
|
|
return{id:e,input:b,// associated target
|
|
selectedDay:0,selectedMonth:0,selectedYear:0,// current selection
|
|
drawMonth:0,drawYear:0,// month being drawn
|
|
inline:c,// is datepicker inline or not
|
|
dpDiv:c?// presentation div
|
|
d(a("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},/* Attach the date picker to an input field. */
|
|
_connectDatepicker:function(b,c){var d=a(b);c.append=a([]),c.trigger=a([]),d.hasClass(this.markerClassName)||(this._attachments(d,c),d.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(c),a.data(b,"datepicker",c),
|
|
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
|
|
c.settings.disabled&&this._disableDatepicker(b))},/* Make attachments based on settings. */
|
|
_attachments:function(b,c){var d,e,f,g=this._get(c,"appendText"),h=this._get(c,"isRTL");c.append&&c.append.remove(),g&&(c.append=a("<span class='"+this._appendClass+"'>"+g+"</span>"),b[h?"before":"after"](c.append)),b.unbind("focus",this._showDatepicker),c.trigger&&c.trigger.remove(),d=this._get(c,"showOn"),("focus"===d||"both"===d)&&b.focus(this._showDatepicker),("button"===d||"both"===d)&&(e=this._get(c,"buttonText"),f=this._get(c,"buttonImage"),c.trigger=a(this._get(c,"buttonImageOnly")?a("<img/>").addClass(this._triggerClass).attr({src:f,alt:e,title:e}):a("<button type='button'></button>").addClass(this._triggerClass).html(f?a("<img/>").attr({src:f,alt:e,title:e}):e)),b[h?"before":"after"](c.trigger),c.trigger.click(function(){return a.datepicker._datepickerShowing&&a.datepicker._lastInput===b[0]?a.datepicker._hideDatepicker():a.datepicker._datepickerShowing&&a.datepicker._lastInput!==b[0]?(a.datepicker._hideDatepicker(),a.datepicker._showDatepicker(b[0])):a.datepicker._showDatepicker(b[0]),!1}))},/* Apply the maximum length for the date format. */
|
|
_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b,c,d,e,f=new Date(2009,11,20),// Ensure double digits
|
|
g=this._get(a,"dateFormat");g.match(/[DM]/)&&(b=function(a){for(c=0,d=0,e=0;e<a.length;e++)a[e].length>c&&(c=a[e].length,d=e);return d},f.setMonth(b(this._get(a,g.match(/MM/)?"monthNames":"monthNamesShort"))),f.setDate(b(this._get(a,g.match(/DD/)?"dayNames":"dayNamesShort"))+20-f.getDay())),a.input.attr("size",this._formatDate(a,f).length)}},/* Attach an inline date picker to a div. */
|
|
_inlineDatepicker:function(b,c){var d=a(b);d.hasClass(this.markerClassName)||(d.addClass(this.markerClassName).append(c.dpDiv),a.data(b,"datepicker",c),this._setDate(c,this._getDefaultDate(c),!0),this._updateDatepicker(c),this._updateAlternate(c),
|
|
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
|
|
c.settings.disabled&&this._disableDatepicker(b),
|
|
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
|
|
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
|
|
c.dpDiv.css("display","block"))},/* Pop-up the date picker in a "dialog" box.
|
|
* @param input element - ignored
|
|
* @param date string or Date - the initial date to display
|
|
* @param onSelect function - the function to call when a date is selected
|
|
* @param settings object - update the dialog date picker instance's settings (anonymous object)
|
|
* @param pos int[2] - coordinates for the dialog's position within the screen or
|
|
* event - with x/y coordinates or
|
|
* leave empty for default (screen centre)
|
|
* @return the manager object
|
|
*/
|
|
_dialogDatepicker:function(b,c,d,e,g){var h,i,j,k,l,m=this._dialogInst;// internal instance
|
|
// should use actual width/height below
|
|
// move input on screen for focus, but hidden behind dialog
|
|
return m||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=a("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),a("body").append(this._dialogInput),m=this._dialogInst=this._newInst(this._dialogInput,!1),m.settings={},a.data(this._dialogInput[0],"datepicker",m)),f(m.settings,e||{}),c=c&&c.constructor===Date?this._formatDate(m,c):c,this._dialogInput.val(c),this._pos=g?g.length?g:[g.pageX,g.pageY]:null,this._pos||(i=document.documentElement.clientWidth,j=document.documentElement.clientHeight,k=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[i/2-100+k,j/2-150+l]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),m.settings.onSelect=d,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),a.blockUI&&a.blockUI(this.dpDiv),a.data(this._dialogInput[0],"datepicker",m),this},/* Detach a datepicker from its control.
|
|
* @param target element - the target input field or division or span
|
|
*/
|
|
_destroyDatepicker:function(b){var c,d=a(b),e=a.data(b,"datepicker");d.hasClass(this.markerClassName)&&(c=b.nodeName.toLowerCase(),a.removeData(b,"datepicker"),"input"===c?(e.append.remove(),e.trigger.remove(),d.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===c||"span"===c)&&d.removeClass(this.markerClassName).empty(),g===e&&(g=null))},/* Enable the date picker to a jQuery selection.
|
|
* @param target element - the target input field or division or span
|
|
*/
|
|
_enableDatepicker:function(b){var c,d,e=a(b),f=a.data(b,"datepicker");e.hasClass(this.markerClassName)&&(c=b.nodeName.toLowerCase(),"input"===c?(b.disabled=!1,f.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===c||"span"===c)&&(d=e.children("."+this._inlineClass),d.children().removeClass("ui-state-disabled"),d.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=a.map(this._disabledInputs,function(a){return a===b?null:a}))},/* Disable the date picker to a jQuery selection.
|
|
* @param target element - the target input field or division or span
|
|
*/
|
|
_disableDatepicker:function(b){var c,d,e=a(b),f=a.data(b,"datepicker");e.hasClass(this.markerClassName)&&(c=b.nodeName.toLowerCase(),"input"===c?(b.disabled=!0,f.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===c||"span"===c)&&(d=e.children("."+this._inlineClass),d.children().addClass("ui-state-disabled"),d.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=a.map(this._disabledInputs,function(a){return a===b?null:a}),this._disabledInputs[this._disabledInputs.length]=b)},/* Is the first field in a jQuery collection disabled as a datepicker?
|
|
* @param target element - the target input field or division or span
|
|
* @return boolean - true if disabled, false if enabled
|
|
*/
|
|
_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]===a)return!0;return!1},/* Retrieve the instance data for the target control.
|
|
* @param target element - the target input field or division or span
|
|
* @return object - the associated instance data
|
|
* @throws error if a jQuery problem getting data
|
|
*/
|
|
_getInst:function(b){try{return a.data(b,"datepicker")}catch(c){throw"Missing instance data for this datepicker"}},/* Update or retrieve the settings for a date picker attached to an input field or division.
|
|
* @param target element - the target input field or division or span
|
|
* @param name object - the new settings to update or
|
|
* string - the name of the setting to change or retrieve,
|
|
* when retrieving also "all" for all instance settings or
|
|
* "defaults" for all global defaults
|
|
* @param value any - the new value for the setting
|
|
* (omit if above is an object or to retrieve a value)
|
|
*/
|
|
_optionDatepicker:function(b,c,d){var e,g,h,i,j=this._getInst(b);
|
|
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
|
|
return 2===arguments.length&&"string"==typeof c?"defaults"===c?a.extend({},a.datepicker._defaults):j?"all"===c?a.extend({},j.settings):this._get(j,c):null:(e=c||{},"string"==typeof c&&(e={},e[c]=d),void(j&&(this._curInst===j&&this._hideDatepicker(),g=this._getDateDatepicker(b,!0),h=this._getMinMaxDate(j,"min"),i=this._getMinMaxDate(j,"max"),f(j.settings,e),null!==h&&void 0!==e.dateFormat&&void 0===e.minDate&&(j.settings.minDate=this._formatDate(j,h)),null!==i&&void 0!==e.dateFormat&&void 0===e.maxDate&&(j.settings.maxDate=this._formatDate(j,i)),"disabled"in e&&(e.disabled?this._disableDatepicker(b):this._enableDatepicker(b)),this._attachments(a(b),j),this._autoSize(j),this._setDate(j,g),this._updateAlternate(j),this._updateDatepicker(j))))},
|
|
// change method deprecated
|
|
_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},/* Redraw the date picker attached to an input field or division.
|
|
* @param target element - the target input field or division or span
|
|
*/
|
|
_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},/* Set the dates for a jQuery selection.
|
|
* @param target element - the target input field or division or span
|
|
* @param date Date - the new date
|
|
*/
|
|
_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},/* Get the date(s) for the first entry in a jQuery selection.
|
|
* @param target element - the target input field or division or span
|
|
* @param noDefault boolean - true if no default date is to be used
|
|
* @return Date - the current date
|
|
*/
|
|
_getDateDatepicker:function(a,b){var c=this._getInst(a);return c&&!c.inline&&this._setDateFromField(c,b),c?this._getDate(c):null},/* Handle keystrokes. */
|
|
_doKeyDown:function(b){var c,d,e,f=a.datepicker._getInst(b.target),g=!0,h=f.dpDiv.is(".ui-datepicker-rtl");if(f._keyEvent=!0,a.datepicker._datepickerShowing)switch(b.keyCode){case 9:a.datepicker._hideDatepicker(),g=!1;break;// hide on tab out
|
|
case 13:
|
|
// trigger custom callback
|
|
return e=a("td."+a.datepicker._dayOverClass+":not(."+a.datepicker._currentClass+")",f.dpDiv),e[0]&&a.datepicker._selectDay(b.target,f.selectedMonth,f.selectedYear,e[0]),c=a.datepicker._get(f,"onSelect"),c?(d=a.datepicker._formatDate(f),c.apply(f.input?f.input[0]:null,[d,f])):a.datepicker._hideDatepicker(),!1;// don't submit the form
|
|
case 27:a.datepicker._hideDatepicker();break;// hide on escape
|
|
case 33:a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(f,"stepBigMonths"):-a.datepicker._get(f,"stepMonths"),"M");break;// previous month/year on page up/+ ctrl
|
|
case 34:a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(f,"stepBigMonths"):+a.datepicker._get(f,"stepMonths"),"M");break;// next month/year on page down/+ ctrl
|
|
case 35:(b.ctrlKey||b.metaKey)&&a.datepicker._clearDate(b.target),g=b.ctrlKey||b.metaKey;break;// clear on ctrl or command +end
|
|
case 36:(b.ctrlKey||b.metaKey)&&a.datepicker._gotoToday(b.target),g=b.ctrlKey||b.metaKey;break;// current on ctrl or command +home
|
|
case 37:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,h?1:-1,"D"),g=b.ctrlKey||b.metaKey,
|
|
// -1 day on ctrl or command +left
|
|
b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?-a.datepicker._get(f,"stepBigMonths"):-a.datepicker._get(f,"stepMonths"),"M");
|
|
// next month/year on alt +left on Mac
|
|
break;case 38:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,-7,"D"),g=b.ctrlKey||b.metaKey;break;// -1 week on ctrl or command +up
|
|
case 39:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,h?-1:1,"D"),g=b.ctrlKey||b.metaKey,
|
|
// +1 day on ctrl or command +right
|
|
b.originalEvent.altKey&&a.datepicker._adjustDate(b.target,b.ctrlKey?+a.datepicker._get(f,"stepBigMonths"):+a.datepicker._get(f,"stepMonths"),"M");
|
|
// next month/year on alt +right
|
|
break;case 40:(b.ctrlKey||b.metaKey)&&a.datepicker._adjustDate(b.target,7,"D"),g=b.ctrlKey||b.metaKey;break;// +1 week on ctrl or command +down
|
|
default:g=!1}else 36===b.keyCode&&b.ctrlKey?// display the date picker on ctrl+home
|
|
a.datepicker._showDatepicker(this):g=!1;g&&(b.preventDefault(),b.stopPropagation())},/* Filter entered characters - based on date format. */
|
|
_doKeyPress:function(b){var c,d,e=a.datepicker._getInst(b.target);return a.datepicker._get(e,"constrainInput")?(c=a.datepicker._possibleChars(a.datepicker._get(e,"dateFormat")),d=String.fromCharCode(null==b.charCode?b.keyCode:b.charCode),b.ctrlKey||b.metaKey||" ">d||!c||c.indexOf(d)>-1):void 0},/* Synchronise manual entry and field/alternate field. */
|
|
_doKeyUp:function(b){var c,d=a.datepicker._getInst(b.target);if(d.input.val()!==d.lastVal)try{c=a.datepicker.parseDate(a.datepicker._get(d,"dateFormat"),d.input?d.input.val():null,a.datepicker._getFormatConfig(d)),c&&(// only if valid
|
|
a.datepicker._setDateFromField(d),a.datepicker._updateAlternate(d),a.datepicker._updateDatepicker(d))}catch(e){}return!0},/* Pop-up the date picker for a given input field.
|
|
* If false returned from beforeShow event handler do not show.
|
|
* @param input element - the input field attached to the date picker or
|
|
* event - if triggered by focus
|
|
*/
|
|
_showDatepicker:function(c){if(c=c.target||c,"input"!==c.nodeName.toLowerCase()&&(c=a("input",c.parentNode)[0]),!a.datepicker._isDisabledDatepicker(c)&&a.datepicker._lastInput!==c){var d,e,g,h,i,j,k;d=a.datepicker._getInst(c),a.datepicker._curInst&&a.datepicker._curInst!==d&&(a.datepicker._curInst.dpDiv.stop(!0,!0),d&&a.datepicker._datepickerShowing&&a.datepicker._hideDatepicker(a.datepicker._curInst.input[0])),e=a.datepicker._get(d,"beforeShow"),g=e?e.apply(c,[c,d]):{},g!==!1&&(f(d.settings,g),d.lastVal=null,a.datepicker._lastInput=c,a.datepicker._setDateFromField(d),a.datepicker._inDialog&&(// hide cursor
|
|
c.value=""),a.datepicker._pos||(// position below input
|
|
a.datepicker._pos=a.datepicker._findPos(c),a.datepicker._pos[1]+=c.offsetHeight),h=!1,a(c).parents().each(function(){return h|="fixed"===a(this).css("position"),!h}),i={left:a.datepicker._pos[0],top:a.datepicker._pos[1]},a.datepicker._pos=null,d.dpDiv.empty(),d.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),a.datepicker._updateDatepicker(d),i=a.datepicker._checkOffset(d,i,h),d.dpDiv.css({position:a.datepicker._inDialog&&a.blockUI?"static":h?"fixed":"absolute",display:"none",left:i.left+"px",top:i.top+"px"}),d.inline||(j=a.datepicker._get(d,"showAnim"),k=a.datepicker._get(d,"duration"),d.dpDiv.css("z-index",b(a(c))+1),a.datepicker._datepickerShowing=!0,a.effects&&a.effects.effect[j]?d.dpDiv.show(j,a.datepicker._get(d,"showOptions"),k):d.dpDiv[j||"show"](j?k:null),a.datepicker._shouldFocusInput(d)&&d.input.focus(),a.datepicker._curInst=d))}},/* Generate the date picker content. */
|
|
_updateDatepicker:function(b){this.maxRows=4,g=b,b.dpDiv.empty().append(this._generateHTML(b)),this._attachHandlers(b);var c,d=this._getNumberOfMonths(b),f=d[1],h=17,i=b.dpDiv.find("."+this._dayOverClass+" a");i.length>0&&e.apply(i.get(0)),b.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&b.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",h*f+"em"),b.dpDiv[(1!==d[0]||1!==d[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),b.dpDiv[(this._get(b,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),b===a.datepicker._curInst&&a.datepicker._datepickerShowing&&a.datepicker._shouldFocusInput(b)&&b.input.focus(),
|
|
// deffered render of the years select (to avoid flashes on Firefox)
|
|
b.yearshtml&&(c=b.yearshtml,setTimeout(function(){c===b.yearshtml&&b.yearshtml&&b.dpDiv.find("select.ui-datepicker-year:first").replaceWith(b.yearshtml),c=b.yearshtml=null},0))},
|
|
// #6694 - don't focus the input if it's already focused
|
|
// this breaks the change event in IE
|
|
// Support: IE and jQuery <1.9
|
|
_shouldFocusInput:function(a){return a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&!a.input.is(":focus")},/* Check positioning to remain on screen. */
|
|
_checkOffset:function(b,c,d){var e=b.dpDiv.outerWidth(),f=b.dpDiv.outerHeight(),g=b.input?b.input.outerWidth():0,h=b.input?b.input.outerHeight():0,i=document.documentElement.clientWidth+(d?0:a(document).scrollLeft()),j=document.documentElement.clientHeight+(d?0:a(document).scrollTop());
|
|
// now check if datepicker is showing outside window viewport - move to a better place if so.
|
|
return c.left-=this._get(b,"isRTL")?e-g:0,c.left-=d&&c.left===b.input.offset().left?a(document).scrollLeft():0,c.top-=d&&c.top===b.input.offset().top+h?a(document).scrollTop():0,c.left-=Math.min(c.left,c.left+e>i&&i>e?Math.abs(c.left+e-i):0),c.top-=Math.min(c.top,c.top+f>j&&j>f?Math.abs(f+h):0),c},/* Find an object's position on the screen. */
|
|
_findPos:function(b){for(var c,d=this._getInst(b),e=this._get(d,"isRTL");b&&("hidden"===b.type||1!==b.nodeType||a.expr.filters.hidden(b));)b=b[e?"previousSibling":"nextSibling"];return c=a(b).offset(),[c.left,c.top]},/* Hide the date picker from view.
|
|
* @param input element - the input field attached to the date picker
|
|
*/
|
|
_hideDatepicker:function(b){var c,d,e,f,g=this._curInst;!g||b&&g!==a.data(b,"datepicker")||this._datepickerShowing&&(c=this._get(g,"showAnim"),d=this._get(g,"duration"),e=function(){a.datepicker._tidyDialog(g)},a.effects&&(a.effects.effect[c]||a.effects[c])?g.dpDiv.hide(c,a.datepicker._get(g,"showOptions"),d,e):g.dpDiv["slideDown"===c?"slideUp":"fadeIn"===c?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1,f=this._get(g,"onClose"),f&&f.apply(g.input?g.input[0]:null,[g.input?g.input.val():"",g]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),a.blockUI&&(a.unblockUI(),a("body").append(this.dpDiv))),this._inDialog=!1)},/* Tidy up after a dialog display. */
|
|
_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},/* Close date picker if clicked elsewhere. */
|
|
_checkExternalClick:function(b){if(a.datepicker._curInst){var c=a(b.target),d=a.datepicker._getInst(c[0]);(c[0].id!==a.datepicker._mainDivId&&0===c.parents("#"+a.datepicker._mainDivId).length&&!c.hasClass(a.datepicker.markerClassName)&&!c.closest("."+a.datepicker._triggerClass).length&&a.datepicker._datepickerShowing&&(!a.datepicker._inDialog||!a.blockUI)||c.hasClass(a.datepicker.markerClassName)&&a.datepicker._curInst!==d)&&a.datepicker._hideDatepicker()}},/* Adjust one of the date sub-fields. */
|
|
_adjustDate:function(b,c,d){var e=a(b),f=this._getInst(e[0]);this._isDisabledDatepicker(e[0])||(this._adjustInstDate(f,c+("M"===d?this._get(f,"showCurrentAtPos"):0),// undo positioning
|
|
d),this._updateDatepicker(f))},/* Action for current link. */
|
|
_gotoToday:function(b){var c,d=a(b),e=this._getInst(d[0]);this._get(e,"gotoCurrent")&&e.currentDay?(e.selectedDay=e.currentDay,e.drawMonth=e.selectedMonth=e.currentMonth,e.drawYear=e.selectedYear=e.currentYear):(c=new Date,e.selectedDay=c.getDate(),e.drawMonth=e.selectedMonth=c.getMonth(),e.drawYear=e.selectedYear=c.getFullYear()),this._notifyChange(e),this._adjustDate(d)},/* Action for selecting a new month/year. */
|
|
_selectMonthYear:function(b,c,d){var e=a(b),f=this._getInst(e[0]);f["selected"+("M"===d?"Month":"Year")]=f["draw"+("M"===d?"Month":"Year")]=parseInt(c.options[c.selectedIndex].value,10),this._notifyChange(f),this._adjustDate(e)},/* Action for selecting a day. */
|
|
_selectDay:function(b,c,d,e){var f,g=a(b);a(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(g[0])||(f=this._getInst(g[0]),f.selectedDay=f.currentDay=a("a",e).html(),f.selectedMonth=f.currentMonth=c,f.selectedYear=f.currentYear=d,this._selectDate(b,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear)))},/* Erase the input field and hide the date picker. */
|
|
_clearDate:function(b){var c=a(b);this._selectDate(c,"")},/* Update the input field with the selected date. */
|
|
_selectDate:function(b,c){var d,e=a(b),f=this._getInst(e[0]);c=null!=c?c:this._formatDate(f),f.input&&f.input.val(c),this._updateAlternate(f),d=this._get(f,"onSelect"),d?d.apply(f.input?f.input[0]:null,[c,f]):f.input&&f.input.trigger("change"),f.inline?this._updateDatepicker(f):(this._hideDatepicker(),this._lastInput=f.input[0],"object"!=typeof f.input[0]&&f.input.focus(),this._lastInput=null)},/* Update any alternate field to synchronise with the main field. */
|
|
_updateAlternate:function(b){var c,d,e,f=this._get(b,"altField");f&&(c=this._get(b,"altFormat")||this._get(b,"dateFormat"),d=this._getDate(b),e=this.formatDate(c,d,this._getFormatConfig(b)),a(f).each(function(){a(this).val(e)}))},/* Set as beforeShowDay function to prevent selection of weekends.
|
|
* @param date Date - the date to customise
|
|
* @return [boolean, string] - is this date selectable?, what is its CSS class?
|
|
*/
|
|
noWeekends:function(a){var b=a.getDay();return[b>0&&6>b,""]},/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
|
|
* @param date Date - the date to get the week for
|
|
* @return number - the number of the week within the year that contains this date
|
|
*/
|
|
iso8601Week:function(a){var b,c=new Date(a.getTime());
|
|
// Find Thursday of this week starting on Monday
|
|
// Compare with Jan 1
|
|
return c.setDate(c.getDate()+4-(c.getDay()||7)),b=c.getTime(),c.setMonth(0),c.setDate(1),Math.floor(Math.round((b-c)/864e5)/7)+1},/* Parse a string value into a date object.
|
|
* See formatDate below for the possible formats.
|
|
*
|
|
* @param format string - the expected format of the date
|
|
* @param value string - the date in the above format
|
|
* @param settings Object - attributes include:
|
|
* shortYearCutoff number - the cutoff year for determining the century (optional)
|
|
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
|
* dayNames string[7] - names of the days from Sunday (optional)
|
|
* monthNamesShort string[12] - abbreviated names of the months (optional)
|
|
* monthNames string[12] - names of the months (optional)
|
|
* @return Date - the extracted date value or null if value is blank
|
|
*/
|
|
parseDate:function(b,c,d){if(null==b||null==c)throw"Invalid arguments";if(c="object"==typeof c?c.toString():c+"",""===c)return null;var e,f,g,h,i=0,j=(d?d.shortYearCutoff:null)||this._defaults.shortYearCutoff,k="string"!=typeof j?j:(new Date).getFullYear()%100+parseInt(j,10),l=(d?d.dayNamesShort:null)||this._defaults.dayNamesShort,m=(d?d.dayNames:null)||this._defaults.dayNames,n=(d?d.monthNamesShort:null)||this._defaults.monthNamesShort,o=(d?d.monthNames:null)||this._defaults.monthNames,p=-1,q=-1,r=-1,s=-1,t=!1,
|
|
// Check whether a format character is doubled
|
|
u=function(a){var c=e+1<b.length&&b.charAt(e+1)===a;return c&&e++,c},
|
|
// Extract a number from the string value
|
|
v=function(a){var b=u(a),d="@"===a?14:"!"===a?20:"y"===a&&b?4:"o"===a?3:2,e="y"===a?d:1,f=new RegExp("^\\d{"+e+","+d+"}"),g=c.substring(i).match(f);if(!g)throw"Missing number at position "+i;return i+=g[0].length,parseInt(g[0],10)},
|
|
// Extract a name from the string value and convert to an index
|
|
w=function(b,d,e){var f=-1,g=a.map(u(b)?e:d,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)});if(a.each(g,function(a,b){var d=b[1];return c.substr(i,d.length).toLowerCase()===d.toLowerCase()?(f=b[0],i+=d.length,!1):void 0}),-1!==f)return f+1;throw"Unknown name at position "+i},
|
|
// Confirm that a literal character matches the string value
|
|
x=function(){if(c.charAt(i)!==b.charAt(e))throw"Unexpected literal at position "+i;i++};for(e=0;e<b.length;e++)if(t)"'"!==b.charAt(e)||u("'")?x():t=!1;else switch(b.charAt(e)){case"d":r=v("d");break;case"D":w("D",l,m);break;case"o":s=v("o");break;case"m":q=v("m");break;case"M":q=w("M",n,o);break;case"y":p=v("y");break;case"@":h=new Date(v("@")),p=h.getFullYear(),q=h.getMonth()+1,r=h.getDate();break;case"!":h=new Date((v("!")-this._ticksTo1970)/1e4),p=h.getFullYear(),q=h.getMonth()+1,r=h.getDate();break;case"'":u("'")?x():t=!0;break;default:x()}if(i<c.length&&(g=c.substr(i),!/^\s+/.test(g)))throw"Extra/unparsed characters found in date: "+g;if(-1===p?p=(new Date).getFullYear():100>p&&(p+=(new Date).getFullYear()-(new Date).getFullYear()%100+(k>=p?0:-100)),s>-1)for(q=1,r=s;;){if(f=this._getDaysInMonth(p,q-1),f>=r)break;q++,r-=f}if(h=this._daylightSavingAdjust(new Date(p,q-1,r)),h.getFullYear()!==p||h.getMonth()+1!==q||h.getDate()!==r)throw"Invalid date";return h},/* Standard date formats. */
|
|
ATOM:"yy-mm-dd",// RFC 3339 (ISO 8601)
|
|
COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",// RFC 822
|
|
TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",// ISO 8601
|
|
_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,/* Format a date object into a string value.
|
|
* The format can be combinations of the following:
|
|
* d - day of month (no leading zero)
|
|
* dd - day of month (two digit)
|
|
* o - day of year (no leading zeros)
|
|
* oo - day of year (three digit)
|
|
* D - day name short
|
|
* DD - day name long
|
|
* m - month of year (no leading zero)
|
|
* mm - month of year (two digit)
|
|
* M - month name short
|
|
* MM - month name long
|
|
* y - year (two digit)
|
|
* yy - year (four digit)
|
|
* @ - Unix timestamp (ms since 01/01/1970)
|
|
* ! - Windows ticks (100ns since 01/01/0001)
|
|
* "..." - literal text
|
|
* '' - single quote
|
|
*
|
|
* @param format string - the desired format of the date
|
|
* @param date Date - the date value to format
|
|
* @param settings Object - attributes include:
|
|
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
|
* dayNames string[7] - names of the days from Sunday (optional)
|
|
* monthNamesShort string[12] - abbreviated names of the months (optional)
|
|
* monthNames string[12] - names of the months (optional)
|
|
* @return string - the date in the above format
|
|
*/
|
|
formatDate:function(a,b,c){if(!b)return"";var d,e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,
|
|
// Check whether a format character is doubled
|
|
i=function(b){var c=d+1<a.length&&a.charAt(d+1)===b;return c&&d++,c},
|
|
// Format a number, with leading zero if necessary
|
|
j=function(a,b,c){var d=""+b;if(i(a))for(;d.length<c;)d="0"+d;return d},
|
|
// Format a name, short or long as requested
|
|
k=function(a,b,c,d){return i(a)?d[b]:c[b]},l="",m=!1;if(b)for(d=0;d<a.length;d++)if(m)"'"!==a.charAt(d)||i("'")?l+=a.charAt(d):m=!1;else switch(a.charAt(d)){case"d":l+=j("d",b.getDate(),2);break;case"D":l+=k("D",b.getDay(),e,f);break;case"o":l+=j("o",Math.round((new Date(b.getFullYear(),b.getMonth(),b.getDate()).getTime()-new Date(b.getFullYear(),0,0).getTime())/864e5),3);break;case"m":l+=j("m",b.getMonth()+1,2);break;case"M":l+=k("M",b.getMonth(),g,h);break;case"y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":l+=b.getTime();break;case"!":l+=1e4*b.getTime()+this._ticksTo1970;break;case"'":i("'")?l+="'":m=!0;break;default:l+=a.charAt(d)}return l},/* Extract all possible characters from the date format. */
|
|
_possibleChars:function(a){var b,c="",d=!1,
|
|
// Check whether a format character is doubled
|
|
e=function(c){var d=b+1<a.length&&a.charAt(b+1)===c;return d&&b++,d};for(b=0;b<a.length;b++)if(d)"'"!==a.charAt(b)||e("'")?c+=a.charAt(b):d=!1;else switch(a.charAt(b)){case"d":case"m":case"y":case"@":c+="0123456789";break;case"D":case"M":return null;// Accept anything
|
|
case"'":e("'")?c+="'":d=!0;break;default:c+=a.charAt(b)}return c},/* Get a setting value, defaulting if necessary. */
|
|
_get:function(a,b){return void 0!==a.settings[b]?a.settings[b]:this._defaults[b]},/* Parse existing date and initialise date picker. */
|
|
_setDateFromField:function(a,b){if(a.input.val()!==a.lastVal){var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e=this._getDefaultDate(a),f=e,g=this._getFormatConfig(a);try{f=this.parseDate(c,d,g)||e}catch(h){d=b?"":d}a.selectedDay=f.getDate(),a.drawMonth=a.selectedMonth=f.getMonth(),a.drawYear=a.selectedYear=f.getFullYear(),a.currentDay=d?f.getDate():0,a.currentMonth=d?f.getMonth():0,a.currentYear=d?f.getFullYear():0,this._adjustInstDate(a)}},/* Retrieve the default date shown on opening. */
|
|
_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},/* A date may be specified as an exact value or a relative one. */
|
|
_determineDate:function(b,c,d){var e=function(a){var b=new Date;return b.setDate(b.getDate()+a),b},f=function(c){try{return a.datepicker.parseDate(a.datepicker._get(b,"dateFormat"),c,a.datepicker._getFormatConfig(b))}catch(d){}for(var e=(c.toLowerCase().match(/^c/)?a.datepicker._getDate(b):null)||new Date,f=e.getFullYear(),g=e.getMonth(),h=e.getDate(),i=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,j=i.exec(c);j;){switch(j[2]||"d"){case"d":case"D":h+=parseInt(j[1],10);break;case"w":case"W":h+=7*parseInt(j[1],10);break;case"m":case"M":g+=parseInt(j[1],10),h=Math.min(h,a.datepicker._getDaysInMonth(f,g));break;case"y":case"Y":f+=parseInt(j[1],10),h=Math.min(h,a.datepicker._getDaysInMonth(f,g))}j=i.exec(c)}return new Date(f,g,h)},g=null==c||""===c?d:"string"==typeof c?f(c):"number"==typeof c?isNaN(c)?d:e(c):new Date(c.getTime());return g=g&&"Invalid Date"===g.toString()?d:g,g&&(g.setHours(0),g.setMinutes(0),g.setSeconds(0),g.setMilliseconds(0)),this._daylightSavingAdjust(g)},/* Handle switch to/from daylight saving.
|
|
* Hours may be non-zero on daylight saving cut-over:
|
|
* > 12 when midnight changeover, but then cannot generate
|
|
* midnight datetime, so jump to 1AM, otherwise reset.
|
|
* @param date (Date) the date to check
|
|
* @return (Date) the corrected date
|
|
*/
|
|
_daylightSavingAdjust:function(a){return a?(a.setHours(a.getHours()>12?a.getHours()+2:0),a):null},/* Set the date(s) directly. */
|
|
_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),e===a.selectedMonth&&f===a.selectedYear||c||this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},/* Retrieve the date(s) directly. */
|
|
_getDate:function(a){var b=!a.currentYear||a.input&&""===a.input.val()?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},/* Attach the onxxx handlers. These are declared statically so
|
|
* they work with static code transformers like Caja.
|
|
*/
|
|
_attachHandlers:function(b){var c=this._get(b,"stepMonths"),d="#"+b.id.replace(/\\\\/g,"\\");b.dpDiv.find("[data-handler]").map(function(){var b={prev:function(){a.datepicker._adjustDate(d,-c,"M")},next:function(){a.datepicker._adjustDate(d,+c,"M")},hide:function(){a.datepicker._hideDatepicker()},today:function(){a.datepicker._gotoToday(d)},selectDay:function(){return a.datepicker._selectDay(d,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return a.datepicker._selectMonthYear(d,this,"M"),!1},selectYear:function(){return a.datepicker._selectMonthYear(d,this,"Y"),!1}};a(this).bind(this.getAttribute("data-event"),b[this.getAttribute("data-handler")])})},/* Generate the HTML for the current state of the date picker. */
|
|
_generateHTML:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O=new Date,P=this._daylightSavingAdjust(new Date(O.getFullYear(),O.getMonth(),O.getDate())),// clear time
|
|
Q=this._get(a,"isRTL"),R=this._get(a,"showButtonPanel"),S=this._get(a,"hideIfNoPrevNext"),T=this._get(a,"navigationAsDateFormat"),U=this._getNumberOfMonths(a),V=this._get(a,"showCurrentAtPos"),W=this._get(a,"stepMonths"),X=1!==U[0]||1!==U[1],Y=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),Z=this._getMinMaxDate(a,"min"),$=this._getMinMaxDate(a,"max"),_=a.drawMonth-V,aa=a.drawYear;if(0>_&&(_+=12,aa--),$)for(b=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-U[0]*U[1]+1,$.getDate())),b=Z&&Z>b?Z:b;this._daylightSavingAdjust(new Date(aa,_,1))>b;)_--,0>_&&(_=11,aa--);for(a.drawMonth=_,a.drawYear=aa,c=this._get(a,"prevText"),c=T?this.formatDate(c,this._daylightSavingAdjust(new Date(aa,_-W,1)),this._getFormatConfig(a)):c,d=this._canAdjustMonth(a,-1,aa,_)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+c+"'><span class='ui-icon ui-icon-circle-triangle-"+(Q?"e":"w")+"'>"+c+"</span></a>":S?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+c+"'><span class='ui-icon ui-icon-circle-triangle-"+(Q?"e":"w")+"'>"+c+"</span></a>",e=this._get(a,"nextText"),e=T?this.formatDate(e,this._daylightSavingAdjust(new Date(aa,_+W,1)),this._getFormatConfig(a)):e,f=this._canAdjustMonth(a,1,aa,_)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+e+"'><span class='ui-icon ui-icon-circle-triangle-"+(Q?"w":"e")+"'>"+e+"</span></a>":S?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+e+"'><span class='ui-icon ui-icon-circle-triangle-"+(Q?"w":"e")+"'>"+e+"</span></a>",g=this._get(a,"currentText"),h=this._get(a,"gotoCurrent")&&a.currentDay?Y:P,g=T?this.formatDate(g,h,this._getFormatConfig(a)):g,i=a.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(a,"closeText")+"</button>",j=R?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Q?i:"")+(this._isInRange(a,h)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+g+"</button>":"")+(Q?"":i)+"</div>":"",k=parseInt(this._get(a,"firstDay"),10),k=isNaN(k)?0:k,l=this._get(a,"showWeek"),m=this._get(a,"dayNames"),n=this._get(a,"dayNamesMin"),o=this._get(a,"monthNames"),p=this._get(a,"monthNamesShort"),q=this._get(a,"beforeShowDay"),r=this._get(a,"showOtherMonths"),s=this._get(a,"selectOtherMonths"),t=this._getDefaultDate(a),u="",w=0;w<U[0];w++){for(x="",this.maxRows=4,y=0;y<U[1];y++){if(z=this._daylightSavingAdjust(new Date(aa,_,a.selectedDay)),A=" ui-corner-all",B="",X){if(B+="<div class='ui-datepicker-group",U[1]>1)switch(y){case 0:B+=" ui-datepicker-group-first",A=" ui-corner-"+(Q?"right":"left");break;case U[1]-1:B+=" ui-datepicker-group-last",A=" ui-corner-"+(Q?"left":"right");break;default:B+=" ui-datepicker-group-middle",A=""}B+="'>"}for(B+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+A+"'>"+(/all|left/.test(A)&&0===w?Q?f:d:"")+(/all|right/.test(A)&&0===w?Q?d:f:"")+this._generateMonthYearHeader(a,_,aa,Z,$,w>0||y>0,o,p)+// draw month headers
|
|
"</div><table class='ui-datepicker-calendar'><thead><tr>",C=l?"<th class='ui-datepicker-week-col'>"+this._get(a,"weekHeader")+"</th>":"",v=0;7>v;v++)D=(v+k)%7,C+="<th scope='col'"+((v+k+6)%7>=5?" class='ui-datepicker-week-end'":"")+"><span title='"+m[D]+"'>"+n[D]+"</span></th>";for(B+=C+"</tr></thead><tbody>",E=this._getDaysInMonth(aa,_),aa===a.selectedYear&&_===a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,E)),F=(this._getFirstDayOfMonth(aa,_)-k+7)%7,G=Math.ceil((F+E)/7),H=X&&this.maxRows>G?this.maxRows:G,this.maxRows=H,I=this._daylightSavingAdjust(new Date(aa,_,1-F)),J=0;H>J;J++){for(B+="<tr>",K=l?"<td class='ui-datepicker-week-col'>"+this._get(a,"calculateWeek")(I)+"</td>":"",v=0;7>v;v++)L=q?q.apply(a.input?a.input[0]:null,[I]):[!0,""],M=I.getMonth()!==_,N=M&&!s||!L[0]||Z&&Z>I||$&&I>$,K+="<td class='"+((v+k+6)%7>=5?" ui-datepicker-week-end":"")+(M?" ui-datepicker-other-month":"")+(I.getTime()===z.getTime()&&_===a.selectedMonth&&a._keyEvent||t.getTime()===I.getTime()&&t.getTime()===z.getTime()?" "+this._dayOverClass:"")+(N?" "+this._unselectableClass+" ui-state-disabled":"")+(M&&!r?"":" "+L[1]+(I.getTime()===Y.getTime()?" "+this._currentClass:"")+(I.getTime()===P.getTime()?" ui-datepicker-today":""))+"'"+(M&&!r||!L[2]?"":" title='"+L[2].replace(/'/g,"'")+"'")+(N?"":" data-handler='selectDay' data-event='click' data-month='"+I.getMonth()+"' data-year='"+I.getFullYear()+"'")+">"+(M&&!r?" ":N?"<span class='ui-state-default'>"+I.getDate()+"</span>":"<a class='ui-state-default"+(I.getTime()===P.getTime()?" ui-state-highlight":"")+(I.getTime()===Y.getTime()?" ui-state-active":"")+(M?" ui-priority-secondary":"")+"' href='#'>"+I.getDate()+"</a>")+"</td>",I.setDate(I.getDate()+1),I=this._daylightSavingAdjust(I);B+=K+"</tr>"}_++,_>11&&(_=0,aa++),B+="</tbody></table>"+(X?"</div>"+(U[0]>0&&y===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=B}u+=x}return u+=j,a._keyEvent=!1,u},/* Generate the month and year header. */
|
|
_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o,p,q=this._get(a,"changeMonth"),r=this._get(a,"changeYear"),s=this._get(a,"showMonthAfterYear"),t="<div class='ui-datepicker-title'>",u="";
|
|
// month selection
|
|
if(f||!q)u+="<span class='ui-datepicker-month'>"+g[b]+"</span>";else{for(i=d&&d.getFullYear()===c,j=e&&e.getFullYear()===c,u+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",k=0;12>k;k++)(!i||k>=d.getMonth())&&(!j||k<=e.getMonth())&&(u+="<option value='"+k+"'"+(k===b?" selected='selected'":"")+">"+h[k]+"</option>");u+="</select>"}
|
|
// year selection
|
|
if(s||(t+=u+(!f&&q&&r?"":" ")),!a.yearshtml)if(a.yearshtml="",f||!r)t+="<span class='ui-datepicker-year'>"+c+"</span>";else{for(
|
|
// determine range of years to display
|
|
l=this._get(a,"yearRange").split(":"),m=(new Date).getFullYear(),n=function(a){var b=a.match(/c[+\-].*/)?c+parseInt(a.substring(1),10):a.match(/[+\-].*/)?m+parseInt(a,10):parseInt(a,10);return isNaN(b)?m:b},o=n(l[0]),p=Math.max(o,n(l[1]||"")),o=d?Math.max(o,d.getFullYear()):o,p=e?Math.min(p,e.getFullYear()):p,a.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";p>=o;o++)a.yearshtml+="<option value='"+o+"'"+(o===c?" selected='selected'":"")+">"+o+"</option>";a.yearshtml+="</select>",t+=a.yearshtml,a.yearshtml=null}// Close datepicker_header
|
|
return t+=this._get(a,"yearSuffix"),s&&(t+=(!f&&q&&r?"":" ")+u),t+="</div>"},/* Adjust one of the date sub-fields. */
|
|
_adjustInstDate:function(a,b,c){var d=a.drawYear+("Y"===c?b:0),e=a.drawMonth+("M"===c?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+("D"===c?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),("M"===c||"Y"===c)&&this._notifyChange(a)},/* Ensure a date is within any min/max bounds. */
|
|
_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&c>b?c:b;return d&&e>d?d:e},/* Notify change of month/year. */
|
|
_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},/* Determine the number of months to show. */
|
|
_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return null==b?[1,1]:"number"==typeof b?[1,b]:b},/* Determine the current maximum date - ensure no time components are set. */
|
|
_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},/* Find the number of days in a given month. */
|
|
_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},/* Find the day of the week of the first of a month. */
|
|
_getFirstDayOfMonth:function(a,b){return new Date(a,b,1).getDay()},/* Determines if we should allow a "next/prev" month display change. */
|
|
_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(0>b?b:e[0]*e[1]),1));return 0>b&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},/* Is the given date in the accepted range? */
|
|
_isInRange:function(a,b){var c,d,e=this._getMinMaxDate(a,"min"),f=this._getMinMaxDate(a,"max"),g=null,h=null,i=this._get(a,"yearRange");return i&&(c=i.split(":"),d=(new Date).getFullYear(),g=parseInt(c[0],10),h=parseInt(c[1],10),c[0].match(/[+\-].*/)&&(g+=d),c[1].match(/[+\-].*/)&&(h+=d)),(!e||b.getTime()>=e.getTime())&&(!f||b.getTime()<=f.getTime())&&(!g||b.getFullYear()>=g)&&(!h||b.getFullYear()<=h)},/* Provide the configuration settings for formatting/parsing. */
|
|
_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b="string"!=typeof b?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},/* Format the given date for display. */
|
|
_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?"object"==typeof b?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),a.fn.datepicker=function(b){/* Verify an empty collection wasn't passed - Fixes #6976 */
|
|
if(!this.length)return this;/* Initialise the date picker. */
|
|
a.datepicker.initialized||(a(document).mousedown(a.datepicker._checkExternalClick),a.datepicker.initialized=!0),/* Append datepicker main container to body if not exist. */
|
|
0===a("#"+a.datepicker._mainDivId).length&&a("body").append(a.datepicker.dpDiv);var c=Array.prototype.slice.call(arguments,1);return"string"!=typeof b||"isDisabled"!==b&&"getDate"!==b&&"widget"!==b?"option"===b&&2===arguments.length&&"string"==typeof arguments[1]?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(c)):this.each(function(){"string"==typeof b?a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this].concat(c)):a.datepicker._attachDatepicker(this,b)}):a.datepicker["_"+b+"Datepicker"].apply(a.datepicker,[this[0]].concat(c))},a.datepicker=new c,a.datepicker.initialized=!1,a.datepicker.uuid=(new Date).getTime(),a.datepicker.version="1.11.4",a.datepicker}); |