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