changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
20:7b1b88e27a20 | 21:48c4eec2b7e6 |
---|---|
1 /* eslint-disable max-len, camelcase */ |
1 /* eslint-disable max-len, camelcase */ |
2 /*! |
2 /*! |
3 * jQuery UI Datepicker 1.13.1 |
3 * jQuery UI Datepicker 1.13.3 |
4 * http://jqueryui.com |
4 * https://jqueryui.com |
5 * |
5 * |
6 * Copyright jQuery Foundation and other contributors |
6 * Copyright OpenJS Foundation and other contributors |
7 * Released under the MIT license. |
7 * Released under the MIT license. |
8 * http://jquery.org/license |
8 * https://jquery.org/license |
9 */ |
9 */ |
10 |
10 |
11 //>>label: Datepicker |
11 //>>label: Datepicker |
12 //>>group: Widgets |
12 //>>group: Widgets |
13 //>>description: Displays a calendar from an input or inline for selecting dates. |
13 //>>description: Displays a calendar from an input or inline for selecting dates. |
14 //>>docs: http://api.jqueryui.com/datepicker/ |
14 //>>docs: https://api.jqueryui.com/datepicker/ |
15 //>>demos: http://jqueryui.com/datepicker/ |
15 //>>demos: https://jqueryui.com/datepicker/ |
16 //>>css.structure: ../../themes/base/core.css |
16 //>>css.structure: ../../themes/base/core.css |
17 //>>css.structure: ../../themes/base/datepicker.css |
17 //>>css.structure: ../../themes/base/datepicker.css |
18 //>>css.theme: ../../themes/base/theme.css |
18 //>>css.theme: ../../themes/base/theme.css |
19 |
19 |
20 ( function( factory ) { |
20 ( function( factory ) { |
23 if ( typeof define === "function" && define.amd ) { |
23 if ( typeof define === "function" && define.amd ) { |
24 |
24 |
25 // AMD. Register as an anonymous module. |
25 // AMD. Register as an anonymous module. |
26 define( [ |
26 define( [ |
27 "jquery", |
27 "jquery", |
28 "./core" |
28 "../version", |
29 "../keycode" |
|
29 ], factory ); |
30 ], factory ); |
30 } else { |
31 } else { |
31 |
32 |
32 // Browser globals |
33 // Browser globals |
33 factory( jQuery ); |
34 factory( jQuery ); |
34 } |
35 } |
35 } )( function( $ ) { |
36 } )( function( $ ) { |
36 "use strict"; |
37 "use strict"; |
37 |
38 |
38 $.extend( $.ui, { datepicker: { version: "1.13.1" } } ); |
39 $.extend( $.ui, { datepicker: { version: "1.13.3" } } ); |
39 |
40 |
40 var datepicker_instActive; |
41 var datepicker_instActive; |
41 |
42 |
42 function datepicker_getZindex( elem ) { |
43 function datepicker_getZindex( elem ) { |
43 var position, value; |
44 var position, value; |
105 selectMonthLabel: "Select month", // Invisible label for month selector |
106 selectMonthLabel: "Select month", // Invisible label for month selector |
106 selectYearLabel: "Select year" // Invisible label for year selector |
107 selectYearLabel: "Select year" // Invisible label for year selector |
107 }; |
108 }; |
108 this._defaults = { // Global defaults for all the date picker instances |
109 this._defaults = { // Global defaults for all the date picker instances |
109 showOn: "focus", // "focus" for popup on focus, |
110 showOn: "focus", // "focus" for popup on focus, |
110 // "button" for trigger button, or "both" for either |
111 // "button" for trigger button, or "both" for either |
111 showAnim: "fadeIn", // Name of jQuery animation for popup |
112 showAnim: "fadeIn", // Name of jQuery animation for popup |
112 showOptions: {}, // Options for enhanced animations |
113 showOptions: {}, // Options for enhanced animations |
113 defaultDate: null, // Used when field is blank: actual date, |
114 defaultDate: null, // Used when field is blank: actual date, |
114 // +/-number for offset from today, null for today |
115 // +/-number for offset from today, null for today |
115 appendText: "", // Display text following the input box, e.g. showing the format |
116 appendText: "", // Display text following the input box, e.g. showing the format |
116 buttonText: "...", // Text for trigger button |
117 buttonText: "...", // Text for trigger button |
117 buttonImage: "", // URL for trigger button image |
118 buttonImage: "", // URL for trigger button image |
118 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button |
119 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button |
119 hideIfNoPrevNext: false, // True to hide next/previous month links |
120 hideIfNoPrevNext: false, // True to hide next/previous month links |
120 // if not applicable, false to just disable them |
121 // if not applicable, false to just disable them |
121 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links |
122 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links |
122 gotoCurrent: false, // True if today link goes back to current selection instead |
123 gotoCurrent: false, // True if today link goes back to current selection instead |
123 changeMonth: false, // True if month can be selected directly, false if only prev/next |
124 changeMonth: false, // True if month can be selected directly, false if only prev/next |
124 changeYear: false, // True if year can be selected directly, false if only prev/next |
125 changeYear: false, // True if year can be selected directly, false if only prev/next |
125 yearRange: "c-10:c+10", // Range of years to display in drop-down, |
126 yearRange: "c-10:c+10", // Range of years to display in drop-down, |
126 // either relative to today's year (-nn:+nn), relative to currently displayed year |
127 // either relative to today's year (-nn:+nn), relative to currently displayed year |
127 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) |
128 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) |
128 showOtherMonths: false, // True to show dates in other months, false to leave blank |
129 showOtherMonths: false, // True to show dates in other months, false to leave blank |
129 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable |
130 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable |
130 showWeek: false, // True to show week of the year, false to not show it |
131 showWeek: false, // True to show week of the year, false to not show it |
131 calculateWeek: this.iso8601Week, // How to calculate the week of the year, |
132 calculateWeek: this.iso8601Week, // How to calculate the week of the year, |
132 // takes a Date and returns the number of the week for it |
133 // takes a Date and returns the number of the week for it |
133 shortYearCutoff: "+10", // Short year values < this are in the current century, |
134 shortYearCutoff: "+10", // Short year values < this are in the current century, |
134 // > this are in the previous century, |
135 // > this are in the previous century, |
135 // string value starting with "+" for current year + value |
136 // string value starting with "+" for current year + value |
136 minDate: null, // The earliest selectable date, or null for no limit |
137 minDate: null, // The earliest selectable date, or null for no limit |
137 maxDate: null, // The latest selectable date, or null for no limit |
138 maxDate: null, // The latest selectable date, or null for no limit |
138 duration: "fast", // Duration of display/closure |
139 duration: "fast", // Duration of display/closure |
139 beforeShowDay: null, // Function that takes a date and returns an array with |
140 beforeShowDay: null, // Function that takes a date and returns an array with |
140 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", |
141 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", |
141 // [2] = cell title (optional), e.g. $.datepicker.noWeekends |
142 // [2] = cell title (optional), e.g. $.datepicker.noWeekends |
142 beforeShow: null, // Function that takes an input field and |
143 beforeShow: null, // Function that takes an input field and |
143 // returns a set of custom settings for the date picker |
144 // returns a set of custom settings for the date picker |
144 onSelect: null, // Define a callback function when a date is selected |
145 onSelect: null, // Define a callback function when a date is selected |
145 onChangeMonthYear: null, // Define a callback function when the month or year is changed |
146 onChangeMonthYear: null, // Define a callback function when the month or year is changed |
146 onClose: null, // Define a callback function when the datepicker is closed |
147 onClose: null, // Define a callback function when the datepicker is closed |
147 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated |
148 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated |
148 numberOfMonths: 1, // Number of months to show at a time |
149 numberOfMonths: 1, // Number of months to show at a time |
211 return { id: id, input: target, // associated target |
212 return { id: id, input: target, // associated target |
212 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection |
213 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection |
213 drawMonth: 0, drawYear: 0, // month being drawn |
214 drawMonth: 0, drawYear: 0, // month being drawn |
214 inline: inline, // is datepicker inline or not |
215 inline: inline, // is datepicker inline or not |
215 dpDiv: ( !inline ? this.dpDiv : // presentation div |
216 dpDiv: ( !inline ? this.dpDiv : // presentation div |
216 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; |
217 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; |
217 }, |
218 }, |
218 |
219 |
219 /* Attach the date picker to an input field. */ |
220 /* Attach the date picker to an input field. */ |
220 _connectDatepicker: function( target, inst ) { |
221 _connectDatepicker: function( target, inst ) { |
221 var input = $( target ); |
222 var input = $( target ); |
224 if ( input.hasClass( this.markerClassName ) ) { |
225 if ( input.hasClass( this.markerClassName ) ) { |
225 return; |
226 return; |
226 } |
227 } |
227 this._attachments( input, inst ); |
228 this._attachments( input, inst ); |
228 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). |
229 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). |
229 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); |
230 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); |
230 this._autoSize( inst ); |
231 this._autoSize( inst ); |
231 $.data( target, "datepicker", inst ); |
232 $.data( target, "datepicker", inst ); |
232 |
233 |
233 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) |
234 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) |
234 if ( inst.settings.disabled ) { |
235 if ( inst.settings.disabled ) { |
350 if ( inst.settings.disabled ) { |
351 if ( inst.settings.disabled ) { |
351 this._disableDatepicker( target ); |
352 this._disableDatepicker( target ); |
352 } |
353 } |
353 |
354 |
354 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements |
355 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements |
355 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height |
356 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height |
356 inst.dpDiv.css( "display", "block" ); |
357 inst.dpDiv.css( "display", "block" ); |
357 }, |
358 }, |
358 |
359 |
359 /* Pop-up the date picker in a "dialog" box. |
360 /* Pop-up the date picker in a "dialog" box. |
360 * @param input element - ignored |
361 * @param input element - ignored |
424 $.removeData( target, "datepicker" ); |
425 $.removeData( target, "datepicker" ); |
425 if ( nodeName === "input" ) { |
426 if ( nodeName === "input" ) { |
426 inst.append.remove(); |
427 inst.append.remove(); |
427 inst.trigger.remove(); |
428 inst.trigger.remove(); |
428 $target.removeClass( this.markerClassName ). |
429 $target.removeClass( this.markerClassName ). |
429 off( "focus", this._showDatepicker ). |
430 off( "focus", this._showDatepicker ). |
430 off( "keydown", this._doKeyDown ). |
431 off( "keydown", this._doKeyDown ). |
431 off( "keypress", this._doKeyPress ). |
432 off( "keypress", this._doKeyPress ). |
432 off( "keyup", this._doKeyUp ); |
433 off( "keyup", this._doKeyUp ); |
433 } else if ( nodeName === "div" || nodeName === "span" ) { |
434 } else if ( nodeName === "div" || nodeName === "span" ) { |
434 $target.removeClass( this.markerClassName ).empty(); |
435 $target.removeClass( this.markerClassName ).empty(); |
435 } |
436 } |
436 |
437 |
437 if ( datepicker_instActive === inst ) { |
438 if ( datepicker_instActive === inst ) { |
454 |
455 |
455 nodeName = target.nodeName.toLowerCase(); |
456 nodeName = target.nodeName.toLowerCase(); |
456 if ( nodeName === "input" ) { |
457 if ( nodeName === "input" ) { |
457 target.disabled = false; |
458 target.disabled = false; |
458 inst.trigger.filter( "button" ). |
459 inst.trigger.filter( "button" ). |
459 each( function() { |
460 each( function() { |
460 this.disabled = false; |
461 this.disabled = false; |
461 } ).end(). |
462 } ).end(). |
462 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); |
463 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); |
463 } else if ( nodeName === "div" || nodeName === "span" ) { |
464 } else if ( nodeName === "div" || nodeName === "span" ) { |
464 inline = $target.children( "." + this._inlineClass ); |
465 inline = $target.children( "." + this._inlineClass ); |
465 inline.children().removeClass( "ui-state-disabled" ); |
466 inline.children().removeClass( "ui-state-disabled" ); |
466 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). |
467 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). |
467 prop( "disabled", false ); |
468 prop( "disabled", false ); |
468 } |
469 } |
469 this._disabledInputs = $.map( this._disabledInputs, |
470 this._disabledInputs = $.map( this._disabledInputs, |
470 |
471 |
471 // Delete entry |
472 // Delete entry |
472 function( value ) { |
473 function( value ) { |
488 |
489 |
489 nodeName = target.nodeName.toLowerCase(); |
490 nodeName = target.nodeName.toLowerCase(); |
490 if ( nodeName === "input" ) { |
491 if ( nodeName === "input" ) { |
491 target.disabled = true; |
492 target.disabled = true; |
492 inst.trigger.filter( "button" ). |
493 inst.trigger.filter( "button" ). |
493 each( function() { |
494 each( function() { |
494 this.disabled = true; |
495 this.disabled = true; |
495 } ).end(). |
496 } ).end(). |
496 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); |
497 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); |
497 } else if ( nodeName === "div" || nodeName === "span" ) { |
498 } else if ( nodeName === "div" || nodeName === "span" ) { |
498 inline = $target.children( "." + this._inlineClass ); |
499 inline = $target.children( "." + this._inlineClass ); |
499 inline.children().addClass( "ui-state-disabled" ); |
500 inline.children().addClass( "ui-state-disabled" ); |
500 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). |
501 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). |
501 prop( "disabled", true ); |
502 prop( "disabled", true ); |
502 } |
503 } |
503 this._disabledInputs = $.map( this._disabledInputs, |
504 this._disabledInputs = $.map( this._disabledInputs, |
504 |
505 |
505 // Delete entry |
506 // Delete entry |
506 function( value ) { |
507 function( value ) { |
552 inst = this._getInst( target ); |
553 inst = this._getInst( target ); |
553 |
554 |
554 if ( arguments.length === 2 && typeof name === "string" ) { |
555 if ( arguments.length === 2 && typeof name === "string" ) { |
555 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : |
556 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : |
556 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : |
557 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : |
557 this._get( inst, name ) ) : null ) ); |
558 this._get( inst, name ) ) : null ) ); |
558 } |
559 } |
559 |
560 |
560 settings = name || {}; |
561 settings = name || {}; |
561 if ( typeof name === "string" ) { |
562 if ( typeof name === "string" ) { |
562 settings = {}; |
563 settings = {}; |
645 |
646 |
646 inst._keyEvent = true; |
647 inst._keyEvent = true; |
647 if ( $.datepicker._datepickerShowing ) { |
648 if ( $.datepicker._datepickerShowing ) { |
648 switch ( event.keyCode ) { |
649 switch ( event.keyCode ) { |
649 case 9: $.datepicker._hideDatepicker(); |
650 case 9: $.datepicker._hideDatepicker(); |
650 handled = false; |
651 handled = false; |
651 break; // hide on tab out |
652 break; // hide on tab out |
652 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + |
653 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + |
653 $.datepicker._currentClass + ")", inst.dpDiv ); |
654 $.datepicker._currentClass + ")", inst.dpDiv ); |
654 if ( sel[ 0 ] ) { |
655 if ( sel[ 0 ] ) { |
655 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); |
656 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); |
656 } |
657 } |
657 |
658 |
658 onSelect = $.datepicker._get( inst, "onSelect" ); |
659 onSelect = $.datepicker._get( inst, "onSelect" ); |
659 if ( onSelect ) { |
660 if ( onSelect ) { |
660 dateStr = $.datepicker._formatDate( inst ); |
661 dateStr = $.datepicker._formatDate( inst ); |
661 |
662 |
662 // Trigger custom callback |
663 // Trigger custom callback |
663 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); |
664 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); |
664 } else { |
665 } else { |
665 $.datepicker._hideDatepicker(); |
666 $.datepicker._hideDatepicker(); |
666 } |
667 } |
667 |
668 |
668 return false; // don't submit the form |
669 return false; // don't submit the form |
669 case 27: $.datepicker._hideDatepicker(); |
670 case 27: $.datepicker._hideDatepicker(); |
670 break; // hide on escape |
671 break; // hide on escape |
671 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
672 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
672 -$.datepicker._get( inst, "stepBigMonths" ) : |
|
673 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
|
674 break; // previous month/year on page up/+ ctrl |
|
675 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
|
676 +$.datepicker._get( inst, "stepBigMonths" ) : |
|
677 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
|
678 break; // next month/year on page down/+ ctrl |
|
679 case 35: if ( event.ctrlKey || event.metaKey ) { |
|
680 $.datepicker._clearDate( event.target ); |
|
681 } |
|
682 handled = event.ctrlKey || event.metaKey; |
|
683 break; // clear on ctrl or command +end |
|
684 case 36: if ( event.ctrlKey || event.metaKey ) { |
|
685 $.datepicker._gotoToday( event.target ); |
|
686 } |
|
687 handled = event.ctrlKey || event.metaKey; |
|
688 break; // current on ctrl or command +home |
|
689 case 37: if ( event.ctrlKey || event.metaKey ) { |
|
690 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); |
|
691 } |
|
692 handled = event.ctrlKey || event.metaKey; |
|
693 |
|
694 // -1 day on ctrl or command +left |
|
695 if ( event.originalEvent.altKey ) { |
|
696 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
|
697 -$.datepicker._get( inst, "stepBigMonths" ) : |
673 -$.datepicker._get( inst, "stepBigMonths" ) : |
698 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
674 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
699 } |
675 break; // previous month/year on page up/+ ctrl |
700 |
676 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
701 // next month/year on alt +left on Mac |
|
702 break; |
|
703 case 38: if ( event.ctrlKey || event.metaKey ) { |
|
704 $.datepicker._adjustDate( event.target, -7, "D" ); |
|
705 } |
|
706 handled = event.ctrlKey || event.metaKey; |
|
707 break; // -1 week on ctrl or command +up |
|
708 case 39: if ( event.ctrlKey || event.metaKey ) { |
|
709 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); |
|
710 } |
|
711 handled = event.ctrlKey || event.metaKey; |
|
712 |
|
713 // +1 day on ctrl or command +right |
|
714 if ( event.originalEvent.altKey ) { |
|
715 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
|
716 +$.datepicker._get( inst, "stepBigMonths" ) : |
677 +$.datepicker._get( inst, "stepBigMonths" ) : |
717 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
678 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
718 } |
679 break; // next month/year on page down/+ ctrl |
719 |
680 case 35: if ( event.ctrlKey || event.metaKey ) { |
720 // next month/year on alt +right |
681 $.datepicker._clearDate( event.target ); |
721 break; |
682 } |
683 handled = event.ctrlKey || event.metaKey; |
|
684 break; // clear on ctrl or command +end |
|
685 case 36: if ( event.ctrlKey || event.metaKey ) { |
|
686 $.datepicker._gotoToday( event.target ); |
|
687 } |
|
688 handled = event.ctrlKey || event.metaKey; |
|
689 break; // current on ctrl or command +home |
|
690 case 37: if ( event.ctrlKey || event.metaKey ) { |
|
691 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); |
|
692 } |
|
693 handled = event.ctrlKey || event.metaKey; |
|
694 |
|
695 // -1 day on ctrl or command +left |
|
696 if ( event.originalEvent.altKey ) { |
|
697 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
|
698 -$.datepicker._get( inst, "stepBigMonths" ) : |
|
699 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
|
700 } |
|
701 |
|
702 // next month/year on alt +left on Mac |
|
703 break; |
|
704 case 38: if ( event.ctrlKey || event.metaKey ) { |
|
705 $.datepicker._adjustDate( event.target, -7, "D" ); |
|
706 } |
|
707 handled = event.ctrlKey || event.metaKey; |
|
708 break; // -1 week on ctrl or command +up |
|
709 case 39: if ( event.ctrlKey || event.metaKey ) { |
|
710 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); |
|
711 } |
|
712 handled = event.ctrlKey || event.metaKey; |
|
713 |
|
714 // +1 day on ctrl or command +right |
|
715 if ( event.originalEvent.altKey ) { |
|
716 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? |
|
717 +$.datepicker._get( inst, "stepBigMonths" ) : |
|
718 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); |
|
719 } |
|
720 |
|
721 // next month/year on alt +right |
|
722 break; |
|
722 case 40: if ( event.ctrlKey || event.metaKey ) { |
723 case 40: if ( event.ctrlKey || event.metaKey ) { |
723 $.datepicker._adjustDate( event.target, +7, "D" ); |
724 $.datepicker._adjustDate( event.target, +7, "D" ); |
724 } |
725 } |
725 handled = event.ctrlKey || event.metaKey; |
726 handled = event.ctrlKey || event.metaKey; |
726 break; // +1 week on ctrl or command +down |
727 break; // +1 week on ctrl or command +down |
727 default: handled = false; |
728 default: handled = false; |
728 } |
729 } |
729 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home |
730 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home |
730 $.datepicker._showDatepicker( this ); |
731 $.datepicker._showDatepicker( this ); |
731 } else { |
732 } else { |
835 |
836 |
836 // fix width for dynamic number of date pickers |
837 // fix width for dynamic number of date pickers |
837 // and adjust position before showing |
838 // and adjust position before showing |
838 offset = $.datepicker._checkOffset( inst, offset, isFixed ); |
839 offset = $.datepicker._checkOffset( inst, offset, isFixed ); |
839 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? |
840 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? |
840 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", |
841 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", |
841 left: offset.left + "px", top: offset.top + "px" } ); |
842 left: offset.left + "px", top: offset.top + "px" } ); |
842 |
843 |
843 if ( !inst.inline ) { |
844 if ( !inst.inline ) { |
844 showAnim = $.datepicker._get( inst, "showAnim" ); |
845 showAnim = $.datepicker._get( inst, "showAnim" ); |
845 duration = $.datepicker._get( inst, "duration" ); |
846 duration = $.datepicker._get( inst, "duration" ); |
881 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); |
882 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); |
882 if ( cols > 1 ) { |
883 if ( cols > 1 ) { |
883 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); |
884 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); |
884 } |
885 } |
885 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + |
886 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + |
886 "Class" ]( "ui-datepicker-multi" ); |
887 "Class" ]( "ui-datepicker-multi" ); |
887 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + |
888 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + |
888 "Class" ]( "ui-datepicker-rtl" ); |
889 "Class" ]( "ui-datepicker-rtl" ); |
889 |
890 |
890 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { |
891 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { |
891 inst.input.trigger( "focus" ); |
892 inst.input.trigger( "focus" ); |
892 } |
893 } |
893 |
894 |
1018 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && |
1019 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && |
1019 !$target.hasClass( $.datepicker.markerClassName ) && |
1020 !$target.hasClass( $.datepicker.markerClassName ) && |
1020 !$target.closest( "." + $.datepicker._triggerClass ).length && |
1021 !$target.closest( "." + $.datepicker._triggerClass ).length && |
1021 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || |
1022 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || |
1022 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { |
1023 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { |
1023 $.datepicker._hideDatepicker(); |
1024 $.datepicker._hideDatepicker(); |
1024 } |
1025 } |
1025 }, |
1026 }, |
1026 |
1027 |
1027 /* Adjust one of the date sub-fields. */ |
1028 /* Adjust one of the date sub-fields. */ |
1028 _adjustDate: function( id, offset, period ) { |
1029 _adjustDate: function( id, offset, period ) { |
1060 _selectMonthYear: function( id, select, period ) { |
1061 _selectMonthYear: function( id, select, period ) { |
1061 var target = $( id ), |
1062 var target = $( id ), |
1062 inst = this._getInst( target[ 0 ] ); |
1063 inst = this._getInst( target[ 0 ] ); |
1063 |
1064 |
1064 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = |
1065 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = |
1065 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = |
1066 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = |
1066 parseInt( select.options[ select.selectedIndex ].value, 10 ); |
1067 parseInt( select.options[ select.selectedIndex ].value, 10 ); |
1067 |
1068 |
1068 this._notifyChange( inst ); |
1069 this._notifyChange( inst ); |
1069 this._adjustDate( target ); |
1070 this._adjustDate( target ); |
1070 }, |
1071 }, |
1071 |
1072 |
1212 |
1213 |
1213 // Extract a number from the string value |
1214 // Extract a number from the string value |
1214 getNumber = function( match ) { |
1215 getNumber = function( match ) { |
1215 var isDoubled = lookAhead( match ), |
1216 var isDoubled = lookAhead( match ), |
1216 size = ( match === "@" ? 14 : ( match === "!" ? 20 : |
1217 size = ( match === "@" ? 14 : ( match === "!" ? 20 : |
1217 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), |
1218 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), |
1218 minSize = ( match === "y" ? size : 1 ), |
1219 minSize = ( match === "y" ? size : 1 ), |
1219 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), |
1220 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), |
1220 num = value.substring( iValue ).match( digits ); |
1221 num = value.substring( iValue ).match( digits ); |
1221 if ( !num ) { |
1222 if ( !num ) { |
1222 throw "Missing number at position " + iValue; |
1223 throw "Missing number at position " + iValue; |
1575 |
1576 |
1576 // Ignore |
1577 // Ignore |
1577 } |
1578 } |
1578 |
1579 |
1579 var date = ( offset.toLowerCase().match( /^c/ ) ? |
1580 var date = ( offset.toLowerCase().match( /^c/ ) ? |
1580 $.datepicker._getDate( inst ) : null ) || new Date(), |
1581 $.datepicker._getDate( inst ) : null ) || new Date(), |
1581 year = date.getFullYear(), |
1582 year = date.getFullYear(), |
1582 month = date.getMonth(), |
1583 month = date.getMonth(), |
1583 day = date.getDate(), |
1584 day = date.getDate(), |
1584 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, |
1585 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, |
1585 matches = pattern.exec( offset ); |
1586 matches = pattern.exec( offset ); |
1652 |
1653 |
1653 /* Retrieve the date(s) directly. */ |
1654 /* Retrieve the date(s) directly. */ |
1654 _getDate: function( inst ) { |
1655 _getDate: function( inst ) { |
1655 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : |
1656 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : |
1656 this._daylightSavingAdjust( new Date( |
1657 this._daylightSavingAdjust( new Date( |
1657 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); |
1658 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); |
1658 return startDate; |
1659 return startDate; |
1659 }, |
1660 }, |
1660 |
1661 |
1661 /* Attach the onxxx handlers. These are declared statically so |
1662 /* Attach the onxxx handlers. These are declared statically so |
1662 * they work with static code transformers like Caja. |
1663 * they work with static code transformers like Caja. |
1663 */ |
1664 */ |
1880 } |
1881 } |
1881 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + |
1882 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + |
1882 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + |
1883 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + |
1883 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + |
1884 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + |
1884 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, |
1885 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, |
1885 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers |
1886 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers |
1886 "</div><table class='ui-datepicker-calendar'><thead>" + |
1887 "</div><table class='ui-datepicker-calendar'><thead>" + |
1887 "<tr>"; |
1888 "<tr>"; |
1888 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); |
1889 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); |
1889 for ( dow = 0; dow < 7; dow++ ) { // days of the week |
1890 for ( dow = 0; dow < 7; dow++ ) { // days of the week |
1890 day = ( dow + firstDay ) % 7; |
1891 day = ( dow + firstDay ) % 7; |
1915 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends |
1916 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends |
1916 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months |
1917 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months |
1917 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key |
1918 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key |
1918 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? |
1919 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? |
1919 |
1920 |
1920 // or defaultDate is current printedDate and defaultDate is selectedDate |
1921 // or defaultDate is current printedDate and defaultDate is selectedDate |
1921 " " + this._dayOverClass : "" ) + // highlight selected day |
1922 " " + this._dayOverClass : "" ) + // highlight selected day |
1922 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days |
1923 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days |
1923 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates |
1924 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates |
1924 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day |
1925 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day |
1925 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) |
1926 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) |
1926 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title |
1927 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title |
1927 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions |
1928 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions |
1928 ( otherMonth && !showOtherMonths ? " " : // display for other months |
1929 ( otherMonth && !showOtherMonths ? " " : // display for other months |
1929 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + |
1930 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + |
1930 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + |
1931 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + |
1931 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day |
1932 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day |
1932 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months |
1933 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months |
1933 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader |
1934 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader |
1934 "' data-date='" + printDate.getDate() + // store date as data |
1935 "' data-date='" + printDate.getDate() + // store date as data |
1935 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date |
1936 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date |
1936 printDate.setDate( printDate.getDate() + 1 ); |
1937 printDate.setDate( printDate.getDate() + 1 ); |
1937 printDate = this._daylightSavingAdjust( printDate ); |
1938 printDate = this._daylightSavingAdjust( printDate ); |
1938 } |
1939 } |
1939 calender += tbody + "</tr>"; |
1940 calender += tbody + "</tr>"; |
1940 } |
1941 } |
1942 if ( drawMonth > 11 ) { |
1943 if ( drawMonth > 11 ) { |
1943 drawMonth = 0; |
1944 drawMonth = 0; |
1944 drawYear++; |
1945 drawYear++; |
1945 } |
1946 } |
1946 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + |
1947 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + |
1947 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); |
1948 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); |
1948 group += calender; |
1949 group += calender; |
1949 } |
1950 } |
1950 html += group; |
1951 html += group; |
1951 } |
1952 } |
1952 html += buttonPanel; |
1953 html += buttonPanel; |
1954 return html; |
1955 return html; |
1955 }, |
1956 }, |
1956 |
1957 |
1957 /* Generate the month and year header. */ |
1958 /* Generate the month and year header. */ |
1958 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, |
1959 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, |
1959 secondary, monthNames, monthNamesShort ) { |
1960 secondary, monthNames, monthNamesShort ) { |
1960 |
1961 |
1961 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, |
1962 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, |
1962 changeMonth = this._get( inst, "changeMonth" ), |
1963 changeMonth = this._get( inst, "changeMonth" ), |
1963 changeYear = this._get( inst, "changeYear" ), |
1964 changeYear = this._get( inst, "changeYear" ), |
1964 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), |
1965 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), |
1999 years = this._get( inst, "yearRange" ).split( ":" ); |
2000 years = this._get( inst, "yearRange" ).split( ":" ); |
2000 thisYear = new Date().getFullYear(); |
2001 thisYear = new Date().getFullYear(); |
2001 determineYear = function( value ) { |
2002 determineYear = function( value ) { |
2002 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : |
2003 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : |
2003 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : |
2004 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : |
2004 parseInt( value, 10 ) ) ); |
2005 parseInt( value, 10 ) ) ); |
2005 return ( isNaN( year ) ? thisYear : year ); |
2006 return ( isNaN( year ) ? thisYear : year ); |
2006 }; |
2007 }; |
2007 year = determineYear( years[ 0 ] ); |
2008 year = determineYear( years[ 0 ] ); |
2008 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); |
2009 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); |
2009 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); |
2010 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); |
2084 |
2085 |
2085 /* Determines if we should allow a "next/prev" month display change. */ |
2086 /* Determines if we should allow a "next/prev" month display change. */ |
2086 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { |
2087 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { |
2087 var numMonths = this._getNumberOfMonths( inst ), |
2088 var numMonths = this._getNumberOfMonths( inst ), |
2088 date = this._daylightSavingAdjust( new Date( curYear, |
2089 date = this._daylightSavingAdjust( new Date( curYear, |
2089 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); |
2090 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); |
2090 |
2091 |
2091 if ( offset < 0 ) { |
2092 if ( offset < 0 ) { |
2092 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); |
2093 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); |
2093 } |
2094 } |
2094 return this._isInRange( inst, date ); |
2095 return this._isInRange( inst, date ); |
2100 minDate = this._getMinMaxDate( inst, "min" ), |
2101 minDate = this._getMinMaxDate( inst, "min" ), |
2101 maxDate = this._getMinMaxDate( inst, "max" ), |
2102 maxDate = this._getMinMaxDate( inst, "max" ), |
2102 minYear = null, |
2103 minYear = null, |
2103 maxYear = null, |
2104 maxYear = null, |
2104 years = this._get( inst, "yearRange" ); |
2105 years = this._get( inst, "yearRange" ); |
2105 if ( years ) { |
2106 if ( years ) { |
2106 yearSplit = years.split( ":" ); |
2107 yearSplit = years.split( ":" ); |
2107 currentYear = new Date().getFullYear(); |
2108 currentYear = new Date().getFullYear(); |
2108 minYear = parseInt( yearSplit[ 0 ], 10 ); |
2109 minYear = parseInt( yearSplit[ 0 ], 10 ); |
2109 maxYear = parseInt( yearSplit[ 1 ], 10 ); |
2110 maxYear = parseInt( yearSplit[ 1 ], 10 ); |
2110 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { |
2111 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { |
2111 minYear += currentYear; |
2112 minYear += currentYear; |
2112 } |
2113 } |
2113 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { |
2114 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { |
2114 maxYear += currentYear; |
2115 maxYear += currentYear; |
2115 } |
2116 } |
2116 } |
2117 } |
2117 |
2118 |
2118 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && |
2119 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && |
2119 ( !maxDate || date.getTime() <= maxDate.getTime() ) && |
2120 ( !maxDate || date.getTime() <= maxDate.getTime() ) && |
2120 ( !minYear || date.getFullYear() >= minYear ) && |
2121 ( !minYear || date.getFullYear() >= minYear ) && |
2121 ( !maxYear || date.getFullYear() <= maxYear ) ); |
2122 ( !maxYear || date.getFullYear() <= maxYear ) ); |
2137 inst.currentDay = inst.selectedDay; |
2138 inst.currentDay = inst.selectedDay; |
2138 inst.currentMonth = inst.selectedMonth; |
2139 inst.currentMonth = inst.selectedMonth; |
2139 inst.currentYear = inst.selectedYear; |
2140 inst.currentYear = inst.selectedYear; |
2140 } |
2141 } |
2141 var date = ( day ? ( typeof day === "object" ? day : |
2142 var date = ( day ? ( typeof day === "object" ? day : |
2142 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : |
2143 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : |
2143 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); |
2144 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); |
2144 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); |
2145 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); |
2145 } |
2146 } |
2146 } ); |
2147 } ); |
2147 |
2148 |
2151 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. |
2152 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. |
2152 */ |
2153 */ |
2153 function datepicker_bindHover( dpDiv ) { |
2154 function datepicker_bindHover( dpDiv ) { |
2154 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; |
2155 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; |
2155 return dpDiv.on( "mouseout", selector, function() { |
2156 return dpDiv.on( "mouseout", selector, function() { |
2156 $( this ).removeClass( "ui-state-hover" ); |
2157 $( this ).removeClass( "ui-state-hover" ); |
2157 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { |
2158 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { |
2158 $( this ).removeClass( "ui-datepicker-prev-hover" ); |
2159 $( this ).removeClass( "ui-datepicker-prev-hover" ); |
2159 } |
2160 } |
2160 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { |
2161 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { |
2161 $( this ).removeClass( "ui-datepicker-next-hover" ); |
2162 $( this ).removeClass( "ui-datepicker-next-hover" ); |
2162 } |
2163 } |
2163 } ) |
2164 } ) |
2164 .on( "mouseover", selector, datepicker_handleMouseover ); |
2165 .on( "mouseover", selector, datepicker_handleMouseover ); |
2165 } |
2166 } |
2166 |
2167 |
2167 function datepicker_handleMouseover() { |
2168 function datepicker_handleMouseover() { |
2168 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { |
2169 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { |
2211 } |
2212 } |
2212 |
2213 |
2213 var otherArgs = Array.prototype.slice.call( arguments, 1 ); |
2214 var otherArgs = Array.prototype.slice.call( arguments, 1 ); |
2214 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { |
2215 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { |
2215 return $.datepicker[ "_" + options + "Datepicker" ]. |
2216 return $.datepicker[ "_" + options + "Datepicker" ]. |
2216 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); |
2217 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); |
2217 } |
2218 } |
2218 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { |
2219 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { |
2219 return $.datepicker[ "_" + options + "Datepicker" ]. |
2220 return $.datepicker[ "_" + options + "Datepicker" ]. |
2220 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); |
2221 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); |
2221 } |
2222 } |
2222 return this.each( function() { |
2223 return this.each( function() { |
2223 if ( typeof options === "string" ) { |
2224 if ( typeof options === "string" ) { |
2224 $.datepicker[ "_" + options + "Datepicker" ] |
2225 $.datepicker[ "_" + options + "Datepicker" ] |
2225 .apply( $.datepicker, [ this ].concat( otherArgs ) ); |
2226 .apply( $.datepicker, [ this ].concat( otherArgs ) ); |
2230 }; |
2231 }; |
2231 |
2232 |
2232 $.datepicker = new Datepicker(); // singleton instance |
2233 $.datepicker = new Datepicker(); // singleton instance |
2233 $.datepicker.initialized = false; |
2234 $.datepicker.initialized = false; |
2234 $.datepicker.uuid = new Date().getTime(); |
2235 $.datepicker.uuid = new Date().getTime(); |
2235 $.datepicker.version = "1.13.1"; |
2236 $.datepicker.version = "1.13.3"; |
2236 |
2237 |
2237 return $.datepicker; |
2238 return $.datepicker; |
2238 |
2239 |
2239 } ); |
2240 } ); |