vendor: 2,680 bytes, lines 1-69
1/*! jQuery UI - v1.14.0 - 2024-09-11 2* https://jqueryui.com 3* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js 4* Copyright OpenJS Foundation and other contributors; Licensed MIT */ 5 6( function( factory ) { 7 "use strict"; 8 9 if ( typeof define === "function" && define.amd ) { 10 11 // AMD. Register as an anonymous module. 12 define( [ "jquery" ], factory ); 13 } else { 14 15 // Browser globals 16 factory( jQuery ); 17 } 18} )( function( $ ) { 19"use strict"; 20 21$.ui = $.ui || {}; 22 23var version = $.ui.version = "1.14.0"; 24 25 26/*! 27 * jQuery UI Widget 1.14.0 28 * https://jqueryui.com 29 * 30 * Copyright OpenJS Foundation and other contributors 31 * Released under the MIT license. 32 * https://jquery.org/license 33 */ 34 35//>>label: Widget 36//>>group: Core 37//>>description: Provides a factory for creating stateful widgets with a common API. 38//>>docs: https://api.jqueryui.com/jQuery.widget/ 39//>>demos: https://jqueryui.com/widget/ 40 41 42var widgetUuid = 0; 43var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 44var widgetSlice = Array.prototype.slice; 45 46$.cleanData = ( function( orig ) { 47 return function( elems ) { 48 var events, elem, i; 49 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 50 51 // Only trigger remove when necessary to save time 52 events = $._data( elem, "events" ); 53 if ( events && events.remove ) { 54 $( elem ).triggerHandler( "remove" ); 55 } 56 } 57 orig( elems ); 58 }; 59} )( $.cleanData ); 60 61$.widget = function( name, base, prototype ) { 62 var existingConstructor, constructor, basePrototype; 63 64 // ProxiedPrototype allows the provided prototype to remain unmodified 65 // so that it can be used as a mixin for multiple widgets (#8876) 66 var proxiedPrototype = {}; 67 68 var namespace = name.split( "." )[ 0 ]; 69 name = name.split( "." )[ 1 ];
vendor: 18,825 bytes, lines 69-769
69 70 var fullName = namespace + "-" + name; 71 72 if ( !prototype ) { 73 prototype = base; 74 base = $.Widget; 75 } 76 77 if ( Array.isArray( prototype ) ) { 78 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 79 } 80 81 // Create selector for plugin 82 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 83 return !!$.data( elem, fullName ); 84 }; 85 86 $[ namespace ] = $[ namespace ] || {}; 87 existingConstructor = $[ namespace ][ name ]; 88 constructor = $[ namespace ][ name ] = function( options, element ) { 89 90 // Allow instantiation without "new" keyword 91 if ( !this || !this._createWidget ) { 92 return new constructor( options, element ); 93 } 94 95 // Allow instantiation without initializing for simple inheritance 96 // must use "new" keyword (the code above always passes args) 97 if ( arguments.length ) { 98 this._createWidget( options, element ); 99 } 100 }; 101 102 // Extend with the existing constructor to carry over any static properties 103 $.extend( constructor, existingConstructor, { 104 version: prototype.version, 105 106 // Copy the object used to create the prototype in case we need to 107 // redefine the widget later 108 _proto: $.extend( {}, prototype ), 109 110 // Track widgets that inherit from this widget in case this widget is 111 // redefined after a widget inherits from it 112 _childConstructors: [] 113 } ); 114 115 basePrototype = new base(); 116 117 // We need to make the options hash a property directly on the new instance 118 // otherwise we'll modify the options hash on the prototype that we're 119 // inheriting from 120 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 121 $.each( prototype, function( prop, value ) { 122 if ( typeof value !== "function" ) { 123 proxiedPrototype[ prop ] = value; 124 return; 125 } 126 proxiedPrototype[ prop ] = ( function() { 127 function _super() { 128 return base.prototype[ prop ].apply( this, arguments ); 129 } 130 131 function _superApply( args ) { 132 return base.prototype[ prop ].apply( this, args ); 133 } 134 135 return function() { 136 var __super = this._super; 137 var __superApply = this._superApply; 138 var returnValue; 139 140 this._super = _super; 141 this._superApply = _superApply; 142 143 returnValue = value.apply( this, arguments ); 144 145 this._super = __super; 146 this._superApply = __superApply; 147 148 return returnValue; 149 }; 150 } )(); 151 } ); 152 constructor.prototype = $.widget.extend( basePrototype, { 153 154 // TODO: remove support for widgetEventPrefix 155 // always use the name + a colon as the prefix, e.g., draggable:start 156 // don't prefix for widgets that aren't DOM-based 157 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 158 }, proxiedPrototype, { 159 constructor: constructor, 160 namespace: namespace, 161 widgetName: name, 162 widgetFullName: fullName 163 } ); 164 165 // If this widget is being redefined then we need to find all widgets that 166 // are inheriting from it and redefine all of them so that they inherit from 167 // the new version of this widget. We're essentially trying to replace one 168 // level in the prototype chain. 169 if ( existingConstructor ) { 170 $.each( existingConstructor._childConstructors, function( i, child ) { 171 var childPrototype = child.prototype; 172 173 // Redefine the child widget using the same prototype that was 174 // originally used, but inherit from the new version of the base 175 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 176 child._proto ); 177 } ); 178 179 // Remove the list of existing child constructors from the old constructor 180 // so the old child constructors can be garbage collected 181 delete existingConstructor._childConstructors; 182 } else { 183 base._childConstructors.push( constructor ); 184 } 185 186 $.widget.bridge( name, constructor ); 187 188 return constructor; 189}; 190 191$.widget.extend = function( target ) { 192 var input = widgetSlice.call( arguments, 1 ); 193 var inputIndex = 0; 194 var inputLength = input.length; 195 var key; 196 var value; 197 198 for ( ; inputIndex < inputLength; inputIndex++ ) { 199 for ( key in input[ inputIndex ] ) { 200 value = input[ inputIndex ][ key ]; 201 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 202 203 // Clone objects 204 if ( $.isPlainObject( value ) ) { 205 target[ key ] = $.isPlainObject( target[ key ] ) ? 206 $.widget.extend( {}, target[ key ], value ) : 207 208 // Don't extend strings, arrays, etc. with objects 209 $.widget.extend( {}, value ); 210 211 // Copy everything else by reference 212 } else { 213 target[ key ] = value; 214 } 215 } 216 } 217 } 218 return target; 219}; 220 221$.widget.bridge = function( name, object ) { 222 var fullName = object.prototype.widgetFullName || name; 223 $.fn[ name ] = function( options ) { 224 var isMethodCall = typeof options === "string"; 225 var args = widgetSlice.call( arguments, 1 ); 226 var returnValue = this; 227 228 if ( isMethodCall ) { 229 230 // If this is an empty collection, we need to have the instance method 231 // return undefined instead of the jQuery instance 232 if ( !this.length && options === "instance" ) { 233 returnValue = undefined; 234 } else { 235 this.each( function() { 236 var methodValue; 237 var instance = $.data( this, fullName ); 238 239 if ( options === "instance" ) { 240 returnValue = instance; 241 return false; 242 } 243 244 if ( !instance ) { 245 return $.error( "cannot call methods on " + name + 246 " prior to initialization; " + 247 "attempted to call method '" + options + "'" ); 248 } 249 250 if ( typeof instance[ options ] !== "function" || 251 options.charAt( 0 ) === "_" ) { 252 return $.error( "no such method '" + options + "' for " + name + 253 " widget instance" ); 254 } 255 256 methodValue = instance[ options ].apply( instance, args ); 257 258 if ( methodValue !== instance && methodValue !== undefined ) { 259 returnValue = methodValue && methodValue.jquery ? 260 returnValue.pushStack( methodValue.get() ) : 261 methodValue; 262 return false; 263 } 264 } ); 265 } 266 } else { 267 268 // Allow multiple hashes to be passed on init 269 if ( args.length ) { 270 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 271 } 272 273 this.each( function() { 274 var instance = $.data( this, fullName ); 275 if ( instance ) { 276 instance.option( options || {} ); 277 if ( instance._init ) { 278 instance._init(); 279 } 280 } else { 281 $.data( this, fullName, new object( options, this ) ); 282 } 283 } ); 284 } 285 286 return returnValue; 287 }; 288}; 289 290$.Widget = function( /* options, element */ ) {}; 291$.Widget._childConstructors = []; 292 293$.Widget.prototype = { 294 widgetName: "widget", 295 widgetEventPrefix: "", 296 defaultElement: "<div>", 297 298 options: { 299 classes: {}, 300 disabled: false, 301 302 // Callbacks 303 create: null 304 }, 305 306 _createWidget: function( options, element ) { 307 element = $( element || this.defaultElement || this )[ 0 ]; 308 this.element = $( element ); 309 this.uuid = widgetUuid++; 310 this.eventNamespace = "." + this.widgetName + this.uuid; 311 312 this.bindings = $(); 313 this.hoverable = $(); 314 this.focusable = $(); 315 this.classesElementLookup = {}; 316 317 if ( element !== this ) { 318 $.data( element, this.widgetFullName, this ); 319 this._on( true, this.element, { 320 remove: function( event ) { 321 if ( event.target === element ) { 322 this.destroy(); 323 } 324 } 325 } ); 326 this.document = $( element.style ? 327 328 // Element within the document 329 element.ownerDocument : 330 331 // Element is window or document 332 element.document || element ); 333 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 334 } 335 336 this.options = $.widget.extend( {}, 337 this.options, 338 this._getCreateOptions(), 339 options ); 340 341 this._create(); 342 343 if ( this.options.disabled ) { 344 this._setOptionDisabled( this.options.disabled ); 345 } 346 347 this._trigger( "create", null, this._getCreateEventData() ); 348 this._init(); 349 }, 350 351 _getCreateOptions: function() { 352 return {}; 353 }, 354 355 _getCreateEventData: $.noop, 356 357 _create: $.noop, 358 359 _init: $.noop, 360 361 destroy: function() { 362 var that = this; 363 364 this._destroy(); 365 $.each( this.classesElementLookup, function( key, value ) { 366 that._removeClass( value, key ); 367 } ); 368 369 // We can probably remove the unbind calls in 2.0 370 // all event bindings should go through this._on() 371 this.element 372 .off( this.eventNamespace ) 373 .removeData( this.widgetFullName ); 374 this.widget() 375 .off( this.eventNamespace ) 376 .removeAttr( "aria-disabled" ); 377 378 // Clean up events and states 379 this.bindings.off( this.eventNamespace ); 380 }, 381 382 _destroy: $.noop, 383 384 widget: function() { 385 return this.element; 386 }, 387 388 option: function( key, value ) { 389 var options = key; 390 var parts; 391 var curOption; 392 var i; 393 394 if ( arguments.length === 0 ) { 395 396 // Don't return a reference to the internal hash 397 return $.widget.extend( {}, this.options ); 398 } 399 400 if ( typeof key === "string" ) { 401 402 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 403 options = {}; 404 parts = key.split( "." ); 405 key = parts.shift(); 406 if ( parts.length ) { 407 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 408 for ( i = 0; i < parts.length - 1; i++ ) { 409 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 410 curOption = curOption[ parts[ i ] ]; 411 } 412 key = parts.pop(); 413 if ( arguments.length === 1 ) { 414 return curOption[ key ] === undefined ? null : curOption[ key ]; 415 } 416 curOption[ key ] = value; 417 } else { 418 if ( arguments.length === 1 ) { 419 return this.options[ key ] === undefined ? null : this.options[ key ]; 420 } 421 options[ key ] = value; 422 } 423 } 424 425 this._setOptions( options ); 426 427 return this; 428 }, 429 430 _setOptions: function( options ) { 431 var key; 432 433 for ( key in options ) { 434 this._setOption( key, options[ key ] ); 435 } 436 437 return this; 438 }, 439 440 _setOption: function( key, value ) { 441 if ( key === "classes" ) { 442 this._setOptionClasses( value ); 443 } 444 445 this.options[ key ] = value; 446 447 if ( key === "disabled" ) { 448 this._setOptionDisabled( value ); 449 } 450 451 return this; 452 }, 453 454 _setOptionClasses: function( value ) { 455 var classKey, elements, currentElements; 456 457 for ( classKey in value ) { 458 currentElements = this.classesElementLookup[ classKey ]; 459 if ( value[ classKey ] === this.options.classes[ classKey ] || 460 !currentElements || 461 !currentElements.length ) { 462 continue; 463 } 464 465 // We are doing this to create a new jQuery object because the _removeClass() call 466 // on the next line is going to destroy the reference to the current elements being 467 // tracked. We need to save a copy of this collection so that we can add the new classes 468 // below. 469 elements = $( currentElements.get() ); 470 this._removeClass( currentElements, classKey ); 471 472 // We don't use _addClass() here, because that uses this.options.classes 473 // for generating the string of classes. We want to use the value passed in from 474 // _setOption(), this is the new value of the classes option which was passed to 475 // _setOption(). We pass this value directly to _classes(). 476 elements.addClass( this._classes( { 477 element: elements, 478 keys: classKey, 479 classes: value, 480 add: true 481 } ) ); 482 } 483 }, 484 485 _setOptionDisabled: function( value ) { 486 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 487 488 // If the widget is becoming disabled, then nothing is interactive 489 if ( value ) { 490 this._removeClass( this.hoverable, null, "ui-state-hover" ); 491 this._removeClass( this.focusable, null, "ui-state-focus" ); 492 } 493 }, 494 495 enable: function() { 496 return this._setOptions( { disabled: false } ); 497 }, 498 499 disable: function() { 500 return this._setOptions( { disabled: true } ); 501 }, 502 503 _classes: function( options ) { 504 var full = []; 505 var that = this; 506 507 options = $.extend( { 508 element: this.element, 509 classes: this.options.classes || {} 510 }, options ); 511 512 function bindRemoveEvent() { 513 var nodesToBind = []; 514 515 options.element.each( function( _, element ) { 516 var isTracked = $.map( that.classesElementLookup, function( elements ) { 517 return elements; 518 } ) 519 .some( function( elements ) { 520 return elements.is( element ); 521 } ); 522 523 if ( !isTracked ) { 524 nodesToBind.push( element ); 525 } 526 } ); 527 528 that._on( $( nodesToBind ), { 529 remove: "_untrackClassesElement" 530 } ); 531 } 532 533 function processClassString( classes, checkOption ) { 534 var current, i; 535 for ( i = 0; i < classes.length; i++ ) { 536 current = that.classesElementLookup[ classes[ i ] ] || $(); 537 if ( options.add ) { 538 bindRemoveEvent(); 539 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 540 } else { 541 current = $( current.not( options.element ).get() ); 542 } 543 that.classesElementLookup[ classes[ i ] ] = current; 544 full.push( classes[ i ] ); 545 if ( checkOption && options.classes[ classes[ i ] ] ) { 546 full.push( options.classes[ classes[ i ] ] ); 547 } 548 } 549 } 550 551 if ( options.keys ) { 552 processClassString( options.keys.match( /\S+/g ) || [], true ); 553 } 554 if ( options.extra ) { 555 processClassString( options.extra.match( /\S+/g ) || [] ); 556 } 557 558 return full.join( " " ); 559 }, 560 561 _untrackClassesElement: function( event ) { 562 var that = this; 563 $.each( that.classesElementLookup, function( key, value ) { 564 if ( $.inArray( event.target, value ) !== -1 ) { 565 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 566 } 567 } ); 568 569 this._off( $( event.target ) ); 570 }, 571 572 _removeClass: function( element, keys, extra ) { 573 return this._toggleClass( element, keys, extra, false ); 574 }, 575 576 _addClass: function( element, keys, extra ) { 577 return this._toggleClass( element, keys, extra, true ); 578 }, 579 580 _toggleClass: function( element, keys, extra, add ) { 581 add = ( typeof add === "boolean" ) ? add : extra; 582 var shift = ( typeof element === "string" || element === null ), 583 options = { 584 extra: shift ? keys : extra, 585 keys: shift ? element : keys, 586 element: shift ? this.element : element, 587 add: add 588 }; 589 options.element.toggleClass( this._classes( options ), add ); 590 return this; 591 }, 592 593 _on: function( suppressDisabledCheck, element, handlers ) { 594 var delegateElement; 595 var instance = this; 596 597 // No suppressDisabledCheck flag, shuffle arguments 598 if ( typeof suppressDisabledCheck !== "boolean" ) { 599 handlers = element; 600 element = suppressDisabledCheck; 601 suppressDisabledCheck = false; 602 } 603 604 // No element argument, shuffle and use this.element 605 if ( !handlers ) { 606 handlers = element; 607 element = this.element; 608 delegateElement = this.widget(); 609 } else { 610 element = delegateElement = $( element ); 611 this.bindings = this.bindings.add( element ); 612 } 613 614 $.each( handlers, function( event, handler ) { 615 function handlerProxy() { 616 617 // Allow widgets to customize the disabled handling 618 // - disabled as an array instead of boolean 619 // - disabled class as method for disabling individual parts 620 if ( !suppressDisabledCheck && 621 ( instance.options.disabled === true || 622 $( this ).hasClass( "ui-state-disabled" ) ) ) { 623 return; 624 } 625 return ( typeof handler === "string" ? instance[ handler ] : handler ) 626 .apply( instance, arguments ); 627 } 628 629 // Copy the guid so direct unbinding works 630 if ( typeof handler !== "string" ) { 631 handlerProxy.guid = handler.guid = 632 handler.guid || handlerProxy.guid || $.guid++; 633 } 634 635 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 636 var eventName = match[ 1 ] + instance.eventNamespace; 637 var selector = match[ 2 ]; 638 639 if ( selector ) { 640 delegateElement.on( eventName, selector, handlerProxy ); 641 } else { 642 element.on( eventName, handlerProxy ); 643 } 644 } ); 645 }, 646 647 _off: function( element, eventName ) { 648 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 649 this.eventNamespace; 650 element.off( eventName ); 651 652 // Clear the stack to avoid memory leaks (#10056) 653 this.bindings = $( this.bindings.not( element ).get() ); 654 this.focusable = $( this.focusable.not( element ).get() ); 655 this.hoverable = $( this.hoverable.not( element ).get() ); 656 }, 657 658 _delay: function( handler, delay ) { 659 function handlerProxy() { 660 return ( typeof handler === "string" ? instance[ handler ] : handler ) 661 .apply( instance, arguments ); 662 } 663 var instance = this; 664 return setTimeout( handlerProxy, delay || 0 ); 665 }, 666 667 _hoverable: function( element ) { 668 this.hoverable = this.hoverable.add( element ); 669 this._on( element, { 670 mouseenter: function( event ) { 671 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 672 }, 673 mouseleave: function( event ) { 674 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 675 } 676 } ); 677 }, 678 679 _focusable: function( element ) { 680 this.focusable = this.focusable.add( element ); 681 this._on( element, { 682 focusin: function( event ) { 683 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 684 }, 685 focusout: function( event ) { 686 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 687 } 688 } ); 689 }, 690 691 _trigger: function( type, event, data ) { 692 var prop, orig; 693 var callback = this.options[ type ]; 694 695 data = data || {}; 696 event = $.Event( event ); 697 event.type = ( type === this.widgetEventPrefix ? 698 type : 699 this.widgetEventPrefix + type ).toLowerCase(); 700 701 // The original event may come from any element 702 // so we need to reset the target on the new event 703 event.target = this.element[ 0 ]; 704 705 // Copy original event properties over to the new event 706 orig = event.originalEvent; 707 if ( orig ) { 708 for ( prop in orig ) { 709 if ( !( prop in event ) ) { 710 event[ prop ] = orig[ prop ]; 711 } 712 } 713 } 714 715 this.element.trigger( event, data ); 716 return !( typeof callback === "function" && 717 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 718 event.isDefaultPrevented() ); 719 } 720}; 721 722$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 723 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 724 if ( typeof options === "string" ) { 725 options = { effect: options }; 726 } 727 728 var hasOptions; 729 var effectName = !options ? 730 method : 731 options === true || typeof options === "number" ? 732 defaultEffect : 733 options.effect || defaultEffect; 734 735 options = options || {}; 736 if ( typeof options === "number" ) { 737 options = { duration: options }; 738 } else if ( options === true ) { 739 options = {}; 740 } 741 742 hasOptions = !$.isEmptyObject( options ); 743 options.complete = callback; 744 745 if ( options.delay ) { 746 element.delay( options.delay ); 747 } 748 749 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 750 element[ method ]( options ); 751 } else if ( effectName !== method && element[ effectName ] ) { 752 element[ effectName ]( options.duration, options.easing, callback ); 753 } else { 754 element.queue( function( next ) { 755 $( this )[ method ](); 756 if ( callback ) { 757 callback.call( element[ 0 ] ); 758 } 759 next(); 760 } ); 761 } 762 }; 763} ); 764 765var widget = $.widget; 766 767 768/*! 769 * jQuery UI Position 1.14.
vendor: 3,861 bytes, lines 769-912
7690 770 * https://jqueryui.com 771 * 772 * Copyright OpenJS Foundation and other contributors 773 * Released under the MIT license. 774 * https://jquery.org/license 775 * 776 * https://api.jqueryui.com/position/ 777 */ 778 779//>>label: Position 780//>>group: Core 781//>>description: Positions elements relative to other elements. 782//>>docs: https://api.jqueryui.com/position/ 783//>>demos: https://jqueryui.com/position/ 784 785 786( function() { 787var cachedScrollbarWidth, 788 max = Math.max, 789 abs = Math.abs, 790 rhorizontal = /left|center|right/, 791 rvertical = /top|center|bottom/, 792 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 793 rposition = /^\w+/, 794 rpercent = /%$/, 795 _position = $.fn.position; 796 797function getOffsets( offsets, width, height ) { 798 return [ 799 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 800 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 801 ]; 802} 803 804function parseCss( element, property ) { 805 return parseInt( $.css( element, property ), 10 ) || 0; 806} 807 808function isWindow( obj ) { 809 return obj != null && obj === obj.window; 810} 811 812function getDimensions( elem ) { 813 var raw = elem[ 0 ]; 814 if ( raw.nodeType === 9 ) { 815 return { 816 width: elem.width(), 817 height: elem.height(), 818 offset: { top: 0, left: 0 } 819 }; 820 } 821 if ( isWindow( raw ) ) { 822 return { 823 width: elem.width(), 824 height: elem.height(), 825 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 826 }; 827 } 828 if ( raw.preventDefault ) { 829 return { 830 width: 0, 831 height: 0, 832 offset: { top: raw.pageY, left: raw.pageX } 833 }; 834 } 835 return { 836 width: elem.outerWidth(), 837 height: elem.outerHeight(), 838 offset: elem.offset() 839 }; 840} 841 842$.position = { 843 scrollbarWidth: function() { 844 if ( cachedScrollbarWidth !== undefined ) { 845 return cachedScrollbarWidth; 846 } 847 var w1, w2, 848 div = $( "<div style=" + 849 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 850 "<div style='height:300px;width:auto;'></div></div>" ), 851 innerDiv = div.children()[ 0 ]; 852 853 $( "body" ).append( div ); 854 w1 = innerDiv.offsetWidth; 855 div.css( "overflow", "scroll" ); 856 857 w2 = innerDiv.offsetWidth; 858 859 if ( w1 === w2 ) { 860 w2 = div[ 0 ].clientWidth; 861 } 862 863 div.remove(); 864 865 return ( cachedScrollbarWidth = w1 - w2 ); 866 }, 867 getScrollInfo: function( within ) { 868 var overflowX = within.isWindow || within.isDocument ? "" : 869 within.element.css( "overflow-x" ), 870 overflowY = within.isWindow || within.isDocument ? "" : 871 within.element.css( "overflow-y" ), 872 hasOverflowX = overflowX === "scroll" || 873 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 874 hasOverflowY = overflowY === "scroll" || 875 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 876 return { 877 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 878 height: hasOverflowX ? $.position.scrollbarWidth() : 0 879 }; 880 }, 881 getWithinInfo: function( element ) { 882 var withinElement = $( element || window ), 883 isElemWindow = isWindow( withinElement[ 0 ] ), 884 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 885 hasOffset = !isElemWindow && !isDocument; 886 return { 887 element: withinElement, 888 isWindow: isElemWindow, 889 isDocument: isDocument, 890 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 891 scrollLeft: withinElement.scrollLeft(), 892 scrollTop: withinElement.scrollTop(), 893 width: withinElement.outerWidth(), 894 height: withinElement.outerHeight() 895 }; 896 } 897}; 898 899$.fn.position = function( options ) { 900 if ( !options || !options.of ) { 901 return _position.apply( this, arguments ); 902 } 903 904 // Make a copy, we don't want to modify arguments 905 options = $.extend( {}, options ); 906 907 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 908 909 // Make sure string options are treated as CSS selectors 910 target = typeof options.of === "string" ? 911 $( document ).find( options.of ) : 912 $( options.of ),
vendor: 10,992 bytes, lines 913-1266
913 914 within = $.position.getWithinInfo( options.within ), 915 scrollInfo = $.position.getScrollInfo( within ), 916 collision = ( options.collision || "flip" ).split( " " ), 917 offsets = {}; 918 919 dimensions = getDimensions( target ); 920 if ( target[ 0 ].preventDefault ) { 921 922 // Force left top to allow flipping 923 options.at = "left top"; 924 } 925 targetWidth = dimensions.width; 926 targetHeight = dimensions.height; 927 targetOffset = dimensions.offset; 928 929 // Clone to reuse original targetOffset later 930 basePosition = $.extend( {}, targetOffset ); 931 932 // Force my and at to have valid horizontal and vertical positions 933 // if a value is missing or invalid, it will be converted to center 934 $.each( [ "my", "at" ], function() { 935 var pos = ( options[ this ] || "" ).split( " " ), 936 horizontalOffset, 937 verticalOffset; 938 939 if ( pos.length === 1 ) { 940 pos = rhorizontal.test( pos[ 0 ] ) ? 941 pos.concat( [ "center" ] ) : 942 rvertical.test( pos[ 0 ] ) ? 943 [ "center" ].concat( pos ) : 944 [ "center", "center" ]; 945 } 946 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 947 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 948 949 // Calculate offsets 950 horizontalOffset = roffset.exec( pos[ 0 ] ); 951 verticalOffset = roffset.exec( pos[ 1 ] ); 952 offsets[ this ] = [ 953 horizontalOffset ? horizontalOffset[ 0 ] : 0, 954 verticalOffset ? verticalOffset[ 0 ] : 0 955 ]; 956 957 // Reduce to just the positions without the offsets 958 options[ this ] = [ 959 rposition.exec( pos[ 0 ] )[ 0 ], 960 rposition.exec( pos[ 1 ] )[ 0 ] 961 ]; 962 } ); 963 964 // Normalize collision option 965 if ( collision.length === 1 ) { 966 collision[ 1 ] = collision[ 0 ]; 967 } 968 969 if ( options.at[ 0 ] === "right" ) { 970 basePosition.left += targetWidth; 971 } else if ( options.at[ 0 ] === "center" ) { 972 basePosition.left += targetWidth / 2; 973 } 974 975 if ( options.at[ 1 ] === "bottom" ) { 976 basePosition.top += targetHeight; 977 } else if ( options.at[ 1 ] === "center" ) { 978 basePosition.top += targetHeight / 2; 979 } 980 981 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 982 basePosition.left += atOffset[ 0 ]; 983 basePosition.top += atOffset[ 1 ]; 984 985 return this.each( function() { 986 var collisionPosition, using, 987 elem = $( this ), 988 elemWidth = elem.outerWidth(), 989 elemHeight = elem.outerHeight(), 990 marginLeft = parseCss( this, "marginLeft" ), 991 marginTop = parseCss( this, "marginTop" ), 992 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 993 scrollInfo.width, 994 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 995 scrollInfo.height, 996 position = $.extend( {}, basePosition ), 997 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 998 999 if ( options.my[ 0 ] === "right" ) { 1000 position.left -= elemWidth; 1001 } else if ( options.my[ 0 ] === "center" ) { 1002 position.left -= elemWidth / 2; 1003 } 1004 1005 if ( options.my[ 1 ] === "bottom" ) { 1006 position.top -= elemHeight; 1007 } else if ( options.my[ 1 ] === "center" ) { 1008 position.top -= elemHeight / 2; 1009 } 1010 1011 position.left += myOffset[ 0 ]; 1012 position.top += myOffset[ 1 ]; 1013 1014 collisionPosition = { 1015 marginLeft: marginLeft, 1016 marginTop: marginTop 1017 }; 1018 1019 $.each( [ "left", "top" ], function( i, dir ) { 1020 if ( $.ui.position[ collision[ i ] ] ) { 1021 $.ui.position[ collision[ i ] ][ dir ]( position, { 1022 targetWidth: targetWidth, 1023 targetHeight: targetHeight, 1024 elemWidth: elemWidth, 1025 elemHeight: elemHeight, 1026 collisionPosition: collisionPosition, 1027 collisionWidth: collisionWidth, 1028 collisionHeight: collisionHeight, 1029 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1030 my: options.my, 1031 at: options.at, 1032 within: within, 1033 elem: elem 1034 } ); 1035 } 1036 } ); 1037 1038 if ( options.using ) { 1039 1040 // Adds feedback as second argument to using callback, if present 1041 using = function( props ) { 1042 var left = targetOffset.left - position.left, 1043 right = left + targetWidth - elemWidth, 1044 top = targetOffset.top - position.top, 1045 bottom = top + targetHeight - elemHeight, 1046 feedback = { 1047 target: { 1048 element: target, 1049 left: targetOffset.left, 1050 top: targetOffset.top, 1051 width: targetWidth, 1052 height: targetHeight 1053 }, 1054 element: { 1055 element: elem, 1056 left: position.left, 1057 top: position.top, 1058 width: elemWidth, 1059 height: elemHeight 1060 }, 1061 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1062 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1063 }; 1064 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1065 feedback.horizontal = "center"; 1066 } 1067 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1068 feedback.vertical = "middle"; 1069 } 1070 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1071 feedback.important = "horizontal"; 1072 } else { 1073 feedback.important = "vertical"; 1074 } 1075 options.using.call( this, props, feedback ); 1076 }; 1077 } 1078 1079 elem.offset( $.extend( position, { using: using } ) ); 1080 } ); 1081}; 1082 1083$.ui.position = { 1084 fit: { 1085 left: function( position, data ) { 1086 var within = data.within, 1087 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1088 outerWidth = within.width, 1089 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1090 overLeft = withinOffset - collisionPosLeft, 1091 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1092 newOverRight; 1093 1094 // Element is wider than within 1095 if ( data.collisionWidth > outerWidth ) { 1096 1097 // Element is initially over the left side of within 1098 if ( overLeft > 0 && overRight <= 0 ) { 1099 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1100 withinOffset; 1101 position.left += overLeft - newOverRight; 1102 1103 // Element is initially over right side of within 1104 } else if ( overRight > 0 && overLeft <= 0 ) { 1105 position.left = withinOffset; 1106 1107 // Element is initially over both left and right sides of within 1108 } else { 1109 if ( overLeft > overRight ) { 1110 position.left = withinOffset + outerWidth - data.collisionWidth; 1111 } else { 1112 position.left = withinOffset; 1113 } 1114 } 1115 1116 // Too far left -> align with left edge 1117 } else if ( overLeft > 0 ) { 1118 position.left += overLeft; 1119 1120 // Too far right -> align with right edge 1121 } else if ( overRight > 0 ) { 1122 position.left -= overRight; 1123 1124 // Adjust based on position and margin 1125 } else { 1126 position.left = max( position.left - collisionPosLeft, position.left ); 1127 } 1128 }, 1129 top: function( position, data ) { 1130 var within = data.within, 1131 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1132 outerHeight = data.within.height, 1133 collisionPosTop = position.top - data.collisionPosition.marginTop, 1134 overTop = withinOffset - collisionPosTop, 1135 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1136 newOverBottom; 1137 1138 // Element is taller than within 1139 if ( data.collisionHeight > outerHeight ) { 1140 1141 // Element is initially over the top of within 1142 if ( overTop > 0 && overBottom <= 0 ) { 1143 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1144 withinOffset; 1145 position.top += overTop - newOverBottom; 1146 1147 // Element is initially over bottom of within 1148 } else if ( overBottom > 0 && overTop <= 0 ) { 1149 position.top = withinOffset; 1150 1151 // Element is initially over both top and bottom of within 1152 } else { 1153 if ( overTop > overBottom ) { 1154 position.top = withinOffset + outerHeight - data.collisionHeight; 1155 } else { 1156 position.top = withinOffset; 1157 } 1158 } 1159 1160 // Too far up -> align with top 1161 } else if ( overTop > 0 ) { 1162 position.top += overTop; 1163 1164 // Too far down -> align with bottom edge 1165 } else if ( overBottom > 0 ) { 1166 position.top -= overBottom; 1167 1168 // Adjust based on position and margin 1169 } else { 1170 position.top = max( position.top - collisionPosTop, position.top ); 1171 } 1172 } 1173 }, 1174 flip: { 1175 left: function( position, data ) { 1176 var within = data.within, 1177 withinOffset = within.offset.left + within.scrollLeft, 1178 outerWidth = within.width, 1179 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1180 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1181 overLeft = collisionPosLeft - offsetLeft, 1182 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1183 myOffset = data.my[ 0 ] === "left" ? 1184 -data.elemWidth : 1185 data.my[ 0 ] === "right" ? 1186 data.elemWidth : 1187 0, 1188 atOffset = data.at[ 0 ] === "left" ? 1189 data.targetWidth : 1190 data.at[ 0 ] === "right" ? 1191 -data.targetWidth : 1192 0, 1193 offset = -2 * data.offset[ 0 ], 1194 newOverRight, 1195 newOverLeft; 1196 1197 if ( overLeft < 0 ) { 1198 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1199 outerWidth - withinOffset; 1200 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1201 position.left += myOffset + atOffset + offset; 1202 } 1203 } else if ( overRight > 0 ) { 1204 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1205 atOffset + offset - offsetLeft; 1206 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1207 position.left += myOffset + atOffset + offset; 1208 } 1209 } 1210 }, 1211 top: function( position, data ) { 1212 var within = data.within, 1213 withinOffset = within.offset.top + within.scrollTop, 1214 outerHeight = within.height, 1215 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1216 collisionPosTop = position.top - data.collisionPosition.marginTop, 1217 overTop = collisionPosTop - offsetTop, 1218 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1219 top = data.my[ 1 ] === "top", 1220 myOffset = top ? 1221 -data.elemHeight : 1222 data.my[ 1 ] === "bottom" ? 1223 data.elemHeight : 1224 0, 1225 atOffset = data.at[ 1 ] === "top" ? 1226 data.targetHeight : 1227 data.at[ 1 ] === "bottom" ? 1228 -data.targetHeight : 1229 0, 1230 offset = -2 * data.offset[ 1 ], 1231 newOverTop, 1232 newOverBottom; 1233 if ( overTop < 0 ) { 1234 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1235 outerHeight - withinOffset; 1236 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1237 position.top += myOffset + atOffset + offset; 1238 } 1239 } else if ( overBottom > 0 ) { 1240 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1241 offset - offsetTop; 1242 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1243 position.top += myOffset + atOffset + offset; 1244 } 1245 } 1246 } 1247 }, 1248 flipfit: { 1249 left: function() { 1250 $.ui.position.flip.left.apply( this, arguments ); 1251 $.ui.position.fit.left.apply( this, arguments ); 1252 }, 1253 top: function() { 1254 $.ui.position.flip.top.apply( this, arguments ); 1255 $.ui.position.fit.top.apply( this, arguments ); 1256 } 1257 } 1258}; 1259 1260} )(); 1261 1262var position = $.ui.position; 1263 1264 1265/*! 1266 * jQuery UI :data 1.1
12664.0 1267 * https://jqueryui.com 1268 * 1269 * Copyright OpenJS Foundation and other contributors 1270 * Released under the MIT license. 1271 * https://jquery.org/license 1272 */ 1273 1274//>>label: :data Selector
vendor: 16,263 bytes, lines 1275-1931
1275//>>group: Core 1276//>>description: Selects elements which have data stored under the specified key. 1277//>>docs: https://api.jqueryui.com/data-selector/ 1278 1279 1280var data = $.extend( $.expr.pseudos, { 1281 data: $.expr.createPseudo( function( dataName ) { 1282 return function( elem ) { 1283 return !!$.data( elem, dataName ); 1284 }; 1285 } ) 1286} ); 1287 1288/*! 1289 * jQuery UI Disable Selection 1.14.0 1290 * https://jqueryui.com 1291 * 1292 * Copyright OpenJS Foundation and other contributors 1293 * Released under the MIT license. 1294 * https://jquery.org/license 1295 */ 1296 1297//>>label: disableSelection 1298//>>group: Core 1299//>>description: Disable selection of text content within the set of matched elements. 1300//>>docs: https://api.jqueryui.com/disableSelection/ 1301 1302// This file is deprecated 1303 1304var disableSelection = $.fn.extend( { 1305 disableSelection: ( function() { 1306 var eventType = "onselectstart" in document.createElement( "div" ) ? 1307 "selectstart" : 1308 "mousedown"; 1309 1310 return function() { 1311 return this.on( eventType + ".ui-disableSelection", function( event ) { 1312 event.preventDefault(); 1313 } ); 1314 }; 1315 } )(), 1316 1317 enableSelection: function() { 1318 return this.off( ".ui-disableSelection" ); 1319 } 1320} ); 1321 1322 1323/*! 1324 * jQuery UI Focusable 1.14.0 1325 * https://jqueryui.com 1326 * 1327 * Copyright OpenJS Foundation and other contributors 1328 * Released under the MIT license. 1329 * https://jquery.org/license 1330 */ 1331 1332//>>label: :focusable Selector 1333//>>group: Core 1334//>>description: Selects elements which can be focused. 1335//>>docs: https://api.jqueryui.com/focusable-selector/ 1336 1337 1338// Selectors 1339$.ui.focusable = function( element, hasTabindex ) { 1340 var map, mapName, img, focusableIfVisible, fieldset, 1341 nodeName = element.nodeName.toLowerCase(); 1342 1343 if ( "area" === nodeName ) { 1344 map = element.parentNode; 1345 mapName = map.name; 1346 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 1347 return false; 1348 } 1349 img = $( "img[usemap='#" + mapName + "']" ); 1350 return img.length > 0 && img.is( ":visible" ); 1351 } 1352 1353 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 1354 focusableIfVisible = !element.disabled; 1355 1356 if ( focusableIfVisible ) { 1357 1358 // Form controls within a disabled fieldset are disabled. 1359 // However, controls within the fieldset's legend do not get disabled. 1360 // Since controls generally aren't placed inside legends, we skip 1361 // this portion of the check. 1362 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 1363 if ( fieldset ) { 1364 focusableIfVisible = !fieldset.disabled; 1365 } 1366 } 1367 } else if ( "a" === nodeName ) { 1368 focusableIfVisible = element.href || hasTabindex; 1369 } else { 1370 focusableIfVisible = hasTabindex; 1371 } 1372 1373 return focusableIfVisible && $( element ).is( ":visible" ) && 1374 $( element ).css( "visibility" ) === "visible"; 1375}; 1376 1377$.extend( $.expr.pseudos, { 1378 focusable: function( element ) { 1379 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 1380 } 1381} ); 1382 1383var focusable = $.ui.focusable; 1384 1385 1386/*! 1387 * jQuery UI Form Reset Mixin 1.14.0 1388 * https://jqueryui.com 1389 * 1390 * Copyright OpenJS Foundation and other contributors 1391 * Released under the MIT license. 1392 * https://jquery.org/license 1393 */ 1394 1395//>>label: Form Reset Mixin 1396//>>group: Core 1397//>>description: Refresh input widgets when their form is reset 1398//>>docs: https://api.jqueryui.com/form-reset-mixin/ 1399 1400 1401var formResetMixin = $.ui.formResetMixin = { 1402 _formResetHandler: function() { 1403 var form = $( this ); 1404 1405 // Wait for the form reset to actually happen before refreshing 1406 setTimeout( function() { 1407 var instances = form.data( "ui-form-reset-instances" ); 1408 $.each( instances, function() { 1409 this.refresh(); 1410 } ); 1411 } ); 1412 }, 1413 1414 _bindFormResetHandler: function() { 1415 this.form = $( this.element.prop( "form" ) ); 1416 if ( !this.form.length ) { 1417 return; 1418 } 1419 1420 var instances = this.form.data( "ui-form-reset-instances" ) || []; 1421 if ( !instances.length ) { 1422 1423 // We don't use _on() here because we use a single event handler per form 1424 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 1425 } 1426 instances.push( this ); 1427 this.form.data( "ui-form-reset-instances", instances ); 1428 }, 1429 1430 _unbindFormResetHandler: function() { 1431 if ( !this.form.length ) { 1432 return; 1433 } 1434 1435 var instances = this.form.data( "ui-form-reset-instances" ); 1436 instances.splice( $.inArray( this, instances ), 1 ); 1437 if ( instances.length ) { 1438 this.form.data( "ui-form-reset-instances", instances ); 1439 } else { 1440 this.form 1441 .removeData( "ui-form-reset-instances" ) 1442 .off( "reset.ui-form-reset" ); 1443 } 1444 } 1445}; 1446 1447 1448/*! 1449 * jQuery UI Legacy jQuery Core patches 1.14.0 1450 * https://jqueryui.com 1451 * 1452 * Copyright OpenJS Foundation and other contributors 1453 * Released under the MIT license. 1454 * https://jquery.org/license 1455 * 1456 */ 1457 1458//>>label: Legacy jQuery Core patches 1459//>>group: Core 1460//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated) 1461 1462 1463// Support: jQuery 2.2.x or older. 1464// This method has been defined in jQuery 3.0.0. 1465// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 1466if ( !$.escapeSelector ) { 1467 $.escapeSelector = function( id ) { 1468 return CSS.escape( id + "" ); 1469 }; 1470} 1471 1472// Support: jQuery 3.4.x or older 1473// These methods have been defined in jQuery 3.5.0. 1474if ( !$.fn.even || !$.fn.odd ) { 1475 $.fn.extend( { 1476 even: function() { 1477 return this.filter( function( i ) { 1478 return i % 2 === 0; 1479 } ); 1480 }, 1481 odd: function() { 1482 return this.filter( function( i ) { 1483 return i % 2 === 1; 1484 } ); 1485 } 1486 } ); 1487} 1488 1489; 1490/*! 1491 * jQuery UI Keycode 1.14.0 1492 * https://jqueryui.com 1493 * 1494 * Copyright OpenJS Foundation and other contributors 1495 * Released under the MIT license. 1496 * https://jquery.org/license 1497 */ 1498 1499//>>label: Keycode 1500//>>group: Core 1501//>>description: Provide keycodes as keynames 1502//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 1503 1504 1505var keycode = $.ui.keyCode = { 1506 BACKSPACE: 8, 1507 COMMA: 188, 1508 DELETE: 46, 1509 DOWN: 40, 1510 END: 35, 1511 ENTER: 13, 1512 ESCAPE: 27, 1513 HOME: 36, 1514 LEFT: 37, 1515 PAGE_DOWN: 34, 1516 PAGE_UP: 33, 1517 PERIOD: 190, 1518 RIGHT: 39, 1519 SPACE: 32, 1520 TAB: 9, 1521 UP: 38 1522}; 1523 1524 1525/*! 1526 * jQuery UI Labels 1.14.0 1527 * https://jqueryui.com 1528 * 1529 * Copyright OpenJS Foundation and other contributors 1530 * Released under the MIT license. 1531 * https://jquery.org/license 1532 */ 1533 1534//>>label: labels 1535//>>group: Core 1536//>>description: Find all the labels associated with a given input 1537//>>docs: https://api.jqueryui.com/labels/ 1538 1539 1540var labels = $.fn.labels = function() { 1541 var ancestor, selector, id, labels, ancestors; 1542 1543 if ( !this.length ) { 1544 return this.pushStack( [] ); 1545 } 1546 1547 // Check control.labels first 1548 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 1549 return this.pushStack( this[ 0 ].labels ); 1550 } 1551 1552 // If `control.labels` is empty - e.g. inside of document fragments - find 1553 // the labels manually 1554 labels = this.eq( 0 ).parents( "label" ); 1555 1556 // Look for the label based on the id 1557 id = this.attr( "id" ); 1558 if ( id ) { 1559 1560 // We don't search against the document in case the element 1561 // is disconnected from the DOM 1562 ancestor = this.eq( 0 ).parents().last(); 1563 1564 // Get a full set of top level ancestors 1565 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 1566 1567 // Create a selector for the label based on the id 1568 selector = "label[for='" + CSS.escape( id ) + "']"; 1569 1570 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 1571 1572 } 1573 1574 // Return whatever we have found for labels 1575 return this.pushStack( labels ); 1576}; 1577 1578 1579/*! 1580 * jQuery UI Scroll Parent 1.14.0 1581 * https://jqueryui.com 1582 * 1583 * Copyright OpenJS Foundation and other contributors 1584 * Released under the MIT license. 1585 * https://jquery.org/license 1586 */ 1587 1588//>>label: scrollParent 1589//>>group: Core 1590//>>description: Get the closest ancestor element that is scrollable. 1591//>>docs: https://api.jqueryui.com/scrollParent/ 1592 1593 1594var scrollParent = $.fn.scrollParent = function( includeHidden ) { 1595 var position = this.css( "position" ), 1596 excludeStaticParent = position === "absolute", 1597 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1598 scrollParent = this.parents().filter( function() { 1599 var parent = $( this ); 1600 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 1601 return false; 1602 } 1603 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 1604 parent.css( "overflow-x" ) ); 1605 } ).eq( 0 ); 1606 1607 return position === "fixed" || !scrollParent.length ? 1608 $( this[ 0 ].ownerDocument || document ) : 1609 scrollParent; 1610}; 1611 1612 1613/*! 1614 * jQuery UI Tabbable 1.14.0 1615 * https://jqueryui.com 1616 * 1617 * Copyright OpenJS Foundation and other contributors 1618 * Released under the MIT license. 1619 * https://jquery.org/license 1620 */ 1621 1622//>>label: :tabbable Selector 1623//>>group: Core 1624//>>description: Selects elements which can be tabbed to. 1625//>>docs: https://api.jqueryui.com/tabbable-selector/ 1626 1627 1628var tabbable = $.extend( $.expr.pseudos, { 1629 tabbable: function( element ) { 1630 var tabIndex = $.attr( element, "tabindex" ), 1631 hasTabindex = tabIndex != null; 1632 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 1633 } 1634} ); 1635 1636 1637/*! 1638 * jQuery UI Unique ID 1.14.0 1639 * https://jqueryui.com 1640 * 1641 * Copyright OpenJS Foundation and other contributors 1642 * Released under the MIT license. 1643 * https://jquery.org/license 1644 */ 1645 1646//>>label: uniqueId 1647//>>group: Core 1648//>>description: Functions to generate and remove uniqueId's 1649//>>docs: https://api.jqueryui.com/uniqueId/ 1650 1651 1652var uniqueId = $.fn.extend( { 1653 uniqueId: ( function() { 1654 var uuid = 0; 1655 1656 return function() { 1657 return this.each( function() { 1658 if ( !this.id ) { 1659 this.id = "ui-id-" + ( ++uuid ); 1660 } 1661 } ); 1662 }; 1663 } )(), 1664 1665 removeUniqueId: function() { 1666 return this.each( function() { 1667 if ( /^ui-id-\d+$/.test( this.id ) ) { 1668 $( this ).removeAttr( "id" ); 1669 } 1670 } ); 1671 } 1672} ); 1673 1674 1675/*! 1676 * jQuery UI Mouse 1.14.0 1677 * https://jqueryui.com 1678 * 1679 * Copyright OpenJS Foundation and other contributors 1680 * Released under the MIT license. 1681 * https://jquery.org/license 1682 */ 1683 1684//>>label: Mouse 1685//>>group: Widgets 1686//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1687//>>docs: https://api.jqueryui.com/mouse/ 1688 1689 1690var mouseHandled = false; 1691$( document ).on( "mouseup", function() { 1692 mouseHandled = false; 1693} ); 1694 1695var widgetsMouse = $.widget( "ui.mouse", { 1696 version: "1.14.0", 1697 options: { 1698 cancel: "input, textarea, button, select, option", 1699 distance: 1, 1700 delay: 0 1701 }, 1702 _mouseInit: function() { 1703 var that = this; 1704 1705 this.element 1706 .on( "mousedown." + this.widgetName, function( event ) { 1707 return that._mouseDown( event ); 1708 } ) 1709 .on( "click." + this.widgetName, function( event ) { 1710 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 1711 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 1712 event.stopImmediatePropagation(); 1713 return false; 1714 } 1715 } ); 1716 1717 this.started = false; 1718 }, 1719 1720 // TODO: make sure destroying one instance of mouse doesn't mess with 1721 // other instances of mouse 1722 _mouseDestroy: function() { 1723 this.element.off( "." + this.widgetName ); 1724 if ( this._mouseMoveDelegate ) { 1725 this.document 1726 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1727 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1728 } 1729 }, 1730 1731 _mouseDown: function( event ) { 1732 1733 // don't let more than one widget handle mouseStart 1734 if ( mouseHandled ) { 1735 return; 1736 } 1737 1738 this._mouseMoved = false; 1739 1740 // We may have missed mouseup (out of window) 1741 if ( this._mouseStarted ) { 1742 this._mouseUp( event ); 1743 } 1744 1745 this._mouseDownEvent = event; 1746 1747 var that = this, 1748 btnIsLeft = event.which === 1, 1749 elIsCancel = typeof this.options.cancel === "string" ? 1750 $( event.target ).closest( this.options.cancel ).length : 1751 false; 1752 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 1753 return true; 1754 } 1755 1756 this.mouseDelayMet = !this.options.delay; 1757 if ( !this.mouseDelayMet ) { 1758 this._mouseDelayTimer = setTimeout( function() { 1759 that.mouseDelayMet = true; 1760 }, this.options.delay ); 1761 } 1762 1763 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1764 this._mouseStarted = ( this._mouseStart( event ) !== false ); 1765 if ( !this._mouseStarted ) { 1766 event.preventDefault(); 1767 return true; 1768 } 1769 } 1770 1771 // Click event may never have fired (Gecko & Opera) 1772 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 1773 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 1774 } 1775 1776 // These delegates are required to keep context 1777 this._mouseMoveDelegate = function( event ) { 1778 return that._mouseMove( event ); 1779 }; 1780 this._mouseUpDelegate = function( event ) { 1781 return that._mouseUp( event ); 1782 }; 1783 1784 this.document 1785 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1786 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1787 1788 event.preventDefault(); 1789 1790 mouseHandled = true; 1791 return true; 1792 }, 1793 1794 _mouseMove: function( event ) { 1795 1796 // Only check for mouseups outside the document if you've moved inside the document 1797 // at least once. 1798 if ( this._mouseMoved && !event.which ) { 1799 1800 // Support: Safari <=8 - 9 1801 // Safari sets which to 0 if you press any of the following keys 1802 // during a drag (#14461) 1803 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 1804 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 1805 this.ignoreMissingWhich = true; 1806 } else if ( !this.ignoreMissingWhich ) { 1807 return this._mouseUp( event ); 1808 } 1809 } 1810 1811 if ( event.which || event.button ) { 1812 this._mouseMoved = true; 1813 } 1814 1815 if ( this._mouseStarted ) { 1816 this._mouseDrag( event ); 1817 return event.preventDefault(); 1818 } 1819 1820 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1821 this._mouseStarted = 1822 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 1823 if ( this._mouseStarted ) { 1824 this._mouseDrag( event ); 1825 } else { 1826 this._mouseUp( event ); 1827 } 1828 } 1829 1830 return !this._mouseStarted; 1831 }, 1832 1833 _mouseUp: function( event ) { 1834 this.document 1835 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1836 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1837 1838 if ( this._mouseStarted ) { 1839 this._mouseStarted = false; 1840 1841 if ( event.target === this._mouseDownEvent.target ) { 1842 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 1843 } 1844 1845 this._mouseStop( event ); 1846 } 1847 1848 if ( this._mouseDelayTimer ) { 1849 clearTimeout( this._mouseDelayTimer ); 1850 delete this._mouseDelayTimer; 1851 } 1852 1853 this.ignoreMissingWhich = false; 1854 mouseHandled = false; 1855 event.preventDefault(); 1856 }, 1857 1858 _mouseDistanceMet: function( event ) { 1859 return ( Math.max( 1860 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 1861 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 1862 ) >= this.options.distance 1863 ); 1864 }, 1865 1866 _mouseDelayMet: function( /* event */ ) { 1867 return this.mouseDelayMet; 1868 }, 1869 1870 // These are placeholder methods, to be overriden by extending plugin 1871 _mouseStart: function( /* event */ ) {}, 1872 _mouseDrag: function( /* event */ ) {}, 1873 _mouseStop: function( /* event */ ) {}, 1874 _mouseCapture: function( /* event */ ) { 1875 return true; 1876 } 1877} ); 1878 1879 1880 1881// $.ui.plugin is deprecated. Use $.widget() extensions instead. 1882var plugin = $.ui.plugin = { 1883 add: function( module, option, set ) { 1884 var i, 1885 proto = $.ui[ module ].prototype; 1886 for ( i in set ) { 1887 proto.plugins[ i ] = proto.plugins[ i ] || []; 1888 proto.plugins[ i ].push( [ option, set[ i ] ] ); 1889 } 1890 }, 1891 call: function( instance, name, args, allowDisconnected ) { 1892 var i, 1893 set = instance.plugins[ name ]; 1894 1895 if ( !set ) { 1896 return; 1897 } 1898 1899 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 1900 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 1901 return; 1902 } 1903 1904 for ( i = 0; i < set.length; i++ ) { 1905 if ( instance.options[ set[ i ][ 0 ] ] ) { 1906 set[ i ][ 1 ].apply( instance.element, args ); 1907 } 1908 } 1909 } 1910}; 1911 1912 1913/*! 1914 * jQuery UI Draggable 1.14.0 1915 * https://jqueryui.com 1916 * 1917 * Copyright OpenJS Foundation and other contributors 1918 * Released under the MIT license. 1919 * https://jquery.org/license 1920 */ 1921 1922//>>label: Draggable 1923//>>group: Interactions 1924//>>description: Enables dragging functionality for any element. 1925//>>docs: https://api.jqueryui.com/draggable/ 1926//>>demos: https://jqueryui.com/draggable/ 1927//>>css.structure: ../../themes/base/draggable.css 1928 1929 1930$.widget( "ui.draggable", $.ui.mouse, { 1931 version: "1.14.0
vendor: 13,254 bytes, lines 1931-2424
1931", 1932 widgetEventPrefix: "drag", 1933 options: { 1934 addClasses: true, 1935 appendTo: "parent", 1936 axis: false, 1937 connectToSortable: false, 1938 containment: false, 1939 cursor: "auto", 1940 cursorAt: false, 1941 grid: false, 1942 handle: false, 1943 helper: "original", 1944 iframeFix: false, 1945 opacity: false, 1946 refreshPositions: false, 1947 revert: false, 1948 revertDuration: 500, 1949 scope: "default", 1950 scroll: true, 1951 scrollSensitivity: 20, 1952 scrollSpeed: 20, 1953 snap: false, 1954 snapMode: "both", 1955 snapTolerance: 20, 1956 stack: false, 1957 zIndex: false, 1958 1959 // Callbacks 1960 drag: null, 1961 start: null, 1962 stop: null 1963 }, 1964 _create: function() { 1965 1966 if ( this.options.helper === "original" ) { 1967 this._setPositionRelative(); 1968 } 1969 if ( this.options.addClasses ) { 1970 this._addClass( "ui-draggable" ); 1971 } 1972 this._setHandleClassName(); 1973 1974 this._mouseInit(); 1975 }, 1976 1977 _setOption: function( key, value ) { 1978 this._super( key, value ); 1979 if ( key === "handle" ) { 1980 this._removeHandleClassName(); 1981 this._setHandleClassName(); 1982 } 1983 }, 1984 1985 _destroy: function() { 1986 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 1987 this.destroyOnClear = true; 1988 return; 1989 } 1990 this._removeHandleClassName(); 1991 this._mouseDestroy(); 1992 }, 1993 1994 _mouseCapture: function( event ) { 1995 var o = this.options; 1996 1997 // Among others, prevent a drag on a resizable-handle 1998 if ( this.helper || o.disabled || 1999 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 2000 return false; 2001 } 2002 2003 //Quit if we're not on a valid handle 2004 this.handle = this._getHandle( event ); 2005 if ( !this.handle ) { 2006 return false; 2007 } 2008 2009 this._blurActiveElement( event ); 2010 2011 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 2012 2013 return true; 2014 2015 }, 2016 2017 _blockFrames: function( selector ) { 2018 this.iframeBlocks = this.document.find( selector ).map( function() { 2019 var iframe = $( this ); 2020 2021 return $( "<div>" ) 2022 .css( "position", "absolute" ) 2023 .appendTo( iframe.parent() ) 2024 .outerWidth( iframe.outerWidth() ) 2025 .outerHeight( iframe.outerHeight() ) 2026 .offset( iframe.offset() )[ 0 ]; 2027 } ); 2028 }, 2029 2030 _unblockFrames: function() { 2031 if ( this.iframeBlocks ) { 2032 this.iframeBlocks.remove(); 2033 delete this.iframeBlocks; 2034 } 2035 }, 2036 2037 _blurActiveElement: function( event ) { 2038 var activeElement = this.document[ 0 ].activeElement, 2039 target = $( event.target ); 2040 2041 // Don't blur if the event occurred on an element that is within 2042 // the currently focused element 2043 // See #10527, #12472 2044 if ( target.closest( activeElement ).length ) { 2045 return; 2046 } 2047 2048 // Blur any element that currently has focus, see #4261 2049 $( activeElement ).trigger( "blur" ); 2050 }, 2051 2052 _mouseStart: function( event ) { 2053 2054 var o = this.options; 2055 2056 //Create and append the visible helper 2057 this.helper = this._createHelper( event ); 2058 2059 this._addClass( this.helper, "ui-draggable-dragging" ); 2060 2061 //Cache the helper size 2062 this._cacheHelperProportions(); 2063 2064 //If ddmanager is used for droppables, set the global draggable 2065 if ( $.ui.ddmanager ) { 2066 $.ui.ddmanager.current = this; 2067 } 2068 2069 /* 2070 * - Position generation - 2071 * This block generates everything position related - it's the core of draggables. 2072 */ 2073 2074 //Cache the margins of the original element 2075 this._cacheMargins(); 2076 2077 //Store the helper's css position 2078 this.cssPosition = this.helper.css( "position" ); 2079 this.scrollParent = this.helper.scrollParent( true ); 2080 this.offsetParent = this.helper.offsetParent(); 2081 this.hasFixedAncestor = this.helper.parents().filter( function() { 2082 return $( this ).css( "position" ) === "fixed"; 2083 } ).length > 0; 2084 2085 //The element's absolute position on the page minus margins 2086 this.positionAbs = this.element.offset(); 2087 this._refreshOffsets( event ); 2088 2089 //Generate the original position 2090 this.originalPosition = this.position = this._generatePosition( event, false ); 2091 this.originalPageX = event.pageX; 2092 this.originalPageY = event.pageY; 2093 2094 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2095 if ( o.cursorAt ) { 2096 this._adjustOffsetFromHelper( o.cursorAt ); 2097 } 2098 2099 //Set a containment if given in the options 2100 this._setContainment(); 2101 2102 //Trigger event + callbacks 2103 if ( this._trigger( "start", event ) === false ) { 2104 this._clear(); 2105 return false; 2106 } 2107 2108 //Recache the helper size 2109 this._cacheHelperProportions(); 2110 2111 //Prepare the droppable offsets 2112 if ( $.ui.ddmanager && !o.dropBehaviour ) { 2113 $.ui.ddmanager.prepareOffsets( this, event ); 2114 } 2115 2116 // Execute the drag once - this causes the helper not to be visible before getting its 2117 // correct position 2118 this._mouseDrag( event, true ); 2119 2120 // If the ddmanager is used for droppables, inform the manager that dragging has started 2121 // (see #5003) 2122 if ( $.ui.ddmanager ) { 2123 $.ui.ddmanager.dragStart( this, event ); 2124 } 2125 2126 return true; 2127 }, 2128 2129 _refreshOffsets: function( event ) { 2130 this.offset = { 2131 top: this.positionAbs.top - this.margins.top, 2132 left: this.positionAbs.left - this.margins.left, 2133 scroll: false, 2134 parent: this._getParentOffset(), 2135 relative: this._getRelativeOffset() 2136 }; 2137 2138 this.offset.click = { 2139 left: event.pageX - this.offset.left, 2140 top: event.pageY - this.offset.top 2141 }; 2142 }, 2143 2144 _mouseDrag: function( event, noPropagation ) { 2145 2146 // reset any necessary cached properties (see #5009) 2147 if ( this.hasFixedAncestor ) { 2148 this.offset.parent = this._getParentOffset(); 2149 } 2150 2151 //Compute the helpers position 2152 this.position = this._generatePosition( event, true ); 2153 this.positionAbs = this._convertPositionTo( "absolute" ); 2154 2155 //Call plugins and callbacks and use the resulting position if something is returned 2156 if ( !noPropagation ) { 2157 var ui = this._uiHash(); 2158 if ( this._trigger( "drag", event, ui ) === false ) { 2159 this._mouseUp( new $.Event( "mouseup", event ) ); 2160 return false; 2161 } 2162 this.position = ui.position; 2163 } 2164 2165 this.helper[ 0 ].style.left = this.position.left + "px"; 2166 this.helper[ 0 ].style.top = this.position.top + "px"; 2167 2168 if ( $.ui.ddmanager ) { 2169 $.ui.ddmanager.drag( this, event ); 2170 } 2171 2172 return false; 2173 }, 2174 2175 _mouseStop: function( event ) { 2176 2177 //If we are using droppables, inform the manager about the drop 2178 var that = this, 2179 dropped = false; 2180 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 2181 dropped = $.ui.ddmanager.drop( this, event ); 2182 } 2183 2184 //if a drop comes from outside (a sortable) 2185 if ( this.dropped ) { 2186 dropped = this.dropped; 2187 this.dropped = false; 2188 } 2189 2190 if ( ( this.options.revert === "invalid" && !dropped ) || 2191 ( this.options.revert === "valid" && dropped ) || 2192 this.options.revert === true || ( typeof this.options.revert === "function" && 2193 this.options.revert.call( this.element, dropped ) ) 2194 ) { 2195 $( this.helper ).animate( 2196 this.originalPosition, 2197 parseInt( this.options.revertDuration, 10 ), 2198 function() { 2199 if ( that._trigger( "stop", event ) !== false ) { 2200 that._clear(); 2201 } 2202 } 2203 ); 2204 } else { 2205 if ( this._trigger( "stop", event ) !== false ) { 2206 this._clear(); 2207 } 2208 } 2209 2210 return false; 2211 }, 2212 2213 _mouseUp: function( event ) { 2214 this._unblockFrames(); 2215 2216 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2217 // (see #5003) 2218 if ( $.ui.ddmanager ) { 2219 $.ui.ddmanager.dragStop( this, event ); 2220 } 2221 2222 // Only need to focus if the event occurred on the draggable itself, see #10527 2223 if ( this.handleElement.is( event.target ) ) { 2224 2225 // The interaction is over; whether or not the click resulted in a drag, 2226 // focus the element 2227 this.element.trigger( "focus" ); 2228 } 2229 2230 return $.ui.mouse.prototype._mouseUp.call( this, event ); 2231 }, 2232 2233 cancel: function() { 2234 2235 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 2236 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 2237 } else { 2238 this._clear(); 2239 } 2240 2241 return this; 2242 2243 }, 2244 2245 _getHandle: function( event ) { 2246 return this.options.handle ? 2247 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 2248 true; 2249 }, 2250 2251 _setHandleClassName: function() { 2252 this.handleElement = this.options.handle ? 2253 this.element.find( this.options.handle ) : this.element; 2254 this._addClass( this.handleElement, "ui-draggable-handle" ); 2255 }, 2256 2257 _removeHandleClassName: function() { 2258 this._removeClass( this.handleElement, "ui-draggable-handle" ); 2259 }, 2260 2261 _createHelper: function( event ) { 2262 2263 var o = this.options, 2264 helperIsFunction = typeof o.helper === "function", 2265 helper = helperIsFunction ? 2266 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 2267 ( o.helper === "clone" ? 2268 this.element.clone().removeAttr( "id" ) : 2269 this.element ); 2270 2271 if ( !helper.parents( "body" ).length ) { 2272 helper.appendTo( ( o.appendTo === "parent" ? 2273 this.element[ 0 ].parentNode : 2274 o.appendTo ) ); 2275 } 2276 2277 // https://bugs.jqueryui.com/ticket/9446 2278 // a helper function can return the original element 2279 // which wouldn't have been set to relative in _create 2280 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 2281 this._setPositionRelative(); 2282 } 2283 2284 if ( helper[ 0 ] !== this.element[ 0 ] && 2285 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 2286 helper.css( "position", "absolute" ); 2287 } 2288 2289 return helper; 2290 2291 }, 2292 2293 _setPositionRelative: function() { 2294 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 2295 this.element[ 0 ].style.position = "relative"; 2296 } 2297 }, 2298 2299 _adjustOffsetFromHelper: function( obj ) { 2300 if ( typeof obj === "string" ) { 2301 obj = obj.split( " " ); 2302 } 2303 if ( Array.isArray( obj ) ) { 2304 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 2305 } 2306 if ( "left" in obj ) { 2307 this.offset.click.left = obj.left + this.margins.left; 2308 } 2309 if ( "right" in obj ) { 2310 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2311 } 2312 if ( "top" in obj ) { 2313 this.offset.click.top = obj.top + this.margins.top; 2314 } 2315 if ( "bottom" in obj ) { 2316 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2317 } 2318 }, 2319 2320 _isRootNode: function( element ) { 2321 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 2322 }, 2323 2324 _getParentOffset: function() { 2325 2326 //Get the offsetParent and cache its position 2327 var po = this.offsetParent.offset(), 2328 document = this.document[ 0 ]; 2329 2330 // This is a special case where we need to modify a offset calculated on start, since the 2331 // following happened: 2332 // 1. The position of the helper is absolute, so it's position is calculated based on the 2333 // next positioned parent 2334 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2335 // the document, which means that the scroll is included in the initial calculation of the 2336 // offset of the parent, and never recalculated upon drag 2337 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 2338 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 2339 po.left += this.scrollParent.scrollLeft(); 2340 po.top += this.scrollParent.scrollTop(); 2341 } 2342 2343 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 2344 po = { top: 0, left: 0 }; 2345 } 2346 2347 return { 2348 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 2349 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 2350 }; 2351 2352 }, 2353 2354 _getRelativeOffset: function() { 2355 if ( this.cssPosition !== "relative" ) { 2356 return { top: 0, left: 0 }; 2357 } 2358 2359 var p = this.element.position(), 2360 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2361 2362 return { 2363 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 2364 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 2365 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 2366 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 2367 }; 2368 2369 }, 2370 2371 _cacheMargins: function() { 2372 this.margins = { 2373 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 2374 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 2375 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 2376 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 2377 }; 2378 }, 2379 2380 _cacheHelperProportions: function() { 2381 this.helperProportions = { 2382 width: this.helper.outerWidth(), 2383 height: this.helper.outerHeight() 2384 }; 2385 }, 2386 2387 _setContainment: function() { 2388 2389 var isUserScrollable, c, ce, 2390 o = this.options, 2391 document = this.document[ 0 ]; 2392 2393 this.relativeContainer = null; 2394 2395 if ( !o.containment ) { 2396 this.containment = null; 2397 return; 2398 } 2399 2400 if ( o.containment === "window" ) { 2401 this.containment = [ 2402 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2403 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2404 $( window ).scrollLeft() + $( window ).width() - 2405 this.helperProportions.width - this.margins.left, 2406 $( window ).scrollTop() + 2407 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 2408 this.helperProportions.height - this.margins.top 2409 ]; 2410 return; 2411 } 2412 2413 if ( o.containment === "document" ) { 2414 this.containment = [ 2415 0, 2416 0, 2417 $( document ).width() - this.helperProportions.width - this.margins.left, 2418 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 2419 this.helperProportions.height - this.margins.top 2420 ]; 2421 return; 2422 } 2423 2424 if ( o.containment.constructor === Array ) {
vendor: 10,369 bytes, lines 2425-2771
2425 this.containment = o.containment; 2426 return; 2427 } 2428 2429 if ( o.containment === "parent" ) { 2430 o.containment = this.helper[ 0 ].parentNode; 2431 } 2432 2433 c = $( o.containment ); 2434 ce = c[ 0 ]; 2435 2436 if ( !ce ) { 2437 return; 2438 } 2439 2440 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 2441 2442 this.containment = [ 2443 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 2444 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 2445 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 2446 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 2447 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 2448 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 2449 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 2450 this.helperProportions.width - 2451 this.margins.left - 2452 this.margins.right, 2453 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 2454 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 2455 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 2456 this.helperProportions.height - 2457 this.margins.top - 2458 this.margins.bottom 2459 ]; 2460 this.relativeContainer = c; 2461 }, 2462 2463 _convertPositionTo: function( d, pos ) { 2464 2465 if ( !pos ) { 2466 pos = this.position; 2467 } 2468 2469 var mod = d === "absolute" ? 1 : -1, 2470 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2471 2472 return { 2473 top: ( 2474 2475 // The absolute mouse position 2476 pos.top + 2477 2478 // Only for relative positioned nodes: Relative offset from element to offset parent 2479 this.offset.relative.top * mod + 2480 2481 // The offsetParent's offset without borders (offset + border) 2482 this.offset.parent.top * mod - 2483 ( ( this.cssPosition === "fixed" ? 2484 -this.offset.scroll.top : 2485 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 2486 ), 2487 left: ( 2488 2489 // The absolute mouse position 2490 pos.left + 2491 2492 // Only for relative positioned nodes: Relative offset from element to offset parent 2493 this.offset.relative.left * mod + 2494 2495 // The offsetParent's offset without borders (offset + border) 2496 this.offset.parent.left * mod - 2497 ( ( this.cssPosition === "fixed" ? 2498 -this.offset.scroll.left : 2499 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 2500 ) 2501 }; 2502 2503 }, 2504 2505 _generatePosition: function( event, constrainPosition ) { 2506 2507 var containment, co, top, left, 2508 o = this.options, 2509 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 2510 pageX = event.pageX, 2511 pageY = event.pageY; 2512 2513 // Cache the scroll 2514 if ( !scrollIsRootNode || !this.offset.scroll ) { 2515 this.offset.scroll = { 2516 top: this.scrollParent.scrollTop(), 2517 left: this.scrollParent.scrollLeft() 2518 }; 2519 } 2520 2521 /* 2522 * - Position constraining - 2523 * Constrain the position to a mix of grid, containment. 2524 */ 2525 2526 // If we are not dragging yet, we won't check for options 2527 if ( constrainPosition ) { 2528 if ( this.containment ) { 2529 if ( this.relativeContainer ) { 2530 co = this.relativeContainer.offset(); 2531 containment = [ 2532 this.containment[ 0 ] + co.left, 2533 this.containment[ 1 ] + co.top, 2534 this.containment[ 2 ] + co.left, 2535 this.containment[ 3 ] + co.top 2536 ]; 2537 } else { 2538 containment = this.containment; 2539 } 2540 2541 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 2542 pageX = containment[ 0 ] + this.offset.click.left; 2543 } 2544 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 2545 pageY = containment[ 1 ] + this.offset.click.top; 2546 } 2547 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 2548 pageX = containment[ 2 ] + this.offset.click.left; 2549 } 2550 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 2551 pageY = containment[ 3 ] + this.offset.click.top; 2552 } 2553 } 2554 2555 if ( o.grid ) { 2556 2557 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2558 // argument errors in IE (see ticket #6950) 2559 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 2560 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 2561 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 2562 top - this.offset.click.top > containment[ 3 ] ) ? 2563 top : 2564 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 2565 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 2566 2567 left = o.grid[ 0 ] ? this.originalPageX + 2568 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 2569 this.originalPageX; 2570 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 2571 left - this.offset.click.left > containment[ 2 ] ) ? 2572 left : 2573 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 2574 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 2575 } 2576 2577 if ( o.axis === "y" ) { 2578 pageX = this.originalPageX; 2579 } 2580 2581 if ( o.axis === "x" ) { 2582 pageY = this.originalPageY; 2583 } 2584 } 2585 2586 return { 2587 top: ( 2588 2589 // The absolute mouse position 2590 pageY - 2591 2592 // Click offset (relative to the element) 2593 this.offset.click.top - 2594 2595 // Only for relative positioned nodes: Relative offset from element to offset parent 2596 this.offset.relative.top - 2597 2598 // The offsetParent's offset without borders (offset + border) 2599 this.offset.parent.top + 2600 ( this.cssPosition === "fixed" ? 2601 -this.offset.scroll.top : 2602 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 2603 ), 2604 left: ( 2605 2606 // The absolute mouse position 2607 pageX - 2608 2609 // Click offset (relative to the element) 2610 this.offset.click.left - 2611 2612 // Only for relative positioned nodes: Relative offset from element to offset parent 2613 this.offset.relative.left - 2614 2615 // The offsetParent's offset without borders (offset + border) 2616 this.offset.parent.left + 2617 ( this.cssPosition === "fixed" ? 2618 -this.offset.scroll.left : 2619 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 2620 ) 2621 }; 2622 2623 }, 2624 2625 _clear: function() { 2626 this._removeClass( this.helper, "ui-draggable-dragging" ); 2627 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 2628 this.helper.remove(); 2629 } 2630 this.helper = null; 2631 this.cancelHelperRemoval = false; 2632 if ( this.destroyOnClear ) { 2633 this.destroy(); 2634 } 2635 }, 2636 2637 // From now on bulk stuff - mainly helpers 2638 2639 _trigger: function( type, event, ui ) { 2640 ui = ui || this._uiHash(); 2641 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 2642 2643 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2644 if ( /^(drag|start|stop)/.test( type ) ) { 2645 this.positionAbs = this._convertPositionTo( "absolute" ); 2646 ui.offset = this.positionAbs; 2647 } 2648 return $.Widget.prototype._trigger.call( this, type, event, ui ); 2649 }, 2650 2651 plugins: {}, 2652 2653 _uiHash: function() { 2654 return { 2655 helper: this.helper, 2656 position: this.position, 2657 originalPosition: this.originalPosition, 2658 offset: this.positionAbs 2659 }; 2660 } 2661 2662} ); 2663 2664$.ui.plugin.add( "draggable", "connectToSortable", { 2665 start: function( event, ui, draggable ) { 2666 var uiSortable = $.extend( {}, ui, { 2667 item: draggable.element 2668 } ); 2669 2670 draggable.sortables = []; 2671 $( draggable.options.connectToSortable ).each( function() { 2672 var sortable = $( this ).sortable( "instance" ); 2673 2674 if ( sortable && !sortable.options.disabled ) { 2675 draggable.sortables.push( sortable ); 2676 2677 // RefreshPositions is called at drag start to refresh the containerCache 2678 // which is used in drag. This ensures it's initialized and synchronized 2679 // with any changes that might have happened on the page since initialization. 2680 sortable.refreshPositions(); 2681 sortable._trigger( "activate", event, uiSortable ); 2682 } 2683 } ); 2684 }, 2685 stop: function( event, ui, draggable ) { 2686 var uiSortable = $.extend( {}, ui, { 2687 item: draggable.element 2688 } ); 2689 2690 draggable.cancelHelperRemoval = false; 2691 2692 $.each( draggable.sortables, function() { 2693 var sortable = this; 2694 2695 if ( sortable.isOver ) { 2696 sortable.isOver = 0; 2697 2698 // Allow this sortable to handle removing the helper 2699 draggable.cancelHelperRemoval = true; 2700 sortable.cancelHelperRemoval = false; 2701 2702 // Use _storedCSS To restore properties in the sortable, 2703 // as this also handles revert (#9675) since the draggable 2704 // may have modified them in unexpected ways (#8809) 2705 sortable._storedCSS = { 2706 position: sortable.placeholder.css( "position" ), 2707 top: sortable.placeholder.css( "top" ), 2708 left: sortable.placeholder.css( "left" ) 2709 }; 2710 2711 sortable._mouseStop( event ); 2712 2713 // Once drag has ended, the sortable should return to using 2714 // its original helper, not the shared helper from draggable 2715 sortable.options.helper = sortable.options._helper; 2716 } else { 2717 2718 // Prevent this Sortable from removing the helper. 2719 // However, don't set the draggable to remove the helper 2720 // either as another connected Sortable may yet handle the removal. 2721 sortable.cancelHelperRemoval = true; 2722 2723 sortable._trigger( "deactivate", event, uiSortable ); 2724 } 2725 } ); 2726 }, 2727 drag: function( event, ui, draggable ) { 2728 $.each( draggable.sortables, function() { 2729 var innermostIntersecting = false, 2730 sortable = this; 2731 2732 // Copy over variables that sortable's _intersectsWith uses 2733 sortable.positionAbs = draggable.positionAbs; 2734 sortable.helperProportions = draggable.helperProportions; 2735 sortable.offset.click = draggable.offset.click; 2736 2737 if ( sortable._intersectsWith( sortable.containerCache ) ) { 2738 innermostIntersecting = true; 2739 2740 $.each( draggable.sortables, function() { 2741 2742 // Copy over variables that sortable's _intersectsWith uses 2743 this.positionAbs = draggable.positionAbs; 2744 this.helperProportions = draggable.helperProportions; 2745 this.offset.click = draggable.offset.click; 2746 2747 if ( this !== sortable && 2748 this._intersectsWith( this.containerCache ) && 2749 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 2750 innermostIntersecting = false; 2751 } 2752 2753 return innermostIntersecting; 2754 } ); 2755 } 2756 2757 if ( innermostIntersecting ) { 2758 2759 // If it intersects, we use a little isOver variable and set it once, 2760 // so that the move-in stuff gets fired only once. 2761 if ( !sortable.isOver ) { 2762 sortable.isOver = 1; 2763 2764 // Store draggable's parent in case we need to reappend to it later. 2765 draggable._parent = ui.helper.parent(); 2766 2767 sortable.currentItem = ui.helper 2768 .appendTo( sortable.element ) 2769 .data( "ui-sortable-item", true ); 2770 2771 // Store helper option to later restore it
vendor: 11,036 bytes, lines 2772-3149
2772 sortable.options._helper = sortable.options.helper; 2773 2774 sortable.options.helper = function() { 2775 return ui.helper[ 0 ]; 2776 }; 2777 2778 // Fire the start events of the sortable with our passed browser event, 2779 // and our own helper (so it doesn't create a new one) 2780 event.target = sortable.currentItem[ 0 ]; 2781 sortable._mouseCapture( event, true ); 2782 sortable._mouseStart( event, true, true ); 2783 2784 // Because the browser event is way off the new appended portlet, 2785 // modify necessary variables to reflect the changes 2786 sortable.offset.click.top = draggable.offset.click.top; 2787 sortable.offset.click.left = draggable.offset.click.left; 2788 sortable.offset.parent.left -= draggable.offset.parent.left - 2789 sortable.offset.parent.left; 2790 sortable.offset.parent.top -= draggable.offset.parent.top - 2791 sortable.offset.parent.top; 2792 2793 draggable._trigger( "toSortable", event ); 2794 2795 // Inform draggable that the helper is in a valid drop zone, 2796 // used solely in the revert option to handle "valid/invalid". 2797 draggable.dropped = sortable.element; 2798 2799 // Need to refreshPositions of all sortables in the case that 2800 // adding to one sortable changes the location of the other sortables (#9675) 2801 $.each( draggable.sortables, function() { 2802 this.refreshPositions(); 2803 } ); 2804 2805 // Hack so receive/update callbacks work (mostly) 2806 draggable.currentItem = draggable.element; 2807 sortable.fromOutside = draggable; 2808 } 2809 2810 if ( sortable.currentItem ) { 2811 sortable._mouseDrag( event ); 2812 2813 // Copy the sortable's position because the draggable's can potentially reflect 2814 // a relative position, while sortable is always absolute, which the dragged 2815 // element has now become. (#8809) 2816 ui.position = sortable.position; 2817 } 2818 } else { 2819 2820 // If it doesn't intersect with the sortable, and it intersected before, 2821 // we fake the drag stop of the sortable, but make sure it doesn't remove 2822 // the helper by using cancelHelperRemoval. 2823 if ( sortable.isOver ) { 2824 2825 sortable.isOver = 0; 2826 sortable.cancelHelperRemoval = true; 2827 2828 // Calling sortable's mouseStop would trigger a revert, 2829 // so revert must be temporarily false until after mouseStop is called. 2830 sortable.options._revert = sortable.options.revert; 2831 sortable.options.revert = false; 2832 2833 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 2834 sortable._mouseStop( event, true ); 2835 2836 // Restore sortable behaviors that were modfied 2837 // when the draggable entered the sortable area (#9481) 2838 sortable.options.revert = sortable.options._revert; 2839 sortable.options.helper = sortable.options._helper; 2840 2841 if ( sortable.placeholder ) { 2842 sortable.placeholder.remove(); 2843 } 2844 2845 // Restore and recalculate the draggable's offset considering the sortable 2846 // may have modified them in unexpected ways. (#8809, #10669) 2847 ui.helper.appendTo( draggable._parent ); 2848 draggable._refreshOffsets( event ); 2849 ui.position = draggable._generatePosition( event, true ); 2850 2851 draggable._trigger( "fromSortable", event ); 2852 2853 // Inform draggable that the helper is no longer in a valid drop zone 2854 draggable.dropped = false; 2855 2856 // Need to refreshPositions of all sortables just in case removing 2857 // from one sortable changes the location of other sortables (#9675) 2858 $.each( draggable.sortables, function() { 2859 this.refreshPositions(); 2860 } ); 2861 } 2862 } 2863 } ); 2864 } 2865} ); 2866 2867$.ui.plugin.add( "draggable", "cursor", { 2868 start: function( event, ui, instance ) { 2869 var t = $( "body" ), 2870 o = instance.options; 2871 2872 if ( t.css( "cursor" ) ) { 2873 o._cursor = t.css( "cursor" ); 2874 } 2875 t.css( "cursor", o.cursor ); 2876 }, 2877 stop: function( event, ui, instance ) { 2878 var o = instance.options; 2879 if ( o._cursor ) { 2880 $( "body" ).css( "cursor", o._cursor ); 2881 } 2882 } 2883} ); 2884 2885$.ui.plugin.add( "draggable", "opacity", { 2886 start: function( event, ui, instance ) { 2887 var t = $( ui.helper ), 2888 o = instance.options; 2889 if ( t.css( "opacity" ) ) { 2890 o._opacity = t.css( "opacity" ); 2891 } 2892 t.css( "opacity", o.opacity ); 2893 }, 2894 stop: function( event, ui, instance ) { 2895 var o = instance.options; 2896 if ( o._opacity ) { 2897 $( ui.helper ).css( "opacity", o._opacity ); 2898 } 2899 } 2900} ); 2901 2902$.ui.plugin.add( "draggable", "scroll", { 2903 start: function( event, ui, i ) { 2904 if ( !i.scrollParentNotHidden ) { 2905 i.scrollParentNotHidden = i.helper.scrollParent( false ); 2906 } 2907 2908 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 2909 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 2910 i.overflowOffset = i.scrollParentNotHidden.offset(); 2911 } 2912 }, 2913 drag: function( event, ui, i ) { 2914 2915 var o = i.options, 2916 scrolled = false, 2917 scrollParent = i.scrollParentNotHidden[ 0 ], 2918 document = i.document[ 0 ]; 2919 2920 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 2921 if ( !o.axis || o.axis !== "x" ) { 2922 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 2923 o.scrollSensitivity ) { 2924 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 2925 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 2926 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 2927 } 2928 } 2929 2930 if ( !o.axis || o.axis !== "y" ) { 2931 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 2932 o.scrollSensitivity ) { 2933 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 2934 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 2935 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 2936 } 2937 } 2938 2939 } else { 2940 2941 if ( !o.axis || o.axis !== "x" ) { 2942 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 2943 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 2944 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 2945 o.scrollSensitivity ) { 2946 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 2947 } 2948 } 2949 2950 if ( !o.axis || o.axis !== "y" ) { 2951 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 2952 scrolled = $( document ).scrollLeft( 2953 $( document ).scrollLeft() - o.scrollSpeed 2954 ); 2955 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 2956 o.scrollSensitivity ) { 2957 scrolled = $( document ).scrollLeft( 2958 $( document ).scrollLeft() + o.scrollSpeed 2959 ); 2960 } 2961 } 2962 2963 } 2964 2965 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 2966 $.ui.ddmanager.prepareOffsets( i, event ); 2967 } 2968 2969 } 2970} ); 2971 2972$.ui.plugin.add( "draggable", "snap", { 2973 start: function( event, ui, i ) { 2974 2975 var o = i.options; 2976 2977 i.snapElements = []; 2978 2979 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 2980 .each( function() { 2981 var $t = $( this ), 2982 $o = $t.offset(); 2983 if ( this !== i.element[ 0 ] ) { 2984 i.snapElements.push( { 2985 item: this, 2986 width: $t.outerWidth(), height: $t.outerHeight(), 2987 top: $o.top, left: $o.left 2988 } ); 2989 } 2990 } ); 2991 2992 }, 2993 drag: function( event, ui, inst ) { 2994 2995 var ts, bs, ls, rs, l, r, t, b, i, first, 2996 o = inst.options, 2997 d = o.snapTolerance, 2998 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 2999 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 3000 3001 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 3002 3003 l = inst.snapElements[ i ].left - inst.margins.left; 3004 r = l + inst.snapElements[ i ].width; 3005 t = inst.snapElements[ i ].top - inst.margins.top; 3006 b = t + inst.snapElements[ i ].height; 3007 3008 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 3009 !$.contains( inst.snapElements[ i ].item.ownerDocument, 3010 inst.snapElements[ i ].item ) ) { 3011 if ( inst.snapElements[ i ].snapping ) { 3012 if ( inst.options.snap.release ) { 3013 inst.options.snap.release.call( 3014 inst.element, 3015 event, 3016 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 3017 ); 3018 } 3019 } 3020 inst.snapElements[ i ].snapping = false; 3021 continue; 3022 } 3023 3024 if ( o.snapMode !== "inner" ) { 3025 ts = Math.abs( t - y2 ) <= d; 3026 bs = Math.abs( b - y1 ) <= d; 3027 ls = Math.abs( l - x2 ) <= d; 3028 rs = Math.abs( r - x1 ) <= d; 3029 if ( ts ) { 3030 ui.position.top = inst._convertPositionTo( "relative", { 3031 top: t - inst.helperProportions.height, 3032 left: 0 3033 } ).top; 3034 } 3035 if ( bs ) { 3036 ui.position.top = inst._convertPositionTo( "relative", { 3037 top: b, 3038 left: 0 3039 } ).top; 3040 } 3041 if ( ls ) { 3042 ui.position.left = inst._convertPositionTo( "relative", { 3043 top: 0, 3044 left: l - inst.helperProportions.width 3045 } ).left; 3046 } 3047 if ( rs ) { 3048 ui.position.left = inst._convertPositionTo( "relative", { 3049 top: 0, 3050 left: r 3051 } ).left; 3052 } 3053 } 3054 3055 first = ( ts || bs || ls || rs ); 3056 3057 if ( o.snapMode !== "outer" ) { 3058 ts = Math.abs( t - y1 ) <= d; 3059 bs = Math.abs( b - y2 ) <= d; 3060 ls = Math.abs( l - x1 ) <= d; 3061 rs = Math.abs( r - x2 ) <= d; 3062 if ( ts ) { 3063 ui.position.top = inst._convertPositionTo( "relative", { 3064 top: t, 3065 left: 0 3066 } ).top; 3067 } 3068 if ( bs ) { 3069 ui.position.top = inst._convertPositionTo( "relative", { 3070 top: b - inst.helperProportions.height, 3071 left: 0 3072 } ).top; 3073 } 3074 if ( ls ) { 3075 ui.position.left = inst._convertPositionTo( "relative", { 3076 top: 0, 3077 left: l 3078 } ).left; 3079 } 3080 if ( rs ) { 3081 ui.position.left = inst._convertPositionTo( "relative", { 3082 top: 0, 3083 left: r - inst.helperProportions.width 3084 } ).left; 3085 } 3086 } 3087 3088 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 3089 if ( inst.options.snap.snap ) { 3090 inst.options.snap.snap.call( 3091 inst.element, 3092 event, 3093 $.extend( inst._uiHash(), { 3094 snapItem: inst.snapElements[ i ].item 3095 } ) ); 3096 } 3097 } 3098 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 3099 3100 } 3101 3102 } 3103} ); 3104 3105$.ui.plugin.add( "draggable", "stack", { 3106 start: function( event, ui, instance ) { 3107 var min, 3108 o = instance.options, 3109 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 3110 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 3111 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 3112 } ); 3113 3114 if ( !group.length ) { 3115 return; 3116 } 3117 3118 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 3119 $( group ).each( function( i ) { 3120 $( this ).css( "zIndex", min + i ); 3121 } ); 3122 this.css( "zIndex", ( min + group.length ) ); 3123 } 3124} ); 3125 3126$.ui.plugin.add( "draggable", "zIndex", { 3127 start: function( event, ui, instance ) { 3128 var t = $( ui.helper ), 3129 o = instance.options; 3130 3131 if ( t.css( "zIndex" ) ) { 3132 o._zIndex = t.css( "zIndex" ); 3133 } 3134 t.css( "zIndex", o.zIndex ); 3135 }, 3136 stop: function( event, ui, instance ) { 3137 var o = instance.options; 3138 3139 if ( o._zIndex ) { 3140 $( ui.helper ).css( "zIndex", o._zIndex ); 3141 } 3142 } 3143} ); 3144 3145var widgetsDraggable = $.ui.draggable; 3146 3147 3148/*! 3149 * jQuery UI
3149Droppable 1.14.0 3150 * https://jqueryui.com 3151 * 3152 * Copyright OpenJS Foundation and other contributors 3153 * Released under the MIT license. 3154 * https://jquery.org/license 3155 */ 3156 3157//>>label: Droppable 3158//>>group: Interactions 3159//>>description: Enables drop targets for draggable elements. 3160//>>docs: https://api.jqueryui.com/droppable/ 3161//>>demos: https://jqueryui.com/droppable/ 3162 3163 3164$.widget( "ui.droppable", { 3165 version: "1.14.0
vendor: 12,166 bytes, lines 3165-3632
3165", 3166 widgetEventPrefix: "drop", 3167 options: { 3168 accept: "*", 3169 addClasses: true, 3170 greedy: false, 3171 scope: "default", 3172 tolerance: "intersect", 3173 3174 // Callbacks 3175 activate: null, 3176 deactivate: null, 3177 drop: null, 3178 out: null, 3179 over: null 3180 }, 3181 _create: function() { 3182 3183 var proportions, 3184 o = this.options, 3185 accept = o.accept; 3186 3187 this.isover = false; 3188 this.isout = true; 3189 3190 this.accept = typeof accept === "function" ? accept : function( d ) { 3191 return d.is( accept ); 3192 }; 3193 3194 this.proportions = function( /* valueToWrite */ ) { 3195 if ( arguments.length ) { 3196 3197 // Store the droppable's proportions 3198 proportions = arguments[ 0 ]; 3199 } else { 3200 3201 // Retrieve or derive the droppable's proportions 3202 return proportions ? 3203 proportions : 3204 proportions = { 3205 width: this.element[ 0 ].offsetWidth, 3206 height: this.element[ 0 ].offsetHeight 3207 }; 3208 } 3209 }; 3210 3211 this._addToManager( o.scope ); 3212 3213 if ( o.addClasses ) { 3214 this._addClass( "ui-droppable" ); 3215 } 3216 3217 }, 3218 3219 _addToManager: function( scope ) { 3220 3221 // Add the reference and positions to the manager 3222 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 3223 $.ui.ddmanager.droppables[ scope ].push( this ); 3224 }, 3225 3226 _splice: function( drop ) { 3227 var i = 0; 3228 for ( ; i < drop.length; i++ ) { 3229 if ( drop[ i ] === this ) { 3230 drop.splice( i, 1 ); 3231 } 3232 } 3233 }, 3234 3235 _destroy: function() { 3236 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 3237 3238 this._splice( drop ); 3239 }, 3240 3241 _setOption: function( key, value ) { 3242 3243 if ( key === "accept" ) { 3244 this.accept = typeof value === "function" ? value : function( d ) { 3245 return d.is( value ); 3246 }; 3247 } else if ( key === "scope" ) { 3248 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 3249 3250 this._splice( drop ); 3251 this._addToManager( value ); 3252 } 3253 3254 this._super( key, value ); 3255 }, 3256 3257 _activate: function( event ) { 3258 var draggable = $.ui.ddmanager.current; 3259 3260 this._addActiveClass(); 3261 if ( draggable ) { 3262 this._trigger( "activate", event, this.ui( draggable ) ); 3263 } 3264 }, 3265 3266 _deactivate: function( event ) { 3267 var draggable = $.ui.ddmanager.current; 3268 3269 this._removeActiveClass(); 3270 if ( draggable ) { 3271 this._trigger( "deactivate", event, this.ui( draggable ) ); 3272 } 3273 }, 3274 3275 _over: function( event ) { 3276 3277 var draggable = $.ui.ddmanager.current; 3278 3279 // Bail if draggable and droppable are same element 3280 if ( !draggable || ( draggable.currentItem || 3281 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3282 return; 3283 } 3284 3285 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 3286 draggable.element ) ) ) { 3287 this._addHoverClass(); 3288 this._trigger( "over", event, this.ui( draggable ) ); 3289 } 3290 3291 }, 3292 3293 _out: function( event ) { 3294 3295 var draggable = $.ui.ddmanager.current; 3296 3297 // Bail if draggable and droppable are same element 3298 if ( !draggable || ( draggable.currentItem || 3299 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3300 return; 3301 } 3302 3303 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 3304 draggable.element ) ) ) { 3305 this._removeHoverClass(); 3306 this._trigger( "out", event, this.ui( draggable ) ); 3307 } 3308 3309 }, 3310 3311 _drop: function( event, custom ) { 3312 3313 var draggable = custom || $.ui.ddmanager.current, 3314 childrenIntersection = false; 3315 3316 // Bail if draggable and droppable are same element 3317 if ( !draggable || ( draggable.currentItem || 3318 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3319 return false; 3320 } 3321 3322 this.element 3323 .find( ":data(ui-droppable)" ) 3324 .not( ".ui-draggable-dragging" ) 3325 .each( function() { 3326 var inst = $( this ).droppable( "instance" ); 3327 if ( 3328 inst.options.greedy && 3329 !inst.options.disabled && 3330 inst.options.scope === draggable.options.scope && 3331 inst.accept.call( 3332 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 3333 ) && 3334 $.ui.intersect( 3335 draggable, 3336 $.extend( inst, { offset: inst.element.offset() } ), 3337 inst.options.tolerance, event 3338 ) 3339 ) { 3340 childrenIntersection = true; 3341 return false; 3342 } 3343 } ); 3344 if ( childrenIntersection ) { 3345 return false; 3346 } 3347 3348 if ( this.accept.call( this.element[ 0 ], 3349 ( draggable.currentItem || draggable.element ) ) ) { 3350 this._removeActiveClass(); 3351 this._removeHoverClass(); 3352 3353 this._trigger( "drop", event, this.ui( draggable ) ); 3354 return this.element; 3355 } 3356 3357 return false; 3358 3359 }, 3360 3361 ui: function( c ) { 3362 return { 3363 draggable: ( c.currentItem || c.element ), 3364 helper: c.helper, 3365 position: c.position, 3366 offset: c.positionAbs 3367 }; 3368 }, 3369 3370 // Extension points just to make backcompat sane and avoid duplicating logic 3371 // TODO: Remove in 1.14 along with call to it below 3372 _addHoverClass: function() { 3373 this._addClass( "ui-droppable-hover" ); 3374 }, 3375 3376 _removeHoverClass: function() { 3377 this._removeClass( "ui-droppable-hover" ); 3378 }, 3379 3380 _addActiveClass: function() { 3381 this._addClass( "ui-droppable-active" ); 3382 }, 3383 3384 _removeActiveClass: function() { 3385 this._removeClass( "ui-droppable-active" ); 3386 } 3387} ); 3388 3389$.ui.intersect = ( function() { 3390 function isOverAxis( x, reference, size ) { 3391 return ( x >= reference ) && ( x < ( reference + size ) ); 3392 } 3393 3394 return function( draggable, droppable, toleranceMode, event ) { 3395 3396 if ( !droppable.offset ) { 3397 return false; 3398 } 3399 3400 var x1 = ( draggable.positionAbs || 3401 draggable.position.absolute ).left + draggable.margins.left, 3402 y1 = ( draggable.positionAbs || 3403 draggable.position.absolute ).top + draggable.margins.top, 3404 x2 = x1 + draggable.helperProportions.width, 3405 y2 = y1 + draggable.helperProportions.height, 3406 l = droppable.offset.left, 3407 t = droppable.offset.top, 3408 r = l + droppable.proportions().width, 3409 b = t + droppable.proportions().height; 3410 3411 switch ( toleranceMode ) { 3412 case "fit": 3413 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 3414 case "intersect": 3415 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 3416 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 3417 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 3418 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 3419 case "pointer": 3420 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 3421 isOverAxis( event.pageX, l, droppable.proportions().width ); 3422 case "touch": 3423 return ( 3424 ( y1 >= t && y1 <= b ) || // Top edge touching 3425 ( y2 >= t && y2 <= b ) || // Bottom edge touching 3426 ( y1 < t && y2 > b ) // Surrounded vertically 3427 ) && ( 3428 ( x1 >= l && x1 <= r ) || // Left edge touching 3429 ( x2 >= l && x2 <= r ) || // Right edge touching 3430 ( x1 < l && x2 > r ) // Surrounded horizontally 3431 ); 3432 default: 3433 return false; 3434 } 3435 }; 3436} )(); 3437 3438/* 3439 This manager tracks offsets of draggables and droppables 3440*/ 3441$.ui.ddmanager = { 3442 current: null, 3443 droppables: { "default": [] }, 3444 prepareOffsets: function( t, event ) { 3445 3446 var i, j, 3447 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 3448 type = event ? event.type : null, // workaround for #2317 3449 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 3450 3451 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 3452 3453 // No disabled and non-accepted 3454 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 3455 ( t.currentItem || t.element ) ) ) ) { 3456 continue; 3457 } 3458 3459 // Filter out elements in the current dragged item 3460 for ( j = 0; j < list.length; j++ ) { 3461 if ( list[ j ] === m[ i ].element[ 0 ] ) { 3462 m[ i ].proportions().height = 0; 3463 continue droppablesLoop; 3464 } 3465 } 3466 3467 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 3468 if ( !m[ i ].visible ) { 3469 continue; 3470 } 3471 3472 // Activate the droppable if used directly from draggables 3473 if ( type === "mousedown" ) { 3474 m[ i ]._activate.call( m[ i ], event ); 3475 } 3476 3477 m[ i ].offset = m[ i ].element.offset(); 3478 m[ i ].proportions( { 3479 width: m[ i ].element[ 0 ].offsetWidth, 3480 height: m[ i ].element[ 0 ].offsetHeight 3481 } ); 3482 3483 } 3484 3485 }, 3486 drop: function( draggable, event ) { 3487 3488 var dropped = false; 3489 3490 // Create a copy of the droppables in case the list changes during the drop (#9116) 3491 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 3492 3493 if ( !this.options ) { 3494 return; 3495 } 3496 if ( !this.options.disabled && this.visible && 3497 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { 3498 dropped = this._drop.call( this, event ) || dropped; 3499 } 3500 3501 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 3502 ( draggable.currentItem || draggable.element ) ) ) { 3503 this.isout = true; 3504 this.isover = false; 3505 this._deactivate.call( this, event ); 3506 } 3507 3508 } ); 3509 return dropped; 3510 3511 }, 3512 dragStart: function( draggable, event ) { 3513 3514 // Listen for scrolling so that if the dragging causes scrolling the position of the 3515 // droppables can be recalculated (see #5003) 3516 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 3517 if ( !draggable.options.refreshPositions ) { 3518 $.ui.ddmanager.prepareOffsets( draggable, event ); 3519 } 3520 } ); 3521 }, 3522 drag: function( draggable, event ) { 3523 3524 // If you have a highly dynamic page, you might try this option. It renders positions 3525 // every time you move the mouse. 3526 if ( draggable.options.refreshPositions ) { 3527 $.ui.ddmanager.prepareOffsets( draggable, event ); 3528 } 3529 3530 // Run through all droppables and check their positions based on specific tolerance options 3531 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 3532 3533 if ( this.options.disabled || this.greedyChild || !this.visible ) { 3534 return; 3535 } 3536 3537 var parentInstance, scope, parent, 3538 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), 3539 c = !intersects && this.isover ? 3540 "isout" : 3541 ( intersects && !this.isover ? "isover" : null ); 3542 if ( !c ) { 3543 return; 3544 } 3545 3546 if ( this.options.greedy ) { 3547 3548 // find droppable parents with same scope 3549 scope = this.options.scope; 3550 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 3551 return $( this ).droppable( "instance" ).options.scope === scope; 3552 } ); 3553 3554 if ( parent.length ) { 3555 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 3556 parentInstance.greedyChild = ( c === "isover" ); 3557 } 3558 } 3559 3560 // We just moved into a greedy child 3561 if ( parentInstance && c === "isover" ) { 3562 parentInstance.isover = false; 3563 parentInstance.isout = true; 3564 parentInstance._out.call( parentInstance, event ); 3565 } 3566 3567 this[ c ] = true; 3568 this[ c === "isout" ? "isover" : "isout" ] = false; 3569 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 3570 3571 // We just moved out of a greedy child 3572 if ( parentInstance && c === "isout" ) { 3573 parentInstance.isout = false; 3574 parentInstance.isover = true; 3575 parentInstance._over.call( parentInstance, event ); 3576 } 3577 } ); 3578 3579 }, 3580 dragStop: function( draggable, event ) { 3581 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 3582 3583 // Call prepareOffsets one final time since IE does not fire return scroll events when 3584 // overflow was caused by drag (see #5003) 3585 if ( !draggable.options.refreshPositions ) { 3586 $.ui.ddmanager.prepareOffsets( draggable, event ); 3587 } 3588 } 3589}; 3590 3591// DEPRECATED 3592// TODO: switch return back to widget declaration at top of file when this is removed 3593if ( $.uiBackCompat === true ) { 3594 3595 // Backcompat for activeClass and hoverClass options 3596 $.widget( "ui.droppable", $.ui.droppable, { 3597 options: { 3598 hoverClass: false, 3599 activeClass: false 3600 }, 3601 _addActiveClass: function() { 3602 this._super(); 3603 if ( this.options.activeClass ) { 3604 this.element.addClass( this.options.activeClass ); 3605 } 3606 }, 3607 _removeActiveClass: function() { 3608 this._super(); 3609 if ( this.options.activeClass ) { 3610 this.element.removeClass( this.options.activeClass ); 3611 } 3612 }, 3613 _addHoverClass: function() { 3614 this._super(); 3615 if ( this.options.hoverClass ) { 3616 this.element.addClass( this.options.hoverClass ); 3617 } 3618 }, 3619 _removeHoverClass: function() { 3620 this._super(); 3621 if ( this.options.hoverClass ) { 3622 this.element.removeClass( this.options.hoverClass ); 3623 } 3624 } 3625 } ); 3626} 3627 3628var widgetsDroppable = $.ui.droppable; 3629 3630 3631/*! 3632 * jQuery UI
3632Resizable 1.14.0 3633 * https://jqueryui.com 3634 * 3635 * Copyright OpenJS Foundation and other contributors 3636 * Released under the MIT license. 3637 * https://jquery.org/license 3638 */ 3639 3640//>>label: Resizable 3641//>>group: Interactions 3642//>>description: Enables resize functionality for any element. 3643//>>docs: https://api.jqueryui.com/resizable/ 3644//>>demos: https://jqueryui.com/resizable/ 3645//>>css.structure: ../../themes/base/core.css 3646//>>css.structure: ../../themes/base/resizable.css 3647//>>css.theme: ../../themes/base/theme.css 3648 3649 3650$.widget( "ui.resizable", $.ui.mouse, { 3651 version: "1.14.0", 3652 widgetEventPrefix: "resize", 3653 options: { 3654 alsoResize: false, 3655 animate: false, 3656 animateDuration: "slow", 3657 animateEasing: "swing", 3658 aspectRatio: false, 3659 autoHide: false, 3660 classes: { 3661 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3662 }, 3663 containment: false, 3664 ghost: false, 3665 grid: false, 3666 handles: "e,s,se", 3667 helper: false, 3668 maxHeight: null, 3669 maxWidth: null, 3670 minHeight: 10, 3671 minWidth: 10, 3672 3673 // See #7960 3674 zIndex: 90, 3675 3676 // Callbacks 3677 resize: null, 3678 start: null, 3679 stop: null 3680 }, 3681 3682 _num: function( value ) { 3683 return parseFloat( value ) || 0; 3684 }, 3685 3686 _isNumber: function( value ) { 3687 return !isNaN( parseFloat( value ) ); 3688 }, 3689 3690 _hasScroll: function( el, a ) { 3691 3692 if ( $( el ).css( "overflow" ) === "hidden" ) { 3693 return false;
vendor: 2,099 bytes, lines 3694-3771
3694 } 3695 3696 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 3697 has = false; 3698 3699 if ( el[ scroll ] > 0 ) { 3700 return true; 3701 } 3702 3703 // TODO: determine which cases actually cause this to happen 3704 // if the element doesn't have the scroll set, see if it's possible to 3705 // set the scroll 3706 try { 3707 el[ scroll ] = 1; 3708 has = ( el[ scroll ] > 0 ); 3709 el[ scroll ] = 0; 3710 } catch ( e ) { 3711 3712 // `el` might be a string, then setting `scroll` will throw 3713 // an error in strict mode; ignore it. 3714 } 3715 return has; 3716 }, 3717 3718 _create: function() { 3719 3720 var margins, 3721 o = this.options, 3722 that = this; 3723 this._addClass( "ui-resizable" ); 3724 3725 $.extend( this, { 3726 _aspectRatio: !!( o.aspectRatio ), 3727 aspectRatio: o.aspectRatio, 3728 originalElement: this.element, 3729 _proportionallyResizeElements: [], 3730 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3731 } ); 3732 3733 // Wrap the element if it cannot hold child nodes 3734 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 3735 3736 this.element.wrap( 3737 $( "<div class='ui-wrapper'></div>" ).css( { 3738 overflow: "hidden", 3739 position: this.element.css( "position" ), 3740 width: this.element.outerWidth(), 3741 height: this.element.outerHeight(), 3742 top: this.element.css( "top" ), 3743 left: this.element.css( "left" ) 3744 } ) 3745 ); 3746 3747 this.element = this.element.parent().data( 3748 "ui-resizable", this.element.resizable( "instance" ) 3749 ); 3750 3751 this.elementIsWrapper = true; 3752 3753 margins = { 3754 marginTop: this.originalElement.css( "marginTop" ), 3755 marginRight: this.originalElement.css( "marginRight" ), 3756 marginBottom: this.originalElement.css( "marginBottom" ), 3757 marginLeft: this.originalElement.css( "marginLeft" ) 3758 }; 3759 3760 this.element.css( margins ); 3761 3762 // Support: Safari 3763 // Prevent Safari textarea resize 3764 this.originalResizeStyle = this.originalElement.css( "resize" ); 3765 this.originalElement.css( "resize", "none" ); 3766 3767 this._proportionallyResizeElements.push( this.originalElement.css( { 3768 position: "static", 3769 zoom: 1, 3770 display: "block" 3771 } )
vendor: 23,890 bytes, lines 3771-4720
3771 ); 3772 3773 this._proportionallyResize(); 3774 } 3775 3776 this._setupHandles(); 3777 3778 if ( o.autoHide ) { 3779 $( this.element ) 3780 .on( "mouseenter", function() { 3781 if ( o.disabled ) { 3782 return; 3783 } 3784 that._removeClass( "ui-resizable-autohide" ); 3785 that._handles.show(); 3786 } ) 3787 .on( "mouseleave", function() { 3788 if ( o.disabled ) { 3789 return; 3790 } 3791 if ( !that.resizing ) { 3792 that._addClass( "ui-resizable-autohide" ); 3793 that._handles.hide(); 3794 } 3795 } ); 3796 } 3797 3798 this._mouseInit(); 3799 }, 3800 3801 _destroy: function() { 3802 3803 this._mouseDestroy(); 3804 this._addedHandles.remove(); 3805 3806 var wrapper, 3807 _destroy = function( exp ) { 3808 $( exp ) 3809 .removeData( "resizable" ) 3810 .removeData( "ui-resizable" ) 3811 .off( ".resizable" ); 3812 }; 3813 3814 // TODO: Unwrap at same DOM position 3815 if ( this.elementIsWrapper ) { 3816 _destroy( this.element ); 3817 wrapper = this.element; 3818 this.originalElement.css( { 3819 position: wrapper.css( "position" ), 3820 width: wrapper.outerWidth(), 3821 height: wrapper.outerHeight(), 3822 top: wrapper.css( "top" ), 3823 left: wrapper.css( "left" ) 3824 } ).insertAfter( wrapper ); 3825 wrapper.remove(); 3826 } 3827 3828 this.originalElement.css( "resize", this.originalResizeStyle ); 3829 _destroy( this.originalElement ); 3830 3831 return this; 3832 }, 3833 3834 _setOption: function( key, value ) { 3835 this._super( key, value ); 3836 3837 switch ( key ) { 3838 case "handles": 3839 this._removeHandles(); 3840 this._setupHandles(); 3841 break; 3842 case "aspectRatio": 3843 this._aspectRatio = !!value; 3844 break; 3845 default: 3846 break; 3847 } 3848 }, 3849 3850 _setupHandles: function() { 3851 var o = this.options, handle, i, n, hname, axis, that = this; 3852 this.handles = o.handles || 3853 ( !$( ".ui-resizable-handle", this.element ).length ? 3854 "e,s,se" : { 3855 n: ".ui-resizable-n", 3856 e: ".ui-resizable-e", 3857 s: ".ui-resizable-s", 3858 w: ".ui-resizable-w", 3859 se: ".ui-resizable-se", 3860 sw: ".ui-resizable-sw", 3861 ne: ".ui-resizable-ne", 3862 nw: ".ui-resizable-nw" 3863 } ); 3864 3865 this._handles = $(); 3866 this._addedHandles = $(); 3867 if ( this.handles.constructor === String ) { 3868 3869 if ( this.handles === "all" ) { 3870 this.handles = "n,e,s,w,se,sw,ne,nw"; 3871 } 3872 3873 n = this.handles.split( "," ); 3874 this.handles = {}; 3875 3876 for ( i = 0; i < n.length; i++ ) { 3877 3878 handle = String.prototype.trim.call( n[ i ] ); 3879 hname = "ui-resizable-" + handle; 3880 axis = $( "<div>" ); 3881 this._addClass( axis, "ui-resizable-handle " + hname ); 3882 3883 axis.css( { zIndex: o.zIndex } ); 3884 3885 this.handles[ handle ] = ".ui-resizable-" + handle; 3886 if ( !this.element.children( this.handles[ handle ] ).length ) { 3887 this.element.append( axis ); 3888 this._addedHandles = this._addedHandles.add( axis ); 3889 } 3890 } 3891 3892 } 3893 3894 this._renderAxis = function( target ) { 3895 3896 var i, axis, padPos, padWrapper; 3897 3898 target = target || this.element; 3899 3900 for ( i in this.handles ) { 3901 3902 if ( this.handles[ i ].constructor === String ) { 3903 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 3904 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 3905 this.handles[ i ] = $( this.handles[ i ] ); 3906 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 3907 } 3908 3909 if ( this.elementIsWrapper && 3910 this.originalElement[ 0 ] 3911 .nodeName 3912 .match( /^(textarea|input|select|button)$/i ) ) { 3913 axis = $( this.handles[ i ], this.element ); 3914 3915 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 3916 axis.outerHeight() : 3917 axis.outerWidth(); 3918 3919 padPos = [ "padding", 3920 /ne|nw|n/.test( i ) ? "Top" : 3921 /se|sw|s/.test( i ) ? "Bottom" : 3922 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 3923 3924 target.css( padPos, padWrapper ); 3925 3926 this._proportionallyResize(); 3927 } 3928 3929 this._handles = this._handles.add( this.handles[ i ] ); 3930 } 3931 }; 3932 3933 // TODO: make renderAxis a prototype function 3934 this._renderAxis( this.element ); 3935 3936 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 3937 this._handles.disableSelection(); 3938 3939 this._handles.on( "mouseover", function() { 3940 if ( !that.resizing ) { 3941 if ( this.className ) { 3942 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 3943 } 3944 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 3945 } 3946 } ); 3947 3948 if ( o.autoHide ) { 3949 this._handles.hide(); 3950 this._addClass( "ui-resizable-autohide" ); 3951 } 3952 }, 3953 3954 _removeHandles: function() { 3955 this._addedHandles.remove(); 3956 }, 3957 3958 _mouseCapture: function( event ) { 3959 var i, handle, 3960 capture = false; 3961 3962 for ( i in this.handles ) { 3963 handle = $( this.handles[ i ] )[ 0 ]; 3964 if ( handle === event.target || $.contains( handle, event.target ) ) { 3965 capture = true; 3966 } 3967 } 3968 3969 return !this.options.disabled && capture; 3970 }, 3971 3972 _mouseStart: function( event ) { 3973 3974 var curleft, curtop, cursor, 3975 o = this.options, 3976 el = this.element; 3977 3978 this.resizing = true; 3979 3980 this._renderProxy(); 3981 3982 curleft = this._num( this.helper.css( "left" ) ); 3983 curtop = this._num( this.helper.css( "top" ) ); 3984 3985 if ( o.containment ) { 3986 curleft += $( o.containment ).scrollLeft() || 0; 3987 curtop += $( o.containment ).scrollTop() || 0; 3988 } 3989 3990 this.offset = this.helper.offset(); 3991 this.position = { left: curleft, top: curtop }; 3992 3993 this.size = this._helper ? { 3994 width: this.helper.width(), 3995 height: this.helper.height() 3996 } : { 3997 width: el.width(), 3998 height: el.height() 3999 }; 4000 4001 this.originalSize = this._helper ? { 4002 width: el.outerWidth(), 4003 height: el.outerHeight() 4004 } : { 4005 width: el.width(), 4006 height: el.height() 4007 }; 4008 4009 this.sizeDiff = { 4010 width: el.outerWidth() - el.width(), 4011 height: el.outerHeight() - el.height() 4012 }; 4013 4014 this.originalPosition = { left: curleft, top: curtop }; 4015 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 4016 4017 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 4018 o.aspectRatio : 4019 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 4020 4021 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 4022 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 4023 4024 this._addClass( "ui-resizable-resizing" ); 4025 this._propagate( "start", event ); 4026 return true; 4027 }, 4028 4029 _mouseDrag: function( event ) { 4030 4031 var data, props, 4032 smp = this.originalMousePosition, 4033 a = this.axis, 4034 dx = ( event.pageX - smp.left ) || 0, 4035 dy = ( event.pageY - smp.top ) || 0, 4036 trigger = this._change[ a ]; 4037 4038 this._updatePrevProperties(); 4039 4040 if ( !trigger ) { 4041 return false; 4042 } 4043 4044 data = trigger.apply( this, [ event, dx, dy ] ); 4045 4046 this._updateVirtualBoundaries( event.shiftKey ); 4047 if ( this._aspectRatio || event.shiftKey ) { 4048 data = this._updateRatio( data, event ); 4049 } 4050 4051 data = this._respectSize( data, event ); 4052 4053 this._updateCache( data ); 4054 4055 this._propagate( "resize", event ); 4056 4057 props = this._applyChanges(); 4058 4059 if ( !this._helper && this._proportionallyResizeElements.length ) { 4060 this._proportionallyResize(); 4061 } 4062 4063 if ( !$.isEmptyObject( props ) ) { 4064 this._updatePrevProperties(); 4065 this._trigger( "resize", event, this.ui() ); 4066 this._applyChanges(); 4067 } 4068 4069 return false; 4070 }, 4071 4072 _mouseStop: function( event ) { 4073 4074 this.resizing = false; 4075 var pr, ista, soffseth, soffsetw, s, left, top, 4076 o = this.options, that = this; 4077 4078 if ( this._helper ) { 4079 4080 pr = this._proportionallyResizeElements; 4081 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 4082 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 4083 soffsetw = ista ? 0 : that.sizeDiff.width; 4084 4085 s = { 4086 width: ( that.helper.width() - soffsetw ), 4087 height: ( that.helper.height() - soffseth ) 4088 }; 4089 left = ( parseFloat( that.element.css( "left" ) ) + 4090 ( that.position.left - that.originalPosition.left ) ) || null; 4091 top = ( parseFloat( that.element.css( "top" ) ) + 4092 ( that.position.top - that.originalPosition.top ) ) || null; 4093 4094 if ( !o.animate ) { 4095 this.element.css( $.extend( s, { top: top, left: left } ) ); 4096 } 4097 4098 that.helper.height( that.size.height ); 4099 that.helper.width( that.size.width ); 4100 4101 if ( this._helper && !o.animate ) { 4102 this._proportionallyResize(); 4103 } 4104 } 4105 4106 $( "body" ).css( "cursor", "auto" ); 4107 4108 this._removeClass( "ui-resizable-resizing" ); 4109 4110 this._propagate( "stop", event ); 4111 4112 if ( this._helper ) { 4113 this.helper.remove(); 4114 } 4115 4116 return false; 4117 4118 }, 4119 4120 _updatePrevProperties: function() { 4121 this.prevPosition = { 4122 top: this.position.top, 4123 left: this.position.left 4124 }; 4125 this.prevSize = { 4126 width: this.size.width, 4127 height: this.size.height 4128 }; 4129 }, 4130 4131 _applyChanges: function() { 4132 var props = {}; 4133 4134 if ( this.position.top !== this.prevPosition.top ) { 4135 props.top = this.position.top + "px"; 4136 } 4137 if ( this.position.left !== this.prevPosition.left ) { 4138 props.left = this.position.left + "px"; 4139 } 4140 4141 this.helper.css( props ); 4142 4143 if ( this.size.width !== this.prevSize.width ) { 4144 props.width = this.size.width + "px"; 4145 this.helper.width( props.width ); 4146 } 4147 if ( this.size.height !== this.prevSize.height ) { 4148 props.height = this.size.height + "px"; 4149 this.helper.height( props.height ); 4150 } 4151 4152 return props; 4153 }, 4154 4155 _updateVirtualBoundaries: function( forceAspectRatio ) { 4156 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 4157 o = this.options; 4158 4159 b = { 4160 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 4161 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 4162 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 4163 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 4164 }; 4165 4166 if ( this._aspectRatio || forceAspectRatio ) { 4167 pMinWidth = b.minHeight * this.aspectRatio; 4168 pMinHeight = b.minWidth / this.aspectRatio; 4169 pMaxWidth = b.maxHeight * this.aspectRatio; 4170 pMaxHeight = b.maxWidth / this.aspectRatio; 4171 4172 if ( pMinWidth > b.minWidth ) { 4173 b.minWidth = pMinWidth; 4174 } 4175 if ( pMinHeight > b.minHeight ) { 4176 b.minHeight = pMinHeight; 4177 } 4178 if ( pMaxWidth < b.maxWidth ) { 4179 b.maxWidth = pMaxWidth; 4180 } 4181 if ( pMaxHeight < b.maxHeight ) { 4182 b.maxHeight = pMaxHeight; 4183 } 4184 } 4185 this._vBoundaries = b; 4186 }, 4187 4188 _updateCache: function( data ) { 4189 this.offset = this.helper.offset(); 4190 if ( this._isNumber( data.left ) ) { 4191 this.position.left = data.left; 4192 } 4193 if ( this._isNumber( data.top ) ) { 4194 this.position.top = data.top; 4195 } 4196 if ( this._isNumber( data.height ) ) { 4197 this.size.height = data.height; 4198 } 4199 if ( this._isNumber( data.width ) ) { 4200 this.size.width = data.width; 4201 } 4202 }, 4203 4204 _updateRatio: function( data ) { 4205 4206 var cpos = this.position, 4207 csize = this.size, 4208 a = this.axis; 4209 4210 if ( this._isNumber( data.height ) ) { 4211 data.width = ( data.height * this.aspectRatio ); 4212 } else if ( this._isNumber( data.width ) ) { 4213 data.height = ( data.width / this.aspectRatio ); 4214 } 4215 4216 if ( a === "sw" ) { 4217 data.left = cpos.left + ( csize.width - data.width ); 4218 data.top = null; 4219 } 4220 if ( a === "nw" ) { 4221 data.top = cpos.top + ( csize.height - data.height ); 4222 data.left = cpos.left + ( csize.width - data.width ); 4223 } 4224 4225 return data; 4226 }, 4227 4228 _respectSize: function( data ) { 4229 4230 var o = this._vBoundaries, 4231 a = this.axis, 4232 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 4233 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 4234 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 4235 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 4236 dw = this.originalPosition.left + this.originalSize.width, 4237 dh = this.originalPosition.top + this.originalSize.height, 4238 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 4239 if ( isminw ) { 4240 data.width = o.minWidth; 4241 } 4242 if ( isminh ) { 4243 data.height = o.minHeight; 4244 } 4245 if ( ismaxw ) { 4246 data.width = o.maxWidth; 4247 } 4248 if ( ismaxh ) { 4249 data.height = o.maxHeight; 4250 } 4251 4252 if ( isminw && cw ) { 4253 data.left = dw - o.minWidth; 4254 } 4255 if ( ismaxw && cw ) { 4256 data.left = dw - o.maxWidth; 4257 } 4258 if ( isminh && ch ) { 4259 data.top = dh - o.minHeight; 4260 } 4261 if ( ismaxh && ch ) { 4262 data.top = dh - o.maxHeight; 4263 } 4264 4265 // Fixing jump error on top/left - bug #2330 4266 if ( !data.width && !data.height && !data.left && data.top ) { 4267 data.top = null; 4268 } else if ( !data.width && !data.height && !data.top && data.left ) { 4269 data.left = null; 4270 } 4271 4272 return data; 4273 }, 4274 4275 _getPaddingPlusBorderDimensions: function( element ) { 4276 var i = 0, 4277 widths = [], 4278 borders = [ 4279 element.css( "borderTopWidth" ), 4280 element.css( "borderRightWidth" ), 4281 element.css( "borderBottomWidth" ), 4282 element.css( "borderLeftWidth" ) 4283 ], 4284 paddings = [ 4285 element.css( "paddingTop" ), 4286 element.css( "paddingRight" ), 4287 element.css( "paddingBottom" ), 4288 element.css( "paddingLeft" ) 4289 ]; 4290 4291 for ( ; i < 4; i++ ) { 4292 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 4293 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 4294 } 4295 4296 return { 4297 height: widths[ 0 ] + widths[ 2 ], 4298 width: widths[ 1 ] + widths[ 3 ] 4299 }; 4300 }, 4301 4302 _proportionallyResize: function() { 4303 4304 if ( !this._proportionallyResizeElements.length ) { 4305 return; 4306 } 4307 4308 var prel, 4309 i = 0, 4310 element = this.helper || this.element; 4311 4312 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 4313 4314 prel = this._proportionallyResizeElements[ i ]; 4315 4316 // TODO: Seems like a bug to cache this.outerDimensions 4317 // considering that we are in a loop. 4318 if ( !this.outerDimensions ) { 4319 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 4320 } 4321 4322 prel.css( { 4323 height: ( element.height() - this.outerDimensions.height ) || 0, 4324 width: ( element.width() - this.outerDimensions.width ) || 0 4325 } ); 4326 4327 } 4328 4329 }, 4330 4331 _renderProxy: function() { 4332 4333 var el = this.element, o = this.options; 4334 this.elementOffset = el.offset(); 4335 4336 if ( this._helper ) { 4337 4338 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 4339 4340 this._addClass( this.helper, this._helper ); 4341 this.helper.css( { 4342 width: this.element.outerWidth(), 4343 height: this.element.outerHeight(), 4344 position: "absolute", 4345 left: this.elementOffset.left + "px", 4346 top: this.elementOffset.top + "px", 4347 zIndex: ++o.zIndex //TODO: Don't modify option 4348 } ); 4349 4350 this.helper 4351 .appendTo( "body" ) 4352 .disableSelection(); 4353 4354 } else { 4355 this.helper = this.element; 4356 } 4357 4358 }, 4359 4360 _change: { 4361 e: function( event, dx ) { 4362 return { width: this.originalSize.width + dx }; 4363 }, 4364 w: function( event, dx ) { 4365 var cs = this.originalSize, sp = this.originalPosition; 4366 return { left: sp.left + dx, width: cs.width - dx }; 4367 }, 4368 n: function( event, dx, dy ) { 4369 var cs = this.originalSize, sp = this.originalPosition; 4370 return { top: sp.top + dy, height: cs.height - dy }; 4371 }, 4372 s: function( event, dx, dy ) { 4373 return { height: this.originalSize.height + dy }; 4374 }, 4375 se: function( event, dx, dy ) { 4376 return $.extend( this._change.s.apply( this, arguments ), 4377 this._change.e.apply( this, [ event, dx, dy ] ) ); 4378 }, 4379 sw: function( event, dx, dy ) { 4380 return $.extend( this._change.s.apply( this, arguments ), 4381 this._change.w.apply( this, [ event, dx, dy ] ) ); 4382 }, 4383 ne: function( event, dx, dy ) { 4384 return $.extend( this._change.n.apply( this, arguments ), 4385 this._change.e.apply( this, [ event, dx, dy ] ) ); 4386 }, 4387 nw: function( event, dx, dy ) { 4388 return $.extend( this._change.n.apply( this, arguments ), 4389 this._change.w.apply( this, [ event, dx, dy ] ) ); 4390 } 4391 }, 4392 4393 _propagate: function( n, event ) { 4394 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 4395 if ( n !== "resize" ) { 4396 this._trigger( n, event, this.ui() ); 4397 } 4398 }, 4399 4400 plugins: {}, 4401 4402 ui: function() { 4403 return { 4404 originalElement: this.originalElement, 4405 element: this.element, 4406 helper: this.helper, 4407 position: this.position, 4408 size: this.size, 4409 originalSize: this.originalSize, 4410 originalPosition: this.originalPosition 4411 }; 4412 } 4413 4414} ); 4415 4416/* 4417 * Resizable Extensions 4418 */ 4419 4420$.ui.plugin.add( "resizable", "animate", { 4421 4422 stop: function( event ) { 4423 var that = $( this ).resizable( "instance" ), 4424 o = that.options, 4425 pr = that._proportionallyResizeElements, 4426 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 4427 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 4428 soffsetw = ista ? 0 : that.sizeDiff.width, 4429 style = { 4430 width: ( that.size.width - soffsetw ), 4431 height: ( that.size.height - soffseth ) 4432 }, 4433 left = ( parseFloat( that.element.css( "left" ) ) + 4434 ( that.position.left - that.originalPosition.left ) ) || null, 4435 top = ( parseFloat( that.element.css( "top" ) ) + 4436 ( that.position.top - that.originalPosition.top ) ) || null; 4437 4438 that.element.animate( 4439 $.extend( style, top && left ? { top: top, left: left } : {} ), { 4440 duration: o.animateDuration, 4441 easing: o.animateEasing, 4442 step: function() { 4443 4444 var data = { 4445 width: parseFloat( that.element.css( "width" ) ), 4446 height: parseFloat( that.element.css( "height" ) ), 4447 top: parseFloat( that.element.css( "top" ) ), 4448 left: parseFloat( that.element.css( "left" ) ) 4449 }; 4450 4451 if ( pr && pr.length ) { 4452 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 4453 } 4454 4455 // Propagating resize, and updating values for each animation step 4456 that._updateCache( data ); 4457 that._propagate( "resize", event ); 4458 4459 } 4460 } 4461 ); 4462 } 4463 4464} ); 4465 4466$.ui.plugin.add( "resizable", "containment", { 4467 4468 start: function() { 4469 var element, p, co, ch, cw, width, height, 4470 that = $( this ).resizable( "instance" ), 4471 o = that.options, 4472 el = that.element, 4473 oc = o.containment, 4474 ce = ( oc instanceof $ ) ? 4475 oc.get( 0 ) : 4476 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 4477 4478 if ( !ce ) { 4479 return; 4480 } 4481 4482 that.containerElement = $( ce ); 4483 4484 if ( /document/.test( oc ) || oc === document ) { 4485 that.containerOffset = { 4486 left: 0, 4487 top: 0 4488 }; 4489 that.containerPosition = { 4490 left: 0, 4491 top: 0 4492 }; 4493 4494 that.parentData = { 4495 element: $( document ), 4496 left: 0, 4497 top: 0, 4498 width: $( document ).width(), 4499 height: $( document ).height() || document.body.parentNode.scrollHeight 4500 }; 4501 } else { 4502 element = $( ce ); 4503 p = []; 4504 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 4505 p[ i ] = that._num( element.css( "padding" + name ) ); 4506 } ); 4507 4508 that.containerOffset = element.offset(); 4509 that.containerPosition = element.position(); 4510 that.containerSize = { 4511 height: ( element.innerHeight() - p[ 3 ] ), 4512 width: ( element.innerWidth() - p[ 1 ] ) 4513 }; 4514 4515 co = that.containerOffset; 4516 ch = that.containerSize.height; 4517 cw = that.containerSize.width; 4518 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 4519 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 4520 4521 that.parentData = { 4522 element: ce, 4523 left: co.left, 4524 top: co.top, 4525 width: width, 4526 height: height 4527 }; 4528 } 4529 }, 4530 4531 resize: function( event ) { 4532 var woset, hoset, isParent, isOffsetRelative, 4533 that = $( this ).resizable( "instance" ), 4534 o = that.options, 4535 co = that.containerOffset, 4536 cp = that.position, 4537 pRatio = that._aspectRatio || event.shiftKey, 4538 cop = { 4539 top: 0, 4540 left: 0 4541 }, 4542 ce = that.containerElement, 4543 continueResize = true; 4544 4545 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 4546 cop = co; 4547 } 4548 4549 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 4550 that.size.width = that.size.width + 4551 ( that._helper ? 4552 ( that.position.left - co.left ) : 4553 ( that.position.left - cop.left ) ); 4554 4555 if ( pRatio ) { 4556 that.size.height = that.size.width / that.aspectRatio; 4557 continueResize = false; 4558 } 4559 that.position.left = o.helper ? co.left : 0; 4560 } 4561 4562 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 4563 that.size.height = that.size.height + 4564 ( that._helper ? 4565 ( that.position.top - co.top ) : 4566 that.position.top ); 4567 4568 if ( pRatio ) { 4569 that.size.width = that.size.height * that.aspectRatio; 4570 continueResize = false; 4571 } 4572 that.position.top = that._helper ? co.top : 0; 4573 } 4574 4575 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 4576 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 4577 4578 if ( isParent && isOffsetRelative ) { 4579 that.offset.left = that.parentData.left + that.position.left; 4580 that.offset.top = that.parentData.top + that.position.top; 4581 } else { 4582 that.offset.left = that.element.offset().left; 4583 that.offset.top = that.element.offset().top; 4584 } 4585 4586 woset = Math.abs( that.sizeDiff.width + 4587 ( that._helper ? 4588 that.offset.left - cop.left : 4589 ( that.offset.left - co.left ) ) ); 4590 4591 hoset = Math.abs( that.sizeDiff.height + 4592 ( that._helper ? 4593 that.offset.top - cop.top : 4594 ( that.offset.top - co.top ) ) ); 4595 4596 if ( woset + that.size.width >= that.parentData.width ) { 4597 that.size.width = that.parentData.width - woset; 4598 if ( pRatio ) { 4599 that.size.height = that.size.width / that.aspectRatio; 4600 continueResize = false; 4601 } 4602 } 4603 4604 if ( hoset + that.size.height >= that.parentData.height ) { 4605 that.size.height = that.parentData.height - hoset; 4606 if ( pRatio ) { 4607 that.size.width = that.size.height * that.aspectRatio; 4608 continueResize = false; 4609 } 4610 } 4611 4612 if ( !continueResize ) { 4613 that.position.left = that.prevPosition.left; 4614 that.position.top = that.prevPosition.top; 4615 that.size.width = that.prevSize.width; 4616 that.size.height = that.prevSize.height; 4617 } 4618 }, 4619 4620 stop: function() { 4621 var that = $( this ).resizable( "instance" ), 4622 o = that.options, 4623 co = that.containerOffset, 4624 cop = that.containerPosition, 4625 ce = that.containerElement, 4626 helper = $( that.helper ), 4627 ho = helper.offset(), 4628 w = helper.outerWidth() - that.sizeDiff.width, 4629 h = helper.outerHeight() - that.sizeDiff.height; 4630 4631 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 4632 $( this ).css( { 4633 left: ho.left - cop.left - co.left, 4634 width: w, 4635 height: h 4636 } ); 4637 } 4638 4639 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 4640 $( this ).css( { 4641 left: ho.left - cop.left - co.left, 4642 width: w, 4643 height: h 4644 } ); 4645 } 4646 } 4647} ); 4648 4649$.ui.plugin.add( "resizable", "alsoResize", { 4650 4651 start: function() { 4652 var that = $( this ).resizable( "instance" ), 4653 o = that.options; 4654 4655 $( o.alsoResize ).each( function() { 4656 var el = $( this ); 4657 el.data( "ui-resizable-alsoresize", { 4658 width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ), 4659 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 4660 } ); 4661 } ); 4662 }, 4663 4664 resize: function( event, ui ) { 4665 var that = $( this ).resizable( "instance" ), 4666 o = that.options, 4667 os = that.originalSize, 4668 op = that.originalPosition, 4669 delta = { 4670 height: ( that.size.height - os.height ) || 0, 4671 width: ( that.size.width - os.width ) || 0, 4672 top: ( that.position.top - op.top ) || 0, 4673 left: ( that.position.left - op.left ) || 0 4674 }; 4675 4676 $( o.alsoResize ).each( function() { 4677 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 4678 css = el.parents( ui.originalElement[ 0 ] ).length ? 4679 [ "width", "height" ] : 4680 [ "width", "height", "top", "left" ]; 4681 4682 $.each( css, function( i, prop ) { 4683 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 4684 if ( sum && sum >= 0 ) { 4685 style[ prop ] = sum || null; 4686 } 4687 } ); 4688 4689 el.css( style ); 4690 } ); 4691 }, 4692 4693 stop: function() { 4694 $( this ).removeData( "ui-resizable-alsoresize" ); 4695 } 4696} ); 4697 4698$.ui.plugin.add( "resizable", "ghost", { 4699 4700 start: function() { 4701 4702 var that = $( this ).resizable( "instance" ), cs = that.size; 4703 4704 that.ghost = that.originalElement.clone(); 4705 that.ghost.css( { 4706 opacity: 0.25, 4707 display: "block", 4708 position: "relative", 4709 height: cs.height, 4710 width: cs.width, 4711 margin: 0, 4712 left: 0, 4713 top: 0 4714 } ); 4715 4716 that._addClass( that.ghost, "ui-resizable-ghost" ); 4717 4718 // DEPRECATED 4719 // TODO: remove after 1.12 4720 if ( $.uiBackCompat
4720=== true && typeof that.options.ghost === "string" ) { 4721 4722 // Ghost option 4723 that.ghost.addClass( this.options.ghost ); 4724 } 4725 4726 that.ghost.appendTo( that.helper ); 4727 4728 }, 4729 4730 resize: function() { 4731 var that = $( this ).resizable( "instance" ); 4732 if ( that.ghost ) { 4733 that.ghost.css( { 4734 position: "relative", 4735 height: that.size.height,
vendor: 10,672 bytes, lines 4736-5143
4736 width: that.size.width 4737 } ); 4738 } 4739 }, 4740 4741 stop: function() { 4742 var that = $( this ).resizable( "instance" ); 4743 if ( that.ghost && that.helper ) { 4744 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 4745 } 4746 } 4747 4748} ); 4749 4750$.ui.plugin.add( "resizable", "grid", { 4751 4752 resize: function() { 4753 var outerDimensions, 4754 that = $( this ).resizable( "instance" ), 4755 o = that.options, 4756 cs = that.size, 4757 os = that.originalSize, 4758 op = that.originalPosition, 4759 a = that.axis, 4760 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 4761 gridX = ( grid[ 0 ] || 1 ), 4762 gridY = ( grid[ 1 ] || 1 ), 4763 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 4764 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 4765 newWidth = os.width + ox, 4766 newHeight = os.height + oy, 4767 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 4768 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 4769 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 4770 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 4771 4772 o.grid = grid; 4773 4774 if ( isMinWidth ) { 4775 newWidth += gridX; 4776 } 4777 if ( isMinHeight ) { 4778 newHeight += gridY; 4779 } 4780 if ( isMaxWidth ) { 4781 newWidth -= gridX; 4782 } 4783 if ( isMaxHeight ) { 4784 newHeight -= gridY; 4785 } 4786 4787 if ( /^(se|s|e)$/.test( a ) ) { 4788 that.size.width = newWidth; 4789 that.size.height = newHeight; 4790 } else if ( /^(ne)$/.test( a ) ) { 4791 that.size.width = newWidth; 4792 that.size.height = newHeight; 4793 that.position.top = op.top - oy; 4794 } else if ( /^(sw)$/.test( a ) ) { 4795 that.size.width = newWidth; 4796 that.size.height = newHeight; 4797 that.position.left = op.left - ox; 4798 } else { 4799 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 4800 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 4801 } 4802 4803 if ( newHeight - gridY > 0 ) { 4804 that.size.height = newHeight; 4805 that.position.top = op.top - oy; 4806 } else { 4807 newHeight = gridY - outerDimensions.height; 4808 that.size.height = newHeight; 4809 that.position.top = op.top + os.height - newHeight; 4810 } 4811 if ( newWidth - gridX > 0 ) { 4812 that.size.width = newWidth; 4813 that.position.left = op.left - ox; 4814 } else { 4815 newWidth = gridX - outerDimensions.width; 4816 that.size.width = newWidth; 4817 that.position.left = op.left + os.width - newWidth; 4818 } 4819 } 4820 } 4821 4822} ); 4823 4824var widgetsResizable = $.ui.resizable; 4825 4826 4827/*! 4828 * jQuery UI Selectable 1.14.0 4829 * https://jqueryui.com 4830 * 4831 * Copyright OpenJS Foundation and other contributors 4832 * Released under the MIT license. 4833 * https://jquery.org/license 4834 */ 4835 4836//>>label: Selectable 4837//>>group: Interactions 4838//>>description: Allows groups of elements to be selected with the mouse. 4839//>>docs: https://api.jqueryui.com/selectable/ 4840//>>demos: https://jqueryui.com/selectable/ 4841//>>css.structure: ../../themes/base/selectable.css 4842 4843 4844var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { 4845 version: "1.14.0", 4846 options: { 4847 appendTo: "body", 4848 autoRefresh: true, 4849 distance: 0, 4850 filter: "*", 4851 tolerance: "touch", 4852 4853 // Callbacks 4854 selected: null, 4855 selecting: null, 4856 start: null, 4857 stop: null, 4858 unselected: null, 4859 unselecting: null 4860 }, 4861 _create: function() { 4862 var that = this; 4863 4864 this._addClass( "ui-selectable" ); 4865 4866 this.dragged = false; 4867 4868 // Cache selectee children based on filter 4869 this.refresh = function() { 4870 that.elementPos = $( that.element[ 0 ] ).offset(); 4871 that.selectees = $( that.options.filter, that.element[ 0 ] ); 4872 that._addClass( that.selectees, "ui-selectee" ); 4873 that.selectees.each( function() { 4874 var $this = $( this ), 4875 selecteeOffset = $this.offset(), 4876 pos = { 4877 left: selecteeOffset.left - that.elementPos.left, 4878 top: selecteeOffset.top - that.elementPos.top 4879 }; 4880 $.data( this, "selectable-item", { 4881 element: this, 4882 $element: $this, 4883 left: pos.left, 4884 top: pos.top, 4885 right: pos.left + $this.outerWidth(), 4886 bottom: pos.top + $this.outerHeight(), 4887 startselected: false, 4888 selected: $this.hasClass( "ui-selected" ), 4889 selecting: $this.hasClass( "ui-selecting" ), 4890 unselecting: $this.hasClass( "ui-unselecting" ) 4891 } ); 4892 } ); 4893 }; 4894 this.refresh(); 4895 4896 this._mouseInit(); 4897 4898 this.helper = $( "<div>" ); 4899 this._addClass( this.helper, "ui-selectable-helper" ); 4900 }, 4901 4902 _destroy: function() { 4903 this.selectees.removeData( "selectable-item" ); 4904 this._mouseDestroy(); 4905 }, 4906 4907 _mouseStart: function( event ) { 4908 var that = this, 4909 options = this.options; 4910 4911 this.opos = [ event.pageX, event.pageY ]; 4912 this.elementPos = $( this.element[ 0 ] ).offset(); 4913 4914 if ( this.options.disabled ) { 4915 return; 4916 } 4917 4918 this.selectees = $( options.filter, this.element[ 0 ] ); 4919 4920 this._trigger( "start", event ); 4921 4922 $( options.appendTo ).append( this.helper ); 4923 4924 // position helper (lasso) 4925 this.helper.css( { 4926 "left": event.pageX, 4927 "top": event.pageY, 4928 "width": 0, 4929 "height": 0 4930 } ); 4931 4932 if ( options.autoRefresh ) { 4933 this.refresh(); 4934 } 4935 4936 this.selectees.filter( ".ui-selected" ).each( function() { 4937 var selectee = $.data( this, "selectable-item" ); 4938 selectee.startselected = true; 4939 if ( !event.metaKey && !event.ctrlKey ) { 4940 that._removeClass( selectee.$element, "ui-selected" ); 4941 selectee.selected = false; 4942 that._addClass( selectee.$element, "ui-unselecting" ); 4943 selectee.unselecting = true; 4944 4945 // selectable UNSELECTING callback 4946 that._trigger( "unselecting", event, { 4947 unselecting: selectee.element 4948 } ); 4949 } 4950 } ); 4951 4952 $( event.target ).parents().addBack().each( function() { 4953 var doSelect, 4954 selectee = $.data( this, "selectable-item" ); 4955 if ( selectee ) { 4956 doSelect = ( !event.metaKey && !event.ctrlKey ) || 4957 !selectee.$element.hasClass( "ui-selected" ); 4958 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 4959 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 4960 selectee.unselecting = !doSelect; 4961 selectee.selecting = doSelect; 4962 selectee.selected = doSelect; 4963 4964 // selectable (UN)SELECTING callback 4965 if ( doSelect ) { 4966 that._trigger( "selecting", event, { 4967 selecting: selectee.element 4968 } ); 4969 } else { 4970 that._trigger( "unselecting", event, { 4971 unselecting: selectee.element 4972 } ); 4973 } 4974 return false; 4975 } 4976 } ); 4977 4978 }, 4979 4980 _mouseDrag: function( event ) { 4981 4982 this.dragged = true; 4983 4984 if ( this.options.disabled ) { 4985 return; 4986 } 4987 4988 var tmp, 4989 that = this, 4990 options = this.options, 4991 x1 = this.opos[ 0 ], 4992 y1 = this.opos[ 1 ], 4993 x2 = event.pageX, 4994 y2 = event.pageY; 4995 4996 if ( x1 > x2 ) { 4997 tmp = x2; x2 = x1; x1 = tmp; 4998 } 4999 if ( y1 > y2 ) { 5000 tmp = y2; y2 = y1; y1 = tmp; 5001 } 5002 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 5003 5004 this.selectees.each( function() { 5005 var selectee = $.data( this, "selectable-item" ), 5006 hit = false, 5007 offset = {}; 5008 5009 //prevent helper from being selected if appendTo: selectable 5010 if ( !selectee || selectee.element === that.element[ 0 ] ) { 5011 return; 5012 } 5013 5014 offset.left = selectee.left + that.elementPos.left; 5015 offset.right = selectee.right + that.elementPos.left; 5016 offset.top = selectee.top + that.elementPos.top; 5017 offset.bottom = selectee.bottom + that.elementPos.top; 5018 5019 if ( options.tolerance === "touch" ) { 5020 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 5021 offset.bottom < y1 ) ); 5022 } else if ( options.tolerance === "fit" ) { 5023 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 5024 offset.bottom < y2 ); 5025 } 5026 5027 if ( hit ) { 5028 5029 // SELECT 5030 if ( selectee.selected ) { 5031 that._removeClass( selectee.$element, "ui-selected" ); 5032 selectee.selected = false; 5033 } 5034 if ( selectee.unselecting ) { 5035 that._removeClass( selectee.$element, "ui-unselecting" ); 5036 selectee.unselecting = false; 5037 } 5038 if ( !selectee.selecting ) { 5039 that._addClass( selectee.$element, "ui-selecting" ); 5040 selectee.selecting = true; 5041 5042 // selectable SELECTING callback 5043 that._trigger( "selecting", event, { 5044 selecting: selectee.element 5045 } ); 5046 } 5047 } else { 5048 5049 // UNSELECT 5050 if ( selectee.selecting ) { 5051 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 5052 that._removeClass( selectee.$element, "ui-selecting" ); 5053 selectee.selecting = false; 5054 that._addClass( selectee.$element, "ui-selected" ); 5055 selectee.selected = true; 5056 } else { 5057 that._removeClass( selectee.$element, "ui-selecting" ); 5058 selectee.selecting = false; 5059 if ( selectee.startselected ) { 5060 that._addClass( selectee.$element, "ui-unselecting" ); 5061 selectee.unselecting = true; 5062 } 5063 5064 // selectable UNSELECTING callback 5065 that._trigger( "unselecting", event, { 5066 unselecting: selectee.element 5067 } ); 5068 } 5069 } 5070 if ( selectee.selected ) { 5071 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 5072 that._removeClass( selectee.$element, "ui-selected" ); 5073 selectee.selected = false; 5074 5075 that._addClass( selectee.$element, "ui-unselecting" ); 5076 selectee.unselecting = true; 5077 5078 // selectable UNSELECTING callback 5079 that._trigger( "unselecting", event, { 5080 unselecting: selectee.element 5081 } ); 5082 } 5083 } 5084 } 5085 } ); 5086 5087 return false; 5088 }, 5089 5090 _mouseStop: function( event ) { 5091 var that = this; 5092 5093 this.dragged = false; 5094 5095 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 5096 var selectee = $.data( this, "selectable-item" ); 5097 that._removeClass( selectee.$element, "ui-unselecting" ); 5098 selectee.unselecting = false; 5099 selectee.startselected = false; 5100 that._trigger( "unselected", event, { 5101 unselected: selectee.element 5102 } ); 5103 } ); 5104 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 5105 var selectee = $.data( this, "selectable-item" ); 5106 that._removeClass( selectee.$element, "ui-selecting" ) 5107 ._addClass( selectee.$element, "ui-selected" ); 5108 selectee.selecting = false; 5109 selectee.selected = true; 5110 selectee.startselected = true; 5111 that._trigger( "selected", event, { 5112 selected: selectee.element 5113 } ); 5114 } ); 5115 this._trigger( "stop", event ); 5116 5117 this.helper.remove(); 5118 5119 return false; 5120 } 5121 5122} ); 5123 5124 5125/*! 5126 * jQuery UI Sortable 1.14.0 5127 * https://jqueryui.com 5128 * 5129 * Copyright OpenJS Foundation and other contributors 5130 * Released under the MIT license. 5131 * https://jquery.org/license 5132 */ 5133 5134//>>label: Sortable 5135//>>group: Interactions 5136//>>description: Enables items in a list to be sorted using the mouse. 5137//>>docs: https://api.jqueryui.com/sortable/ 5138//>>demos: https://jqueryui.com/sortable/ 5139//>>css.structure: ../../themes/base/sortable.css 5140 5141 5142var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { 5143 version: "1.14.0
vendor: 12,316 bytes, lines 5143-5601
5143", 5144 widgetEventPrefix: "sort", 5145 ready: false, 5146 options: { 5147 appendTo: "parent", 5148 axis: false, 5149 connectWith: false, 5150 containment: false, 5151 cursor: "auto", 5152 cursorAt: false, 5153 dropOnEmpty: true, 5154 forcePlaceholderSize: false, 5155 forceHelperSize: false, 5156 grid: false, 5157 handle: false, 5158 helper: "original", 5159 items: "> *", 5160 opacity: false, 5161 placeholder: false, 5162 revert: false, 5163 scroll: true, 5164 scrollSensitivity: 20, 5165 scrollSpeed: 20, 5166 scope: "default", 5167 tolerance: "intersect", 5168 zIndex: 1000, 5169 5170 // Callbacks 5171 activate: null, 5172 beforeStop: null, 5173 change: null, 5174 deactivate: null, 5175 out: null, 5176 over: null, 5177 receive: null, 5178 remove: null, 5179 sort: null, 5180 start: null, 5181 stop: null, 5182 update: null 5183 }, 5184 5185 _isOverAxis: function( x, reference, size ) { 5186 return ( x >= reference ) && ( x < ( reference + size ) ); 5187 }, 5188 5189 _isFloating: function( item ) { 5190 return ( /left|right/ ).test( item.css( "float" ) ) || 5191 ( /inline|table-cell/ ).test( item.css( "display" ) ); 5192 }, 5193 5194 _create: function() { 5195 this.containerCache = {}; 5196 this._addClass( "ui-sortable" ); 5197 5198 //Get the items 5199 this.refresh(); 5200 5201 //Let's determine the parent's offset 5202 this.offset = this.element.offset(); 5203 5204 //Initialize mouse events for interaction 5205 this._mouseInit(); 5206 5207 this._setHandleClassName(); 5208 5209 //We're ready to go 5210 this.ready = true; 5211 5212 }, 5213 5214 _setOption: function( key, value ) { 5215 this._super( key, value ); 5216 5217 if ( key === "handle" ) { 5218 this._setHandleClassName(); 5219 } 5220 }, 5221 5222 _setHandleClassName: function() { 5223 var that = this; 5224 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 5225 $.each( this.items, function() { 5226 that._addClass( 5227 this.instance.options.handle ? 5228 this.item.find( this.instance.options.handle ) : 5229 this.item, 5230 "ui-sortable-handle" 5231 ); 5232 } ); 5233 }, 5234 5235 _destroy: function() { 5236 this._mouseDestroy(); 5237 5238 for ( var i = this.items.length - 1; i >= 0; i-- ) { 5239 this.items[ i ].item.removeData( this.widgetName + "-item" ); 5240 } 5241 5242 return this; 5243 }, 5244 5245 _mouseCapture: function( event, overrideHandle ) { 5246 var currentItem = null, 5247 validHandle = false, 5248 that = this; 5249 5250 if ( this.reverting ) { 5251 return false; 5252 } 5253 5254 if ( this.options.disabled || this.options.type === "static" ) { 5255 return false; 5256 } 5257 5258 //We have to refresh the items data once first 5259 this._refreshItems( event ); 5260 5261 //Find out if the clicked node (or one of its parents) is a actual item in this.items 5262 $( event.target ).parents().each( function() { 5263 if ( $.data( this, that.widgetName + "-item" ) === that ) { 5264 currentItem = $( this ); 5265 return false; 5266 } 5267 } ); 5268 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 5269 currentItem = $( event.target ); 5270 } 5271 5272 if ( !currentItem ) { 5273 return false; 5274 } 5275 if ( this.options.handle && !overrideHandle ) { 5276 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 5277 if ( this === event.target ) { 5278 validHandle = true; 5279 } 5280 } ); 5281 if ( !validHandle ) { 5282 return false; 5283 } 5284 } 5285 5286 this.currentItem = currentItem; 5287 this._removeCurrentsFromItems(); 5288 return true; 5289 5290 }, 5291 5292 _mouseStart: function( event, overrideHandle, noActivation ) { 5293 5294 var i, body, 5295 o = this.options; 5296 5297 this.currentContainer = this; 5298 5299 //We only need to call refreshPositions, because the refreshItems call has been moved to 5300 // mouseCapture 5301 this.refreshPositions(); 5302 5303 //Prepare the dragged items parent 5304 this.appendTo = $( o.appendTo !== "parent" ? 5305 o.appendTo : 5306 this.currentItem.parent() ); 5307 5308 //Create and append the visible helper 5309 this.helper = this._createHelper( event ); 5310 5311 //Cache the helper size 5312 this._cacheHelperProportions(); 5313 5314 /* 5315 * - Position generation - 5316 * This block generates everything position related - it's the core of draggables. 5317 */ 5318 5319 //Cache the margins of the original element 5320 this._cacheMargins(); 5321 5322 //The element's absolute position on the page minus margins 5323 this.offset = this.currentItem.offset(); 5324 this.offset = { 5325 top: this.offset.top - this.margins.top, 5326 left: this.offset.left - this.margins.left 5327 }; 5328 5329 $.extend( this.offset, { 5330 click: { //Where the click happened, relative to the element 5331 left: event.pageX - this.offset.left, 5332 top: event.pageY - this.offset.top 5333 }, 5334 5335 // This is a relative to absolute position minus the actual position calculation - 5336 // only used for relative positioned helper 5337 relative: this._getRelativeOffset() 5338 } ); 5339 5340 // After we get the helper offset, but before we get the parent offset we can 5341 // change the helper's position to absolute 5342 // TODO: Still need to figure out a way to make relative sorting possible 5343 this.helper.css( "position", "absolute" ); 5344 this.cssPosition = this.helper.css( "position" ); 5345 5346 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5347 if ( o.cursorAt ) { 5348 this._adjustOffsetFromHelper( o.cursorAt ); 5349 } 5350 5351 //Cache the former DOM position 5352 this.domPosition = { 5353 prev: this.currentItem.prev()[ 0 ], 5354 parent: this.currentItem.parent()[ 0 ] 5355 }; 5356 5357 // If the helper is not the original, hide the original so it's not playing any role during 5358 // the drag, won't cause anything bad this way 5359 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 5360 this.currentItem.hide(); 5361 } 5362 5363 //Create the placeholder 5364 this._createPlaceholder(); 5365 5366 //Get the next scrolling parent 5367 this.scrollParent = this.placeholder.scrollParent(); 5368 5369 $.extend( this.offset, { 5370 parent: this._getParentOffset() 5371 } ); 5372 5373 //Set a containment if given in the options 5374 if ( o.containment ) { 5375 this._setContainment(); 5376 } 5377 5378 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 5379 body = this.document.find( "body" ); 5380 5381 this._storedStylesheet = 5382 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 5383 } 5384 5385 // We need to make sure to grab the zIndex before setting the 5386 // opacity, because setting the opacity to anything lower than 1 5387 // causes the zIndex to change from "auto" to 0. 5388 if ( o.zIndex ) { // zIndex option 5389 if ( this.helper.css( "zIndex" ) ) { 5390 this._storedZIndex = this.helper.css( "zIndex" ); 5391 } 5392 this.helper.css( "zIndex", o.zIndex ); 5393 } 5394 5395 if ( o.opacity ) { // opacity option 5396 if ( this.helper.css( "opacity" ) ) { 5397 this._storedOpacity = this.helper.css( "opacity" ); 5398 } 5399 this.helper.css( "opacity", o.opacity ); 5400 } 5401 5402 //Prepare scrolling 5403 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 5404 this.scrollParent[ 0 ].tagName !== "HTML" ) { 5405 this.overflowOffset = this.scrollParent.offset(); 5406 } 5407 5408 //Call callbacks 5409 this._trigger( "start", event, this._uiHash() ); 5410 5411 //Recache the helper size 5412 if ( !this._preserveHelperProportions ) { 5413 this._cacheHelperProportions(); 5414 } 5415 5416 //Post "activate" events to possible containers 5417 if ( !noActivation ) { 5418 for ( i = this.containers.length - 1; i >= 0; i-- ) { 5419 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 5420 } 5421 } 5422 5423 //Prepare possible droppables 5424 if ( $.ui.ddmanager ) { 5425 $.ui.ddmanager.current = this; 5426 } 5427 5428 if ( $.ui.ddmanager && !o.dropBehaviour ) { 5429 $.ui.ddmanager.prepareOffsets( this, event ); 5430 } 5431 5432 this.dragging = true; 5433 5434 this._addClass( this.helper, "ui-sortable-helper" ); 5435 5436 //Move the helper, if needed 5437 if ( !this.helper.parent().is( this.appendTo ) ) { 5438 this.helper.detach().appendTo( this.appendTo ); 5439 5440 //Update position 5441 this.offset.parent = this._getParentOffset(); 5442 } 5443 5444 //Generate the original position 5445 this.position = this.originalPosition = this._generatePosition( event ); 5446 this.originalPageX = event.pageX; 5447 this.originalPageY = event.pageY; 5448 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 5449 5450 this._mouseDrag( event ); 5451 5452 return true; 5453 5454 }, 5455 5456 _scroll: function( event ) { 5457 var o = this.options, 5458 scrolled = false; 5459 5460 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 5461 this.scrollParent[ 0 ].tagName !== "HTML" ) { 5462 5463 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 5464 event.pageY < o.scrollSensitivity ) { 5465 this.scrollParent[ 0 ].scrollTop = 5466 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 5467 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 5468 this.scrollParent[ 0 ].scrollTop = 5469 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 5470 } 5471 5472 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 5473 event.pageX < o.scrollSensitivity ) { 5474 this.scrollParent[ 0 ].scrollLeft = scrolled = 5475 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 5476 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 5477 this.scrollParent[ 0 ].scrollLeft = scrolled = 5478 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 5479 } 5480 5481 } else { 5482 5483 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 5484 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 5485 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 5486 o.scrollSensitivity ) { 5487 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 5488 } 5489 5490 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 5491 scrolled = this.document.scrollLeft( 5492 this.document.scrollLeft() - o.scrollSpeed 5493 ); 5494 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 5495 o.scrollSensitivity ) { 5496 scrolled = this.document.scrollLeft( 5497 this.document.scrollLeft() + o.scrollSpeed 5498 ); 5499 } 5500 5501 } 5502 5503 return scrolled; 5504 }, 5505 5506 _mouseDrag: function( event ) { 5507 var i, item, itemElement, intersection, 5508 o = this.options; 5509 5510 //Compute the helpers position 5511 this.position = this._generatePosition( event ); 5512 this.positionAbs = this._convertPositionTo( "absolute" ); 5513 5514 //Set the helper position 5515 if ( !this.options.axis || this.options.axis !== "y" ) { 5516 this.helper[ 0 ].style.left = this.position.left + "px"; 5517 } 5518 if ( !this.options.axis || this.options.axis !== "x" ) { 5519 this.helper[ 0 ].style.top = this.position.top + "px"; 5520 } 5521 5522 //Do scrolling 5523 if ( o.scroll ) { 5524 if ( this._scroll( event ) !== false ) { 5525 5526 //Update item positions used in position checks 5527 this._refreshItemPositions( true ); 5528 5529 if ( $.ui.ddmanager && !o.dropBehaviour ) { 5530 $.ui.ddmanager.prepareOffsets( this, event ); 5531 } 5532 } 5533 } 5534 5535 this.dragDirection = { 5536 vertical: this._getDragVerticalDirection(), 5537 horizontal: this._getDragHorizontalDirection() 5538 }; 5539 5540 //Rearrange 5541 for ( i = this.items.length - 1; i >= 0; i-- ) { 5542 5543 //Cache variables and intersection, continue if no intersection 5544 item = this.items[ i ]; 5545 itemElement = item.item[ 0 ]; 5546 intersection = this._intersectsWithPointer( item ); 5547 if ( !intersection ) { 5548 continue; 5549 } 5550 5551 // Only put the placeholder inside the current Container, skip all 5552 // items from other containers. This works because when moving 5553 // an item from one container to another the 5554 // currentContainer is switched before the placeholder is moved. 5555 // 5556 // Without this, moving items in "sub-sortables" can cause 5557 // the placeholder to jitter between the outer and inner container. 5558 if ( item.instance !== this.currentContainer ) { 5559 continue; 5560 } 5561 5562 // Cannot intersect with itself 5563 // no useless actions that have been done before 5564 // no action if the item moved is the parent of the item checked 5565 if ( itemElement !== this.currentItem[ 0 ] && 5566 this.placeholder[ intersection === 1 ? 5567 "next" : "prev" ]()[ 0 ] !== itemElement && 5568 !$.contains( this.placeholder[ 0 ], itemElement ) && 5569 ( this.options.type === "semi-dynamic" ? 5570 !$.contains( this.element[ 0 ], itemElement ) : 5571 true 5572 ) 5573 ) { 5574 5575 this.direction = intersection === 1 ? "down" : "up"; 5576 5577 if ( this.options.tolerance === "pointer" || 5578 this._intersectsWithSides( item ) ) { 5579 this._rearrange( event, item ); 5580 } else { 5581 break; 5582 } 5583 5584 this._trigger( "change", event, this._uiHash() ); 5585 break; 5586 } 5587 } 5588 5589 //Post events to containers 5590 this._contactContainers( event ); 5591 5592 //Interconnect with droppables 5593 if ( $.ui.ddmanager ) { 5594 $.ui.ddmanager.drag( this, event ); 5595 } 5596 5597 //Call callbacks 5598 this._trigger( "sort", event, this._uiHash() ); 5599 5600 this.lastPositionAbs = this.positionAbs; 5601 return false;
vendor: 5,063 bytes, lines 5602-5791
5602 5603 }, 5604 5605 _mouseStop: function( event, noPropagation ) { 5606 5607 if ( !event ) { 5608 return; 5609 } 5610 5611 //If we are using droppables, inform the manager about the drop 5612 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 5613 $.ui.ddmanager.drop( this, event ); 5614 } 5615 5616 if ( this.options.revert ) { 5617 var that = this, 5618 cur = this.placeholder.offset(), 5619 axis = this.options.axis, 5620 animation = {}; 5621 5622 if ( !axis || axis === "x" ) { 5623 animation.left = cur.left - this.offset.parent.left - this.margins.left + 5624 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 5625 0 : 5626 this.offsetParent[ 0 ].scrollLeft 5627 ); 5628 } 5629 if ( !axis || axis === "y" ) { 5630 animation.top = cur.top - this.offset.parent.top - this.margins.top + 5631 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 5632 0 : 5633 this.offsetParent[ 0 ].scrollTop 5634 ); 5635 } 5636 this.reverting = true; 5637 $( this.helper ).animate( 5638 animation, 5639 parseInt( this.options.revert, 10 ) || 500, 5640 function() { 5641 that._clear( event ); 5642 } 5643 ); 5644 } else { 5645 this._clear( event, noPropagation ); 5646 } 5647 5648 return false; 5649 5650 }, 5651 5652 cancel: function() { 5653 5654 if ( this.dragging ) { 5655 5656 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 5657 5658 if ( this.options.helper === "original" ) { 5659 this.currentItem.css( this._storedCSS ); 5660 this._removeClass( this.currentItem, "ui-sortable-helper" ); 5661 } else { 5662 this.currentItem.show(); 5663 } 5664 5665 //Post deactivating events to containers 5666 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 5667 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 5668 if ( this.containers[ i ].containerCache.over ) { 5669 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 5670 this.containers[ i ].containerCache.over = 0; 5671 } 5672 } 5673 5674 } 5675 5676 if ( this.placeholder ) { 5677 5678 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 5679 // it unbinds ALL events from the original node! 5680 if ( this.placeholder[ 0 ].parentNode ) { 5681 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 5682 } 5683 if ( this.options.helper !== "original" && this.helper && 5684 this.helper[ 0 ].parentNode ) { 5685 this.helper.remove(); 5686 } 5687 5688 $.extend( this, { 5689 helper: null, 5690 dragging: false, 5691 reverting: false, 5692 _noFinalSort: null 5693 } ); 5694 5695 if ( this.domPosition.prev ) { 5696 $( this.domPosition.prev ).after( this.currentItem ); 5697 } else { 5698 $( this.domPosition.parent ).prepend( this.currentItem ); 5699 } 5700 } 5701 5702 return this; 5703 5704 }, 5705 5706 serialize: function( o ) { 5707 5708 var items = this._getItemsAsjQuery( o && o.connected ), 5709 str = []; 5710 o = o || {}; 5711 5712 $( items ).each( function() { 5713 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 5714 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 5715 if ( res ) { 5716 str.push( 5717 ( o.key || res[ 1 ] + "[]" ) + 5718 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 5719 } 5720 } ); 5721 5722 if ( !str.length && o.key ) { 5723 str.push( o.key + "=" ); 5724 } 5725 5726 return str.join( "&" ); 5727 5728 }, 5729 5730 toArray: function( o ) { 5731 5732 var items = this._getItemsAsjQuery( o && o.connected ), 5733 ret = []; 5734 5735 o = o || {}; 5736 5737 items.each( function() { 5738 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 5739 } ); 5740 return ret; 5741 5742 }, 5743 5744 /* Be careful with the following core functions */ 5745 _intersectsWith: function( item ) { 5746 5747 var x1 = this.positionAbs.left, 5748 x2 = x1 + this.helperProportions.width, 5749 y1 = this.positionAbs.top, 5750 y2 = y1 + this.helperProportions.height, 5751 l = item.left, 5752 r = l + item.width, 5753 t = item.top, 5754 b = t + item.height, 5755 dyClick = this.offset.click.top, 5756 dxClick = this.offset.click.left, 5757 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 5758 ( y1 + dyClick ) < b ), 5759 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 5760 ( x1 + dxClick ) < r ), 5761 isOverElement = isOverElementHeight && isOverElementWidth; 5762 5763 if ( this.options.tolerance === "pointer" || 5764 this.options.forcePointerForContainers || 5765 ( this.options.tolerance !== "pointer" && 5766 this.helperProportions[ this.floating ? "width" : "height" ] > 5767 item[ this.floating ? "width" : "height" ] ) 5768 ) { 5769 return isOverElement; 5770 } else { 5771 5772 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 5773 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 5774 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 5775 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 5776 5777 } 5778 }, 5779 5780 _intersectsWithPointer: function( item ) { 5781 var verticalDirection, horizontalDirection, 5782 isOverElementHeight = ( this.options.axis === "x" ) || 5783 this._isOverAxis( 5784 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 5785 isOverElementWidth = ( this.options.axis === "y" ) || 5786 this._isOverAxis( 5787 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 5788 isOverElement = isOverElementHeight && isOverElementWidth; 5789 5790 if ( !isOverElement ) { 5791 return false;
vendor: 18,528 bytes, lines 5792-6372
5792 } 5793 5794 verticalDirection = this.dragDirection.vertical; 5795 horizontalDirection = this.dragDirection.horizontal; 5796 5797 return this.floating ? 5798 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 5799 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 5800 5801 }, 5802 5803 _intersectsWithSides: function( item ) { 5804 5805 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 5806 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 5807 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 5808 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 5809 verticalDirection = this.dragDirection.vertical, 5810 horizontalDirection = this.dragDirection.horizontal; 5811 5812 if ( this.floating && horizontalDirection ) { 5813 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 5814 ( horizontalDirection === "left" && !isOverRightHalf ) ); 5815 } else { 5816 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 5817 ( verticalDirection === "up" && !isOverBottomHalf ) ); 5818 } 5819 5820 }, 5821 5822 _getDragVerticalDirection: function() { 5823 var delta = this.positionAbs.top - this.lastPositionAbs.top; 5824 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 5825 }, 5826 5827 _getDragHorizontalDirection: function() { 5828 var delta = this.positionAbs.left - this.lastPositionAbs.left; 5829 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 5830 }, 5831 5832 refresh: function( event ) { 5833 this._refreshItems( event ); 5834 this._setHandleClassName(); 5835 this.refreshPositions(); 5836 return this; 5837 }, 5838 5839 _connectWith: function() { 5840 var options = this.options; 5841 return options.connectWith.constructor === String ? 5842 [ options.connectWith ] : 5843 options.connectWith; 5844 }, 5845 5846 _getItemsAsjQuery: function( connected ) { 5847 5848 var i, j, cur, inst, 5849 items = [], 5850 queries = [], 5851 connectWith = this._connectWith(); 5852 5853 if ( connectWith && connected ) { 5854 for ( i = connectWith.length - 1; i >= 0; i-- ) { 5855 cur = $( connectWith[ i ], this.document[ 0 ] ); 5856 for ( j = cur.length - 1; j >= 0; j-- ) { 5857 inst = $.data( cur[ j ], this.widgetFullName ); 5858 if ( inst && inst !== this && !inst.options.disabled ) { 5859 queries.push( [ typeof inst.options.items === "function" ? 5860 inst.options.items.call( inst.element ) : 5861 $( inst.options.items, inst.element ) 5862 .not( ".ui-sortable-helper" ) 5863 .not( ".ui-sortable-placeholder" ), inst ] ); 5864 } 5865 } 5866 } 5867 } 5868 5869 queries.push( [ typeof this.options.items === "function" ? 5870 this.options.items 5871 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 5872 $( this.options.items, this.element ) 5873 .not( ".ui-sortable-helper" ) 5874 .not( ".ui-sortable-placeholder" ), this ] ); 5875 5876 function addItems() { 5877 items.push( this ); 5878 } 5879 for ( i = queries.length - 1; i >= 0; i-- ) { 5880 queries[ i ][ 0 ].each( addItems ); 5881 } 5882 5883 return $( items ); 5884 5885 }, 5886 5887 _removeCurrentsFromItems: function() { 5888 5889 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 5890 5891 this.items = $.grep( this.items, function( item ) { 5892 for ( var j = 0; j < list.length; j++ ) { 5893 if ( list[ j ] === item.item[ 0 ] ) { 5894 return false; 5895 } 5896 } 5897 return true; 5898 } ); 5899 5900 }, 5901 5902 _refreshItems: function( event ) { 5903 5904 this.items = []; 5905 this.containers = [ this ]; 5906 5907 var i, j, cur, inst, targetData, _queries, item, queriesLength, 5908 items = this.items, 5909 queries = [ [ typeof this.options.items === "function" ? 5910 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 5911 $( this.options.items, this.element ), this ] ], 5912 connectWith = this._connectWith(); 5913 5914 //Shouldn't be run the first time through due to massive slow-down 5915 if ( connectWith && this.ready ) { 5916 for ( i = connectWith.length - 1; i >= 0; i-- ) { 5917 cur = $( connectWith[ i ], this.document[ 0 ] ); 5918 for ( j = cur.length - 1; j >= 0; j-- ) { 5919 inst = $.data( cur[ j ], this.widgetFullName ); 5920 if ( inst && inst !== this && !inst.options.disabled ) { 5921 queries.push( [ typeof inst.options.items === "function" ? 5922 inst.options.items 5923 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 5924 $( inst.options.items, inst.element ), inst ] ); 5925 this.containers.push( inst ); 5926 } 5927 } 5928 } 5929 } 5930 5931 for ( i = queries.length - 1; i >= 0; i-- ) { 5932 targetData = queries[ i ][ 1 ]; 5933 _queries = queries[ i ][ 0 ]; 5934 5935 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 5936 item = $( _queries[ j ] ); 5937 5938 // Data for target checking (mouse manager) 5939 item.data( this.widgetName + "-item", targetData ); 5940 5941 items.push( { 5942 item: item, 5943 instance: targetData, 5944 width: 0, height: 0, 5945 left: 0, top: 0 5946 } ); 5947 } 5948 } 5949 5950 }, 5951 5952 _refreshItemPositions: function( fast ) { 5953 var i, item, t, p; 5954 5955 for ( i = this.items.length - 1; i >= 0; i-- ) { 5956 item = this.items[ i ]; 5957 5958 //We ignore calculating positions of all connected containers when we're not over them 5959 if ( this.currentContainer && item.instance !== this.currentContainer && 5960 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 5961 continue; 5962 } 5963 5964 t = this.options.toleranceElement ? 5965 $( this.options.toleranceElement, item.item ) : 5966 item.item; 5967 5968 if ( !fast ) { 5969 item.width = t.outerWidth(); 5970 item.height = t.outerHeight(); 5971 } 5972 5973 p = t.offset(); 5974 item.left = p.left; 5975 item.top = p.top; 5976 } 5977 }, 5978 5979 refreshPositions: function( fast ) { 5980 5981 // Determine whether items are being displayed horizontally 5982 this.floating = this.items.length ? 5983 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 5984 false; 5985 5986 // This has to be redone because due to the item being moved out/into the offsetParent, 5987 // the offsetParent's position will change 5988 if ( this.offsetParent && this.helper ) { 5989 this.offset.parent = this._getParentOffset(); 5990 } 5991 5992 this._refreshItemPositions( fast ); 5993 5994 var i, p; 5995 5996 if ( this.options.custom && this.options.custom.refreshContainers ) { 5997 this.options.custom.refreshContainers.call( this ); 5998 } else { 5999 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6000 p = this.containers[ i ].element.offset(); 6001 this.containers[ i ].containerCache.left = p.left; 6002 this.containers[ i ].containerCache.top = p.top; 6003 this.containers[ i ].containerCache.width = 6004 this.containers[ i ].element.outerWidth(); 6005 this.containers[ i ].containerCache.height = 6006 this.containers[ i ].element.outerHeight(); 6007 } 6008 } 6009 6010 return this; 6011 }, 6012 6013 _createPlaceholder: function( that ) { 6014 that = that || this; 6015 var className, nodeName, 6016 o = that.options; 6017 6018 if ( !o.placeholder || o.placeholder.constructor === String ) { 6019 className = o.placeholder; 6020 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 6021 o.placeholder = { 6022 element: function() { 6023 6024 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 6025 6026 that._addClass( element, "ui-sortable-placeholder", 6027 className || that.currentItem[ 0 ].className ) 6028 ._removeClass( element, "ui-sortable-helper" ); 6029 6030 if ( nodeName === "tbody" ) { 6031 that._createTrPlaceholder( 6032 that.currentItem.find( "tr" ).eq( 0 ), 6033 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 6034 ); 6035 } else if ( nodeName === "tr" ) { 6036 that._createTrPlaceholder( that.currentItem, element ); 6037 } else if ( nodeName === "img" ) { 6038 element.attr( "src", that.currentItem.attr( "src" ) ); 6039 } 6040 6041 if ( !className ) { 6042 element.css( "visibility", "hidden" ); 6043 } 6044 6045 return element; 6046 }, 6047 update: function( container, p ) { 6048 6049 // 1. If a className is set as 'placeholder option, we don't force sizes - 6050 // the class is responsible for that 6051 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 6052 // class name is specified 6053 if ( className && !o.forcePlaceholderSize ) { 6054 return; 6055 } 6056 6057 // If the element doesn't have a actual height or width by itself (without 6058 // styles coming from a stylesheet), it receives the inline height and width 6059 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 6060 // anyway since we're populating them with <td>s above, but they're unlikely to 6061 // be the correct height on their own if the row heights are dynamic, so we'll 6062 // always assign the height of the dragged item given forcePlaceholderSize 6063 // is true. 6064 if ( !p.height() || ( o.forcePlaceholderSize && 6065 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 6066 p.height( 6067 that.currentItem.innerHeight() - 6068 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 6069 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 6070 } 6071 if ( !p.width() ) { 6072 p.width( 6073 that.currentItem.innerWidth() - 6074 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 6075 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 6076 } 6077 } 6078 }; 6079 } 6080 6081 //Create the placeholder 6082 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 6083 6084 //Append it after the actual current item 6085 that.currentItem.after( that.placeholder ); 6086 6087 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 6088 o.placeholder.update( that, that.placeholder ); 6089 6090 }, 6091 6092 _createTrPlaceholder: function( sourceTr, targetTr ) { 6093 var that = this; 6094 6095 sourceTr.children().each( function() { 6096 $( "<td> </td>", that.document[ 0 ] ) 6097 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 6098 .appendTo( targetTr ); 6099 } ); 6100 }, 6101 6102 _contactContainers: function( event ) { 6103 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 6104 floating, axis, 6105 innermostContainer = null, 6106 innermostIndex = null; 6107 6108 // Get innermost container that intersects with item 6109 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6110 6111 // Never consider a container that's located within the item itself 6112 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 6113 continue; 6114 } 6115 6116 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 6117 6118 // If we've already found a container and it's more "inner" than this, then continue 6119 if ( innermostContainer && 6120 $.contains( 6121 this.containers[ i ].element[ 0 ], 6122 innermostContainer.element[ 0 ] ) ) { 6123 continue; 6124 } 6125 6126 innermostContainer = this.containers[ i ]; 6127 innermostIndex = i; 6128 6129 } else { 6130 6131 // container doesn't intersect. trigger "out" event if necessary 6132 if ( this.containers[ i ].containerCache.over ) { 6133 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 6134 this.containers[ i ].containerCache.over = 0; 6135 } 6136 } 6137 6138 } 6139 6140 // If no intersecting containers found, return 6141 if ( !innermostContainer ) { 6142 return; 6143 } 6144 6145 // Move the item into the container if it's not there already 6146 if ( this.containers.length === 1 ) { 6147 if ( !this.containers[ innermostIndex ].containerCache.over ) { 6148 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 6149 this.containers[ innermostIndex ].containerCache.over = 1; 6150 } 6151 } else { 6152 6153 // When entering a new container, we will find the item with the least distance and 6154 // append our item near it 6155 dist = 10000; 6156 itemWithLeastDistance = null; 6157 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 6158 posProperty = floating ? "left" : "top"; 6159 sizeProperty = floating ? "width" : "height"; 6160 axis = floating ? "pageX" : "pageY"; 6161 6162 for ( j = this.items.length - 1; j >= 0; j-- ) { 6163 if ( !$.contains( 6164 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 6165 ) { 6166 continue; 6167 } 6168 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 6169 continue; 6170 } 6171 6172 cur = this.items[ j ].item.offset()[ posProperty ]; 6173 nearBottom = false; 6174 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 6175 nearBottom = true; 6176 } 6177 6178 if ( Math.abs( event[ axis ] - cur ) < dist ) { 6179 dist = Math.abs( event[ axis ] - cur ); 6180 itemWithLeastDistance = this.items[ j ]; 6181 this.direction = nearBottom ? "up" : "down"; 6182 } 6183 } 6184 6185 //Check if dropOnEmpty is enabled 6186 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 6187 return; 6188 } 6189 6190 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 6191 if ( !this.currentContainer.containerCache.over ) { 6192 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 6193 this.currentContainer.containerCache.over = 1; 6194 } 6195 return; 6196 } 6197 6198 if ( itemWithLeastDistance ) { 6199 this._rearrange( event, itemWithLeastDistance, null, true ); 6200 } else { 6201 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 6202 } 6203 this._trigger( "change", event, this._uiHash() ); 6204 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 6205 this.currentContainer = this.containers[ innermostIndex ]; 6206 6207 //Update the placeholder 6208 this.options.placeholder.update( this.currentContainer, this.placeholder ); 6209 6210 //Update scrollParent 6211 this.scrollParent = this.placeholder.scrollParent(); 6212 6213 //Update overflowOffset 6214 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6215 this.scrollParent[ 0 ].tagName !== "HTML" ) { 6216 this.overflowOffset = this.scrollParent.offset(); 6217 } 6218 6219 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 6220 this.containers[ innermostIndex ].containerCache.over = 1; 6221 } 6222 6223 }, 6224 6225 _createHelper: function( event ) { 6226 6227 var o = this.options, 6228 helper = typeof o.helper === "function" ? 6229 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 6230 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 6231 6232 //Add the helper to the DOM if that didn't happen already 6233 if ( !helper.parents( "body" ).length ) { 6234 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 6235 } 6236 6237 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 6238 this._storedCSS = { 6239 width: this.currentItem[ 0 ].style.width, 6240 height: this.currentItem[ 0 ].style.height, 6241 position: this.currentItem.css( "position" ), 6242 top: this.currentItem.css( "top" ), 6243 left: this.currentItem.css( "left" ) 6244 }; 6245 } 6246 6247 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 6248 helper.width( this.currentItem.width() ); 6249 } 6250 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 6251 helper.height( this.currentItem.height() ); 6252 } 6253 6254 return helper; 6255 6256 }, 6257 6258 _adjustOffsetFromHelper: function( obj ) { 6259 if ( typeof obj === "string" ) { 6260 obj = obj.split( " " ); 6261 } 6262 if ( Array.isArray( obj ) ) { 6263 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 6264 } 6265 if ( "left" in obj ) { 6266 this.offset.click.left = obj.left + this.margins.left; 6267 } 6268 if ( "right" in obj ) { 6269 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6270 } 6271 if ( "top" in obj ) { 6272 this.offset.click.top = obj.top + this.margins.top; 6273 } 6274 if ( "bottom" in obj ) { 6275 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6276 } 6277 }, 6278 6279 _getParentOffset: function() { 6280 6281 //Get the offsetParent and cache its position 6282 this.offsetParent = this.helper.offsetParent(); 6283 var po = this.offsetParent.offset(); 6284 6285 // This is a special case where we need to modify a offset calculated on start, since the 6286 // following happened: 6287 // 1. The position of the helper is absolute, so it's position is calculated based on the 6288 // next positioned parent 6289 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 6290 // the document, which means that the scroll is included in the initial calculation of the 6291 // offset of the parent, and never recalculated upon drag 6292 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 6293 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 6294 po.left += this.scrollParent.scrollLeft(); 6295 po.top += this.scrollParent.scrollTop(); 6296 } 6297 6298 // This needs to be actually done for all browsers, since pageX/pageY includes 6299 // this information. 6300 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ) { 6301 po = { top: 0, left: 0 }; 6302 } 6303 6304 return { 6305 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 6306 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 6307 }; 6308 6309 }, 6310 6311 _getRelativeOffset: function() { 6312 6313 if ( this.cssPosition === "relative" ) { 6314 var p = this.currentItem.position(); 6315 return { 6316 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 6317 this.scrollParent.scrollTop(), 6318 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 6319 this.scrollParent.scrollLeft() 6320 }; 6321 } else { 6322 return { top: 0, left: 0 }; 6323 } 6324 6325 }, 6326 6327 _cacheMargins: function() { 6328 this.margins = { 6329 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 6330 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 6331 }; 6332 }, 6333 6334 _cacheHelperProportions: function() { 6335 this.helperProportions = { 6336 width: this.helper.outerWidth(), 6337 height: this.helper.outerHeight() 6338 }; 6339 }, 6340 6341 _setContainment: function() { 6342 6343 var ce, co, over, 6344 o = this.options; 6345 if ( o.containment === "parent" ) { 6346 o.containment = this.helper[ 0 ].parentNode; 6347 } 6348 if ( o.containment === "document" || o.containment === "window" ) { 6349 this.containment = [ 6350 0 - this.offset.relative.left - this.offset.parent.left, 6351 0 - this.offset.relative.top - this.offset.parent.top, 6352 o.containment === "document" ? 6353 this.document.width() : 6354 this.window.width() - this.helperProportions.width - this.margins.left, 6355 ( o.containment === "document" ? 6356 ( this.document.height() || document.body.parentNode.scrollHeight ) : 6357 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 6358 ) - this.helperProportions.height - this.margins.top 6359 ]; 6360 } 6361 6362 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 6363 ce = $( o.containment )[ 0 ]; 6364 co = $( o.containment ).offset(); 6365 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 6366 6367 this.containment = [ 6368 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 6369 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 6370 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 6371 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 6372 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth )
vendor: 1,747 bytes, lines 6372-6424
6372: ce.offsetWidth ) - 6373 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 6374 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 6375 this.helperProportions.width - this.margins.left, 6376 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 6377 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 6378 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 6379 this.helperProportions.height - this.margins.top 6380 ]; 6381 } 6382 6383 }, 6384 6385 _convertPositionTo: function( d, pos ) { 6386 6387 if ( !pos ) { 6388 pos = this.position; 6389 } 6390 var mod = d === "absolute" ? 1 : -1, 6391 scroll = this.cssPosition === "absolute" && 6392 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6393 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 6394 this.offsetParent : 6395 this.scrollParent, 6396 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 6397 6398 return { 6399 top: ( 6400 6401 // The absolute mouse position 6402 pos.top + 6403 6404 // Only for relative positioned nodes: Relative offset from element to offset parent 6405 this.offset.relative.top * mod + 6406 6407 // The offsetParent's offset without borders (offset + border) 6408 this.offset.parent.top * mod - 6409 ( ( this.cssPosition === "fixed" ? 6410 -this.scrollParent.scrollTop() : 6411 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 6412 ), 6413 left: ( 6414 6415 // The absolute mouse position 6416 pos.left + 6417 6418 // Only for relative positioned nodes: Relative offset from element to offset parent 6419 this.offset.relative.left * mod + 6420 6421 // The offsetParent's offset without borders (offset + border) 6422 this.offset.parent.left * mod - 6423 ( ( this.cssPosition === "fixed" ? 6424 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 8,856 bytes, lines 6425-6710
6425 scroll.scrollLeft() ) * mod ) 6426 ) 6427 }; 6428 6429 }, 6430 6431 _generatePosition: function( event ) { 6432 6433 var top, left, 6434 o = this.options, 6435 pageX = event.pageX, 6436 pageY = event.pageY, 6437 scroll = this.cssPosition === "absolute" && 6438 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6439 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 6440 this.offsetParent : 6441 this.scrollParent, 6442 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 6443 6444 // This is another very weird special case that only happens for relative elements: 6445 // 1. If the css position is relative 6446 // 2. and the scroll parent is the document or similar to the offset parent 6447 // we have to refresh the relative offset during the scroll so there are no jumps 6448 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6449 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 6450 this.offset.relative = this._getRelativeOffset(); 6451 } 6452 6453 /* 6454 * - Position constraining - 6455 * Constrain the position to a mix of grid, containment. 6456 */ 6457 6458 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 6459 6460 if ( this.containment ) { 6461 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 6462 pageX = this.containment[ 0 ] + this.offset.click.left; 6463 } 6464 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 6465 pageY = this.containment[ 1 ] + this.offset.click.top; 6466 } 6467 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 6468 pageX = this.containment[ 2 ] + this.offset.click.left; 6469 } 6470 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 6471 pageY = this.containment[ 3 ] + this.offset.click.top; 6472 } 6473 } 6474 6475 if ( o.grid ) { 6476 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 6477 o.grid[ 1 ] ) * o.grid[ 1 ]; 6478 pageY = this.containment ? 6479 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 6480 top - this.offset.click.top <= this.containment[ 3 ] ) ? 6481 top : 6482 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 6483 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 6484 top; 6485 6486 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 6487 o.grid[ 0 ] ) * o.grid[ 0 ]; 6488 pageX = this.containment ? 6489 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 6490 left - this.offset.click.left <= this.containment[ 2 ] ) ? 6491 left : 6492 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 6493 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 6494 left; 6495 } 6496 6497 } 6498 6499 return { 6500 top: ( 6501 6502 // The absolute mouse position 6503 pageY - 6504 6505 // Click offset (relative to the element) 6506 this.offset.click.top - 6507 6508 // Only for relative positioned nodes: Relative offset from element to offset parent 6509 this.offset.relative.top - 6510 6511 // The offsetParent's offset without borders (offset + border) 6512 this.offset.parent.top + 6513 ( ( this.cssPosition === "fixed" ? 6514 -this.scrollParent.scrollTop() : 6515 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 6516 ), 6517 left: ( 6518 6519 // The absolute mouse position 6520 pageX - 6521 6522 // Click offset (relative to the element) 6523 this.offset.click.left - 6524 6525 // Only for relative positioned nodes: Relative offset from element to offset parent 6526 this.offset.relative.left - 6527 6528 // The offsetParent's offset without borders (offset + border) 6529 this.offset.parent.left + 6530 ( ( this.cssPosition === "fixed" ? 6531 -this.scrollParent.scrollLeft() : 6532 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 6533 ) 6534 }; 6535 6536 }, 6537 6538 _rearrange: function( event, i, a, hardRefresh ) { 6539 6540 if ( a ) { 6541 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 6542 } else { 6543 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 6544 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 6545 } 6546 6547 //Various things done here to improve the performance: 6548 // 1. we create a setTimeout, that calls refreshPositions 6549 // 2. on the instance, we have a counter variable, that get's higher after every append 6550 // 3. on the local scope, we copy the counter variable, and check in the timeout, 6551 // if it's still the same 6552 // 4. this lets only the last addition to the timeout stack through 6553 this.counter = this.counter ? ++this.counter : 1; 6554 var counter = this.counter; 6555 6556 this._delay( function() { 6557 if ( counter === this.counter ) { 6558 6559 //Precompute after each DOM insertion, NOT on mousemove 6560 this.refreshPositions( !hardRefresh ); 6561 } 6562 } ); 6563 6564 }, 6565 6566 _clear: function( event, noPropagation ) { 6567 6568 this.reverting = false; 6569 6570 // We delay all events that have to be triggered to after the point where the placeholder 6571 // has been removed and everything else normalized again 6572 var i, 6573 delayedTriggers = []; 6574 6575 // We first have to update the dom position of the actual currentItem 6576 // Note: don't do it if the current item is already removed (by a user), or it gets 6577 // reappended (see #4088) 6578 if ( !this._noFinalSort && this.currentItem.parent().length ) { 6579 this.placeholder.before( this.currentItem ); 6580 } 6581 this._noFinalSort = null; 6582 6583 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 6584 for ( i in this._storedCSS ) { 6585 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 6586 this._storedCSS[ i ] = ""; 6587 } 6588 } 6589 this.currentItem.css( this._storedCSS ); 6590 this._removeClass( this.currentItem, "ui-sortable-helper" ); 6591 } else { 6592 this.currentItem.show(); 6593 } 6594 6595 if ( this.fromOutside && !noPropagation ) { 6596 delayedTriggers.push( function( event ) { 6597 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 6598 } ); 6599 } 6600 if ( ( this.fromOutside || 6601 this.domPosition.prev !== 6602 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 6603 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 6604 6605 // Trigger update callback if the DOM position has changed 6606 delayedTriggers.push( function( event ) { 6607 this._trigger( "update", event, this._uiHash() ); 6608 } ); 6609 } 6610 6611 // Check if the items Container has Changed and trigger appropriate 6612 // events. 6613 if ( this !== this.currentContainer ) { 6614 if ( !noPropagation ) { 6615 delayedTriggers.push( function( event ) { 6616 this._trigger( "remove", event, this._uiHash() ); 6617 } ); 6618 delayedTriggers.push( ( function( c ) { 6619 return function( event ) { 6620 c._trigger( "receive", event, this._uiHash( this ) ); 6621 }; 6622 } ).call( this, this.currentContainer ) ); 6623 delayedTriggers.push( ( function( c ) { 6624 return function( event ) { 6625 c._trigger( "update", event, this._uiHash( this ) ); 6626 }; 6627 } ).call( this, this.currentContainer ) ); 6628 } 6629 } 6630 6631 //Post events to containers 6632 function delayEvent( type, instance, container ) { 6633 return function( event ) { 6634 container._trigger( type, event, instance._uiHash( instance ) ); 6635 }; 6636 } 6637 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6638 if ( !noPropagation ) { 6639 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 6640 } 6641 if ( this.containers[ i ].containerCache.over ) { 6642 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 6643 this.containers[ i ].containerCache.over = 0; 6644 } 6645 } 6646 6647 //Do what was originally in plugins 6648 if ( this._storedStylesheet ) { 6649 this._storedStylesheet.remove(); 6650 this._storedStylesheet = null; 6651 } 6652 if ( this._storedOpacity ) { 6653 this.helper.css( "opacity", this._storedOpacity ); 6654 } 6655 if ( this._storedZIndex ) { 6656 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 6657 } 6658 6659 this.dragging = false; 6660 6661 if ( !noPropagation ) { 6662 this._trigger( "beforeStop", event, this._uiHash() ); 6663 } 6664 6665 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 6666 // it unbinds ALL events from the original node! 6667 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 6668 6669 if ( !this.cancelHelperRemoval ) { 6670 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 6671 this.helper.remove(); 6672 } 6673 this.helper = null; 6674 } 6675 6676 if ( !noPropagation ) { 6677 for ( i = 0; i < delayedTriggers.length; i++ ) { 6678 6679 // Trigger all delayed events 6680 delayedTriggers[ i ].call( this, event ); 6681 } 6682 this._trigger( "stop", event, this._uiHash() ); 6683 } 6684 6685 this.fromOutside = false; 6686 return !this.cancelHelperRemoval; 6687 6688 }, 6689 6690 _trigger: function() { 6691 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 6692 this.cancel(); 6693 } 6694 }, 6695 6696 _uiHash: function( _inst ) { 6697 var inst = _inst || this; 6698 return { 6699 helper: inst.helper, 6700 placeholder: inst.placeholder || $( [] ), 6701 position: inst.position, 6702 originalPosition: inst.originalPosition, 6703 offset: inst.positionAbs, 6704 item: inst.currentItem, 6705 sender: _inst ? _inst.element : null 6706 }; 6707 } 6708 6709} ); 6710
vendor: 16,117 bytes, lines 6711-7334
6711 6712/*! 6713 * jQuery UI Accordion 1.14.0 6714 * https://jqueryui.com 6715 * 6716 * Copyright OpenJS Foundation and other contributors 6717 * Released under the MIT license. 6718 * https://jquery.org/license 6719 */ 6720 6721//>>label: Accordion 6722//>>group: Widgets 6723/* eslint-disable max-len */ 6724//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 6725/* eslint-enable max-len */ 6726//>>docs: https://api.jqueryui.com/accordion/ 6727//>>demos: https://jqueryui.com/accordion/ 6728//>>css.structure: ../../themes/base/core.css 6729//>>css.structure: ../../themes/base/accordion.css 6730//>>css.theme: ../../themes/base/theme.css 6731 6732 6733var widgetsAccordion = $.widget( "ui.accordion", { 6734 version: "1.14.0", 6735 options: { 6736 active: 0, 6737 animate: {}, 6738 classes: { 6739 "ui-accordion-header": "ui-corner-top", 6740 "ui-accordion-header-collapsed": "ui-corner-all", 6741 "ui-accordion-content": "ui-corner-bottom" 6742 }, 6743 collapsible: false, 6744 event: "click", 6745 header: function( elem ) { 6746 return elem 6747 .find( "> li > :first-child" ) 6748 .add( 6749 elem.find( "> :not(li)" ) 6750 6751 // Support: jQuery <3.5 only 6752 // We could use `.even()` but that's unavailable in older jQuery. 6753 .filter( function( i ) { 6754 return i % 2 === 0; 6755 } ) 6756 ); 6757 }, 6758 heightStyle: "auto", 6759 icons: { 6760 activeHeader: "ui-icon-triangle-1-s", 6761 header: "ui-icon-triangle-1-e" 6762 }, 6763 6764 // Callbacks 6765 activate: null, 6766 beforeActivate: null 6767 }, 6768 6769 hideProps: { 6770 borderTopWidth: "hide", 6771 borderBottomWidth: "hide", 6772 paddingTop: "hide", 6773 paddingBottom: "hide", 6774 height: "hide" 6775 }, 6776 6777 showProps: { 6778 borderTopWidth: "show", 6779 borderBottomWidth: "show", 6780 paddingTop: "show", 6781 paddingBottom: "show", 6782 height: "show" 6783 }, 6784 6785 _create: function() { 6786 var options = this.options; 6787 6788 this.prevShow = this.prevHide = $(); 6789 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 6790 this.element.attr( "role", "tablist" ); 6791 6792 // Don't allow collapsible: false and active: false / null 6793 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 6794 options.active = 0; 6795 } 6796 6797 this._processPanels(); 6798 6799 // handle negative values 6800 if ( options.active < 0 ) { 6801 options.active += this.headers.length; 6802 } 6803 this._refresh(); 6804 }, 6805 6806 _getCreateEventData: function() { 6807 return { 6808 header: this.active, 6809 panel: !this.active.length ? $() : this.active.next() 6810 }; 6811 }, 6812 6813 _createIcons: function() { 6814 var icon, children, 6815 icons = this.options.icons; 6816 6817 if ( icons ) { 6818 icon = $( "<span>" ); 6819 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 6820 icon.prependTo( this.headers ); 6821 children = this.active.children( ".ui-accordion-header-icon" ); 6822 this._removeClass( children, icons.header ) 6823 ._addClass( children, null, icons.activeHeader ) 6824 ._addClass( this.headers, "ui-accordion-icons" ); 6825 } 6826 }, 6827 6828 _destroyIcons: function() { 6829 this._removeClass( this.headers, "ui-accordion-icons" ); 6830 this.headers.children( ".ui-accordion-header-icon" ).remove(); 6831 }, 6832 6833 _destroy: function() { 6834 var contents; 6835 6836 // Clean up main element 6837 this.element.removeAttr( "role" ); 6838 6839 // Clean up headers 6840 this.headers 6841 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 6842 .removeUniqueId(); 6843 6844 this._destroyIcons(); 6845 6846 // Clean up content panels 6847 contents = this.headers.next() 6848 .css( "display", "" ) 6849 .removeAttr( "role aria-hidden aria-labelledby" ) 6850 .removeUniqueId(); 6851 6852 if ( this.options.heightStyle !== "content" ) { 6853 contents.css( "height", "" ); 6854 } 6855 }, 6856 6857 _setOption: function( key, value ) { 6858 if ( key === "active" ) { 6859 6860 // _activate() will handle invalid values and update this.options 6861 this._activate( value ); 6862 return; 6863 } 6864 6865 if ( key === "event" ) { 6866 if ( this.options.event ) { 6867 this._off( this.headers, this.options.event ); 6868 } 6869 this._setupEvents( value ); 6870 } 6871 6872 this._super( key, value ); 6873 6874 // Setting collapsible: false while collapsed; open first panel 6875 if ( key === "collapsible" && !value && this.options.active === false ) { 6876 this._activate( 0 ); 6877 } 6878 6879 if ( key === "icons" ) { 6880 this._destroyIcons(); 6881 if ( value ) { 6882 this._createIcons(); 6883 } 6884 } 6885 }, 6886 6887 _setOptionDisabled: function( value ) { 6888 this._super( value ); 6889 6890 this.element.attr( "aria-disabled", value ); 6891 this._toggleClass( null, "ui-state-disabled", !!value ); 6892 }, 6893 6894 _keydown: function( event ) { 6895 if ( event.altKey || event.ctrlKey ) { 6896 return; 6897 } 6898 6899 var keyCode = $.ui.keyCode, 6900 length = this.headers.length, 6901 currentIndex = this.headers.index( event.target ), 6902 toFocus = false; 6903 6904 switch ( event.keyCode ) { 6905 case keyCode.RIGHT: 6906 case keyCode.DOWN: 6907 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 6908 break; 6909 case keyCode.LEFT: 6910 case keyCode.UP: 6911 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 6912 break; 6913 case keyCode.SPACE: 6914 case keyCode.ENTER: 6915 this._eventHandler( event ); 6916 break; 6917 case keyCode.HOME: 6918 toFocus = this.headers[ 0 ]; 6919 break; 6920 case keyCode.END: 6921 toFocus = this.headers[ length - 1 ]; 6922 break; 6923 } 6924 6925 if ( toFocus ) { 6926 $( event.target ).attr( "tabIndex", -1 ); 6927 $( toFocus ).attr( "tabIndex", 0 ); 6928 $( toFocus ).trigger( "focus" ); 6929 event.preventDefault(); 6930 } 6931 }, 6932 6933 _panelKeyDown: function( event ) { 6934 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 6935 $( event.currentTarget ).prev().trigger( "focus" ); 6936 } 6937 }, 6938 6939 refresh: function() { 6940 var options = this.options; 6941 this._processPanels(); 6942 6943 // Was collapsed or no panel 6944 if ( ( options.active === false && options.collapsible === true ) || 6945 !this.headers.length ) { 6946 options.active = false; 6947 this.active = $(); 6948 6949 // active false only when collapsible is true 6950 } else if ( options.active === false ) { 6951 this._activate( 0 ); 6952 6953 // was active, but active panel is gone 6954 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 6955 6956 // all remaining panel are disabled 6957 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 6958 options.active = false; 6959 this.active = $(); 6960 6961 // activate previous panel 6962 } else { 6963 this._activate( Math.max( 0, options.active - 1 ) ); 6964 } 6965 6966 // was active, active panel still exists 6967 } else { 6968 6969 // make sure active index is correct 6970 options.active = this.headers.index( this.active ); 6971 } 6972 6973 this._destroyIcons(); 6974 6975 this._refresh(); 6976 }, 6977 6978 _processPanels: function() { 6979 var prevHeaders = this.headers, 6980 prevPanels = this.panels; 6981 6982 if ( typeof this.options.header === "function" ) { 6983 this.headers = this.options.header( this.element ); 6984 } else { 6985 this.headers = this.element.find( this.options.header ); 6986 } 6987 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 6988 "ui-state-default" ); 6989 6990 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 6991 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 6992 6993 // Avoid memory leaks (#10056) 6994 if ( prevPanels ) { 6995 this._off( prevHeaders.not( this.headers ) ); 6996 this._off( prevPanels.not( this.panels ) ); 6997 } 6998 }, 6999 7000 _refresh: function() { 7001 var maxHeight, 7002 options = this.options, 7003 heightStyle = options.heightStyle, 7004 parent = this.element.parent(); 7005 7006 this.active = this._findActive( options.active ); 7007 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 7008 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 7009 this._addClass( this.active.next(), "ui-accordion-content-active" ); 7010 this.active.next().show(); 7011 7012 this.headers 7013 .attr( "role", "tab" ) 7014 .each( function() { 7015 var header = $( this ), 7016 headerId = header.uniqueId().attr( "id" ), 7017 panel = header.next(), 7018 panelId = panel.uniqueId().attr( "id" ); 7019 header.attr( "aria-controls", panelId ); 7020 panel.attr( "aria-labelledby", headerId ); 7021 } ) 7022 .next() 7023 .attr( "role", "tabpanel" ); 7024 7025 this.headers 7026 .not( this.active ) 7027 .attr( { 7028 "aria-selected": "false", 7029 "aria-expanded": "false", 7030 tabIndex: -1 7031 } ) 7032 .next() 7033 .attr( { 7034 "aria-hidden": "true" 7035 } ) 7036 .hide(); 7037 7038 // Make sure at least one header is in the tab order 7039 if ( !this.active.length ) { 7040 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 7041 } else { 7042 this.active.attr( { 7043 "aria-selected": "true", 7044 "aria-expanded": "true", 7045 tabIndex: 0 7046 } ) 7047 .next() 7048 .attr( { 7049 "aria-hidden": "false" 7050 } ); 7051 } 7052 7053 this._createIcons(); 7054 7055 this._setupEvents( options.event ); 7056 7057 if ( heightStyle === "fill" ) { 7058 maxHeight = parent.height(); 7059 this.element.siblings( ":visible" ).each( function() { 7060 var elem = $( this ), 7061 position = elem.css( "position" ); 7062 7063 if ( position === "absolute" || position === "fixed" ) { 7064 return; 7065 } 7066 maxHeight -= elem.outerHeight( true ); 7067 } ); 7068 7069 this.headers.each( function() { 7070 maxHeight -= $( this ).outerHeight( true ); 7071 } ); 7072 7073 this.headers.next() 7074 .each( function() { 7075 $( this ).height( Math.max( 0, maxHeight - 7076 $( this ).innerHeight() + $( this ).height() ) ); 7077 } ) 7078 .css( "overflow", "auto" ); 7079 } else if ( heightStyle === "auto" ) { 7080 maxHeight = 0; 7081 this.headers.next() 7082 .each( function() { 7083 var isVisible = $( this ).is( ":visible" ); 7084 if ( !isVisible ) { 7085 $( this ).show(); 7086 } 7087 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 7088 if ( !isVisible ) { 7089 $( this ).hide(); 7090 } 7091 } ) 7092 .height( maxHeight ); 7093 } 7094 }, 7095 7096 _activate: function( index ) { 7097 var active = this._findActive( index )[ 0 ]; 7098 7099 // Trying to activate the already active panel 7100 if ( active === this.active[ 0 ] ) { 7101 return; 7102 } 7103 7104 // Trying to collapse, simulate a click on the currently active header 7105 active = active || this.active[ 0 ]; 7106 7107 this._eventHandler( { 7108 target: active, 7109 currentTarget: active, 7110 preventDefault: $.noop 7111 } ); 7112 }, 7113 7114 _findActive: function( selector ) { 7115 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 7116 }, 7117 7118 _setupEvents: function( event ) { 7119 var events = { 7120 keydown: "_keydown" 7121 }; 7122 if ( event ) { 7123 $.each( event.split( " " ), function( index, eventName ) { 7124 events[ eventName ] = "_eventHandler"; 7125 } ); 7126 } 7127 7128 this._off( this.headers.add( this.headers.next() ) ); 7129 this._on( this.headers, events ); 7130 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 7131 this._hoverable( this.headers ); 7132 this._focusable( this.headers ); 7133 }, 7134 7135 _eventHandler: function( event ) { 7136 var activeChildren, clickedChildren, 7137 options = this.options, 7138 active = this.active, 7139 clicked = $( event.currentTarget ), 7140 clickedIsActive = clicked[ 0 ] === active[ 0 ], 7141 collapsing = clickedIsActive && options.collapsible, 7142 toShow = collapsing ? $() : clicked.next(), 7143 toHide = active.next(), 7144 eventData = { 7145 oldHeader: active, 7146 oldPanel: toHide, 7147 newHeader: collapsing ? $() : clicked, 7148 newPanel: toShow 7149 }; 7150 7151 event.preventDefault(); 7152 7153 if ( 7154 7155 // click on active header, but not collapsible 7156 ( clickedIsActive && !options.collapsible ) || 7157 7158 // allow canceling activation 7159 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 7160 return; 7161 } 7162 7163 options.active = collapsing ? false : this.headers.index( clicked ); 7164 7165 // When the call to ._toggle() comes after the class changes 7166 // it causes a very odd bug in IE 8 (see #6720) 7167 this.active = clickedIsActive ? $() : clicked; 7168 this._toggle( eventData ); 7169 7170 // Switch classes 7171 // corner classes on the previously active header stay after the animation 7172 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 7173 if ( options.icons ) { 7174 activeChildren = active.children( ".ui-accordion-header-icon" ); 7175 this._removeClass( activeChildren, null, options.icons.activeHeader ) 7176 ._addClass( activeChildren, null, options.icons.header ); 7177 } 7178 7179 if ( !clickedIsActive ) { 7180 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 7181 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 7182 if ( options.icons ) { 7183 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 7184 this._removeClass( clickedChildren, null, options.icons.header ) 7185 ._addClass( clickedChildren, null, options.icons.activeHeader ); 7186 } 7187 7188 this._addClass( clicked.next(), "ui-accordion-content-active" ); 7189 } 7190 }, 7191 7192 _toggle: function( data ) { 7193 var toShow = data.newPanel, 7194 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 7195 7196 // Handle activating a panel during the animation for another activation 7197 this.prevShow.add( this.prevHide ).stop( true, true ); 7198 this.prevShow = toShow; 7199 this.prevHide = toHide; 7200 7201 if ( this.options.animate ) { 7202 this._animate( toShow, toHide, data ); 7203 } else { 7204 toHide.hide(); 7205 toShow.show(); 7206 this._toggleComplete( data ); 7207 } 7208 7209 toHide.attr( { 7210 "aria-hidden": "true" 7211 } ); 7212 toHide.prev().attr( { 7213 "aria-selected": "false", 7214 "aria-expanded": "false" 7215 } ); 7216 7217 // if we're switching panels, remove the old header from the tab order 7218 // if we're opening from collapsed state, remove the previous header from the tab order 7219 // if we're collapsing, then keep the collapsing header in the tab order 7220 if ( toShow.length && toHide.length ) { 7221 toHide.prev().attr( { 7222 "tabIndex": -1, 7223 "aria-expanded": "false" 7224 } ); 7225 } else if ( toShow.length ) { 7226 this.headers.filter( function() { 7227 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 7228 } ) 7229 .attr( "tabIndex", -1 ); 7230 } 7231 7232 toShow 7233 .attr( "aria-hidden", "false" ) 7234 .prev() 7235 .attr( { 7236 "aria-selected": "true", 7237 "aria-expanded": "true", 7238 tabIndex: 0 7239 } ); 7240 }, 7241 7242 _animate: function( toShow, toHide, data ) { 7243 var total, easing, duration, 7244 that = this, 7245 adjust = 0, 7246 boxSizing = toShow.css( "box-sizing" ), 7247 down = toShow.length && 7248 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 7249 animate = this.options.animate || {}, 7250 options = down && animate.down || animate, 7251 complete = function() { 7252 that._toggleComplete( data ); 7253 }; 7254 7255 if ( typeof options === "number" ) { 7256 duration = options; 7257 } 7258 if ( typeof options === "string" ) { 7259 easing = options; 7260 } 7261 7262 // fall back from options to animation in case of partial down settings 7263 easing = easing || options.easing || animate.easing; 7264 duration = duration || options.duration || animate.duration; 7265 7266 if ( !toHide.length ) { 7267 return toShow.animate( this.showProps, duration, easing, complete ); 7268 } 7269 if ( !toShow.length ) { 7270 return toHide.animate( this.hideProps, duration, easing, complete ); 7271 } 7272 7273 total = toShow.show().outerHeight(); 7274 toHide.animate( this.hideProps, { 7275 duration: duration, 7276 easing: easing, 7277 step: function( now, fx ) { 7278 fx.now = Math.round( now ); 7279 } 7280 } ); 7281 toShow 7282 .hide() 7283 .animate( this.showProps, { 7284 duration: duration, 7285 easing: easing, 7286 complete: complete, 7287 step: function( now, fx ) { 7288 fx.now = Math.round( now ); 7289 if ( fx.prop !== "height" ) { 7290 if ( boxSizing === "content-box" ) { 7291 adjust += fx.now; 7292 } 7293 } else if ( that.options.heightStyle !== "content" ) { 7294 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 7295 adjust = 0; 7296 } 7297 } 7298 } ); 7299 }, 7300 7301 _toggleComplete: function( data ) { 7302 var toHide = data.oldPanel, 7303 prev = toHide.prev(); 7304 7305 this._removeClass( toHide, "ui-accordion-content-active" ); 7306 this._removeClass( prev, "ui-accordion-header-active" ) 7307 ._addClass( prev, "ui-accordion-header-collapsed" ); 7308 7309 this._trigger( "activate", null, data ); 7310 } 7311} ); 7312 7313 7314/*! 7315 * jQuery UI Menu 1.14.0 7316 * https://jqueryui.com 7317 * 7318 * Copyright OpenJS Foundation and other contributors 7319 * Released under the MIT license. 7320 * https://jquery.org/license 7321 */ 7322 7323//>>label: Menu 7324//>>group: Widgets 7325//>>description: Creates nestable menus. 7326//>>docs: https://api.jqueryui.com/menu/ 7327//>>demos: https://jqueryui.com/menu/ 7328//>>css.structure: ../../themes/base/core.css 7329//>>css.structure: ../../themes/base/menu.css 7330//>>css.theme: ../../themes/base/theme.css 7331 7332 7333var widgetsMenu = $.widget( "ui.menu", { 7334 version: "1.14.0
vendor: 5,700 bytes, lines 7334-7553
7334", 7335 defaultElement: "<ul>", 7336 delay: 300, 7337 options: { 7338 icons: { 7339 submenu: "ui-icon-caret-1-e" 7340 }, 7341 items: "> *", 7342 menus: "ul", 7343 position: { 7344 my: "left top", 7345 at: "right top" 7346 }, 7347 role: "menu", 7348 7349 // Callbacks 7350 blur: null, 7351 focus: null, 7352 select: null 7353 }, 7354 7355 _create: function() { 7356 this.activeMenu = this.element; 7357 7358 // Flag used to prevent firing of the click handler 7359 // as the event bubbles up through nested menus 7360 this.mouseHandled = false; 7361 this.lastMousePosition = { x: null, y: null }; 7362 this.element 7363 .uniqueId() 7364 .attr( { 7365 role: this.options.role, 7366 tabIndex: 0 7367 } ); 7368 7369 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 7370 this._on( { 7371 7372 // Prevent focus from sticking to links inside menu after clicking 7373 // them (focus should always stay on UL during navigation). 7374 "mousedown .ui-menu-item": function( event ) { 7375 event.preventDefault(); 7376 7377 this._activateItem( event ); 7378 }, 7379 "click .ui-menu-item": function( event ) { 7380 var target = $( event.target ); 7381 var active = $( this.document[ 0 ].activeElement ); 7382 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 7383 this.select( event ); 7384 7385 // Only set the mouseHandled flag if the event will bubble, see #9469. 7386 if ( !event.isPropagationStopped() ) { 7387 this.mouseHandled = true; 7388 } 7389 7390 // Open submenu on click 7391 if ( target.has( ".ui-menu" ).length ) { 7392 this.expand( event ); 7393 } else if ( !this.element.is( ":focus" ) && 7394 active.closest( ".ui-menu" ).length ) { 7395 7396 // Redirect focus to the menu 7397 this.element.trigger( "focus", [ true ] ); 7398 7399 // If the active item is on the top level, let it stay active. 7400 // Otherwise, blur the active item since it is no longer visible. 7401 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 7402 clearTimeout( this.timer ); 7403 } 7404 } 7405 } 7406 }, 7407 "mouseenter .ui-menu-item": "_activateItem", 7408 "mousemove .ui-menu-item": "_activateItem", 7409 mouseleave: "collapseAll", 7410 "mouseleave .ui-menu": "collapseAll", 7411 focus: function( event, keepActiveItem ) { 7412 7413 // If there's already an active item, keep it active 7414 // If not, activate the first item 7415 var item = this.active || this._menuItems().first(); 7416 7417 if ( !keepActiveItem ) { 7418 this.focus( event, item ); 7419 } 7420 }, 7421 blur: function( event ) { 7422 this._delay( function() { 7423 var notContained = !$.contains( 7424 this.element[ 0 ], 7425 this.document[ 0 ].activeElement 7426 ); 7427 if ( notContained ) { 7428 this.collapseAll( event ); 7429 } 7430 } ); 7431 }, 7432 keydown: "_keydown" 7433 } ); 7434 7435 this.refresh(); 7436 7437 // Clicks outside of a menu collapse any open menus 7438 this._on( this.document, { 7439 click: function( event ) { 7440 if ( this._closeOnDocumentClick( event ) ) { 7441 this.collapseAll( event, true ); 7442 } 7443 7444 // Reset the mouseHandled flag 7445 this.mouseHandled = false; 7446 } 7447 } ); 7448 }, 7449 7450 _activateItem: function( event ) { 7451 7452 // Ignore mouse events while typeahead is active, see #10458. 7453 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 7454 // is over an item in the menu 7455 if ( this.previousFilter ) { 7456 return; 7457 } 7458 7459 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 7460 if ( event.clientX === this.lastMousePosition.x && 7461 event.clientY === this.lastMousePosition.y ) { 7462 return; 7463 } 7464 7465 this.lastMousePosition = { 7466 x: event.clientX, 7467 y: event.clientY 7468 }; 7469 7470 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 7471 target = $( event.currentTarget ); 7472 7473 // Ignore bubbled events on parent items, see #11641 7474 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 7475 return; 7476 } 7477 7478 // If the item is already active, there's nothing to do 7479 if ( target.is( ".ui-state-active" ) ) { 7480 return; 7481 } 7482 7483 // Remove ui-state-active class from siblings of the newly focused menu item 7484 // to avoid a jump caused by adjacent elements both having a class with a border 7485 this._removeClass( target.siblings().children( ".ui-state-active" ), 7486 null, "ui-state-active" ); 7487 this.focus( event, target ); 7488 }, 7489 7490 _destroy: function() { 7491 var items = this.element.find( ".ui-menu-item" ) 7492 .removeAttr( "role aria-disabled" ), 7493 submenus = items.children( ".ui-menu-item-wrapper" ) 7494 .removeUniqueId() 7495 .removeAttr( "tabIndex role aria-haspopup" ); 7496 7497 // Destroy (sub)menus 7498 this.element 7499 .removeAttr( "aria-activedescendant" ) 7500 .find( ".ui-menu" ).addBack() 7501 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 7502 "tabIndex" ) 7503 .removeUniqueId() 7504 .show(); 7505 7506 submenus.children().each( function() { 7507 var elem = $( this ); 7508 if ( elem.data( "ui-menu-submenu-caret" ) ) { 7509 elem.remove(); 7510 } 7511 } ); 7512 }, 7513 7514 _keydown: function( event ) { 7515 var match, prev, character, skip, 7516 preventDefault = true; 7517 7518 switch ( event.keyCode ) { 7519 case $.ui.keyCode.PAGE_UP: 7520 this.previousPage( event ); 7521 break; 7522 case $.ui.keyCode.PAGE_DOWN: 7523 this.nextPage( event ); 7524 break; 7525 case $.ui.keyCode.HOME: 7526 this._move( "first", "first", event ); 7527 break; 7528 case $.ui.keyCode.END: 7529 this._move( "last", "last", event ); 7530 break; 7531 case $.ui.keyCode.UP: 7532 this.previous( event ); 7533 break; 7534 case $.ui.keyCode.DOWN: 7535 this.next( event ); 7536 break; 7537 case $.ui.keyCode.LEFT: 7538 this.collapse( event ); 7539 break; 7540 case $.ui.keyCode.RIGHT: 7541 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 7542 this.expand( event ); 7543 } 7544 break; 7545 case $.ui.keyCode.ENTER: 7546 case $.ui.keyCode.SPACE: 7547 this._activate( event ); 7548 break; 7549 case $.ui.keyCode.ESCAPE: 7550 this.collapse( event ); 7551 break; 7552 default: 7553 preventDefault = false;
vendor: 6,930 bytes, lines 7554-7802
7554 prev = this.previousFilter || ""; 7555 skip = false; 7556 7557 // Support number pad values 7558 character = event.keyCode >= 96 && event.keyCode <= 105 ? 7559 ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode ); 7560 7561 clearTimeout( this.filterTimer ); 7562 7563 if ( character === prev ) { 7564 skip = true; 7565 } else { 7566 character = prev + character; 7567 } 7568 7569 match = this._filterMenuItems( character ); 7570 match = skip && match.index( this.active.next() ) !== -1 ? 7571 this.active.nextAll( ".ui-menu-item" ) : 7572 match; 7573 7574 // If no matches on the current filter, reset to the last character pressed 7575 // to move down the menu to the first item that starts with that character 7576 if ( !match.length ) { 7577 character = String.fromCharCode( event.keyCode ); 7578 match = this._filterMenuItems( character ); 7579 } 7580 7581 if ( match.length ) { 7582 this.focus( event, match ); 7583 this.previousFilter = character; 7584 this.filterTimer = this._delay( function() { 7585 delete this.previousFilter; 7586 }, 1000 ); 7587 } else { 7588 delete this.previousFilter; 7589 } 7590 } 7591 7592 if ( preventDefault ) { 7593 event.preventDefault(); 7594 } 7595 }, 7596 7597 _activate: function( event ) { 7598 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 7599 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 7600 this.expand( event ); 7601 } else { 7602 this.select( event ); 7603 } 7604 } 7605 }, 7606 7607 refresh: function() { 7608 var menus, items, newSubmenus, newItems, newWrappers, 7609 that = this, 7610 icon = this.options.icons.submenu, 7611 submenus = this.element.find( this.options.menus ); 7612 7613 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 7614 7615 // Initialize nested menus 7616 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 7617 .hide() 7618 .attr( { 7619 role: this.options.role, 7620 "aria-hidden": "true", 7621 "aria-expanded": "false" 7622 } ) 7623 .each( function() { 7624 var menu = $( this ), 7625 item = menu.prev(), 7626 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 7627 7628 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 7629 item 7630 .attr( "aria-haspopup", "true" ) 7631 .prepend( submenuCaret ); 7632 menu.attr( "aria-labelledby", item.attr( "id" ) ); 7633 } ); 7634 7635 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 7636 7637 menus = submenus.add( this.element ); 7638 items = menus.find( this.options.items ); 7639 7640 // Initialize menu-items containing spaces and/or dashes only as dividers 7641 items.not( ".ui-menu-item" ).each( function() { 7642 var item = $( this ); 7643 if ( that._isDivider( item ) ) { 7644 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 7645 } 7646 } ); 7647 7648 // Don't refresh list items that are already adapted 7649 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 7650 newWrappers = newItems.children() 7651 .not( ".ui-menu" ) 7652 .uniqueId() 7653 .attr( { 7654 tabIndex: -1, 7655 role: this._itemRole() 7656 } ); 7657 this._addClass( newItems, "ui-menu-item" ) 7658 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 7659 7660 // Add aria-disabled attribute to any disabled menu item 7661 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 7662 7663 // If the active item has been removed, blur the menu 7664 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 7665 this.blur(); 7666 } 7667 }, 7668 7669 _itemRole: function() { 7670 return { 7671 menu: "menuitem", 7672 listbox: "option" 7673 }[ this.options.role ]; 7674 }, 7675 7676 _setOption: function( key, value ) { 7677 if ( key === "icons" ) { 7678 var icons = this.element.find( ".ui-menu-icon" ); 7679 this._removeClass( icons, null, this.options.icons.submenu ) 7680 ._addClass( icons, null, value.submenu ); 7681 } 7682 this._super( key, value ); 7683 }, 7684 7685 _setOptionDisabled: function( value ) { 7686 this._super( value ); 7687 7688 this.element.attr( "aria-disabled", String( value ) ); 7689 this._toggleClass( null, "ui-state-disabled", !!value ); 7690 }, 7691 7692 focus: function( event, item ) { 7693 var nested, focused, activeParent; 7694 this.blur( event, event && event.type === "focus" ); 7695 7696 this._scrollIntoView( item ); 7697 7698 this.active = item.first(); 7699 7700 focused = this.active.children( ".ui-menu-item-wrapper" ); 7701 this._addClass( focused, null, "ui-state-active" ); 7702 7703 // Only update aria-activedescendant if there's a role 7704 // otherwise we assume focus is managed elsewhere 7705 if ( this.options.role ) { 7706 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 7707 } 7708 7709 // Highlight active parent menu item, if any 7710 activeParent = this.active 7711 .parent() 7712 .closest( ".ui-menu-item" ) 7713 .children( ".ui-menu-item-wrapper" ); 7714 this._addClass( activeParent, null, "ui-state-active" ); 7715 7716 if ( event && event.type === "keydown" ) { 7717 this._close(); 7718 } else { 7719 this.timer = this._delay( function() { 7720 this._close(); 7721 }, this.delay ); 7722 } 7723 7724 nested = item.children( ".ui-menu" ); 7725 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 7726 this._startOpening( nested ); 7727 } 7728 this.activeMenu = item.parent(); 7729 7730 this._trigger( "focus", event, { item: item } ); 7731 }, 7732 7733 _scrollIntoView: function( item ) { 7734 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 7735 if ( this._hasScroll() ) { 7736 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 7737 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 7738 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 7739 scroll = this.activeMenu.scrollTop(); 7740 elementHeight = this.activeMenu.height(); 7741 itemHeight = item.outerHeight(); 7742 7743 if ( offset < 0 ) { 7744 this.activeMenu.scrollTop( scroll + offset ); 7745 } else if ( offset + itemHeight > elementHeight ) { 7746 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 7747 } 7748 } 7749 }, 7750 7751 blur: function( event, fromFocus ) { 7752 if ( !fromFocus ) { 7753 clearTimeout( this.timer ); 7754 } 7755 7756 if ( !this.active ) { 7757 return; 7758 } 7759 7760 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 7761 null, "ui-state-active" ); 7762 7763 this._trigger( "blur", event, { item: this.active } ); 7764 this.active = null; 7765 }, 7766 7767 _startOpening: function( submenu ) { 7768 clearTimeout( this.timer ); 7769 7770 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 7771 // shift in the submenu position when mousing over the caret icon 7772 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 7773 return; 7774 } 7775 7776 this.timer = this._delay( function() { 7777 this._close(); 7778 this._open( submenu ); 7779 }, this.delay ); 7780 }, 7781 7782 _open: function( submenu ) { 7783 var position = $.extend( { 7784 of: this.active 7785 }, this.options.position ); 7786 7787 clearTimeout( this.timer ); 7788 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 7789 .hide() 7790 .attr( "aria-hidden", "true" ); 7791 7792 submenu 7793 .show() 7794 .removeAttr( "aria-hidden" ) 7795 .attr( "aria-expanded", "true" ) 7796 .position( position ); 7797 }, 7798 7799 collapseAll: function( event, all ) { 7800 clearTimeout( this.timer ); 7801 this.timer = this._delay( function() { 7802
vendor: 5,434 bytes, lines 7803-8006
7803 // If we were passed an event, look for the submenu that contains the event 7804 var currentMenu = all ? this.element : 7805 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 7806 7807 // If we found no valid submenu ancestor, use the main menu to close all 7808 // sub menus anyway 7809 if ( !currentMenu.length ) { 7810 currentMenu = this.element; 7811 } 7812 7813 this._close( currentMenu ); 7814 7815 this.blur( event ); 7816 7817 // Work around active item staying active after menu is blurred 7818 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 7819 7820 this.activeMenu = currentMenu; 7821 }, all ? 0 : this.delay ); 7822 }, 7823 7824 // With no arguments, closes the currently active menu - if nothing is active 7825 // it closes all menus. If passed an argument, it will search for menus BELOW 7826 _close: function( startMenu ) { 7827 if ( !startMenu ) { 7828 startMenu = this.active ? this.active.parent() : this.element; 7829 } 7830 7831 startMenu.find( ".ui-menu" ) 7832 .hide() 7833 .attr( "aria-hidden", "true" ) 7834 .attr( "aria-expanded", "false" ); 7835 }, 7836 7837 _closeOnDocumentClick: function( event ) { 7838 return !$( event.target ).closest( ".ui-menu" ).length; 7839 }, 7840 7841 _isDivider: function( item ) { 7842 7843 // Match hyphen, em dash, en dash 7844 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 7845 }, 7846 7847 collapse: function( event ) { 7848 var newItem = this.active && 7849 this.active.parent().closest( ".ui-menu-item", this.element ); 7850 if ( newItem && newItem.length ) { 7851 this._close(); 7852 this.focus( event, newItem ); 7853 } 7854 }, 7855 7856 expand: function( event ) { 7857 var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first(); 7858 7859 if ( newItem && newItem.length ) { 7860 this._open( newItem.parent() ); 7861 7862 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 7863 this._delay( function() { 7864 this.focus( event, newItem ); 7865 } ); 7866 } 7867 }, 7868 7869 next: function( event ) { 7870 this._move( "next", "first", event ); 7871 }, 7872 7873 previous: function( event ) { 7874 this._move( "prev", "last", event ); 7875 }, 7876 7877 isFirstItem: function() { 7878 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 7879 }, 7880 7881 isLastItem: function() { 7882 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 7883 }, 7884 7885 _menuItems: function( menu ) { 7886 return ( menu || this.element ) 7887 .find( this.options.items ) 7888 .filter( ".ui-menu-item" ); 7889 }, 7890 7891 _move: function( direction, filter, event ) { 7892 var next; 7893 if ( this.active ) { 7894 if ( direction === "first" || direction === "last" ) { 7895 next = this.active 7896 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 7897 .last(); 7898 } else { 7899 next = this.active 7900 [ direction + "All" ]( ".ui-menu-item" ) 7901 .first(); 7902 } 7903 } 7904 if ( !next || !next.length || !this.active ) { 7905 next = this._menuItems( this.activeMenu )[ filter ](); 7906 } 7907 7908 this.focus( event, next ); 7909 }, 7910 7911 nextPage: function( event ) { 7912 var item, base, height; 7913 7914 if ( !this.active ) { 7915 this.next( event ); 7916 return; 7917 } 7918 if ( this.isLastItem() ) { 7919 return; 7920 } 7921 if ( this._hasScroll() ) { 7922 base = this.active.offset().top; 7923 height = this.element.innerHeight(); 7924 7925 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 7926 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 7927 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 7928 } 7929 7930 this.active.nextAll( ".ui-menu-item" ).each( function() { 7931 item = $( this ); 7932 return item.offset().top - base - height < 0; 7933 } ); 7934 7935 this.focus( event, item ); 7936 } else { 7937 this.focus( event, this._menuItems( this.activeMenu ) 7938 [ !this.active ? "first" : "last" ]() ); 7939 } 7940 }, 7941 7942 previousPage: function( event ) { 7943 var item, base, height; 7944 if ( !this.active ) { 7945 this.next( event ); 7946 return; 7947 } 7948 if ( this.isFirstItem() ) { 7949 return; 7950 } 7951 if ( this._hasScroll() ) { 7952 base = this.active.offset().top; 7953 height = this.element.innerHeight(); 7954 7955 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 7956 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 7957 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 7958 } 7959 7960 this.active.prevAll( ".ui-menu-item" ).each( function() { 7961 item = $( this ); 7962 return item.offset().top - base + height > 0; 7963 } ); 7964 7965 this.focus( event, item ); 7966 } else { 7967 this.focus( event, this._menuItems( this.activeMenu ).first() ); 7968 } 7969 }, 7970 7971 _hasScroll: function() { 7972 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 7973 }, 7974 7975 select: function( event ) { 7976 7977 // TODO: It should never be possible to not have an active item at this 7978 // point, but the tests don't trigger mouseenter before click. 7979 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 7980 var ui = { item: this.active }; 7981 if ( !this.active.has( ".ui-menu" ).length ) { 7982 this.collapseAll( event, true ); 7983 } 7984 this._trigger( "select", event, ui ); 7985 }, 7986 7987 _filterMenuItems: function( character ) { 7988 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 7989 regex = new RegExp( "^" + escapedCharacter, "i" ); 7990 7991 return this.activeMenu 7992 .find( this.options.items ) 7993 7994 // Only match on items, not dividers or other content (#10571) 7995 .filter( ".ui-menu-item" ) 7996 .filter( function() { 7997 return regex.test( 7998 String.prototype.trim.call( 7999 $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 8000 } ); 8001 } 8002} ); 8003 8004 8005/*! 8006 * jQuery UI Autocomplete 1.14.
80060 8007 * https://jqueryui.com 8008 * 8009 * Copyright OpenJS Foundation and other contributors 8010 * Released under the MIT license. 8011 * https://jquery.org/license 8012 */ 8013 8014//>>label: Autocomplete 8015//>>group: Widgets 8016//>>description: Lists suggested words as the user is typing. 8017//>>docs: https://api.jqueryui.com/autocomplete/ 8018//>>demos: https://jqueryui.com/autocomplete/ 8019//>>css.structure: ../../themes/base/core.css 8020//>>css.structure: ../../themes/base/autocomplete.css 8021//>>css.theme: ../../themes/base/theme.css 8022 8023 8024$.widget( "ui.autocomplete", { 8025 version: "1.14.0
vendor: 15,301 bytes, lines 8025-8625
8025", 8026 defaultElement: "<input>", 8027 options: { 8028 appendTo: null, 8029 autoFocus: false, 8030 delay: 300, 8031 minLength: 1, 8032 position: { 8033 my: "left top", 8034 at: "left bottom", 8035 collision: "none" 8036 }, 8037 source: null, 8038 8039 // Callbacks 8040 change: null, 8041 close: null, 8042 focus: null, 8043 open: null, 8044 response: null, 8045 search: null, 8046 select: null 8047 }, 8048 8049 requestIndex: 0, 8050 pending: 0, 8051 liveRegionTimer: null, 8052 8053 _create: function() { 8054 8055 // Some browsers only repeat keydown events, not keypress events, 8056 // so we use the suppressKeyPress flag to determine if we've already 8057 // handled the keydown event. #7269 8058 // Unfortunately the code for & in keypress is the same as the up arrow, 8059 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 8060 // events when we know the keydown event was used to modify the 8061 // search term. #7799 8062 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 8063 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 8064 isTextarea = nodeName === "textarea", 8065 isInput = nodeName === "input"; 8066 8067 // Textareas are always multi-line 8068 // Inputs are always single-line, even if inside a contentEditable element 8069 // All other element types are determined by whether they're contentEditable 8070 this.isMultiLine = isTextarea || 8071 !isInput && this.element.prop( "contentEditable" ) === "true"; 8072 8073 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 8074 this.isNewMenu = true; 8075 8076 this._addClass( "ui-autocomplete-input" ); 8077 this.element.attr( "autocomplete", "off" ); 8078 8079 this._on( this.element, { 8080 keydown: function( event ) { 8081 if ( this.element.prop( "readOnly" ) ) { 8082 suppressKeyPress = true; 8083 suppressInput = true; 8084 suppressKeyPressRepeat = true; 8085 return; 8086 } 8087 8088 suppressKeyPress = false; 8089 suppressInput = false; 8090 suppressKeyPressRepeat = false; 8091 var keyCode = $.ui.keyCode; 8092 switch ( event.keyCode ) { 8093 case keyCode.PAGE_UP: 8094 suppressKeyPress = true; 8095 this._move( "previousPage", event ); 8096 break; 8097 case keyCode.PAGE_DOWN: 8098 suppressKeyPress = true; 8099 this._move( "nextPage", event ); 8100 break; 8101 case keyCode.UP: 8102 suppressKeyPress = true; 8103 this._keyEvent( "previous", event ); 8104 break; 8105 case keyCode.DOWN: 8106 suppressKeyPress = true; 8107 this._keyEvent( "next", event ); 8108 break; 8109 case keyCode.ENTER: 8110 8111 // when menu is open and has focus 8112 if ( this.menu.active ) { 8113 8114 // #6055 - Opera still allows the keypress to occur 8115 // which causes forms to submit 8116 suppressKeyPress = true; 8117 event.preventDefault(); 8118 this.menu.select( event ); 8119 } 8120 break; 8121 case keyCode.TAB: 8122 if ( this.menu.active ) { 8123 this.menu.select( event ); 8124 } 8125 break; 8126 case keyCode.ESCAPE: 8127 if ( this.menu.element.is( ":visible" ) ) { 8128 if ( !this.isMultiLine ) { 8129 this._value( this.term ); 8130 } 8131 this.close( event ); 8132 8133 // Different browsers have different default behavior for escape 8134 // Single press can mean undo or clear 8135 event.preventDefault(); 8136 } 8137 break; 8138 default: 8139 suppressKeyPressRepeat = true; 8140 8141 // search timeout should be triggered before the input value is changed 8142 this._searchTimeout( event ); 8143 break; 8144 } 8145 }, 8146 keypress: function( event ) { 8147 if ( suppressKeyPress ) { 8148 suppressKeyPress = false; 8149 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 8150 event.preventDefault(); 8151 } 8152 return; 8153 } 8154 if ( suppressKeyPressRepeat ) { 8155 return; 8156 } 8157 8158 // Replicate some key handlers to allow them to repeat in Firefox and Opera 8159 var keyCode = $.ui.keyCode; 8160 switch ( event.keyCode ) { 8161 case keyCode.PAGE_UP: 8162 this._move( "previousPage", event ); 8163 break; 8164 case keyCode.PAGE_DOWN: 8165 this._move( "nextPage", event ); 8166 break; 8167 case keyCode.UP: 8168 this._keyEvent( "previous", event ); 8169 break; 8170 case keyCode.DOWN: 8171 this._keyEvent( "next", event ); 8172 break; 8173 } 8174 }, 8175 input: function( event ) { 8176 if ( suppressInput ) { 8177 suppressInput = false; 8178 event.preventDefault(); 8179 return; 8180 } 8181 this._searchTimeout( event ); 8182 }, 8183 focus: function() { 8184 this.selectedItem = null; 8185 this.previous = this._value(); 8186 }, 8187 blur: function( event ) { 8188 clearTimeout( this.searching ); 8189 this.close( event ); 8190 this._change( event ); 8191 } 8192 } ); 8193 8194 this._initSource(); 8195 this.menu = $( "<ul>" ) 8196 .appendTo( this._appendTo() ) 8197 .menu( { 8198 8199 // disable ARIA support, the live region takes care of that 8200 role: null 8201 } ) 8202 .hide() 8203 .menu( "instance" ); 8204 8205 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 8206 this._on( this.menu.element, { 8207 mousedown: function( event ) { 8208 8209 // Prevent moving focus out of the text field 8210 event.preventDefault(); 8211 }, 8212 menufocus: function( event, ui ) { 8213 var label, item; 8214 8215 // Support: Firefox 8216 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 8217 if ( this.isNewMenu ) { 8218 this.isNewMenu = false; 8219 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 8220 this.menu.blur(); 8221 8222 this.document.one( "mousemove", function() { 8223 $( event.target ).trigger( event.originalEvent ); 8224 } ); 8225 8226 return; 8227 } 8228 } 8229 8230 item = ui.item.data( "ui-autocomplete-item" ); 8231 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 8232 8233 // use value to match what will end up in the input, if it was a key event 8234 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 8235 this._value( item.value ); 8236 } 8237 } 8238 8239 // Announce the value in the liveRegion 8240 label = ui.item.attr( "aria-label" ) || item.value; 8241 if ( label && String.prototype.trim.call( label ).length ) { 8242 clearTimeout( this.liveRegionTimer ); 8243 this.liveRegionTimer = this._delay( function() { 8244 this.liveRegion.html( $( "<div>" ).text( label ) ); 8245 }, 100 ); 8246 } 8247 }, 8248 menuselect: function( event, ui ) { 8249 var item = ui.item.data( "ui-autocomplete-item" ), 8250 previous = this.previous; 8251 8252 // Only trigger when focus was lost (click on menu) 8253 if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { 8254 this.element.trigger( "focus" ); 8255 this.previous = previous; 8256 } 8257 8258 if ( false !== this._trigger( "select", event, { item: item } ) ) { 8259 this._value( item.value ); 8260 } 8261 8262 // reset the term after the select event 8263 // this allows custom select handling to work properly 8264 this.term = this._value(); 8265 8266 this.close( event ); 8267 this.selectedItem = item; 8268 } 8269 } ); 8270 8271 this.liveRegion = $( "<div>", { 8272 role: "status", 8273 "aria-live": "assertive", 8274 "aria-relevant": "additions" 8275 } ) 8276 .appendTo( this.document[ 0 ].body ); 8277 8278 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 8279 8280 // Turning off autocomplete prevents the browser from remembering the 8281 // value when navigating through history, so we re-enable autocomplete 8282 // if the page is unloaded before the widget is destroyed. #7790 8283 this._on( this.window, { 8284 beforeunload: function() { 8285 this.element.removeAttr( "autocomplete" ); 8286 } 8287 } ); 8288 }, 8289 8290 _destroy: function() { 8291 clearTimeout( this.searching ); 8292 this.element.removeAttr( "autocomplete" ); 8293 this.menu.element.remove(); 8294 this.liveRegion.remove(); 8295 }, 8296 8297 _setOption: function( key, value ) { 8298 this._super( key, value ); 8299 if ( key === "source" ) { 8300 this._initSource(); 8301 } 8302 if ( key === "appendTo" ) { 8303 this.menu.element.appendTo( this._appendTo() ); 8304 } 8305 if ( key === "disabled" && value && this.xhr ) { 8306 this.xhr.abort(); 8307 } 8308 }, 8309 8310 _isEventTargetInWidget: function( event ) { 8311 var menuElement = this.menu.element[ 0 ]; 8312 8313 return event.target === this.element[ 0 ] || 8314 event.target === menuElement || 8315 $.contains( menuElement, event.target ); 8316 }, 8317 8318 _closeOnClickOutside: function( event ) { 8319 if ( !this._isEventTargetInWidget( event ) ) { 8320 this.close(); 8321 } 8322 }, 8323 8324 _appendTo: function() { 8325 var element = this.options.appendTo; 8326 8327 if ( element ) { 8328 element = element.jquery || element.nodeType ? 8329 $( element ) : 8330 this.document.find( element ).eq( 0 ); 8331 } 8332 8333 if ( !element || !element[ 0 ] ) { 8334 element = this.element.closest( ".ui-front, dialog" ); 8335 } 8336 8337 if ( !element.length ) { 8338 element = this.document[ 0 ].body; 8339 } 8340 8341 return element; 8342 }, 8343 8344 _initSource: function() { 8345 var array, url, 8346 that = this; 8347 if ( Array.isArray( this.options.source ) ) { 8348 array = this.options.source; 8349 this.source = function( request, response ) { 8350 response( $.ui.autocomplete.filter( array, request.term ) ); 8351 }; 8352 } else if ( typeof this.options.source === "string" ) { 8353 url = this.options.source; 8354 this.source = function( request, response ) { 8355 if ( that.xhr ) { 8356 that.xhr.abort(); 8357 } 8358 that.xhr = $.ajax( { 8359 url: url, 8360 data: request, 8361 dataType: "json", 8362 success: function( data ) { 8363 response( data ); 8364 }, 8365 error: function() { 8366 response( [] ); 8367 } 8368 } ); 8369 }; 8370 } else { 8371 this.source = this.options.source; 8372 } 8373 }, 8374 8375 _searchTimeout: function( event ) { 8376 clearTimeout( this.searching ); 8377 this.searching = this._delay( function() { 8378 8379 // Search if the value has changed, or if the user retypes the same value (see #7434) 8380 var equalValues = this.term === this._value(), 8381 menuVisible = this.menu.element.is( ":visible" ), 8382 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 8383 8384 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 8385 this.selectedItem = null; 8386 this.search( null, event ); 8387 } 8388 }, this.options.delay ); 8389 }, 8390 8391 search: function( value, event ) { 8392 value = value != null ? value : this._value(); 8393 8394 // Always save the actual value, not the one passed as an argument 8395 this.term = this._value(); 8396 8397 if ( value.length < this.options.minLength ) { 8398 return this.close( event ); 8399 } 8400 8401 if ( this._trigger( "search", event ) === false ) { 8402 return; 8403 } 8404 8405 return this._search( value ); 8406 }, 8407 8408 _search: function( value ) { 8409 this.pending++; 8410 this._addClass( "ui-autocomplete-loading" ); 8411 this.cancelSearch = false; 8412 8413 this.source( { term: value }, this._response() ); 8414 }, 8415 8416 _response: function() { 8417 var index = ++this.requestIndex; 8418 8419 return function( content ) { 8420 if ( index === this.requestIndex ) { 8421 this.__response( content ); 8422 } 8423 8424 this.pending--; 8425 if ( !this.pending ) { 8426 this._removeClass( "ui-autocomplete-loading" ); 8427 } 8428 }.bind( this ); 8429 }, 8430 8431 __response: function( content ) { 8432 if ( content ) { 8433 content = this._normalize( content ); 8434 } 8435 this._trigger( "response", null, { content: content } ); 8436 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 8437 this._suggest( content ); 8438 this._trigger( "open" ); 8439 } else { 8440 8441 // use ._close() instead of .close() so we don't cancel future searches 8442 this._close(); 8443 } 8444 }, 8445 8446 close: function( event ) { 8447 this.cancelSearch = true; 8448 this._close( event ); 8449 }, 8450 8451 _close: function( event ) { 8452 8453 // Remove the handler that closes the menu on outside clicks 8454 this._off( this.document, "mousedown" ); 8455 8456 if ( this.menu.element.is( ":visible" ) ) { 8457 this.menu.element.hide(); 8458 this.menu.blur(); 8459 this.isNewMenu = true; 8460 this._trigger( "close", event ); 8461 } 8462 }, 8463 8464 _change: function( event ) { 8465 if ( this.previous !== this._value() ) { 8466 this._trigger( "change", event, { item: this.selectedItem } ); 8467 } 8468 }, 8469 8470 _normalize: function( items ) { 8471 8472 // assume all items have the right format when the first item is complete 8473 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 8474 return items; 8475 } 8476 return $.map( items, function( item ) { 8477 if ( typeof item === "string" ) { 8478 return { 8479 label: item, 8480 value: item 8481 }; 8482 } 8483 return $.extend( {}, item, { 8484 label: item.label || item.value, 8485 value: item.value || item.label 8486 } ); 8487 } ); 8488 }, 8489 8490 _suggest: function( items ) { 8491 var ul = this.menu.element.empty(); 8492 this._renderMenu( ul, items ); 8493 this.isNewMenu = true; 8494 this.menu.refresh(); 8495 8496 // Size and position menu 8497 ul.show(); 8498 this._resizeMenu(); 8499 ul.position( $.extend( { 8500 of: this.element 8501 }, this.options.position ) ); 8502 8503 if ( this.options.autoFocus ) { 8504 this.menu.next(); 8505 } 8506 8507 // Listen for interactions outside of the widget (#6642) 8508 this._on( this.document, { 8509 mousedown: "_closeOnClickOutside" 8510 } ); 8511 }, 8512 8513 _resizeMenu: function() { 8514 var ul = this.menu.element; 8515 ul.outerWidth( Math.max( 8516 8517 // Firefox wraps long text (possibly a rounding bug) 8518 // so we add 1px to avoid the wrapping (#7513) 8519 ul.width( "" ).outerWidth() + 1, 8520 this.element.outerWidth() 8521 ) ); 8522 }, 8523 8524 _renderMenu: function( ul, items ) { 8525 var that = this; 8526 $.each( items, function( index, item ) { 8527 that._renderItemData( ul, item ); 8528 } ); 8529 }, 8530 8531 _renderItemData: function( ul, item ) { 8532 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 8533 }, 8534 8535 _renderItem: function( ul, item ) { 8536 return $( "<li>" ) 8537 .append( $( "<div>" ).text( item.label ) ) 8538 .appendTo( ul ); 8539 }, 8540 8541 _move: function( direction, event ) { 8542 if ( !this.menu.element.is( ":visible" ) ) { 8543 this.search( null, event ); 8544 return; 8545 } 8546 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 8547 this.menu.isLastItem() && /^next/.test( direction ) ) { 8548 8549 if ( !this.isMultiLine ) { 8550 this._value( this.term ); 8551 } 8552 8553 this.menu.blur(); 8554 return; 8555 } 8556 this.menu[ direction ]( event ); 8557 }, 8558 8559 widget: function() { 8560 return this.menu.element; 8561 }, 8562 8563 _value: function() { 8564 return this.valueMethod.apply( this.element, arguments ); 8565 }, 8566 8567 _keyEvent: function( keyEvent, event ) { 8568 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 8569 this._move( keyEvent, event ); 8570 8571 // Prevents moving cursor to beginning/end of the text field in some browsers 8572 event.preventDefault(); 8573 } 8574 } 8575} ); 8576 8577$.extend( $.ui.autocomplete, { 8578 escapeRegex: function( value ) { 8579 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 8580 }, 8581 filter: function( array, term ) { 8582 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 8583 return $.grep( array, function( value ) { 8584 return matcher.test( value.label || value.value || value ); 8585 } ); 8586 } 8587} ); 8588 8589// Live region extension, adding a `messages` option 8590// NOTE: This is an experimental API. We are still investigating 8591// a full solution for string manipulation and internationalization. 8592$.widget( "ui.autocomplete", $.ui.autocomplete, { 8593 options: { 8594 messages: { 8595 noResults: "No search results.", 8596 results: function( amount ) { 8597 return amount + ( amount > 1 ? " results are" : " result is" ) + 8598 " available, use up and down arrow keys to navigate."; 8599 } 8600 } 8601 }, 8602 8603 __response: function( content ) { 8604 var message; 8605 this._superApply( arguments ); 8606 if ( this.options.disabled || this.cancelSearch ) { 8607 return; 8608 } 8609 if ( content && content.length ) { 8610 message = this.options.messages.results( content.length ); 8611 } else { 8612 message = this.options.messages.noResults; 8613 } 8614 clearTimeout( this.liveRegionTimer ); 8615 this.liveRegionTimer = this._delay( function() { 8616 this.liveRegion.html( $( "<div>" ).text( message ) ); 8617 }, 100 ); 8618 } 8619} ); 8620 8621var widgetsAutocomplete = $.ui.autocomplete; 8622 8623 8624/*! 8625 * jQuery UI Controlgroup 1.14.
86250 8626 * https://jqueryui.com 8627 * 8628 * Copyright OpenJS Foundation and other contributors 8629 * Released under the MIT license. 8630 * https://jquery.org/license 8631 */ 8632 8633//>>label: Controlgroup 8634//>>group: Widgets 8635//>>description: Visually groups form control widgets 8636//>>docs: https://api.jqueryui.com/controlgroup/ 8637//>>demos: https://jqueryui.com/controlgroup/ 8638//>>css.structure: ../../themes/base/core.css 8639//>>css.structure: ../../themes/base/controlgroup.css 8640//>>css.theme: ../../themes/base/theme.css 8641 8642 8643var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 8644 8645var widgetsControlgroup = $.widget( "ui.controlgroup", { 8646 version: "1.14.0
vendor: 7,736 bytes, lines 8646-8910
8646", 8647 defaultElement: "<div>", 8648 options: { 8649 direction: "horizontal", 8650 disabled: null, 8651 onlyVisible: true, 8652 items: { 8653 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 8654 "controlgroupLabel": ".ui-controlgroup-label", 8655 "checkboxradio": "input[type='checkbox'], input[type='radio']", 8656 "selectmenu": "select", 8657 "spinner": ".ui-spinner-input" 8658 } 8659 }, 8660 8661 _create: function() { 8662 this._enhance(); 8663 }, 8664 8665 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 8666 _enhance: function() { 8667 this.element.attr( "role", "toolbar" ); 8668 this.refresh(); 8669 }, 8670 8671 _destroy: function() { 8672 this._callChildMethod( "destroy" ); 8673 this.childWidgets.removeData( "ui-controlgroup-data" ); 8674 this.element.removeAttr( "role" ); 8675 if ( this.options.items.controlgroupLabel ) { 8676 this.element 8677 .find( this.options.items.controlgroupLabel ) 8678 .find( ".ui-controlgroup-label-contents" ) 8679 .contents().unwrap(); 8680 } 8681 }, 8682 8683 _initWidgets: function() { 8684 var that = this, 8685 childWidgets = []; 8686 8687 // First we iterate over each of the items options 8688 $.each( this.options.items, function( widget, selector ) { 8689 var labels; 8690 var options = {}; 8691 8692 // Make sure the widget has a selector set 8693 if ( !selector ) { 8694 return; 8695 } 8696 8697 if ( widget === "controlgroupLabel" ) { 8698 labels = that.element.find( selector ); 8699 labels.each( function() { 8700 var element = $( this ); 8701 8702 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 8703 return; 8704 } 8705 element.contents() 8706 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 8707 } ); 8708 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 8709 childWidgets = childWidgets.concat( labels.get() ); 8710 return; 8711 } 8712 8713 // Make sure the widget actually exists 8714 if ( !$.fn[ widget ] ) { 8715 return; 8716 } 8717 8718 // We assume everything is in the middle to start because we can't determine 8719 // first / last elements until all enhancments are done. 8720 if ( that[ "_" + widget + "Options" ] ) { 8721 options = that[ "_" + widget + "Options" ]( "middle" ); 8722 } else { 8723 options = { classes: {} }; 8724 } 8725 8726 // Find instances of this widget inside controlgroup and init them 8727 that.element 8728 .find( selector ) 8729 .each( function() { 8730 var element = $( this ); 8731 var instance = element[ widget ]( "instance" ); 8732 8733 // We need to clone the default options for this type of widget to avoid 8734 // polluting the variable options which has a wider scope than a single widget. 8735 var instanceOptions = $.widget.extend( {}, options ); 8736 8737 // If the button is the child of a spinner ignore it 8738 // TODO: Find a more generic solution 8739 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 8740 return; 8741 } 8742 8743 // Create the widget if it doesn't exist 8744 if ( !instance ) { 8745 instance = element[ widget ]()[ widget ]( "instance" ); 8746 } 8747 if ( instance ) { 8748 instanceOptions.classes = 8749 that._resolveClassesValues( instanceOptions.classes, instance ); 8750 } 8751 element[ widget ]( instanceOptions ); 8752 8753 // Store an instance of the controlgroup to be able to reference 8754 // from the outermost element for changing options and refresh 8755 var widgetElement = element[ widget ]( "widget" ); 8756 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 8757 instance ? instance : element[ widget ]( "instance" ) ); 8758 8759 childWidgets.push( widgetElement[ 0 ] ); 8760 } ); 8761 } ); 8762 8763 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 8764 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 8765 }, 8766 8767 _callChildMethod: function( method ) { 8768 this.childWidgets.each( function() { 8769 var element = $( this ), 8770 data = element.data( "ui-controlgroup-data" ); 8771 if ( data && data[ method ] ) { 8772 data[ method ](); 8773 } 8774 } ); 8775 }, 8776 8777 _updateCornerClass: function( element, position ) { 8778 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 8779 var add = this._buildSimpleOptions( position, "label" ).classes.label; 8780 8781 this._removeClass( element, null, remove ); 8782 this._addClass( element, null, add ); 8783 }, 8784 8785 _buildSimpleOptions: function( position, key ) { 8786 var direction = this.options.direction === "vertical"; 8787 var result = { 8788 classes: {} 8789 }; 8790 result.classes[ key ] = { 8791 "middle": "", 8792 "first": "ui-corner-" + ( direction ? "top" : "left" ), 8793 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 8794 "only": "ui-corner-all" 8795 }[ position ]; 8796 8797 return result; 8798 }, 8799 8800 _spinnerOptions: function( position ) { 8801 var options = this._buildSimpleOptions( position, "ui-spinner" ); 8802 8803 options.classes[ "ui-spinner-up" ] = ""; 8804 options.classes[ "ui-spinner-down" ] = ""; 8805 8806 return options; 8807 }, 8808 8809 _buttonOptions: function( position ) { 8810 return this._buildSimpleOptions( position, "ui-button" ); 8811 }, 8812 8813 _checkboxradioOptions: function( position ) { 8814 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 8815 }, 8816 8817 _selectmenuOptions: function( position ) { 8818 var direction = this.options.direction === "vertical"; 8819 return { 8820 width: direction ? "auto" : false, 8821 classes: { 8822 middle: { 8823 "ui-selectmenu-button-open": "", 8824 "ui-selectmenu-button-closed": "" 8825 }, 8826 first: { 8827 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 8828 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 8829 }, 8830 last: { 8831 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 8832 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 8833 }, 8834 only: { 8835 "ui-selectmenu-button-open": "ui-corner-top", 8836 "ui-selectmenu-button-closed": "ui-corner-all" 8837 } 8838 8839 }[ position ] 8840 }; 8841 }, 8842 8843 _resolveClassesValues: function( classes, instance ) { 8844 var result = {}; 8845 $.each( classes, function( key ) { 8846 var current = instance.options.classes[ key ] || ""; 8847 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 8848 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 8849 } ); 8850 return result; 8851 }, 8852 8853 _setOption: function( key, value ) { 8854 if ( key === "direction" ) { 8855 this._removeClass( "ui-controlgroup-" + this.options.direction ); 8856 } 8857 8858 this._super( key, value ); 8859 if ( key === "disabled" ) { 8860 this._callChildMethod( value ? "disable" : "enable" ); 8861 return; 8862 } 8863 8864 this.refresh(); 8865 }, 8866 8867 refresh: function() { 8868 var children, 8869 that = this; 8870 8871 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 8872 8873 if ( this.options.direction === "horizontal" ) { 8874 this._addClass( null, "ui-helper-clearfix" ); 8875 } 8876 this._initWidgets(); 8877 8878 children = this.childWidgets; 8879 8880 // We filter here because we need to track all childWidgets not just the visible ones 8881 if ( this.options.onlyVisible ) { 8882 children = children.filter( ":visible" ); 8883 } 8884 8885 if ( children.length ) { 8886 8887 // We do this last because we need to make sure all enhancment is done 8888 // before determining first and last 8889 $.each( [ "first", "last" ], function( index, value ) { 8890 var instance = children[ value ]().data( "ui-controlgroup-data" ); 8891 8892 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 8893 var options = that[ "_" + instance.widgetName + "Options" ]( 8894 children.length === 1 ? "only" : value 8895 ); 8896 options.classes = that._resolveClassesValues( options.classes, instance ); 8897 instance.element[ instance.widgetName ]( options ); 8898 } else { 8899 that._updateCornerClass( children[ value ](), value ); 8900 } 8901 } ); 8902 8903 // Finally call the refresh method on each of the child widgets. 8904 this._callChildMethod( "refresh" ); 8905 } 8906 } 8907} ); 8908 8909/*! 8910 * jQuery UI Checkboxradio 1.14.
vendor: 7,789 bytes, lines 8910-9200
89100 8911 * https://jqueryui.com 8912 * 8913 * Copyright OpenJS Foundation and other contributors 8914 * Released under the MIT license. 8915 * https://jquery.org/license 8916 */ 8917 8918//>>label: Checkboxradio 8919//>>group: Widgets 8920//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 8921//>>docs: https://api.jqueryui.com/checkboxradio/ 8922//>>demos: https://jqueryui.com/checkboxradio/ 8923//>>css.structure: ../../themes/base/core.css 8924//>>css.structure: ../../themes/base/button.css 8925//>>css.structure: ../../themes/base/checkboxradio.css 8926//>>css.theme: ../../themes/base/theme.css 8927 8928 8929$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 8930 version: "1.14.0", 8931 options: { 8932 disabled: null, 8933 label: null, 8934 icon: true, 8935 classes: { 8936 "ui-checkboxradio-label": "ui-corner-all", 8937 "ui-checkboxradio-icon": "ui-corner-all" 8938 } 8939 }, 8940 8941 _getCreateOptions: function() { 8942 var disabled, labels, labelContents; 8943 var options = this._super() || {}; 8944 8945 // We read the type here, because it makes more sense to throw a element type error first, 8946 // rather then the error for lack of a label. Often if its the wrong type, it 8947 // won't have a label (e.g. calling on a div, btn, etc) 8948 this._readType(); 8949 8950 labels = this.element.labels(); 8951 8952 // If there are multiple labels, use the last one 8953 this.label = $( labels[ labels.length - 1 ] ); 8954 if ( !this.label.length ) { 8955 $.error( "No label found for checkboxradio widget" ); 8956 } 8957 8958 this.originalLabel = ""; 8959 8960 // We need to get the label text but this may also need to make sure it does not contain the 8961 // input itself. 8962 // The label contents could be text, html, or a mix. We wrap all elements 8963 // and read the wrapper's `innerHTML` to get a string representation of 8964 // the label, without the input as part of it. 8965 labelContents = this.label.contents().not( this.element[ 0 ] ); 8966 8967 if ( labelContents.length ) { 8968 this.originalLabel += labelContents 8969 .clone() 8970 .wrapAll( "<div></div>" ) 8971 .parent() 8972 .html(); 8973 } 8974 8975 // Set the label option if we found label text 8976 if ( this.originalLabel ) { 8977 options.label = this.originalLabel; 8978 } 8979 8980 disabled = this.element[ 0 ].disabled; 8981 if ( disabled != null ) { 8982 options.disabled = disabled; 8983 } 8984 return options; 8985 }, 8986 8987 _create: function() { 8988 var checked = this.element[ 0 ].checked; 8989 8990 this._bindFormResetHandler(); 8991 8992 if ( this.options.disabled == null ) { 8993 this.options.disabled = this.element[ 0 ].disabled; 8994 } 8995 8996 this._setOption( "disabled", this.options.disabled ); 8997 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 8998 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 8999 9000 if ( this.type === "radio" ) { 9001 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 9002 } 9003 9004 if ( this.options.label && this.options.label !== this.originalLabel ) { 9005 this._updateLabel(); 9006 } else if ( this.originalLabel ) { 9007 this.options.label = this.originalLabel; 9008 } 9009 9010 this._enhance(); 9011 9012 if ( checked ) { 9013 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 9014 } 9015 9016 this._on( { 9017 change: "_toggleClasses", 9018 focus: function() { 9019 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 9020 }, 9021 blur: function() { 9022 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 9023 } 9024 } ); 9025 }, 9026 9027 _readType: function() { 9028 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 9029 this.type = this.element[ 0 ].type; 9030 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 9031 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 9032 " and element.type=" + this.type ); 9033 } 9034 }, 9035 9036 // Support jQuery Mobile enhanced option 9037 _enhance: function() { 9038 this._updateIcon( this.element[ 0 ].checked ); 9039 }, 9040 9041 widget: function() { 9042 return this.label; 9043 }, 9044 9045 _getRadioGroup: function() { 9046 var group; 9047 var name = this.element[ 0 ].name; 9048 var nameSelector = "input[name='" + CSS.escape( name ) + "']"; 9049 9050 if ( !name ) { 9051 return $( [] ); 9052 } 9053 9054 if ( this.form.length ) { 9055 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 9056 } else { 9057 9058 // Not inside a form, check all inputs that also are not inside a form 9059 group = $( nameSelector ).filter( function() { 9060 return $( $( this ).prop( "form" ) ).length === 0; 9061 } ); 9062 } 9063 9064 return group.not( this.element ); 9065 }, 9066 9067 _toggleClasses: function() { 9068 var checked = this.element[ 0 ].checked; 9069 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 9070 9071 if ( this.options.icon && this.type === "checkbox" ) { 9072 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 9073 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 9074 } 9075 9076 if ( this.type === "radio" ) { 9077 this._getRadioGroup() 9078 .each( function() { 9079 var instance = $( this ).checkboxradio( "instance" ); 9080 9081 if ( instance ) { 9082 instance._removeClass( instance.label, 9083 "ui-checkboxradio-checked", "ui-state-active" ); 9084 } 9085 } ); 9086 } 9087 }, 9088 9089 _destroy: function() { 9090 this._unbindFormResetHandler(); 9091 9092 if ( this.icon ) { 9093 this.icon.remove(); 9094 this.iconSpace.remove(); 9095 } 9096 }, 9097 9098 _setOption: function( key, value ) { 9099 9100 // We don't allow the value to be set to nothing 9101 if ( key === "label" && !value ) { 9102 return; 9103 } 9104 9105 this._super( key, value ); 9106 9107 if ( key === "disabled" ) { 9108 this._toggleClass( this.label, null, "ui-state-disabled", value ); 9109 this.element[ 0 ].disabled = value; 9110 9111 // Don't refresh when setting disabled 9112 return; 9113 } 9114 this.refresh(); 9115 }, 9116 9117 _updateIcon: function( checked ) { 9118 var toAdd = "ui-icon ui-icon-background "; 9119 9120 if ( this.options.icon ) { 9121 if ( !this.icon ) { 9122 this.icon = $( "<span>" ); 9123 this.iconSpace = $( "<span> </span>" ); 9124 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 9125 } 9126 9127 if ( this.type === "checkbox" ) { 9128 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 9129 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 9130 } else { 9131 toAdd += "ui-icon-blank"; 9132 } 9133 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 9134 if ( !checked ) { 9135 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 9136 } 9137 this.icon.prependTo( this.label ).after( this.iconSpace ); 9138 } else if ( this.icon !== undefined ) { 9139 this.icon.remove(); 9140 this.iconSpace.remove(); 9141 delete this.icon; 9142 } 9143 }, 9144 9145 _updateLabel: function() { 9146 9147 // Remove the contents of the label ( minus the icon, icon space, and input ) 9148 var contents = this.label.contents().not( this.element[ 0 ] ); 9149 if ( this.icon ) { 9150 contents = contents.not( this.icon[ 0 ] ); 9151 } 9152 if ( this.iconSpace ) { 9153 contents = contents.not( this.iconSpace[ 0 ] ); 9154 } 9155 contents.remove(); 9156 9157 this.label.append( this.options.label ); 9158 }, 9159 9160 refresh: function() { 9161 var checked = this.element[ 0 ].checked, 9162 isDisabled = this.element[ 0 ].disabled; 9163 9164 this._updateIcon( checked ); 9165 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 9166 if ( this.options.label !== null ) { 9167 this._updateLabel(); 9168 } 9169 9170 if ( isDisabled !== this.options.disabled ) { 9171 this._setOptions( { "disabled": isDisabled } ); 9172 } 9173 } 9174 9175} ] ); 9176 9177var widgetsCheckboxradio = $.ui.checkboxradio; 9178 9179 9180/*! 9181 * jQuery UI Button 1.14.0 9182 * https://jqueryui.com 9183 * 9184 * Copyright OpenJS Foundation and other contributors 9185 * Released under the MIT license. 9186 * https://jquery.org/license 9187 */ 9188 9189//>>label: Button 9190//>>group: Widgets 9191//>>description: Enhances a form with themeable buttons. 9192//>>docs: https://api.jqueryui.com/button/ 9193//>>demos: https://jqueryui.com/button/ 9194//>>css.structure: ../../themes/base/core.css 9195//>>css.structure: ../../themes/base/button.css 9196//>>css.theme: ../../themes/base/theme.css 9197 9198 9199$.widget( "ui.button", { 9200 version: "1.14.0
vendor: 10,754 bytes, lines 9200-9605
9200", 9201 defaultElement: "<button>", 9202 options: { 9203 classes: { 9204 "ui-button": "ui-corner-all" 9205 }, 9206 disabled: null, 9207 icon: null, 9208 iconPosition: "beginning", 9209 label: null, 9210 showLabel: true 9211 }, 9212 9213 _getCreateOptions: function() { 9214 var disabled, 9215 9216 // This is to support cases like in jQuery Mobile where the base widget does have 9217 // an implementation of _getCreateOptions 9218 options = this._super() || {}; 9219 9220 this.isInput = this.element.is( "input" ); 9221 9222 disabled = this.element[ 0 ].disabled; 9223 if ( disabled != null ) { 9224 options.disabled = disabled; 9225 } 9226 9227 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 9228 if ( this.originalLabel ) { 9229 options.label = this.originalLabel; 9230 } 9231 9232 return options; 9233 }, 9234 9235 _create: function() { 9236 if ( !this.option.showLabel & !this.options.icon ) { 9237 this.options.showLabel = true; 9238 } 9239 9240 // We have to check the option again here even though we did in _getCreateOptions, 9241 // because null may have been passed on init which would override what was set in 9242 // _getCreateOptions 9243 if ( this.options.disabled == null ) { 9244 this.options.disabled = this.element[ 0 ].disabled || false; 9245 } 9246 9247 this.hasTitle = !!this.element.attr( "title" ); 9248 9249 // Check to see if the label needs to be set or if its already correct 9250 if ( this.options.label && this.options.label !== this.originalLabel ) { 9251 if ( this.isInput ) { 9252 this.element.val( this.options.label ); 9253 } else { 9254 this.element.html( this.options.label ); 9255 } 9256 } 9257 this._addClass( "ui-button", "ui-widget" ); 9258 this._setOption( "disabled", this.options.disabled ); 9259 this._enhance(); 9260 9261 if ( this.element.is( "a" ) ) { 9262 this._on( { 9263 "keyup": function( event ) { 9264 if ( event.keyCode === $.ui.keyCode.SPACE ) { 9265 event.preventDefault(); 9266 9267 // If a native click is available use it, so we 9268 // actually cause navigation. Otherwise, just trigger 9269 // a click event. 9270 if ( this.element[ 0 ].click ) { 9271 this.element[ 0 ].click(); 9272 } else { 9273 this.element.trigger( "click" ); 9274 } 9275 } 9276 } 9277 } ); 9278 } 9279 }, 9280 9281 _enhance: function() { 9282 if ( !this.element.is( "button" ) ) { 9283 this.element.attr( "role", "button" ); 9284 } 9285 9286 if ( this.options.icon ) { 9287 this._updateIcon( "icon", this.options.icon ); 9288 this._updateTooltip(); 9289 } 9290 }, 9291 9292 _updateTooltip: function() { 9293 this.title = this.element.attr( "title" ); 9294 9295 if ( !this.options.showLabel && !this.title ) { 9296 this.element.attr( "title", this.options.label ); 9297 } 9298 }, 9299 9300 _updateIcon: function( option, value ) { 9301 var icon = option !== "iconPosition", 9302 position = icon ? this.options.iconPosition : value, 9303 displayBlock = position === "top" || position === "bottom"; 9304 9305 // Create icon 9306 if ( !this.icon ) { 9307 this.icon = $( "<span>" ); 9308 9309 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 9310 9311 if ( !this.options.showLabel ) { 9312 this._addClass( "ui-button-icon-only" ); 9313 } 9314 } else if ( icon ) { 9315 9316 // If we are updating the icon remove the old icon class 9317 this._removeClass( this.icon, null, this.options.icon ); 9318 } 9319 9320 // If we are updating the icon add the new icon class 9321 if ( icon ) { 9322 this._addClass( this.icon, null, value ); 9323 } 9324 9325 this._attachIcon( position ); 9326 9327 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 9328 // the iconSpace if there is one. 9329 if ( displayBlock ) { 9330 this._addClass( this.icon, null, "ui-widget-icon-block" ); 9331 if ( this.iconSpace ) { 9332 this.iconSpace.remove(); 9333 } 9334 } else { 9335 9336 // Position is beginning or end so remove the ui-widget-icon-block class and add the 9337 // space if it does not exist 9338 if ( !this.iconSpace ) { 9339 this.iconSpace = $( "<span> </span>" ); 9340 this._addClass( this.iconSpace, "ui-button-icon-space" ); 9341 } 9342 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 9343 this._attachIconSpace( position ); 9344 } 9345 }, 9346 9347 _destroy: function() { 9348 this.element.removeAttr( "role" ); 9349 9350 if ( this.icon ) { 9351 this.icon.remove(); 9352 } 9353 if ( this.iconSpace ) { 9354 this.iconSpace.remove(); 9355 } 9356 if ( !this.hasTitle ) { 9357 this.element.removeAttr( "title" ); 9358 } 9359 }, 9360 9361 _attachIconSpace: function( iconPosition ) { 9362 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 9363 }, 9364 9365 _attachIcon: function( iconPosition ) { 9366 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 9367 }, 9368 9369 _setOptions: function( options ) { 9370 var newShowLabel = options.showLabel === undefined ? 9371 this.options.showLabel : 9372 options.showLabel, 9373 newIcon = options.icon === undefined ? this.options.icon : options.icon; 9374 9375 if ( !newShowLabel && !newIcon ) { 9376 options.showLabel = true; 9377 } 9378 this._super( options ); 9379 }, 9380 9381 _setOption: function( key, value ) { 9382 if ( key === "icon" ) { 9383 if ( value ) { 9384 this._updateIcon( key, value ); 9385 } else if ( this.icon ) { 9386 this.icon.remove(); 9387 if ( this.iconSpace ) { 9388 this.iconSpace.remove(); 9389 } 9390 } 9391 } 9392 9393 if ( key === "iconPosition" ) { 9394 this._updateIcon( key, value ); 9395 } 9396 9397 // Make sure we can't end up with a button that has neither text nor icon 9398 if ( key === "showLabel" ) { 9399 this._toggleClass( "ui-button-icon-only", null, !value ); 9400 this._updateTooltip(); 9401 } 9402 9403 if ( key === "label" ) { 9404 if ( this.isInput ) { 9405 this.element.val( value ); 9406 } else { 9407 9408 // If there is an icon, append it, else nothing then append the value 9409 // this avoids removal of the icon when setting label text 9410 this.element.html( value ); 9411 if ( this.icon ) { 9412 this._attachIcon( this.options.iconPosition ); 9413 this._attachIconSpace( this.options.iconPosition ); 9414 } 9415 } 9416 } 9417 9418 this._super( key, value ); 9419 9420 if ( key === "disabled" ) { 9421 this._toggleClass( null, "ui-state-disabled", value ); 9422 this.element[ 0 ].disabled = value; 9423 if ( value ) { 9424 this.element.trigger( "blur" ); 9425 } 9426 } 9427 }, 9428 9429 refresh: function() { 9430 9431 // Make sure to only check disabled if its an element that supports this otherwise 9432 // check for the disabled class to determine state 9433 var isDisabled = this.element.is( "input, button" ) ? 9434 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 9435 9436 if ( isDisabled !== this.options.disabled ) { 9437 this._setOptions( { disabled: isDisabled } ); 9438 } 9439 9440 this._updateTooltip(); 9441 } 9442} ); 9443 9444// DEPRECATED 9445if ( $.uiBackCompat === true ) { 9446 9447 // Text and Icons options 9448 $.widget( "ui.button", $.ui.button, { 9449 options: { 9450 text: true, 9451 icons: { 9452 primary: null, 9453 secondary: null 9454 } 9455 }, 9456 9457 _create: function() { 9458 if ( this.options.showLabel && !this.options.text ) { 9459 this.options.showLabel = this.options.text; 9460 } 9461 if ( !this.options.showLabel && this.options.text ) { 9462 this.options.text = this.options.showLabel; 9463 } 9464 if ( !this.options.icon && ( this.options.icons.primary || 9465 this.options.icons.secondary ) ) { 9466 if ( this.options.icons.primary ) { 9467 this.options.icon = this.options.icons.primary; 9468 } else { 9469 this.options.icon = this.options.icons.secondary; 9470 this.options.iconPosition = "end"; 9471 } 9472 } else if ( this.options.icon ) { 9473 this.options.icons.primary = this.options.icon; 9474 } 9475 this._super(); 9476 }, 9477 9478 _setOption: function( key, value ) { 9479 if ( key === "text" ) { 9480 this._super( "showLabel", value ); 9481 return; 9482 } 9483 if ( key === "showLabel" ) { 9484 this.options.text = value; 9485 } 9486 if ( key === "icon" ) { 9487 this.options.icons.primary = value; 9488 } 9489 if ( key === "icons" ) { 9490 if ( value.primary ) { 9491 this._super( "icon", value.primary ); 9492 this._super( "iconPosition", "beginning" ); 9493 } else if ( value.secondary ) { 9494 this._super( "icon", value.secondary ); 9495 this._super( "iconPosition", "end" ); 9496 } 9497 } 9498 this._superApply( arguments ); 9499 } 9500 } ); 9501 9502 $.fn.button = ( function( orig ) { 9503 return function( options ) { 9504 var isMethodCall = typeof options === "string"; 9505 var args = Array.prototype.slice.call( arguments, 1 ); 9506 var returnValue = this; 9507 9508 if ( isMethodCall ) { 9509 9510 // If this is an empty collection, we need to have the instance method 9511 // return undefined instead of the jQuery instance 9512 if ( !this.length && options === "instance" ) { 9513 returnValue = undefined; 9514 } else { 9515 this.each( function() { 9516 var methodValue; 9517 var type = $( this ).attr( "type" ); 9518 var name = type !== "checkbox" && type !== "radio" ? 9519 "button" : 9520 "checkboxradio"; 9521 var instance = $.data( this, "ui-" + name ); 9522 9523 if ( options === "instance" ) { 9524 returnValue = instance; 9525 return false; 9526 } 9527 9528 if ( !instance ) { 9529 return $.error( "cannot call methods on button" + 9530 " prior to initialization; " + 9531 "attempted to call method '" + options + "'" ); 9532 } 9533 9534 if ( typeof instance[ options ] !== "function" || 9535 options.charAt( 0 ) === "_" ) { 9536 return $.error( "no such method '" + options + "' for button" + 9537 " widget instance" ); 9538 } 9539 9540 methodValue = instance[ options ].apply( instance, args ); 9541 9542 if ( methodValue !== instance && methodValue !== undefined ) { 9543 returnValue = methodValue && methodValue.jquery ? 9544 returnValue.pushStack( methodValue.get() ) : 9545 methodValue; 9546 return false; 9547 } 9548 } ); 9549 } 9550 } else { 9551 9552 // Allow multiple hashes to be passed on init 9553 if ( args.length ) { 9554 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 9555 } 9556 9557 this.each( function() { 9558 var type = $( this ).attr( "type" ); 9559 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 9560 var instance = $.data( this, "ui-" + name ); 9561 9562 if ( instance ) { 9563 instance.option( options || {} ); 9564 if ( instance._init ) { 9565 instance._init(); 9566 } 9567 } else { 9568 if ( name === "button" ) { 9569 orig.call( $( this ), options ); 9570 return; 9571 } 9572 9573 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 9574 } 9575 } ); 9576 } 9577 9578 return returnValue; 9579 }; 9580 } )( $.fn.button ); 9581 9582 $.fn.buttonset = function() { 9583 if ( !$.ui.controlgroup ) { 9584 $.error( "Controlgroup widget missing" ); 9585 } 9586 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 9587 return this.controlgroup.apply( this, 9588 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 9589 } 9590 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 9591 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 9592 } 9593 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 9594 arguments[ 0 ].items = { 9595 button: arguments[ 0 ].items 9596 }; 9597 } 9598 return this.controlgroup.apply( this, arguments ); 9599 }; 9600} 9601 9602var widgetsButton = $.ui.button; 9603 9604 9605/* eslint-disable max-len
9605, camelcase */ 9606/*! 9607 * jQuery UI Datepicker 1.14.0 9608 * https://jqueryui.com 9609 * 9610 * Copyright OpenJS Foundation and other contributors 9611 * Released under the MIT license. 9612 * https://jquery.org/license 9613 */ 9614 9615//>>label: Datepicker 9616//>>group: Widgets 9617//>>description: Displays a calendar from an input or inline for selecting dates. 9618//>>docs: https://api.jqueryui.com/datepicker/ 9619//>>demos: https://jqueryui.com/datepicker/ 9620//>>css.structure: ../../themes/base/core.css 9621//>>css.structure: ../../themes/base/datepicker.css 9622//>>css.theme: ../../themes/base/theme.css 9623 9624 9625$.extend( $.ui, { datepicker: { version: "1.14.0
vendor: 20,464 bytes, lines 9625-10124
9625" } } ); 9626 9627var datepicker_instActive; 9628 9629function datepicker_getZindex( elem ) { 9630 var position, value; 9631 while ( elem.length && elem[ 0 ] !== document ) { 9632 9633 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9634 // This makes behavior of this function consistent across browsers 9635 // WebKit always returns auto if the element is positioned 9636 position = elem.css( "position" ); 9637 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 9638 9639 // IE returns 0 when zIndex is not specified 9640 // other browsers return a string 9641 // we ignore the case of nested elements with an explicit value of 0 9642 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9643 value = parseInt( elem.css( "zIndex" ), 10 ); 9644 if ( !isNaN( value ) && value !== 0 ) { 9645 return value; 9646 } 9647 } 9648 elem = elem.parent(); 9649 } 9650 9651 return 0; 9652} 9653 9654/* Date picker manager. 9655 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 9656 Settings for (groups of) date pickers are maintained in an instance object, 9657 allowing multiple different settings on the same page. */ 9658 9659function Datepicker() { 9660 this._curInst = null; // The current instance in use 9661 this._keyEvent = false; // If the last event was a key event 9662 this._disabledInputs = []; // List of date picker inputs that have been disabled 9663 this._datepickerShowing = false; // True if the popup picker is showing , false if not 9664 this._inDialog = false; // True if showing within a "dialog", false if not 9665 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 9666 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 9667 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 9668 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 9669 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 9670 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 9671 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 9672 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 9673 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 9674 this.regional = []; // Available regional settings, indexed by language code 9675 this.regional[ "" ] = { // Default regional settings 9676 closeText: "Done", // Display text for close link 9677 prevText: "Prev", // Display text for previous month link 9678 nextText: "Next", // Display text for next month link 9679 currentText: "Today", // Display text for current month link 9680 monthNames: [ "January", "February", "March", "April", "May", "June", 9681 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 9682 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 9683 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 9684 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 9685 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 9686 weekHeader: "Wk", // Column header for week of the year 9687 dateFormat: "mm/dd/yy", // See format options on parseDate 9688 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 9689 isRTL: false, // True if right-to-left language, false if left-to-right 9690 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 9691 yearSuffix: "", // Additional text to append to the year in the month headers, 9692 selectMonthLabel: "Select month", // Invisible label for month selector 9693 selectYearLabel: "Select year" // Invisible label for year selector 9694 }; 9695 this._defaults = { // Global defaults for all the date picker instances 9696 showOn: "focus", // "focus" for popup on focus, 9697 // "button" for trigger button, or "both" for either 9698 showAnim: "fadeIn", // Name of jQuery animation for popup 9699 showOptions: {}, // Options for enhanced animations 9700 defaultDate: null, // Used when field is blank: actual date, 9701 // +/-number for offset from today, null for today 9702 appendText: "", // Display text following the input box, e.g. showing the format 9703 buttonText: "...", // Text for trigger button 9704 buttonImage: "", // URL for trigger button image 9705 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 9706 hideIfNoPrevNext: false, // True to hide next/previous month links 9707 // if not applicable, false to just disable them 9708 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 9709 gotoCurrent: false, // True if today link goes back to current selection instead 9710 changeMonth: false, // True if month can be selected directly, false if only prev/next 9711 changeYear: false, // True if year can be selected directly, false if only prev/next 9712 yearRange: "c-10:c+10", // Range of years to display in drop-down, 9713 // either relative to today's year (-nn:+nn), relative to currently displayed year 9714 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 9715 showOtherMonths: false, // True to show dates in other months, false to leave blank 9716 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 9717 showWeek: false, // True to show week of the year, false to not show it 9718 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 9719 // takes a Date and returns the number of the week for it 9720 shortYearCutoff: "+10", // Short year values < this are in the current century, 9721 // > this are in the previous century, 9722 // string value starting with "+" for current year + value 9723 minDate: null, // The earliest selectable date, or null for no limit 9724 maxDate: null, // The latest selectable date, or null for no limit 9725 duration: "fast", // Duration of display/closure 9726 beforeShowDay: null, // Function that takes a date and returns an array with 9727 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 9728 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 9729 beforeShow: null, // Function that takes an input field and 9730 // returns a set of custom settings for the date picker 9731 onSelect: null, // Define a callback function when a date is selected 9732 onChangeMonthYear: null, // Define a callback function when the month or year is changed 9733 onClose: null, // Define a callback function when the datepicker is closed 9734 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 9735 numberOfMonths: 1, // Number of months to show at a time 9736 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 9737 stepMonths: 1, // Number of months to step back/forward 9738 stepBigMonths: 12, // Number of months to step back/forward for the big links 9739 altField: "", // Selector for an alternate field to store selected dates into 9740 altFormat: "", // The date format to use for the alternate field 9741 constrainInput: true, // The input is constrained by the current date format 9742 showButtonPanel: false, // True to show button panel, false to not show it 9743 autoSize: false, // True to size the input for the date format, false to leave as is 9744 disabled: false // The initial disabled state 9745 }; 9746 $.extend( this._defaults, this.regional[ "" ] ); 9747 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 9748 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 9749 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 9750} 9751 9752$.extend( Datepicker.prototype, { 9753 9754 /* Class name added to elements to indicate already configured with a date picker. */ 9755 markerClassName: "hasDatepicker", 9756 9757 //Keep track of the maximum number of rows displayed (see #7043) 9758 maxRows: 4, 9759 9760 // TODO rename to "widget" when switching to widget factory 9761 _widgetDatepicker: function() { 9762 return this.dpDiv; 9763 }, 9764 9765 /* Override the default settings for all instances of the date picker. 9766 * @param settings object - the new settings to use as defaults (anonymous object) 9767 * @return the manager object 9768 */ 9769 setDefaults: function( settings ) { 9770 datepicker_extendRemove( this._defaults, settings || {} ); 9771 return this; 9772 }, 9773 9774 /* Attach the date picker to a jQuery selection. 9775 * @param target element - the target input field or division or span 9776 * @param settings object - the new settings to use for this date picker instance (anonymous) 9777 */ 9778 _attachDatepicker: function( target, settings ) { 9779 var nodeName, inline, inst; 9780 nodeName = target.nodeName.toLowerCase(); 9781 inline = ( nodeName === "div" || nodeName === "span" ); 9782 if ( !target.id ) { 9783 this.uuid += 1; 9784 target.id = "dp" + this.uuid; 9785 } 9786 inst = this._newInst( $( target ), inline ); 9787 inst.settings = $.extend( {}, settings || {} ); 9788 if ( nodeName === "input" ) { 9789 this._connectDatepicker( target, inst ); 9790 } else if ( inline ) { 9791 this._inlineDatepicker( target, inst ); 9792 } 9793 }, 9794 9795 /* Create a new instance object. */ 9796 _newInst: function( target, inline ) { 9797 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 9798 return { id: id, input: target, // associated target 9799 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 9800 drawMonth: 0, drawYear: 0, // month being drawn 9801 inline: inline, // is datepicker inline or not 9802 dpDiv: ( !inline ? this.dpDiv : // presentation div 9803 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 9804 }, 9805 9806 /* Attach the date picker to an input field. */ 9807 _connectDatepicker: function( target, inst ) { 9808 var input = $( target ); 9809 inst.append = $( [] ); 9810 inst.trigger = $( [] ); 9811 if ( input.hasClass( this.markerClassName ) ) { 9812 return; 9813 } 9814 this._attachments( input, inst ); 9815 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 9816 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 9817 this._autoSize( inst ); 9818 $.data( target, "datepicker", inst ); 9819 9820 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 9821 if ( inst.settings.disabled ) { 9822 this._disableDatepicker( target ); 9823 } 9824 }, 9825 9826 /* Make attachments based on settings. */ 9827 _attachments: function( input, inst ) { 9828 var showOn, buttonText, buttonImage, 9829 appendText = this._get( inst, "appendText" ), 9830 isRTL = this._get( inst, "isRTL" ); 9831 9832 if ( inst.append ) { 9833 inst.append.remove(); 9834 } 9835 if ( appendText ) { 9836 inst.append = $( "<span>" ) 9837 .addClass( this._appendClass ) 9838 .text( appendText ); 9839 input[ isRTL ? "before" : "after" ]( inst.append ); 9840 } 9841 9842 input.off( "focus", this._showDatepicker ); 9843 9844 if ( inst.trigger ) { 9845 inst.trigger.remove(); 9846 } 9847 9848 showOn = this._get( inst, "showOn" ); 9849 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 9850 input.on( "focus", this._showDatepicker ); 9851 } 9852 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 9853 buttonText = this._get( inst, "buttonText" ); 9854 buttonImage = this._get( inst, "buttonImage" ); 9855 9856 if ( this._get( inst, "buttonImageOnly" ) ) { 9857 inst.trigger = $( "<img>" ) 9858 .addClass( this._triggerClass ) 9859 .attr( { 9860 src: buttonImage, 9861 alt: buttonText, 9862 title: buttonText 9863 } ); 9864 } else { 9865 inst.trigger = $( "<button type='button'>" ) 9866 .addClass( this._triggerClass ); 9867 if ( buttonImage ) { 9868 inst.trigger.html( 9869 $( "<img>" ) 9870 .attr( { 9871 src: buttonImage, 9872 alt: buttonText, 9873 title: buttonText 9874 } ) 9875 ); 9876 } else { 9877 inst.trigger.text( buttonText ); 9878 } 9879 } 9880 9881 input[ isRTL ? "before" : "after" ]( inst.trigger ); 9882 inst.trigger.on( "click", function() { 9883 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 9884 $.datepicker._hideDatepicker(); 9885 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 9886 $.datepicker._hideDatepicker(); 9887 $.datepicker._showDatepicker( input[ 0 ] ); 9888 } else { 9889 $.datepicker._showDatepicker( input[ 0 ] ); 9890 } 9891 return false; 9892 } ); 9893 } 9894 }, 9895 9896 /* Apply the maximum length for the date format. */ 9897 _autoSize: function( inst ) { 9898 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 9899 var findMax, max, maxI, i, 9900 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 9901 dateFormat = this._get( inst, "dateFormat" ); 9902 9903 if ( dateFormat.match( /[DM]/ ) ) { 9904 findMax = function( names ) { 9905 max = 0; 9906 maxI = 0; 9907 for ( i = 0; i < names.length; i++ ) { 9908 if ( names[ i ].length > max ) { 9909 max = names[ i ].length; 9910 maxI = i; 9911 } 9912 } 9913 return maxI; 9914 }; 9915 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 9916 "monthNames" : "monthNamesShort" ) ) ) ); 9917 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 9918 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 9919 } 9920 inst.input.attr( "size", this._formatDate( inst, date ).length ); 9921 } 9922 }, 9923 9924 /* Attach an inline date picker to a div. */ 9925 _inlineDatepicker: function( target, inst ) { 9926 var divSpan = $( target ); 9927 if ( divSpan.hasClass( this.markerClassName ) ) { 9928 return; 9929 } 9930 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 9931 $.data( target, "datepicker", inst ); 9932 this._setDate( inst, this._getDefaultDate( inst ), true ); 9933 this._updateDatepicker( inst ); 9934 this._updateAlternate( inst ); 9935 9936 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 9937 if ( inst.settings.disabled ) { 9938 this._disableDatepicker( target ); 9939 } 9940 9941 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 9942 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 9943 inst.dpDiv.css( "display", "block" ); 9944 }, 9945 9946 /* Pop-up the date picker in a "dialog" box. 9947 * @param input element - ignored 9948 * @param date string or Date - the initial date to display 9949 * @param onSelect function - the function to call when a date is selected 9950 * @param settings object - update the dialog date picker instance's settings (anonymous object) 9951 * @param pos int[2] - coordinates for the dialog's position within the screen or 9952 * event - with x/y coordinates or 9953 * leave empty for default (screen centre) 9954 * @return the manager object 9955 */ 9956 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 9957 var id, browserWidth, browserHeight, scrollX, scrollY, 9958 inst = this._dialogInst; // internal instance 9959 9960 if ( !inst ) { 9961 this.uuid += 1; 9962 id = "dp" + this.uuid; 9963 this._dialogInput = $( "<input type='text' id='" + id + 9964 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 9965 this._dialogInput.on( "keydown", this._doKeyDown ); 9966 $( "body" ).append( this._dialogInput ); 9967 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 9968 inst.settings = {}; 9969 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 9970 } 9971 datepicker_extendRemove( inst.settings, settings || {} ); 9972 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 9973 this._dialogInput.val( date ); 9974 9975 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 9976 if ( !this._pos ) { 9977 browserWidth = document.documentElement.clientWidth; 9978 browserHeight = document.documentElement.clientHeight; 9979 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 9980 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 9981 this._pos = // should use actual width/height below 9982 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 9983 } 9984 9985 // Move input on screen for focus, but hidden behind dialog 9986 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 9987 inst.settings.onSelect = onSelect; 9988 this._inDialog = true; 9989 this.dpDiv.addClass( this._dialogClass ); 9990 this._showDatepicker( this._dialogInput[ 0 ] ); 9991 if ( $.blockUI ) { 9992 $.blockUI( this.dpDiv ); 9993 } 9994 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 9995 return this; 9996 }, 9997 9998 /* Detach a datepicker from its control. 9999 * @param target element - the target input field or division or span 10000 */ 10001 _destroyDatepicker: function( target ) { 10002 var nodeName, 10003 $target = $( target ), 10004 inst = $.data( target, "datepicker" ); 10005 10006 if ( !$target.hasClass( this.markerClassName ) ) { 10007 return; 10008 } 10009 10010 nodeName = target.nodeName.toLowerCase(); 10011 $.removeData( target, "datepicker" ); 10012 if ( nodeName === "input" ) { 10013 inst.append.remove(); 10014 inst.trigger.remove(); 10015 $target.removeClass( this.markerClassName ). 10016 off( "focus", this._showDatepicker ). 10017 off( "keydown", this._doKeyDown ). 10018 off( "keypress", this._doKeyPress ). 10019 off( "keyup", this._doKeyUp ); 10020 } else if ( nodeName === "div" || nodeName === "span" ) { 10021 $target.removeClass( this.markerClassName ).empty(); 10022 } 10023 10024 $.datepicker._hideDatepicker(); 10025 if ( datepicker_instActive === inst ) { 10026 datepicker_instActive = null; 10027 this._curInst = null; 10028 } 10029 }, 10030 10031 /* Enable the date picker to a jQuery selection. 10032 * @param target element - the target input field or division or span 10033 */ 10034 _enableDatepicker: function( target ) { 10035 var nodeName, inline, 10036 $target = $( target ), 10037 inst = $.data( target, "datepicker" ); 10038 10039 if ( !$target.hasClass( this.markerClassName ) ) { 10040 return; 10041 } 10042 10043 nodeName = target.nodeName.toLowerCase(); 10044 if ( nodeName === "input" ) { 10045 target.disabled = false; 10046 inst.trigger.filter( "button" ). 10047 each( function() { 10048 this.disabled = false; 10049 } ).end(). 10050 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 10051 } else if ( nodeName === "div" || nodeName === "span" ) { 10052 inline = $target.children( "." + this._inlineClass ); 10053 inline.children().removeClass( "ui-state-disabled" ); 10054 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 10055 prop( "disabled", false ); 10056 } 10057 this._disabledInputs = $.map( this._disabledInputs, 10058 10059 // Delete entry 10060 function( value ) { 10061 return ( value === target ? null : value ); 10062 } ); 10063 }, 10064 10065 /* Disable the date picker to a jQuery selection. 10066 * @param target element - the target input field or division or span 10067 */ 10068 _disableDatepicker: function( target ) { 10069 var nodeName, inline, 10070 $target = $( target ), 10071 inst = $.data( target, "datepicker" ); 10072 10073 if ( !$target.hasClass( this.markerClassName ) ) { 10074 return; 10075 } 10076 10077 nodeName = target.nodeName.toLowerCase(); 10078 if ( nodeName === "input" ) { 10079 target.disabled = true; 10080 inst.trigger.filter( "button" ). 10081 each( function() { 10082 this.disabled = true; 10083 } ).end(). 10084 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 10085 } else if ( nodeName === "div" || nodeName === "span" ) { 10086 inline = $target.children( "." + this._inlineClass ); 10087 inline.children().addClass( "ui-state-disabled" ); 10088 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 10089 prop( "disabled", true ); 10090 } 10091 this._disabledInputs = $.map( this._disabledInputs, 10092 10093 // Delete entry 10094 function( value ) { 10095 return ( value === target ? null : value ); 10096 } ); 10097 this._disabledInputs[ this._disabledInputs.length ] = target; 10098 }, 10099 10100 /* Is the first field in a jQuery collection disabled as a datepicker? 10101 * @param target element - the target input field or division or span 10102 * @return boolean - true if disabled, false if enabled 10103 */ 10104 _isDisabledDatepicker: function( target ) { 10105 if ( !target ) { 10106 return false; 10107 } 10108 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 10109 if ( this._disabledInputs[ i ] === target ) { 10110 return true; 10111 } 10112 } 10113 return false; 10114 }, 10115 10116 /* Retrieve the instance data for the target control. 10117 * @param target element - the target input field or division or span 10118 * @return object - the associated instance data 10119 * @throws error if a jQuery problem getting data 10120 */ 10121 _getInst: function( target ) { 10122 try { 10123 return $.data( target, "datepicker" ); 10124 } catch (
vendor: 8,426 bytes, lines 10124-10365
10124err ) { 10125 throw "Missing instance data for this datepicker"; 10126 } 10127 }, 10128 10129 /* Update or retrieve the settings for a date picker attached to an input field or division. 10130 * @param target element - the target input field or division or span 10131 * @param name object - the new settings to update or 10132 * string - the name of the setting to change or retrieve, 10133 * when retrieving also "all" for all instance settings or 10134 * "defaults" for all global defaults 10135 * @param value any - the new value for the setting 10136 * (omit if above is an object or to retrieve a value) 10137 */ 10138 _optionDatepicker: function( target, name, value ) { 10139 var settings, date, minDate, maxDate, 10140 inst = this._getInst( target ); 10141 10142 if ( arguments.length === 2 && typeof name === "string" ) { 10143 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 10144 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 10145 this._get( inst, name ) ) : null ) ); 10146 } 10147 10148 settings = name || {}; 10149 if ( typeof name === "string" ) { 10150 settings = {}; 10151 settings[ name ] = value; 10152 } 10153 10154 if ( inst ) { 10155 if ( this._curInst === inst ) { 10156 this._hideDatepicker(); 10157 } 10158 10159 date = this._getDateDatepicker( target, true ); 10160 minDate = this._getMinMaxDate( inst, "min" ); 10161 maxDate = this._getMinMaxDate( inst, "max" ); 10162 datepicker_extendRemove( inst.settings, settings ); 10163 10164 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 10165 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 10166 inst.settings.minDate = this._formatDate( inst, minDate ); 10167 } 10168 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 10169 inst.settings.maxDate = this._formatDate( inst, maxDate ); 10170 } 10171 if ( "disabled" in settings ) { 10172 if ( settings.disabled ) { 10173 this._disableDatepicker( target ); 10174 } else { 10175 this._enableDatepicker( target ); 10176 } 10177 } 10178 this._attachments( $( target ), inst ); 10179 this._autoSize( inst ); 10180 this._setDate( inst, date ); 10181 this._updateAlternate( inst ); 10182 this._updateDatepicker( inst ); 10183 } 10184 }, 10185 10186 // Change method deprecated 10187 _changeDatepicker: function( target, name, value ) { 10188 this._optionDatepicker( target, name, value ); 10189 }, 10190 10191 /* Redraw the date picker attached to an input field or division. 10192 * @param target element - the target input field or division or span 10193 */ 10194 _refreshDatepicker: function( target ) { 10195 var inst = this._getInst( target ); 10196 if ( inst ) { 10197 this._updateDatepicker( inst ); 10198 } 10199 }, 10200 10201 /* Set the dates for a jQuery selection. 10202 * @param target element - the target input field or division or span 10203 * @param date Date - the new date 10204 */ 10205 _setDateDatepicker: function( target, date ) { 10206 var inst = this._getInst( target ); 10207 if ( inst ) { 10208 this._setDate( inst, date ); 10209 this._updateDatepicker( inst ); 10210 this._updateAlternate( inst ); 10211 } 10212 }, 10213 10214 /* Get the date(s) for the first entry in a jQuery selection. 10215 * @param target element - the target input field or division or span 10216 * @param noDefault boolean - true if no default date is to be used 10217 * @return Date - the current date 10218 */ 10219 _getDateDatepicker: function( target, noDefault ) { 10220 var inst = this._getInst( target ); 10221 if ( inst && !inst.inline ) { 10222 this._setDateFromField( inst, noDefault ); 10223 } 10224 return ( inst ? this._getDate( inst ) : null ); 10225 }, 10226 10227 /* Handle keystrokes. */ 10228 _doKeyDown: function( event ) { 10229 var onSelect, dateStr, sel, 10230 inst = $.datepicker._getInst( event.target ), 10231 handled = true, 10232 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 10233 10234 inst._keyEvent = true; 10235 if ( $.datepicker._datepickerShowing ) { 10236 switch ( event.keyCode ) { 10237 case 9: $.datepicker._hideDatepicker(); 10238 handled = false; 10239 break; // hide on tab out 10240 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 10241 $.datepicker._currentClass + ")", inst.dpDiv ); 10242 if ( sel[ 0 ] ) { 10243 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 10244 } 10245 10246 onSelect = $.datepicker._get( inst, "onSelect" ); 10247 if ( onSelect ) { 10248 dateStr = $.datepicker._formatDate( inst ); 10249 10250 // Trigger custom callback 10251 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 10252 } else { 10253 $.datepicker._hideDatepicker(); 10254 } 10255 10256 return false; // don't submit the form 10257 case 27: $.datepicker._hideDatepicker(); 10258 break; // hide on escape 10259 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10260 -$.datepicker._get( inst, "stepBigMonths" ) : 10261 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10262 break; // previous month/year on page up/+ ctrl 10263 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10264 +$.datepicker._get( inst, "stepBigMonths" ) : 10265 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10266 break; // next month/year on page down/+ ctrl 10267 case 35: if ( event.ctrlKey || event.metaKey ) { 10268 $.datepicker._clearDate( event.target ); 10269 } 10270 handled = event.ctrlKey || event.metaKey; 10271 break; // clear on ctrl or command +end 10272 case 36: if ( event.ctrlKey || event.metaKey ) { 10273 $.datepicker._gotoToday( event.target ); 10274 } 10275 handled = event.ctrlKey || event.metaKey; 10276 break; // current on ctrl or command +home 10277 case 37: if ( event.ctrlKey || event.metaKey ) { 10278 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 10279 } 10280 handled = event.ctrlKey || event.metaKey; 10281 10282 // -1 day on ctrl or command +left 10283 if ( event.originalEvent.altKey ) { 10284 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10285 -$.datepicker._get( inst, "stepBigMonths" ) : 10286 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10287 } 10288 10289 // next month/year on alt +left on Mac 10290 break; 10291 case 38: if ( event.ctrlKey || event.metaKey ) { 10292 $.datepicker._adjustDate( event.target, -7, "D" ); 10293 } 10294 handled = event.ctrlKey || event.metaKey; 10295 break; // -1 week on ctrl or command +up 10296 case 39: if ( event.ctrlKey || event.metaKey ) { 10297 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 10298 } 10299 handled = event.ctrlKey || event.metaKey; 10300 10301 // +1 day on ctrl or command +right 10302 if ( event.originalEvent.altKey ) { 10303 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10304 +$.datepicker._get( inst, "stepBigMonths" ) : 10305 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10306 } 10307 10308 // next month/year on alt +right 10309 break; 10310 case 40: if ( event.ctrlKey || event.metaKey ) { 10311 $.datepicker._adjustDate( event.target, +7, "D" ); 10312 } 10313 handled = event.ctrlKey || event.metaKey; 10314 break; // +1 week on ctrl or command +down 10315 default: handled = false; 10316 } 10317 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 10318 $.datepicker._showDatepicker( this ); 10319 } else { 10320 handled = false; 10321 } 10322 10323 if ( handled ) { 10324 event.preventDefault(); 10325 event.stopPropagation(); 10326 } 10327 }, 10328 10329 /* Filter entered characters - based on date format. */ 10330 _doKeyPress: function( event ) { 10331 var chars, chr, 10332 inst = $.datepicker._getInst( event.target ); 10333 10334 if ( $.datepicker._get( inst, "constrainInput" ) ) { 10335 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 10336 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 10337 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 10338 } 10339 }, 10340 10341 /* Synchronise manual entry and field/alternate field. */ 10342 _doKeyUp: function( event ) { 10343 var date, 10344 inst = $.datepicker._getInst( event.target ); 10345 10346 if ( inst.input.val() !== inst.lastVal ) { 10347 try { 10348 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 10349 ( inst.input ? inst.input.val() : null ), 10350 $.datepicker._getFormatConfig( inst ) ); 10351 10352 if ( date ) { // only if valid 10353 $.datepicker._setDateFromField( inst ); 10354 $.datepicker._updateAlternate( inst ); 10355 $.datepicker._updateDatepicker( inst ); 10356 } 10357 } catch ( err ) { 10358 } 10359 } 10360 return true; 10361 }, 10362 10363 /* Pop-up the date picker for a given input field. 10364 * If false returned from beforeShow event handler do not show. 10365 * @param input element - the input field attached to the date picker or
vendor: 14,198 bytes, lines 10366-10775
10366 * event - if triggered by focus 10367 */ 10368 _showDatepicker: function( input ) { 10369 input = input.target || input; 10370 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 10371 input = $( "input", input.parentNode )[ 0 ]; 10372 } 10373 10374 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 10375 return; 10376 } 10377 10378 var inst, beforeShow, beforeShowSettings, isFixed, 10379 offset, showAnim, duration; 10380 10381 inst = $.datepicker._getInst( input ); 10382 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 10383 $.datepicker._curInst.dpDiv.stop( true, true ); 10384 if ( inst && $.datepicker._datepickerShowing ) { 10385 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 10386 } 10387 } 10388 10389 beforeShow = $.datepicker._get( inst, "beforeShow" ); 10390 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 10391 if ( beforeShowSettings === false ) { 10392 return; 10393 } 10394 datepicker_extendRemove( inst.settings, beforeShowSettings ); 10395 10396 inst.lastVal = null; 10397 $.datepicker._lastInput = input; 10398 $.datepicker._setDateFromField( inst ); 10399 10400 if ( $.datepicker._inDialog ) { // hide cursor 10401 input.value = ""; 10402 } 10403 if ( !$.datepicker._pos ) { // position below input 10404 $.datepicker._pos = $.datepicker._findPos( input ); 10405 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 10406 } 10407 10408 isFixed = false; 10409 $( input ).parents().each( function() { 10410 isFixed |= $( this ).css( "position" ) === "fixed"; 10411 return !isFixed; 10412 } ); 10413 10414 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 10415 $.datepicker._pos = null; 10416 10417 //to avoid flashes on Firefox 10418 inst.dpDiv.empty(); 10419 10420 // determine sizing offscreen 10421 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 10422 $.datepicker._updateDatepicker( inst ); 10423 10424 // fix width for dynamic number of date pickers 10425 // and adjust position before showing 10426 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 10427 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 10428 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 10429 left: offset.left + "px", top: offset.top + "px" } ); 10430 10431 if ( !inst.inline ) { 10432 showAnim = $.datepicker._get( inst, "showAnim" ); 10433 duration = $.datepicker._get( inst, "duration" ); 10434 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 10435 $.datepicker._datepickerShowing = true; 10436 10437 if ( $.effects && $.effects.effect[ showAnim ] ) { 10438 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 10439 } else { 10440 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 10441 } 10442 10443 if ( $.datepicker._shouldFocusInput( inst ) ) { 10444 inst.input.trigger( "focus" ); 10445 } 10446 10447 $.datepicker._curInst = inst; 10448 } 10449 }, 10450 10451 /* Generate the date picker content. */ 10452 _updateDatepicker: function( inst ) { 10453 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 10454 datepicker_instActive = inst; // for delegate hover events 10455 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 10456 this._attachHandlers( inst ); 10457 10458 var origyearshtml, 10459 numMonths = this._getNumberOfMonths( inst ), 10460 cols = numMonths[ 1 ], 10461 width = 17, 10462 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 10463 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 10464 10465 if ( activeCell.length > 0 ) { 10466 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 10467 } 10468 10469 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 10470 if ( cols > 1 ) { 10471 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 10472 } 10473 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 10474 "Class" ]( "ui-datepicker-multi" ); 10475 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 10476 "Class" ]( "ui-datepicker-rtl" ); 10477 10478 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 10479 inst.input.trigger( "focus" ); 10480 } 10481 10482 // Deffered render of the years select (to avoid flashes on Firefox) 10483 if ( inst.yearshtml ) { 10484 origyearshtml = inst.yearshtml; 10485 setTimeout( function() { 10486 10487 //assure that inst.yearshtml didn't change. 10488 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 10489 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 10490 } 10491 origyearshtml = inst.yearshtml = null; 10492 }, 0 ); 10493 } 10494 10495 if ( onUpdateDatepicker ) { 10496 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 10497 } 10498 }, 10499 10500 _shouldFocusInput: function( inst ) { 10501 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ); 10502 }, 10503 10504 /* Check positioning to remain on screen. */ 10505 _checkOffset: function( inst, offset, isFixed ) { 10506 var dpWidth = inst.dpDiv.outerWidth(), 10507 dpHeight = inst.dpDiv.outerHeight(), 10508 inputWidth = inst.input ? inst.input.outerWidth() : 0, 10509 inputHeight = inst.input ? inst.input.outerHeight() : 0, 10510 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 10511 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 10512 10513 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 10514 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 10515 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 10516 10517 // Now check if datepicker is showing outside window viewport - move to a better place if so. 10518 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 10519 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 10520 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 10521 Math.abs( dpHeight + inputHeight ) : 0 ); 10522 10523 return offset; 10524 }, 10525 10526 /* Find an object's position on the screen. */ 10527 _findPos: function( obj ) { 10528 var position, 10529 inst = this._getInst( obj ), 10530 isRTL = this._get( inst, "isRTL" ); 10531 10532 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 10533 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 10534 } 10535 10536 position = $( obj ).offset(); 10537 return [ position.left, position.top ]; 10538 }, 10539 10540 /* Hide the date picker from view. 10541 * @param input element - the input field attached to the date picker 10542 */ 10543 _hideDatepicker: function( input ) { 10544 var showAnim, duration, postProcess, onClose, 10545 inst = this._curInst; 10546 10547 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 10548 return; 10549 } 10550 10551 if ( this._datepickerShowing ) { 10552 showAnim = this._get( inst, "showAnim" ); 10553 duration = this._get( inst, "duration" ); 10554 postProcess = function() { 10555 $.datepicker._tidyDialog( inst ); 10556 }; 10557 10558 if ( $.effects && ( $.effects.effect[ showAnim ] ) ) { 10559 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 10560 } else { 10561 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 10562 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 10563 } 10564 10565 if ( !showAnim ) { 10566 postProcess(); 10567 } 10568 this._datepickerShowing = false; 10569 10570 onClose = this._get( inst, "onClose" ); 10571 if ( onClose ) { 10572 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 10573 } 10574 10575 this._lastInput = null; 10576 if ( this._inDialog ) { 10577 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 10578 if ( $.blockUI ) { 10579 $.unblockUI(); 10580 $( "body" ).append( this.dpDiv ); 10581 } 10582 } 10583 this._inDialog = false; 10584 } 10585 }, 10586 10587 /* Tidy up after a dialog display. */ 10588 _tidyDialog: function( inst ) { 10589 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 10590 }, 10591 10592 /* Close date picker if clicked elsewhere. */ 10593 _checkExternalClick: function( event ) { 10594 if ( !$.datepicker._curInst ) { 10595 return; 10596 } 10597 10598 var $target = $( event.target ), 10599 inst = $.datepicker._getInst( $target[ 0 ] ); 10600 10601 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 10602 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 10603 !$target.hasClass( $.datepicker.markerClassName ) && 10604 !$target.closest( "." + $.datepicker._triggerClass ).length && 10605 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 10606 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 10607 $.datepicker._hideDatepicker(); 10608 } 10609 }, 10610 10611 /* Adjust one of the date sub-fields. */ 10612 _adjustDate: function( id, offset, period ) { 10613 var target = $( id ), 10614 inst = this._getInst( target[ 0 ] ); 10615 10616 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 10617 return; 10618 } 10619 this._adjustInstDate( inst, offset, period ); 10620 this._updateDatepicker( inst ); 10621 }, 10622 10623 /* Action for current link. */ 10624 _gotoToday: function( id ) { 10625 var date, 10626 target = $( id ), 10627 inst = this._getInst( target[ 0 ] ); 10628 10629 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 10630 inst.selectedDay = inst.currentDay; 10631 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 10632 inst.drawYear = inst.selectedYear = inst.currentYear; 10633 } else { 10634 date = new Date(); 10635 inst.selectedDay = date.getDate(); 10636 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10637 inst.drawYear = inst.selectedYear = date.getFullYear(); 10638 } 10639 this._notifyChange( inst ); 10640 this._adjustDate( target ); 10641 }, 10642 10643 /* Action for selecting a new month/year. */ 10644 _selectMonthYear: function( id, select, period ) { 10645 var target = $( id ), 10646 inst = this._getInst( target[ 0 ] ); 10647 10648 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 10649 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 10650 parseInt( select.options[ select.selectedIndex ].value, 10 ); 10651 10652 this._notifyChange( inst ); 10653 this._adjustDate( target ); 10654 }, 10655 10656 /* Action for selecting a day. */ 10657 _selectDay: function( id, month, year, td ) { 10658 var inst, 10659 target = $( id ); 10660 10661 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 10662 return; 10663 } 10664 10665 inst = this._getInst( target[ 0 ] ); 10666 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 10667 inst.selectedMonth = inst.currentMonth = month; 10668 inst.selectedYear = inst.currentYear = year; 10669 this._selectDate( id, this._formatDate( inst, 10670 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 10671 }, 10672 10673 /* Erase the input field and hide the date picker. */ 10674 _clearDate: function( id ) { 10675 var target = $( id ); 10676 this._selectDate( target, "" ); 10677 }, 10678 10679 /* Update the input field with the selected date. */ 10680 _selectDate: function( id, dateStr ) { 10681 var onSelect, 10682 target = $( id ), 10683 inst = this._getInst( target[ 0 ] ); 10684 10685 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 10686 if ( inst.input ) { 10687 inst.input.val( dateStr ); 10688 } 10689 this._updateAlternate( inst ); 10690 10691 onSelect = this._get( inst, "onSelect" ); 10692 if ( onSelect ) { 10693 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 10694 } else if ( inst.input ) { 10695 inst.input.trigger( "change" ); // fire the change event 10696 } 10697 10698 if ( inst.inline ) { 10699 this._updateDatepicker( inst ); 10700 } else { 10701 this._hideDatepicker(); 10702 this._lastInput = inst.input[ 0 ]; 10703 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 10704 inst.input.trigger( "focus" ); // restore focus 10705 } 10706 this._lastInput = null; 10707 } 10708 }, 10709 10710 /* Update any alternate field to synchronise with the main field. */ 10711 _updateAlternate: function( inst ) { 10712 var altFormat, date, dateStr, 10713 altField = this._get( inst, "altField" ); 10714 10715 if ( altField ) { // update alternate field too 10716 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 10717 date = this._getDate( inst ); 10718 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 10719 $( document ).find( altField ).val( dateStr ); 10720 } 10721 }, 10722 10723 /* Set as beforeShowDay function to prevent selection of weekends. 10724 * @param date Date - the date to customise 10725 * @return [boolean, string] - is this date selectable?, what is its CSS class? 10726 */ 10727 noWeekends: function( date ) { 10728 var day = date.getDay(); 10729 return [ ( day > 0 && day < 6 ), "" ]; 10730 }, 10731 10732 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 10733 * @param date Date - the date to get the week for 10734 * @return number - the number of the week within the year that contains this date 10735 */ 10736 iso8601Week: function( date ) { 10737 var time, 10738 checkDate = new Date( date.getTime() ); 10739 10740 // Find Thursday of this week starting on Monday 10741 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 10742 10743 time = checkDate.getTime(); 10744 checkDate.setMonth( 0 ); // Compare with Jan 1 10745 checkDate.setDate( 1 ); 10746 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 10747 }, 10748 10749 /* Parse a string value into a date object. 10750 * See formatDate below for the possible formats. 10751 * 10752 * @param format string - the expected format of the date 10753 * @param value string - the date in the above format 10754 * @param settings Object - attributes include: 10755 * shortYearCutoff number - the cutoff year for determining the century (optional) 10756 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10757 * dayNames string[7] - names of the days from Sunday (optional) 10758 * monthNamesShort string[12] - abbreviated names of the months (optional) 10759 * monthNames string[12] - names of the months (optional) 10760 * @return Date - the extracted date value or null if value is blank 10761 */ 10762 parseDate: function( format, value, settings ) { 10763 if ( format == null || value == null ) { 10764 throw "Invalid arguments"; 10765 } 10766 10767 value = ( typeof value === "object" ? value.toString() : value + "" ); 10768 if ( value === "" ) { 10769 return null; 10770 } 10771 10772 var iFormat, dim, extra, 10773 iValue = 0, 10774 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 10775 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 10775-10965
10775: 10776 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 10777 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 10778 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 10779 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 10780 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 10781 year = -1, 10782 month = -1, 10783 day = -1, 10784 doy = -1, 10785 literal = false, 10786 date, 10787 10788 // Check whether a format character is doubled 10789 lookAhead = function( match ) { 10790 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 10791 if ( matches ) { 10792 iFormat++; 10793 } 10794 return matches; 10795 }, 10796 10797 // Extract a number from the string value 10798 getNumber = function( match ) { 10799 var isDoubled = lookAhead( match ), 10800 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 10801 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 10802 minSize = ( match === "y" ? size : 1 ), 10803 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 10804 num = value.substring( iValue ).match( digits ); 10805 if ( !num ) { 10806 throw "Missing number at position " + iValue; 10807 } 10808 iValue += num[ 0 ].length; 10809 return parseInt( num[ 0 ], 10 ); 10810 }, 10811 10812 // Extract a name from the string value and convert to an index 10813 getName = function( match, shortNames, longNames ) { 10814 var index = -1, 10815 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 10816 return [ [ k, v ] ]; 10817 } ).sort( function( a, b ) { 10818 return -( a[ 1 ].length - b[ 1 ].length ); 10819 } ); 10820 10821 $.each( names, function( i, pair ) { 10822 var name = pair[ 1 ]; 10823 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 10824 index = pair[ 0 ]; 10825 iValue += name.length; 10826 return false; 10827 } 10828 } ); 10829 if ( index !== -1 ) { 10830 return index + 1; 10831 } else { 10832 throw "Unknown name at position " + iValue; 10833 } 10834 }, 10835 10836 // Confirm that a literal character matches the string value 10837 checkLiteral = function() { 10838 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 10839 throw "Unexpected literal at position " + iValue; 10840 } 10841 iValue++; 10842 }; 10843 10844 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 10845 if ( literal ) { 10846 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 10847 literal = false; 10848 } else { 10849 checkLiteral(); 10850 } 10851 } else { 10852 switch ( format.charAt( iFormat ) ) { 10853 case "d": 10854 day = getNumber( "d" ); 10855 break; 10856 case "D": 10857 getName( "D", dayNamesShort, dayNames ); 10858 break; 10859 case "o": 10860 doy = getNumber( "o" ); 10861 break; 10862 case "m": 10863 month = getNumber( "m" ); 10864 break; 10865 case "M": 10866 month = getName( "M", monthNamesShort, monthNames ); 10867 break; 10868 case "y": 10869 year = getNumber( "y" ); 10870 break; 10871 case "@": 10872 date = new Date( getNumber( "@" ) ); 10873 year = date.getFullYear(); 10874 month = date.getMonth() + 1; 10875 day = date.getDate(); 10876 break; 10877 case "!": 10878 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 10879 year = date.getFullYear(); 10880 month = date.getMonth() + 1; 10881 day = date.getDate(); 10882 break; 10883 case "'": 10884 if ( lookAhead( "'" ) ) { 10885 checkLiteral(); 10886 } else { 10887 literal = true; 10888 } 10889 break; 10890 default: 10891 checkLiteral(); 10892 } 10893 } 10894 } 10895 10896 if ( iValue < value.length ) { 10897 extra = value.substr( iValue ); 10898 if ( !/^\s+/.test( extra ) ) { 10899 throw "Extra/unparsed characters found in date: " + extra; 10900 } 10901 } 10902 10903 if ( year === -1 ) { 10904 year = new Date().getFullYear(); 10905 } else if ( year < 100 ) { 10906 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 10907 ( year <= shortYearCutoff ? 0 : -100 ); 10908 } 10909 10910 if ( doy > -1 ) { 10911 month = 1; 10912 day = doy; 10913 do { 10914 dim = this._getDaysInMonth( year, month - 1 ); 10915 if ( day <= dim ) { 10916 break; 10917 } 10918 month++; 10919 day -= dim; 10920 } while ( true ); 10921 } 10922 10923 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 10924 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 10925 throw "Invalid date"; // E.g. 31/02/00 10926 } 10927 return date; 10928 }, 10929 10930 /* Standard date formats. */ 10931 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 10932 COOKIE: "D, dd M yy", 10933 ISO_8601: "yy-mm-dd", 10934 RFC_822: "D, d M y", 10935 RFC_850: "DD, dd-M-y", 10936 RFC_1036: "D, d M y", 10937 RFC_1123: "D, d M yy", 10938 RFC_2822: "D, d M yy", 10939 RSS: "D, d M y", // RFC 822 10940 TICKS: "!", 10941 TIMESTAMP: "@", 10942 W3C: "yy-mm-dd", // ISO 8601 10943 10944 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 10945 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 10946 10947 /* Format a date object into a string value. 10948 * The format can be combinations of the following: 10949 * d - day of month (no leading zero) 10950 * dd - day of month (two digit) 10951 * o - day of year (no leading zeros) 10952 * oo - day of year (three digit) 10953 * D - day name short 10954 * DD - day name long 10955 * m - month of year (no leading zero) 10956 * mm - month of year (two digit) 10957 * M - month name short 10958 * MM - month name long 10959 * y - year (two digit) 10960 * yy - year (four digit) 10961 * @ - Unix timestamp (ms since 01/01/1970) 10962 * ! - Windows ticks (100ns since 01/01/0001) 10963 * "..." - literal text 10964 * '' - single quote 10965 *
vendor: 6,198 bytes, lines 10966-11165
10966 * @param format string - the desired format of the date 10967 * @param date Date - the date value to format 10968 * @param settings Object - attributes include: 10969 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10970 * dayNames string[7] - names of the days from Sunday (optional) 10971 * monthNamesShort string[12] - abbreviated names of the months (optional) 10972 * monthNames string[12] - names of the months (optional) 10973 * @return string - the date in the above format 10974 */ 10975 formatDate: function( format, date, settings ) { 10976 if ( !date ) { 10977 return ""; 10978 } 10979 10980 var iFormat, 10981 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 10982 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 10983 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 10984 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 10985 10986 // Check whether a format character is doubled 10987 lookAhead = function( match ) { 10988 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 10989 if ( matches ) { 10990 iFormat++; 10991 } 10992 return matches; 10993 }, 10994 10995 // Format a number, with leading zero if necessary 10996 formatNumber = function( match, value, len ) { 10997 var num = "" + value; 10998 if ( lookAhead( match ) ) { 10999 while ( num.length < len ) { 11000 num = "0" + num; 11001 } 11002 } 11003 return num; 11004 }, 11005 11006 // Format a name, short or long as requested 11007 formatName = function( match, value, shortNames, longNames ) { 11008 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 11009 }, 11010 output = "", 11011 literal = false; 11012 11013 if ( date ) { 11014 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 11015 if ( literal ) { 11016 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 11017 literal = false; 11018 } else { 11019 output += format.charAt( iFormat ); 11020 } 11021 } else { 11022 switch ( format.charAt( iFormat ) ) { 11023 case "d": 11024 output += formatNumber( "d", date.getDate(), 2 ); 11025 break; 11026 case "D": 11027 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 11028 break; 11029 case "o": 11030 output += formatNumber( "o", 11031 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 11032 break; 11033 case "m": 11034 output += formatNumber( "m", date.getMonth() + 1, 2 ); 11035 break; 11036 case "M": 11037 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 11038 break; 11039 case "y": 11040 output += ( lookAhead( "y" ) ? date.getFullYear() : 11041 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 11042 break; 11043 case "@": 11044 output += date.getTime(); 11045 break; 11046 case "!": 11047 output += date.getTime() * 10000 + this._ticksTo1970; 11048 break; 11049 case "'": 11050 if ( lookAhead( "'" ) ) { 11051 output += "'"; 11052 } else { 11053 literal = true; 11054 } 11055 break; 11056 default: 11057 output += format.charAt( iFormat ); 11058 } 11059 } 11060 } 11061 } 11062 return output; 11063 }, 11064 11065 /* Extract all possible characters from the date format. */ 11066 _possibleChars: function( format ) { 11067 var iFormat, 11068 chars = "", 11069 literal = false, 11070 11071 // Check whether a format character is doubled 11072 lookAhead = function( match ) { 11073 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 11074 if ( matches ) { 11075 iFormat++; 11076 } 11077 return matches; 11078 }; 11079 11080 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 11081 if ( literal ) { 11082 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 11083 literal = false; 11084 } else { 11085 chars += format.charAt( iFormat ); 11086 } 11087 } else { 11088 switch ( format.charAt( iFormat ) ) { 11089 case "d": case "m": case "y": case "@": 11090 chars += "0123456789"; 11091 break; 11092 case "D": case "M": 11093 return null; // Accept anything 11094 case "'": 11095 if ( lookAhead( "'" ) ) { 11096 chars += "'"; 11097 } else { 11098 literal = true; 11099 } 11100 break; 11101 default: 11102 chars += format.charAt( iFormat ); 11103 } 11104 } 11105 } 11106 return chars; 11107 }, 11108 11109 /* Get a setting value, defaulting if necessary. */ 11110 _get: function( inst, name ) { 11111 return inst.settings[ name ] !== undefined ? 11112 inst.settings[ name ] : this._defaults[ name ]; 11113 }, 11114 11115 /* Parse existing date and initialise date picker. */ 11116 _setDateFromField: function( inst, noDefault ) { 11117 if ( inst.input.val() === inst.lastVal ) { 11118 return; 11119 } 11120 11121 var dateFormat = this._get( inst, "dateFormat" ), 11122 dates = inst.lastVal = inst.input ? inst.input.val() : null, 11123 defaultDate = this._getDefaultDate( inst ), 11124 date = defaultDate, 11125 settings = this._getFormatConfig( inst ); 11126 11127 try { 11128 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 11129 } catch ( event ) { 11130 dates = ( noDefault ? "" : dates ); 11131 } 11132 inst.selectedDay = date.getDate(); 11133 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11134 inst.drawYear = inst.selectedYear = date.getFullYear(); 11135 inst.currentDay = ( dates ? date.getDate() : 0 ); 11136 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 11137 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 11138 this._adjustInstDate( inst ); 11139 }, 11140 11141 /* Retrieve the default date shown on opening. */ 11142 _getDefaultDate: function( inst ) { 11143 return this._restrictMinMax( inst, 11144 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 11145 }, 11146 11147 /* A date may be specified as an exact value or a relative one. */ 11148 _determineDate: function( inst, date, defaultDate ) { 11149 var offsetNumeric = function( offset ) { 11150 var date = new Date(); 11151 date.setDate( date.getDate() + offset ); 11152 return date; 11153 }, 11154 offsetString = function( offset ) { 11155 try { 11156 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 11157 offset, $.datepicker._getFormatConfig( inst ) ); 11158 } catch ( e ) { 11159 11160 // Ignore 11161 } 11162 11163 var date = ( offset.toLowerCase().match( /^c/ ) ? 11164 $.datepicker._getDate( inst ) : null ) || new Date(), 11165 year = date.getFullYear(),
vendor: 5,359 bytes, lines 11166-11304
11166 month = date.getMonth(), 11167 day = date.getDate(), 11168 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 11169 matches = pattern.exec( offset ); 11170 11171 while ( matches ) { 11172 switch ( matches[ 2 ] || "d" ) { 11173 case "d" : case "D" : 11174 day += parseInt( matches[ 1 ], 10 ); break; 11175 case "w" : case "W" : 11176 day += parseInt( matches[ 1 ], 10 ) * 7; break; 11177 case "m" : case "M" : 11178 month += parseInt( matches[ 1 ], 10 ); 11179 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 11180 break; 11181 case "y": case "Y" : 11182 year += parseInt( matches[ 1 ], 10 ); 11183 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 11184 break; 11185 } 11186 matches = pattern.exec( offset ); 11187 } 11188 return new Date( year, month, day ); 11189 }, 11190 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 11191 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 11192 11193 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 11194 if ( newDate ) { 11195 newDate.setHours( 0 ); 11196 newDate.setMinutes( 0 ); 11197 newDate.setSeconds( 0 ); 11198 newDate.setMilliseconds( 0 ); 11199 } 11200 return this._daylightSavingAdjust( newDate ); 11201 }, 11202 11203 /* Handle switch to/from daylight saving. 11204 * Hours may be non-zero on daylight saving cut-over: 11205 * > 12 when midnight changeover, but then cannot generate 11206 * midnight datetime, so jump to 1AM, otherwise reset. 11207 * @param date (Date) the date to check 11208 * @return (Date) the corrected date 11209 */ 11210 _daylightSavingAdjust: function( date ) { 11211 if ( !date ) { 11212 return null; 11213 } 11214 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 11215 return date; 11216 }, 11217 11218 /* Set the date(s) directly. */ 11219 _setDate: function( inst, date, noChange ) { 11220 var clear = !date, 11221 origMonth = inst.selectedMonth, 11222 origYear = inst.selectedYear, 11223 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 11224 11225 inst.selectedDay = inst.currentDay = newDate.getDate(); 11226 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 11227 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 11228 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 11229 this._notifyChange( inst ); 11230 } 11231 this._adjustInstDate( inst ); 11232 if ( inst.input ) { 11233 inst.input.val( clear ? "" : this._formatDate( inst ) ); 11234 } 11235 }, 11236 11237 /* Retrieve the date(s) directly. */ 11238 _getDate: function( inst ) { 11239 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 11240 this._daylightSavingAdjust( new Date( 11241 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 11242 return startDate; 11243 }, 11244 11245 /* Attach the onxxx handlers. These are declared statically so 11246 * they work with static code transformers like Caja. 11247 */ 11248 _attachHandlers: function( inst ) { 11249 var stepMonths = this._get( inst, "stepMonths" ), 11250 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 11251 inst.dpDiv.find( "[data-handler]" ).map( function() { 11252 var handler = { 11253 prev: function() { 11254 $.datepicker._adjustDate( id, -stepMonths, "M" ); 11255 }, 11256 next: function() { 11257 $.datepicker._adjustDate( id, +stepMonths, "M" ); 11258 }, 11259 hide: function() { 11260 $.datepicker._hideDatepicker(); 11261 }, 11262 today: function() { 11263 $.datepicker._gotoToday( id ); 11264 }, 11265 selectDay: function() { 11266 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 11267 return false; 11268 }, 11269 selectMonth: function() { 11270 $.datepicker._selectMonthYear( id, this, "M" ); 11271 return false; 11272 }, 11273 selectYear: function() { 11274 $.datepicker._selectMonthYear( id, this, "Y" ); 11275 return false; 11276 } 11277 }; 11278 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 11279 } ); 11280 }, 11281 11282 /* Generate the HTML for the current state of the date picker. */ 11283 _generateHTML: function( inst ) { 11284 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 11285 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 11286 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 11287 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 11288 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 11289 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 11290 tempDate = new Date(), 11291 today = this._daylightSavingAdjust( 11292 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 11293 isRTL = this._get( inst, "isRTL" ), 11294 showButtonPanel = this._get( inst, "showButtonPanel" ), 11295 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 11296 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 11297 numMonths = this._getNumberOfMonths( inst ), 11298 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 11299 stepMonths = this._get( inst, "stepMonths" ), 11300 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 11301 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 11302 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 11303 minDate = this._getMinMaxDate( inst, "min" ), 11304 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,259 bytes, lines 11305-11819
11305 drawMonth = inst.drawMonth - showCurrentAtPos, 11306 drawYear = inst.drawYear; 11307 11308 if ( drawMonth < 0 ) { 11309 drawMonth += 12; 11310 drawYear--; 11311 } 11312 if ( maxDate ) { 11313 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 11314 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 11315 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 11316 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 11317 drawMonth--; 11318 if ( drawMonth < 0 ) { 11319 drawMonth = 11; 11320 drawYear--; 11321 } 11322 } 11323 } 11324 inst.drawMonth = drawMonth; 11325 inst.drawYear = drawYear; 11326 11327 prevText = this._get( inst, "prevText" ); 11328 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 11329 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 11330 this._getFormatConfig( inst ) ) ); 11331 11332 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 11333 prev = $( "<a>" ) 11334 .attr( { 11335 "class": "ui-datepicker-prev ui-corner-all", 11336 "data-handler": "prev", 11337 "data-event": "click", 11338 title: prevText 11339 } ) 11340 .append( 11341 $( "<span>" ) 11342 .addClass( "ui-icon ui-icon-circle-triangle-" + 11343 ( isRTL ? "e" : "w" ) ) 11344 .text( prevText ) 11345 )[ 0 ].outerHTML; 11346 } else if ( hideIfNoPrevNext ) { 11347 prev = ""; 11348 } else { 11349 prev = $( "<a>" ) 11350 .attr( { 11351 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 11352 title: prevText 11353 } ) 11354 .append( 11355 $( "<span>" ) 11356 .addClass( "ui-icon ui-icon-circle-triangle-" + 11357 ( isRTL ? "e" : "w" ) ) 11358 .text( prevText ) 11359 )[ 0 ].outerHTML; 11360 } 11361 11362 nextText = this._get( inst, "nextText" ); 11363 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 11364 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 11365 this._getFormatConfig( inst ) ) ); 11366 11367 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 11368 next = $( "<a>" ) 11369 .attr( { 11370 "class": "ui-datepicker-next ui-corner-all", 11371 "data-handler": "next", 11372 "data-event": "click", 11373 title: nextText 11374 } ) 11375 .append( 11376 $( "<span>" ) 11377 .addClass( "ui-icon ui-icon-circle-triangle-" + 11378 ( isRTL ? "w" : "e" ) ) 11379 .text( nextText ) 11380 )[ 0 ].outerHTML; 11381 } else if ( hideIfNoPrevNext ) { 11382 next = ""; 11383 } else { 11384 next = $( "<a>" ) 11385 .attr( { 11386 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 11387 title: nextText 11388 } ) 11389 .append( 11390 $( "<span>" ) 11391 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 11392 ( isRTL ? "w" : "e" ) ) 11393 .text( nextText ) 11394 )[ 0 ].outerHTML; 11395 } 11396 11397 currentText = this._get( inst, "currentText" ); 11398 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 11399 currentText = ( !navigationAsDateFormat ? currentText : 11400 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 11401 11402 controls = ""; 11403 if ( !inst.inline ) { 11404 controls = $( "<button>" ) 11405 .attr( { 11406 type: "button", 11407 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 11408 "data-handler": "hide", 11409 "data-event": "click" 11410 } ) 11411 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 11412 } 11413 11414 buttonPanel = ""; 11415 if ( showButtonPanel ) { 11416 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 11417 .append( isRTL ? controls : "" ) 11418 .append( this._isInRange( inst, gotoDate ) ? 11419 $( "<button>" ) 11420 .attr( { 11421 type: "button", 11422 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 11423 "data-handler": "today", 11424 "data-event": "click" 11425 } ) 11426 .text( currentText ) : 11427 "" ) 11428 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 11429 } 11430 11431 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 11432 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 11433 11434 showWeek = this._get( inst, "showWeek" ); 11435 dayNames = this._get( inst, "dayNames" ); 11436 dayNamesMin = this._get( inst, "dayNamesMin" ); 11437 monthNames = this._get( inst, "monthNames" ); 11438 monthNamesShort = this._get( inst, "monthNamesShort" ); 11439 beforeShowDay = this._get( inst, "beforeShowDay" ); 11440 showOtherMonths = this._get( inst, "showOtherMonths" ); 11441 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 11442 defaultDate = this._getDefaultDate( inst ); 11443 html = ""; 11444 11445 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 11446 group = ""; 11447 this.maxRows = 4; 11448 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 11449 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 11450 cornerClass = " ui-corner-all"; 11451 calender = ""; 11452 if ( isMultiMonth ) { 11453 calender += "<div class='ui-datepicker-group"; 11454 if ( numMonths[ 1 ] > 1 ) { 11455 switch ( col ) { 11456 case 0: calender += " ui-datepicker-group-first"; 11457 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 11458 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 11459 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 11460 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 11461 } 11462 } 11463 calender += "'>"; 11464 } 11465 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 11466 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 11467 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 11468 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 11469 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 11470 "</div><table class='ui-datepicker-calendar'><thead>" + 11471 "<tr>"; 11472 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 11473 for ( dow = 0; dow < 7; dow++ ) { // days of the week 11474 day = ( dow + firstDay ) % 7; 11475 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 11476 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 11477 } 11478 calender += thead + "</tr></thead><tbody>"; 11479 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 11480 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 11481 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 11482 } 11483 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 11484 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 11485 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 11486 this.maxRows = numRows; 11487 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 11488 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 11489 calender += "<tr>"; 11490 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 11491 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 11492 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 11493 daySettings = ( beforeShowDay ? 11494 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 11495 otherMonth = ( printDate.getMonth() !== drawMonth ); 11496 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 11497 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 11498 tbody += "<td class='" + 11499 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 11500 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 11501 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 11502 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 11503 11504 // or defaultDate is current printedDate and defaultDate is selectedDate 11505 " " + this._dayOverClass : "" ) + // highlight selected day 11506 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 11507 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 11508 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 11509 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 11510 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 11511 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 11512 ( otherMonth && !showOtherMonths ? " " : // display for other months 11513 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 11514 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 11515 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 11516 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 11517 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 11518 "' data-date='" + printDate.getDate() + // store date as data 11519 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 11520 printDate.setDate( printDate.getDate() + 1 ); 11521 printDate = this._daylightSavingAdjust( printDate ); 11522 } 11523 calender += tbody + "</tr>"; 11524 } 11525 drawMonth++; 11526 if ( drawMonth > 11 ) { 11527 drawMonth = 0; 11528 drawYear++; 11529 } 11530 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 11531 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 11532 group += calender; 11533 } 11534 html += group; 11535 } 11536 html += buttonPanel; 11537 inst._keyEvent = false; 11538 return html; 11539 }, 11540 11541 /* Generate the month and year header. */ 11542 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 11543 secondary, monthNames, monthNamesShort ) { 11544 11545 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 11546 changeMonth = this._get( inst, "changeMonth" ), 11547 changeYear = this._get( inst, "changeYear" ), 11548 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 11549 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 11550 selectYearLabel = this._get( inst, "selectYearLabel" ), 11551 html = "<div class='ui-datepicker-title'>", 11552 monthHtml = ""; 11553 11554 // Month selection 11555 if ( secondary || !changeMonth ) { 11556 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 11557 } else { 11558 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 11559 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 11560 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 11561 for ( month = 0; month < 12; month++ ) { 11562 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 11563 monthHtml += "<option value='" + month + "'" + 11564 ( month === drawMonth ? " selected='selected'" : "" ) + 11565 ">" + monthNamesShort[ month ] + "</option>"; 11566 } 11567 } 11568 monthHtml += "</select>"; 11569 } 11570 11571 if ( !showMonthAfterYear ) { 11572 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 11573 } 11574 11575 // Year selection 11576 if ( !inst.yearshtml ) { 11577 inst.yearshtml = ""; 11578 if ( secondary || !changeYear ) { 11579 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 11580 } else { 11581 11582 // determine range of years to display 11583 years = this._get( inst, "yearRange" ).split( ":" ); 11584 thisYear = new Date().getFullYear(); 11585 determineYear = function( value ) { 11586 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 11587 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 11588 parseInt( value, 10 ) ) ); 11589 return ( isNaN( year ) ? thisYear : year ); 11590 }; 11591 year = determineYear( years[ 0 ] ); 11592 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 11593 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 11594 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 11595 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 11596 for ( ; year <= endYear; year++ ) { 11597 inst.yearshtml += "<option value='" + year + "'" + 11598 ( year === drawYear ? " selected='selected'" : "" ) + 11599 ">" + year + "</option>"; 11600 } 11601 inst.yearshtml += "</select>"; 11602 11603 html += inst.yearshtml; 11604 inst.yearshtml = null; 11605 } 11606 } 11607 11608 html += this._get( inst, "yearSuffix" ); 11609 if ( showMonthAfterYear ) { 11610 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 11611 } 11612 html += "</div>"; // Close datepicker_header 11613 return html; 11614 }, 11615 11616 /* Adjust one of the date sub-fields. */ 11617 _adjustInstDate: function( inst, offset, period ) { 11618 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 11619 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 11620 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 11621 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 11622 11623 inst.selectedDay = date.getDate(); 11624 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11625 inst.drawYear = inst.selectedYear = date.getFullYear(); 11626 if ( period === "M" || period === "Y" ) { 11627 this._notifyChange( inst ); 11628 } 11629 }, 11630 11631 /* Ensure a date is within any min/max bounds. */ 11632 _restrictMinMax: function( inst, date ) { 11633 var minDate = this._getMinMaxDate( inst, "min" ), 11634 maxDate = this._getMinMaxDate( inst, "max" ), 11635 newDate = ( minDate && date < minDate ? minDate : date ); 11636 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 11637 }, 11638 11639 /* Notify change of month/year. */ 11640 _notifyChange: function( inst ) { 11641 var onChange = this._get( inst, "onChangeMonthYear" ); 11642 if ( onChange ) { 11643 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 11644 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 11645 } 11646 }, 11647 11648 /* Determine the number of months to show. */ 11649 _getNumberOfMonths: function( inst ) { 11650 var numMonths = this._get( inst, "numberOfMonths" ); 11651 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 11652 }, 11653 11654 /* Determine the current maximum date - ensure no time components are set. */ 11655 _getMinMaxDate: function( inst, minMax ) { 11656 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 11657 }, 11658 11659 /* Find the number of days in a given month. */ 11660 _getDaysInMonth: function( year, month ) { 11661 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 11662 }, 11663 11664 /* Find the day of the week of the first of a month. */ 11665 _getFirstDayOfMonth: function( year, month ) { 11666 return new Date( year, month, 1 ).getDay(); 11667 }, 11668 11669 /* Determines if we should allow a "next/prev" month display change. */ 11670 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 11671 var numMonths = this._getNumberOfMonths( inst ), 11672 date = this._daylightSavingAdjust( new Date( curYear, 11673 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 11674 11675 if ( offset < 0 ) { 11676 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 11677 } 11678 return this._isInRange( inst, date ); 11679 }, 11680 11681 /* Is the given date in the accepted range? */ 11682 _isInRange: function( inst, date ) { 11683 var yearSplit, currentYear, 11684 minDate = this._getMinMaxDate( inst, "min" ), 11685 maxDate = this._getMinMaxDate( inst, "max" ), 11686 minYear = null, 11687 maxYear = null, 11688 years = this._get( inst, "yearRange" ); 11689 if ( years ) { 11690 yearSplit = years.split( ":" ); 11691 currentYear = new Date().getFullYear(); 11692 minYear = parseInt( yearSplit[ 0 ], 10 ); 11693 maxYear = parseInt( yearSplit[ 1 ], 10 ); 11694 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 11695 minYear += currentYear; 11696 } 11697 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 11698 maxYear += currentYear; 11699 } 11700 } 11701 11702 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 11703 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 11704 ( !minYear || date.getFullYear() >= minYear ) && 11705 ( !maxYear || date.getFullYear() <= maxYear ) ); 11706 }, 11707 11708 /* Provide the configuration settings for formatting/parsing. */ 11709 _getFormatConfig: function( inst ) { 11710 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 11711 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 11712 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 11713 return { shortYearCutoff: shortYearCutoff, 11714 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 11715 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 11716 }, 11717 11718 /* Format the given date for display. */ 11719 _formatDate: function( inst, day, month, year ) { 11720 if ( !day ) { 11721 inst.currentDay = inst.selectedDay; 11722 inst.currentMonth = inst.selectedMonth; 11723 inst.currentYear = inst.selectedYear; 11724 } 11725 var date = ( day ? ( typeof day === "object" ? day : 11726 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 11727 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 11728 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 11729 } 11730} ); 11731 11732/* 11733 * Bind hover events for datepicker elements. 11734 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 11735 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 11736 */ 11737function datepicker_bindHover( dpDiv ) { 11738 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 11739 return dpDiv.on( "mouseout", selector, function() { 11740 $( this ).removeClass( "ui-state-hover" ); 11741 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 11742 $( this ).removeClass( "ui-datepicker-prev-hover" ); 11743 } 11744 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 11745 $( this ).removeClass( "ui-datepicker-next-hover" ); 11746 } 11747 } ) 11748 .on( "mouseover", selector, datepicker_handleMouseover ); 11749} 11750 11751function datepicker_handleMouseover() { 11752 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 11753 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 11754 $( this ).addClass( "ui-state-hover" ); 11755 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 11756 $( this ).addClass( "ui-datepicker-prev-hover" ); 11757 } 11758 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 11759 $( this ).addClass( "ui-datepicker-next-hover" ); 11760 } 11761 } 11762} 11763 11764/* jQuery extend now ignores nulls! */ 11765function datepicker_extendRemove( target, props ) { 11766 $.extend( target, props ); 11767 for ( var name in props ) { 11768 if ( props[ name ] == null ) { 11769 target[ name ] = props[ name ]; 11770 } 11771 } 11772 return target; 11773} 11774 11775/* Invoke the datepicker functionality. 11776 @param options string - a command, optionally followed by additional parameters or 11777 Object - settings for attaching new datepicker functionality 11778 @return jQuery object */ 11779$.fn.datepicker = function( options ) { 11780 11781 /* Verify an empty collection wasn't passed - Fixes #6976 */ 11782 if ( !this.length ) { 11783 return this; 11784 } 11785 11786 /* Initialise the date picker. */ 11787 if ( !$.datepicker.initialized ) { 11788 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 11789 $.datepicker.initialized = true; 11790 } 11791 11792 /* Append datepicker main container to body if not exist. */ 11793 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 11794 $( "body" ).append( $.datepicker.dpDiv ); 11795 } 11796 11797 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 11798 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 11799 return $.datepicker[ "_" + options + "Datepicker" ]. 11800 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 11801 } 11802 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 11803 return $.datepicker[ "_" + options + "Datepicker" ]. 11804 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 11805 } 11806 return this.each( function() { 11807 if ( typeof options === "string" ) { 11808 $.datepicker[ "_" + options + "Datepicker" ] 11809 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 11810 } else { 11811 $.datepicker._attachDatepicker( this, options ); 11812 } 11813 } ); 11814}; 11815 11816$.datepicker = new Datepicker(); // singleton instance 11817$.datepicker.initialized = false; 11818$.datepicker.uuid = new Date().getTime(); 11819$.datepicker.version = "1.14.
vendor: 4,105 bytes, lines 11819-12016
118190"; 11820 11821var widgetsDatepicker = $.datepicker; 11822 11823 11824/*! 11825 * jQuery UI Dialog 1.14.0 11826 * https://jqueryui.com 11827 * 11828 * Copyright OpenJS Foundation and other contributors 11829 * Released under the MIT license. 11830 * https://jquery.org/license 11831 */ 11832 11833//>>label: Dialog 11834//>>group: Widgets 11835//>>description: Displays customizable dialog windows. 11836//>>docs: https://api.jqueryui.com/dialog/ 11837//>>demos: https://jqueryui.com/dialog/ 11838//>>css.structure: ../../themes/base/core.css 11839//>>css.structure: ../../themes/base/dialog.css 11840//>>css.theme: ../../themes/base/theme.css 11841 11842 11843$.widget( "ui.dialog", { 11844 version: "1.14.0", 11845 options: { 11846 appendTo: "body", 11847 autoOpen: true, 11848 buttons: [], 11849 classes: { 11850 "ui-dialog": "ui-corner-all", 11851 "ui-dialog-titlebar": "ui-corner-all" 11852 }, 11853 closeOnEscape: true, 11854 closeText: "Close", 11855 draggable: true, 11856 hide: null, 11857 height: "auto", 11858 maxHeight: null, 11859 maxWidth: null, 11860 minHeight: 150, 11861 minWidth: 150, 11862 modal: false, 11863 position: { 11864 my: "center", 11865 at: "center", 11866 of: window, 11867 collision: "fit", 11868 11869 // Ensure the titlebar is always visible 11870 using: function( pos ) { 11871 var topOffset = $( this ).css( pos ).offset().top; 11872 if ( topOffset < 0 ) { 11873 $( this ).css( "top", pos.top - topOffset ); 11874 } 11875 } 11876 }, 11877 resizable: true, 11878 show: null, 11879 title: null, 11880 width: 300, 11881 11882 // Callbacks 11883 beforeClose: null, 11884 close: null, 11885 drag: null, 11886 dragStart: null, 11887 dragStop: null, 11888 focus: null, 11889 open: null, 11890 resize: null, 11891 resizeStart: null, 11892 resizeStop: null 11893 }, 11894 11895 sizeRelatedOptions: { 11896 buttons: true, 11897 height: true, 11898 maxHeight: true, 11899 maxWidth: true, 11900 minHeight: true, 11901 minWidth: true, 11902 width: true 11903 }, 11904 11905 resizableRelatedOptions: { 11906 maxHeight: true, 11907 maxWidth: true, 11908 minHeight: true, 11909 minWidth: true 11910 }, 11911 11912 _create: function() { 11913 this.originalCss = { 11914 display: this.element[ 0 ].style.display, 11915 width: this.element[ 0 ].style.width, 11916 minHeight: this.element[ 0 ].style.minHeight, 11917 maxHeight: this.element[ 0 ].style.maxHeight, 11918 height: this.element[ 0 ].style.height 11919 }; 11920 this.originalPosition = { 11921 parent: this.element.parent(), 11922 index: this.element.parent().children().index( this.element ) 11923 }; 11924 this.originalTitle = this.element.attr( "title" ); 11925 if ( this.options.title == null && this.originalTitle != null ) { 11926 this.options.title = this.originalTitle; 11927 } 11928 11929 // Dialogs can't be disabled 11930 if ( this.options.disabled ) { 11931 this.options.disabled = false; 11932 } 11933 11934 this._createWrapper(); 11935 11936 this.element 11937 .show() 11938 .removeAttr( "title" ) 11939 .appendTo( this.uiDialog ); 11940 11941 this._addClass( "ui-dialog-content", "ui-widget-content" ); 11942 11943 this._createTitlebar(); 11944 this._createButtonPane(); 11945 11946 if ( this.options.draggable && $.fn.draggable ) { 11947 this._makeDraggable(); 11948 } 11949 if ( this.options.resizable && $.fn.resizable ) { 11950 this._makeResizable(); 11951 } 11952 11953 this._isOpen = false; 11954 11955 this._trackFocus(); 11956 }, 11957 11958 _init: function() { 11959 if ( this.options.autoOpen ) { 11960 this.open(); 11961 } 11962 }, 11963 11964 _appendTo: function() { 11965 var element = this.options.appendTo; 11966 if ( element && ( element.jquery || element.nodeType ) ) { 11967 return $( element ); 11968 } 11969 return this.document.find( element || "body" ).eq( 0 ); 11970 }, 11971 11972 _destroy: function() { 11973 var next, 11974 originalPosition = this.originalPosition; 11975 11976 this._untrackInstance(); 11977 this._destroyOverlay(); 11978 11979 this.element 11980 .removeUniqueId() 11981 .css( this.originalCss ) 11982 11983 // Without detaching first, the following becomes really slow 11984 .detach(); 11985 11986 this.uiDialog.remove(); 11987 11988 if ( this.originalTitle ) { 11989 this.element.attr( "title", this.originalTitle ); 11990 } 11991 11992 next = originalPosition.parent.children().eq( originalPosition.index ); 11993 11994 // Don't try to place the dialog next to itself (#8613) 11995 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 11996 next.before( this.element ); 11997 } else { 11998 originalPosition.parent.append( this.element ); 11999 } 12000 }, 12001 12002 widget: function() { 12003 return this.uiDialog; 12004 }, 12005 12006 disable: $.noop, 12007 enable: $.noop, 12008 12009 close: function( event ) { 12010 var that = this; 12011 12012 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 12013 return; 12014 } 12015 12016 this._isOpen = false;
vendor: 23,311 bytes, lines 12017-12920
12017 this._focusedElement = null; 12018 this._destroyOverlay(); 12019 this._untrackInstance(); 12020 12021 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 12022 12023 // Hiding a focused element doesn't trigger blur in WebKit 12024 // so in case we have nothing to focus on, explicitly blur the active element 12025 // https://bugs.webkit.org/show_bug.cgi?id=47182 12026 $( this.document[ 0 ].activeElement ).trigger( "blur" ); 12027 } 12028 12029 this._hide( this.uiDialog, this.options.hide, function() { 12030 that._trigger( "close", event ); 12031 } ); 12032 }, 12033 12034 isOpen: function() { 12035 return this._isOpen; 12036 }, 12037 12038 moveToTop: function() { 12039 this._moveToTop(); 12040 }, 12041 12042 _moveToTop: function( event, silent ) { 12043 var moved = false, 12044 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 12045 return +$( this ).css( "z-index" ); 12046 } ).get(), 12047 zIndexMax = Math.max.apply( null, zIndices ); 12048 12049 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 12050 this.uiDialog.css( "z-index", zIndexMax + 1 ); 12051 moved = true; 12052 } 12053 12054 if ( moved && !silent ) { 12055 this._trigger( "focus", event ); 12056 } 12057 return moved; 12058 }, 12059 12060 open: function() { 12061 var that = this; 12062 if ( this._isOpen ) { 12063 if ( this._moveToTop() ) { 12064 this._focusTabbable(); 12065 } 12066 return; 12067 } 12068 12069 this._isOpen = true; 12070 this.opener = $( this.document[ 0 ].activeElement ); 12071 12072 this._size(); 12073 this._position(); 12074 this._createOverlay(); 12075 this._moveToTop( null, true ); 12076 12077 // Ensure the overlay is moved to the top with the dialog, but only when 12078 // opening. The overlay shouldn't move after the dialog is open so that 12079 // modeless dialogs opened after the modal dialog stack properly. 12080 if ( this.overlay ) { 12081 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 12082 } 12083 12084 this._show( this.uiDialog, this.options.show, function() { 12085 that._focusTabbable(); 12086 that._trigger( "focus" ); 12087 } ); 12088 12089 // Track the dialog immediately upon opening in case a focus event 12090 // somehow occurs outside of the dialog before an element inside the 12091 // dialog is focused (#10152) 12092 this._makeFocusTarget(); 12093 12094 this._trigger( "open" ); 12095 }, 12096 12097 _focusTabbable: function() { 12098 12099 // Set focus to the first match: 12100 // 1. An element that was focused previously 12101 // 2. First element inside the dialog matching [autofocus] 12102 // 3. Tabbable element inside the content element 12103 // 4. Tabbable element inside the buttonpane 12104 // 5. The close button 12105 // 6. The dialog itself 12106 var hasFocus = this._focusedElement; 12107 if ( !hasFocus ) { 12108 hasFocus = this.element.find( "[autofocus]" ); 12109 } 12110 if ( !hasFocus.length ) { 12111 hasFocus = this.element.find( ":tabbable" ); 12112 } 12113 if ( !hasFocus.length ) { 12114 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 12115 } 12116 if ( !hasFocus.length ) { 12117 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 12118 } 12119 if ( !hasFocus.length ) { 12120 hasFocus = this.uiDialog; 12121 } 12122 hasFocus.eq( 0 ).trigger( "focus" ); 12123 }, 12124 12125 _restoreTabbableFocus: function() { 12126 var activeElement = this.document[ 0 ].activeElement, 12127 isActive = this.uiDialog[ 0 ] === activeElement || 12128 $.contains( this.uiDialog[ 0 ], activeElement ); 12129 if ( !isActive ) { 12130 this._focusTabbable(); 12131 } 12132 }, 12133 12134 _keepFocus: function( event ) { 12135 event.preventDefault(); 12136 this._restoreTabbableFocus(); 12137 }, 12138 12139 _createWrapper: function() { 12140 this.uiDialog = $( "<div>" ) 12141 .hide() 12142 .attr( { 12143 12144 // Setting tabIndex makes the div focusable 12145 tabIndex: -1, 12146 role: "dialog", 12147 "aria-modal": this.options.modal ? "true" : null 12148 } ) 12149 .appendTo( this._appendTo() ); 12150 12151 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 12152 this._on( this.uiDialog, { 12153 keydown: function( event ) { 12154 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12155 event.keyCode === $.ui.keyCode.ESCAPE ) { 12156 event.preventDefault(); 12157 this.close( event ); 12158 return; 12159 } 12160 12161 // Prevent tabbing out of dialogs 12162 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 12163 return; 12164 } 12165 var tabbables = this.uiDialog.find( ":tabbable" ), 12166 first = tabbables.first(), 12167 last = tabbables.last(); 12168 12169 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 12170 !event.shiftKey ) { 12171 this._delay( function() { 12172 first.trigger( "focus" ); 12173 } ); 12174 event.preventDefault(); 12175 } else if ( ( event.target === first[ 0 ] || 12176 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 12177 this._delay( function() { 12178 last.trigger( "focus" ); 12179 } ); 12180 event.preventDefault(); 12181 } 12182 }, 12183 mousedown: function( event ) { 12184 if ( this._moveToTop( event ) ) { 12185 this._focusTabbable(); 12186 } 12187 } 12188 } ); 12189 12190 // We assume that any existing aria-describedby attribute means 12191 // that the dialog content is marked up properly 12192 // otherwise we brute force the content as the description 12193 if ( !this.element.find( "[aria-describedby]" ).length ) { 12194 this.uiDialog.attr( { 12195 "aria-describedby": this.element.uniqueId().attr( "id" ) 12196 } ); 12197 } 12198 }, 12199 12200 _createTitlebar: function() { 12201 var uiDialogTitle; 12202 12203 this.uiDialogTitlebar = $( "<div>" ); 12204 this._addClass( this.uiDialogTitlebar, 12205 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 12206 this._on( this.uiDialogTitlebar, { 12207 mousedown: function( event ) { 12208 12209 // Don't prevent click on close button (#8838) 12210 // Focusing a dialog that is partially scrolled out of view 12211 // causes the browser to scroll it into view, preventing the click event 12212 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 12213 12214 // Dialog isn't getting focus when dragging (#8063) 12215 this.uiDialog.trigger( "focus" ); 12216 } 12217 } 12218 } ); 12219 12220 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 12221 .button( { 12222 label: $( "<a>" ).text( this.options.closeText ).html(), 12223 icon: "ui-icon-closethick", 12224 showLabel: false 12225 } ) 12226 .appendTo( this.uiDialogTitlebar ); 12227 12228 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 12229 this._on( this.uiDialogTitlebarClose, { 12230 click: function( event ) { 12231 event.preventDefault(); 12232 this.close( event ); 12233 } 12234 } ); 12235 12236 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 12237 this._addClass( uiDialogTitle, "ui-dialog-title" ); 12238 this._title( uiDialogTitle ); 12239 12240 this.uiDialogTitlebar.prependTo( this.uiDialog ); 12241 12242 this.uiDialog.attr( { 12243 "aria-labelledby": uiDialogTitle.attr( "id" ) 12244 } ); 12245 }, 12246 12247 _title: function( title ) { 12248 if ( this.options.title ) { 12249 title.text( this.options.title ); 12250 } else { 12251 title.html( " " ); 12252 } 12253 }, 12254 12255 _createButtonPane: function() { 12256 this.uiDialogButtonPane = $( "<div>" ); 12257 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 12258 "ui-widget-content ui-helper-clearfix" ); 12259 12260 this.uiButtonSet = $( "<div>" ) 12261 .appendTo( this.uiDialogButtonPane ); 12262 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 12263 12264 this._createButtons(); 12265 }, 12266 12267 _createButtons: function() { 12268 var that = this, 12269 buttons = this.options.buttons; 12270 12271 // If we already have a button pane, remove it 12272 this.uiDialogButtonPane.remove(); 12273 this.uiButtonSet.empty(); 12274 12275 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 12276 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 12277 return; 12278 } 12279 12280 $.each( buttons, function( name, props ) { 12281 var click, buttonOptions; 12282 props = typeof props === "function" ? 12283 { click: props, text: name } : 12284 props; 12285 12286 // Default to a non-submitting button 12287 props = $.extend( { type: "button" }, props ); 12288 12289 // Change the context for the click callback to be the main element 12290 click = props.click; 12291 buttonOptions = { 12292 icon: props.icon, 12293 iconPosition: props.iconPosition, 12294 showLabel: props.showLabel, 12295 12296 // Deprecated options 12297 icons: props.icons, 12298 text: props.text 12299 }; 12300 12301 delete props.click; 12302 delete props.icon; 12303 delete props.iconPosition; 12304 delete props.showLabel; 12305 12306 // Deprecated options 12307 delete props.icons; 12308 if ( typeof props.text === "boolean" ) { 12309 delete props.text; 12310 } 12311 12312 $( "<button></button>", props ) 12313 .button( buttonOptions ) 12314 .appendTo( that.uiButtonSet ) 12315 .on( "click", function() { 12316 click.apply( that.element[ 0 ], arguments ); 12317 } ); 12318 } ); 12319 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 12320 this.uiDialogButtonPane.appendTo( this.uiDialog ); 12321 }, 12322 12323 _makeDraggable: function() { 12324 var that = this, 12325 options = this.options; 12326 12327 function filteredUi( ui ) { 12328 return { 12329 position: ui.position, 12330 offset: ui.offset 12331 }; 12332 } 12333 12334 this.uiDialog.draggable( { 12335 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12336 handle: ".ui-dialog-titlebar", 12337 containment: "document", 12338 start: function( event, ui ) { 12339 that._addClass( $( this ), "ui-dialog-dragging" ); 12340 that._blockFrames(); 12341 that._trigger( "dragStart", event, filteredUi( ui ) ); 12342 }, 12343 drag: function( event, ui ) { 12344 that._trigger( "drag", event, filteredUi( ui ) ); 12345 }, 12346 stop: function( event, ui ) { 12347 var left = ui.offset.left - that.document.scrollLeft(), 12348 top = ui.offset.top - that.document.scrollTop(); 12349 12350 options.position = { 12351 my: "left top", 12352 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12353 "top" + ( top >= 0 ? "+" : "" ) + top, 12354 of: that.window 12355 }; 12356 that._removeClass( $( this ), "ui-dialog-dragging" ); 12357 that._unblockFrames(); 12358 that._trigger( "dragStop", event, filteredUi( ui ) ); 12359 } 12360 } ); 12361 }, 12362 12363 _makeResizable: function() { 12364 var that = this, 12365 options = this.options, 12366 handles = options.resizable, 12367 12368 // .ui-resizable has position: relative defined in the stylesheet 12369 // but dialogs have to use absolute or fixed positioning 12370 position = this.uiDialog.css( "position" ), 12371 resizeHandles = typeof handles === "string" ? 12372 handles : 12373 "n,e,s,w,se,sw,ne,nw"; 12374 12375 function filteredUi( ui ) { 12376 return { 12377 originalPosition: ui.originalPosition, 12378 originalSize: ui.originalSize, 12379 position: ui.position, 12380 size: ui.size 12381 }; 12382 } 12383 12384 this.uiDialog.resizable( { 12385 cancel: ".ui-dialog-content", 12386 containment: "document", 12387 alsoResize: this.element, 12388 maxWidth: options.maxWidth, 12389 maxHeight: options.maxHeight, 12390 minWidth: options.minWidth, 12391 minHeight: this._minHeight(), 12392 handles: resizeHandles, 12393 start: function( event, ui ) { 12394 that._addClass( $( this ), "ui-dialog-resizing" ); 12395 that._blockFrames(); 12396 that._trigger( "resizeStart", event, filteredUi( ui ) ); 12397 }, 12398 resize: function( event, ui ) { 12399 that._trigger( "resize", event, filteredUi( ui ) ); 12400 }, 12401 stop: function( event, ui ) { 12402 var offset = that.uiDialog.offset(), 12403 left = offset.left - that.document.scrollLeft(), 12404 top = offset.top - that.document.scrollTop(); 12405 12406 options.height = that.uiDialog.height(); 12407 options.width = that.uiDialog.width(); 12408 options.position = { 12409 my: "left top", 12410 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12411 "top" + ( top >= 0 ? "+" : "" ) + top, 12412 of: that.window 12413 }; 12414 that._removeClass( $( this ), "ui-dialog-resizing" ); 12415 that._unblockFrames(); 12416 that._trigger( "resizeStop", event, filteredUi( ui ) ); 12417 } 12418 } ) 12419 .css( "position", position ); 12420 }, 12421 12422 _trackFocus: function() { 12423 this._on( this.widget(), { 12424 focusin: function( event ) { 12425 this._makeFocusTarget(); 12426 this._focusedElement = $( event.target ); 12427 } 12428 } ); 12429 }, 12430 12431 _makeFocusTarget: function() { 12432 this._untrackInstance(); 12433 this._trackingInstances().unshift( this ); 12434 }, 12435 12436 _untrackInstance: function() { 12437 var instances = this._trackingInstances(), 12438 exists = $.inArray( this, instances ); 12439 if ( exists !== -1 ) { 12440 instances.splice( exists, 1 ); 12441 } 12442 }, 12443 12444 _trackingInstances: function() { 12445 var instances = this.document.data( "ui-dialog-instances" ); 12446 if ( !instances ) { 12447 instances = []; 12448 this.document.data( "ui-dialog-instances", instances ); 12449 } 12450 return instances; 12451 }, 12452 12453 _minHeight: function() { 12454 var options = this.options; 12455 12456 return options.height === "auto" ? 12457 options.minHeight : 12458 Math.min( options.minHeight, options.height ); 12459 }, 12460 12461 _position: function() { 12462 12463 // Need to show the dialog to get the actual offset in the position plugin 12464 var isVisible = this.uiDialog.is( ":visible" ); 12465 if ( !isVisible ) { 12466 this.uiDialog.show(); 12467 } 12468 this.uiDialog.position( this.options.position ); 12469 if ( !isVisible ) { 12470 this.uiDialog.hide(); 12471 } 12472 }, 12473 12474 _setOptions: function( options ) { 12475 var that = this, 12476 resize = false, 12477 resizableOptions = {}; 12478 12479 $.each( options, function( key, value ) { 12480 that._setOption( key, value ); 12481 12482 if ( key in that.sizeRelatedOptions ) { 12483 resize = true; 12484 } 12485 if ( key in that.resizableRelatedOptions ) { 12486 resizableOptions[ key ] = value; 12487 } 12488 } ); 12489 12490 if ( resize ) { 12491 this._size(); 12492 this._position(); 12493 } 12494 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12495 this.uiDialog.resizable( "option", resizableOptions ); 12496 } 12497 }, 12498 12499 _setOption: function( key, value ) { 12500 var isDraggable, isResizable, 12501 uiDialog = this.uiDialog; 12502 12503 if ( key === "disabled" ) { 12504 return; 12505 } 12506 12507 this._super( key, value ); 12508 12509 if ( key === "appendTo" ) { 12510 this.uiDialog.appendTo( this._appendTo() ); 12511 } 12512 12513 if ( key === "buttons" ) { 12514 this._createButtons(); 12515 } 12516 12517 if ( key === "closeText" ) { 12518 this.uiDialogTitlebarClose.button( { 12519 12520 // Ensure that we always pass a string 12521 label: $( "<a>" ).text( "" + this.options.closeText ).html() 12522 } ); 12523 } 12524 12525 if ( key === "draggable" ) { 12526 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 12527 if ( isDraggable && !value ) { 12528 uiDialog.draggable( "destroy" ); 12529 } 12530 12531 if ( !isDraggable && value ) { 12532 this._makeDraggable(); 12533 } 12534 } 12535 12536 if ( key === "position" ) { 12537 this._position(); 12538 } 12539 12540 if ( key === "resizable" ) { 12541 12542 // currently resizable, becoming non-resizable 12543 isResizable = uiDialog.is( ":data(ui-resizable)" ); 12544 if ( isResizable && !value ) { 12545 uiDialog.resizable( "destroy" ); 12546 } 12547 12548 // Currently resizable, changing handles 12549 if ( isResizable && typeof value === "string" ) { 12550 uiDialog.resizable( "option", "handles", value ); 12551 } 12552 12553 // Currently non-resizable, becoming resizable 12554 if ( !isResizable && value !== false ) { 12555 this._makeResizable(); 12556 } 12557 } 12558 12559 if ( key === "title" ) { 12560 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 12561 } 12562 12563 if ( key === "modal" ) { 12564 uiDialog.attr( "aria-modal", value ? "true" : null ); 12565 } 12566 }, 12567 12568 _size: function() { 12569 12570 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12571 // divs will both have width and height set, so we need to reset them 12572 var nonContentHeight, minContentHeight, maxContentHeight, 12573 options = this.options; 12574 12575 // Reset content sizing 12576 this.element.show().css( { 12577 width: "auto", 12578 minHeight: 0, 12579 maxHeight: "none", 12580 height: 0 12581 } ); 12582 12583 if ( options.minWidth > options.width ) { 12584 options.width = options.minWidth; 12585 } 12586 12587 // Reset wrapper sizing 12588 // determine the height of all the non-content elements 12589 nonContentHeight = this.uiDialog.css( { 12590 height: "auto", 12591 width: options.width 12592 } ) 12593 .outerHeight(); 12594 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 12595 maxContentHeight = typeof options.maxHeight === "number" ? 12596 Math.max( 0, options.maxHeight - nonContentHeight ) : 12597 "none"; 12598 12599 if ( options.height === "auto" ) { 12600 this.element.css( { 12601 minHeight: minContentHeight, 12602 maxHeight: maxContentHeight, 12603 height: "auto" 12604 } ); 12605 } else { 12606 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 12607 } 12608 12609 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12610 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 12611 } 12612 }, 12613 12614 _blockFrames: function() { 12615 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 12616 var iframe = $( this ); 12617 12618 return $( "<div>" ) 12619 .css( { 12620 position: "absolute", 12621 width: iframe.outerWidth(), 12622 height: iframe.outerHeight() 12623 } ) 12624 .appendTo( iframe.parent() ) 12625 .offset( iframe.offset() )[ 0 ]; 12626 } ); 12627 }, 12628 12629 _unblockFrames: function() { 12630 if ( this.iframeBlocks ) { 12631 this.iframeBlocks.remove(); 12632 delete this.iframeBlocks; 12633 } 12634 }, 12635 12636 _allowInteraction: function( event ) { 12637 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 12638 return true; 12639 } 12640 12641 // TODO: Remove hack when datepicker implements 12642 // the .ui-front logic (#8989) 12643 return !!$( event.target ).closest( ".ui-datepicker" ).length; 12644 }, 12645 12646 _createOverlay: function() { 12647 if ( !this.options.modal ) { 12648 return; 12649 } 12650 12651 // We use a delay in case the overlay is created from an 12652 // event that we're going to be cancelling (#2804) 12653 var isOpening = true; 12654 this._delay( function() { 12655 isOpening = false; 12656 } ); 12657 12658 if ( !this.document.data( "ui-dialog-overlays" ) ) { 12659 12660 // Prevent use of anchors and inputs 12661 // This doesn't use `_on()` because it is a shared event handler 12662 // across all open modal dialogs. 12663 this.document.on( "focusin.ui-dialog", function( event ) { 12664 if ( isOpening ) { 12665 return; 12666 } 12667 12668 var instance = this._trackingInstances()[ 0 ]; 12669 if ( !instance._allowInteraction( event ) ) { 12670 event.preventDefault(); 12671 instance._focusTabbable(); 12672 } 12673 }.bind( this ) ); 12674 } 12675 12676 this.overlay = $( "<div>" ) 12677 .appendTo( this._appendTo() ); 12678 12679 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 12680 this._on( this.overlay, { 12681 mousedown: "_keepFocus" 12682 } ); 12683 this.document.data( "ui-dialog-overlays", 12684 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 12685 }, 12686 12687 _destroyOverlay: function() { 12688 if ( !this.options.modal ) { 12689 return; 12690 } 12691 12692 if ( this.overlay ) { 12693 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 12694 12695 if ( !overlays ) { 12696 this.document.off( "focusin.ui-dialog" ); 12697 this.document.removeData( "ui-dialog-overlays" ); 12698 } else { 12699 this.document.data( "ui-dialog-overlays", overlays ); 12700 } 12701 12702 this.overlay.remove(); 12703 this.overlay = null; 12704 } 12705 } 12706} ); 12707 12708// DEPRECATED 12709// TODO: switch return back to widget declaration at top of file when this is removed 12710if ( $.uiBackCompat === true ) { 12711 12712 // Backcompat for dialogClass option 12713 $.widget( "ui.dialog", $.ui.dialog, { 12714 options: { 12715 dialogClass: "" 12716 }, 12717 _createWrapper: function() { 12718 this._super(); 12719 this.uiDialog.addClass( this.options.dialogClass ); 12720 }, 12721 _setOption: function( key, value ) { 12722 if ( key === "dialogClass" ) { 12723 this.uiDialog 12724 .removeClass( this.options.dialogClass ) 12725 .addClass( value ); 12726 } 12727 this._superApply( arguments ); 12728 } 12729 } ); 12730} 12731 12732var widgetsDialog = $.ui.dialog; 12733 12734 12735/*! 12736 * jQuery UI Progressbar 1.14.0 12737 * https://jqueryui.com 12738 * 12739 * Copyright OpenJS Foundation and other contributors 12740 * Released under the MIT license. 12741 * https://jquery.org/license 12742 */ 12743 12744//>>label: Progressbar 12745//>>group: Widgets 12746/* eslint-disable max-len */ 12747//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 12748/* eslint-enable max-len */ 12749//>>docs: https://api.jqueryui.com/progressbar/ 12750//>>demos: https://jqueryui.com/progressbar/ 12751//>>css.structure: ../../themes/base/core.css 12752//>>css.structure: ../../themes/base/progressbar.css 12753//>>css.theme: ../../themes/base/theme.css 12754 12755 12756var widgetsProgressbar = $.widget( "ui.progressbar", { 12757 version: "1.14.0", 12758 options: { 12759 classes: { 12760 "ui-progressbar": "ui-corner-all", 12761 "ui-progressbar-value": "ui-corner-left", 12762 "ui-progressbar-complete": "ui-corner-right" 12763 }, 12764 max: 100, 12765 value: 0, 12766 12767 change: null, 12768 complete: null 12769 }, 12770 12771 min: 0, 12772 12773 _create: function() { 12774 12775 // Constrain initial value 12776 this.oldValue = this.options.value = this._constrainedValue(); 12777 12778 this.element.attr( { 12779 12780 // Only set static values; aria-valuenow and aria-valuemax are 12781 // set inside _refreshValue() 12782 role: "progressbar", 12783 "aria-valuemin": this.min 12784 } ); 12785 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 12786 12787 this.valueDiv = $( "<div>" ).appendTo( this.element ); 12788 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 12789 this._refreshValue(); 12790 }, 12791 12792 _destroy: function() { 12793 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 12794 12795 this.valueDiv.remove(); 12796 }, 12797 12798 value: function( newValue ) { 12799 if ( newValue === undefined ) { 12800 return this.options.value; 12801 } 12802 12803 this.options.value = this._constrainedValue( newValue ); 12804 this._refreshValue(); 12805 }, 12806 12807 _constrainedValue: function( newValue ) { 12808 if ( newValue === undefined ) { 12809 newValue = this.options.value; 12810 } 12811 12812 this.indeterminate = newValue === false; 12813 12814 // Sanitize value 12815 if ( typeof newValue !== "number" ) { 12816 newValue = 0; 12817 } 12818 12819 return this.indeterminate ? false : 12820 Math.min( this.options.max, Math.max( this.min, newValue ) ); 12821 }, 12822 12823 _setOptions: function( options ) { 12824 12825 // Ensure "value" option is set after other values (like max) 12826 var value = options.value; 12827 delete options.value; 12828 12829 this._super( options ); 12830 12831 this.options.value = this._constrainedValue( value ); 12832 this._refreshValue(); 12833 }, 12834 12835 _setOption: function( key, value ) { 12836 if ( key === "max" ) { 12837 12838 // Don't allow a max less than min 12839 value = Math.max( this.min, value ); 12840 } 12841 this._super( key, value ); 12842 }, 12843 12844 _setOptionDisabled: function( value ) { 12845 this._super( value ); 12846 12847 this.element.attr( "aria-disabled", value ); 12848 this._toggleClass( null, "ui-state-disabled", !!value ); 12849 }, 12850 12851 _percentage: function() { 12852 return this.indeterminate ? 12853 100 : 12854 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 12855 }, 12856 12857 _refreshValue: function() { 12858 var value = this.options.value, 12859 percentage = this._percentage(); 12860 12861 this.valueDiv 12862 .toggle( this.indeterminate || value > this.min ) 12863 .width( percentage.toFixed( 0 ) + "%" ); 12864 12865 this 12866 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 12867 value === this.options.max ) 12868 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 12869 12870 if ( this.indeterminate ) { 12871 this.element.removeAttr( "aria-valuenow" ); 12872 if ( !this.overlayDiv ) { 12873 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 12874 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 12875 } 12876 } else { 12877 this.element.attr( { 12878 "aria-valuemax": this.options.max, 12879 "aria-valuenow": value 12880 } ); 12881 if ( this.overlayDiv ) { 12882 this.overlayDiv.remove(); 12883 this.overlayDiv = null; 12884 } 12885 } 12886 12887 if ( this.oldValue !== value ) { 12888 this.oldValue = value; 12889 this._trigger( "change" ); 12890 } 12891 if ( value === this.options.max ) { 12892 this._trigger( "complete" ); 12893 } 12894 } 12895} ); 12896 12897 12898/*! 12899 * jQuery UI Selectmenu 1.14.0 12900 * https://jqueryui.com 12901 * 12902 * Copyright OpenJS Foundation and other contributors 12903 * Released under the MIT license. 12904 * https://jquery.org/license 12905 */ 12906 12907//>>label: Selectmenu 12908//>>group: Widgets 12909/* eslint-disable max-len */ 12910//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select. 12911/* eslint-enable max-len */ 12912//>>docs: https://api.jqueryui.com/selectmenu/ 12913//>>demos: https://jqueryui.com/selectmenu/ 12914//>>css.structure: ../../themes/base/core.css 12915//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 12916//>>css.theme: ../../themes/base/theme.css 12917 12918 12919var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 12920 version: "1.14.0
vendor: 14,466 bytes, lines 12920-13541
12920", 12921 defaultElement: "<select>", 12922 options: { 12923 appendTo: null, 12924 classes: { 12925 "ui-selectmenu-button-open": "ui-corner-top", 12926 "ui-selectmenu-button-closed": "ui-corner-all" 12927 }, 12928 disabled: null, 12929 icons: { 12930 button: "ui-icon-triangle-1-s" 12931 }, 12932 position: { 12933 my: "left top", 12934 at: "left bottom", 12935 collision: "none" 12936 }, 12937 width: false, 12938 12939 // Callbacks 12940 change: null, 12941 close: null, 12942 focus: null, 12943 open: null, 12944 select: null 12945 }, 12946 12947 _create: function() { 12948 var selectmenuId = this.element.uniqueId().attr( "id" ); 12949 this.ids = { 12950 element: selectmenuId, 12951 button: selectmenuId + "-button", 12952 menu: selectmenuId + "-menu" 12953 }; 12954 12955 this._drawButton(); 12956 this._drawMenu(); 12957 this._bindFormResetHandler(); 12958 12959 this._rendered = false; 12960 this.menuItems = $(); 12961 }, 12962 12963 _drawButton: function() { 12964 var icon, 12965 that = this, 12966 item = this._parseOption( 12967 this.element.find( "option:selected" ), 12968 this.element[ 0 ].selectedIndex 12969 ); 12970 12971 // Associate existing label with the new button 12972 this.labels = this.element.labels().attr( "for", this.ids.button ); 12973 this._on( this.labels, { 12974 click: function( event ) { 12975 this.button.trigger( "focus" ); 12976 event.preventDefault(); 12977 } 12978 } ); 12979 12980 // Hide original select element 12981 this.element.hide(); 12982 12983 // Create button 12984 this.button = $( "<span>", { 12985 tabindex: this.options.disabled ? -1 : 0, 12986 id: this.ids.button, 12987 role: "combobox", 12988 "aria-expanded": "false", 12989 "aria-autocomplete": "list", 12990 "aria-owns": this.ids.menu, 12991 "aria-haspopup": "true", 12992 title: this.element.attr( "title" ) 12993 } ) 12994 .insertAfter( this.element ); 12995 12996 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 12997 "ui-button ui-widget" ); 12998 12999 icon = $( "<span>" ).appendTo( this.button ); 13000 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 13001 this.buttonItem = this._renderButtonItem( item ) 13002 .appendTo( this.button ); 13003 13004 if ( this.options.width !== false ) { 13005 this._resizeButton(); 13006 } 13007 13008 this._on( this.button, this._buttonEvents ); 13009 this.button.one( "focusin", function() { 13010 13011 // Delay rendering the menu items until the button receives focus. 13012 // The menu may have already been rendered via a programmatic open. 13013 if ( !that._rendered ) { 13014 that._refreshMenu(); 13015 } 13016 } ); 13017 }, 13018 13019 _drawMenu: function() { 13020 var that = this; 13021 13022 // Create menu 13023 this.menu = $( "<ul>", { 13024 "aria-hidden": "true", 13025 "aria-labelledby": this.ids.button, 13026 id: this.ids.menu 13027 } ); 13028 13029 // Wrap menu 13030 this.menuWrap = $( "<div>" ).append( this.menu ); 13031 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 13032 this.menuWrap.appendTo( this._appendTo() ); 13033 13034 // Initialize menu widget 13035 this.menuInstance = this.menu 13036 .menu( { 13037 classes: { 13038 "ui-menu": "ui-corner-bottom" 13039 }, 13040 role: "listbox", 13041 select: function( event, ui ) { 13042 event.preventDefault(); 13043 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 13044 }, 13045 focus: function( event, ui ) { 13046 var item = ui.item.data( "ui-selectmenu-item" ); 13047 13048 // Prevent inital focus from firing and check if its a newly focused item 13049 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 13050 that._trigger( "focus", event, { item: item } ); 13051 if ( !that.isOpen ) { 13052 that._select( item, event ); 13053 } 13054 } 13055 that.focusIndex = item.index; 13056 13057 that.button.attr( "aria-activedescendant", 13058 that.menuItems.eq( item.index ).attr( "id" ) ); 13059 } 13060 } ) 13061 .menu( "instance" ); 13062 13063 // Don't close the menu on mouseleave 13064 this.menuInstance._off( this.menu, "mouseleave" ); 13065 13066 // Cancel the menu's collapseAll on document click 13067 this.menuInstance._closeOnDocumentClick = function() { 13068 return false; 13069 }; 13070 13071 // Selects often contain empty items, but never contain dividers 13072 this.menuInstance._isDivider = function() { 13073 return false; 13074 }; 13075 }, 13076 13077 refresh: function() { 13078 this._refreshMenu(); 13079 this.buttonItem.replaceWith( 13080 this.buttonItem = this._renderButtonItem( 13081 13082 // Fall back to an empty object in case there are no options 13083 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 13084 ) 13085 ); 13086 if ( this.options.width === null ) { 13087 this._resizeButton(); 13088 } 13089 }, 13090 13091 _refreshMenu: function() { 13092 var item, 13093 options = this.element.find( "option" ); 13094 13095 this.menu.empty(); 13096 13097 this._parseOptions( options ); 13098 this._renderMenu( this.menu, this.items ); 13099 13100 this.menuInstance.refresh(); 13101 this.menuItems = this.menu.find( "li" ) 13102 .not( ".ui-selectmenu-optgroup" ) 13103 .find( ".ui-menu-item-wrapper" ); 13104 13105 this._rendered = true; 13106 13107 if ( !options.length ) { 13108 return; 13109 } 13110 13111 item = this._getSelectedItem(); 13112 13113 // Update the menu to have the correct item focused 13114 this.menuInstance.focus( null, item ); 13115 this._setAria( item.data( "ui-selectmenu-item" ) ); 13116 13117 // Set disabled state 13118 this._setOption( "disabled", this.element.prop( "disabled" ) ); 13119 }, 13120 13121 open: function( event ) { 13122 if ( this.options.disabled ) { 13123 return; 13124 } 13125 13126 // If this is the first time the menu is being opened, render the items 13127 if ( !this._rendered ) { 13128 this._refreshMenu(); 13129 } else { 13130 13131 // Menu clears focus on close, reset focus to selected item 13132 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 13133 this.menuInstance.focus( null, this._getSelectedItem() ); 13134 } 13135 13136 // If there are no options, don't open the menu 13137 if ( !this.menuItems.length ) { 13138 return; 13139 } 13140 13141 this.isOpen = true; 13142 this._toggleAttr(); 13143 this._resizeMenu(); 13144 this._position(); 13145 13146 this._on( this.document, this._documentClick ); 13147 13148 this._trigger( "open", event ); 13149 }, 13150 13151 _position: function() { 13152 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 13153 }, 13154 13155 close: function( event ) { 13156 if ( !this.isOpen ) { 13157 return; 13158 } 13159 13160 this.isOpen = false; 13161 this._toggleAttr(); 13162 13163 this.range = null; 13164 this._off( this.document ); 13165 13166 this._trigger( "close", event ); 13167 }, 13168 13169 widget: function() { 13170 return this.button; 13171 }, 13172 13173 menuWidget: function() { 13174 return this.menu; 13175 }, 13176 13177 _renderButtonItem: function( item ) { 13178 var buttonItem = $( "<span>" ); 13179 13180 this._setText( buttonItem, item.label ); 13181 this._addClass( buttonItem, "ui-selectmenu-text" ); 13182 13183 return buttonItem; 13184 }, 13185 13186 _renderMenu: function( ul, items ) { 13187 var that = this, 13188 currentOptgroup = ""; 13189 13190 $.each( items, function( index, item ) { 13191 var li; 13192 13193 if ( item.optgroup !== currentOptgroup ) { 13194 li = $( "<li>", { 13195 text: item.optgroup 13196 } ); 13197 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13198 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 13199 " ui-state-disabled" : 13200 "" ) ); 13201 13202 li.appendTo( ul ); 13203 13204 currentOptgroup = item.optgroup; 13205 } 13206 13207 that._renderItemData( ul, item ); 13208 } ); 13209 }, 13210 13211 _renderItemData: function( ul, item ) { 13212 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 13213 }, 13214 13215 _renderItem: function( ul, item ) { 13216 var li = $( "<li>" ), 13217 wrapper = $( "<div>", { 13218 title: item.element.attr( "title" ) 13219 } ); 13220 13221 if ( item.disabled ) { 13222 this._addClass( li, null, "ui-state-disabled" ); 13223 } 13224 13225 if ( item.hidden ) { 13226 li.prop( "hidden", true ); 13227 } else { 13228 this._setText( wrapper, item.label ); 13229 } 13230 13231 return li.append( wrapper ).appendTo( ul ); 13232 }, 13233 13234 _setText: function( element, value ) { 13235 if ( value ) { 13236 element.text( value ); 13237 } else { 13238 element.html( " " ); 13239 } 13240 }, 13241 13242 _move: function( direction, event ) { 13243 var item, next, 13244 filter = ".ui-menu-item"; 13245 13246 if ( this.isOpen ) { 13247 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 13248 } else { 13249 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 13250 filter += ":not(.ui-state-disabled)"; 13251 } 13252 13253 if ( direction === "first" || direction === "last" ) { 13254 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 13255 } else { 13256 next = item[ direction + "All" ]( filter ).eq( 0 ); 13257 } 13258 13259 if ( next.length ) { 13260 this.menuInstance.focus( event, next ); 13261 } 13262 }, 13263 13264 _getSelectedItem: function() { 13265 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 13266 }, 13267 13268 _toggle: function( event ) { 13269 this[ this.isOpen ? "close" : "open" ]( event ); 13270 }, 13271 13272 _setSelection: function() { 13273 var selection; 13274 13275 if ( !this.range ) { 13276 return; 13277 } 13278 13279 selection = window.getSelection(); 13280 selection.removeAllRanges(); 13281 selection.addRange( this.range ); 13282 }, 13283 13284 _documentClick: { 13285 mousedown: function( event ) { 13286 if ( !this.isOpen ) { 13287 return; 13288 } 13289 13290 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 13291 CSS.escape( this.ids.button ) ).length ) { 13292 this.close( event ); 13293 } 13294 } 13295 }, 13296 13297 _buttonEvents: { 13298 13299 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13300 mousedown: function() { 13301 var selection = window.getSelection(); 13302 if ( selection.rangeCount ) { 13303 this.range = selection.getRangeAt( 0 ); 13304 } 13305 }, 13306 13307 click: function( event ) { 13308 this._setSelection(); 13309 this._toggle( event ); 13310 }, 13311 13312 keydown: function( event ) { 13313 var preventDefault = true; 13314 switch ( event.keyCode ) { 13315 case $.ui.keyCode.TAB: 13316 case $.ui.keyCode.ESCAPE: 13317 this.close( event ); 13318 preventDefault = false; 13319 break; 13320 case $.ui.keyCode.ENTER: 13321 if ( this.isOpen ) { 13322 this._selectFocusedItem( event ); 13323 } 13324 break; 13325 case $.ui.keyCode.UP: 13326 if ( event.altKey ) { 13327 this._toggle( event ); 13328 } else { 13329 this._move( "prev", event ); 13330 } 13331 break; 13332 case $.ui.keyCode.DOWN: 13333 if ( event.altKey ) { 13334 this._toggle( event ); 13335 } else { 13336 this._move( "next", event ); 13337 } 13338 break; 13339 case $.ui.keyCode.SPACE: 13340 if ( this.isOpen ) { 13341 this._selectFocusedItem( event ); 13342 } else { 13343 this._toggle( event ); 13344 } 13345 break; 13346 case $.ui.keyCode.LEFT: 13347 this._move( "prev", event ); 13348 break; 13349 case $.ui.keyCode.RIGHT: 13350 this._move( "next", event ); 13351 break; 13352 case $.ui.keyCode.HOME: 13353 case $.ui.keyCode.PAGE_UP: 13354 this._move( "first", event ); 13355 break; 13356 case $.ui.keyCode.END: 13357 case $.ui.keyCode.PAGE_DOWN: 13358 this._move( "last", event ); 13359 break; 13360 default: 13361 this.menu.trigger( event ); 13362 preventDefault = false; 13363 } 13364 13365 if ( preventDefault ) { 13366 event.preventDefault(); 13367 } 13368 } 13369 }, 13370 13371 _selectFocusedItem: function( event ) { 13372 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 13373 if ( !item.hasClass( "ui-state-disabled" ) ) { 13374 this._select( item.data( "ui-selectmenu-item" ), event ); 13375 } 13376 }, 13377 13378 _select: function( item, event ) { 13379 var oldIndex = this.element[ 0 ].selectedIndex; 13380 13381 // Change native select element 13382 this.element[ 0 ].selectedIndex = item.index; 13383 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 13384 this._setAria( item ); 13385 this._trigger( "select", event, { item: item } ); 13386 13387 if ( item.index !== oldIndex ) { 13388 this._trigger( "change", event, { item: item } ); 13389 } 13390 13391 this.close( event ); 13392 }, 13393 13394 _setAria: function( item ) { 13395 var id = this.menuItems.eq( item.index ).attr( "id" ); 13396 13397 this.button.attr( { 13398 "aria-labelledby": id, 13399 "aria-activedescendant": id 13400 } ); 13401 this.menu.attr( "aria-activedescendant", id ); 13402 }, 13403 13404 _setOption: function( key, value ) { 13405 if ( key === "icons" ) { 13406 var icon = this.button.find( "span.ui-icon" ); 13407 this._removeClass( icon, null, this.options.icons.button ) 13408 ._addClass( icon, null, value.button ); 13409 } 13410 13411 this._super( key, value ); 13412 13413 if ( key === "appendTo" ) { 13414 this.menuWrap.appendTo( this._appendTo() ); 13415 } 13416 13417 if ( key === "width" ) { 13418 this._resizeButton(); 13419 } 13420 }, 13421 13422 _setOptionDisabled: function( value ) { 13423 this._super( value ); 13424 13425 this.menuInstance.option( "disabled", value ); 13426 this.button.attr( "aria-disabled", value ); 13427 this._toggleClass( this.button, null, "ui-state-disabled", value ); 13428 13429 this.element.prop( "disabled", value ); 13430 if ( value ) { 13431 this.button.attr( "tabindex", -1 ); 13432 this.close(); 13433 } else { 13434 this.button.attr( "tabindex", 0 ); 13435 } 13436 }, 13437 13438 _appendTo: function() { 13439 var element = this.options.appendTo; 13440 13441 if ( element ) { 13442 element = element.jquery || element.nodeType ? 13443 $( element ) : 13444 this.document.find( element ).eq( 0 ); 13445 } 13446 13447 if ( !element || !element[ 0 ] ) { 13448 element = this.element.closest( ".ui-front, dialog" ); 13449 } 13450 13451 if ( !element.length ) { 13452 element = this.document[ 0 ].body; 13453 } 13454 13455 return element; 13456 }, 13457 13458 _toggleAttr: function() { 13459 this.button.attr( "aria-expanded", this.isOpen ); 13460 13461 // We can't use two _toggleClass() calls here, because we need to make sure 13462 // we always remove classes first and add them second, otherwise if both classes have the 13463 // same theme class, it will be removed after we add it. 13464 this._removeClass( this.button, "ui-selectmenu-button-" + 13465 ( this.isOpen ? "closed" : "open" ) ) 13466 ._addClass( this.button, "ui-selectmenu-button-" + 13467 ( this.isOpen ? "open" : "closed" ) ) 13468 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 13469 13470 this.menu.attr( "aria-hidden", !this.isOpen ); 13471 }, 13472 13473 _resizeButton: function() { 13474 var width = this.options.width; 13475 13476 // For `width: false`, just remove inline style and stop 13477 if ( width === false ) { 13478 this.button.css( "width", "" ); 13479 return; 13480 } 13481 13482 // For `width: null`, match the width of the original element 13483 if ( width === null ) { 13484 width = this.element.show().outerWidth(); 13485 this.element.hide(); 13486 } 13487 13488 this.button.outerWidth( width ); 13489 }, 13490 13491 _resizeMenu: function() { 13492 this.menu.outerWidth( Math.max( 13493 this.button.outerWidth(), 13494 this.menu.width( "" ).outerWidth() 13495 ) ); 13496 }, 13497 13498 _getCreateOptions: function() { 13499 var options = this._super(); 13500 13501 options.disabled = this.element.prop( "disabled" ); 13502 13503 return options; 13504 }, 13505 13506 _parseOptions: function( options ) { 13507 var that = this, 13508 data = []; 13509 options.each( function( index, item ) { 13510 data.push( that._parseOption( $( item ), index ) ); 13511 } ); 13512 this.items = data; 13513 }, 13514 13515 _parseOption: function( option, index ) { 13516 var optgroup = option.parent( "optgroup" ); 13517 13518 return { 13519 element: option, 13520 index: index, 13521 value: option.val(), 13522 label: option.text(), 13523 hidden: optgroup.prop( "hidden" ) || option.prop( "hidden" ), 13524 optgroup: optgroup.attr( "label" ) || "", 13525 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 13526 }; 13527 }, 13528 13529 _destroy: function() { 13530 this._unbindFormResetHandler(); 13531 this.menuWrap.remove(); 13532 this.button.remove(); 13533 this.element.show(); 13534 this.element.removeUniqueId(); 13535 this.labels.attr( "for", this.ids.element ); 13536 } 13537} ] ); 13538 13539 13540/*! 13541 * jQuery UI Slider 1.14.
vendor: 2,981 bytes, lines 13541-13657
135410 13542 * https://jqueryui.com 13543 * 13544 * Copyright OpenJS Foundation and other contributors 13545 * Released under the MIT license. 13546 * https://jquery.org/license 13547 */ 13548 13549//>>label: Slider 13550//>>group: Widgets 13551//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 13552//>>docs: https://api.jqueryui.com/slider/ 13553//>>demos: https://jqueryui.com/slider/ 13554//>>css.structure: ../../themes/base/core.css 13555//>>css.structure: ../../themes/base/slider.css 13556//>>css.theme: ../../themes/base/theme.css 13557 13558 13559var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { 13560 version: "1.14.0", 13561 widgetEventPrefix: "slide", 13562 13563 options: { 13564 animate: false, 13565 classes: { 13566 "ui-slider": "ui-corner-all", 13567 "ui-slider-handle": "ui-corner-all", 13568 13569 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 13570 // element, but worked best visually with a variety of themes 13571 "ui-slider-range": "ui-corner-all ui-widget-header" 13572 }, 13573 distance: 0, 13574 max: 100, 13575 min: 0, 13576 orientation: "horizontal", 13577 range: false, 13578 step: 1, 13579 value: 0, 13580 values: null, 13581 13582 // Callbacks 13583 change: null, 13584 slide: null, 13585 start: null, 13586 stop: null 13587 }, 13588 13589 // Number of pages in a slider 13590 // (how many times can you page up/down to go through the whole range) 13591 numPages: 5, 13592 13593 _create: function() { 13594 this._keySliding = false; 13595 this._mouseSliding = false; 13596 this._animateOff = true; 13597 this._handleIndex = null; 13598 this._detectOrientation(); 13599 this._mouseInit(); 13600 this._calculateNewMax(); 13601 13602 this._addClass( "ui-slider ui-slider-" + this.orientation, 13603 "ui-widget ui-widget-content" ); 13604 13605 this._refresh(); 13606 13607 this._animateOff = false; 13608 }, 13609 13610 _refresh: function() { 13611 this._createRange(); 13612 this._createHandles(); 13613 this._setupEvents(); 13614 this._refreshValue(); 13615 }, 13616 13617 _createHandles: function() { 13618 var i, handleCount, 13619 options = this.options, 13620 existingHandles = this.element.find( ".ui-slider-handle" ), 13621 handle = "<span tabindex='0'></span>", 13622 handles = []; 13623 13624 handleCount = ( options.values && options.values.length ) || 1; 13625 13626 if ( existingHandles.length > handleCount ) { 13627 existingHandles.slice( handleCount ).remove(); 13628 existingHandles = existingHandles.slice( 0, handleCount ); 13629 } 13630 13631 for ( i = existingHandles.length; i < handleCount; i++ ) { 13632 handles.push( handle ); 13633 } 13634 13635 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 13636 13637 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 13638 13639 this.handle = this.handles.eq( 0 ); 13640 13641 this.handles.each( function( i ) { 13642 $( this ) 13643 .data( "ui-slider-handle-index", i ) 13644 .attr( "tabIndex", 0 ); 13645 } ); 13646 }, 13647 13648 _createRange: function() { 13649 var options = this.options; 13650 13651 if ( options.range ) { 13652 if ( options.range === true ) { 13653 if ( !options.values ) { 13654 options.values = [ this._valueMin(), this._valueMin() ]; 13655 } else if ( options.values.length && options.values.length !== 2 ) { 13656 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 13657 } else if ( Array
vendor: 6,343 bytes, lines 13657-13903
13657.isArray( options.values ) ) { 13658 options.values = options.values.slice( 0 ); 13659 } 13660 } 13661 13662 if ( !this.range || !this.range.length ) { 13663 this.range = $( "<div>" ) 13664 .appendTo( this.element ); 13665 13666 this._addClass( this.range, "ui-slider-range" ); 13667 } else { 13668 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 13669 13670 // Handle range switching from true to min/max 13671 this.range.css( { 13672 "left": "", 13673 "bottom": "" 13674 } ); 13675 } 13676 if ( options.range === "min" || options.range === "max" ) { 13677 this._addClass( this.range, "ui-slider-range-" + options.range ); 13678 } 13679 } else { 13680 if ( this.range ) { 13681 this.range.remove(); 13682 } 13683 this.range = null; 13684 } 13685 }, 13686 13687 _setupEvents: function() { 13688 this._off( this.handles ); 13689 this._on( this.handles, this._handleEvents ); 13690 this._hoverable( this.handles ); 13691 this._focusable( this.handles ); 13692 }, 13693 13694 _destroy: function() { 13695 this.handles.remove(); 13696 if ( this.range ) { 13697 this.range.remove(); 13698 } 13699 13700 this._mouseDestroy(); 13701 }, 13702 13703 _mouseCapture: function( event ) { 13704 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 13705 that = this, 13706 o = this.options; 13707 13708 if ( o.disabled ) { 13709 return false; 13710 } 13711 13712 this.elementSize = { 13713 width: this.element.outerWidth(), 13714 height: this.element.outerHeight() 13715 }; 13716 this.elementOffset = this.element.offset(); 13717 13718 position = { x: event.pageX, y: event.pageY }; 13719 normValue = this._normValueFromMouse( position ); 13720 distance = this._valueMax() - this._valueMin() + 1; 13721 this.handles.each( function( i ) { 13722 var thisDistance = Math.abs( normValue - that.values( i ) ); 13723 if ( ( distance > thisDistance ) || 13724 ( distance === thisDistance && 13725 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 13726 distance = thisDistance; 13727 closestHandle = $( this ); 13728 index = i; 13729 } 13730 } ); 13731 13732 allowed = this._start( event, index ); 13733 if ( allowed === false ) { 13734 return false; 13735 } 13736 this._mouseSliding = true; 13737 13738 this._handleIndex = index; 13739 13740 this._addClass( closestHandle, null, "ui-state-active" ); 13741 closestHandle.trigger( "focus" ); 13742 13743 offset = closestHandle.offset(); 13744 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 13745 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 13746 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 13747 top: event.pageY - offset.top - 13748 ( closestHandle.height() / 2 ) - 13749 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 13750 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 13751 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 13752 }; 13753 13754 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 13755 this._slide( event, index, normValue ); 13756 } 13757 this._animateOff = true; 13758 return true; 13759 }, 13760 13761 _mouseStart: function() { 13762 return true; 13763 }, 13764 13765 _mouseDrag: function( event ) { 13766 var position = { x: event.pageX, y: event.pageY }, 13767 normValue = this._normValueFromMouse( position ); 13768 13769 this._slide( event, this._handleIndex, normValue ); 13770 13771 return false; 13772 }, 13773 13774 _mouseStop: function( event ) { 13775 this._removeClass( this.handles, null, "ui-state-active" ); 13776 this._mouseSliding = false; 13777 13778 this._stop( event, this._handleIndex ); 13779 this._change( event, this._handleIndex ); 13780 13781 this._handleIndex = null; 13782 this._clickOffset = null; 13783 this._animateOff = false; 13784 13785 return false; 13786 }, 13787 13788 _detectOrientation: function() { 13789 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 13790 }, 13791 13792 _normValueFromMouse: function( position ) { 13793 var pixelTotal, 13794 pixelMouse, 13795 percentMouse, 13796 valueTotal, 13797 valueMouse; 13798 13799 if ( this.orientation === "horizontal" ) { 13800 pixelTotal = this.elementSize.width; 13801 pixelMouse = position.x - this.elementOffset.left - 13802 ( this._clickOffset ? this._clickOffset.left : 0 ); 13803 } else { 13804 pixelTotal = this.elementSize.height; 13805 pixelMouse = position.y - this.elementOffset.top - 13806 ( this._clickOffset ? this._clickOffset.top : 0 ); 13807 } 13808 13809 percentMouse = ( pixelMouse / pixelTotal ); 13810 if ( percentMouse > 1 ) { 13811 percentMouse = 1; 13812 } 13813 if ( percentMouse < 0 ) { 13814 percentMouse = 0; 13815 } 13816 if ( this.orientation === "vertical" ) { 13817 percentMouse = 1 - percentMouse; 13818 } 13819 13820 valueTotal = this._valueMax() - this._valueMin(); 13821 valueMouse = this._valueMin() + percentMouse * valueTotal; 13822 13823 return this._trimAlignValue( valueMouse ); 13824 }, 13825 13826 _uiHash: function( index, value, values ) { 13827 var uiHash = { 13828 handle: this.handles[ index ], 13829 handleIndex: index, 13830 value: value !== undefined ? value : this.value() 13831 }; 13832 13833 if ( this._hasMultipleValues() ) { 13834 uiHash.value = value !== undefined ? value : this.values( index ); 13835 uiHash.values = values || this.values(); 13836 } 13837 13838 return uiHash; 13839 }, 13840 13841 _hasMultipleValues: function() { 13842 return this.options.values && this.options.values.length; 13843 }, 13844 13845 _start: function( event, index ) { 13846 return this._trigger( "start", event, this._uiHash( index ) ); 13847 }, 13848 13849 _slide: function( event, index, newVal ) { 13850 var allowed, otherVal, 13851 currentValue = this.value(), 13852 newValues = this.values(); 13853 13854 if ( this._hasMultipleValues() ) { 13855 otherVal = this.values( index ? 0 : 1 ); 13856 currentValue = this.values( index ); 13857 13858 if ( this.options.values.length === 2 && this.options.range === true ) { 13859 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 13860 } 13861 13862 newValues[ index ] = newVal; 13863 } 13864 13865 if ( newVal === currentValue ) { 13866 return; 13867 } 13868 13869 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 13870 13871 // A slide can be canceled by returning false from the slide callback 13872 if ( allowed === false ) { 13873 return; 13874 } 13875 13876 if ( this._hasMultipleValues() ) { 13877 this.values( index, newVal ); 13878 } else { 13879 this.value( newVal ); 13880 } 13881 }, 13882 13883 _stop: function( event, index ) { 13884 this._trigger( "stop", event, this._uiHash( index ) ); 13885 }, 13886 13887 _change: function( event, index ) { 13888 if ( !this._keySliding && !this._mouseSliding ) { 13889 13890 //store the last changed value index for reference when handles overlap 13891 this._lastChangedValue = index; 13892 this._trigger( "change", event, this._uiHash( index ) ); 13893 } 13894 }, 13895 13896 value: function( newValue ) { 13897 if ( arguments.length ) { 13898 this.options.value = this._trimAlignValue( newValue ); 13899 this._refreshValue(); 13900 this._change( null, 0 ); 13901 return; 13902 } 13903
vendor: 4,358 bytes, lines 13904-14076
13904 return this._value(); 13905 }, 13906 13907 values: function( index, newValue ) { 13908 var vals, 13909 newValues, 13910 i; 13911 13912 if ( arguments.length > 1 ) { 13913 this.options.values[ index ] = this._trimAlignValue( newValue ); 13914 this._refreshValue(); 13915 this._change( null, index ); 13916 return; 13917 } 13918 13919 if ( arguments.length ) { 13920 if ( Array.isArray( arguments[ 0 ] ) ) { 13921 vals = this.options.values; 13922 newValues = arguments[ 0 ]; 13923 for ( i = 0; i < vals.length; i += 1 ) { 13924 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 13925 this._change( null, i ); 13926 } 13927 this._refreshValue(); 13928 } else { 13929 if ( this._hasMultipleValues() ) { 13930 return this._values( index ); 13931 } else { 13932 return this.value(); 13933 } 13934 } 13935 } else { 13936 return this._values(); 13937 } 13938 }, 13939 13940 _setOption: function( key, value ) { 13941 var i, 13942 valsLength = 0; 13943 13944 if ( key === "range" && this.options.range === true ) { 13945 if ( value === "min" ) { 13946 this.options.value = this._values( 0 ); 13947 this.options.values = null; 13948 } else if ( value === "max" ) { 13949 this.options.value = this._values( this.options.values.length - 1 ); 13950 this.options.values = null; 13951 } 13952 } 13953 13954 if ( Array.isArray( this.options.values ) ) { 13955 valsLength = this.options.values.length; 13956 } 13957 13958 this._super( key, value ); 13959 13960 switch ( key ) { 13961 case "orientation": 13962 this._detectOrientation(); 13963 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 13964 ._addClass( "ui-slider-" + this.orientation ); 13965 this._refreshValue(); 13966 if ( this.options.range ) { 13967 this._refreshRange( value ); 13968 } 13969 13970 // Reset positioning from previous orientation 13971 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 13972 break; 13973 case "value": 13974 this._animateOff = true; 13975 this._refreshValue(); 13976 this._change( null, 0 ); 13977 this._animateOff = false; 13978 break; 13979 case "values": 13980 this._animateOff = true; 13981 this._refreshValue(); 13982 13983 // Start from the last handle to prevent unreachable handles (#9046) 13984 for ( i = valsLength - 1; i >= 0; i-- ) { 13985 this._change( null, i ); 13986 } 13987 this._animateOff = false; 13988 break; 13989 case "step": 13990 case "min": 13991 case "max": 13992 this._animateOff = true; 13993 this._calculateNewMax(); 13994 this._refreshValue(); 13995 this._animateOff = false; 13996 break; 13997 case "range": 13998 this._animateOff = true; 13999 this._refresh(); 14000 this._animateOff = false; 14001 break; 14002 } 14003 }, 14004 14005 _setOptionDisabled: function( value ) { 14006 this._super( value ); 14007 14008 this._toggleClass( null, "ui-state-disabled", !!value ); 14009 }, 14010 14011 //internal value getter 14012 // _value() returns value trimmed by min and max, aligned by step 14013 _value: function() { 14014 var val = this.options.value; 14015 val = this._trimAlignValue( val ); 14016 14017 return val; 14018 }, 14019 14020 //internal values getter 14021 // _values() returns array of values trimmed by min and max, aligned by step 14022 // _values( index ) returns single value trimmed by min and max, aligned by step 14023 _values: function( index ) { 14024 var val, 14025 vals, 14026 i; 14027 14028 if ( arguments.length ) { 14029 val = this.options.values[ index ]; 14030 val = this._trimAlignValue( val ); 14031 14032 return val; 14033 } else if ( this._hasMultipleValues() ) { 14034 14035 // .slice() creates a copy of the array 14036 // this copy gets trimmed by min and max and then returned 14037 vals = this.options.values.slice(); 14038 for ( i = 0; i < vals.length; i += 1 ) { 14039 vals[ i ] = this._trimAlignValue( vals[ i ] ); 14040 } 14041 14042 return vals; 14043 } else { 14044 return []; 14045 } 14046 }, 14047 14048 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 14049 _trimAlignValue: function( val ) { 14050 if ( val <= this._valueMin() ) { 14051 return this._valueMin(); 14052 } 14053 if ( val >= this._valueMax() ) { 14054 return this._valueMax(); 14055 } 14056 var step = ( this.options.step > 0 ) ? this.options.step : 1, 14057 valModStep = ( val - this._valueMin() ) % step, 14058 alignValue = val - valModStep; 14059 14060 if ( Math.abs( valModStep ) * 2 >= step ) { 14061 alignValue += ( valModStep > 0 ) ? step : ( -step ); 14062 } 14063 14064 // Since JavaScript has problems with large floats, round 14065 // the final value to 5 digits after the decimal point (see #4124) 14066 return parseFloat( alignValue.toFixed( 5 ) ); 14067 }, 14068 14069 _calculateNewMax: function() { 14070 var max = this.options.max, 14071 min = this._valueMin(), 14072 step = this.options.step, 14073 aboveMin = Math.round( ( max - min ) / step ) * step; 14074 max = aboveMin + min; 14075 if ( max > this.options.max ) { 14076
vendor: 5,583 bytes, lines 14077-14276
14077 //If max is not divisible by step, rounding off may increase its value 14078 max -= step; 14079 } 14080 this.max = parseFloat( max.toFixed( this._precision() ) ); 14081 }, 14082 14083 _precision: function() { 14084 var precision = this._precisionOf( this.options.step ); 14085 if ( this.options.min !== null ) { 14086 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 14087 } 14088 return precision; 14089 }, 14090 14091 _precisionOf: function( num ) { 14092 var str = num.toString(), 14093 decimal = str.indexOf( "." ); 14094 return decimal === -1 ? 0 : str.length - decimal - 1; 14095 }, 14096 14097 _valueMin: function() { 14098 return this.options.min; 14099 }, 14100 14101 _valueMax: function() { 14102 return this.max; 14103 }, 14104 14105 _refreshRange: function( orientation ) { 14106 if ( orientation === "vertical" ) { 14107 this.range.css( { "width": "", "left": "" } ); 14108 } 14109 if ( orientation === "horizontal" ) { 14110 this.range.css( { "height": "", "bottom": "" } ); 14111 } 14112 }, 14113 14114 _refreshValue: function() { 14115 var lastValPercent, valPercent, value, valueMin, valueMax, 14116 oRange = this.options.range, 14117 o = this.options, 14118 that = this, 14119 animate = ( !this._animateOff ) ? o.animate : false, 14120 _set = {}; 14121 14122 if ( this._hasMultipleValues() ) { 14123 this.handles.each( function( i ) { 14124 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 14125 that._valueMin() ) * 100; 14126 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 14127 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 14128 if ( that.options.range === true ) { 14129 if ( that.orientation === "horizontal" ) { 14130 if ( i === 0 ) { 14131 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14132 left: valPercent + "%" 14133 }, o.animate ); 14134 } 14135 if ( i === 1 ) { 14136 that.range[ animate ? "animate" : "css" ]( { 14137 width: ( valPercent - lastValPercent ) + "%" 14138 }, { 14139 queue: false, 14140 duration: o.animate 14141 } ); 14142 } 14143 } else { 14144 if ( i === 0 ) { 14145 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14146 bottom: ( valPercent ) + "%" 14147 }, o.animate ); 14148 } 14149 if ( i === 1 ) { 14150 that.range[ animate ? "animate" : "css" ]( { 14151 height: ( valPercent - lastValPercent ) + "%" 14152 }, { 14153 queue: false, 14154 duration: o.animate 14155 } ); 14156 } 14157 } 14158 } 14159 lastValPercent = valPercent; 14160 } ); 14161 } else { 14162 value = this.value(); 14163 valueMin = this._valueMin(); 14164 valueMax = this._valueMax(); 14165 valPercent = ( valueMax !== valueMin ) ? 14166 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 14167 0; 14168 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 14169 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 14170 14171 if ( oRange === "min" && this.orientation === "horizontal" ) { 14172 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14173 width: valPercent + "%" 14174 }, o.animate ); 14175 } 14176 if ( oRange === "max" && this.orientation === "horizontal" ) { 14177 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14178 width: ( 100 - valPercent ) + "%" 14179 }, o.animate ); 14180 } 14181 if ( oRange === "min" && this.orientation === "vertical" ) { 14182 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14183 height: valPercent + "%" 14184 }, o.animate ); 14185 } 14186 if ( oRange === "max" && this.orientation === "vertical" ) { 14187 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14188 height: ( 100 - valPercent ) + "%" 14189 }, o.animate ); 14190 } 14191 } 14192 }, 14193 14194 _handleEvents: { 14195 keydown: function( event ) { 14196 var allowed, curVal, newVal, step, 14197 index = $( event.target ).data( "ui-slider-handle-index" ); 14198 14199 switch ( event.keyCode ) { 14200 case $.ui.keyCode.HOME: 14201 case $.ui.keyCode.END: 14202 case $.ui.keyCode.PAGE_UP: 14203 case $.ui.keyCode.PAGE_DOWN: 14204 case $.ui.keyCode.UP: 14205 case $.ui.keyCode.RIGHT: 14206 case $.ui.keyCode.DOWN: 14207 case $.ui.keyCode.LEFT: 14208 event.preventDefault(); 14209 if ( !this._keySliding ) { 14210 this._keySliding = true; 14211 this._addClass( $( event.target ), null, "ui-state-active" ); 14212 allowed = this._start( event, index ); 14213 if ( allowed === false ) { 14214 return; 14215 } 14216 } 14217 break; 14218 } 14219 14220 step = this.options.step; 14221 if ( this._hasMultipleValues() ) { 14222 curVal = newVal = this.values( index ); 14223 } else { 14224 curVal = newVal = this.value(); 14225 } 14226 14227 switch ( event.keyCode ) { 14228 case $.ui.keyCode.HOME: 14229 newVal = this._valueMin(); 14230 break; 14231 case $.ui.keyCode.END: 14232 newVal = this._valueMax(); 14233 break; 14234 case $.ui.keyCode.PAGE_UP: 14235 newVal = this._trimAlignValue( 14236 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 14237 ); 14238 break; 14239 case $.ui.keyCode.PAGE_DOWN: 14240 newVal = this._trimAlignValue( 14241 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 14242 break; 14243 case $.ui.keyCode.UP: 14244 case $.ui.keyCode.RIGHT: 14245 if ( curVal === this._valueMax() ) { 14246 return; 14247 } 14248 newVal = this._trimAlignValue( curVal + step ); 14249 break; 14250 case $.ui.keyCode.DOWN: 14251 case $.ui.keyCode.LEFT: 14252 if ( curVal === this._valueMin() ) { 14253 return; 14254 } 14255 newVal = this._trimAlignValue( curVal - step ); 14256 break; 14257 } 14258 14259 this._slide( event, index, newVal ); 14260 }, 14261 keyup: function( event ) { 14262 var index = $( event.target ).data( "ui-slider-handle-index" ); 14263 14264 if ( this._keySliding ) { 14265 this._keySliding = false; 14266 this._stop( event, index ); 14267 this._change( event, index ); 14268 this._removeClass( $( event.target ), null, "ui-state-active" ); 14269 } 14270 } 14271 } 14272} ); 14273 14274 14275/*! 14276 * jQuery UI S
vendor: 3,313 bytes, lines 14276-14413
14276pinner 1.14.0 14277 * https://jqueryui.com 14278 * 14279 * Copyright OpenJS Foundation and other contributors 14280 * Released under the MIT license. 14281 * https://jquery.org/license 14282 */ 14283 14284//>>label: Spinner 14285//>>group: Widgets 14286//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 14287//>>docs: https://api.jqueryui.com/spinner/ 14288//>>demos: https://jqueryui.com/spinner/ 14289//>>css.structure: ../../themes/base/core.css 14290//>>css.structure: ../../themes/base/spinner.css 14291//>>css.theme: ../../themes/base/theme.css 14292 14293 14294function spinnerModifier( fn ) { 14295 return function() { 14296 var previous = this.element.val(); 14297 fn.apply( this, arguments ); 14298 this._refresh(); 14299 if ( previous !== this.element.val() ) { 14300 this._trigger( "change" ); 14301 } 14302 }; 14303} 14304 14305$.widget( "ui.spinner", { 14306 version: "1.14.0", 14307 defaultElement: "<input>", 14308 widgetEventPrefix: "spin", 14309 options: { 14310 classes: { 14311 "ui-spinner": "ui-corner-all", 14312 "ui-spinner-down": "ui-corner-br", 14313 "ui-spinner-up": "ui-corner-tr" 14314 }, 14315 culture: null, 14316 icons: { 14317 down: "ui-icon-triangle-1-s", 14318 up: "ui-icon-triangle-1-n" 14319 }, 14320 incremental: true, 14321 max: null, 14322 min: null, 14323 numberFormat: null, 14324 page: 10, 14325 step: 1, 14326 14327 change: null, 14328 spin: null, 14329 start: null, 14330 stop: null 14331 }, 14332 14333 _create: function() { 14334 14335 // handle string values that need to be parsed 14336 this._setOption( "max", this.options.max ); 14337 this._setOption( "min", this.options.min ); 14338 this._setOption( "step", this.options.step ); 14339 14340 // Only format if there is a value, prevents the field from being marked 14341 // as invalid in Firefox, see #9573. 14342 if ( this.value() !== "" ) { 14343 14344 // Format the value, but don't constrain. 14345 this._value( this.element.val(), true ); 14346 } 14347 14348 this._draw(); 14349 this._on( this._events ); 14350 this._refresh(); 14351 14352 // Turning off autocomplete prevents the browser from remembering the 14353 // value when navigating through history, so we re-enable autocomplete 14354 // if the page is unloaded before the widget is destroyed. #7790 14355 this._on( this.window, { 14356 beforeunload: function() { 14357 this.element.removeAttr( "autocomplete" ); 14358 } 14359 } ); 14360 }, 14361 14362 _getCreateOptions: function() { 14363 var options = this._super(); 14364 var element = this.element; 14365 14366 $.each( [ "min", "max", "step" ], function( i, option ) { 14367 var value = element.attr( option ); 14368 if ( value != null && value.length ) { 14369 options[ option ] = value; 14370 } 14371 } ); 14372 14373 return options; 14374 }, 14375 14376 _events: { 14377 keydown: function( event ) { 14378 if ( this._start( event ) && this._keydown( event ) ) { 14379 event.preventDefault(); 14380 } 14381 }, 14382 keyup: "_stop", 14383 focus: function() { 14384 this.previous = this.element.val(); 14385 }, 14386 blur: function( event ) { 14387 this._stop(); 14388 this._refresh(); 14389 if ( this.previous !== this.element.val() ) { 14390 this._trigger( "change", event ); 14391 } 14392 }, 14393 mousewheel: function( event, delta ) { 14394 var activeElement = this.document[ 0 ].activeElement; 14395 var isActive = this.element[ 0 ] === activeElement; 14396 14397 if ( !isActive || !delta ) { 14398 return; 14399 } 14400 14401 if ( !this.spinning && !this._start( event ) ) { 14402 return false; 14403 } 14404 14405 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 14406 clearTimeout( this.mousewheelTimer ); 14407 this.mousewheelTimer = this._delay( function() { 14408 if ( this.spinning ) { 14409 this._stop( event ); 14410 } 14411 }, 100 ); 14412 event.preventDefault(); 14413 },
vendor: 10,099 bytes, lines 14413-14815
14413 14414 "mousedown .ui-spinner-button": function( event ) { 14415 var previous; 14416 14417 // We never want the buttons to have focus; whenever the user is 14418 // interacting with the spinner, the focus should be on the input. 14419 // If the input is focused then this.previous is properly set from 14420 // when the input first received focus. If the input is not focused 14421 // then we need to set this.previous based on the value before spinning. 14422 previous = this.element[ 0 ] === this.document[ 0 ].activeElement ? 14423 this.previous : this.element.val(); 14424 function checkFocus() { 14425 var isActive = this.element[ 0 ] === this.document[ 0 ].activeElement; 14426 if ( !isActive ) { 14427 this.element.trigger( "focus" ); 14428 this.previous = previous; 14429 } 14430 } 14431 14432 // Ensure focus is on (or stays on) the text field 14433 event.preventDefault(); 14434 checkFocus.call( this ); 14435 14436 if ( this._start( event ) === false ) { 14437 return; 14438 } 14439 14440 this._repeat( null, $( event.currentTarget ) 14441 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 14442 }, 14443 "mouseup .ui-spinner-button": "_stop", 14444 "mouseenter .ui-spinner-button": function( event ) { 14445 14446 // button will add ui-state-active if mouse was down while mouseleave and kept down 14447 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 14448 return; 14449 } 14450 14451 if ( this._start( event ) === false ) { 14452 return false; 14453 } 14454 this._repeat( null, $( event.currentTarget ) 14455 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 14456 }, 14457 14458 // TODO: do we really want to consider this a stop? 14459 // shouldn't we just stop the repeater and wait until mouseup before 14460 // we trigger the stop event? 14461 "mouseleave .ui-spinner-button": "_stop" 14462 }, 14463 14464 // Support mobile enhanced option and make backcompat more sane 14465 _enhance: function() { 14466 this.uiSpinner = this.element 14467 .attr( "autocomplete", "off" ) 14468 .wrap( "<span>" ) 14469 .parent() 14470 14471 // Add buttons 14472 .append( 14473 "<a></a><a></a>" 14474 ); 14475 }, 14476 14477 _draw: function() { 14478 this._enhance(); 14479 14480 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 14481 this._addClass( "ui-spinner-input" ); 14482 14483 this.element.attr( "role", "spinbutton" ); 14484 14485 // Button bindings 14486 this.buttons = this.uiSpinner.children( "a" ) 14487 .attr( "tabIndex", -1 ) 14488 .attr( "aria-hidden", true ) 14489 .button( { 14490 classes: { 14491 "ui-button": "" 14492 } 14493 } ); 14494 14495 // TODO: Right now button does not support classes this is already updated in button PR 14496 this._removeClass( this.buttons, "ui-corner-all" ); 14497 14498 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 14499 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 14500 this.buttons.first().button( { 14501 "icon": this.options.icons.up, 14502 "showLabel": false 14503 } ); 14504 this.buttons.last().button( { 14505 "icon": this.options.icons.down, 14506 "showLabel": false 14507 } ); 14508 14509 // IE 6 doesn't understand height: 50% for the buttons 14510 // unless the wrapper has an explicit height 14511 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 14512 this.uiSpinner.height() > 0 ) { 14513 this.uiSpinner.height( this.uiSpinner.height() ); 14514 } 14515 }, 14516 14517 _keydown: function( event ) { 14518 var options = this.options, 14519 keyCode = $.ui.keyCode; 14520 14521 switch ( event.keyCode ) { 14522 case keyCode.UP: 14523 this._repeat( null, 1, event ); 14524 return true; 14525 case keyCode.DOWN: 14526 this._repeat( null, -1, event ); 14527 return true; 14528 case keyCode.PAGE_UP: 14529 this._repeat( null, options.page, event ); 14530 return true; 14531 case keyCode.PAGE_DOWN: 14532 this._repeat( null, -options.page, event ); 14533 return true; 14534 } 14535 14536 return false; 14537 }, 14538 14539 _start: function( event ) { 14540 if ( !this.spinning && this._trigger( "start", event ) === false ) { 14541 return false; 14542 } 14543 14544 if ( !this.counter ) { 14545 this.counter = 1; 14546 } 14547 this.spinning = true; 14548 return true; 14549 }, 14550 14551 _repeat: function( i, steps, event ) { 14552 i = i || 500; 14553 14554 clearTimeout( this.timer ); 14555 this.timer = this._delay( function() { 14556 this._repeat( 40, steps, event ); 14557 }, i ); 14558 14559 this._spin( steps * this.options.step, event ); 14560 }, 14561 14562 _spin: function( step, event ) { 14563 var value = this.value() || 0; 14564 14565 if ( !this.counter ) { 14566 this.counter = 1; 14567 } 14568 14569 value = this._adjustValue( value + step * this._increment( this.counter ) ); 14570 14571 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 14572 this._value( value ); 14573 this.counter++; 14574 } 14575 }, 14576 14577 _increment: function( i ) { 14578 var incremental = this.options.incremental; 14579 14580 if ( incremental ) { 14581 return typeof incremental === "function" ? 14582 incremental( i ) : 14583 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 14584 } 14585 14586 return 1; 14587 }, 14588 14589 _precision: function() { 14590 var precision = this._precisionOf( this.options.step ); 14591 if ( this.options.min !== null ) { 14592 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 14593 } 14594 return precision; 14595 }, 14596 14597 _precisionOf: function( num ) { 14598 var str = num.toString(), 14599 decimal = str.indexOf( "." ); 14600 return decimal === -1 ? 0 : str.length - decimal - 1; 14601 }, 14602 14603 _adjustValue: function( value ) { 14604 var base, aboveMin, 14605 options = this.options; 14606 14607 // Make sure we're at a valid step 14608 // - find out where we are relative to the base (min or 0) 14609 base = options.min !== null ? options.min : 0; 14610 aboveMin = value - base; 14611 14612 // - round to the nearest step 14613 aboveMin = Math.round( aboveMin / options.step ) * options.step; 14614 14615 // - rounding is based on 0, so adjust back to our base 14616 value = base + aboveMin; 14617 14618 // Fix precision from bad JS floating point math 14619 value = parseFloat( value.toFixed( this._precision() ) ); 14620 14621 // Clamp the value 14622 if ( options.max !== null && value > options.max ) { 14623 return options.max; 14624 } 14625 if ( options.min !== null && value < options.min ) { 14626 return options.min; 14627 } 14628 14629 return value; 14630 }, 14631 14632 _stop: function( event ) { 14633 if ( !this.spinning ) { 14634 return; 14635 } 14636 14637 clearTimeout( this.timer ); 14638 clearTimeout( this.mousewheelTimer ); 14639 this.counter = 0; 14640 this.spinning = false; 14641 this._trigger( "stop", event ); 14642 }, 14643 14644 _setOption: function( key, value ) { 14645 var prevValue, first, last; 14646 14647 if ( key === "culture" || key === "numberFormat" ) { 14648 prevValue = this._parse( this.element.val() ); 14649 this.options[ key ] = value; 14650 this.element.val( this._format( prevValue ) ); 14651 return; 14652 } 14653 14654 if ( key === "max" || key === "min" || key === "step" ) { 14655 if ( typeof value === "string" ) { 14656 value = this._parse( value ); 14657 } 14658 } 14659 if ( key === "icons" ) { 14660 first = this.buttons.first().find( ".ui-icon" ); 14661 this._removeClass( first, null, this.options.icons.up ); 14662 this._addClass( first, null, value.up ); 14663 last = this.buttons.last().find( ".ui-icon" ); 14664 this._removeClass( last, null, this.options.icons.down ); 14665 this._addClass( last, null, value.down ); 14666 } 14667 14668 this._super( key, value ); 14669 }, 14670 14671 _setOptionDisabled: function( value ) { 14672 this._super( value ); 14673 14674 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 14675 this.element.prop( "disabled", !!value ); 14676 this.buttons.button( value ? "disable" : "enable" ); 14677 }, 14678 14679 _setOptions: spinnerModifier( function( options ) { 14680 this._super( options ); 14681 } ), 14682 14683 _parse: function( val ) { 14684 if ( typeof val === "string" && val !== "" ) { 14685 val = window.Globalize && this.options.numberFormat ? 14686 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 14687 } 14688 return val === "" || isNaN( val ) ? null : val; 14689 }, 14690 14691 _format: function( value ) { 14692 if ( value === "" ) { 14693 return ""; 14694 } 14695 return window.Globalize && this.options.numberFormat ? 14696 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 14697 value; 14698 }, 14699 14700 _refresh: function() { 14701 this.element.attr( { 14702 "aria-valuemin": this.options.min, 14703 "aria-valuemax": this.options.max, 14704 14705 // TODO: what should we do with values that can't be parsed? 14706 "aria-valuenow": this._parse( this.element.val() ) 14707 } ); 14708 }, 14709 14710 isValid: function() { 14711 var value = this.value(); 14712 14713 // Null is invalid 14714 if ( value === null ) { 14715 return false; 14716 } 14717 14718 // If value gets adjusted, it's invalid 14719 return value === this._adjustValue( value ); 14720 }, 14721 14722 // Update the value without triggering change 14723 _value: function( value, allowAny ) { 14724 var parsed; 14725 if ( value !== "" ) { 14726 parsed = this._parse( value ); 14727 if ( parsed !== null ) { 14728 if ( !allowAny ) { 14729 parsed = this._adjustValue( parsed ); 14730 } 14731 value = this._format( parsed ); 14732 } 14733 } 14734 this.element.val( value ); 14735 this._refresh(); 14736 }, 14737 14738 _destroy: function() { 14739 this.element 14740 .prop( "disabled", false ) 14741 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 14742 14743 this.uiSpinner.replaceWith( this.element ); 14744 }, 14745 14746 stepUp: spinnerModifier( function( steps ) { 14747 this._stepUp( steps ); 14748 } ), 14749 _stepUp: function( steps ) { 14750 if ( this._start() ) { 14751 this._spin( ( steps || 1 ) * this.options.step ); 14752 this._stop(); 14753 } 14754 }, 14755 14756 stepDown: spinnerModifier( function( steps ) { 14757 this._stepDown( steps ); 14758 } ), 14759 _stepDown: function( steps ) { 14760 if ( this._start() ) { 14761 this._spin( ( steps || 1 ) * -this.options.step ); 14762 this._stop(); 14763 } 14764 }, 14765 14766 pageUp: spinnerModifier( function( pages ) { 14767 this._stepUp( ( pages || 1 ) * this.options.page ); 14768 } ), 14769 14770 pageDown: spinnerModifier( function( pages ) { 14771 this._stepDown( ( pages || 1 ) * this.options.page ); 14772 } ), 14773 14774 value: function( newVal ) { 14775 if ( !arguments.length ) { 14776 return this._parse( this.element.val() ); 14777 } 14778 spinnerModifier( this._value ).call( this, newVal ); 14779 }, 14780 14781 widget: function() { 14782 return this.uiSpinner; 14783 } 14784} ); 14785 14786// DEPRECATED 14787// TODO: switch return back to widget declaration at top of file when this is removed 14788if ( $.uiBackCompat === true ) { 14789 14790 // Backcompat for spinner html extension points 14791 $.widget( "ui.spinner", $.ui.spinner, { 14792 _enhance: function() { 14793 this.uiSpinner = this.element 14794 .attr( "autocomplete", "off" ) 14795 .wrap( this._uiSpinnerHtml() ) 14796 .parent() 14797 14798 // Add buttons 14799 .append( this._buttonHtml() ); 14800 }, 14801 _uiSpinnerHtml: function() { 14802 return "<span>"; 14803 }, 14804 14805 _buttonHtml: function() { 14806 return "<a></a><a></a>"; 14807 } 14808 } ); 14809} 14810 14811var widgetsSpinner = $.ui.spinner; 14812 14813 14814/*! 14815 * jQuery UI Tabs 1.14.
vendor: 7,978 bytes, lines 14815-15126
148150 14816 * https://jqueryui.com 14817 * 14818 * Copyright OpenJS Foundation and other contributors 14819 * Released under the MIT license. 14820 * https://jquery.org/license 14821 */ 14822 14823//>>label: Tabs 14824//>>group: Widgets 14825//>>description: Transforms a set of container elements into a tab structure. 14826//>>docs: https://api.jqueryui.com/tabs/ 14827//>>demos: https://jqueryui.com/tabs/ 14828//>>css.structure: ../../themes/base/core.css 14829//>>css.structure: ../../themes/base/tabs.css 14830//>>css.theme: ../../themes/base/theme.css 14831 14832 14833$.widget( "ui.tabs", { 14834 version: "1.14.0", 14835 delay: 300, 14836 options: { 14837 active: null, 14838 classes: { 14839 "ui-tabs": "ui-corner-all", 14840 "ui-tabs-nav": "ui-corner-all", 14841 "ui-tabs-panel": "ui-corner-bottom", 14842 "ui-tabs-tab": "ui-corner-top" 14843 }, 14844 collapsible: false, 14845 event: "click", 14846 heightStyle: "content", 14847 hide: null, 14848 show: null, 14849 14850 // Callbacks 14851 activate: null, 14852 beforeActivate: null, 14853 beforeLoad: null, 14854 load: null 14855 }, 14856 14857 _isLocal: ( function() { 14858 var rhash = /#.*$/; 14859 14860 return function( anchor ) { 14861 var anchorUrl, locationUrl; 14862 14863 anchorUrl = anchor.href.replace( rhash, "" ); 14864 locationUrl = location.href.replace( rhash, "" ); 14865 14866 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 14867 try { 14868 anchorUrl = decodeURIComponent( anchorUrl ); 14869 } catch ( error ) {} 14870 try { 14871 locationUrl = decodeURIComponent( locationUrl ); 14872 } catch ( error ) {} 14873 14874 return anchor.hash.length > 1 && anchorUrl === locationUrl; 14875 }; 14876 } )(), 14877 14878 _create: function() { 14879 var that = this, 14880 options = this.options; 14881 14882 this.running = false; 14883 14884 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 14885 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 14886 14887 this._processTabs(); 14888 options.active = this._initialActive(); 14889 14890 // Take disabling tabs via class attribute from HTML 14891 // into account and update option properly. 14892 if ( Array.isArray( options.disabled ) ) { 14893 options.disabled = $.uniqueSort( options.disabled.concat( 14894 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 14895 return that.tabs.index( li ); 14896 } ) 14897 ) ).sort(); 14898 } 14899 14900 // Check for length avoids error when initializing empty list 14901 if ( this.options.active !== false && this.anchors.length ) { 14902 this.active = this._findActive( options.active ); 14903 } else { 14904 this.active = $(); 14905 } 14906 14907 this._refresh(); 14908 14909 if ( this.active.length ) { 14910 this.load( options.active ); 14911 } 14912 }, 14913 14914 _initialActive: function() { 14915 var active = this.options.active, 14916 collapsible = this.options.collapsible, 14917 locationHash = location.hash.substring( 1 ); 14918 14919 if ( active === null ) { 14920 14921 // check the fragment identifier in the URL 14922 if ( locationHash ) { 14923 this.tabs.each( function( i, tab ) { 14924 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 14925 active = i; 14926 return false; 14927 } 14928 } ); 14929 } 14930 14931 // Check for a tab marked active via a class 14932 if ( active === null ) { 14933 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 14934 } 14935 14936 // No active tab, set to false 14937 if ( active === null || active === -1 ) { 14938 active = this.tabs.length ? 0 : false; 14939 } 14940 } 14941 14942 // Handle numbers: negative, out of range 14943 if ( active !== false ) { 14944 active = this.tabs.index( this.tabs.eq( active ) ); 14945 if ( active === -1 ) { 14946 active = collapsible ? false : 0; 14947 } 14948 } 14949 14950 // Don't allow collapsible: false and active: false 14951 if ( !collapsible && active === false && this.anchors.length ) { 14952 active = 0; 14953 } 14954 14955 return active; 14956 }, 14957 14958 _getCreateEventData: function() { 14959 return { 14960 tab: this.active, 14961 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 14962 }; 14963 }, 14964 14965 _tabKeydown: function( event ) { 14966 var focusedTab = $( this.document[ 0 ].activeElement ).closest( "li" ), 14967 selectedIndex = this.tabs.index( focusedTab ), 14968 goingForward = true; 14969 14970 if ( this._handlePageNav( event ) ) { 14971 return; 14972 } 14973 14974 switch ( event.keyCode ) { 14975 case $.ui.keyCode.RIGHT: 14976 case $.ui.keyCode.DOWN: 14977 selectedIndex++; 14978 break; 14979 case $.ui.keyCode.UP: 14980 case $.ui.keyCode.LEFT: 14981 goingForward = false; 14982 selectedIndex--; 14983 break; 14984 case $.ui.keyCode.END: 14985 selectedIndex = this.anchors.length - 1; 14986 break; 14987 case $.ui.keyCode.HOME: 14988 selectedIndex = 0; 14989 break; 14990 case $.ui.keyCode.SPACE: 14991 14992 // Activate only, no collapsing 14993 event.preventDefault(); 14994 clearTimeout( this.activating ); 14995 this._activate( selectedIndex ); 14996 return; 14997 case $.ui.keyCode.ENTER: 14998 14999 // Toggle (cancel delayed activation, allow collapsing) 15000 event.preventDefault(); 15001 clearTimeout( this.activating ); 15002 15003 // Determine if we should collapse or activate 15004 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 15005 return; 15006 default: 15007 return; 15008 } 15009 15010 // Focus the appropriate tab, based on which key was pressed 15011 event.preventDefault(); 15012 clearTimeout( this.activating ); 15013 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 15014 15015 // Navigating with control/command key will prevent automatic activation 15016 if ( !event.ctrlKey && !event.metaKey ) { 15017 15018 // Update aria-selected immediately so that AT think the tab is already selected. 15019 // Otherwise AT may confuse the user by stating that they need to activate the tab, 15020 // but the tab will already be activated by the time the announcement finishes. 15021 focusedTab.attr( "aria-selected", "false" ); 15022 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 15023 15024 this.activating = this._delay( function() { 15025 this.option( "active", selectedIndex ); 15026 }, this.delay ); 15027 } 15028 }, 15029 15030 _panelKeydown: function( event ) { 15031 if ( this._handlePageNav( event ) ) { 15032 return; 15033 } 15034 15035 // Ctrl+up moves focus to the current tab 15036 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 15037 event.preventDefault(); 15038 this.active.trigger( "focus" ); 15039 } 15040 }, 15041 15042 // Alt+page up/down moves focus to the previous/next tab (and activates) 15043 _handlePageNav: function( event ) { 15044 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 15045 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 15046 return true; 15047 } 15048 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 15049 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 15050 return true; 15051 } 15052 }, 15053 15054 _findNextTab: function( index, goingForward ) { 15055 var lastTabIndex = this.tabs.length - 1; 15056 15057 function constrain() { 15058 if ( index > lastTabIndex ) { 15059 index = 0; 15060 } 15061 if ( index < 0 ) { 15062 index = lastTabIndex; 15063 } 15064 return index; 15065 } 15066 15067 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 15068 index = goingForward ? index + 1 : index - 1; 15069 } 15070 15071 return index; 15072 }, 15073 15074 _focusNextTab: function( index, goingForward ) { 15075 index = this._findNextTab( index, goingForward ); 15076 this.tabs.eq( index ).trigger( "focus" ); 15077 return index; 15078 }, 15079 15080 _setOption: function( key, value ) { 15081 if ( key === "active" ) { 15082 15083 // _activate() will handle invalid values and update this.options 15084 this._activate( value ); 15085 return; 15086 } 15087 15088 this._super( key, value ); 15089 15090 if ( key === "collapsible" ) { 15091 this._toggleClass( "ui-tabs-collapsible", null, value ); 15092 15093 // Setting collapsible: false while collapsed; open first panel 15094 if ( !value && this.options.active === false ) { 15095 this._activate( 0 ); 15096 } 15097 } 15098 15099 if ( key === "event" ) { 15100 this._setupEvents( value ); 15101 } 15102 15103 if ( key === "heightStyle" ) { 15104 this._setupHeightStyle( value ); 15105 } 15106 }, 15107 15108 _sanitizeSelector: function( hash ) { 15109 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 15110 }, 15111 15112 refresh: function() { 15113 var options = this.options, 15114 lis = this.tablist.children( ":has(a[href])" ); 15115 15116 // Get disabled tabs from class attribute from HTML 15117 // this will get converted to a boolean if needed in _refresh() 15118 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 15119 return lis.index( tab ); 15120 } ); 15121 15122 this._processTabs(); 15123 15124 // Was collapsed or no tabs 15125 if ( options.active === false || !this.anchors.length ) { 15126 options.active = false;
vendor: 4,230 bytes, lines 15127-15287
15127 this.active = $(); 15128 15129 // was active, but active tab is gone 15130 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 15131 15132 // all remaining tabs are disabled 15133 if ( this.tabs.length === options.disabled.length ) { 15134 options.active = false; 15135 this.active = $(); 15136 15137 // activate previous tab 15138 } else { 15139 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 15140 } 15141 15142 // was active, active tab still exists 15143 } else { 15144 15145 // make sure active index is correct 15146 options.active = this.tabs.index( this.active ); 15147 } 15148 15149 this._refresh(); 15150 }, 15151 15152 _refresh: function() { 15153 this._setOptionDisabled( this.options.disabled ); 15154 this._setupEvents( this.options.event ); 15155 this._setupHeightStyle( this.options.heightStyle ); 15156 15157 this.tabs.not( this.active ).attr( { 15158 "aria-selected": "false", 15159 "aria-expanded": "false", 15160 tabIndex: -1 15161 } ); 15162 this.panels.not( this._getPanelForTab( this.active ) ) 15163 .hide() 15164 .attr( { 15165 "aria-hidden": "true" 15166 } ); 15167 15168 // Make sure one tab is in the tab order 15169 if ( !this.active.length ) { 15170 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 15171 } else { 15172 this.active 15173 .attr( { 15174 "aria-selected": "true", 15175 "aria-expanded": "true", 15176 tabIndex: 0 15177 } ); 15178 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 15179 this._getPanelForTab( this.active ) 15180 .show() 15181 .attr( { 15182 "aria-hidden": "false" 15183 } ); 15184 } 15185 }, 15186 15187 _processTabs: function() { 15188 var that = this, 15189 prevTabs = this.tabs, 15190 prevAnchors = this.anchors, 15191 prevPanels = this.panels; 15192 15193 this.tablist = this._getList().attr( "role", "tablist" ); 15194 this._addClass( this.tablist, "ui-tabs-nav", 15195 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 15196 15197 // Prevent users from focusing disabled tabs via click 15198 this.tablist 15199 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 15200 if ( $( this ).is( ".ui-state-disabled" ) ) { 15201 event.preventDefault(); 15202 } 15203 } ); 15204 15205 this.tabs = this.tablist.find( "> li:has(a[href])" ) 15206 .attr( { 15207 role: "tab", 15208 tabIndex: -1 15209 } ); 15210 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 15211 15212 this.anchors = this.tabs.map( function() { 15213 return $( "a", this )[ 0 ]; 15214 } ) 15215 .attr( { 15216 tabIndex: -1 15217 } ); 15218 this._addClass( this.anchors, "ui-tabs-anchor" ); 15219 15220 this.panels = $(); 15221 15222 this.anchors.each( function( i, anchor ) { 15223 var selector, panel, panelId, 15224 anchorId = $( anchor ).uniqueId().attr( "id" ), 15225 tab = $( anchor ).closest( "li" ), 15226 originalAriaControls = tab.attr( "aria-controls" ); 15227 15228 // Inline tab 15229 if ( that._isLocal( anchor ) ) { 15230 selector = anchor.hash; 15231 panelId = selector.substring( 1 ); 15232 panel = that.element.find( that._sanitizeSelector( selector ) ); 15233 15234 // remote tab 15235 } else { 15236 15237 // If the tab doesn't already have aria-controls, 15238 // generate an id by using a throw-away element 15239 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 15240 selector = "#" + panelId; 15241 panel = that.element.find( selector ); 15242 if ( !panel.length ) { 15243 panel = that._createPanel( panelId ); 15244 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 15245 } 15246 panel.attr( "aria-live", "polite" ); 15247 } 15248 15249 if ( panel.length ) { 15250 that.panels = that.panels.add( panel ); 15251 } 15252 if ( originalAriaControls ) { 15253 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 15254 } 15255 tab.attr( { 15256 "aria-controls": panelId, 15257 "aria-labelledby": anchorId 15258 } ); 15259 panel.attr( "aria-labelledby", anchorId ); 15260 } ); 15261 15262 this.panels.attr( "role", "tabpanel" ); 15263 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 15264 15265 // Avoid memory leaks (#10056) 15266 if ( prevTabs ) { 15267 this._off( prevTabs.not( this.tabs ) ); 15268 this._off( prevAnchors.not( this.anchors ) ); 15269 this._off( prevPanels.not( this.panels ) ); 15270 } 15271 }, 15272 15273 // Allow overriding how to find the list for rare usage scenarios (#7715) 15274 _getList: function() { 15275 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 15276 }, 15277 15278 _createPanel: function( id ) { 15279 return $( "<div>" ) 15280 .attr( "id", id ) 15281 .data( "ui-tabs-destroy", true ); 15282 }, 15283 15284 _setOptionDisabled: function( disabled ) { 15285 var currentItem, li, i; 15286 15287 if ( Array
vendor: 6,222 bytes, lines 15287-15518
15287.isArray( disabled ) ) { 15288 if ( !disabled.length ) { 15289 disabled = false; 15290 } else if ( disabled.length === this.anchors.length ) { 15291 disabled = true; 15292 } 15293 } 15294 15295 // Disable tabs 15296 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 15297 currentItem = $( li ); 15298 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 15299 currentItem.attr( "aria-disabled", "true" ); 15300 this._addClass( currentItem, null, "ui-state-disabled" ); 15301 } else { 15302 currentItem.removeAttr( "aria-disabled" ); 15303 this._removeClass( currentItem, null, "ui-state-disabled" ); 15304 } 15305 } 15306 15307 this.options.disabled = disabled; 15308 15309 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 15310 disabled === true ); 15311 }, 15312 15313 _setupEvents: function( event ) { 15314 var events = {}; 15315 if ( event ) { 15316 $.each( event.split( " " ), function( index, eventName ) { 15317 events[ eventName ] = "_eventHandler"; 15318 } ); 15319 } 15320 15321 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 15322 15323 // Always prevent the default action, even when disabled 15324 this._on( true, this.anchors, { 15325 click: function( event ) { 15326 event.preventDefault(); 15327 } 15328 } ); 15329 this._on( this.anchors, events ); 15330 this._on( this.tabs, { keydown: "_tabKeydown" } ); 15331 this._on( this.panels, { keydown: "_panelKeydown" } ); 15332 15333 this._focusable( this.tabs ); 15334 this._hoverable( this.tabs ); 15335 }, 15336 15337 _setupHeightStyle: function( heightStyle ) { 15338 var maxHeight, 15339 parent = this.element.parent(); 15340 15341 if ( heightStyle === "fill" ) { 15342 maxHeight = parent.height(); 15343 maxHeight -= this.element.outerHeight() - this.element.height(); 15344 15345 this.element.siblings( ":visible" ).each( function() { 15346 var elem = $( this ), 15347 position = elem.css( "position" ); 15348 15349 if ( position === "absolute" || position === "fixed" ) { 15350 return; 15351 } 15352 maxHeight -= elem.outerHeight( true ); 15353 } ); 15354 15355 this.element.children().not( this.panels ).each( function() { 15356 maxHeight -= $( this ).outerHeight( true ); 15357 } ); 15358 15359 this.panels.each( function() { 15360 $( this ).height( Math.max( 0, maxHeight - 15361 $( this ).innerHeight() + $( this ).height() ) ); 15362 } ) 15363 .css( "overflow", "auto" ); 15364 } else if ( heightStyle === "auto" ) { 15365 maxHeight = 0; 15366 this.panels.each( function() { 15367 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 15368 } ).height( maxHeight ); 15369 } 15370 }, 15371 15372 _eventHandler: function( event ) { 15373 var options = this.options, 15374 active = this.active, 15375 anchor = $( event.currentTarget ), 15376 tab = anchor.closest( "li" ), 15377 clickedIsActive = tab[ 0 ] === active[ 0 ], 15378 collapsing = clickedIsActive && options.collapsible, 15379 toShow = collapsing ? $() : this._getPanelForTab( tab ), 15380 toHide = !active.length ? $() : this._getPanelForTab( active ), 15381 eventData = { 15382 oldTab: active, 15383 oldPanel: toHide, 15384 newTab: collapsing ? $() : tab, 15385 newPanel: toShow 15386 }; 15387 15388 event.preventDefault(); 15389 15390 if ( tab.hasClass( "ui-state-disabled" ) || 15391 15392 // tab is already loading 15393 tab.hasClass( "ui-tabs-loading" ) || 15394 15395 // can't switch durning an animation 15396 this.running || 15397 15398 // click on active header, but not collapsible 15399 ( clickedIsActive && !options.collapsible ) || 15400 15401 // allow canceling activation 15402 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 15403 return; 15404 } 15405 15406 options.active = collapsing ? false : this.tabs.index( tab ); 15407 15408 this.active = clickedIsActive ? $() : tab; 15409 if ( this.xhr ) { 15410 this.xhr.abort(); 15411 } 15412 15413 if ( !toHide.length && !toShow.length ) { 15414 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 15415 } 15416 15417 if ( toShow.length ) { 15418 this.load( this.tabs.index( tab ), event ); 15419 } 15420 this._toggle( event, eventData ); 15421 }, 15422 15423 // Handles show/hide for selecting tabs 15424 _toggle: function( event, eventData ) { 15425 var that = this, 15426 toShow = eventData.newPanel, 15427 toHide = eventData.oldPanel; 15428 15429 this.running = true; 15430 15431 function complete() { 15432 that.running = false; 15433 that._trigger( "activate", event, eventData ); 15434 } 15435 15436 function show() { 15437 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 15438 15439 if ( toShow.length && that.options.show ) { 15440 that._show( toShow, that.options.show, complete ); 15441 } else { 15442 toShow.show(); 15443 complete(); 15444 } 15445 } 15446 15447 // Start out by hiding, then showing, then completing 15448 if ( toHide.length && this.options.hide ) { 15449 this._hide( toHide, this.options.hide, function() { 15450 that._removeClass( eventData.oldTab.closest( "li" ), 15451 "ui-tabs-active", "ui-state-active" ); 15452 show(); 15453 } ); 15454 } else { 15455 this._removeClass( eventData.oldTab.closest( "li" ), 15456 "ui-tabs-active", "ui-state-active" ); 15457 toHide.hide(); 15458 show(); 15459 } 15460 15461 toHide.attr( "aria-hidden", "true" ); 15462 eventData.oldTab.attr( { 15463 "aria-selected": "false", 15464 "aria-expanded": "false" 15465 } ); 15466 15467 // If we're switching tabs, remove the old tab from the tab order. 15468 // If we're opening from collapsed state, remove the previous tab from the tab order. 15469 // If we're collapsing, then keep the collapsing tab in the tab order. 15470 if ( toShow.length && toHide.length ) { 15471 eventData.oldTab.attr( "tabIndex", -1 ); 15472 } else if ( toShow.length ) { 15473 this.tabs.filter( function() { 15474 return $( this ).attr( "tabIndex" ) === 0; 15475 } ) 15476 .attr( "tabIndex", -1 ); 15477 } 15478 15479 toShow.attr( "aria-hidden", "false" ); 15480 eventData.newTab.attr( { 15481 "aria-selected": "true", 15482 "aria-expanded": "true", 15483 tabIndex: 0 15484 } ); 15485 }, 15486 15487 _activate: function( index ) { 15488 var anchor, 15489 active = this._findActive( index ); 15490 15491 // Trying to activate the already active panel 15492 if ( active[ 0 ] === this.active[ 0 ] ) { 15493 return; 15494 } 15495 15496 // Trying to collapse, simulate a click on the current active header 15497 if ( !active.length ) { 15498 active = this.active; 15499 } 15500 15501 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 15502 this._eventHandler( { 15503 target: anchor, 15504 currentTarget: anchor, 15505 preventDefault: $.noop 15506 } ); 15507 }, 15508 15509 _findActive: function( index ) { 15510 return index === false ? $() : this.tabs.eq( index ); 15511 }, 15512 15513 _getIndex: function( index ) { 15514 15515 // meta-function to give users option to provide a href string instead of a numerical index. 15516 if ( typeof index === "string" ) { 15517 index = this.anchors.index( this.anchors.filter( "[href$='" + 15518
vendor: 17,749 bytes, lines 15518-16188
15518CSS.escape( index ) + "']" ) ); 15519 } 15520 15521 return index; 15522 }, 15523 15524 _destroy: function() { 15525 if ( this.xhr ) { 15526 this.xhr.abort(); 15527 } 15528 15529 this.tablist 15530 .removeAttr( "role" ) 15531 .off( this.eventNamespace ); 15532 15533 this.anchors 15534 .removeAttr( "role tabIndex" ) 15535 .removeUniqueId(); 15536 15537 this.tabs.add( this.panels ).each( function() { 15538 if ( $.data( this, "ui-tabs-destroy" ) ) { 15539 $( this ).remove(); 15540 } else { 15541 $( this ).removeAttr( "role tabIndex " + 15542 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 15543 } 15544 } ); 15545 15546 this.tabs.each( function() { 15547 var li = $( this ), 15548 prev = li.data( "ui-tabs-aria-controls" ); 15549 if ( prev ) { 15550 li 15551 .attr( "aria-controls", prev ) 15552 .removeData( "ui-tabs-aria-controls" ); 15553 } else { 15554 li.removeAttr( "aria-controls" ); 15555 } 15556 } ); 15557 15558 this.panels.show(); 15559 15560 if ( this.options.heightStyle !== "content" ) { 15561 this.panels.css( "height", "" ); 15562 } 15563 }, 15564 15565 enable: function( index ) { 15566 var disabled = this.options.disabled; 15567 if ( disabled === false ) { 15568 return; 15569 } 15570 15571 if ( index === undefined ) { 15572 disabled = false; 15573 } else { 15574 index = this._getIndex( index ); 15575 if ( Array.isArray( disabled ) ) { 15576 disabled = $.map( disabled, function( num ) { 15577 return num !== index ? num : null; 15578 } ); 15579 } else { 15580 disabled = $.map( this.tabs, function( li, num ) { 15581 return num !== index ? num : null; 15582 } ); 15583 } 15584 } 15585 this._setOptionDisabled( disabled ); 15586 }, 15587 15588 disable: function( index ) { 15589 var disabled = this.options.disabled; 15590 if ( disabled === true ) { 15591 return; 15592 } 15593 15594 if ( index === undefined ) { 15595 disabled = true; 15596 } else { 15597 index = this._getIndex( index ); 15598 if ( $.inArray( index, disabled ) !== -1 ) { 15599 return; 15600 } 15601 if ( Array.isArray( disabled ) ) { 15602 disabled = $.merge( [ index ], disabled ).sort(); 15603 } else { 15604 disabled = [ index ]; 15605 } 15606 } 15607 this._setOptionDisabled( disabled ); 15608 }, 15609 15610 load: function( index, event ) { 15611 index = this._getIndex( index ); 15612 var that = this, 15613 tab = this.tabs.eq( index ), 15614 anchor = tab.find( ".ui-tabs-anchor" ), 15615 panel = this._getPanelForTab( tab ), 15616 eventData = { 15617 tab: tab, 15618 panel: panel 15619 }, 15620 complete = function( jqXHR, status ) { 15621 if ( status === "abort" ) { 15622 that.panels.stop( false, true ); 15623 } 15624 15625 that._removeClass( tab, "ui-tabs-loading" ); 15626 panel.removeAttr( "aria-busy" ); 15627 15628 if ( jqXHR === that.xhr ) { 15629 delete that.xhr; 15630 } 15631 }; 15632 15633 // Not remote 15634 if ( this._isLocal( anchor[ 0 ] ) ) { 15635 return; 15636 } 15637 15638 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 15639 15640 if ( this.xhr.statusText !== "canceled" ) { 15641 this._addClass( tab, "ui-tabs-loading" ); 15642 panel.attr( "aria-busy", "true" ); 15643 15644 this.xhr 15645 .done( function( response, status, jqXHR ) { 15646 panel.html( response ); 15647 that._trigger( "load", event, eventData ); 15648 15649 complete( jqXHR, status ); 15650 } ) 15651 .fail( function( jqXHR, status ) { 15652 complete( jqXHR, status ); 15653 } ); 15654 } 15655 }, 15656 15657 _ajaxSettings: function( anchor, event, eventData ) { 15658 var that = this; 15659 return { 15660 url: anchor.attr( "href" ), 15661 beforeSend: function( jqXHR, settings ) { 15662 return that._trigger( "beforeLoad", event, 15663 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 15664 } 15665 }; 15666 }, 15667 15668 _getPanelForTab: function( tab ) { 15669 var id = $( tab ).attr( "aria-controls" ); 15670 return this.element.find( this._sanitizeSelector( "#" + id ) ); 15671 } 15672} ); 15673 15674// DEPRECATED 15675// TODO: Switch return back to widget declaration at top of file when this is removed 15676if ( $.uiBackCompat === true ) { 15677 15678 // Backcompat for ui-tab class (now ui-tabs-tab) 15679 $.widget( "ui.tabs", $.ui.tabs, { 15680 _processTabs: function() { 15681 this._superApply( arguments ); 15682 this._addClass( this.tabs, "ui-tab" ); 15683 } 15684 } ); 15685} 15686 15687var widgetsTabs = $.ui.tabs; 15688 15689 15690/*! 15691 * jQuery UI Tooltip 1.14.0 15692 * https://jqueryui.com 15693 * 15694 * Copyright OpenJS Foundation and other contributors 15695 * Released under the MIT license. 15696 * https://jquery.org/license 15697 */ 15698 15699//>>label: Tooltip 15700//>>group: Widgets 15701//>>description: Shows additional information for any element on hover or focus. 15702//>>docs: https://api.jqueryui.com/tooltip/ 15703//>>demos: https://jqueryui.com/tooltip/ 15704//>>css.structure: ../../themes/base/core.css 15705//>>css.structure: ../../themes/base/tooltip.css 15706//>>css.theme: ../../themes/base/theme.css 15707 15708 15709$.widget( "ui.tooltip", { 15710 version: "1.14.0", 15711 options: { 15712 classes: { 15713 "ui-tooltip": "ui-corner-all ui-widget-shadow" 15714 }, 15715 content: function() { 15716 var title = $( this ).attr( "title" ); 15717 15718 // Escape title, since we're going from an attribute to raw HTML 15719 return $( "<a>" ).text( title ).html(); 15720 }, 15721 hide: true, 15722 15723 // Disabled elements have inconsistent behavior across browsers (#8661) 15724 items: "[title]:not([disabled])", 15725 position: { 15726 my: "left top+15", 15727 at: "left bottom", 15728 collision: "flipfit flip" 15729 }, 15730 show: true, 15731 track: false, 15732 15733 // Callbacks 15734 close: null, 15735 open: null 15736 }, 15737 15738 _addDescribedBy: function( elem, id ) { 15739 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 15740 describedby.push( id ); 15741 elem 15742 .data( "ui-tooltip-id", id ) 15743 .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) ); 15744 }, 15745 15746 _removeDescribedBy: function( elem ) { 15747 var id = elem.data( "ui-tooltip-id" ), 15748 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 15749 index = $.inArray( id, describedby ); 15750 15751 if ( index !== -1 ) { 15752 describedby.splice( index, 1 ); 15753 } 15754 15755 elem.removeData( "ui-tooltip-id" ); 15756 describedby = String.prototype.trim.call( describedby.join( " " ) ); 15757 if ( describedby ) { 15758 elem.attr( "aria-describedby", describedby ); 15759 } else { 15760 elem.removeAttr( "aria-describedby" ); 15761 } 15762 }, 15763 15764 _create: function() { 15765 this._on( { 15766 mouseover: "open", 15767 focusin: "open" 15768 } ); 15769 15770 // IDs of generated tooltips, needed for destroy 15771 this.tooltips = {}; 15772 15773 // IDs of parent tooltips where we removed the title attribute 15774 this.parents = {}; 15775 15776 // Append the aria-live region so tooltips announce correctly 15777 this.liveRegion = $( "<div>" ) 15778 .attr( { 15779 role: "log", 15780 "aria-live": "assertive", 15781 "aria-relevant": "additions" 15782 } ) 15783 .appendTo( this.document[ 0 ].body ); 15784 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 15785 15786 this.disabledTitles = $( [] ); 15787 }, 15788 15789 _setOption: function( key, value ) { 15790 var that = this; 15791 15792 this._super( key, value ); 15793 15794 if ( key === "content" ) { 15795 $.each( this.tooltips, function( id, tooltipData ) { 15796 that._updateContent( tooltipData.element ); 15797 } ); 15798 } 15799 }, 15800 15801 _setOptionDisabled: function( value ) { 15802 this[ value ? "_disable" : "_enable" ](); 15803 }, 15804 15805 _disable: function() { 15806 var that = this; 15807 15808 // Close open tooltips 15809 $.each( this.tooltips, function( id, tooltipData ) { 15810 var event = $.Event( "blur" ); 15811 event.target = event.currentTarget = tooltipData.element[ 0 ]; 15812 that.close( event, true ); 15813 } ); 15814 15815 // Remove title attributes to prevent native tooltips 15816 this.disabledTitles = this.disabledTitles.add( 15817 this.element.find( this.options.items ).addBack() 15818 .filter( function() { 15819 var element = $( this ); 15820 if ( element.is( "[title]" ) ) { 15821 return element 15822 .data( "ui-tooltip-title", element.attr( "title" ) ) 15823 .removeAttr( "title" ); 15824 } 15825 } ) 15826 ); 15827 }, 15828 15829 _enable: function() { 15830 15831 // restore title attributes 15832 this.disabledTitles.each( function() { 15833 var element = $( this ); 15834 if ( element.data( "ui-tooltip-title" ) ) { 15835 element.attr( "title", element.data( "ui-tooltip-title" ) ); 15836 } 15837 } ); 15838 this.disabledTitles = $( [] ); 15839 }, 15840 15841 open: function( event ) { 15842 var that = this, 15843 target = $( event ? event.target : this.element ) 15844 15845 // we need closest here due to mouseover bubbling, 15846 // but always pointing at the same event target 15847 .closest( this.options.items ); 15848 15849 // No element to show a tooltip for or the tooltip is already open 15850 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 15851 return; 15852 } 15853 15854 if ( target.attr( "title" ) ) { 15855 target.data( "ui-tooltip-title", target.attr( "title" ) ); 15856 } 15857 15858 target.data( "ui-tooltip-open", true ); 15859 15860 // Kill parent tooltips, custom or native, for hover 15861 if ( event && event.type === "mouseover" ) { 15862 target.parents().each( function() { 15863 var parent = $( this ), 15864 blurEvent; 15865 if ( parent.data( "ui-tooltip-open" ) ) { 15866 blurEvent = $.Event( "blur" ); 15867 blurEvent.target = blurEvent.currentTarget = this; 15868 that.close( blurEvent, true ); 15869 } 15870 if ( parent.attr( "title" ) ) { 15871 parent.uniqueId(); 15872 that.parents[ this.id ] = { 15873 element: this, 15874 title: parent.attr( "title" ) 15875 }; 15876 parent.attr( "title", "" ); 15877 } 15878 } ); 15879 } 15880 15881 this._registerCloseHandlers( event, target ); 15882 this._updateContent( target, event ); 15883 }, 15884 15885 _updateContent: function( target, event ) { 15886 var content, 15887 contentOption = this.options.content, 15888 that = this, 15889 eventType = event ? event.type : null; 15890 15891 if ( typeof contentOption === "string" || contentOption.nodeType || 15892 contentOption.jquery ) { 15893 return this._open( event, target, contentOption ); 15894 } 15895 15896 content = contentOption.call( target[ 0 ], function( response ) { 15897 15898 // Ignore async response if tooltip was closed already 15899 if ( !target.data( "ui-tooltip-open" ) ) { 15900 return; 15901 } 15902 15903 // JQuery creates a special event for focusin when it doesn't 15904 // exist natively. To improve performance, the native event 15905 // object is reused and the type is changed. Therefore, we can't 15906 // rely on the type being correct after the event finished 15907 // bubbling, so we set it back to the previous value. (#8740) 15908 if ( event ) { 15909 event.type = eventType; 15910 } 15911 that._open( event, target, response ); 15912 } ); 15913 if ( content ) { 15914 this._open( event, target, content ); 15915 } 15916 }, 15917 15918 _open: function( event, target, content ) { 15919 var tooltipData, tooltip, delayedShow, a11yContent, 15920 positionOption = $.extend( {}, this.options.position ); 15921 15922 if ( !content ) { 15923 return; 15924 } 15925 15926 // Content can be updated multiple times. If the tooltip already 15927 // exists, then just update the content and bail. 15928 tooltipData = this._find( target ); 15929 if ( tooltipData ) { 15930 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 15931 return; 15932 } 15933 15934 // If we have a title, clear it to prevent the native tooltip 15935 // we have to check first to avoid defining a title if none exists 15936 // (we don't want to cause an element to start matching [title]) 15937 // 15938 // We use removeAttr only for key events, to allow IE to export the correct 15939 // accessible attributes. For mouse events, set to empty string to avoid 15940 // native tooltip showing up (happens only when removing inside mouseover). 15941 if ( target.is( "[title]" ) ) { 15942 if ( event && event.type === "mouseover" ) { 15943 target.attr( "title", "" ); 15944 } else { 15945 target.removeAttr( "title" ); 15946 } 15947 } 15948 15949 tooltipData = this._tooltip( target ); 15950 tooltip = tooltipData.tooltip; 15951 this._addDescribedBy( target, tooltip.attr( "id" ) ); 15952 tooltip.find( ".ui-tooltip-content" ).html( content ); 15953 15954 // Support: Voiceover on OS X, JAWS on IE <= 9 15955 // JAWS announces deletions even when aria-relevant="additions" 15956 // Voiceover will sometimes re-read the entire log region's contents from the beginning 15957 this.liveRegion.children().hide(); 15958 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 15959 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 15960 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 15961 a11yContent.appendTo( this.liveRegion ); 15962 15963 function position( event ) { 15964 positionOption.of = event; 15965 if ( tooltip.is( ":hidden" ) ) { 15966 return; 15967 } 15968 tooltip.position( positionOption ); 15969 } 15970 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 15971 this._on( this.document, { 15972 mousemove: position 15973 } ); 15974 15975 // trigger once to override element-relative positioning 15976 position( event ); 15977 } else { 15978 tooltip.position( $.extend( { 15979 of: target 15980 }, this.options.position ) ); 15981 } 15982 15983 tooltip.hide(); 15984 15985 this._show( tooltip, this.options.show ); 15986 15987 // Handle tracking tooltips that are shown with a delay (#8644). As soon 15988 // as the tooltip is visible, position the tooltip using the most recent 15989 // event. 15990 // Adds the check to add the timers only when both delay and track options are set (#14682) 15991 if ( this.options.track && this.options.show && this.options.show.delay ) { 15992 delayedShow = this.delayedShow = setInterval( function() { 15993 if ( tooltip.is( ":visible" ) ) { 15994 position( positionOption.of ); 15995 clearInterval( delayedShow ); 15996 } 15997 }, 13 ); 15998 } 15999 16000 this._trigger( "open", event, { tooltip: tooltip } ); 16001 }, 16002 16003 _registerCloseHandlers: function( event, target ) { 16004 var events = { 16005 keyup: function( event ) { 16006 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 16007 var fakeEvent = $.Event( event ); 16008 fakeEvent.currentTarget = target[ 0 ]; 16009 this.close( fakeEvent, true ); 16010 } 16011 } 16012 }; 16013 16014 // Only bind remove handler for delegated targets. Non-delegated 16015 // tooltips will handle this in destroy. 16016 if ( target[ 0 ] !== this.element[ 0 ] ) { 16017 events.remove = function() { 16018 var targetElement = this._find( target ); 16019 if ( targetElement ) { 16020 this._removeTooltip( targetElement.tooltip ); 16021 } 16022 }; 16023 } 16024 16025 if ( !event || event.type === "mouseover" ) { 16026 events.mouseleave = "close"; 16027 } 16028 if ( !event || event.type === "focusin" ) { 16029 events.focusout = "close"; 16030 } 16031 this._on( true, target, events ); 16032 }, 16033 16034 close: function( event ) { 16035 var tooltip, 16036 that = this, 16037 target = $( event ? event.currentTarget : this.element ), 16038 tooltipData = this._find( target ); 16039 16040 // The tooltip may already be closed 16041 if ( !tooltipData ) { 16042 16043 // We set ui-tooltip-open immediately upon open (in open()), but only set the 16044 // additional data once there's actually content to show (in _open()). So even if the 16045 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 16046 // the period between open() and _open(). 16047 target.removeData( "ui-tooltip-open" ); 16048 return; 16049 } 16050 16051 tooltip = tooltipData.tooltip; 16052 16053 // Disabling closes the tooltip, so we need to track when we're closing 16054 // to avoid an infinite loop in case the tooltip becomes disabled on close 16055 if ( tooltipData.closing ) { 16056 return; 16057 } 16058 16059 // Clear the interval for delayed tracking tooltips 16060 clearInterval( this.delayedShow ); 16061 16062 // Only set title if we had one before (see comment in _open()) 16063 // If the title attribute has changed since open(), don't restore 16064 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 16065 target.attr( "title", target.data( "ui-tooltip-title" ) ); 16066 } 16067 16068 this._removeDescribedBy( target ); 16069 16070 tooltipData.hiding = true; 16071 tooltip.stop( true ); 16072 this._hide( tooltip, this.options.hide, function() { 16073 that._removeTooltip( $( this ) ); 16074 } ); 16075 16076 target.removeData( "ui-tooltip-open" ); 16077 this._off( target, "mouseleave focusout keyup" ); 16078 16079 // Remove 'remove' binding only on delegated targets 16080 if ( target[ 0 ] !== this.element[ 0 ] ) { 16081 this._off( target, "remove" ); 16082 } 16083 this._off( this.document, "mousemove" ); 16084 16085 if ( event && event.type === "mouseleave" ) { 16086 $.each( this.parents, function( id, parent ) { 16087 $( parent.element ).attr( "title", parent.title ); 16088 delete that.parents[ id ]; 16089 } ); 16090 } 16091 16092 tooltipData.closing = true; 16093 this._trigger( "close", event, { tooltip: tooltip } ); 16094 if ( !tooltipData.hiding ) { 16095 tooltipData.closing = false; 16096 } 16097 }, 16098 16099 _tooltip: function( element ) { 16100 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 16101 content = $( "<div>" ).appendTo( tooltip ), 16102 id = tooltip.uniqueId().attr( "id" ); 16103 16104 this._addClass( content, "ui-tooltip-content" ); 16105 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 16106 16107 tooltip.appendTo( this._appendTo( element ) ); 16108 16109 return this.tooltips[ id ] = { 16110 element: element, 16111 tooltip: tooltip 16112 }; 16113 }, 16114 16115 _find: function( target ) { 16116 var id = target.data( "ui-tooltip-id" ); 16117 return id ? this.tooltips[ id ] : null; 16118 }, 16119 16120 _removeTooltip: function( tooltip ) { 16121 16122 // Clear the interval for delayed tracking tooltips 16123 clearInterval( this.delayedShow ); 16124 16125 tooltip.remove(); 16126 delete this.tooltips[ tooltip.attr( "id" ) ]; 16127 }, 16128 16129 _appendTo: function( target ) { 16130 var element = target.closest( ".ui-front, dialog" ); 16131 16132 if ( !element.length ) { 16133 element = this.document[ 0 ].body; 16134 } 16135 16136 return element; 16137 }, 16138 16139 _destroy: function() { 16140 var that = this; 16141 16142 // Close open tooltips 16143 $.each( this.tooltips, function( id, tooltipData ) { 16144 16145 // Delegate to close method to handle common cleanup 16146 var event = $.Event( "blur" ), 16147 element = tooltipData.element; 16148 event.target = event.currentTarget = element[ 0 ]; 16149 that.close( event, true ); 16150 16151 // Remove immediately; destroying an open tooltip doesn't use the 16152 // hide animation 16153 $( "#" + id ).remove(); 16154 16155 // Restore the title 16156 if ( element.data( "ui-tooltip-title" ) ) { 16157 16158 // If the title attribute has changed since open(), don't restore 16159 if ( !element.attr( "title" ) ) { 16160 element.attr( "title", element.data( "ui-tooltip-title" ) ); 16161 } 16162 element.removeData( "ui-tooltip-title" ); 16163 } 16164 } ); 16165 this.liveRegion.remove(); 16166 } 16167} ); 16168 16169// DEPRECATED 16170// TODO: Switch return back to widget declaration at top of file when this is removed 16171if ( $.uiBackCompat === true ) { 16172 16173 // Backcompat for tooltipClass option 16174 $.widget( "ui.tooltip", $.ui.tooltip, { 16175 options: { 16176 tooltipClass: null 16177 }, 16178 _tooltip: function() { 16179 var tooltipData = this._superApply( arguments ); 16180 if ( this.options.tooltipClass ) { 16181 tooltipData.tooltip.addClass( this.options.tooltipClass ); 16182 } 16183 return tooltipData; 16184 } 16185 } ); 16186} 16187 16188var widgetsTooltip = $.ui.tooltip
vendor: 16,220 bytes, lines 16188-16877
16188; 16189 16190 16191 16192// Create a local jQuery because jQuery Color relies on it and the 16193// global may not exist with AMD and a custom build (#10199). 16194// This module is a noop if used as a regular AMD module. 16195// eslint-disable-next-line no-unused-vars 16196var jQuery = $; 16197 16198 16199/*! 16200 * jQuery Color Animations v3.0.0 16201 * https://github.com/jquery/jquery-color 16202 * 16203 * Copyright OpenJS Foundation and other contributors 16204 * Released under the MIT license. 16205 * https://jquery.org/license 16206 * 16207 * Date: Wed May 15 16:49:44 2024 +0200 16208 */ 16209 16210 16211 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 16212 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 16213 16214 class2type = {}, 16215 toString = class2type.toString, 16216 16217 // plusequals test for += 100 -= 100 16218 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 16219 16220 // a set of RE's that can match strings and generate color tuples. 16221 stringParsers = [ { 16222 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16223 parse: function( execResult ) { 16224 return [ 16225 execResult[ 1 ], 16226 execResult[ 2 ], 16227 execResult[ 3 ], 16228 execResult[ 4 ] 16229 ]; 16230 } 16231 }, { 16232 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16233 parse: function( execResult ) { 16234 return [ 16235 execResult[ 1 ] * 2.55, 16236 execResult[ 2 ] * 2.55, 16237 execResult[ 3 ] * 2.55, 16238 execResult[ 4 ] 16239 ]; 16240 } 16241 }, { 16242 16243 // this regex ignores A-F because it's compared against an already lowercased string 16244 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 16245 parse: function( execResult ) { 16246 return [ 16247 parseInt( execResult[ 1 ], 16 ), 16248 parseInt( execResult[ 2 ], 16 ), 16249 parseInt( execResult[ 3 ], 16 ), 16250 execResult[ 4 ] ? 16251 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 16252 1 16253 ]; 16254 } 16255 }, { 16256 16257 // this regex ignores A-F because it's compared against an already lowercased string 16258 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 16259 parse: function( execResult ) { 16260 return [ 16261 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 16262 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 16263 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 16264 execResult[ 4 ] ? 16265 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 16266 .toFixed( 2 ) : 16267 1 16268 ]; 16269 } 16270 }, { 16271 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16272 space: "hsla", 16273 parse: function( execResult ) { 16274 return [ 16275 execResult[ 1 ], 16276 execResult[ 2 ] / 100, 16277 execResult[ 3 ] / 100, 16278 execResult[ 4 ] 16279 ]; 16280 } 16281 } ], 16282 16283 // jQuery.Color( ) 16284 color = jQuery.Color = function( color, green, blue, alpha ) { 16285 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 16286 }, 16287 spaces = { 16288 rgba: { 16289 props: { 16290 red: { 16291 idx: 0, 16292 type: "byte" 16293 }, 16294 green: { 16295 idx: 1, 16296 type: "byte" 16297 }, 16298 blue: { 16299 idx: 2, 16300 type: "byte" 16301 } 16302 } 16303 }, 16304 16305 hsla: { 16306 props: { 16307 hue: { 16308 idx: 0, 16309 type: "degrees" 16310 }, 16311 saturation: { 16312 idx: 1, 16313 type: "percent" 16314 }, 16315 lightness: { 16316 idx: 2, 16317 type: "percent" 16318 } 16319 } 16320 } 16321 }, 16322 propTypes = { 16323 "byte": { 16324 floor: true, 16325 max: 255 16326 }, 16327 "percent": { 16328 max: 1 16329 }, 16330 "degrees": { 16331 mod: 360, 16332 floor: true 16333 } 16334 }, 16335 16336 // colors = jQuery.Color.names 16337 colors, 16338 16339 // local aliases of functions called often 16340 each = jQuery.each; 16341 16342// define cache name and alpha properties 16343// for rgba and hsla spaces 16344each( spaces, function( spaceName, space ) { 16345 space.cache = "_" + spaceName; 16346 space.props.alpha = { 16347 idx: 3, 16348 type: "percent", 16349 def: 1 16350 }; 16351} ); 16352 16353// Populate the class2type map 16354jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 16355 function( _i, name ) { 16356 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 16357 } ); 16358 16359function getType( obj ) { 16360 if ( obj == null ) { 16361 return obj + ""; 16362 } 16363 16364 return typeof obj === "object" ? 16365 class2type[ toString.call( obj ) ] || "object" : 16366 typeof obj; 16367} 16368 16369function clamp( value, prop, allowEmpty ) { 16370 var type = propTypes[ prop.type ] || {}; 16371 16372 if ( value == null ) { 16373 return ( allowEmpty || !prop.def ) ? null : prop.def; 16374 } 16375 16376 // ~~ is an short way of doing floor for positive numbers 16377 value = type.floor ? ~~value : parseFloat( value ); 16378 16379 if ( type.mod ) { 16380 16381 // we add mod before modding to make sure that negatives values 16382 // get converted properly: -10 -> 350 16383 return ( value + type.mod ) % type.mod; 16384 } 16385 16386 // for now all property types without mod have min and max 16387 return Math.min( type.max, Math.max( 0, value ) ); 16388} 16389 16390function stringParse( string ) { 16391 var inst = color(), 16392 rgba = inst._rgba = []; 16393 16394 string = string.toLowerCase(); 16395 16396 each( stringParsers, function( _i, parser ) { 16397 var parsed, 16398 match = parser.re.exec( string ), 16399 values = match && parser.parse( match ), 16400 spaceName = parser.space || "rgba"; 16401 16402 if ( values ) { 16403 parsed = inst[ spaceName ]( values ); 16404 16405 // if this was an rgba parse the assignment might happen twice 16406 // oh well.... 16407 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 16408 rgba = inst._rgba = parsed._rgba; 16409 16410 // exit each( stringParsers ) here because we matched 16411 return false; 16412 } 16413 } ); 16414 16415 // Found a stringParser that handled it 16416 if ( rgba.length ) { 16417 16418 // if this came from a parsed string, force "transparent" when alpha is 0 16419 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 16420 if ( rgba.join() === "0,0,0,0" ) { 16421 jQuery.extend( rgba, colors.transparent ); 16422 } 16423 return inst; 16424 } 16425 16426 // named colors 16427 return colors[ string ]; 16428} 16429 16430color.fn = jQuery.extend( color.prototype, { 16431 parse: function( red, green, blue, alpha ) { 16432 if ( red === undefined ) { 16433 this._rgba = [ null, null, null, null ]; 16434 return this; 16435 } 16436 if ( red.jquery || red.nodeType ) { 16437 red = jQuery( red ).css( green ); 16438 green = undefined; 16439 } 16440 16441 var inst = this, 16442 type = getType( red ), 16443 rgba = this._rgba = []; 16444 16445 // more than 1 argument specified - assume ( red, green, blue, alpha ) 16446 if ( green !== undefined ) { 16447 red = [ red, green, blue, alpha ]; 16448 type = "array"; 16449 } 16450 16451 if ( type === "string" ) { 16452 return this.parse( stringParse( red ) || colors._default ); 16453 } 16454 16455 if ( type === "array" ) { 16456 each( spaces.rgba.props, function( _key, prop ) { 16457 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 16458 } ); 16459 return this; 16460 } 16461 16462 if ( type === "object" ) { 16463 if ( red instanceof color ) { 16464 each( spaces, function( _spaceName, space ) { 16465 if ( red[ space.cache ] ) { 16466 inst[ space.cache ] = red[ space.cache ].slice(); 16467 } 16468 } ); 16469 } else { 16470 each( spaces, function( _spaceName, space ) { 16471 var cache = space.cache; 16472 each( space.props, function( key, prop ) { 16473 16474 // if the cache doesn't exist, and we know how to convert 16475 if ( !inst[ cache ] && space.to ) { 16476 16477 // if the value was null, we don't need to copy it 16478 // if the key was alpha, we don't need to copy it either 16479 if ( key === "alpha" || red[ key ] == null ) { 16480 return; 16481 } 16482 inst[ cache ] = space.to( inst._rgba ); 16483 } 16484 16485 // this is the only case where we allow nulls for ALL properties. 16486 // call clamp with alwaysAllowEmpty 16487 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 16488 } ); 16489 16490 // everything defined but alpha? 16491 if ( inst[ cache ] && jQuery.inArray( 16492 null, 16493 inst[ cache ].slice( 0, 3 ) 16494 ) < 0 ) { 16495 16496 // use the default of 1 16497 if ( inst[ cache ][ 3 ] == null ) { 16498 inst[ cache ][ 3 ] = 1; 16499 } 16500 16501 if ( space.from ) { 16502 inst._rgba = space.from( inst[ cache ] ); 16503 } 16504 } 16505 } ); 16506 } 16507 return this; 16508 } 16509 }, 16510 is: function( compare ) { 16511 var is = color( compare ), 16512 same = true, 16513 inst = this; 16514 16515 each( spaces, function( _, space ) { 16516 var localCache, 16517 isCache = is[ space.cache ]; 16518 if ( isCache ) { 16519 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 16520 each( space.props, function( _, prop ) { 16521 if ( isCache[ prop.idx ] != null ) { 16522 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 16523 return same; 16524 } 16525 } ); 16526 } 16527 return same; 16528 } ); 16529 return same; 16530 }, 16531 _space: function() { 16532 var used = [], 16533 inst = this; 16534 each( spaces, function( spaceName, space ) { 16535 if ( inst[ space.cache ] ) { 16536 used.push( spaceName ); 16537 } 16538 } ); 16539 return used.pop(); 16540 }, 16541 transition: function( other, distance ) { 16542 var end = color( other ), 16543 spaceName = end._space(), 16544 space = spaces[ spaceName ], 16545 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 16546 start = startColor[ space.cache ] || space.to( startColor._rgba ), 16547 result = start.slice(); 16548 16549 end = end[ space.cache ]; 16550 each( space.props, function( _key, prop ) { 16551 var index = prop.idx, 16552 startValue = start[ index ], 16553 endValue = end[ index ], 16554 type = propTypes[ prop.type ] || {}; 16555 16556 // if null, don't override start value 16557 if ( endValue === null ) { 16558 return; 16559 } 16560 16561 // if null - use end 16562 if ( startValue === null ) { 16563 result[ index ] = endValue; 16564 } else { 16565 if ( type.mod ) { 16566 if ( endValue - startValue > type.mod / 2 ) { 16567 startValue += type.mod; 16568 } else if ( startValue - endValue > type.mod / 2 ) { 16569 startValue -= type.mod; 16570 } 16571 } 16572 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 16573 } 16574 } ); 16575 return this[ spaceName ]( result ); 16576 }, 16577 blend: function( opaque ) { 16578 16579 // if we are already opaque - return ourself 16580 if ( this._rgba[ 3 ] === 1 ) { 16581 return this; 16582 } 16583 16584 var rgb = this._rgba.slice(), 16585 a = rgb.pop(), 16586 blend = color( opaque )._rgba; 16587 16588 return color( jQuery.map( rgb, function( v, i ) { 16589 return ( 1 - a ) * blend[ i ] + a * v; 16590 } ) ); 16591 }, 16592 toRgbaString: function() { 16593 var prefix = "rgba(", 16594 rgba = jQuery.map( this._rgba, function( v, i ) { 16595 if ( v != null ) { 16596 return v; 16597 } 16598 return i > 2 ? 1 : 0; 16599 } ); 16600 16601 if ( rgba[ 3 ] === 1 ) { 16602 rgba.pop(); 16603 prefix = "rgb("; 16604 } 16605 16606 return prefix + rgba.join( ", " ) + ")"; 16607 }, 16608 toHslaString: function() { 16609 var prefix = "hsla(", 16610 hsla = jQuery.map( this.hsla(), function( v, i ) { 16611 if ( v == null ) { 16612 v = i > 2 ? 1 : 0; 16613 } 16614 16615 // catch 1 and 2 16616 if ( i && i < 3 ) { 16617 v = Math.round( v * 100 ) + "%"; 16618 } 16619 return v; 16620 } ); 16621 16622 if ( hsla[ 3 ] === 1 ) { 16623 hsla.pop(); 16624 prefix = "hsl("; 16625 } 16626 return prefix + hsla.join( ", " ) + ")"; 16627 }, 16628 toHexString: function( includeAlpha ) { 16629 var rgba = this._rgba.slice(), 16630 alpha = rgba.pop(); 16631 16632 if ( includeAlpha ) { 16633 rgba.push( ~~( alpha * 255 ) ); 16634 } 16635 16636 return "#" + jQuery.map( rgba, function( v ) { 16637 16638 // default to 0 when nulls exist 16639 return ( "0" + ( v || 0 ).toString( 16 ) ).substr( -2 ); 16640 } ).join( "" ); 16641 }, 16642 toString: function() { 16643 return this.toRgbaString(); 16644 } 16645} ); 16646color.fn.parse.prototype = color.fn; 16647 16648// hsla conversions adapted from: 16649// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 16650 16651function hue2rgb( p, q, h ) { 16652 h = ( h + 1 ) % 1; 16653 if ( h * 6 < 1 ) { 16654 return p + ( q - p ) * h * 6; 16655 } 16656 if ( h * 2 < 1 ) { 16657 return q; 16658 } 16659 if ( h * 3 < 2 ) { 16660 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 16661 } 16662 return p; 16663} 16664 16665spaces.hsla.to = function( rgba ) { 16666 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 16667 return [ null, null, null, rgba[ 3 ] ]; 16668 } 16669 var r = rgba[ 0 ] / 255, 16670 g = rgba[ 1 ] / 255, 16671 b = rgba[ 2 ] / 255, 16672 a = rgba[ 3 ], 16673 max = Math.max( r, g, b ), 16674 min = Math.min( r, g, b ), 16675 diff = max - min, 16676 add = max + min, 16677 l = add * 0.5, 16678 h, s; 16679 16680 if ( min === max ) { 16681 h = 0; 16682 } else if ( r === max ) { 16683 h = ( 60 * ( g - b ) / diff ) + 360; 16684 } else if ( g === max ) { 16685 h = ( 60 * ( b - r ) / diff ) + 120; 16686 } else { 16687 h = ( 60 * ( r - g ) / diff ) + 240; 16688 } 16689 16690 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 16691 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 16692 if ( diff === 0 ) { 16693 s = 0; 16694 } else if ( l <= 0.5 ) { 16695 s = diff / add; 16696 } else { 16697 s = diff / ( 2 - add ); 16698 } 16699 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 16700}; 16701 16702spaces.hsla.from = function( hsla ) { 16703 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 16704 return [ null, null, null, hsla[ 3 ] ]; 16705 } 16706 var h = hsla[ 0 ] / 360, 16707 s = hsla[ 1 ], 16708 l = hsla[ 2 ], 16709 a = hsla[ 3 ], 16710 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 16711 p = 2 * l - q; 16712 16713 return [ 16714 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 16715 Math.round( hue2rgb( p, q, h ) * 255 ), 16716 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 16717 a 16718 ]; 16719}; 16720 16721 16722each( spaces, function( spaceName, space ) { 16723 var props = space.props, 16724 cache = space.cache, 16725 to = space.to, 16726 from = space.from; 16727 16728 // makes rgba() and hsla() 16729 color.fn[ spaceName ] = function( value ) { 16730 16731 // generate a cache for this space if it doesn't exist 16732 if ( to && !this[ cache ] ) { 16733 this[ cache ] = to( this._rgba ); 16734 } 16735 if ( value === undefined ) { 16736 return this[ cache ].slice(); 16737 } 16738 16739 var ret, 16740 type = getType( value ), 16741 arr = ( type === "array" || type === "object" ) ? value : arguments, 16742 local = this[ cache ].slice(); 16743 16744 each( props, function( key, prop ) { 16745 var val = arr[ type === "object" ? key : prop.idx ]; 16746 if ( val == null ) { 16747 val = local[ prop.idx ]; 16748 } 16749 local[ prop.idx ] = clamp( val, prop ); 16750 } ); 16751 16752 if ( from ) { 16753 ret = color( from( local ) ); 16754 ret[ cache ] = local; 16755 return ret; 16756 } else { 16757 return color( local ); 16758 } 16759 }; 16760 16761 // makes red() green() blue() alpha() hue() saturation() lightness() 16762 each( props, function( key, prop ) { 16763 16764 // alpha is included in more than one space 16765 if ( color.fn[ key ] ) { 16766 return; 16767 } 16768 color.fn[ key ] = function( value ) { 16769 var local, cur, match, fn, 16770 vtype = getType( value ); 16771 16772 if ( key === "alpha" ) { 16773 fn = this._hsla ? "hsla" : "rgba"; 16774 } else { 16775 fn = spaceName; 16776 } 16777 local = this[ fn ](); 16778 cur = local[ prop.idx ]; 16779 16780 if ( vtype === "undefined" ) { 16781 return cur; 16782 } 16783 16784 if ( vtype === "function" ) { 16785 value = value.call( this, cur ); 16786 vtype = getType( value ); 16787 } 16788 if ( value == null && prop.empty ) { 16789 return this; 16790 } 16791 if ( vtype === "string" ) { 16792 match = rplusequals.exec( value ); 16793 if ( match ) { 16794 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 16795 } 16796 } 16797 local[ prop.idx ] = value; 16798 return this[ fn ]( local ); 16799 }; 16800 } ); 16801} ); 16802 16803// add cssHook and .fx.step function for each named hook. 16804// accept a space separated string of properties 16805color.hook = function( hook ) { 16806 var hooks = hook.split( " " ); 16807 each( hooks, function( _i, hook ) { 16808 jQuery.cssHooks[ hook ] = { 16809 set: function( elem, value ) { 16810 var parsed; 16811 16812 if ( value !== "transparent" && 16813 ( getType( value ) !== "string" || 16814 ( parsed = stringParse( value ) ) ) ) { 16815 value = color( parsed || value ); 16816 value = value.toRgbaString(); 16817 } 16818 elem.style[ hook ] = value; 16819 } 16820 }; 16821 jQuery.fx.step[ hook ] = function( fx ) { 16822 if ( !fx.colorInit ) { 16823 fx.start = color( fx.elem, hook ); 16824 fx.end = color( fx.end ); 16825 fx.colorInit = true; 16826 } 16827 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 16828 }; 16829 } ); 16830 16831}; 16832 16833color.hook( stepHooks ); 16834 16835jQuery.cssHooks.borderColor = { 16836 expand: function( value ) { 16837 var expanded = {}; 16838 16839 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 16840 expanded[ "border" + part + "Color" ] = value; 16841 } ); 16842 return expanded; 16843 } 16844}; 16845 16846// Basic color names only. 16847// Usage of any of the other color names requires adding yourself or including 16848// jquery.color.svg-names.js. 16849colors = jQuery.Color.names = { 16850 16851 // 4.1. Basic color keywords 16852 aqua: "#00ffff", 16853 black: "#000000", 16854 blue: "#0000ff", 16855 fuchsia: "#ff00ff", 16856 gray: "#808080", 16857 green: "#008000", 16858 lime: "#00ff00", 16859 maroon: "#800000", 16860 navy: "#000080", 16861 olive: "#808000", 16862 purple: "#800080", 16863 red: "#ff0000", 16864 silver: "#c0c0c0", 16865 teal: "#008080", 16866 white: "#ffffff", 16867 yellow: "#ffff00", 16868 16869 // 4.2.3. "transparent" color keyword 16870 transparent: [ null, null, null, 0 ], 16871 16872 _default: "#ffffff" 16873}; 16874 16875 16876/*! 16877 * jQuery UI Effects 1.14.
168770 16878 * https://jqueryui.com 16879 * 16880 * Copyright OpenJS Foundation and other contributors 16881 * Released under the MIT license. 16882 * https://jquery.org/license 16883 */ 16884 16885//>>label: Effects Core 16886//>>group: Effects 16887/* eslint-disable max-len */ 16888//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 16889/* eslint-enable max-len */
vendor: 7,523 bytes, lines 16889-17179
16889 16890//>>docs: https://api.jqueryui.com/category/effects-core/ 16891//>>demos: https://jqueryui.com/effect/ 16892 16893 16894var dataSpace = "ui-effects-", 16895 dataSpaceStyle = "ui-effects-style", 16896 dataSpaceAnimated = "ui-effects-animated"; 16897 16898$.effects = { 16899 effect: {} 16900}; 16901 16902/******************************************************************************/ 16903/****************************** CLASS ANIMATIONS ******************************/ 16904/******************************************************************************/ 16905( function() { 16906 16907var classAnimationActions = [ "add", "remove", "toggle" ], 16908 shorthandStyles = { 16909 border: 1, 16910 borderBottom: 1, 16911 borderColor: 1, 16912 borderLeft: 1, 16913 borderRight: 1, 16914 borderTop: 1, 16915 borderWidth: 1, 16916 margin: 1, 16917 padding: 1 16918 }; 16919 16920$.each( 16921 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 16922 function( _, prop ) { 16923 $.fx.step[ prop ] = function( fx ) { 16924 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 16925 jQuery.style( fx.elem, prop, fx.end ); 16926 fx.setAttr = true; 16927 } 16928 }; 16929 } 16930); 16931 16932function camelCase( string ) { 16933 return string.replace( /-([\da-z])/gi, function( all, letter ) { 16934 return letter.toUpperCase(); 16935 } ); 16936} 16937 16938function getElementStyles( elem ) { 16939 var key, len, 16940 style = elem.ownerDocument.defaultView.getComputedStyle( elem ), 16941 styles = {}; 16942 16943 len = style.length; 16944 while ( len-- ) { 16945 key = style[ len ]; 16946 if ( typeof style[ key ] === "string" ) { 16947 styles[ camelCase( key ) ] = style[ key ]; 16948 } 16949 } 16950 16951 return styles; 16952} 16953 16954function styleDifference( oldStyle, newStyle ) { 16955 var diff = {}, 16956 name, value; 16957 16958 for ( name in newStyle ) { 16959 value = newStyle[ name ]; 16960 if ( oldStyle[ name ] !== value ) { 16961 if ( !shorthandStyles[ name ] ) { 16962 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 16963 diff[ name ] = value; 16964 } 16965 } 16966 } 16967 } 16968 16969 return diff; 16970} 16971 16972$.effects.animateClass = function( value, duration, easing, callback ) { 16973 var o = $.speed( duration, easing, callback ); 16974 16975 return this.queue( function() { 16976 var animated = $( this ), 16977 baseClass = animated.attr( "class" ) || "", 16978 applyClassChange, 16979 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 16980 16981 // Map the animated objects to store the original styles. 16982 allAnimations = allAnimations.map( function() { 16983 var el = $( this ); 16984 return { 16985 el: el, 16986 start: getElementStyles( this ) 16987 }; 16988 } ); 16989 16990 // Apply class change 16991 applyClassChange = function() { 16992 $.each( classAnimationActions, function( i, action ) { 16993 if ( value[ action ] ) { 16994 animated[ action + "Class" ]( value[ action ] ); 16995 } 16996 } ); 16997 }; 16998 applyClassChange(); 16999 17000 // Map all animated objects again - calculate new styles and diff 17001 allAnimations = allAnimations.map( function() { 17002 this.end = getElementStyles( this.el[ 0 ] ); 17003 this.diff = styleDifference( this.start, this.end ); 17004 return this; 17005 } ); 17006 17007 // Apply original class 17008 animated.attr( "class", baseClass ); 17009 17010 // Map all animated objects again - this time collecting a promise 17011 allAnimations = allAnimations.map( function() { 17012 var styleInfo = this, 17013 dfd = $.Deferred(), 17014 opts = $.extend( {}, o, { 17015 queue: false, 17016 complete: function() { 17017 dfd.resolve( styleInfo ); 17018 } 17019 } ); 17020 17021 this.el.animate( this.diff, opts ); 17022 return dfd.promise(); 17023 } ); 17024 17025 // Once all animations have completed: 17026 $.when.apply( $, allAnimations.get() ).done( function() { 17027 17028 // Set the final class 17029 applyClassChange(); 17030 17031 // For each animated element, 17032 // clear all css properties that were animated 17033 $.each( arguments, function() { 17034 var el = this.el; 17035 $.each( this.diff, function( key ) { 17036 el.css( key, "" ); 17037 } ); 17038 } ); 17039 17040 // This is guarnteed to be there if you use jQuery.speed() 17041 // it also handles dequeuing the next anim... 17042 o.complete.call( animated[ 0 ] ); 17043 } ); 17044 } ); 17045}; 17046 17047$.fn.extend( { 17048 addClass: ( function( orig ) { 17049 return function( classNames, speed, easing, callback ) { 17050 return speed ? 17051 $.effects.animateClass.call( this, 17052 { add: classNames }, speed, easing, callback ) : 17053 orig.apply( this, arguments ); 17054 }; 17055 } )( $.fn.addClass ), 17056 17057 removeClass: ( function( orig ) { 17058 return function( classNames, speed, easing, callback ) { 17059 return arguments.length > 1 ? 17060 $.effects.animateClass.call( this, 17061 { remove: classNames }, speed, easing, callback ) : 17062 orig.apply( this, arguments ); 17063 }; 17064 } )( $.fn.removeClass ), 17065 17066 toggleClass: ( function( orig ) { 17067 return function( classNames, force, speed, easing, callback ) { 17068 if ( typeof force === "boolean" || force === undefined ) { 17069 if ( !speed ) { 17070 17071 // Without speed parameter 17072 return orig.apply( this, arguments ); 17073 } else { 17074 return $.effects.animateClass.call( this, 17075 ( force ? { add: classNames } : { remove: classNames } ), 17076 speed, easing, callback ); 17077 } 17078 } else { 17079 17080 // Without force parameter 17081 return $.effects.animateClass.call( this, 17082 { toggle: classNames }, force, speed, easing ); 17083 } 17084 }; 17085 } )( $.fn.toggleClass ), 17086 17087 switchClass: function( remove, add, speed, easing, callback ) { 17088 return $.effects.animateClass.call( this, { 17089 add: add, 17090 remove: remove 17091 }, speed, easing, callback ); 17092 } 17093} ); 17094 17095} )(); 17096 17097/******************************************************************************/ 17098/*********************************** EFFECTS **********************************/ 17099/******************************************************************************/ 17100 17101( function() { 17102 17103if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 17104 $.expr.pseudos.animated = ( function( orig ) { 17105 return function( elem ) { 17106 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 17107 }; 17108 } )( $.expr.pseudos.animated ); 17109} 17110 17111if ( $.uiBackCompat === true ) { 17112 $.extend( $.effects, { 17113 17114 // Saves a set of properties in a data storage 17115 save: function( element, set ) { 17116 var i = 0, length = set.length; 17117 for ( ; i < length; i++ ) { 17118 if ( set[ i ] !== null ) { 17119 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 17120 } 17121 } 17122 }, 17123 17124 // Restores a set of previously saved properties from a data storage 17125 restore: function( element, set ) { 17126 var val, i = 0, length = set.length; 17127 for ( ; i < length; i++ ) { 17128 if ( set[ i ] !== null ) { 17129 val = element.data( dataSpace + set[ i ] ); 17130 element.css( set[ i ], val ); 17131 } 17132 } 17133 }, 17134 17135 setMode: function( el, mode ) { 17136 if ( mode === "toggle" ) { 17137 mode = el.is( ":hidden" ) ? "show" : "hide"; 17138 } 17139 return mode; 17140 }, 17141 17142 // Wraps the element around a wrapper that copies position properties 17143 createWrapper: function( element ) { 17144 17145 // If the element is already wrapped, return it 17146 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 17147 return element.parent(); 17148 } 17149 17150 // Wrap the element 17151 var props = { 17152 width: element.outerWidth( true ), 17153 height: element.outerHeight( true ), 17154 "float": element.css( "float" ) 17155 }, 17156 wrapper = $( "<div></div>" ) 17157 .addClass( "ui-effects-wrapper" ) 17158 .css( { 17159 fontSize: "100%", 17160 background: "transparent", 17161 border: "none", 17162 margin: 0, 17163 padding: 0 17164 } ), 17165 17166 // Store the size in case width/height are defined in % - Fixes #5245 17167 size = { 17168 width: element.width(), 17169 height: element.height() 17170 }, 17171 active = document.activeElement; 17172 17173 // Support: Firefox 17174 // Firefox incorrectly exposes anonymous content 17175 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 17176 try { 17177 // eslint-disable-next-line no-unused-expressions 17178 active.id; 17179 } catch (
vendor: 1,550 bytes, lines 17179-17240
17179e ) { 17180 active = document.body; 17181 } 17182 17183 element.wrap( wrapper ); 17184 17185 // Fixes #7595 - Elements lose focus when wrapped. 17186 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 17187 $( active ).trigger( "focus" ); 17188 } 17189 17190 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 17191 // lose the reference to the wrapped element 17192 wrapper = element.parent(); 17193 17194 // Transfer positioning properties to the wrapper 17195 if ( element.css( "position" ) === "static" ) { 17196 wrapper.css( { position: "relative" } ); 17197 element.css( { position: "relative" } ); 17198 } else { 17199 $.extend( props, { 17200 position: element.css( "position" ), 17201 zIndex: element.css( "z-index" ) 17202 } ); 17203 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 17204 props[ pos ] = element.css( pos ); 17205 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 17206 props[ pos ] = "auto"; 17207 } 17208 } ); 17209 element.css( { 17210 position: "relative", 17211 top: 0, 17212 left: 0, 17213 right: "auto", 17214 bottom: "auto" 17215 } ); 17216 } 17217 element.css( size ); 17218 17219 return wrapper.css( props ).show(); 17220 }, 17221 17222 removeWrapper: function( element ) { 17223 var active = document.activeElement; 17224 17225 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 17226 element.parent().replaceWith( element ); 17227 17228 // Fixes #7595 - Elements lose focus when wrapped. 17229 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 17230 $( active ).trigger( "focus" ); 17231 } 17232 } 17233 17234 return element; 17235 } 17236 } ); 17237} 17238 17239$.extend( $.effects, { 17240 version: "1.14.0
vendor: 14,339 bytes, lines 17240-17808
17240", 17241 17242 define: function( name, mode, effect ) { 17243 if ( !effect ) { 17244 effect = mode; 17245 mode = "effect"; 17246 } 17247 17248 $.effects.effect[ name ] = effect; 17249 $.effects.effect[ name ].mode = mode; 17250 17251 return effect; 17252 }, 17253 17254 scaledDimensions: function( element, percent, direction ) { 17255 if ( percent === 0 ) { 17256 return { 17257 height: 0, 17258 width: 0, 17259 outerHeight: 0, 17260 outerWidth: 0 17261 }; 17262 } 17263 17264 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 17265 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 17266 17267 return { 17268 height: element.height() * y, 17269 width: element.width() * x, 17270 outerHeight: element.outerHeight() * y, 17271 outerWidth: element.outerWidth() * x 17272 }; 17273 17274 }, 17275 17276 clipToBox: function( animation ) { 17277 return { 17278 width: animation.clip.right - animation.clip.left, 17279 height: animation.clip.bottom - animation.clip.top, 17280 left: animation.clip.left, 17281 top: animation.clip.top 17282 }; 17283 }, 17284 17285 // Injects recently queued functions to be first in line (after "inprogress") 17286 unshift: function( element, queueLength, count ) { 17287 var queue = element.queue(); 17288 17289 if ( queueLength > 1 ) { 17290 queue.splice.apply( queue, 17291 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 17292 } 17293 element.dequeue(); 17294 }, 17295 17296 saveStyle: function( element ) { 17297 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 17298 }, 17299 17300 restoreStyle: function( element ) { 17301 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 17302 element.removeData( dataSpaceStyle ); 17303 }, 17304 17305 mode: function( element, mode ) { 17306 var hidden = element.is( ":hidden" ); 17307 17308 if ( mode === "toggle" ) { 17309 mode = hidden ? "show" : "hide"; 17310 } 17311 if ( hidden ? mode === "hide" : mode === "show" ) { 17312 mode = "none"; 17313 } 17314 return mode; 17315 }, 17316 17317 // Translates a [top,left] array into a baseline value 17318 getBaseline: function( origin, original ) { 17319 var y, x; 17320 17321 switch ( origin[ 0 ] ) { 17322 case "top": 17323 y = 0; 17324 break; 17325 case "middle": 17326 y = 0.5; 17327 break; 17328 case "bottom": 17329 y = 1; 17330 break; 17331 default: 17332 y = origin[ 0 ] / original.height; 17333 } 17334 17335 switch ( origin[ 1 ] ) { 17336 case "left": 17337 x = 0; 17338 break; 17339 case "center": 17340 x = 0.5; 17341 break; 17342 case "right": 17343 x = 1; 17344 break; 17345 default: 17346 x = origin[ 1 ] / original.width; 17347 } 17348 17349 return { 17350 x: x, 17351 y: y 17352 }; 17353 }, 17354 17355 // Creates a placeholder element so that the original element can be made absolute 17356 createPlaceholder: function( element ) { 17357 var placeholder, 17358 cssPosition = element.css( "position" ), 17359 position = element.position(); 17360 17361 // Lock in margins first to account for form elements, which 17362 // will change margin if you explicitly set height 17363 // see: https://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 17364 // Support: Safari 17365 element.css( { 17366 marginTop: element.css( "marginTop" ), 17367 marginBottom: element.css( "marginBottom" ), 17368 marginLeft: element.css( "marginLeft" ), 17369 marginRight: element.css( "marginRight" ) 17370 } ) 17371 .outerWidth( element.outerWidth() ) 17372 .outerHeight( element.outerHeight() ); 17373 17374 if ( /^(static|relative)/.test( cssPosition ) ) { 17375 cssPosition = "absolute"; 17376 17377 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 17378 17379 // Convert inline to inline block to account for inline elements 17380 // that turn to inline block based on content (like img) 17381 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 17382 "inline-block" : 17383 "block", 17384 visibility: "hidden", 17385 17386 // Margins need to be set to account for margin collapse 17387 marginTop: element.css( "marginTop" ), 17388 marginBottom: element.css( "marginBottom" ), 17389 marginLeft: element.css( "marginLeft" ), 17390 marginRight: element.css( "marginRight" ), 17391 "float": element.css( "float" ) 17392 } ) 17393 .outerWidth( element.outerWidth() ) 17394 .outerHeight( element.outerHeight() ) 17395 .addClass( "ui-effects-placeholder" ); 17396 17397 element.data( dataSpace + "placeholder", placeholder ); 17398 } 17399 17400 element.css( { 17401 position: cssPosition, 17402 left: position.left, 17403 top: position.top 17404 } ); 17405 17406 return placeholder; 17407 }, 17408 17409 removePlaceholder: function( element ) { 17410 var dataKey = dataSpace + "placeholder", 17411 placeholder = element.data( dataKey ); 17412 17413 if ( placeholder ) { 17414 placeholder.remove(); 17415 element.removeData( dataKey ); 17416 } 17417 }, 17418 17419 // Removes a placeholder if it exists and restores 17420 // properties that were modified during placeholder creation 17421 cleanUp: function( element ) { 17422 $.effects.restoreStyle( element ); 17423 $.effects.removePlaceholder( element ); 17424 }, 17425 17426 setTransition: function( element, list, factor, value ) { 17427 value = value || {}; 17428 $.each( list, function( i, x ) { 17429 var unit = element.cssUnit( x ); 17430 if ( unit[ 0 ] > 0 ) { 17431 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 17432 } 17433 } ); 17434 return value; 17435 } 17436} ); 17437 17438// Return an effect options object for the given parameters: 17439function _normalizeArguments( effect, options, speed, callback ) { 17440 17441 // Allow passing all options as the first parameter 17442 if ( $.isPlainObject( effect ) ) { 17443 options = effect; 17444 effect = effect.effect; 17445 } 17446 17447 // Convert to an object 17448 effect = { effect: effect }; 17449 17450 // Catch (effect, null, ...) 17451 if ( options == null ) { 17452 options = {}; 17453 } 17454 17455 // Catch (effect, callback) 17456 if ( typeof options === "function" ) { 17457 callback = options; 17458 speed = null; 17459 options = {}; 17460 } 17461 17462 // Catch (effect, speed, ?) 17463 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 17464 callback = speed; 17465 speed = options; 17466 options = {}; 17467 } 17468 17469 // Catch (effect, options, callback) 17470 if ( typeof speed === "function" ) { 17471 callback = speed; 17472 speed = null; 17473 } 17474 17475 // Add options to effect 17476 if ( options ) { 17477 $.extend( effect, options ); 17478 } 17479 17480 speed = speed || options.duration; 17481 effect.duration = $.fx.off ? 0 : 17482 typeof speed === "number" ? speed : 17483 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 17484 $.fx.speeds._default; 17485 17486 effect.complete = callback || options.complete; 17487 17488 return effect; 17489} 17490 17491function standardAnimationOption( option ) { 17492 17493 // Valid standard speeds (nothing, number, named speed) 17494 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 17495 return true; 17496 } 17497 17498 // Invalid strings - treat as "normal" speed 17499 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 17500 return true; 17501 } 17502 17503 // Complete callback 17504 if ( typeof option === "function" ) { 17505 return true; 17506 } 17507 17508 // Options hash (but not naming an effect) 17509 if ( typeof option === "object" && !option.effect ) { 17510 return true; 17511 } 17512 17513 // Didn't match any standard API 17514 return false; 17515} 17516 17517$.fn.extend( { 17518 effect: function( /* effect, options, speed, callback */ ) { 17519 var args = _normalizeArguments.apply( this, arguments ), 17520 effectMethod = $.effects.effect[ args.effect ], 17521 defaultMode = effectMethod.mode, 17522 queue = args.queue, 17523 queueName = queue || "fx", 17524 complete = args.complete, 17525 mode = args.mode, 17526 modes = [], 17527 prefilter = function( next ) { 17528 var el = $( this ), 17529 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 17530 17531 // Sentinel for duck-punching the :animated pseudo-selector 17532 el.data( dataSpaceAnimated, true ); 17533 17534 // Save effect mode for later use, 17535 // we can't just call $.effects.mode again later, 17536 // as the .show() below destroys the initial state 17537 modes.push( normalizedMode ); 17538 17539 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 17540 if ( defaultMode && ( normalizedMode === "show" || 17541 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 17542 el.show(); 17543 } 17544 17545 if ( !defaultMode || normalizedMode !== "none" ) { 17546 $.effects.saveStyle( el ); 17547 } 17548 17549 if ( typeof next === "function" ) { 17550 next(); 17551 } 17552 }; 17553 17554 if ( $.fx.off || !effectMethod ) { 17555 17556 // Delegate to the original method (e.g., .show()) if possible 17557 if ( mode ) { 17558 return this[ mode ]( args.duration, complete ); 17559 } else { 17560 return this.each( function() { 17561 if ( complete ) { 17562 complete.call( this ); 17563 } 17564 } ); 17565 } 17566 } 17567 17568 function run( next ) { 17569 var elem = $( this ); 17570 17571 function cleanup() { 17572 elem.removeData( dataSpaceAnimated ); 17573 17574 $.effects.cleanUp( elem ); 17575 17576 if ( args.mode === "hide" ) { 17577 elem.hide(); 17578 } 17579 17580 done(); 17581 } 17582 17583 function done() { 17584 if ( typeof complete === "function" ) { 17585 complete.call( elem[ 0 ] ); 17586 } 17587 17588 if ( typeof next === "function" ) { 17589 next(); 17590 } 17591 } 17592 17593 // Override mode option on a per element basis, 17594 // as toggle can be either show or hide depending on element state 17595 args.mode = modes.shift(); 17596 17597 if ( $.uiBackCompat === true && !defaultMode ) { 17598 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 17599 17600 // Call the core method to track "olddisplay" properly 17601 elem[ mode ](); 17602 done(); 17603 } else { 17604 effectMethod.call( elem[ 0 ], args, done ); 17605 } 17606 } else { 17607 if ( args.mode === "none" ) { 17608 17609 // Call the core method to track "olddisplay" properly 17610 elem[ mode ](); 17611 done(); 17612 } else { 17613 effectMethod.call( elem[ 0 ], args, cleanup ); 17614 } 17615 } 17616 } 17617 17618 // Run prefilter on all elements first to ensure that 17619 // any showing or hiding happens before placeholder creation, 17620 // which ensures that any layout changes are correctly captured. 17621 return queue === false ? 17622 this.each( prefilter ).each( run ) : 17623 this.queue( queueName, prefilter ).queue( queueName, run ); 17624 }, 17625 17626 show: ( function( orig ) { 17627 return function( option ) { 17628 if ( standardAnimationOption( option ) ) { 17629 return orig.apply( this, arguments ); 17630 } else { 17631 var args = _normalizeArguments.apply( this, arguments ); 17632 args.mode = "show"; 17633 return this.effect.call( this, args ); 17634 } 17635 }; 17636 } )( $.fn.show ), 17637 17638 hide: ( function( orig ) { 17639 return function( option ) { 17640 if ( standardAnimationOption( option ) ) { 17641 return orig.apply( this, arguments ); 17642 } else { 17643 var args = _normalizeArguments.apply( this, arguments ); 17644 args.mode = "hide"; 17645 return this.effect.call( this, args ); 17646 } 17647 }; 17648 } )( $.fn.hide ), 17649 17650 toggle: ( function( orig ) { 17651 return function( option ) { 17652 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 17653 return orig.apply( this, arguments ); 17654 } else { 17655 var args = _normalizeArguments.apply( this, arguments ); 17656 args.mode = "toggle"; 17657 return this.effect.call( this, args ); 17658 } 17659 }; 17660 } )( $.fn.toggle ), 17661 17662 cssUnit: function( key ) { 17663 var style = this.css( key ), 17664 val = []; 17665 17666 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 17667 if ( style.indexOf( unit ) > 0 ) { 17668 val = [ parseFloat( style ), unit ]; 17669 } 17670 } ); 17671 return val; 17672 }, 17673 17674 cssClip: function( clipObj ) { 17675 if ( clipObj ) { 17676 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 17677 clipObj.bottom + "px " + clipObj.left + "px)" ); 17678 } 17679 return parseClip( this.css( "clip" ), this ); 17680 }, 17681 17682 transfer: function( options, done ) { 17683 var element = $( this ), 17684 target = $( options.to ), 17685 targetFixed = target.css( "position" ) === "fixed", 17686 body = $( "body" ), 17687 fixTop = targetFixed ? body.scrollTop() : 0, 17688 fixLeft = targetFixed ? body.scrollLeft() : 0, 17689 endPosition = target.offset(), 17690 animation = { 17691 top: endPosition.top - fixTop, 17692 left: endPosition.left - fixLeft, 17693 height: target.innerHeight(), 17694 width: target.innerWidth() 17695 }, 17696 startPosition = element.offset(), 17697 transfer = $( "<div class='ui-effects-transfer'></div>" ); 17698 17699 transfer 17700 .appendTo( "body" ) 17701 .addClass( options.className ) 17702 .css( { 17703 top: startPosition.top - fixTop, 17704 left: startPosition.left - fixLeft, 17705 height: element.innerHeight(), 17706 width: element.innerWidth(), 17707 position: targetFixed ? "fixed" : "absolute" 17708 } ) 17709 .animate( animation, options.duration, options.easing, function() { 17710 transfer.remove(); 17711 if ( typeof done === "function" ) { 17712 done(); 17713 } 17714 } ); 17715 } 17716} ); 17717 17718function parseClip( str, element ) { 17719 var outerWidth = element.outerWidth(), 17720 outerHeight = element.outerHeight(), 17721 clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, 17722 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 17723 17724 return { 17725 top: parseFloat( values[ 1 ] ) || 0, 17726 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 17727 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 17728 left: parseFloat( values[ 4 ] ) || 0 17729 }; 17730} 17731 17732$.fx.step.clip = function( fx ) { 17733 if ( !fx.clipInit ) { 17734 fx.start = $( fx.elem ).cssClip(); 17735 if ( typeof fx.end === "string" ) { 17736 fx.end = parseClip( fx.end, fx.elem ); 17737 } 17738 fx.clipInit = true; 17739 } 17740 17741 $( fx.elem ).cssClip( { 17742 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 17743 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 17744 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 17745 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 17746 } ); 17747}; 17748 17749} )(); 17750 17751/******************************************************************************/ 17752/*********************************** EASING ***********************************/ 17753/******************************************************************************/ 17754 17755( function() { 17756 17757// Based on easing equations from Robert Penner (http://robertpenner.com/easing) 17758 17759var baseEasings = {}; 17760 17761$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 17762 baseEasings[ name ] = function( p ) { 17763 return Math.pow( p, i + 2 ); 17764 }; 17765} ); 17766 17767$.extend( baseEasings, { 17768 Sine: function( p ) { 17769 return 1 - Math.cos( p * Math.PI / 2 ); 17770 }, 17771 Circ: function( p ) { 17772 return 1 - Math.sqrt( 1 - p * p ); 17773 }, 17774 Elastic: function( p ) { 17775 return p === 0 || p === 1 ? p : 17776 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 17777 }, 17778 Back: function( p ) { 17779 return p * p * ( 3 * p - 2 ); 17780 }, 17781 Bounce: function( p ) { 17782 var pow2, 17783 bounce = 4; 17784 17785 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 17786 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 17787 } 17788} ); 17789 17790$.each( baseEasings, function( name, easeIn ) { 17791 $.easing[ "easeIn" + name ] = easeIn; 17792 $.easing[ "easeOut" + name ] = function( p ) { 17793 return 1 - easeIn( 1 - p ); 17794 }; 17795 $.easing[ "easeInOut" + name ] = function( p ) { 17796 return p < 0.5 ? 17797 easeIn( p * 2 ) / 2 : 17798 1 - easeIn( p * -2 + 2 ) / 2; 17799 }; 17800} ); 17801 17802} )(); 17803 17804var effect = $.effects; 17805 17806 17807/*! 17808 * jQuery UI Effects Blind 1.14.
vendor: 23,878 bytes, lines 17808-18712
178080 17809 * https://jqueryui.com 17810 * 17811 * Copyright OpenJS Foundation and other contributors 17812 * Released under the MIT license. 17813 * https://jquery.org/license 17814 */ 17815 17816//>>label: Blind Effect 17817//>>group: Effects 17818//>>description: Blinds the element. 17819//>>docs: https://api.jqueryui.com/blind-effect/ 17820//>>demos: https://jqueryui.com/effect/ 17821 17822 17823var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) { 17824 var map = { 17825 up: [ "bottom", "top" ], 17826 vertical: [ "bottom", "top" ], 17827 down: [ "top", "bottom" ], 17828 left: [ "right", "left" ], 17829 horizontal: [ "right", "left" ], 17830 right: [ "left", "right" ] 17831 }, 17832 element = $( this ), 17833 direction = options.direction || "up", 17834 start = element.cssClip(), 17835 animate = { clip: $.extend( {}, start ) }, 17836 placeholder = $.effects.createPlaceholder( element ); 17837 17838 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 17839 17840 if ( options.mode === "show" ) { 17841 element.cssClip( animate.clip ); 17842 if ( placeholder ) { 17843 placeholder.css( $.effects.clipToBox( animate ) ); 17844 } 17845 17846 animate.clip = start; 17847 } 17848 17849 if ( placeholder ) { 17850 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 17851 } 17852 17853 element.animate( animate, { 17854 queue: false, 17855 duration: options.duration, 17856 easing: options.easing, 17857 complete: done 17858 } ); 17859} ); 17860 17861 17862/*! 17863 * jQuery UI Effects Bounce 1.14.0 17864 * https://jqueryui.com 17865 * 17866 * Copyright OpenJS Foundation and other contributors 17867 * Released under the MIT license. 17868 * https://jquery.org/license 17869 */ 17870 17871//>>label: Bounce Effect 17872//>>group: Effects 17873//>>description: Bounces an element horizontally or vertically n times. 17874//>>docs: https://api.jqueryui.com/bounce-effect/ 17875//>>demos: https://jqueryui.com/effect/ 17876 17877 17878var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) { 17879 var upAnim, downAnim, refValue, 17880 element = $( this ), 17881 17882 // Defaults: 17883 mode = options.mode, 17884 hide = mode === "hide", 17885 show = mode === "show", 17886 direction = options.direction || "up", 17887 distance = options.distance, 17888 times = options.times || 5, 17889 17890 // Number of internal animations 17891 anims = times * 2 + ( show || hide ? 1 : 0 ), 17892 speed = options.duration / anims, 17893 easing = options.easing, 17894 17895 // Utility: 17896 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 17897 motion = ( direction === "up" || direction === "left" ), 17898 i = 0, 17899 17900 queuelen = element.queue().length; 17901 17902 $.effects.createPlaceholder( element ); 17903 17904 refValue = element.css( ref ); 17905 17906 // Default distance for the BIGGEST bounce is the outer Distance / 3 17907 if ( !distance ) { 17908 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 17909 } 17910 17911 if ( show ) { 17912 downAnim = { opacity: 1 }; 17913 downAnim[ ref ] = refValue; 17914 17915 // If we are showing, force opacity 0 and set the initial position 17916 // then do the "first" animation 17917 element 17918 .css( "opacity", 0 ) 17919 .css( ref, motion ? -distance * 2 : distance * 2 ) 17920 .animate( downAnim, speed, easing ); 17921 } 17922 17923 // Start at the smallest distance if we are hiding 17924 if ( hide ) { 17925 distance = distance / Math.pow( 2, times - 1 ); 17926 } 17927 17928 downAnim = {}; 17929 downAnim[ ref ] = refValue; 17930 17931 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 17932 for ( ; i < times; i++ ) { 17933 upAnim = {}; 17934 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 17935 17936 element 17937 .animate( upAnim, speed, easing ) 17938 .animate( downAnim, speed, easing ); 17939 17940 distance = hide ? distance * 2 : distance / 2; 17941 } 17942 17943 // Last Bounce when Hiding 17944 if ( hide ) { 17945 upAnim = { opacity: 0 }; 17946 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 17947 17948 element.animate( upAnim, speed, easing ); 17949 } 17950 17951 element.queue( done ); 17952 17953 $.effects.unshift( element, queuelen, anims + 1 ); 17954} ); 17955 17956 17957/*! 17958 * jQuery UI Effects Clip 1.14.0 17959 * https://jqueryui.com 17960 * 17961 * Copyright OpenJS Foundation and other contributors 17962 * Released under the MIT license. 17963 * https://jquery.org/license 17964 */ 17965 17966//>>label: Clip Effect 17967//>>group: Effects 17968//>>description: Clips the element on and off like an old TV. 17969//>>docs: https://api.jqueryui.com/clip-effect/ 17970//>>demos: https://jqueryui.com/effect/ 17971 17972 17973var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) { 17974 var start, 17975 animate = {}, 17976 element = $( this ), 17977 direction = options.direction || "vertical", 17978 both = direction === "both", 17979 horizontal = both || direction === "horizontal", 17980 vertical = both || direction === "vertical"; 17981 17982 start = element.cssClip(); 17983 animate.clip = { 17984 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 17985 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 17986 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 17987 left: horizontal ? ( start.right - start.left ) / 2 : start.left 17988 }; 17989 17990 $.effects.createPlaceholder( element ); 17991 17992 if ( options.mode === "show" ) { 17993 element.cssClip( animate.clip ); 17994 animate.clip = start; 17995 } 17996 17997 element.animate( animate, { 17998 queue: false, 17999 duration: options.duration, 18000 easing: options.easing, 18001 complete: done 18002 } ); 18003 18004} ); 18005 18006 18007/*! 18008 * jQuery UI Effects Drop 1.14.0 18009 * https://jqueryui.com 18010 * 18011 * Copyright OpenJS Foundation and other contributors 18012 * Released under the MIT license. 18013 * https://jquery.org/license 18014 */ 18015 18016//>>label: Drop Effect 18017//>>group: Effects 18018//>>description: Moves an element in one direction and hides it at the same time. 18019//>>docs: https://api.jqueryui.com/drop-effect/ 18020//>>demos: https://jqueryui.com/effect/ 18021 18022 18023var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) { 18024 18025 var distance, 18026 element = $( this ), 18027 mode = options.mode, 18028 show = mode === "show", 18029 direction = options.direction || "left", 18030 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18031 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 18032 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 18033 animation = { 18034 opacity: 0 18035 }; 18036 18037 $.effects.createPlaceholder( element ); 18038 18039 distance = options.distance || 18040 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 18041 18042 animation[ ref ] = motion + distance; 18043 18044 if ( show ) { 18045 element.css( animation ); 18046 18047 animation[ ref ] = oppositeMotion + distance; 18048 animation.opacity = 1; 18049 } 18050 18051 // Animate 18052 element.animate( animation, { 18053 queue: false, 18054 duration: options.duration, 18055 easing: options.easing, 18056 complete: done 18057 } ); 18058} ); 18059 18060 18061/*! 18062 * jQuery UI Effects Explode 1.14.0 18063 * https://jqueryui.com 18064 * 18065 * Copyright OpenJS Foundation and other contributors 18066 * Released under the MIT license. 18067 * https://jquery.org/license 18068 */ 18069 18070//>>label: Explode Effect 18071//>>group: Effects 18072/* eslint-disable max-len */ 18073//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 18074/* eslint-enable max-len */ 18075//>>docs: https://api.jqueryui.com/explode-effect/ 18076//>>demos: https://jqueryui.com/effect/ 18077 18078 18079var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) { 18080 18081 var i, j, left, top, mx, my, 18082 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 18083 cells = rows, 18084 element = $( this ), 18085 mode = options.mode, 18086 show = mode === "show", 18087 18088 // Show and then visibility:hidden the element before calculating offset 18089 offset = element.show().css( "visibility", "hidden" ).offset(), 18090 18091 // Width and height of a piece 18092 width = Math.ceil( element.outerWidth() / cells ), 18093 height = Math.ceil( element.outerHeight() / rows ), 18094 pieces = []; 18095 18096 // Children animate complete: 18097 function childComplete() { 18098 pieces.push( this ); 18099 if ( pieces.length === rows * cells ) { 18100 animComplete(); 18101 } 18102 } 18103 18104 // Clone the element for each row and cell. 18105 for ( i = 0; i < rows; i++ ) { // ===> 18106 top = offset.top + i * height; 18107 my = i - ( rows - 1 ) / 2; 18108 18109 for ( j = 0; j < cells; j++ ) { // ||| 18110 left = offset.left + j * width; 18111 mx = j - ( cells - 1 ) / 2; 18112 18113 // Create a clone of the now hidden main element that will be absolute positioned 18114 // within a wrapper div off the -left and -top equal to size of our pieces 18115 element 18116 .clone() 18117 .appendTo( "body" ) 18118 .wrap( "<div></div>" ) 18119 .css( { 18120 position: "absolute", 18121 visibility: "visible", 18122 left: -j * width, 18123 top: -i * height 18124 } ) 18125 18126 // Select the wrapper - make it overflow: hidden and absolute positioned based on 18127 // where the original was located +left and +top equal to the size of pieces 18128 .parent() 18129 .addClass( "ui-effects-explode" ) 18130 .css( { 18131 position: "absolute", 18132 overflow: "hidden", 18133 width: width, 18134 height: height, 18135 left: left + ( show ? mx * width : 0 ), 18136 top: top + ( show ? my * height : 0 ), 18137 opacity: show ? 0 : 1 18138 } ) 18139 .animate( { 18140 left: left + ( show ? 0 : mx * width ), 18141 top: top + ( show ? 0 : my * height ), 18142 opacity: show ? 1 : 0 18143 }, options.duration || 500, options.easing, childComplete ); 18144 } 18145 } 18146 18147 function animComplete() { 18148 element.css( { 18149 visibility: "visible" 18150 } ); 18151 $( pieces ).remove(); 18152 done(); 18153 } 18154} ); 18155 18156 18157/*! 18158 * jQuery UI Effects Fade 1.14.0 18159 * https://jqueryui.com 18160 * 18161 * Copyright OpenJS Foundation and other contributors 18162 * Released under the MIT license. 18163 * https://jquery.org/license 18164 */ 18165 18166//>>label: Fade Effect 18167//>>group: Effects 18168//>>description: Fades the element. 18169//>>docs: https://api.jqueryui.com/fade-effect/ 18170//>>demos: https://jqueryui.com/effect/ 18171 18172 18173var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) { 18174 var show = options.mode === "show"; 18175 18176 $( this ) 18177 .css( "opacity", show ? 0 : 1 ) 18178 .animate( { 18179 opacity: show ? 1 : 0 18180 }, { 18181 queue: false, 18182 duration: options.duration, 18183 easing: options.easing, 18184 complete: done 18185 } ); 18186} ); 18187 18188 18189/*! 18190 * jQuery UI Effects Fold 1.14.0 18191 * https://jqueryui.com 18192 * 18193 * Copyright OpenJS Foundation and other contributors 18194 * Released under the MIT license. 18195 * https://jquery.org/license 18196 */ 18197 18198//>>label: Fold Effect 18199//>>group: Effects 18200//>>description: Folds an element first horizontally and then vertically. 18201//>>docs: https://api.jqueryui.com/fold-effect/ 18202//>>demos: https://jqueryui.com/effect/ 18203 18204 18205var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) { 18206 18207 // Create element 18208 var element = $( this ), 18209 mode = options.mode, 18210 show = mode === "show", 18211 hide = mode === "hide", 18212 size = options.size || 15, 18213 percent = /([0-9]+)%/.exec( size ), 18214 horizFirst = !!options.horizFirst, 18215 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 18216 duration = options.duration / 2, 18217 18218 placeholder = $.effects.createPlaceholder( element ), 18219 18220 start = element.cssClip(), 18221 animation1 = { clip: $.extend( {}, start ) }, 18222 animation2 = { clip: $.extend( {}, start ) }, 18223 18224 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 18225 18226 queuelen = element.queue().length; 18227 18228 if ( percent ) { 18229 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 18230 } 18231 animation1.clip[ ref[ 0 ] ] = size; 18232 animation2.clip[ ref[ 0 ] ] = size; 18233 animation2.clip[ ref[ 1 ] ] = 0; 18234 18235 if ( show ) { 18236 element.cssClip( animation2.clip ); 18237 if ( placeholder ) { 18238 placeholder.css( $.effects.clipToBox( animation2 ) ); 18239 } 18240 18241 animation2.clip = start; 18242 } 18243 18244 // Animate 18245 element 18246 .queue( function( next ) { 18247 if ( placeholder ) { 18248 placeholder 18249 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 18250 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 18251 } 18252 18253 next(); 18254 } ) 18255 .animate( animation1, duration, options.easing ) 18256 .animate( animation2, duration, options.easing ) 18257 .queue( done ); 18258 18259 $.effects.unshift( element, queuelen, 4 ); 18260} ); 18261 18262 18263/*! 18264 * jQuery UI Effects Highlight 1.14.0 18265 * https://jqueryui.com 18266 * 18267 * Copyright OpenJS Foundation and other contributors 18268 * Released under the MIT license. 18269 * https://jquery.org/license 18270 */ 18271 18272//>>label: Highlight Effect 18273//>>group: Effects 18274//>>description: Highlights the background of an element in a defined color for a custom duration. 18275//>>docs: https://api.jqueryui.com/highlight-effect/ 18276//>>demos: https://jqueryui.com/effect/ 18277 18278 18279var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) { 18280 var element = $( this ), 18281 animation = { 18282 backgroundColor: element.css( "backgroundColor" ) 18283 }; 18284 18285 if ( options.mode === "hide" ) { 18286 animation.opacity = 0; 18287 } 18288 18289 $.effects.saveStyle( element ); 18290 18291 element 18292 .css( { 18293 backgroundImage: "none", 18294 backgroundColor: options.color || "#ffff99" 18295 } ) 18296 .animate( animation, { 18297 queue: false, 18298 duration: options.duration, 18299 easing: options.easing, 18300 complete: done 18301 } ); 18302} ); 18303 18304 18305/*! 18306 * jQuery UI Effects Size 1.14.0 18307 * https://jqueryui.com 18308 * 18309 * Copyright OpenJS Foundation and other contributors 18310 * Released under the MIT license. 18311 * https://jquery.org/license 18312 */ 18313 18314//>>label: Size Effect 18315//>>group: Effects 18316//>>description: Resize an element to a specified width and height. 18317//>>docs: https://api.jqueryui.com/size-effect/ 18318//>>demos: https://jqueryui.com/effect/ 18319 18320 18321var effectsEffectSize = $.effects.define( "size", function( options, done ) { 18322 18323 // Create element 18324 var baseline, factor, temp, 18325 element = $( this ), 18326 18327 // Copy for children 18328 cProps = [ "fontSize" ], 18329 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 18330 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 18331 18332 // Set options 18333 mode = options.mode, 18334 restore = mode !== "effect", 18335 scale = options.scale || "both", 18336 origin = options.origin || [ "middle", "center" ], 18337 position = element.css( "position" ), 18338 pos = element.position(), 18339 original = $.effects.scaledDimensions( element ), 18340 from = options.from || original, 18341 to = options.to || $.effects.scaledDimensions( element, 0 ); 18342 18343 $.effects.createPlaceholder( element ); 18344 18345 if ( mode === "show" ) { 18346 temp = from; 18347 from = to; 18348 to = temp; 18349 } 18350 18351 // Set scaling factor 18352 factor = { 18353 from: { 18354 y: from.height / original.height, 18355 x: from.width / original.width 18356 }, 18357 to: { 18358 y: to.height / original.height, 18359 x: to.width / original.width 18360 } 18361 }; 18362 18363 // Scale the css box 18364 if ( scale === "box" || scale === "both" ) { 18365 18366 // Vertical props scaling 18367 if ( factor.from.y !== factor.to.y ) { 18368 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 18369 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 18370 } 18371 18372 // Horizontal props scaling 18373 if ( factor.from.x !== factor.to.x ) { 18374 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 18375 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 18376 } 18377 } 18378 18379 // Scale the content 18380 if ( scale === "content" || scale === "both" ) { 18381 18382 // Vertical props scaling 18383 if ( factor.from.y !== factor.to.y ) { 18384 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 18385 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 18386 } 18387 } 18388 18389 // Adjust the position properties based on the provided origin points 18390 if ( origin ) { 18391 baseline = $.effects.getBaseline( origin, original ); 18392 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 18393 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 18394 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 18395 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 18396 } 18397 delete from.outerHeight; 18398 delete from.outerWidth; 18399 element.css( from ); 18400 18401 // Animate the children if desired 18402 if ( scale === "content" || scale === "both" ) { 18403 18404 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 18405 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 18406 18407 // Only animate children with width attributes specified 18408 // TODO: is this right? should we include anything with css width specified as well 18409 element.find( "*[width]" ).each( function() { 18410 var child = $( this ), 18411 childOriginal = $.effects.scaledDimensions( child ), 18412 childFrom = { 18413 height: childOriginal.height * factor.from.y, 18414 width: childOriginal.width * factor.from.x, 18415 outerHeight: childOriginal.outerHeight * factor.from.y, 18416 outerWidth: childOriginal.outerWidth * factor.from.x 18417 }, 18418 childTo = { 18419 height: childOriginal.height * factor.to.y, 18420 width: childOriginal.width * factor.to.x, 18421 outerHeight: childOriginal.height * factor.to.y, 18422 outerWidth: childOriginal.width * factor.to.x 18423 }; 18424 18425 // Vertical props scaling 18426 if ( factor.from.y !== factor.to.y ) { 18427 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 18428 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 18429 } 18430 18431 // Horizontal props scaling 18432 if ( factor.from.x !== factor.to.x ) { 18433 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 18434 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 18435 } 18436 18437 if ( restore ) { 18438 $.effects.saveStyle( child ); 18439 } 18440 18441 // Animate children 18442 child.css( childFrom ); 18443 child.animate( childTo, options.duration, options.easing, function() { 18444 18445 // Restore children 18446 if ( restore ) { 18447 $.effects.restoreStyle( child ); 18448 } 18449 } ); 18450 } ); 18451 } 18452 18453 // Animate 18454 element.animate( to, { 18455 queue: false, 18456 duration: options.duration, 18457 easing: options.easing, 18458 complete: function() { 18459 18460 var offset = element.offset(); 18461 18462 if ( to.opacity === 0 ) { 18463 element.css( "opacity", from.opacity ); 18464 } 18465 18466 if ( !restore ) { 18467 element 18468 .css( "position", position === "static" ? "relative" : position ) 18469 .offset( offset ); 18470 18471 // Need to save style here so that automatic style restoration 18472 // doesn't restore to the original styles from before the animation. 18473 $.effects.saveStyle( element ); 18474 } 18475 18476 done(); 18477 } 18478 } ); 18479 18480} ); 18481 18482 18483/*! 18484 * jQuery UI Effects Scale 1.14.0 18485 * https://jqueryui.com 18486 * 18487 * Copyright OpenJS Foundation and other contributors 18488 * Released under the MIT license. 18489 * https://jquery.org/license 18490 */ 18491 18492//>>label: Scale Effect 18493//>>group: Effects 18494//>>description: Grows or shrinks an element and its content. 18495//>>docs: https://api.jqueryui.com/scale-effect/ 18496//>>demos: https://jqueryui.com/effect/ 18497 18498 18499var effectsEffectScale = $.effects.define( "scale", function( options, done ) { 18500 18501 // Create element 18502 var el = $( this ), 18503 mode = options.mode, 18504 percent = parseInt( options.percent, 10 ) || 18505 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 18506 18507 newOptions = $.extend( true, { 18508 from: $.effects.scaledDimensions( el ), 18509 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 18510 origin: options.origin || [ "middle", "center" ] 18511 }, options ); 18512 18513 // Fade option to support puff 18514 if ( options.fade ) { 18515 newOptions.from.opacity = 1; 18516 newOptions.to.opacity = 0; 18517 } 18518 18519 $.effects.effect.size.call( this, newOptions, done ); 18520} ); 18521 18522 18523/*! 18524 * jQuery UI Effects Puff 1.14.0 18525 * https://jqueryui.com 18526 * 18527 * Copyright OpenJS Foundation and other contributors 18528 * Released under the MIT license. 18529 * https://jquery.org/license 18530 */ 18531 18532//>>label: Puff Effect 18533//>>group: Effects 18534//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 18535//>>docs: https://api.jqueryui.com/puff-effect/ 18536//>>demos: https://jqueryui.com/effect/ 18537 18538 18539var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) { 18540 var newOptions = $.extend( true, {}, options, { 18541 fade: true, 18542 percent: parseInt( options.percent, 10 ) || 150 18543 } ); 18544 18545 $.effects.effect.scale.call( this, newOptions, done ); 18546} ); 18547 18548 18549/*! 18550 * jQuery UI Effects Pulsate 1.14.0 18551 * https://jqueryui.com 18552 * 18553 * Copyright OpenJS Foundation and other contributors 18554 * Released under the MIT license. 18555 * https://jquery.org/license 18556 */ 18557 18558//>>label: Pulsate Effect 18559//>>group: Effects 18560//>>description: Pulsates an element n times by changing the opacity to zero and back. 18561//>>docs: https://api.jqueryui.com/pulsate-effect/ 18562//>>demos: https://jqueryui.com/effect/ 18563 18564 18565var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) { 18566 var element = $( this ), 18567 mode = options.mode, 18568 show = mode === "show", 18569 hide = mode === "hide", 18570 showhide = show || hide, 18571 18572 // Showing or hiding leaves off the "last" animation 18573 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 18574 duration = options.duration / anims, 18575 animateTo = 0, 18576 i = 1, 18577 queuelen = element.queue().length; 18578 18579 if ( show || !element.is( ":visible" ) ) { 18580 element.css( "opacity", 0 ).show(); 18581 animateTo = 1; 18582 } 18583 18584 // Anims - 1 opacity "toggles" 18585 for ( ; i < anims; i++ ) { 18586 element.animate( { opacity: animateTo }, duration, options.easing ); 18587 animateTo = 1 - animateTo; 18588 } 18589 18590 element.animate( { opacity: animateTo }, duration, options.easing ); 18591 18592 element.queue( done ); 18593 18594 $.effects.unshift( element, queuelen, anims + 1 ); 18595} ); 18596 18597 18598/*! 18599 * jQuery UI Effects Shake 1.14.0 18600 * https://jqueryui.com 18601 * 18602 * Copyright OpenJS Foundation and other contributors 18603 * Released under the MIT license. 18604 * https://jquery.org/license 18605 */ 18606 18607//>>label: Shake Effect 18608//>>group: Effects 18609//>>description: Shakes an element horizontally or vertically n times. 18610//>>docs: https://api.jqueryui.com/shake-effect/ 18611//>>demos: https://jqueryui.com/effect/ 18612 18613 18614var effectsEffectShake = $.effects.define( "shake", function( options, done ) { 18615 18616 var i = 1, 18617 element = $( this ), 18618 direction = options.direction || "left", 18619 distance = options.distance || 20, 18620 times = options.times || 3, 18621 anims = times * 2 + 1, 18622 speed = Math.round( options.duration / anims ), 18623 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18624 positiveMotion = ( direction === "up" || direction === "left" ), 18625 animation = {}, 18626 animation1 = {}, 18627 animation2 = {}, 18628 18629 queuelen = element.queue().length; 18630 18631 $.effects.createPlaceholder( element ); 18632 18633 // Animation 18634 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 18635 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 18636 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 18637 18638 // Animate 18639 element.animate( animation, speed, options.easing ); 18640 18641 // Shakes 18642 for ( ; i < times; i++ ) { 18643 element 18644 .animate( animation1, speed, options.easing ) 18645 .animate( animation2, speed, options.easing ); 18646 } 18647 18648 element 18649 .animate( animation1, speed, options.easing ) 18650 .animate( animation, speed / 2, options.easing ) 18651 .queue( done ); 18652 18653 $.effects.unshift( element, queuelen, anims + 1 ); 18654} ); 18655 18656 18657/*! 18658 * jQuery UI Effects Slide 1.14.0 18659 * https://jqueryui.com 18660 * 18661 * Copyright OpenJS Foundation and other contributors 18662 * Released under the MIT license. 18663 * https://jquery.org/license 18664 */ 18665 18666//>>label: Slide Effect 18667//>>group: Effects 18668//>>description: Slides an element in and out of the viewport. 18669//>>docs: https://api.jqueryui.com/slide-effect/ 18670//>>demos: https://jqueryui.com/effect/ 18671 18672 18673var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) { 18674 var startClip, startRef, 18675 element = $( this ), 18676 map = { 18677 up: [ "bottom", "top" ], 18678 down: [ "top", "bottom" ], 18679 left: [ "right", "left" ], 18680 right: [ "left", "right" ] 18681 }, 18682 mode = options.mode, 18683 direction = options.direction || "left", 18684 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18685 positiveMotion = ( direction === "up" || direction === "left" ), 18686 distance = options.distance || 18687 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 18688 animation = {}; 18689 18690 $.effects.createPlaceholder( element ); 18691 18692 startClip = element.cssClip(); 18693 startRef = element.position()[ ref ]; 18694 18695 // Define hide animation 18696 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 18697 animation.clip = element.cssClip(); 18698 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 18699 18700 // Reverse the animation if we're showing 18701 if ( mode === "show" ) { 18702 element.cssClip( animation.clip ); 18703 element.css( ref, animation[ ref ] ); 18704 animation.clip = startClip; 18705 animation[ ref ] = startRef; 18706 } 18707 18708 // Actually animate 18709 element.animate( animation, { 18710 queue: false, 18711 duration: options.duration, 18712 easing: options.easing,
18713 complete: done 18714 } ); 18715} ); 18716 18717 18718/*! 18719 * jQuery UI Effects Transfer 1.14.0 18720 * https://jqueryui.com 18721 * 18722 * Copyright OpenJS Foundation and other contributors 18723 * Released under the MIT license. 18724 * https://jquery.org/license 18725 */ 18726 18727//>>label: Transfer Effect 18728//>>group: Effects 18729//>>description: Displays a transfer effect from one element to another. 18730//>>docs: https://api.jqueryui.com/transfer-effect/ 18731//>>demos: https://jqueryui.com/effect/ 18732 18733 18734var effect; 18735if ( $.uiBackCompat === true ) { 18736 effect = $.effects.define( "transfer", function( options, done ) { 18737 $( this ).transfer( options, done ); 18738 } ); 18739} 18740var effectsEffectTransfer = effect; 18741 18742 18743 18744 18745} );
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.