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