corrade-http-templates – Blame information for rev 62

Subversion Repositories:
Rev:
"; daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); } leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)this.maxRows = numRows; printDate = this._daylightSavingAdjust( newDate( drawYear, drawMonth, 1 - leadDays ) );for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows calender += "<tr>"; tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +this._get( inst, "calculateWeek" )( printDate ) + "</td>" );for ( dow = 0; dow < 7; dow++ ) { // create date picker days daySettings = ( beforeShowDay ? beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); otherMonth = ( printDate.getMonth() !== drawMonth ); unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); tbody += "<td class='" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?// or defaultDate is current printedDate and defaultDate is selectedDate" " + this._dayOverClass : "" ) + // highlight selected day ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months"' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date printDate.setDate( printDate.getDate() + 1 ); printDate = this._daylightSavingAdjust( printDate ); } calender += tbody + "</tr>"; } drawMonth++;if ( drawMonth > 11 ) { drawMonth = 0; drawYear++; } calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); group += calender; } html += group; } html += buttonPanel; inst._keyEvent = false;return html; },/* Generate the month and year header. */ _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, secondary, monthNames, monthNamesShort ) {var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, changeMonth = this._get( inst, "changeMonth" ), changeYear = this._get( inst, "changeYear" ), showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), html = "<div class='ui-datepicker-title'>", monthHtml = "";// Month selectionif ( secondary || !changeMonth ) { monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; } else { inMinYear = ( minDate && minDate.getFullYear() === drawYear ); inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";for ( month = 0; month < 12; month++ ) {if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { monthHtml += "<option value='" + month + "'" + ( month === drawMonth ? " selected='selected'" : "" ) +">" + monthNamesShort[ month ] + "</option>"; } } monthHtml += "</select>"; }if ( !showMonthAfterYear ) { html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ); }// Year selectionif ( !inst.yearshtml ) { inst.yearshtml = "";if ( secondary || !changeYear ) { html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; } else {// determine range of years to display years = this._get( inst, "yearRange" ).split( ":" ); thisYear = newDate().getFullYear(); determineYear = function( value ) {var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :parseInt( value, 10 ) ) );return ( isNaN( year ) ? thisYear : year ); }; year = determineYear( years[ 0 ] ); endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";for ( ; year <= endYear; year++ ) { inst.yearshtml += "<option value='" + year + "'" + ( year === drawYear ? " selected='selected'" : "" ) +">" + year + "</option>"; } inst.yearshtml += "</select>"; html += inst.yearshtml; inst.yearshtml = null; } } html += this._get( inst, "yearSuffix" );if ( showMonthAfterYear ) { html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml; } html += "</div>"; // Close datepicker_headerreturn html; },/* Adjust one of the date sub-fields. */ _adjustInstDate: function( inst, offset, period ) {var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), month = inst.selectedMonth + ( period === "M" ? offset : 0 ), day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), date = this._restrictMinMax( inst, this._daylightSavingAdjust( newDate( year, month, day ) ) ); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear();if ( period === "M" || period === "Y" ) {this._notifyChange( inst ); } },/* Ensure a date is within any min/max bounds. */ _restrictMinMax: function( inst, date ) {var minDate = this._getMinMaxDate( inst, "min" ), maxDate = this._getMinMaxDate( inst, "max" ), newDate = ( minDate && date < minDate ? minDate : date );return ( maxDate && newDate > maxDate ? maxDate : newDate ); },/* Notify change of month/year. */ _notifyChange: function( inst ) {var onChange = this._get( inst, "onChangeMonthYear" );if ( onChange ) { onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); } },/* Determine the number of months to show. */ _getNumberOfMonths: function( inst ) {var numMonths = this._get( inst, "numberOfMonths" );return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); },/* Determine the current maximum date - ensure no time components are set. */ _getMinMaxDate: function( inst, minMax ) {returnthis._determineDate( inst, this._get( inst, minMax + "Date" ), null ); },/* Find the number of days in a given month. */ _getDaysInMonth: function( year, month ) {return 32 - this._daylightSavingAdjust( newDate( year, month, 32 ) ).getDate(); },/* Find the day of the week of the first of a month. */ _getFirstDayOfMonth: function( year, month ) {returnnewDate( year, month, 1 ).getDay(); },/* Determines if we should allow a "next/prev" month display change. */ _canAdjustMonth: function( inst, offset, curYear, curMonth ) {var numMonths = this._getNumberOfMonths( inst ), date = this._daylightSavingAdjust( newDate( curYear, curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );if ( offset < 0 ) { date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); }returnthis._isInRange( inst, date ); },/* Is the given date in the accepted range? */ _isInRange: function( inst, date ) {var yearSplit, currentYear, minDate = this._getMinMaxDate( inst, "min" ), maxDate = this._getMinMaxDate( inst, "max" ), minYear = null, maxYear = null, years = this._get( inst, "yearRange" );if ( years ) { yearSplit = years.split( ":" ); currentYear = newDate().getFullYear(); minYear = parseInt( yearSplit[ 0 ], 10 ); maxYear = parseInt( yearSplit[ 1 ], 10 );if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { minYear += currentYear; }if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { maxYear += currentYear; } }return ( ( !minDate || date.getTime() >= minDate.getTime() ) && ( !maxDate || date.getTime() <= maxDate.getTime() ) && ( !minYear || date.getFullYear() >= minYear ) && ( !maxYear || date.getFullYear() <= maxYear ) ); },/* Provide the configuration settings for formatting/parsing. */ _getFormatConfig: function( inst ) {var shortYearCutoff = this._get( inst, "shortYearCutoff" ); shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :newDate().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );return { shortYearCutoff: shortYearCutoff, dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; },/* Format the given date for display. */ _formatDate: function( inst, day, month, year ) {if ( !day ) { inst.currentDay = inst.selectedDay; inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear; }var date = ( day ? ( typeof day === "object" ? day :this._daylightSavingAdjust( newDate( year, month, day ) ) ) :this._daylightSavingAdjust( newDate( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );returnthis.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); }} );/* * 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. */functiondatepicker_bindHover( dpDiv ) {var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.on( "mouseout", selector, function() { $( this ).removeClass( "ui-state-hover" );if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-prev-hover" ); }if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-next-hover" ); } } ) .on( "mouseover", selector, datepicker_handleMouseover );}functiondatepicker_handleMouseover() {if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); $( this ).addClass( "ui-state-hover" );if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { $( this ).addClass( "ui-datepicker-prev-hover" ); }if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { $( this ).addClass( "ui-datepicker-next-hover" ); } }}/* jQuery extend now ignores nulls! */functiondatepicker_extendRemove( target, props ) { $.extend( target, props );for ( var name in props ) {if ( props[ name ] == null ) { target[ name ] = props[ name ]; } }return target;}/* 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 */$.fn.datepicker = function( options ) {/* Verify an empty collection wasn't passed - Fixes #6976 */if ( !this.length ) {returnthis; }/* Initialise the date picker. */if ( !$.datepicker.initialized ) { $( document ).on( "mousedown", $.datepicker._checkExternalClick ); $.datepicker.initialized = true; }/* Append datepicker main container to body if not exist. */if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { $( "body" ).append( $.datepicker.dpDiv ); }var otherArgs = Array.prototype.slice.call( arguments, 1 );if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {return $.datepicker[ "_" + options + "Datepicker" ]. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); }if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {return $.datepicker[ "_" + options + "Datepicker" ]. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); }returnthis.each( function() { typeof options === "string" ? $.datepicker[ "_" + options + "Datepicker" ]. apply( $.datepicker, [ this ].concat( otherArgs ) ) : $.datepicker._attachDatepicker( this, options ); } );};$.datepicker = new Datepicker(); // singleton instance$.datepicker.initialized = false;$.datepicker.uuid = newDate().getTime();$.datepicker.version = "1.12.1";return $.datepicker;} ) );
Rev Author Line No. Line
62 office 1 // jscs:disable maximumLineLength
2 /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
3 /*!
4 * jQuery UI Datepicker 1.12.1
5 * http://jqueryui.com
6 *
7 * Copyright jQuery Foundation and other contributors
8 * Released under the MIT license.
9 * http://jquery.org/license
10 */
11  
12 //>>label: Datepicker
13 //>>group: Widgets
14 //>>description: Displays a calendar from an input or inline for selecting dates.
15 //>>docs: http://api.jqueryui.com/datepicker/
16 //>>demos: http://jqueryui.com/datepicker/
17 //>>css.structure: ../../themes/base/core.css
18 //>>css.structure: ../../themes/base/datepicker.css
19 //>>css.theme: ../../themes/base/theme.css
20  
21 ( function( factory ) {
22 if ( typeof define === "function" && define.amd ) {
23  
24 // AMD. Register as an anonymous module.
25 define( [
26 "jquery",
27 "../version",
28 "../keycode"
29 ], factory );
30 } else {
31  
32 // Browser globals
33 factory( jQuery );
34 }
35 }( function( $ ) {
36  
37 $.extend( $.ui, { datepicker: { version: "1.12.1" } } );
38  
39 var datepicker_instActive;
40  
41 function datepicker_getZindex( elem ) {
42 var position, value;
43 while ( elem.length && elem[ 0 ] !== document ) {
44  
45 // Ignore z-index if position is set to a value where z-index is ignored by the browser
46 // This makes behavior of this function consistent across browsers
47 // WebKit always returns auto if the element is positioned
48 position = elem.css( "position" );
49 if ( position === "absolute" || position === "relative" || position === "fixed" ) {
50  
51 // IE returns 0 when zIndex is not specified
52 // other browsers return a string
53 // we ignore the case of nested elements with an explicit value of 0
54 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
55 value = parseInt( elem.css( "zIndex" ), 10 );
56 if ( !isNaN( value ) && value !== 0 ) {
57 return value;
58 }
59 }
60 elem = elem.parent();
61 }
62  
63 return 0;
64 }
65 /* Date picker manager.
66 Use the singleton instance of this class, $.datepicker, to interact with the date picker.
67 Settings for (groups of) date pickers are maintained in an instance object,
68 allowing multiple different settings on the same page. */
69  
70 function Datepicker() {
71 this._curInst = null; // The current instance in use
72 this._keyEvent = false; // If the last event was a key event
73 this._disabledInputs = []; // List of date picker inputs that have been disabled
74 this._datepickerShowing = false; // True if the popup picker is showing , false if not
75 this._inDialog = false; // True if showing within a "dialog", false if not
76 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
77 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
78 this._appendClass = "ui-datepicker-append"; // The name of the append marker class
79 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
80 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
81 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
82 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
83 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
84 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
85 this.regional = []; // Available regional settings, indexed by language code
86 this.regional[ "" ] = { // Default regional settings
87 closeText: "Done", // Display text for close link
88 prevText: "Prev", // Display text for previous month link
89 nextText: "Next", // Display text for next month link
90 currentText: "Today", // Display text for current month link
91 monthNames: [ "January","February","March","April","May","June",
92 "July","August","September","October","November","December" ], // Names of months for drop-down and formatting
93 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
94 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
95 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
96 dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
97 weekHeader: "Wk", // Column header for week of the year
98 dateFormat: "mm/dd/yy", // See format options on parseDate
99 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
100 isRTL: false, // True if right-to-left language, false if left-to-right
101 showMonthAfterYear: false, // True if the year select precedes month, false for month then year
102 yearSuffix: "" // Additional text to append to the year in the month headers
103 };
104 this._defaults = { // Global defaults for all the date picker instances
105 showOn: "focus", // "focus" for popup on focus,
106 // "button" for trigger button, or "both" for either
107 showAnim: "fadeIn", // Name of jQuery animation for popup
108 showOptions: {}, // Options for enhanced animations
109 defaultDate: null, // Used when field is blank: actual date,
110 // +/-number for offset from today, null for today
111 appendText: "", // Display text following the input box, e.g. showing the format
112 buttonText: "...", // Text for trigger button
113 buttonImage: "", // URL for trigger button image
114 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
115 hideIfNoPrevNext: false, // True to hide next/previous month links
116 // if not applicable, false to just disable them
117 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
118 gotoCurrent: false, // True if today link goes back to current selection instead
119 changeMonth: false, // True if month can be selected directly, false if only prev/next
120 changeYear: false, // True if year can be selected directly, false if only prev/next
121 yearRange: "c-10:c+10", // Range of years to display in drop-down,
122 // either relative to today's year (-nn:+nn), relative to currently displayed year
123 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
124 showOtherMonths: false, // True to show dates in other months, false to leave blank
125 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
126 showWeek: false, // True to show week of the year, false to not show it
127 calculateWeek: this.iso8601Week, // How to calculate the week of the year,
128 // takes a Date and returns the number of the week for it
129 shortYearCutoff: "+10", // Short year values < this are in the current century,
130 // > this are in the previous century,
131 // string value starting with "+" for current year + value
132 minDate: null, // The earliest selectable date, or null for no limit
133 maxDate: null, // The latest selectable date, or null for no limit
134 duration: "fast", // Duration of display/closure
135 beforeShowDay: null, // Function that takes a date and returns an array with
136 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
137 // [2] = cell title (optional), e.g. $.datepicker.noWeekends
138 beforeShow: null, // Function that takes an input field and
139 // returns a set of custom settings for the date picker
140 onSelect: null, // Define a callback function when a date is selected
141 onChangeMonthYear: null, // Define a callback function when the month or year is changed
142 onClose: null, // Define a callback function when the datepicker is closed
143 numberOfMonths: 1, // Number of months to show at a time
144 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
145 stepMonths: 1, // Number of months to step back/forward
146 stepBigMonths: 12, // Number of months to step back/forward for the big links
147 altField: "", // Selector for an alternate field to store selected dates into
148 altFormat: "", // The date format to use for the alternate field
149 constrainInput: true, // The input is constrained by the current date format
150 showButtonPanel: false, // True to show button panel, false to not show it
151 autoSize: false, // True to size the input for the date format, false to leave as is
152 disabled: false // The initial disabled state
153 };
154 $.extend( this._defaults, this.regional[ "" ] );
155 this.regional.en = $.extend( true, {}, this.regional[ "" ] );
156 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
157 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
158 }
159  
160 $.extend( Datepicker.prototype, {
161 /* Class name added to elements to indicate already configured with a date picker. */
162 markerClassName: "hasDatepicker",
163  
164 //Keep track of the maximum number of rows displayed (see #7043)
165 maxRows: 4,
166  
167 // TODO rename to "widget" when switching to widget factory
168 _widgetDatepicker: function() {
169 return this.dpDiv;
170 },
171  
172 /* Override the default settings for all instances of the date picker.
173 * @param settings object - the new settings to use as defaults (anonymous object)
174 * @return the manager object
175 */
176 setDefaults: function( settings ) {
177 datepicker_extendRemove( this._defaults, settings || {} );
178 return this;
179 },
180  
181 /* Attach the date picker to a jQuery selection.
182 * @param target element - the target input field or division or span
183 * @param settings object - the new settings to use for this date picker instance (anonymous)
184 */
185 _attachDatepicker: function( target, settings ) {
186 var nodeName, inline, inst;
187 nodeName = target.nodeName.toLowerCase();
188 inline = ( nodeName === "div" || nodeName === "span" );
189 if ( !target.id ) {
190 this.uuid += 1;
191 target.id = "dp" + this.uuid;
192 }
193 inst = this._newInst( $( target ), inline );
194 inst.settings = $.extend( {}, settings || {} );
195 if ( nodeName === "input" ) {
196 this._connectDatepicker( target, inst );
197 } else if ( inline ) {
198 this._inlineDatepicker( target, inst );
199 }
200 },
201  
202 /* Create a new instance object. */
203 _newInst: function( target, inline ) {
204 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
205 return { id: id, input: target, // associated target
206 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
207 drawMonth: 0, drawYear: 0, // month being drawn
208 inline: inline, // is datepicker inline or not
209 dpDiv: ( !inline ? this.dpDiv : // presentation div
210 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
211 },
212  
213 /* Attach the date picker to an input field. */
214 _connectDatepicker: function( target, inst ) {
215 var input = $( target );
216 inst.append = $( [] );
217 inst.trigger = $( [] );
218 if ( input.hasClass( this.markerClassName ) ) {
219 return;
220 }
221 this._attachments( input, inst );
222 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
223 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
224 this._autoSize( inst );
225 $.data( target, "datepicker", inst );
226  
227 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
228 if ( inst.settings.disabled ) {
229 this._disableDatepicker( target );
230 }
231 },
232  
233 /* Make attachments based on settings. */
234 _attachments: function( input, inst ) {
235 var showOn, buttonText, buttonImage,
236 appendText = this._get( inst, "appendText" ),
237 isRTL = this._get( inst, "isRTL" );
238  
239 if ( inst.append ) {
240 inst.append.remove();
241 }
242 if ( appendText ) {
243 inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
244 input[ isRTL ? "before" : "after" ]( inst.append );
245 }
246  
247 input.off( "focus", this._showDatepicker );
248  
249 if ( inst.trigger ) {
250 inst.trigger.remove();
251 }
252  
253 showOn = this._get( inst, "showOn" );
254 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
255 input.on( "focus", this._showDatepicker );
256 }
257 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
258 buttonText = this._get( inst, "buttonText" );
259 buttonImage = this._get( inst, "buttonImage" );
260 inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
261 $( "<img/>" ).addClass( this._triggerClass ).
262 attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
263 $( "<button type='button'></button>" ).addClass( this._triggerClass ).
264 html( !buttonImage ? buttonText : $( "<img/>" ).attr(
265 { src:buttonImage, alt:buttonText, title:buttonText } ) ) );
266 input[ isRTL ? "before" : "after" ]( inst.trigger );
267 inst.trigger.on( "click", function() {
268 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
269 $.datepicker._hideDatepicker();
270 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
271 $.datepicker._hideDatepicker();
272 $.datepicker._showDatepicker( input[ 0 ] );
273 } else {
274 $.datepicker._showDatepicker( input[ 0 ] );
275 }
276 return false;
277 } );
278 }
279 },
280  
281 /* Apply the maximum length for the date format. */
282 _autoSize: function( inst ) {
283 if ( this._get( inst, "autoSize" ) && !inst.inline ) {
284 var findMax, max, maxI, i,
285 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
286 dateFormat = this._get( inst, "dateFormat" );
287  
288 if ( dateFormat.match( /[DM]/ ) ) {
289 findMax = function( names ) {
290 max = 0;
291 maxI = 0;
292 for ( i = 0; i < names.length; i++ ) {
293 if ( names[ i ].length > max ) {
294 max = names[ i ].length;
295 maxI = i;
296 }
297 }
298 return maxI;
299 };
300 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
301 "monthNames" : "monthNamesShort" ) ) ) );
302 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
303 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
304 }
305 inst.input.attr( "size", this._formatDate( inst, date ).length );
306 }
307 },
308  
309 /* Attach an inline date picker to a div. */
310 _inlineDatepicker: function( target, inst ) {
311 var divSpan = $( target );
312 if ( divSpan.hasClass( this.markerClassName ) ) {
313 return;
314 }
315 divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
316 $.data( target, "datepicker", inst );
317 this._setDate( inst, this._getDefaultDate( inst ), true );
318 this._updateDatepicker( inst );
319 this._updateAlternate( inst );
320  
321 //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
322 if ( inst.settings.disabled ) {
323 this._disableDatepicker( target );
324 }
325  
326 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
327 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
328 inst.dpDiv.css( "display", "block" );
329 },
330  
331 /* Pop-up the date picker in a "dialog" box.
332 * @param input element - ignored
333 * @param date string or Date - the initial date to display
334 * @param onSelect function - the function to call when a date is selected
335 * @param settings object - update the dialog date picker instance's settings (anonymous object)
336 * @param pos int[2] - coordinates for the dialog's position within the screen or
337 * event - with x/y coordinates or
338 * leave empty for default (screen centre)
339 * @return the manager object
340 */
341 _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
342 var id, browserWidth, browserHeight, scrollX, scrollY,
343 inst = this._dialogInst; // internal instance
344  
345 if ( !inst ) {
346 this.uuid += 1;
347 id = "dp" + this.uuid;
348 this._dialogInput = $( "<input type='text' id='" + id +
349 "' style='position: absolute; top: -100px; width: 0px;'/>" );
350 this._dialogInput.on( "keydown", this._doKeyDown );
351 $( "body" ).append( this._dialogInput );
352 inst = this._dialogInst = this._newInst( this._dialogInput, false );
353 inst.settings = {};
354 $.data( this._dialogInput[ 0 ], "datepicker", inst );
355 }
356 datepicker_extendRemove( inst.settings, settings || {} );
357 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
358 this._dialogInput.val( date );
359  
360 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
361 if ( !this._pos ) {
362 browserWidth = document.documentElement.clientWidth;
363 browserHeight = document.documentElement.clientHeight;
364 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
365 scrollY = document.documentElement.scrollTop || document.body.scrollTop;
366 this._pos = // should use actual width/height below
367 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
368 }
369  
370 // Move input on screen for focus, but hidden behind dialog
371 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
372 inst.settings.onSelect = onSelect;
373 this._inDialog = true;
374 this.dpDiv.addClass( this._dialogClass );
375 this._showDatepicker( this._dialogInput[ 0 ] );
376 if ( $.blockUI ) {
377 $.blockUI( this.dpDiv );
378 }
379 $.data( this._dialogInput[ 0 ], "datepicker", inst );
380 return this;
381 },
382  
383 /* Detach a datepicker from its control.
384 * @param target element - the target input field or division or span
385 */
386 _destroyDatepicker: function( target ) {
387 var nodeName,
388 $target = $( target ),
389 inst = $.data( target, "datepicker" );
390  
391 if ( !$target.hasClass( this.markerClassName ) ) {
392 return;
393 }
394  
395 nodeName = target.nodeName.toLowerCase();
396 $.removeData( target, "datepicker" );
397 if ( nodeName === "input" ) {
398 inst.append.remove();
399 inst.trigger.remove();
400 $target.removeClass( this.markerClassName ).
401 off( "focus", this._showDatepicker ).
402 off( "keydown", this._doKeyDown ).
403 off( "keypress", this._doKeyPress ).
404 off( "keyup", this._doKeyUp );
405 } else if ( nodeName === "div" || nodeName === "span" ) {
406 $target.removeClass( this.markerClassName ).empty();
407 }
408  
409 if ( datepicker_instActive === inst ) {
410 datepicker_instActive = null;
411 }
412 },
413  
414 /* Enable the date picker to a jQuery selection.
415 * @param target element - the target input field or division or span
416 */
417 _enableDatepicker: function( target ) {
418 var nodeName, inline,
419 $target = $( target ),
420 inst = $.data( target, "datepicker" );
421  
422 if ( !$target.hasClass( this.markerClassName ) ) {
423 return;
424 }
425  
426 nodeName = target.nodeName.toLowerCase();
427 if ( nodeName === "input" ) {
428 target.disabled = false;
429 inst.trigger.filter( "button" ).
430 each( function() { this.disabled = false; } ).end().
431 filter( "img" ).css( { opacity: "1.0", cursor: "" } );
432 } else if ( nodeName === "div" || nodeName === "span" ) {
433 inline = $target.children( "." + this._inlineClass );
434 inline.children().removeClass( "ui-state-disabled" );
435 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
436 prop( "disabled", false );
437 }
438 this._disabledInputs = $.map( this._disabledInputs,
439 function( value ) { return ( value === target ? null : value ); } ); // delete entry
440 },
441  
442 /* Disable the date picker to a jQuery selection.
443 * @param target element - the target input field or division or span
444 */
445 _disableDatepicker: function( target ) {
446 var nodeName, inline,
447 $target = $( target ),
448 inst = $.data( target, "datepicker" );
449  
450 if ( !$target.hasClass( this.markerClassName ) ) {
451 return;
452 }
453  
454 nodeName = target.nodeName.toLowerCase();
455 if ( nodeName === "input" ) {
456 target.disabled = true;
457 inst.trigger.filter( "button" ).
458 each( function() { this.disabled = true; } ).end().
459 filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
460 } else if ( nodeName === "div" || nodeName === "span" ) {
461 inline = $target.children( "." + this._inlineClass );
462 inline.children().addClass( "ui-state-disabled" );
463 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
464 prop( "disabled", true );
465 }
466 this._disabledInputs = $.map( this._disabledInputs,
467 function( value ) { return ( value === target ? null : value ); } ); // delete entry
468 this._disabledInputs[ this._disabledInputs.length ] = target;
469 },
470  
471 /* Is the first field in a jQuery collection disabled as a datepicker?
472 * @param target element - the target input field or division or span
473 * @return boolean - true if disabled, false if enabled
474 */
475 _isDisabledDatepicker: function( target ) {
476 if ( !target ) {
477 return false;
478 }
479 for ( var i = 0; i < this._disabledInputs.length; i++ ) {
480 if ( this._disabledInputs[ i ] === target ) {
481 return true;
482 }
483 }
484 return false;
485 },
486  
487 /* Retrieve the instance data for the target control.
488 * @param target element - the target input field or division or span
489 * @return object - the associated instance data
490 * @throws error if a jQuery problem getting data
491 */
492 _getInst: function( target ) {
493 try {
494 return $.data( target, "datepicker" );
495 }
496 catch ( err ) {
497 throw "Missing instance data for this datepicker";
498 }
499 },
500  
501 /* Update or retrieve the settings for a date picker attached to an input field or division.
502 * @param target element - the target input field or division or span
503 * @param name object - the new settings to update or
504 * string - the name of the setting to change or retrieve,
505 * when retrieving also "all" for all instance settings or
506 * "defaults" for all global defaults
507 * @param value any - the new value for the setting
508 * (omit if above is an object or to retrieve a value)
509 */
510 _optionDatepicker: function( target, name, value ) {
511 var settings, date, minDate, maxDate,
512 inst = this._getInst( target );
513  
514 if ( arguments.length === 2 && typeof name === "string" ) {
515 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
516 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
517 this._get( inst, name ) ) : null ) );
518 }
519  
520 settings = name || {};
521 if ( typeof name === "string" ) {
522 settings = {};
523 settings[ name ] = value;
524 }
525  
526 if ( inst ) {
527 if ( this._curInst === inst ) {
528 this._hideDatepicker();
529 }
530  
531 date = this._getDateDatepicker( target, true );
532 minDate = this._getMinMaxDate( inst, "min" );
533 maxDate = this._getMinMaxDate( inst, "max" );
534 datepicker_extendRemove( inst.settings, settings );
535  
536 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
537 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
538 inst.settings.minDate = this._formatDate( inst, minDate );
539 }
540 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
541 inst.settings.maxDate = this._formatDate( inst, maxDate );
542 }
543 if ( "disabled" in settings ) {
544 if ( settings.disabled ) {
545 this._disableDatepicker( target );
546 } else {
547 this._enableDatepicker( target );
548 }
549 }
550 this._attachments( $( target ), inst );
551 this._autoSize( inst );
552 this._setDate( inst, date );
553 this._updateAlternate( inst );
554 this._updateDatepicker( inst );
555 }
556 },
557  
558 // Change method deprecated
559 _changeDatepicker: function( target, name, value ) {
560 this._optionDatepicker( target, name, value );
561 },
562  
563 /* Redraw the date picker attached to an input field or division.
564 * @param target element - the target input field or division or span
565 */
566 _refreshDatepicker: function( target ) {
567 var inst = this._getInst( target );
568 if ( inst ) {
569 this._updateDatepicker( inst );
570 }
571 },
572  
573 /* Set the dates for a jQuery selection.
574 * @param target element - the target input field or division or span
575 * @param date Date - the new date
576 */
577 _setDateDatepicker: function( target, date ) {
578 var inst = this._getInst( target );
579 if ( inst ) {
580 this._setDate( inst, date );
581 this._updateDatepicker( inst );
582 this._updateAlternate( inst );
583 }
584 },
585  
586 /* Get the date(s) for the first entry in a jQuery selection.
587 * @param target element - the target input field or division or span
588 * @param noDefault boolean - true if no default date is to be used
589 * @return Date - the current date
590 */
591 _getDateDatepicker: function( target, noDefault ) {
592 var inst = this._getInst( target );
593 if ( inst && !inst.inline ) {
594 this._setDateFromField( inst, noDefault );
595 }
596 return ( inst ? this._getDate( inst ) : null );
597 },
598  
599 /* Handle keystrokes. */
600 _doKeyDown: function( event ) {
601 var onSelect, dateStr, sel,
602 inst = $.datepicker._getInst( event.target ),
603 handled = true,
604 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
605  
606 inst._keyEvent = true;
607 if ( $.datepicker._datepickerShowing ) {
608 switch ( event.keyCode ) {
609 case 9: $.datepicker._hideDatepicker();
610 handled = false;
611 break; // hide on tab out
612 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
613 $.datepicker._currentClass + ")", inst.dpDiv );
614 if ( sel[ 0 ] ) {
615 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
616 }
617  
618 onSelect = $.datepicker._get( inst, "onSelect" );
619 if ( onSelect ) {
620 dateStr = $.datepicker._formatDate( inst );
621  
622 // Trigger custom callback
623 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
624 } else {
625 $.datepicker._hideDatepicker();
626 }
627  
628 return false; // don't submit the form
629 case 27: $.datepicker._hideDatepicker();
630 break; // hide on escape
631 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
632 -$.datepicker._get( inst, "stepBigMonths" ) :
633 -$.datepicker._get( inst, "stepMonths" ) ), "M" );
634 break; // previous month/year on page up/+ ctrl
635 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
636 +$.datepicker._get( inst, "stepBigMonths" ) :
637 +$.datepicker._get( inst, "stepMonths" ) ), "M" );
638 break; // next month/year on page down/+ ctrl
639 case 35: if ( event.ctrlKey || event.metaKey ) {
640 $.datepicker._clearDate( event.target );
641 }
642 handled = event.ctrlKey || event.metaKey;
643 break; // clear on ctrl or command +end
644 case 36: if ( event.ctrlKey || event.metaKey ) {
645 $.datepicker._gotoToday( event.target );
646 }
647 handled = event.ctrlKey || event.metaKey;
648 break; // current on ctrl or command +home
649 case 37: if ( event.ctrlKey || event.metaKey ) {
650 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
651 }
652 handled = event.ctrlKey || event.metaKey;
653  
654 // -1 day on ctrl or command +left
655 if ( event.originalEvent.altKey ) {
656 $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
657 -$.datepicker._get( inst, "stepBigMonths" ) :
658 -$.datepicker._get( inst, "stepMonths" ) ), "M" );
659 }
660  
661 // next month/year on alt +left on Mac
662 break;
663 case 38: if ( event.ctrlKey || event.metaKey ) {
664 $.datepicker._adjustDate( event.target, -7, "D" );
665 }
666 handled = event.ctrlKey || event.metaKey;
667 break; // -1 week on ctrl or command +up
668 case 39: if ( event.ctrlKey || event.metaKey ) {
669 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
670 }
671 handled = event.ctrlKey || event.metaKey;
672  
673 // +1 day on ctrl or command +right
674 if ( event.originalEvent.altKey ) {
675 $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
676 +$.datepicker._get( inst, "stepBigMonths" ) :
677 +$.datepicker._get( inst, "stepMonths" ) ), "M" );
678 }
679  
680 // next month/year on alt +right
681 break;
682 case 40: if ( event.ctrlKey || event.metaKey ) {
683 $.datepicker._adjustDate( event.target, +7, "D" );
684 }
685 handled = event.ctrlKey || event.metaKey;
686 break; // +1 week on ctrl or command +down
687 default: handled = false;
688 }
689 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
690 $.datepicker._showDatepicker( this );
691 } else {
692 handled = false;
693 }
694  
695 if ( handled ) {
696 event.preventDefault();
697 event.stopPropagation();
698 }
699 },
700  
701 /* Filter entered characters - based on date format. */
702 _doKeyPress: function( event ) {
703 var chars, chr,
704 inst = $.datepicker._getInst( event.target );
705  
706 if ( $.datepicker._get( inst, "constrainInput" ) ) {
707 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
708 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
709 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
710 }
711 },
712  
713 /* Synchronise manual entry and field/alternate field. */
714 _doKeyUp: function( event ) {
715 var date,
716 inst = $.datepicker._getInst( event.target );
717  
718 if ( inst.input.val() !== inst.lastVal ) {
719 try {
720 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
721 ( inst.input ? inst.input.val() : null ),
722 $.datepicker._getFormatConfig( inst ) );
723  
724 if ( date ) { // only if valid
725 $.datepicker._setDateFromField( inst );
726 $.datepicker._updateAlternate( inst );
727 $.datepicker._updateDatepicker( inst );
728 }
729 }
730 catch ( err ) {
731 }
732 }
733 return true;
734 },
735  
736 /* Pop-up the date picker for a given input field.
737 * If false returned from beforeShow event handler do not show.
738 * @param input element - the input field attached to the date picker or
739 * event - if triggered by focus
740 */
741 _showDatepicker: function( input ) {
742 input = input.target || input;
743 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
744 input = $( "input", input.parentNode )[ 0 ];
745 }
746  
747 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
748 return;
749 }
750  
751 var inst, beforeShow, beforeShowSettings, isFixed,
752 offset, showAnim, duration;
753  
754 inst = $.datepicker._getInst( input );
755 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
756 $.datepicker._curInst.dpDiv.stop( true, true );
757 if ( inst && $.datepicker._datepickerShowing ) {
758 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
759 }
760 }
761  
762 beforeShow = $.datepicker._get( inst, "beforeShow" );
763 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
764 if ( beforeShowSettings === false ) {
765 return;
766 }
767 datepicker_extendRemove( inst.settings, beforeShowSettings );
768  
769 inst.lastVal = null;
770 $.datepicker._lastInput = input;
771 $.datepicker._setDateFromField( inst );
772  
773 if ( $.datepicker._inDialog ) { // hide cursor
774 input.value = "";
775 }
776 if ( !$.datepicker._pos ) { // position below input
777 $.datepicker._pos = $.datepicker._findPos( input );
778 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
779 }
780  
781 isFixed = false;
782 $( input ).parents().each( function() {
783 isFixed |= $( this ).css( "position" ) === "fixed";
784 return !isFixed;
785 } );
786  
787 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
788 $.datepicker._pos = null;
789  
790 //to avoid flashes on Firefox
791 inst.dpDiv.empty();
792  
793 // determine sizing offscreen
794 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
795 $.datepicker._updateDatepicker( inst );
796  
797 // fix width for dynamic number of date pickers
798 // and adjust position before showing
799 offset = $.datepicker._checkOffset( inst, offset, isFixed );
800 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
801 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
802 left: offset.left + "px", top: offset.top + "px" } );
803  
804 if ( !inst.inline ) {
805 showAnim = $.datepicker._get( inst, "showAnim" );
806 duration = $.datepicker._get( inst, "duration" );
807 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
808 $.datepicker._datepickerShowing = true;
809  
810 if ( $.effects && $.effects.effect[ showAnim ] ) {
811 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
812 } else {
813 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
814 }
815  
816 if ( $.datepicker._shouldFocusInput( inst ) ) {
817 inst.input.trigger( "focus" );
818 }
819  
820 $.datepicker._curInst = inst;
821 }
822 },
823  
824 /* Generate the date picker content. */
825 _updateDatepicker: function( inst ) {
826 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
827 datepicker_instActive = inst; // for delegate hover events
828 inst.dpDiv.empty().append( this._generateHTML( inst ) );
829 this._attachHandlers( inst );
830  
831 var origyearshtml,
832 numMonths = this._getNumberOfMonths( inst ),
833 cols = numMonths[ 1 ],
834 width = 17,
835 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
836  
837 if ( activeCell.length > 0 ) {
838 datepicker_handleMouseover.apply( activeCell.get( 0 ) );
839 }
840  
841 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
842 if ( cols > 1 ) {
843 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
844 }
845 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
846 "Class" ]( "ui-datepicker-multi" );
847 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
848 "Class" ]( "ui-datepicker-rtl" );
849  
850 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
851 inst.input.trigger( "focus" );
852 }
853  
854 // Deffered render of the years select (to avoid flashes on Firefox)
855 if ( inst.yearshtml ) {
856 origyearshtml = inst.yearshtml;
857 setTimeout( function() {
858  
859 //assure that inst.yearshtml didn't change.
860 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
861 inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
862 }
863 origyearshtml = inst.yearshtml = null;
864 }, 0 );
865 }
866 },
867  
868 // #6694 - don't focus the input if it's already focused
869 // this breaks the change event in IE
870 // Support: IE and jQuery <1.9
871 _shouldFocusInput: function( inst ) {
872 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
873 },
874  
875 /* Check positioning to remain on screen. */
876 _checkOffset: function( inst, offset, isFixed ) {
877 var dpWidth = inst.dpDiv.outerWidth(),
878 dpHeight = inst.dpDiv.outerHeight(),
879 inputWidth = inst.input ? inst.input.outerWidth() : 0,
880 inputHeight = inst.input ? inst.input.outerHeight() : 0,
881 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
882 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
883  
884 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
885 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
886 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
887  
888 // Now check if datepicker is showing outside window viewport - move to a better place if so.
889 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
890 Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
891 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
892 Math.abs( dpHeight + inputHeight ) : 0 );
893  
894 return offset;
895 },
896  
897 /* Find an object's position on the screen. */
898 _findPos: function( obj ) {
899 var position,
900 inst = this._getInst( obj ),
901 isRTL = this._get( inst, "isRTL" );
902  
903 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
904 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
905 }
906  
907 position = $( obj ).offset();
908 return [ position.left, position.top ];
909 },
910  
911 /* Hide the date picker from view.
912 * @param input element - the input field attached to the date picker
913 */
914 _hideDatepicker: function( input ) {
915 var showAnim, duration, postProcess, onClose,
916 inst = this._curInst;
917  
918 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
919 return;
920 }
921  
922 if ( this._datepickerShowing ) {
923 showAnim = this._get( inst, "showAnim" );
924 duration = this._get( inst, "duration" );
925 postProcess = function() {
926 $.datepicker._tidyDialog( inst );
927 };
928  
929 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
930 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
931 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
932 } else {
933 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
934 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
935 }
936  
937 if ( !showAnim ) {
938 postProcess();
939 }
940 this._datepickerShowing = false;
941  
942 onClose = this._get( inst, "onClose" );
943 if ( onClose ) {
944 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
945 }
946  
947 this._lastInput = null;
948 if ( this._inDialog ) {
949 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
950 if ( $.blockUI ) {
951 $.unblockUI();
952 $( "body" ).append( this.dpDiv );
953 }
954 }
955 this._inDialog = false;
956 }
957 },
958  
959 /* Tidy up after a dialog display. */
960 _tidyDialog: function( inst ) {
961 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
962 },
963  
964 /* Close date picker if clicked elsewhere. */
965 _checkExternalClick: function( event ) {
966 if ( !$.datepicker._curInst ) {
967 return;
968 }
969  
970 var $target = $( event.target ),
971 inst = $.datepicker._getInst( $target[ 0 ] );
972  
973 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
974 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
975 !$target.hasClass( $.datepicker.markerClassName ) &&
976 !$target.closest( "." + $.datepicker._triggerClass ).length &&
977 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
978 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
979 $.datepicker._hideDatepicker();
980 }
981 },
982  
983 /* Adjust one of the date sub-fields. */
984 _adjustDate: function( id, offset, period ) {
985 var target = $( id ),
986 inst = this._getInst( target[ 0 ] );
987  
988 if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
989 return;
990 }
991 this._adjustInstDate( inst, offset +
992 ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
993 period );
994 this._updateDatepicker( inst );
995 },
996  
997 /* Action for current link. */
998 _gotoToday: function( id ) {
999 var date,
1000 target = $( id ),
1001 inst = this._getInst( target[ 0 ] );
1002  
1003 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
1004 inst.selectedDay = inst.currentDay;
1005 inst.drawMonth = inst.selectedMonth = inst.currentMonth;
1006 inst.drawYear = inst.selectedYear = inst.currentYear;
1007 } else {
1008 date = new Date();
1009 inst.selectedDay = date.getDate();
1010 inst.drawMonth = inst.selectedMonth = date.getMonth();
1011 inst.drawYear = inst.selectedYear = date.getFullYear();
1012 }
1013 this._notifyChange( inst );
1014 this._adjustDate( target );
1015 },
1016  
1017 /* Action for selecting a new month/year. */
1018 _selectMonthYear: function( id, select, period ) {
1019 var target = $( id ),
1020 inst = this._getInst( target[ 0 ] );
1021  
1022 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
1023 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
1024 parseInt( select.options[ select.selectedIndex ].value, 10 );
1025  
1026 this._notifyChange( inst );
1027 this._adjustDate( target );
1028 },
1029  
1030 /* Action for selecting a day. */
1031 _selectDay: function( id, month, year, td ) {
1032 var inst,
1033 target = $( id );
1034  
1035 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
1036 return;
1037 }
1038  
1039 inst = this._getInst( target[ 0 ] );
1040 inst.selectedDay = inst.currentDay = $( "a", td ).html();
1041 inst.selectedMonth = inst.currentMonth = month;
1042 inst.selectedYear = inst.currentYear = year;
1043 this._selectDate( id, this._formatDate( inst,
1044 inst.currentDay, inst.currentMonth, inst.currentYear ) );
1045 },
1046  
1047 /* Erase the input field and hide the date picker. */
1048 _clearDate: function( id ) {
1049 var target = $( id );
1050 this._selectDate( target, "" );
1051 },
1052  
1053 /* Update the input field with the selected date. */
1054 _selectDate: function( id, dateStr ) {
1055 var onSelect,
1056 target = $( id ),
1057 inst = this._getInst( target[ 0 ] );
1058  
1059 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
1060 if ( inst.input ) {
1061 inst.input.val( dateStr );
1062 }
1063 this._updateAlternate( inst );
1064  
1065 onSelect = this._get( inst, "onSelect" );
1066 if ( onSelect ) {
1067 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
1068 } else if ( inst.input ) {
1069 inst.input.trigger( "change" ); // fire the change event
1070 }
1071  
1072 if ( inst.inline ) {
1073 this._updateDatepicker( inst );
1074 } else {
1075 this._hideDatepicker();
1076 this._lastInput = inst.input[ 0 ];
1077 if ( typeof( inst.input[ 0 ] ) !== "object" ) {
1078 inst.input.trigger( "focus" ); // restore focus
1079 }
1080 this._lastInput = null;
1081 }
1082 },
1083  
1084 /* Update any alternate field to synchronise with the main field. */
1085 _updateAlternate: function( inst ) {
1086 var altFormat, date, dateStr,
1087 altField = this._get( inst, "altField" );
1088  
1089 if ( altField ) { // update alternate field too
1090 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
1091 date = this._getDate( inst );
1092 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
1093 $( altField ).val( dateStr );
1094 }
1095 },
1096  
1097 /* Set as beforeShowDay function to prevent selection of weekends.
1098 * @param date Date - the date to customise
1099 * @return [boolean, string] - is this date selectable?, what is its CSS class?
1100 */
1101 noWeekends: function( date ) {
1102 var day = date.getDay();
1103 return [ ( day > 0 && day < 6 ), "" ];
1104 },
1105  
1106 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
1107 * @param date Date - the date to get the week for
1108 * @return number - the number of the week within the year that contains this date
1109 */
1110 iso8601Week: function( date ) {
1111 var time,
1112 checkDate = new Date( date.getTime() );
1113  
1114 // Find Thursday of this week starting on Monday
1115 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
1116  
1117 time = checkDate.getTime();
1118 checkDate.setMonth( 0 ); // Compare with Jan 1
1119 checkDate.setDate( 1 );
1120 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
1121 },
1122  
1123 /* Parse a string value into a date object.
1124 * See formatDate below for the possible formats.
1125 *
1126 * @param format string - the expected format of the date
1127 * @param value string - the date in the above format
1128 * @param settings Object - attributes include:
1129 * shortYearCutoff number - the cutoff year for determining the century (optional)
1130 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1131 * dayNames string[7] - names of the days from Sunday (optional)
1132 * monthNamesShort string[12] - abbreviated names of the months (optional)
1133 * monthNames string[12] - names of the months (optional)
1134 * @return Date - the extracted date value or null if value is blank
1135 */
1136 parseDate: function( format, value, settings ) {
1137 if ( format == null || value == null ) {
1138 throw "Invalid arguments";
1139 }
1140  
1141 value = ( typeof value === "object" ? value.toString() : value + "" );
1142 if ( value === "" ) {
1143 return null;
1144 }
1145  
1146 var iFormat, dim, extra,
1147 iValue = 0,
1148 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
1149 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
1150 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
1151 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
1152 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
1153 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
1154 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
1155 year = -1,
1156 month = -1,
1157 day = -1,
1158 doy = -1,
1159 literal = false,
1160 date,
1161  
1162 // Check whether a format character is doubled
1163 lookAhead = function( match ) {
1164 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1165 if ( matches ) {
1166 iFormat++;
1167 }
1168 return matches;
1169 },
1170  
1171 // Extract a number from the string value
1172 getNumber = function( match ) {
1173 var isDoubled = lookAhead( match ),
1174 size = ( match === "@" ? 14 : ( match === "!" ? 20 :
1175 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
1176 minSize = ( match === "y" ? size : 1 ),
1177 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
1178 num = value.substring( iValue ).match( digits );
1179 if ( !num ) {
1180 throw "Missing number at position " + iValue;
1181 }
1182 iValue += num[ 0 ].length;
1183 return parseInt( num[ 0 ], 10 );
1184 },
1185  
1186 // Extract a name from the string value and convert to an index
1187 getName = function( match, shortNames, longNames ) {
1188 var index = -1,
1189 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
1190 return [ [ k, v ] ];
1191 } ).sort( function( a, b ) {
1192 return -( a[ 1 ].length - b[ 1 ].length );
1193 } );
1194  
1195 $.each( names, function( i, pair ) {
1196 var name = pair[ 1 ];
1197 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
1198 index = pair[ 0 ];
1199 iValue += name.length;
1200 return false;
1201 }
1202 } );
1203 if ( index !== -1 ) {
1204 return index + 1;
1205 } else {
1206 throw "Unknown name at position " + iValue;
1207 }
1208 },
1209  
1210 // Confirm that a literal character matches the string value
1211 checkLiteral = function() {
1212 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
1213 throw "Unexpected literal at position " + iValue;
1214 }
1215 iValue++;
1216 };
1217  
1218 for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1219 if ( literal ) {
1220 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1221 literal = false;
1222 } else {
1223 checkLiteral();
1224 }
1225 } else {
1226 switch ( format.charAt( iFormat ) ) {
1227 case "d":
1228 day = getNumber( "d" );
1229 break;
1230 case "D":
1231 getName( "D", dayNamesShort, dayNames );
1232 break;
1233 case "o":
1234 doy = getNumber( "o" );
1235 break;
1236 case "m":
1237 month = getNumber( "m" );
1238 break;
1239 case "M":
1240 month = getName( "M", monthNamesShort, monthNames );
1241 break;
1242 case "y":
1243 year = getNumber( "y" );
1244 break;
1245 case "@":
1246 date = new Date( getNumber( "@" ) );
1247 year = date.getFullYear();
1248 month = date.getMonth() + 1;
1249 day = date.getDate();
1250 break;
1251 case "!":
1252 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
1253 year = date.getFullYear();
1254 month = date.getMonth() + 1;
1255 day = date.getDate();
1256 break;
1257 case "'":
1258 if ( lookAhead( "'" ) ) {
1259 checkLiteral();
1260 } else {
1261 literal = true;
1262 }
1263 break;
1264 default:
1265 checkLiteral();
1266 }
1267 }
1268 }
1269  
1270 if ( iValue < value.length ) {
1271 < value.length ) { extra = value.substr( iValue );
1272 < value.length ) { if ( !/^\s+/.test( extra ) ) {
1273 < value.length ) { throw "Extra/unparsed characters found in date: " + extra;
1274 < value.length ) { }
1275 < value.length ) { }
1276  
1277 < value.length ) { if ( year === -1 ) {
1278 < value.length ) { year = new Date().getFullYear();
1279 < value.length ) { } else if ( year < 100 ) {
1280 < value.length ) { year += new Date().getFullYear() - new Date().getFullYear() % 100 +
1281 < value.length ) { ( year <= shortYearCutoff ? 0 : -100 );
1282 < value.length ) { }
1283  
1284 < value.length ) { if ( doy > -1 ) {
1285 < value.length ) { month = 1;
1286 < value.length ) { day = doy;
1287 < value.length ) { do {
1288 < value.length ) { dim = this._getDaysInMonth( year, month - 1 );
1289 < value.length ) { if ( day <= dim ) {
1290 < value.length ) { break;
1291 < value.length ) { }
1292 < value.length ) { month++;
1293 < value.length ) { day -= dim;
1294 < value.length ) { } while ( true );
1295 < value.length ) { }
1296  
1297 < value.length ) { date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
1298 < value.length ) { if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
1299 < value.length ) { throw "Invalid date"; // E.g. 31/02/00
1300 < value.length ) { }
1301 < value.length ) { return date;
1302 < value.length ) { },
1303  
1304 < value.length ) { /* Standard date formats. */
1305 < value.length ) { ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
1306 < value.length ) { COOKIE: "D, dd M yy",
1307 < value.length ) { ISO_8601: "yy-mm-dd",
1308 < value.length ) { RFC_822: "D, d M y",
1309 < value.length ) { RFC_850: "DD, dd-M-y",
1310 < value.length ) { RFC_1036: "D, d M y",
1311 < value.length ) { RFC_1123: "D, d M yy",
1312 < value.length ) { RFC_2822: "D, d M yy",
1313 < value.length ) { RSS: "D, d M y", // RFC 822
1314 < value.length ) { TICKS: "!",
1315 < value.length ) { TIMESTAMP: "@",
1316 < value.length ) { W3C: "yy-mm-dd", // ISO 8601
1317  
1318 < value.length ) { _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
1319 < value.length ) { Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
1320  
1321 < value.length ) { /* Format a date object into a string value.
1322 < value.length ) { * The format can be combinations of the following:
1323 < value.length ) { * d - day of month (no leading zero)
1324 < value.length ) { * dd - day of month (two digit)
1325 < value.length ) { * o - day of year (no leading zeros)
1326 < value.length ) { * oo - day of year (three digit)
1327 < value.length ) { * D - day name short
1328 < value.length ) { * DD - day name long
1329 < value.length ) { * m - month of year (no leading zero)
1330 < value.length ) { * mm - month of year (two digit)
1331 < value.length ) { * M - month name short
1332 < value.length ) { * MM - month name long
1333 < value.length ) { * y - year (two digit)
1334 < value.length ) { * yy - year (four digit)
1335 < value.length ) { * @ - Unix timestamp (ms since 01/01/1970)
1336 < value.length ) { * ! - Windows ticks (100ns since 01/01/0001)
1337 < value.length ) { * "..." - literal text
1338 < value.length ) { * '' - single quote
1339 < value.length ) { *
1340 < value.length ) { * @param format string - the desired format of the date
1341 < value.length ) { * @param date Date - the date value to format
1342 < value.length ) { * @param settings Object - attributes include:
1343 < value.length ) { * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
1344 < value.length ) { * dayNames string[7] - names of the days from Sunday (optional)
1345 < value.length ) { * monthNamesShort string[12] - abbreviated names of the months (optional)
1346 < value.length ) { * monthNames string[12] - names of the months (optional)
1347 < value.length ) { * @return string - the date in the above format
1348 < value.length ) { */
1349 < value.length ) { formatDate: function( format, date, settings ) {
1350 < value.length ) { if ( !date ) {
1351 < value.length ) { return "";
1352 < value.length ) { }
1353  
1354 < value.length ) { var iFormat,
1355 < value.length ) { dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
1356 < value.length ) { dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
1357 < value.length ) { monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
1358 < value.length ) { monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
1359  
1360 < value.length ) { // Check whether a format character is doubled
1361 < value.length ) { lookAhead = function( match ) {
1362 < value.length ) { var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1363 < value.length ) { if ( matches ) {
1364 < value.length ) { iFormat++;
1365 < value.length ) { }
1366 < value.length ) { return matches;
1367 < value.length ) { },
1368  
1369 < value.length ) { // Format a number, with leading zero if necessary
1370 < value.length ) { formatNumber = function( match, value, len ) {
1371 < value.length ) { var num = "" + value;
1372 < value.length ) { if ( lookAhead( match ) ) {
1373 < value.length ) { while ( num.length < len ) {
1374 < value.length ) { num = "0" + num;
1375 < value.length ) { }
1376 < value.length ) { }
1377 < value.length ) { return num;
1378 < value.length ) { },
1379  
1380 < value.length ) { // Format a name, short or long as requested
1381 < value.length ) { formatName = function( match, value, shortNames, longNames ) {
1382 < value.length ) { return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
1383 < value.length ) { },
1384 < value.length ) { output = "",
1385 < value.length ) { literal = false;
1386  
1387 < value.length ) { if ( date ) {
1388 < value.length ) { for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1389 < value.length ) { if ( literal ) {
1390 < value.length ) { if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1391 < value.length ) { literal = false;
1392 < value.length ) { } else {
1393 < value.length ) { output += format.charAt( iFormat );
1394 < value.length ) { }
1395 < value.length ) { } else {
1396 < value.length ) { switch ( format.charAt( iFormat ) ) {
1397 < value.length ) { case "d":
1398 < value.length ) { output += formatNumber( "d", date.getDate(), 2 );
1399 < value.length ) { break;
1400 < value.length ) { case "D":
1401 < value.length ) { output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
1402 < value.length ) { break;
1403 < value.length ) { case "o":
1404 < value.length ) { output += formatNumber( "o",
1405 < value.length ) { Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
1406 < value.length ) { break;
1407 < value.length ) { case "m":
1408 < value.length ) { output += formatNumber( "m", date.getMonth() + 1, 2 );
1409 < value.length ) { break;
1410 < value.length ) { case "M":
1411 < value.length ) { output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
1412 < value.length ) { break;
1413 < value.length ) { case "y":
1414 < value.length ) { output += ( lookAhead( "y" ) ? date.getFullYear() :
1415 < value.length ) { ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
1416 < value.length ) { break;
1417 < value.length ) { case "@":
1418 < value.length ) { output += date.getTime();
1419 < value.length ) { break;
1420 < value.length ) { case "!":
1421 < value.length ) { output += date.getTime() * 10000 + this._ticksTo1970;
1422 < value.length ) { break;
1423 < value.length ) { case "'":
1424 < value.length ) { if ( lookAhead( "'" ) ) {
1425 < value.length ) { output += "'";
1426 < value.length ) { } else {
1427 < value.length ) { literal = true;
1428 < value.length ) { }
1429 < value.length ) { break;
1430 < value.length ) { default:
1431 < value.length ) { output += format.charAt( iFormat );
1432 < value.length ) { }
1433 < value.length ) { }
1434 < value.length ) { }
1435 < value.length ) { }
1436 < value.length ) { return output;
1437 < value.length ) { },
1438  
1439 < value.length ) { /* Extract all possible characters from the date format. */
1440 < value.length ) { _possibleChars: function( format ) {
1441 < value.length ) { var iFormat,
1442 < value.length ) { chars = "",
1443 < value.length ) { literal = false,
1444  
1445 < value.length ) { // Check whether a format character is doubled
1446 < value.length ) { lookAhead = function( match ) {
1447 < value.length ) { var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
1448 < value.length ) { if ( matches ) {
1449 < value.length ) { iFormat++;
1450 < value.length ) { }
1451 < value.length ) { return matches;
1452 < value.length ) { };
1453  
1454 < value.length ) { for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
1455 < value.length ) { if ( literal ) {
1456 < value.length ) { if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
1457 < value.length ) { literal = false;
1458 < value.length ) { } else {
1459 < value.length ) { chars += format.charAt( iFormat );
1460 < value.length ) { }
1461 < value.length ) { } else {
1462 < value.length ) { switch ( format.charAt( iFormat ) ) {
1463 < value.length ) { case "d": case "m": case "y": case "@":
1464 < value.length ) { chars += "0123456789";
1465 < value.length ) { break;
1466 < value.length ) { case "D": case "M":
1467 < value.length ) { return null; // Accept anything
1468 < value.length ) { case "'":
1469 < value.length ) { if ( lookAhead( "'" ) ) {
1470 < value.length ) { chars += "'";
1471 < value.length ) { } else {
1472 < value.length ) { literal = true;
1473 < value.length ) { }
1474 < value.length ) { break;
1475 < value.length ) { default:
1476 < value.length ) { chars += format.charAt( iFormat );
1477 < value.length ) { }
1478 < value.length ) { }
1479 < value.length ) { }
1480 < value.length ) { return chars;
1481 < value.length ) { },
1482  
1483 < value.length ) { /* Get a setting value, defaulting if necessary. */
1484 < value.length ) { _get: function( inst, name ) {
1485 < value.length ) { return inst.settings[ name ] !== undefined ?
1486 < value.length ) { inst.settings[ name ] : this._defaults[ name ];
1487 < value.length ) { },
1488  
1489 < value.length ) { /* Parse existing date and initialise date picker. */
1490 < value.length ) { _setDateFromField: function( inst, noDefault ) {
1491 < value.length ) { if ( inst.input.val() === inst.lastVal ) {
1492 < value.length ) { return;
1493 < value.length ) { }
1494  
1495 < value.length ) { var dateFormat = this._get( inst, "dateFormat" ),
1496 < value.length ) { dates = inst.lastVal = inst.input ? inst.input.val() : null,
1497 < value.length ) { defaultDate = this._getDefaultDate( inst ),
1498 < value.length ) { date = defaultDate,
1499 < value.length ) { settings = this._getFormatConfig( inst );
1500  
1501 < value.length ) { try {
1502 < value.length ) { date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
1503 < value.length ) { } catch ( event ) {
1504 < value.length ) { dates = ( noDefault ? "" : dates );
1505 < value.length ) { }
1506 < value.length ) { inst.selectedDay = date.getDate();
1507 < value.length ) { inst.drawMonth = inst.selectedMonth = date.getMonth();
1508 < value.length ) { inst.drawYear = inst.selectedYear = date.getFullYear();
1509 < value.length ) { inst.currentDay = ( dates ? date.getDate() : 0 );
1510 < value.length ) { inst.currentMonth = ( dates ? date.getMonth() : 0 );
1511 < value.length ) { inst.currentYear = ( dates ? date.getFullYear() : 0 );
1512 < value.length ) { this._adjustInstDate( inst );
1513 < value.length ) { },
1514  
1515 < value.length ) { /* Retrieve the default date shown on opening. */
1516 < value.length ) { _getDefaultDate: function( inst ) {
1517 < value.length ) { return this._restrictMinMax( inst,
1518 < value.length ) { this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
1519 < value.length ) { },
1520  
1521 < value.length ) { /* A date may be specified as an exact value or a relative one. */
1522 < value.length ) { _determineDate: function( inst, date, defaultDate ) {
1523 < value.length ) { var offsetNumeric = function( offset ) {
1524 < value.length ) { var date = new Date();
1525 < value.length ) { date.setDate( date.getDate() + offset );
1526 < value.length ) { return date;
1527 < value.length ) { },
1528 < value.length ) { offsetString = function( offset ) {
1529 < value.length ) { try {
1530 < value.length ) { return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
1531 < value.length ) { offset, $.datepicker._getFormatConfig( inst ) );
1532 < value.length ) { }
1533 < value.length ) { catch ( e ) {
1534  
1535 < value.length ) { // Ignore
1536 < value.length ) { }
1537  
1538 < value.length ) { var date = ( offset.toLowerCase().match( /^c/ ) ?
1539 < value.length ) { $.datepicker._getDate( inst ) : null ) || new Date(),
1540 < value.length ) { year = date.getFullYear(),
1541 < value.length ) { month = date.getMonth(),
1542 < value.length ) { day = date.getDate(),
1543 < value.length ) { pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
1544 < value.length ) { matches = pattern.exec( offset );
1545  
1546 < value.length ) { while ( matches ) {
1547 < value.length ) { switch ( matches[ 2 ] || "d" ) {
1548 < value.length ) { case "d" : case "D" :
1549 < value.length ) { day += parseInt( matches[ 1 ], 10 ); break;
1550 < value.length ) { case "w" : case "W" :
1551 < value.length ) { day += parseInt( matches[ 1 ], 10 ) * 7; break;
1552 < value.length ) { case "m" : case "M" :
1553 < value.length ) { month += parseInt( matches[ 1 ], 10 );
1554 < value.length ) { day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
1555 < value.length ) { break;
1556 < value.length ) { case "y": case "Y" :
1557 < value.length ) { year += parseInt( matches[ 1 ], 10 );
1558 < value.length ) { day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
1559 < value.length ) { break;
1560 < value.length ) { }
1561 < value.length ) { matches = pattern.exec( offset );
1562 < value.length ) { }
1563 < value.length ) { return new Date( year, month, day );
1564 < value.length ) { },
1565 < value.length ) { newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
1566 < value.length ) { ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
1567  
1568 < value.length ) { newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
1569 < value.length ) { if ( newDate ) {
1570 < value.length ) { newDate.setHours( 0 );
1571 < value.length ) { newDate.setMinutes( 0 );
1572 < value.length ) { newDate.setSeconds( 0 );
1573 < value.length ) { newDate.setMilliseconds( 0 );
1574 < value.length ) { }
1575 < value.length ) { return this._daylightSavingAdjust( newDate );
1576 < value.length ) { },
1577  
1578 < value.length ) { /* Handle switch to/from daylight saving.
1579 < value.length ) { * Hours may be non-zero on daylight saving cut-over:
1580 < value.length ) { * > 12 when midnight changeover, but then cannot generate
1581 < value.length ) { * midnight datetime, so jump to 1AM, otherwise reset.
1582 < value.length ) { * @param date (Date) the date to check
1583 < value.length ) { * @return (Date) the corrected date
1584 < value.length ) { */
1585 < value.length ) { _daylightSavingAdjust: function( date ) {
1586 < value.length ) { if ( !date ) {
1587 < value.length ) { return null;
1588 < value.length ) { }
1589 < value.length ) { date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
1590 < value.length ) { return date;
1591 < value.length ) { },
1592  
1593 < value.length ) { /* Set the date(s) directly. */
1594 < value.length ) { _setDate: function( inst, date, noChange ) {
1595 < value.length ) { var clear = !date,
1596 < value.length ) { origMonth = inst.selectedMonth,
1597 < value.length ) { origYear = inst.selectedYear,
1598 < value.length ) { newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
1599  
1600 < value.length ) { inst.selectedDay = inst.currentDay = newDate.getDate();
1601 < value.length ) { inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
1602 < value.length ) { inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
1603 < value.length ) { if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
1604 < value.length ) { this._notifyChange( inst );
1605 < value.length ) { }
1606 < value.length ) { this._adjustInstDate( inst );
1607 < value.length ) { if ( inst.input ) {
1608 < value.length ) { inst.input.val( clear ? "" : this._formatDate( inst ) );
1609 < value.length ) { }
1610 < value.length ) { },
1611  
1612 < value.length ) { /* Retrieve the date(s) directly. */
1613 < value.length ) { _getDate: function( inst ) {
1614 < value.length ) { var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
1615 < value.length ) { this._daylightSavingAdjust( new Date(
1616 < value.length ) { inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
1617 < value.length ) { return startDate;
1618 < value.length ) { },
1619  
1620 < value.length ) { /* Attach the onxxx handlers. These are declared statically so
1621 < value.length ) { * they work with static code transformers like Caja.
1622 < value.length ) { */
1623 < value.length ) { _attachHandlers: function( inst ) {
1624 < value.length ) { var stepMonths = this._get( inst, "stepMonths" ),
1625 < value.length ) { id = "#" + inst.id.replace( /\\\\/g, "\\" );
1626 < value.length ) { inst.dpDiv.find( "[data-handler]" ).map( function() {
1627 < value.length ) { var handler = {
1628 < value.length ) { prev: function() {
1629 < value.length ) { $.datepicker._adjustDate( id, -stepMonths, "M" );
1630 < value.length ) { },
1631 < value.length ) { next: function() {
1632 < value.length ) { $.datepicker._adjustDate( id, +stepMonths, "M" );
1633 < value.length ) { },
1634 < value.length ) { hide: function() {
1635 < value.length ) { $.datepicker._hideDatepicker();
1636 < value.length ) { },
1637 < value.length ) { today: function() {
1638 < value.length ) { $.datepicker._gotoToday( id );
1639 < value.length ) { },
1640 < value.length ) { selectDay: function() {
1641 < value.length ) { $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
1642 < value.length ) { return false;
1643 < value.length ) { },
1644 < value.length ) { selectMonth: function() {
1645 < value.length ) { $.datepicker._selectMonthYear( id, this, "M" );
1646 < value.length ) { return false;
1647 < value.length ) { },
1648 < value.length ) { selectYear: function() {
1649 < value.length ) { $.datepicker._selectMonthYear( id, this, "Y" );
1650 < value.length ) { return false;
1651 < value.length ) { }
1652 < value.length ) { };
1653 < value.length ) { $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
1654 < value.length ) { } );
1655 < value.length ) { },
1656  
1657 < value.length ) { /* Generate the HTML for the current state of the date picker. */
1658 < value.length ) { _generateHTML: function( inst ) {
1659 < value.length ) { var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
1660 < value.length ) { controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
1661 < value.length ) { monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
1662 < value.length ) { selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
1663 < value.length ) { cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
1664 < value.length ) { printDate, dRow, tbody, daySettings, otherMonth, unselectable,
1665 < value.length ) { tempDate = new Date(),
1666 < value.length ) { today = this._daylightSavingAdjust(
1667 < value.length ) { new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
1668 < value.length ) { isRTL = this._get( inst, "isRTL" ),
1669 < value.length ) { showButtonPanel = this._get( inst, "showButtonPanel" ),
1670 < value.length ) { hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
1671 < value.length ) { navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
1672 < value.length ) { numMonths = this._getNumberOfMonths( inst ),
1673 < value.length ) { showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
1674 < value.length ) { stepMonths = this._get( inst, "stepMonths" ),
1675 < value.length ) { isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
1676 < value.length ) { currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
1677 < value.length ) { new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
1678 < value.length ) { minDate = this._getMinMaxDate( inst, "min" ),
1679 < value.length ) { maxDate = this._getMinMaxDate( inst, "max" ),
1680 < value.length ) { drawMonth = inst.drawMonth - showCurrentAtPos,
1681 < value.length ) { drawYear = inst.drawYear;
1682  
1683 < value.length ) { if ( drawMonth < 0 ) {
1684 < value.length ) { drawMonth += 12;
1685 < value.length ) { drawYear--;
1686 < value.length ) { }
1687 < value.length ) { if ( maxDate ) {
1688 < value.length ) { maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
1689 < value.length ) { maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
1690 < value.length ) { maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
1691 < value.length ) { while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
1692 < value.length ) { drawMonth--;
1693 < value.length ) { if ( drawMonth < 0 ) {
1694 < value.length ) { drawMonth = 11;
1695 < value.length ) { drawYear--;
1696 < value.length ) { }
1697 < value.length ) { }
1698 < value.length ) { }
1699 < value.length ) { inst.drawMonth = drawMonth;
1700 < value.length ) { inst.drawYear = drawYear;
1701  
1702 < value.length ) { prevText = this._get( inst, "prevText" );
1703 < value.length ) { prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
1704 < value.length ) { this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
1705 < value.length ) { this._getFormatConfig( inst ) ) );
1706  
1707 < value.length ) { prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
1708 < value.length ) { "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
1709 < value.length ) { " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span>a>" :
1710 < value.length ) { ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span>a>" ) );
1711  
1712 < value.length ) { nextText = this._get( inst, "nextText" );
1713 < value.length ) { nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
1714 < value.length ) { this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
1715 < value.length ) { this._getFormatConfig( inst ) ) );
1716  
1717 < value.length ) { next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
1718 < value.length ) { "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
1719 < value.length ) { " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span>a>" :
1720 < value.length ) { ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span>a>" ) );
1721  
1722 < value.length ) { currentText = this._get( inst, "currentText" );
1723 < value.length ) { gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
1724 < value.length ) { currentText = ( !navigationAsDateFormat ? currentText :
1725 < value.length ) { this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
1726  
1727 < value.length ) { controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
1728 < value.length ) { this._get( inst, "closeText" ) + "</button>" : "" );
1729  
1730 < value.length ) { buttonPanel = ( showButtonPanel ) ? "
" + ( isRTL ? controls : "" ) +
1731 < value.length ) {
( this._isInRange( inst, gotoDate ) ? "
1732 < value.length ) {
1733  
1734 < value.length ) {
1735 < value.length ) {
1736  
1737 < value.length ) {
1738 < value.length ) {
1739 < value.length ) {
1740 < value.length ) {
1741 < value.length ) {
1742 < value.length ) {
1743 < value.length ) {
1744 < value.length ) {
1745 < value.length ) {
1746 < value.length ) {
1747  
1748 < value.length ) {
1749 < value.length ) {
1750 < value.length ) {
1751 < value.length ) {
1752 < value.length ) {
1753 < value.length ) {
1754 < value.length ) {
1755 < value.length ) {
1756 < value.length ) {
1767 < value.length ) {
1769 < value.length ) {
1770 < value.length ) {
1771 < value.length ) {
1772 < value.length ) {
1773 < value.length ) {
1774 < value.length ) {
1775 < value.length ) {
1776 < value.length ) {
1777 < value.length ) {
1778 < value.length ) {
= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
1779 < value.length ) {
"" + dayNamesMin[ day ] + "span></th>";
1780 < value.length ) {
}
1781 < value.length ) {
calender += thead + "tr></thead>
1782 < value.length ) {
1783 < value.length ) {
1784 < value.length ) {
1785 < value.length ) {
1786 < value.length ) {
1787 < value.length ) {
1788 < value.length ) {
1789 < value.length ) {
1790 < value.length ) {
1791 < value.length ) {
1792 < value.length ) {
1793 < value.length ) {
1794 < value.length ) {
1795 < value.length ) {
1796 < value.length ) {
1797 < value.length ) {
1798 < value.length ) {
1799 < value.length ) {
1800 < value.length ) {
1801 < value.length ) {
1802 < value.length ) {
1803 < value.length ) {
1804 < value.length ) {
1805 < value.length ) {
1806  
1807 < value.length ) {
1808 < value.length ) {
1809 < value.length ) {
1810 < value.length ) {
1811 < value.length ) {
1812 < value.length ) {
1813 < value.length ) {
1814 < value.length ) {
1815 < value.length ) {
1816 < value.length ) {
1817 < value.length ) {
1818 < value.length ) {
1819 < value.length ) {
1820 < value.length ) {
1821 < value.length ) {
1822 < value.length ) {
1823 < value.length ) {
1824 < value.length ) {
1825 < value.length ) {
1826 < value.length ) {
1827 < value.length ) {
1828 < value.length ) {
1829 < value.length ) {
1830 < value.length ) {
1831 < value.length ) {
1832 < value.length ) {
1833 < value.length ) {
1834 < value.length ) {
1835 < value.length ) {
1836 < value.length ) {
1837 < value.length ) {
1838 < value.length ) {
1839 < value.length ) {
1840 < value.length ) {
1841  
1842 < value.length ) {
1843 < value.length ) {
1844 < value.length ) {
1845  
1846 < value.length ) {
1847 < value.length ) {
1848 < value.length ) {
1849 < value.length ) {
1850 < value.length ) {
1851 < value.length ) {
1852  
1853 < value.length ) {
1854 < value.length ) {
1855 < value.length ) {
1856 < value.length ) {
1857 < value.length ) {
1858 < value.length ) {
1859 < value.length ) {
1860 < value.length ) {
1861 < value.length ) {
1862 < value.length ) {
1863 < value.length ) {
1864 < value.length ) {
1865 < value.length ) {
1866 < value.length ) {
1867 < value.length ) {
1868 < value.length ) {
1869  
1870 < value.length ) {
1871 < value.length ) {
1872 < value.length ) {
1873  
1874 < value.length ) {
1875 < value.length ) {
1876 < value.length ) {
1877 < value.length ) {
1878 < value.length ) {
1879 < value.length ) {
1880  
1881 < value.length ) {
1882 < value.length ) {
1883 < value.length ) {
1884 < value.length ) {
1885 < value.length ) {
1886 < value.length ) {
1887 < value.length ) {
1888 < value.length ) {
1889 < value.length ) {
1890 < value.length ) {
1891 < value.length ) {
1892 < value.length ) {
1893 < value.length ) {
1894 < value.length ) {
1895 < value.length ) {
1896 < value.length ) {
1897 < value.length ) {
1898 < value.length ) {
1899 < value.length ) {
1900 < value.length ) {
1901  
1902 < value.length ) {
1903 < value.length ) {
1904 < value.length ) {
1905 < value.length ) {
1906  
1907 < value.length ) {
1908 < value.length ) {
1909 < value.length ) {
1910 < value.length ) {
1911 < value.length ) {
1912 < value.length ) {
1913 < value.length ) {
1914  
1915 < value.length ) {
1916 < value.length ) {
1917 < value.length ) {
1918 < value.length ) {
1919 < value.length ) {
1920 < value.length ) {
1921  
1922 < value.length ) {
1923 < value.length ) {
1924 < value.length ) {
1925 < value.length ) {
1926 < value.length ) {
1927 < value.length ) {
1928 < value.length ) {
1929  
1930 < value.length ) {
1931 < value.length ) {
1932 < value.length ) {
1933 < value.length ) {
1934 < value.length ) {
1935 < value.length ) {
1936 < value.length ) {
1937  
1938 < value.length ) {
1939 < value.length ) {
1940 < value.length ) {
1941 < value.length ) {
1942 < value.length ) {
1943 < value.length ) {
1944 < value.length ) {
1945 < value.length ) {
1946  
1947 < value.length ) {
1948 < value.length ) {
1949 < value.length ) {
1950 < value.length ) {
1951 < value.length ) {
1952  
1953 < value.length ) {
1954 < value.length ) {
1955 < value.length ) {
1956 < value.length ) {
1957  
1958 < value.length ) {
1959 < value.length ) {
1960 < value.length ) {
1961 < value.length ) {
1962  
1963 < value.length ) {
1964 < value.length ) {
1965 < value.length ) {
1966 < value.length ) {
1967  
1968 < value.length ) {
1969 < value.length ) {
1970 < value.length ) {
1971 < value.length ) {
1972 < value.length ) {
1973  
1974 < value.length ) {
1975 < value.length ) {
1976 < value.length ) {
1977 < value.length ) {
1978 < value.length ) {
1979  
1980 < value.length ) {
1981 < value.length ) {
1982 < value.length ) {
1983 < value.length ) {
1984 < value.length ) {
1985 < value.length ) {
1986 < value.length ) {
1987 < value.length ) {
1988 < value.length ) {
1989 < value.length ) {
1990 < value.length ) {
1991 < value.length ) {
1992 < value.length ) {
1993 < value.length ) {
1994 < value.length ) {
1995 < value.length ) {
1996 < value.length ) {
1997 < value.length ) {
1998 < value.length ) {
1999 < value.length ) {
2000  
2001 < value.length ) {
2002 < value.length ) {
2003 < value.length ) {
2004 < value.length ) {
2005 < value.length ) {
2006  
2007 < value.length ) {
2008 < value.length ) {
2009 < value.length ) {
2010 < value.length ) {
2011 < value.length ) {
2012 < value.length ) {
2013 < value.length ) {
2014 < value.length ) {
2015 < value.length ) {
2016  
2017 < value.length ) {
2018 < value.length ) {
2019 < value.length ) {
2020 < value.length ) {
2021 < value.length ) {
2022 < value.length ) {
2023 < value.length ) {
2024 < value.length ) {
2025 < value.length ) {
2026 < value.length ) {
2027 < value.length ) {
2028 < value.length ) {
2029 < value.length ) {
2030  
2031 < value.length ) {
2032 < value.length ) {
2033 < value.length ) {
2034 < value.length ) {
2035 < value.length ) {
2036 < value.length ) {
2037 < value.length ) {
2038 < value.length ) {
2039 < value.length ) {
2040 < value.length ) {
2041 < value.length ) {
2042 < value.length ) {
2043 < value.length ) {
2044 < value.length ) {
2045 < value.length ) {
2046 < value.length ) {
2047 < value.length ) {
2048 < value.length ) {
2049  
2050 < value.length ) {
2051 < value.length ) {
2052 < value.length ) {
2053 < value.length ) {
2054 < value.length ) {
2055 < value.length ) {
2056 < value.length ) {
2057 < value.length ) {
2058 < value.length ) {
2059 < value.length ) {
2060 < value.length ) {
2061 < value.length ) {
2062  
2063 < value.length ) {
2064 < value.length ) {
2065 < value.length ) {
2066 < value.length ) {
2067 < value.length ) {
2068 < value.length ) {
2069 < value.length ) {
2070 < value.length ) {
2071 < value.length ) {
2072 < value.length ) {
2073  
2074 < value.length ) {
2075 < value.length ) {
2076 < value.length ) {
2077 < value.length ) {
2078 < value.length ) {
2079  
2080 < value.length ) {
2081 < value.length ) {
2082 < value.length ) {
2083 < value.length ) {
2084  
2085 < value.length ) {
2086 < value.length ) {
2087 < value.length ) {
2088 < value.length ) {
2089 < value.length ) {
2090  
2091 < value.length ) {
2092 < value.length ) {
2093 < value.length ) {
2094 < value.length ) {
2095  
2096 < value.length ) {
2097 < value.length ) {
2098 < value.length ) {
2099 < value.length ) {
2100 < value.length ) {
2101 < value.length ) {
2102 < value.length ) {
2103 < value.length ) {
2104 < value.length ) {
2105 < value.length ) {
2106 < value.length ) {
2107 < value.length ) {
2108 < value.length ) {
2109 < value.length ) {
2110 < value.length ) {
2111 < value.length ) {
2112  
2113 < value.length ) {
2114 < value.length ) {
2115 < value.length ) {
2116 < value.length ) {
2117  
2118 < value.length ) {
2119  
2120 < value.length ) {