vendor: 3,237 bytes, lines 1-91
1/*! jQuery UI - v1.13.0 - 2021-10-31 2* http://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 jQuery 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.13.0"; 24 25 26/*! 27 * jQuery UI Widget 1.13.0 28 * http://jqueryui.com 29 * 30 * Copyright jQuery Foundation and other contributors 31 * Released under the MIT license. 32 * http://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: http://api.jqueryui.com/jQuery.widget/ 39//>>demos: http://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 ]; 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 (
vendor: 11,136 bytes, lines 91-513
91 !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
vendor: 10,916 bytes, lines 513-908
513options.element.each( function( _, element ) { 514 var isTracked = $.map( that.classesElementLookup, function( elements ) { 515 return elements; 516 } ) 517 .some( function( elements ) { 518 return elements.is( element ); 519 } ); 520 521 if ( !isTracked ) { 522 that._on( $( element ), { 523 remove: "_untrackClassesElement" 524 } ); 525 } 526 } ); 527 } 528 529 function processClassString( classes, checkOption ) { 530 var current, i; 531 for ( i = 0; i < classes.length; i++ ) { 532 current = that.classesElementLookup[ classes[ i ] ] || $(); 533 if ( options.add ) { 534 bindRemoveEvent(); 535 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 536 } else { 537 current = $( current.not( options.element ).get() ); 538 } 539 that.classesElementLookup[ classes[ i ] ] = current; 540 full.push( classes[ i ] ); 541 if ( checkOption && options.classes[ classes[ i ] ] ) { 542 full.push( options.classes[ classes[ i ] ] ); 543 } 544 } 545 } 546 547 if ( options.keys ) { 548 processClassString( options.keys.match( /\S+/g ) || [], true ); 549 } 550 if ( options.extra ) { 551 processClassString( options.extra.match( /\S+/g ) || [] ); 552 } 553 554 return full.join( " " ); 555 }, 556 557 _untrackClassesElement: function( event ) { 558 var that = this; 559 $.each( that.classesElementLookup, function( key, value ) { 560 if ( $.inArray( event.target, value ) !== -1 ) { 561 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 562 } 563 } ); 564 565 this._off( $( event.target ) ); 566 }, 567 568 _removeClass: function( element, keys, extra ) { 569 return this._toggleClass( element, keys, extra, false ); 570 }, 571 572 _addClass: function( element, keys, extra ) { 573 return this._toggleClass( element, keys, extra, true ); 574 }, 575 576 _toggleClass: function( element, keys, extra, add ) { 577 add = ( typeof add === "boolean" ) ? add : extra; 578 var shift = ( typeof element === "string" || element === null ), 579 options = { 580 extra: shift ? keys : extra, 581 keys: shift ? element : keys, 582 element: shift ? this.element : element, 583 add: add 584 }; 585 options.element.toggleClass( this._classes( options ), add ); 586 return this; 587 }, 588 589 _on: function( suppressDisabledCheck, element, handlers ) { 590 var delegateElement; 591 var instance = this; 592 593 // No suppressDisabledCheck flag, shuffle arguments 594 if ( typeof suppressDisabledCheck !== "boolean" ) { 595 handlers = element; 596 element = suppressDisabledCheck; 597 suppressDisabledCheck = false; 598 } 599 600 // No element argument, shuffle and use this.element 601 if ( !handlers ) { 602 handlers = element; 603 element = this.element; 604 delegateElement = this.widget(); 605 } else { 606 element = delegateElement = $( element ); 607 this.bindings = this.bindings.add( element ); 608 } 609 610 $.each( handlers, function( event, handler ) { 611 function handlerProxy() { 612 613 // Allow widgets to customize the disabled handling 614 // - disabled as an array instead of boolean 615 // - disabled class as method for disabling individual parts 616 if ( !suppressDisabledCheck && 617 ( instance.options.disabled === true || 618 $( this ).hasClass( "ui-state-disabled" ) ) ) { 619 return; 620 } 621 return ( typeof handler === "string" ? instance[ handler ] : handler ) 622 .apply( instance, arguments ); 623 } 624 625 // Copy the guid so direct unbinding works 626 if ( typeof handler !== "string" ) { 627 handlerProxy.guid = handler.guid = 628 handler.guid || handlerProxy.guid || $.guid++; 629 } 630 631 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 632 var eventName = match[ 1 ] + instance.eventNamespace; 633 var selector = match[ 2 ]; 634 635 if ( selector ) { 636 delegateElement.on( eventName, selector, handlerProxy ); 637 } else { 638 element.on( eventName, handlerProxy ); 639 } 640 } ); 641 }, 642 643 _off: function( element, eventName ) { 644 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 645 this.eventNamespace; 646 element.off( eventName ); 647 648 // Clear the stack to avoid memory leaks (#10056) 649 this.bindings = $( this.bindings.not( element ).get() ); 650 this.focusable = $( this.focusable.not( element ).get() ); 651 this.hoverable = $( this.hoverable.not( element ).get() ); 652 }, 653 654 _delay: function( handler, delay ) { 655 function handlerProxy() { 656 return ( typeof handler === "string" ? instance[ handler ] : handler ) 657 .apply( instance, arguments ); 658 } 659 var instance = this; 660 return setTimeout( handlerProxy, delay || 0 ); 661 }, 662 663 _hoverable: function( element ) { 664 this.hoverable = this.hoverable.add( element ); 665 this._on( element, { 666 mouseenter: function( event ) { 667 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 668 }, 669 mouseleave: function( event ) { 670 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 671 } 672 } ); 673 }, 674 675 _focusable: function( element ) { 676 this.focusable = this.focusable.add( element ); 677 this._on( element, { 678 focusin: function( event ) { 679 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 680 }, 681 focusout: function( event ) { 682 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 683 } 684 } ); 685 }, 686 687 _trigger: function( type, event, data ) { 688 var prop, orig; 689 var callback = this.options[ type ]; 690 691 data = data || {}; 692 event = $.Event( event ); 693 event.type = ( type === this.widgetEventPrefix ? 694 type : 695 this.widgetEventPrefix + type ).toLowerCase(); 696 697 // The original event may come from any element 698 // so we need to reset the target on the new event 699 event.target = this.element[ 0 ]; 700 701 // Copy original event properties over to the new event 702 orig = event.originalEvent; 703 if ( orig ) { 704 for ( prop in orig ) { 705 if ( !( prop in event ) ) { 706 event[ prop ] = orig[ prop ]; 707 } 708 } 709 } 710 711 this.element.trigger( event, data ); 712 return !( typeof callback === "function" && 713 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 714 event.isDefaultPrevented() ); 715 } 716}; 717 718$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 719 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 720 if ( typeof options === "string" ) { 721 options = { effect: options }; 722 } 723 724 var hasOptions; 725 var effectName = !options ? 726 method : 727 options === true || typeof options === "number" ? 728 defaultEffect : 729 options.effect || defaultEffect; 730 731 options = options || {}; 732 if ( typeof options === "number" ) { 733 options = { duration: options }; 734 } else if ( options === true ) { 735 options = {}; 736 } 737 738 hasOptions = !$.isEmptyObject( options ); 739 options.complete = callback; 740 741 if ( options.delay ) { 742 element.delay( options.delay ); 743 } 744 745 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 746 element[ method ]( options ); 747 } else if ( effectName !== method && element[ effectName ] ) { 748 element[ effectName ]( options.duration, options.easing, callback ); 749 } else { 750 element.queue( function( next ) { 751 $( this )[ method ](); 752 if ( callback ) { 753 callback.call( element[ 0 ] ); 754 } 755 next(); 756 } ); 757 } 758 }; 759} ); 760 761var widget = $.widget; 762 763 764/*! 765 * jQuery UI Position 1.13.0 766 * http://jqueryui.com 767 * 768 * Copyright jQuery Foundation and other contributors 769 * Released under the MIT license. 770 * http://jquery.org/license 771 * 772 * http://api.jqueryui.com/position/ 773 */ 774 775//>>label: Position 776//>>group: Core 777//>>description: Positions elements relative to other elements. 778//>>docs: http://api.jqueryui.com/position/ 779//>>demos: http://jqueryui.com/position/ 780 781 782( function() { 783var cachedScrollbarWidth, 784 max = Math.max, 785 abs = Math.abs, 786 rhorizontal = /left|center|right/, 787 rvertical = /top|center|bottom/, 788 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 789 rposition = /^\w+/, 790 rpercent = /%$/, 791 _position = $.fn.position; 792 793function getOffsets( offsets, width, height ) { 794 return [ 795 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 796 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 797 ]; 798} 799 800function parseCss( element, property ) { 801 return parseInt( $.css( element, property ), 10 ) || 0; 802} 803 804function isWindow( obj ) { 805 return obj != null && obj === obj.window; 806} 807 808function getDimensions( elem ) { 809 var raw = elem[ 0 ]; 810 if ( raw.nodeType === 9 ) { 811 return { 812 width: elem.width(), 813 height: elem.height(), 814 offset: { top: 0, left: 0 } 815 }; 816 } 817 if ( isWindow( raw ) ) { 818 return { 819 width: elem.width(), 820 height: elem.height(), 821 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 822 }; 823 } 824 if ( raw.preventDefault ) { 825 return { 826 width: 0, 827 height: 0, 828 offset: { top: raw.pageY, left: raw.pageX } 829 }; 830 } 831 return { 832 width: elem.outerWidth(), 833 height: elem.outerHeight(), 834 offset: elem.offset() 835 }; 836} 837 838$.position = { 839 scrollbarWidth: function() { 840 if ( cachedScrollbarWidth !== undefined ) { 841 return cachedScrollbarWidth; 842 } 843 var w1, w2, 844 div = $( "<div style=" + 845 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 846 "<div style='height:300px;width:auto;'></div></div>" ), 847 innerDiv = div.children()[ 0 ]; 848 849 $( "body" ).append( div ); 850 w1 = innerDiv.offsetWidth; 851 div.css( "overflow", "scroll" ); 852 853 w2 = innerDiv.offsetWidth; 854 855 if ( w1 === w2 ) { 856 w2 = div[ 0 ].clientWidth; 857 } 858 859 div.remove(); 860 861 return ( cachedScrollbarWidth = w1 - w2 ); 862 }, 863 getScrollInfo: function( within ) { 864 var overflowX = within.isWindow || within.isDocument ? "" : 865 within.element.css( "overflow-x" ), 866 overflowY = within.isWindow || within.isDocument ? "" : 867 within.element.css( "overflow-y" ), 868 hasOverflowX = overflowX === "scroll" || 869 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 870 hasOverflowY = overflowY === "scroll" || 871 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 872 return { 873 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 874 height: hasOverflowX ? $.position.scrollbarWidth() : 0 875 }; 876 }, 877 getWithinInfo: function( element ) { 878 var withinElement = $( element || window ), 879 isElemWindow = isWindow( withinElement[ 0 ] ), 880 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 881 hasOffset = !isElemWindow && !isDocument; 882 return { 883 element: withinElement, 884 isWindow: isElemWindow, 885 isDocument: isDocument, 886 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 887 scrollLeft: withinElement.scrollLeft(), 888 scrollTop: withinElement.scrollTop(), 889 width: withinElement.outerWidth(), 890 height: withinElement.outerHeight() 891 }; 892 } 893}; 894 895$.fn.position = function( options ) { 896 if ( !options || !options.of ) { 897 return _position.apply( this, arguments ); 898 } 899 900 // Make a copy, we don't want to modify arguments 901 options = $.extend( {}, options ); 902 903 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 904 905 // Make sure string options are treated as CSS selectors 906 target = typeof options.of === "string" ? 907 $( document ).find( options.of ) : 908 $( options.of ),
vendor: 10,992 bytes, lines 909-1262
909 910 within = $.position.getWithinInfo( options.within ), 911 scrollInfo = $.position.getScrollInfo( within ), 912 collision = ( options.collision || "flip" ).split( " " ), 913 offsets = {}; 914 915 dimensions = getDimensions( target ); 916 if ( target[ 0 ].preventDefault ) { 917 918 // Force left top to allow flipping 919 options.at = "left top"; 920 } 921 targetWidth = dimensions.width; 922 targetHeight = dimensions.height; 923 targetOffset = dimensions.offset; 924 925 // Clone to reuse original targetOffset later 926 basePosition = $.extend( {}, targetOffset ); 927 928 // Force my and at to have valid horizontal and vertical positions 929 // if a value is missing or invalid, it will be converted to center 930 $.each( [ "my", "at" ], function() { 931 var pos = ( options[ this ] || "" ).split( " " ), 932 horizontalOffset, 933 verticalOffset; 934 935 if ( pos.length === 1 ) { 936 pos = rhorizontal.test( pos[ 0 ] ) ? 937 pos.concat( [ "center" ] ) : 938 rvertical.test( pos[ 0 ] ) ? 939 [ "center" ].concat( pos ) : 940 [ "center", "center" ]; 941 } 942 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 943 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 944 945 // Calculate offsets 946 horizontalOffset = roffset.exec( pos[ 0 ] ); 947 verticalOffset = roffset.exec( pos[ 1 ] ); 948 offsets[ this ] = [ 949 horizontalOffset ? horizontalOffset[ 0 ] : 0, 950 verticalOffset ? verticalOffset[ 0 ] : 0 951 ]; 952 953 // Reduce to just the positions without the offsets 954 options[ this ] = [ 955 rposition.exec( pos[ 0 ] )[ 0 ], 956 rposition.exec( pos[ 1 ] )[ 0 ] 957 ]; 958 } ); 959 960 // Normalize collision option 961 if ( collision.length === 1 ) { 962 collision[ 1 ] = collision[ 0 ]; 963 } 964 965 if ( options.at[ 0 ] === "right" ) { 966 basePosition.left += targetWidth; 967 } else if ( options.at[ 0 ] === "center" ) { 968 basePosition.left += targetWidth / 2; 969 } 970 971 if ( options.at[ 1 ] === "bottom" ) { 972 basePosition.top += targetHeight; 973 } else if ( options.at[ 1 ] === "center" ) { 974 basePosition.top += targetHeight / 2; 975 } 976 977 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 978 basePosition.left += atOffset[ 0 ]; 979 basePosition.top += atOffset[ 1 ]; 980 981 return this.each( function() { 982 var collisionPosition, using, 983 elem = $( this ), 984 elemWidth = elem.outerWidth(), 985 elemHeight = elem.outerHeight(), 986 marginLeft = parseCss( this, "marginLeft" ), 987 marginTop = parseCss( this, "marginTop" ), 988 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 989 scrollInfo.width, 990 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 991 scrollInfo.height, 992 position = $.extend( {}, basePosition ), 993 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 994 995 if ( options.my[ 0 ] === "right" ) { 996 position.left -= elemWidth; 997 } else if ( options.my[ 0 ] === "center" ) { 998 position.left -= elemWidth / 2; 999 } 1000 1001 if ( options.my[ 1 ] === "bottom" ) { 1002 position.top -= elemHeight; 1003 } else if ( options.my[ 1 ] === "center" ) { 1004 position.top -= elemHeight / 2; 1005 } 1006 1007 position.left += myOffset[ 0 ]; 1008 position.top += myOffset[ 1 ]; 1009 1010 collisionPosition = { 1011 marginLeft: marginLeft, 1012 marginTop: marginTop 1013 }; 1014 1015 $.each( [ "left", "top" ], function( i, dir ) { 1016 if ( $.ui.position[ collision[ i ] ] ) { 1017 $.ui.position[ collision[ i ] ][ dir ]( position, { 1018 targetWidth: targetWidth, 1019 targetHeight: targetHeight, 1020 elemWidth: elemWidth, 1021 elemHeight: elemHeight, 1022 collisionPosition: collisionPosition, 1023 collisionWidth: collisionWidth, 1024 collisionHeight: collisionHeight, 1025 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1026 my: options.my, 1027 at: options.at, 1028 within: within, 1029 elem: elem 1030 } ); 1031 } 1032 } ); 1033 1034 if ( options.using ) { 1035 1036 // Adds feedback as second argument to using callback, if present 1037 using = function( props ) { 1038 var left = targetOffset.left - position.left, 1039 right = left + targetWidth - elemWidth, 1040 top = targetOffset.top - position.top, 1041 bottom = top + targetHeight - elemHeight, 1042 feedback = { 1043 target: { 1044 element: target, 1045 left: targetOffset.left, 1046 top: targetOffset.top, 1047 width: targetWidth, 1048 height: targetHeight 1049 }, 1050 element: { 1051 element: elem, 1052 left: position.left, 1053 top: position.top, 1054 width: elemWidth, 1055 height: elemHeight 1056 }, 1057 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1058 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1059 }; 1060 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1061 feedback.horizontal = "center"; 1062 } 1063 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1064 feedback.vertical = "middle"; 1065 } 1066 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1067 feedback.important = "horizontal"; 1068 } else { 1069 feedback.important = "vertical"; 1070 } 1071 options.using.call( this, props, feedback ); 1072 }; 1073 } 1074 1075 elem.offset( $.extend( position, { using: using } ) ); 1076 } ); 1077}; 1078 1079$.ui.position = { 1080 fit: { 1081 left: function( position, data ) { 1082 var within = data.within, 1083 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1084 outerWidth = within.width, 1085 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1086 overLeft = withinOffset - collisionPosLeft, 1087 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1088 newOverRight; 1089 1090 // Element is wider than within 1091 if ( data.collisionWidth > outerWidth ) { 1092 1093 // Element is initially over the left side of within 1094 if ( overLeft > 0 && overRight <= 0 ) { 1095 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1096 withinOffset; 1097 position.left += overLeft - newOverRight; 1098 1099 // Element is initially over right side of within 1100 } else if ( overRight > 0 && overLeft <= 0 ) { 1101 position.left = withinOffset; 1102 1103 // Element is initially over both left and right sides of within 1104 } else { 1105 if ( overLeft > overRight ) { 1106 position.left = withinOffset + outerWidth - data.collisionWidth; 1107 } else { 1108 position.left = withinOffset; 1109 } 1110 } 1111 1112 // Too far left -> align with left edge 1113 } else if ( overLeft > 0 ) { 1114 position.left += overLeft; 1115 1116 // Too far right -> align with right edge 1117 } else if ( overRight > 0 ) { 1118 position.left -= overRight; 1119 1120 // Adjust based on position and margin 1121 } else { 1122 position.left = max( position.left - collisionPosLeft, position.left ); 1123 } 1124 }, 1125 top: function( position, data ) { 1126 var within = data.within, 1127 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1128 outerHeight = data.within.height, 1129 collisionPosTop = position.top - data.collisionPosition.marginTop, 1130 overTop = withinOffset - collisionPosTop, 1131 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1132 newOverBottom; 1133 1134 // Element is taller than within 1135 if ( data.collisionHeight > outerHeight ) { 1136 1137 // Element is initially over the top of within 1138 if ( overTop > 0 && overBottom <= 0 ) { 1139 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1140 withinOffset; 1141 position.top += overTop - newOverBottom; 1142 1143 // Element is initially over bottom of within 1144 } else if ( overBottom > 0 && overTop <= 0 ) { 1145 position.top = withinOffset; 1146 1147 // Element is initially over both top and bottom of within 1148 } else { 1149 if ( overTop > overBottom ) { 1150 position.top = withinOffset + outerHeight - data.collisionHeight; 1151 } else { 1152 position.top = withinOffset; 1153 } 1154 } 1155 1156 // Too far up -> align with top 1157 } else if ( overTop > 0 ) { 1158 position.top += overTop; 1159 1160 // Too far down -> align with bottom edge 1161 } else if ( overBottom > 0 ) { 1162 position.top -= overBottom; 1163 1164 // Adjust based on position and margin 1165 } else { 1166 position.top = max( position.top - collisionPosTop, position.top ); 1167 } 1168 } 1169 }, 1170 flip: { 1171 left: function( position, data ) { 1172 var within = data.within, 1173 withinOffset = within.offset.left + within.scrollLeft, 1174 outerWidth = within.width, 1175 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1176 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1177 overLeft = collisionPosLeft - offsetLeft, 1178 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1179 myOffset = data.my[ 0 ] === "left" ? 1180 -data.elemWidth : 1181 data.my[ 0 ] === "right" ? 1182 data.elemWidth : 1183 0, 1184 atOffset = data.at[ 0 ] === "left" ? 1185 data.targetWidth : 1186 data.at[ 0 ] === "right" ? 1187 -data.targetWidth : 1188 0, 1189 offset = -2 * data.offset[ 0 ], 1190 newOverRight, 1191 newOverLeft; 1192 1193 if ( overLeft < 0 ) { 1194 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1195 outerWidth - withinOffset; 1196 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1197 position.left += myOffset + atOffset + offset; 1198 } 1199 } else if ( overRight > 0 ) { 1200 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1201 atOffset + offset - offsetLeft; 1202 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1203 position.left += myOffset + atOffset + offset; 1204 } 1205 } 1206 }, 1207 top: function( position, data ) { 1208 var within = data.within, 1209 withinOffset = within.offset.top + within.scrollTop, 1210 outerHeight = within.height, 1211 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1212 collisionPosTop = position.top - data.collisionPosition.marginTop, 1213 overTop = collisionPosTop - offsetTop, 1214 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1215 top = data.my[ 1 ] === "top", 1216 myOffset = top ? 1217 -data.elemHeight : 1218 data.my[ 1 ] === "bottom" ? 1219 data.elemHeight : 1220 0, 1221 atOffset = data.at[ 1 ] === "top" ? 1222 data.targetHeight : 1223 data.at[ 1 ] === "bottom" ? 1224 -data.targetHeight : 1225 0, 1226 offset = -2 * data.offset[ 1 ], 1227 newOverTop, 1228 newOverBottom; 1229 if ( overTop < 0 ) { 1230 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1231 outerHeight - withinOffset; 1232 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1233 position.top += myOffset + atOffset + offset; 1234 } 1235 } else if ( overBottom > 0 ) { 1236 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1237 offset - offsetTop; 1238 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1239 position.top += myOffset + atOffset + offset; 1240 } 1241 } 1242 } 1243 }, 1244 flipfit: { 1245 left: function() { 1246 $.ui.position.flip.left.apply( this, arguments ); 1247 $.ui.position.fit.left.apply( this, arguments ); 1248 }, 1249 top: function() { 1250 $.ui.position.flip.top.apply( this, arguments ); 1251 $.ui.position.fit.top.apply( this, arguments ); 1252 } 1253 } 1254}; 1255 1256} )(); 1257 1258var position = $.ui.position; 1259 1260 1261/*! 1262 * jQuery UI :data 1.1
12623.0 1263 * http://jqueryui.com 1264 * 1265 * Copyright jQuery Foundation and other contributors 1266 * Released under the MIT license. 1267 * http://jquery.org/license 1268 */ 1269 1270//>>label: :data Selector
vendor: 25,394 bytes, lines 1271-2273
1271//>>group: Core 1272//>>description: Selects elements which have data stored under the specified key. 1273//>>docs: http://api.jqueryui.com/data-selector/ 1274 1275 1276var data = $.extend( $.expr.pseudos, { 1277 data: $.expr.createPseudo ? 1278 $.expr.createPseudo( function( dataName ) { 1279 return function( elem ) { 1280 return !!$.data( elem, dataName ); 1281 }; 1282 } ) : 1283 1284 // Support: jQuery <1.8 1285 function( elem, i, match ) { 1286 return !!$.data( elem, match[ 3 ] ); 1287 } 1288} ); 1289 1290/*! 1291 * jQuery UI Disable Selection 1.13.0 1292 * http://jqueryui.com 1293 * 1294 * Copyright jQuery Foundation and other contributors 1295 * Released under the MIT license. 1296 * http://jquery.org/license 1297 */ 1298 1299//>>label: disableSelection 1300//>>group: Core 1301//>>description: Disable selection of text content within the set of matched elements. 1302//>>docs: http://api.jqueryui.com/disableSelection/ 1303 1304// This file is deprecated 1305 1306var disableSelection = $.fn.extend( { 1307 disableSelection: ( function() { 1308 var eventType = "onselectstart" in document.createElement( "div" ) ? 1309 "selectstart" : 1310 "mousedown"; 1311 1312 return function() { 1313 return this.on( eventType + ".ui-disableSelection", function( event ) { 1314 event.preventDefault(); 1315 } ); 1316 }; 1317 } )(), 1318 1319 enableSelection: function() { 1320 return this.off( ".ui-disableSelection" ); 1321 } 1322} ); 1323 1324 1325/*! 1326 * jQuery UI Focusable 1.13.0 1327 * http://jqueryui.com 1328 * 1329 * Copyright jQuery Foundation and other contributors 1330 * Released under the MIT license. 1331 * http://jquery.org/license 1332 */ 1333 1334//>>label: :focusable Selector 1335//>>group: Core 1336//>>description: Selects elements which can be focused. 1337//>>docs: http://api.jqueryui.com/focusable-selector/ 1338 1339 1340// Selectors 1341$.ui.focusable = function( element, hasTabindex ) { 1342 var map, mapName, img, focusableIfVisible, fieldset, 1343 nodeName = element.nodeName.toLowerCase(); 1344 1345 if ( "area" === nodeName ) { 1346 map = element.parentNode; 1347 mapName = map.name; 1348 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 1349 return false; 1350 } 1351 img = $( "img[usemap='#" + mapName + "']" ); 1352 return img.length > 0 && img.is( ":visible" ); 1353 } 1354 1355 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 1356 focusableIfVisible = !element.disabled; 1357 1358 if ( focusableIfVisible ) { 1359 1360 // Form controls within a disabled fieldset are disabled. 1361 // However, controls within the fieldset's legend do not get disabled. 1362 // Since controls generally aren't placed inside legends, we skip 1363 // this portion of the check. 1364 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 1365 if ( fieldset ) { 1366 focusableIfVisible = !fieldset.disabled; 1367 } 1368 } 1369 } else if ( "a" === nodeName ) { 1370 focusableIfVisible = element.href || hasTabindex; 1371 } else { 1372 focusableIfVisible = hasTabindex; 1373 } 1374 1375 return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); 1376}; 1377 1378// Support: IE 8 only 1379// IE 8 doesn't resolve inherit to visible/hidden for computed values 1380function visible( element ) { 1381 var visibility = element.css( "visibility" ); 1382 while ( visibility === "inherit" ) { 1383 element = element.parent(); 1384 visibility = element.css( "visibility" ); 1385 } 1386 return visibility === "visible"; 1387} 1388 1389$.extend( $.expr.pseudos, { 1390 focusable: function( element ) { 1391 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 1392 } 1393} ); 1394 1395var focusable = $.ui.focusable; 1396 1397 1398 1399// Support: IE8 Only 1400// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 1401// with a string, so we need to find the proper form. 1402var form = $.fn._form = function() { 1403 return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); 1404}; 1405 1406 1407/*! 1408 * jQuery UI Form Reset Mixin 1.13.0 1409 * http://jqueryui.com 1410 * 1411 * Copyright jQuery Foundation and other contributors 1412 * Released under the MIT license. 1413 * http://jquery.org/license 1414 */ 1415 1416//>>label: Form Reset Mixin 1417//>>group: Core 1418//>>description: Refresh input widgets when their form is reset 1419//>>docs: http://api.jqueryui.com/form-reset-mixin/ 1420 1421 1422var formResetMixin = $.ui.formResetMixin = { 1423 _formResetHandler: function() { 1424 var form = $( this ); 1425 1426 // Wait for the form reset to actually happen before refreshing 1427 setTimeout( function() { 1428 var instances = form.data( "ui-form-reset-instances" ); 1429 $.each( instances, function() { 1430 this.refresh(); 1431 } ); 1432 } ); 1433 }, 1434 1435 _bindFormResetHandler: function() { 1436 this.form = this.element._form(); 1437 if ( !this.form.length ) { 1438 return; 1439 } 1440 1441 var instances = this.form.data( "ui-form-reset-instances" ) || []; 1442 if ( !instances.length ) { 1443 1444 // We don't use _on() here because we use a single event handler per form 1445 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 1446 } 1447 instances.push( this ); 1448 this.form.data( "ui-form-reset-instances", instances ); 1449 }, 1450 1451 _unbindFormResetHandler: function() { 1452 if ( !this.form.length ) { 1453 return; 1454 } 1455 1456 var instances = this.form.data( "ui-form-reset-instances" ); 1457 instances.splice( $.inArray( this, instances ), 1 ); 1458 if ( instances.length ) { 1459 this.form.data( "ui-form-reset-instances", instances ); 1460 } else { 1461 this.form 1462 .removeData( "ui-form-reset-instances" ) 1463 .off( "reset.ui-form-reset" ); 1464 } 1465 } 1466}; 1467 1468 1469/*! 1470 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.0 1471 * http://jqueryui.com 1472 * 1473 * Copyright jQuery Foundation and other contributors 1474 * Released under the MIT license. 1475 * http://jquery.org/license 1476 * 1477 */ 1478 1479//>>label: jQuery 1.8+ Support 1480//>>group: Core 1481//>>description: Support version 1.8.x and newer of jQuery core 1482 1483 1484// Support: jQuery 1.9.x or older 1485// $.expr[ ":" ] is deprecated. 1486if ( !$.expr.pseudos ) { 1487 $.expr.pseudos = $.expr[ ":" ]; 1488} 1489 1490// Support: jQuery 1.11.x or older 1491// $.unique has been renamed to $.uniqueSort 1492if ( !$.uniqueSort ) { 1493 $.uniqueSort = $.unique; 1494} 1495 1496// Support: jQuery 2.2.x or older. 1497// This method has been defined in jQuery 3.0.0. 1498// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 1499if ( !$.escapeSelector ) { 1500 1501 // CSS string/identifier serialization 1502 // https://drafts.csswg.org/cssom/#common-serializing-idioms 1503 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 1504 1505 var fcssescape = function( ch, asCodePoint ) { 1506 if ( asCodePoint ) { 1507 1508 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 1509 if ( ch === "\0" ) { 1510 return "\uFFFD"; 1511 } 1512 1513 // Control characters and (dependent upon position) numbers get escaped as code points 1514 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 1515 } 1516 1517 // Other potentially-special ASCII characters get backslash-escaped 1518 return "\\" + ch; 1519 }; 1520 1521 $.escapeSelector = function( sel ) { 1522 return ( sel + "" ).replace( rcssescape, fcssescape ); 1523 }; 1524} 1525 1526// Support: jQuery 3.4.x or older 1527// These methods have been defined in jQuery 3.5.0. 1528if ( !$.fn.even || !$.fn.odd ) { 1529 $.fn.extend( { 1530 even: function() { 1531 return this.filter( function( i ) { 1532 return i % 2 === 0; 1533 } ); 1534 }, 1535 odd: function() { 1536 return this.filter( function( i ) { 1537 return i % 2 === 1; 1538 } ); 1539 } 1540 } ); 1541} 1542 1543; 1544/*! 1545 * jQuery UI Keycode 1.13.0 1546 * http://jqueryui.com 1547 * 1548 * Copyright jQuery Foundation and other contributors 1549 * Released under the MIT license. 1550 * http://jquery.org/license 1551 */ 1552 1553//>>label: Keycode 1554//>>group: Core 1555//>>description: Provide keycodes as keynames 1556//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 1557 1558 1559var keycode = $.ui.keyCode = { 1560 BACKSPACE: 8, 1561 COMMA: 188, 1562 DELETE: 46, 1563 DOWN: 40, 1564 END: 35, 1565 ENTER: 13, 1566 ESCAPE: 27, 1567 HOME: 36, 1568 LEFT: 37, 1569 PAGE_DOWN: 34, 1570 PAGE_UP: 33, 1571 PERIOD: 190, 1572 RIGHT: 39, 1573 SPACE: 32, 1574 TAB: 9, 1575 UP: 38 1576}; 1577 1578 1579/*! 1580 * jQuery UI Labels 1.13.0 1581 * http://jqueryui.com 1582 * 1583 * Copyright jQuery Foundation and other contributors 1584 * Released under the MIT license. 1585 * http://jquery.org/license 1586 */ 1587 1588//>>label: labels 1589//>>group: Core 1590//>>description: Find all the labels associated with a given input 1591//>>docs: http://api.jqueryui.com/labels/ 1592 1593 1594var labels = $.fn.labels = function() { 1595 var ancestor, selector, id, labels, ancestors; 1596 1597 if ( !this.length ) { 1598 return this.pushStack( [] ); 1599 } 1600 1601 // Check control.labels first 1602 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 1603 return this.pushStack( this[ 0 ].labels ); 1604 } 1605 1606 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 1607 // Above browsers do not support control.labels. Everything below is to support them 1608 // as well as document fragments. control.labels does not work on document fragments 1609 labels = this.eq( 0 ).parents( "label" ); 1610 1611 // Look for the label based on the id 1612 id = this.attr( "id" ); 1613 if ( id ) { 1614 1615 // We don't search against the document in case the element 1616 // is disconnected from the DOM 1617 ancestor = this.eq( 0 ).parents().last(); 1618 1619 // Get a full set of top level ancestors 1620 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 1621 1622 // Create a selector for the label based on the id 1623 selector = "label[for='" + $.escapeSelector( id ) + "']"; 1624 1625 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 1626 1627 } 1628 1629 // Return whatever we have found for labels 1630 return this.pushStack( labels ); 1631}; 1632 1633 1634/*! 1635 * jQuery UI Scroll Parent 1.13.0 1636 * http://jqueryui.com 1637 * 1638 * Copyright jQuery Foundation and other contributors 1639 * Released under the MIT license. 1640 * http://jquery.org/license 1641 */ 1642 1643//>>label: scrollParent 1644//>>group: Core 1645//>>description: Get the closest ancestor element that is scrollable. 1646//>>docs: http://api.jqueryui.com/scrollParent/ 1647 1648 1649var scrollParent = $.fn.scrollParent = function( includeHidden ) { 1650 var position = this.css( "position" ), 1651 excludeStaticParent = position === "absolute", 1652 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 1653 scrollParent = this.parents().filter( function() { 1654 var parent = $( this ); 1655 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 1656 return false; 1657 } 1658 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 1659 parent.css( "overflow-x" ) ); 1660 } ).eq( 0 ); 1661 1662 return position === "fixed" || !scrollParent.length ? 1663 $( this[ 0 ].ownerDocument || document ) : 1664 scrollParent; 1665}; 1666 1667 1668/*! 1669 * jQuery UI Tabbable 1.13.0 1670 * http://jqueryui.com 1671 * 1672 * Copyright jQuery Foundation and other contributors 1673 * Released under the MIT license. 1674 * http://jquery.org/license 1675 */ 1676 1677//>>label: :tabbable Selector 1678//>>group: Core 1679//>>description: Selects elements which can be tabbed to. 1680//>>docs: http://api.jqueryui.com/tabbable-selector/ 1681 1682 1683var tabbable = $.extend( $.expr.pseudos, { 1684 tabbable: function( element ) { 1685 var tabIndex = $.attr( element, "tabindex" ), 1686 hasTabindex = tabIndex != null; 1687 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 1688 } 1689} ); 1690 1691 1692/*! 1693 * jQuery UI Unique ID 1.13.0 1694 * http://jqueryui.com 1695 * 1696 * Copyright jQuery Foundation and other contributors 1697 * Released under the MIT license. 1698 * http://jquery.org/license 1699 */ 1700 1701//>>label: uniqueId 1702//>>group: Core 1703//>>description: Functions to generate and remove uniqueId's 1704//>>docs: http://api.jqueryui.com/uniqueId/ 1705 1706 1707var uniqueId = $.fn.extend( { 1708 uniqueId: ( function() { 1709 var uuid = 0; 1710 1711 return function() { 1712 return this.each( function() { 1713 if ( !this.id ) { 1714 this.id = "ui-id-" + ( ++uuid ); 1715 } 1716 } ); 1717 }; 1718 } )(), 1719 1720 removeUniqueId: function() { 1721 return this.each( function() { 1722 if ( /^ui-id-\d+$/.test( this.id ) ) { 1723 $( this ).removeAttr( "id" ); 1724 } 1725 } ); 1726 } 1727} ); 1728 1729 1730 1731// This file is deprecated 1732var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 1733 1734/*! 1735 * jQuery UI Mouse 1.13.0 1736 * http://jqueryui.com 1737 * 1738 * Copyright jQuery Foundation and other contributors 1739 * Released under the MIT license. 1740 * http://jquery.org/license 1741 */ 1742 1743//>>label: Mouse 1744//>>group: Widgets 1745//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 1746//>>docs: http://api.jqueryui.com/mouse/ 1747 1748 1749var mouseHandled = false; 1750$( document ).on( "mouseup", function() { 1751 mouseHandled = false; 1752} ); 1753 1754var widgetsMouse = $.widget( "ui.mouse", { 1755 version: "1.13.0", 1756 options: { 1757 cancel: "input, textarea, button, select, option", 1758 distance: 1, 1759 delay: 0 1760 }, 1761 _mouseInit: function() { 1762 var that = this; 1763 1764 this.element 1765 .on( "mousedown." + this.widgetName, function( event ) { 1766 return that._mouseDown( event ); 1767 } ) 1768 .on( "click." + this.widgetName, function( event ) { 1769 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 1770 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 1771 event.stopImmediatePropagation(); 1772 return false; 1773 } 1774 } ); 1775 1776 this.started = false; 1777 }, 1778 1779 // TODO: make sure destroying one instance of mouse doesn't mess with 1780 // other instances of mouse 1781 _mouseDestroy: function() { 1782 this.element.off( "." + this.widgetName ); 1783 if ( this._mouseMoveDelegate ) { 1784 this.document 1785 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1786 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1787 } 1788 }, 1789 1790 _mouseDown: function( event ) { 1791 1792 // don't let more than one widget handle mouseStart 1793 if ( mouseHandled ) { 1794 return; 1795 } 1796 1797 this._mouseMoved = false; 1798 1799 // We may have missed mouseup (out of window) 1800 if ( this._mouseStarted ) { 1801 this._mouseUp( event ); 1802 } 1803 1804 this._mouseDownEvent = event; 1805 1806 var that = this, 1807 btnIsLeft = ( event.which === 1 ), 1808 1809 // event.target.nodeName works around a bug in IE 8 with 1810 // disabled inputs (#7620) 1811 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 1812 $( event.target ).closest( this.options.cancel ).length : false ); 1813 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 1814 return true; 1815 } 1816 1817 this.mouseDelayMet = !this.options.delay; 1818 if ( !this.mouseDelayMet ) { 1819 this._mouseDelayTimer = setTimeout( function() { 1820 that.mouseDelayMet = true; 1821 }, this.options.delay ); 1822 } 1823 1824 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1825 this._mouseStarted = ( this._mouseStart( event ) !== false ); 1826 if ( !this._mouseStarted ) { 1827 event.preventDefault(); 1828 return true; 1829 } 1830 } 1831 1832 // Click event may never have fired (Gecko & Opera) 1833 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 1834 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 1835 } 1836 1837 // These delegates are required to keep context 1838 this._mouseMoveDelegate = function( event ) { 1839 return that._mouseMove( event ); 1840 }; 1841 this._mouseUpDelegate = function( event ) { 1842 return that._mouseUp( event ); 1843 }; 1844 1845 this.document 1846 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1847 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1848 1849 event.preventDefault(); 1850 1851 mouseHandled = true; 1852 return true; 1853 }, 1854 1855 _mouseMove: function( event ) { 1856 1857 // Only check for mouseups outside the document if you've moved inside the document 1858 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 1859 // fire a mousemove event if content is placed under the cursor. See #7778 1860 // Support: IE <9 1861 if ( this._mouseMoved ) { 1862 1863 // IE mouseup check - mouseup happened when mouse was out of window 1864 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 1865 !event.button ) { 1866 return this._mouseUp( event ); 1867 1868 // Iframe mouseup check - mouseup occurred in another document 1869 } else if ( !event.which ) { 1870 1871 // Support: Safari <=8 - 9 1872 // Safari sets which to 0 if you press any of the following keys 1873 // during a drag (#14461) 1874 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 1875 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 1876 this.ignoreMissingWhich = true; 1877 } else if ( !this.ignoreMissingWhich ) { 1878 return this._mouseUp( event ); 1879 } 1880 } 1881 } 1882 1883 if ( event.which || event.button ) { 1884 this._mouseMoved = true; 1885 } 1886 1887 if ( this._mouseStarted ) { 1888 this._mouseDrag( event ); 1889 return event.preventDefault(); 1890 } 1891 1892 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 1893 this._mouseStarted = 1894 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 1895 if ( this._mouseStarted ) { 1896 this._mouseDrag( event ); 1897 } else { 1898 this._mouseUp( event ); 1899 } 1900 } 1901 1902 return !this._mouseStarted; 1903 }, 1904 1905 _mouseUp: function( event ) { 1906 this.document 1907 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 1908 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 1909 1910 if ( this._mouseStarted ) { 1911 this._mouseStarted = false; 1912 1913 if ( event.target === this._mouseDownEvent.target ) { 1914 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 1915 } 1916 1917 this._mouseStop( event ); 1918 } 1919 1920 if ( this._mouseDelayTimer ) { 1921 clearTimeout( this._mouseDelayTimer ); 1922 delete this._mouseDelayTimer; 1923 } 1924 1925 this.ignoreMissingWhich = false; 1926 mouseHandled = false; 1927 event.preventDefault(); 1928 }, 1929 1930 _mouseDistanceMet: function( event ) { 1931 return ( Math.max( 1932 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 1933 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 1934 ) >= this.options.distance 1935 ); 1936 }, 1937 1938 _mouseDelayMet: function( /* event */ ) { 1939 return this.mouseDelayMet; 1940 }, 1941 1942 // These are placeholder methods, to be overriden by extending plugin 1943 _mouseStart: function( /* event */ ) {}, 1944 _mouseDrag: function( /* event */ ) {}, 1945 _mouseStop: function( /* event */ ) {}, 1946 _mouseCapture: function( /* event */ ) { 1947 return true; 1948 } 1949} ); 1950 1951 1952 1953// $.ui.plugin is deprecated. Use $.widget() extensions instead. 1954var plugin = $.ui.plugin = { 1955 add: function( module, option, set ) { 1956 var i, 1957 proto = $.ui[ module ].prototype; 1958 for ( i in set ) { 1959 proto.plugins[ i ] = proto.plugins[ i ] || []; 1960 proto.plugins[ i ].push( [ option, set[ i ] ] ); 1961 } 1962 }, 1963 call: function( instance, name, args, allowDisconnected ) { 1964 var i, 1965 set = instance.plugins[ name ]; 1966 1967 if ( !set ) { 1968 return; 1969 } 1970 1971 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 1972 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 1973 return; 1974 } 1975 1976 for ( i = 0; i < set.length; i++ ) { 1977 if ( instance.options[ set[ i ][ 0 ] ] ) { 1978 set[ i ][ 1 ].apply( instance.element, args ); 1979 } 1980 } 1981 } 1982}; 1983 1984 1985 1986var safeActiveElement = $.ui.safeActiveElement = function( document ) { 1987 var activeElement; 1988 1989 // Support: IE 9 only 1990 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 1991 try { 1992 activeElement = document.activeElement; 1993 } catch ( error ) { 1994 activeElement = document.body; 1995 } 1996 1997 // Support: IE 9 - 11 only 1998 // IE may return null instead of an element 1999 // Interestingly, this only seems to occur when NOT in an iframe 2000 if ( !activeElement ) { 2001 activeElement = document.body; 2002 } 2003 2004 // Support: IE 11 only 2005 // IE11 returns a seemingly empty object in some cases when accessing 2006 // document.activeElement from an <iframe> 2007 if ( !activeElement.nodeName ) { 2008 activeElement = document.body; 2009 } 2010 2011 return activeElement; 2012}; 2013 2014 2015 2016var safeBlur = $.ui.safeBlur = function( element ) { 2017 2018 // Support: IE9 - 10 only 2019 // If the <body> is blurred, IE will switch windows, see #9420 2020 if ( element && element.nodeName.toLowerCase() !== "body" ) { 2021 $( element ).trigger( "blur" ); 2022 } 2023}; 2024 2025 2026/*! 2027 * jQuery UI Draggable 1.13.0 2028 * http://jqueryui.com 2029 * 2030 * Copyright jQuery Foundation and other contributors 2031 * Released under the MIT license. 2032 * http://jquery.org/license 2033 */ 2034 2035//>>label: Draggable 2036//>>group: Interactions 2037//>>description: Enables dragging functionality for any element. 2038//>>docs: http://api.jqueryui.com/draggable/ 2039//>>demos: http://jqueryui.com/draggable/ 2040//>>css.structure: ../../themes/base/draggable.css 2041 2042 2043$.widget( "ui.draggable", $.ui.mouse, { 2044 version: "1.13.0", 2045 widgetEventPrefix: "drag", 2046 options: { 2047 addClasses: true, 2048 appendTo: "parent", 2049 axis: false, 2050 connectToSortable: false, 2051 containment: false, 2052 cursor: "auto", 2053 cursorAt: false, 2054 grid: false, 2055 handle: false, 2056 helper: "original", 2057 iframeFix: false, 2058 opacity: false, 2059 refreshPositions: false, 2060 revert: false, 2061 revertDuration: 500, 2062 scope: "default", 2063 scroll: true, 2064 scrollSensitivity: 20, 2065 scrollSpeed: 20, 2066 snap: false, 2067 snapMode: "both", 2068 snapTolerance: 20, 2069 stack: false, 2070 zIndex: false, 2071 2072 // Callbacks 2073 drag: null, 2074 start: null, 2075 stop: null 2076 }, 2077 _create: function() { 2078 2079 if ( this.options.helper === "original" ) { 2080 this._setPositionRelative(); 2081 } 2082 if ( this.options.addClasses ) { 2083 this._addClass( "ui-draggable" ); 2084 } 2085 this._setHandleClassName(); 2086 2087 this._mouseInit(); 2088 }, 2089 2090 _setOption: function( key, value ) { 2091 this._super( key, value ); 2092 if ( key === "handle" ) { 2093 this._removeHandleClassName(); 2094 this._setHandleClassName(); 2095 } 2096 }, 2097 2098 _destroy: function() { 2099 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 2100 this.destroyOnClear = true; 2101 return; 2102 } 2103 this._removeHandleClassName(); 2104 this._mouseDestroy(); 2105 }, 2106 2107 _mouseCapture: function( event ) { 2108 var o = this.options; 2109 2110 // Among others, prevent a drag on a resizable-handle 2111 if ( this.helper || o.disabled || 2112 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 2113 return false; 2114 } 2115 2116 //Quit if we're not on a valid handle 2117 this.handle = this._getHandle( event ); 2118 if ( !this.handle ) { 2119 return false; 2120 } 2121 2122 this._blurActiveElement( event ); 2123 2124 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 2125 2126 return true; 2127 2128 }, 2129 2130 _blockFrames: function( selector ) { 2131 this.iframeBlocks = this.document.find( selector ).map( function() { 2132 var iframe = $( this ); 2133 2134 return $( "<div>" ) 2135 .css( "position", "absolute" ) 2136 .appendTo( iframe.parent() ) 2137 .outerWidth( iframe.outerWidth() ) 2138 .outerHeight( iframe.outerHeight() ) 2139 .offset( iframe.offset() )[ 0 ]; 2140 } ); 2141 }, 2142 2143 _unblockFrames: function() { 2144 if ( this.iframeBlocks ) { 2145 this.iframeBlocks.remove(); 2146 delete this.iframeBlocks; 2147 } 2148 }, 2149 2150 _blurActiveElement: function( event ) { 2151 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 2152 target = $( event.target ); 2153 2154 // Don't blur if the event occurred on an element that is within 2155 // the currently focused element 2156 // See #10527, #12472 2157 if ( target.closest( activeElement ).length ) { 2158 return; 2159 } 2160 2161 // Blur any element that currently has focus, see #4261 2162 $.ui.safeBlur( activeElement ); 2163 }, 2164 2165 _mouseStart: function( event ) { 2166 2167 var o = this.options; 2168 2169 //Create and append the visible helper 2170 this.helper = this._createHelper( event ); 2171 2172 this._addClass( this.helper, "ui-draggable-dragging" ); 2173 2174 //Cache the helper size 2175 this._cacheHelperProportions(); 2176 2177 //If ddmanager is used for droppables, set the global draggable 2178 if ( $.ui.ddmanager ) { 2179 $.ui.ddmanager.current = this; 2180 } 2181 2182 /* 2183 * - Position generation - 2184 * This block generates everything position related - it's the core of draggables. 2185 */ 2186 2187 //Cache the margins of the original element 2188 this._cacheMargins(); 2189 2190 //Store the helper's css position 2191 this.cssPosition = this.helper.css( "position" ); 2192 this.scrollParent = this.helper.scrollParent( true ); 2193 this.offsetParent = this.helper.offsetParent(); 2194 this.hasFixedAncestor = this.helper.parents().filter( function() { 2195 return $( this ).css( "position" ) === "fixed"; 2196 } ).length > 0; 2197 2198 //The element's absolute position on the page minus margins 2199 this.positionAbs = this.element.offset(); 2200 this._refreshOffsets( event ); 2201 2202 //Generate the original position 2203 this.originalPosition = this.position = this._generatePosition( event, false ); 2204 this.originalPageX = event.pageX; 2205 this.originalPageY = event.pageY; 2206 2207 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 2208 if ( o.cursorAt ) { 2209 this._adjustOffsetFromHelper( o.cursorAt ); 2210 } 2211 2212 //Set a containment if given in the options 2213 this._setContainment(); 2214 2215 //Trigger event + callbacks 2216 if ( this._trigger( "start", event ) === false ) { 2217 this._clear(); 2218 return false; 2219 } 2220 2221 //Recache the helper size 2222 this._cacheHelperProportions(); 2223 2224 //Prepare the droppable offsets 2225 if ( $.ui.ddmanager && !o.dropBehaviour ) { 2226 $.ui.ddmanager.prepareOffsets( this, event ); 2227 } 2228 2229 // Execute the drag once - this causes the helper not to be visible before getting its 2230 // correct position 2231 this._mouseDrag( event, true ); 2232 2233 // If the ddmanager is used for droppables, inform the manager that dragging has started 2234 // (see #5003) 2235 if ( $.ui.ddmanager ) { 2236 $.ui.ddmanager.dragStart( this, event ); 2237 } 2238 2239 return true; 2240 }, 2241 2242 _refreshOffsets: function( event ) { 2243 this.offset = { 2244 top: this.positionAbs.top - this.margins.top, 2245 left: this.positionAbs.left - this.margins.left, 2246 scroll: false, 2247 parent: this._getParentOffset(), 2248 relative: this._getRelativeOffset() 2249 }; 2250 2251 this.offset.click = { 2252 left: event.pageX - this.offset.left, 2253 top: event.pageY - this.offset.top 2254 }; 2255 }, 2256 2257 _mouseDrag: function( event, noPropagation ) { 2258 2259 // reset any necessary cached properties (see #5009) 2260 if ( this.hasFixedAncestor ) { 2261 this.offset.parent = this._getParentOffset(); 2262 } 2263 2264 //Compute the helpers position 2265 this.position = this._generatePosition( event, true ); 2266 this.positionAbs = this._convertPositionTo( "absolute" ); 2267 2268 //Call plugins and callbacks and use the resulting position if something is returned 2269 if ( !noPropagation ) { 2270 var ui = this._uiHash(); 2271 if ( this._trigger( "drag", event, ui ) === false ) { 2272 this._mouseUp( new $.Event( "mouseup", event ) ); 2273 return false;
vendor: 2,945 bytes, lines 2274-2390
2274 } 2275 this.position = ui.position; 2276 } 2277 2278 this.helper[ 0 ].style.left = this.position.left + "px"; 2279 this.helper[ 0 ].style.top = this.position.top + "px"; 2280 2281 if ( $.ui.ddmanager ) { 2282 $.ui.ddmanager.drag( this, event ); 2283 } 2284 2285 return false; 2286 }, 2287 2288 _mouseStop: function( event ) { 2289 2290 //If we are using droppables, inform the manager about the drop 2291 var that = this, 2292 dropped = false; 2293 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 2294 dropped = $.ui.ddmanager.drop( this, event ); 2295 } 2296 2297 //if a drop comes from outside (a sortable) 2298 if ( this.dropped ) { 2299 dropped = this.dropped; 2300 this.dropped = false; 2301 } 2302 2303 if ( ( this.options.revert === "invalid" && !dropped ) || 2304 ( this.options.revert === "valid" && dropped ) || 2305 this.options.revert === true || ( typeof this.options.revert === "function" && 2306 this.options.revert.call( this.element, dropped ) ) 2307 ) { 2308 $( this.helper ).animate( 2309 this.originalPosition, 2310 parseInt( this.options.revertDuration, 10 ), 2311 function() { 2312 if ( that._trigger( "stop", event ) !== false ) { 2313 that._clear(); 2314 } 2315 } 2316 ); 2317 } else { 2318 if ( this._trigger( "stop", event ) !== false ) { 2319 this._clear(); 2320 } 2321 } 2322 2323 return false; 2324 }, 2325 2326 _mouseUp: function( event ) { 2327 this._unblockFrames(); 2328 2329 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 2330 // (see #5003) 2331 if ( $.ui.ddmanager ) { 2332 $.ui.ddmanager.dragStop( this, event ); 2333 } 2334 2335 // Only need to focus if the event occurred on the draggable itself, see #10527 2336 if ( this.handleElement.is( event.target ) ) { 2337 2338 // The interaction is over; whether or not the click resulted in a drag, 2339 // focus the element 2340 this.element.trigger( "focus" ); 2341 } 2342 2343 return $.ui.mouse.prototype._mouseUp.call( this, event ); 2344 }, 2345 2346 cancel: function() { 2347 2348 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 2349 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 2350 } else { 2351 this._clear(); 2352 } 2353 2354 return this; 2355 2356 }, 2357 2358 _getHandle: function( event ) { 2359 return this.options.handle ? 2360 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 2361 true; 2362 }, 2363 2364 _setHandleClassName: function() { 2365 this.handleElement = this.options.handle ? 2366 this.element.find( this.options.handle ) : this.element; 2367 this._addClass( this.handleElement, "ui-draggable-handle" ); 2368 }, 2369 2370 _removeHandleClassName: function() { 2371 this._removeClass( this.handleElement, "ui-draggable-handle" ); 2372 }, 2373 2374 _createHelper: function( event ) { 2375 2376 var o = this.options, 2377 helperIsFunction = typeof o.helper === "function", 2378 helper = helperIsFunction ? 2379 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 2380 ( o.helper === "clone" ? 2381 this.element.clone().removeAttr( "id" ) : 2382 this.element ); 2383 2384 if ( !helper.parents( "body" ).length ) { 2385 helper.appendTo( ( o.appendTo === "parent" ? 2386 this.element[ 0 ].parentNode : 2387 o.appendTo ) ); 2388 } 2389 2390 // Http
vendor: 25,976 bytes, lines 2390-3262
2390://bugs.jqueryui.com/ticket/9446 2391 // a helper function can return the original element 2392 // which wouldn't have been set to relative in _create 2393 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 2394 this._setPositionRelative(); 2395 } 2396 2397 if ( helper[ 0 ] !== this.element[ 0 ] && 2398 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 2399 helper.css( "position", "absolute" ); 2400 } 2401 2402 return helper; 2403 2404 }, 2405 2406 _setPositionRelative: function() { 2407 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 2408 this.element[ 0 ].style.position = "relative"; 2409 } 2410 }, 2411 2412 _adjustOffsetFromHelper: function( obj ) { 2413 if ( typeof obj === "string" ) { 2414 obj = obj.split( " " ); 2415 } 2416 if ( Array.isArray( obj ) ) { 2417 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 2418 } 2419 if ( "left" in obj ) { 2420 this.offset.click.left = obj.left + this.margins.left; 2421 } 2422 if ( "right" in obj ) { 2423 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 2424 } 2425 if ( "top" in obj ) { 2426 this.offset.click.top = obj.top + this.margins.top; 2427 } 2428 if ( "bottom" in obj ) { 2429 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 2430 } 2431 }, 2432 2433 _isRootNode: function( element ) { 2434 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 2435 }, 2436 2437 _getParentOffset: function() { 2438 2439 //Get the offsetParent and cache its position 2440 var po = this.offsetParent.offset(), 2441 document = this.document[ 0 ]; 2442 2443 // This is a special case where we need to modify a offset calculated on start, since the 2444 // following happened: 2445 // 1. The position of the helper is absolute, so it's position is calculated based on the 2446 // next positioned parent 2447 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 2448 // the document, which means that the scroll is included in the initial calculation of the 2449 // offset of the parent, and never recalculated upon drag 2450 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 2451 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 2452 po.left += this.scrollParent.scrollLeft(); 2453 po.top += this.scrollParent.scrollTop(); 2454 } 2455 2456 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 2457 po = { top: 0, left: 0 }; 2458 } 2459 2460 return { 2461 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 2462 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 2463 }; 2464 2465 }, 2466 2467 _getRelativeOffset: function() { 2468 if ( this.cssPosition !== "relative" ) { 2469 return { top: 0, left: 0 }; 2470 } 2471 2472 var p = this.element.position(), 2473 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2474 2475 return { 2476 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 2477 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 2478 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 2479 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 2480 }; 2481 2482 }, 2483 2484 _cacheMargins: function() { 2485 this.margins = { 2486 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 2487 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 2488 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 2489 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 2490 }; 2491 }, 2492 2493 _cacheHelperProportions: function() { 2494 this.helperProportions = { 2495 width: this.helper.outerWidth(), 2496 height: this.helper.outerHeight() 2497 }; 2498 }, 2499 2500 _setContainment: function() { 2501 2502 var isUserScrollable, c, ce, 2503 o = this.options, 2504 document = this.document[ 0 ]; 2505 2506 this.relativeContainer = null; 2507 2508 if ( !o.containment ) { 2509 this.containment = null; 2510 return; 2511 } 2512 2513 if ( o.containment === "window" ) { 2514 this.containment = [ 2515 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 2516 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 2517 $( window ).scrollLeft() + $( window ).width() - 2518 this.helperProportions.width - this.margins.left, 2519 $( window ).scrollTop() + 2520 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 2521 this.helperProportions.height - this.margins.top 2522 ]; 2523 return; 2524 } 2525 2526 if ( o.containment === "document" ) { 2527 this.containment = [ 2528 0, 2529 0, 2530 $( document ).width() - this.helperProportions.width - this.margins.left, 2531 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 2532 this.helperProportions.height - this.margins.top 2533 ]; 2534 return; 2535 } 2536 2537 if ( o.containment.constructor === Array ) { 2538 this.containment = o.containment; 2539 return; 2540 } 2541 2542 if ( o.containment === "parent" ) { 2543 o.containment = this.helper[ 0 ].parentNode; 2544 } 2545 2546 c = $( o.containment ); 2547 ce = c[ 0 ]; 2548 2549 if ( !ce ) { 2550 return; 2551 } 2552 2553 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 2554 2555 this.containment = [ 2556 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 2557 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 2558 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 2559 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 2560 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 2561 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 2562 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 2563 this.helperProportions.width - 2564 this.margins.left - 2565 this.margins.right, 2566 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 2567 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 2568 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 2569 this.helperProportions.height - 2570 this.margins.top - 2571 this.margins.bottom 2572 ]; 2573 this.relativeContainer = c; 2574 }, 2575 2576 _convertPositionTo: function( d, pos ) { 2577 2578 if ( !pos ) { 2579 pos = this.position; 2580 } 2581 2582 var mod = d === "absolute" ? 1 : -1, 2583 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 2584 2585 return { 2586 top: ( 2587 2588 // The absolute mouse position 2589 pos.top + 2590 2591 // Only for relative positioned nodes: Relative offset from element to offset parent 2592 this.offset.relative.top * mod + 2593 2594 // The offsetParent's offset without borders (offset + border) 2595 this.offset.parent.top * mod - 2596 ( ( this.cssPosition === "fixed" ? 2597 -this.offset.scroll.top : 2598 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 2599 ), 2600 left: ( 2601 2602 // The absolute mouse position 2603 pos.left + 2604 2605 // Only for relative positioned nodes: Relative offset from element to offset parent 2606 this.offset.relative.left * mod + 2607 2608 // The offsetParent's offset without borders (offset + border) 2609 this.offset.parent.left * mod - 2610 ( ( this.cssPosition === "fixed" ? 2611 -this.offset.scroll.left : 2612 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 2613 ) 2614 }; 2615 2616 }, 2617 2618 _generatePosition: function( event, constrainPosition ) { 2619 2620 var containment, co, top, left, 2621 o = this.options, 2622 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 2623 pageX = event.pageX, 2624 pageY = event.pageY; 2625 2626 // Cache the scroll 2627 if ( !scrollIsRootNode || !this.offset.scroll ) { 2628 this.offset.scroll = { 2629 top: this.scrollParent.scrollTop(), 2630 left: this.scrollParent.scrollLeft() 2631 }; 2632 } 2633 2634 /* 2635 * - Position constraining - 2636 * Constrain the position to a mix of grid, containment. 2637 */ 2638 2639 // If we are not dragging yet, we won't check for options 2640 if ( constrainPosition ) { 2641 if ( this.containment ) { 2642 if ( this.relativeContainer ) { 2643 co = this.relativeContainer.offset(); 2644 containment = [ 2645 this.containment[ 0 ] + co.left, 2646 this.containment[ 1 ] + co.top, 2647 this.containment[ 2 ] + co.left, 2648 this.containment[ 3 ] + co.top 2649 ]; 2650 } else { 2651 containment = this.containment; 2652 } 2653 2654 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 2655 pageX = containment[ 0 ] + this.offset.click.left; 2656 } 2657 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 2658 pageY = containment[ 1 ] + this.offset.click.top; 2659 } 2660 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 2661 pageX = containment[ 2 ] + this.offset.click.left; 2662 } 2663 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 2664 pageY = containment[ 3 ] + this.offset.click.top; 2665 } 2666 } 2667 2668 if ( o.grid ) { 2669 2670 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 2671 // argument errors in IE (see ticket #6950) 2672 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 2673 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 2674 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 2675 top - this.offset.click.top > containment[ 3 ] ) ? 2676 top : 2677 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 2678 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 2679 2680 left = o.grid[ 0 ] ? this.originalPageX + 2681 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 2682 this.originalPageX; 2683 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 2684 left - this.offset.click.left > containment[ 2 ] ) ? 2685 left : 2686 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 2687 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 2688 } 2689 2690 if ( o.axis === "y" ) { 2691 pageX = this.originalPageX; 2692 } 2693 2694 if ( o.axis === "x" ) { 2695 pageY = this.originalPageY; 2696 } 2697 } 2698 2699 return { 2700 top: ( 2701 2702 // The absolute mouse position 2703 pageY - 2704 2705 // Click offset (relative to the element) 2706 this.offset.click.top - 2707 2708 // Only for relative positioned nodes: Relative offset from element to offset parent 2709 this.offset.relative.top - 2710 2711 // The offsetParent's offset without borders (offset + border) 2712 this.offset.parent.top + 2713 ( this.cssPosition === "fixed" ? 2714 -this.offset.scroll.top : 2715 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 2716 ), 2717 left: ( 2718 2719 // The absolute mouse position 2720 pageX - 2721 2722 // Click offset (relative to the element) 2723 this.offset.click.left - 2724 2725 // Only for relative positioned nodes: Relative offset from element to offset parent 2726 this.offset.relative.left - 2727 2728 // The offsetParent's offset without borders (offset + border) 2729 this.offset.parent.left + 2730 ( this.cssPosition === "fixed" ? 2731 -this.offset.scroll.left : 2732 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 2733 ) 2734 }; 2735 2736 }, 2737 2738 _clear: function() { 2739 this._removeClass( this.helper, "ui-draggable-dragging" ); 2740 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 2741 this.helper.remove(); 2742 } 2743 this.helper = null; 2744 this.cancelHelperRemoval = false; 2745 if ( this.destroyOnClear ) { 2746 this.destroy(); 2747 } 2748 }, 2749 2750 // From now on bulk stuff - mainly helpers 2751 2752 _trigger: function( type, event, ui ) { 2753 ui = ui || this._uiHash(); 2754 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 2755 2756 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 2757 if ( /^(drag|start|stop)/.test( type ) ) { 2758 this.positionAbs = this._convertPositionTo( "absolute" ); 2759 ui.offset = this.positionAbs; 2760 } 2761 return $.Widget.prototype._trigger.call( this, type, event, ui ); 2762 }, 2763 2764 plugins: {}, 2765 2766 _uiHash: function() { 2767 return { 2768 helper: this.helper, 2769 position: this.position, 2770 originalPosition: this.originalPosition, 2771 offset: this.positionAbs 2772 }; 2773 } 2774 2775} ); 2776 2777$.ui.plugin.add( "draggable", "connectToSortable", { 2778 start: function( event, ui, draggable ) { 2779 var uiSortable = $.extend( {}, ui, { 2780 item: draggable.element 2781 } ); 2782 2783 draggable.sortables = []; 2784 $( draggable.options.connectToSortable ).each( function() { 2785 var sortable = $( this ).sortable( "instance" ); 2786 2787 if ( sortable && !sortable.options.disabled ) { 2788 draggable.sortables.push( sortable ); 2789 2790 // RefreshPositions is called at drag start to refresh the containerCache 2791 // which is used in drag. This ensures it's initialized and synchronized 2792 // with any changes that might have happened on the page since initialization. 2793 sortable.refreshPositions(); 2794 sortable._trigger( "activate", event, uiSortable ); 2795 } 2796 } ); 2797 }, 2798 stop: function( event, ui, draggable ) { 2799 var uiSortable = $.extend( {}, ui, { 2800 item: draggable.element 2801 } ); 2802 2803 draggable.cancelHelperRemoval = false; 2804 2805 $.each( draggable.sortables, function() { 2806 var sortable = this; 2807 2808 if ( sortable.isOver ) { 2809 sortable.isOver = 0; 2810 2811 // Allow this sortable to handle removing the helper 2812 draggable.cancelHelperRemoval = true; 2813 sortable.cancelHelperRemoval = false; 2814 2815 // Use _storedCSS To restore properties in the sortable, 2816 // as this also handles revert (#9675) since the draggable 2817 // may have modified them in unexpected ways (#8809) 2818 sortable._storedCSS = { 2819 position: sortable.placeholder.css( "position" ), 2820 top: sortable.placeholder.css( "top" ), 2821 left: sortable.placeholder.css( "left" ) 2822 }; 2823 2824 sortable._mouseStop( event ); 2825 2826 // Once drag has ended, the sortable should return to using 2827 // its original helper, not the shared helper from draggable 2828 sortable.options.helper = sortable.options._helper; 2829 } else { 2830 2831 // Prevent this Sortable from removing the helper. 2832 // However, don't set the draggable to remove the helper 2833 // either as another connected Sortable may yet handle the removal. 2834 sortable.cancelHelperRemoval = true; 2835 2836 sortable._trigger( "deactivate", event, uiSortable ); 2837 } 2838 } ); 2839 }, 2840 drag: function( event, ui, draggable ) { 2841 $.each( draggable.sortables, function() { 2842 var innermostIntersecting = false, 2843 sortable = this; 2844 2845 // Copy over variables that sortable's _intersectsWith uses 2846 sortable.positionAbs = draggable.positionAbs; 2847 sortable.helperProportions = draggable.helperProportions; 2848 sortable.offset.click = draggable.offset.click; 2849 2850 if ( sortable._intersectsWith( sortable.containerCache ) ) { 2851 innermostIntersecting = true; 2852 2853 $.each( draggable.sortables, function() { 2854 2855 // Copy over variables that sortable's _intersectsWith uses 2856 this.positionAbs = draggable.positionAbs; 2857 this.helperProportions = draggable.helperProportions; 2858 this.offset.click = draggable.offset.click; 2859 2860 if ( this !== sortable && 2861 this._intersectsWith( this.containerCache ) && 2862 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 2863 innermostIntersecting = false; 2864 } 2865 2866 return innermostIntersecting; 2867 } ); 2868 } 2869 2870 if ( innermostIntersecting ) { 2871 2872 // If it intersects, we use a little isOver variable and set it once, 2873 // so that the move-in stuff gets fired only once. 2874 if ( !sortable.isOver ) { 2875 sortable.isOver = 1; 2876 2877 // Store draggable's parent in case we need to reappend to it later. 2878 draggable._parent = ui.helper.parent(); 2879 2880 sortable.currentItem = ui.helper 2881 .appendTo( sortable.element ) 2882 .data( "ui-sortable-item", true ); 2883 2884 // Store helper option to later restore it 2885 sortable.options._helper = sortable.options.helper; 2886 2887 sortable.options.helper = function() { 2888 return ui.helper[ 0 ]; 2889 }; 2890 2891 // Fire the start events of the sortable with our passed browser event, 2892 // and our own helper (so it doesn't create a new one) 2893 event.target = sortable.currentItem[ 0 ]; 2894 sortable._mouseCapture( event, true ); 2895 sortable._mouseStart( event, true, true ); 2896 2897 // Because the browser event is way off the new appended portlet, 2898 // modify necessary variables to reflect the changes 2899 sortable.offset.click.top = draggable.offset.click.top; 2900 sortable.offset.click.left = draggable.offset.click.left; 2901 sortable.offset.parent.left -= draggable.offset.parent.left - 2902 sortable.offset.parent.left; 2903 sortable.offset.parent.top -= draggable.offset.parent.top - 2904 sortable.offset.parent.top; 2905 2906 draggable._trigger( "toSortable", event ); 2907 2908 // Inform draggable that the helper is in a valid drop zone, 2909 // used solely in the revert option to handle "valid/invalid". 2910 draggable.dropped = sortable.element; 2911 2912 // Need to refreshPositions of all sortables in the case that 2913 // adding to one sortable changes the location of the other sortables (#9675) 2914 $.each( draggable.sortables, function() { 2915 this.refreshPositions(); 2916 } ); 2917 2918 // Hack so receive/update callbacks work (mostly) 2919 draggable.currentItem = draggable.element; 2920 sortable.fromOutside = draggable; 2921 } 2922 2923 if ( sortable.currentItem ) { 2924 sortable._mouseDrag( event ); 2925 2926 // Copy the sortable's position because the draggable's can potentially reflect 2927 // a relative position, while sortable is always absolute, which the dragged 2928 // element has now become. (#8809) 2929 ui.position = sortable.position; 2930 } 2931 } else { 2932 2933 // If it doesn't intersect with the sortable, and it intersected before, 2934 // we fake the drag stop of the sortable, but make sure it doesn't remove 2935 // the helper by using cancelHelperRemoval. 2936 if ( sortable.isOver ) { 2937 2938 sortable.isOver = 0; 2939 sortable.cancelHelperRemoval = true; 2940 2941 // Calling sortable's mouseStop would trigger a revert, 2942 // so revert must be temporarily false until after mouseStop is called. 2943 sortable.options._revert = sortable.options.revert; 2944 sortable.options.revert = false; 2945 2946 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 2947 sortable._mouseStop( event, true ); 2948 2949 // Restore sortable behaviors that were modfied 2950 // when the draggable entered the sortable area (#9481) 2951 sortable.options.revert = sortable.options._revert; 2952 sortable.options.helper = sortable.options._helper; 2953 2954 if ( sortable.placeholder ) { 2955 sortable.placeholder.remove(); 2956 } 2957 2958 // Restore and recalculate the draggable's offset considering the sortable 2959 // may have modified them in unexpected ways. (#8809, #10669) 2960 ui.helper.appendTo( draggable._parent ); 2961 draggable._refreshOffsets( event ); 2962 ui.position = draggable._generatePosition( event, true ); 2963 2964 draggable._trigger( "fromSortable", event ); 2965 2966 // Inform draggable that the helper is no longer in a valid drop zone 2967 draggable.dropped = false; 2968 2969 // Need to refreshPositions of all sortables just in case removing 2970 // from one sortable changes the location of other sortables (#9675) 2971 $.each( draggable.sortables, function() { 2972 this.refreshPositions(); 2973 } ); 2974 } 2975 } 2976 } ); 2977 } 2978} ); 2979 2980$.ui.plugin.add( "draggable", "cursor", { 2981 start: function( event, ui, instance ) { 2982 var t = $( "body" ), 2983 o = instance.options; 2984 2985 if ( t.css( "cursor" ) ) { 2986 o._cursor = t.css( "cursor" ); 2987 } 2988 t.css( "cursor", o.cursor ); 2989 }, 2990 stop: function( event, ui, instance ) { 2991 var o = instance.options; 2992 if ( o._cursor ) { 2993 $( "body" ).css( "cursor", o._cursor ); 2994 } 2995 } 2996} ); 2997 2998$.ui.plugin.add( "draggable", "opacity", { 2999 start: function( event, ui, instance ) { 3000 var t = $( ui.helper ), 3001 o = instance.options; 3002 if ( t.css( "opacity" ) ) { 3003 o._opacity = t.css( "opacity" ); 3004 } 3005 t.css( "opacity", o.opacity ); 3006 }, 3007 stop: function( event, ui, instance ) { 3008 var o = instance.options; 3009 if ( o._opacity ) { 3010 $( ui.helper ).css( "opacity", o._opacity ); 3011 } 3012 } 3013} ); 3014 3015$.ui.plugin.add( "draggable", "scroll", { 3016 start: function( event, ui, i ) { 3017 if ( !i.scrollParentNotHidden ) { 3018 i.scrollParentNotHidden = i.helper.scrollParent( false ); 3019 } 3020 3021 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 3022 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 3023 i.overflowOffset = i.scrollParentNotHidden.offset(); 3024 } 3025 }, 3026 drag: function( event, ui, i ) { 3027 3028 var o = i.options, 3029 scrolled = false, 3030 scrollParent = i.scrollParentNotHidden[ 0 ], 3031 document = i.document[ 0 ]; 3032 3033 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 3034 if ( !o.axis || o.axis !== "x" ) { 3035 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 3036 o.scrollSensitivity ) { 3037 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 3038 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 3039 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 3040 } 3041 } 3042 3043 if ( !o.axis || o.axis !== "y" ) { 3044 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 3045 o.scrollSensitivity ) { 3046 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 3047 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 3048 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 3049 } 3050 } 3051 3052 } else { 3053 3054 if ( !o.axis || o.axis !== "x" ) { 3055 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 3056 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 3057 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 3058 o.scrollSensitivity ) { 3059 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 3060 } 3061 } 3062 3063 if ( !o.axis || o.axis !== "y" ) { 3064 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 3065 scrolled = $( document ).scrollLeft( 3066 $( document ).scrollLeft() - o.scrollSpeed 3067 ); 3068 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 3069 o.scrollSensitivity ) { 3070 scrolled = $( document ).scrollLeft( 3071 $( document ).scrollLeft() + o.scrollSpeed 3072 ); 3073 } 3074 } 3075 3076 } 3077 3078 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 3079 $.ui.ddmanager.prepareOffsets( i, event ); 3080 } 3081 3082 } 3083} ); 3084 3085$.ui.plugin.add( "draggable", "snap", { 3086 start: function( event, ui, i ) { 3087 3088 var o = i.options; 3089 3090 i.snapElements = []; 3091 3092 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 3093 .each( function() { 3094 var $t = $( this ), 3095 $o = $t.offset(); 3096 if ( this !== i.element[ 0 ] ) { 3097 i.snapElements.push( { 3098 item: this, 3099 width: $t.outerWidth(), height: $t.outerHeight(), 3100 top: $o.top, left: $o.left 3101 } ); 3102 } 3103 } ); 3104 3105 }, 3106 drag: function( event, ui, inst ) { 3107 3108 var ts, bs, ls, rs, l, r, t, b, i, first, 3109 o = inst.options, 3110 d = o.snapTolerance, 3111 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 3112 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 3113 3114 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 3115 3116 l = inst.snapElements[ i ].left - inst.margins.left; 3117 r = l + inst.snapElements[ i ].width; 3118 t = inst.snapElements[ i ].top - inst.margins.top; 3119 b = t + inst.snapElements[ i ].height; 3120 3121 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 3122 !$.contains( inst.snapElements[ i ].item.ownerDocument, 3123 inst.snapElements[ i ].item ) ) { 3124 if ( inst.snapElements[ i ].snapping ) { 3125 if ( inst.options.snap.release ) { 3126 inst.options.snap.release.call( 3127 inst.element, 3128 event, 3129 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 3130 ); 3131 } 3132 } 3133 inst.snapElements[ i ].snapping = false; 3134 continue; 3135 } 3136 3137 if ( o.snapMode !== "inner" ) { 3138 ts = Math.abs( t - y2 ) <= d; 3139 bs = Math.abs( b - y1 ) <= d; 3140 ls = Math.abs( l - x2 ) <= d; 3141 rs = Math.abs( r - x1 ) <= d; 3142 if ( ts ) { 3143 ui.position.top = inst._convertPositionTo( "relative", { 3144 top: t - inst.helperProportions.height, 3145 left: 0 3146 } ).top; 3147 } 3148 if ( bs ) { 3149 ui.position.top = inst._convertPositionTo( "relative", { 3150 top: b, 3151 left: 0 3152 } ).top; 3153 } 3154 if ( ls ) { 3155 ui.position.left = inst._convertPositionTo( "relative", { 3156 top: 0, 3157 left: l - inst.helperProportions.width 3158 } ).left; 3159 } 3160 if ( rs ) { 3161 ui.position.left = inst._convertPositionTo( "relative", { 3162 top: 0, 3163 left: r 3164 } ).left; 3165 } 3166 } 3167 3168 first = ( ts || bs || ls || rs ); 3169 3170 if ( o.snapMode !== "outer" ) { 3171 ts = Math.abs( t - y1 ) <= d; 3172 bs = Math.abs( b - y2 ) <= d; 3173 ls = Math.abs( l - x1 ) <= d; 3174 rs = Math.abs( r - x2 ) <= d; 3175 if ( ts ) { 3176 ui.position.top = inst._convertPositionTo( "relative", { 3177 top: t, 3178 left: 0 3179 } ).top; 3180 } 3181 if ( bs ) { 3182 ui.position.top = inst._convertPositionTo( "relative", { 3183 top: b - inst.helperProportions.height, 3184 left: 0 3185 } ).top; 3186 } 3187 if ( ls ) { 3188 ui.position.left = inst._convertPositionTo( "relative", { 3189 top: 0, 3190 left: l 3191 } ).left; 3192 } 3193 if ( rs ) { 3194 ui.position.left = inst._convertPositionTo( "relative", { 3195 top: 0, 3196 left: r - inst.helperProportions.width 3197 } ).left; 3198 } 3199 } 3200 3201 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 3202 if ( inst.options.snap.snap ) { 3203 inst.options.snap.snap.call( 3204 inst.element, 3205 event, 3206 $.extend( inst._uiHash(), { 3207 snapItem: inst.snapElements[ i ].item 3208 } ) ); 3209 } 3210 } 3211 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 3212 3213 } 3214 3215 } 3216} ); 3217 3218$.ui.plugin.add( "draggable", "stack", { 3219 start: function( event, ui, instance ) { 3220 var min, 3221 o = instance.options, 3222 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 3223 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 3224 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 3225 } ); 3226 3227 if ( !group.length ) { 3228 return; 3229 } 3230 3231 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 3232 $( group ).each( function( i ) { 3233 $( this ).css( "zIndex", min + i ); 3234 } ); 3235 this.css( "zIndex", ( min + group.length ) ); 3236 } 3237} ); 3238 3239$.ui.plugin.add( "draggable", "zIndex", { 3240 start: function( event, ui, instance ) { 3241 var t = $( ui.helper ), 3242 o = instance.options; 3243 3244 if ( t.css( "zIndex" ) ) { 3245 o._zIndex = t.css( "zIndex" ); 3246 } 3247 t.css( "zIndex", o.zIndex ); 3248 }, 3249 stop: function( event, ui, instance ) { 3250 var o = instance.options; 3251 3252 if ( o._zIndex ) { 3253 $( ui.helper ).css( "zIndex", o._zIndex ); 3254 } 3255 } 3256} ); 3257 3258var widgetsDraggable = $.ui.draggable; 3259 3260 3261/*! 3262 * jQuery UI
3262Droppable 1.13.0 3263 * http://jqueryui.com 3264 * 3265 * Copyright jQuery Foundation and other contributors 3266 * Released under the MIT license. 3267 * http://jquery.org/license 3268 */ 3269 3270//>>label: Droppable 3271//>>group: Interactions 3272//>>description: Enables drop targets for draggable elements. 3273//>>docs: http://api.jqueryui.com/droppable/ 3274//>>demos: http://jqueryui.com/droppable/ 3275 3276 3277$.widget( "ui.droppable", { 3278 version: "1.13.0
vendor: 12,167 bytes, lines 3278-3745
3278", 3279 widgetEventPrefix: "drop", 3280 options: { 3281 accept: "*", 3282 addClasses: true, 3283 greedy: false, 3284 scope: "default", 3285 tolerance: "intersect", 3286 3287 // Callbacks 3288 activate: null, 3289 deactivate: null, 3290 drop: null, 3291 out: null, 3292 over: null 3293 }, 3294 _create: function() { 3295 3296 var proportions, 3297 o = this.options, 3298 accept = o.accept; 3299 3300 this.isover = false; 3301 this.isout = true; 3302 3303 this.accept = typeof accept === "function" ? accept : function( d ) { 3304 return d.is( accept ); 3305 }; 3306 3307 this.proportions = function( /* valueToWrite */ ) { 3308 if ( arguments.length ) { 3309 3310 // Store the droppable's proportions 3311 proportions = arguments[ 0 ]; 3312 } else { 3313 3314 // Retrieve or derive the droppable's proportions 3315 return proportions ? 3316 proportions : 3317 proportions = { 3318 width: this.element[ 0 ].offsetWidth, 3319 height: this.element[ 0 ].offsetHeight 3320 }; 3321 } 3322 }; 3323 3324 this._addToManager( o.scope ); 3325 3326 if ( o.addClasses ) { 3327 this._addClass( "ui-droppable" ); 3328 } 3329 3330 }, 3331 3332 _addToManager: function( scope ) { 3333 3334 // Add the reference and positions to the manager 3335 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 3336 $.ui.ddmanager.droppables[ scope ].push( this ); 3337 }, 3338 3339 _splice: function( drop ) { 3340 var i = 0; 3341 for ( ; i < drop.length; i++ ) { 3342 if ( drop[ i ] === this ) { 3343 drop.splice( i, 1 ); 3344 } 3345 } 3346 }, 3347 3348 _destroy: function() { 3349 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 3350 3351 this._splice( drop ); 3352 }, 3353 3354 _setOption: function( key, value ) { 3355 3356 if ( key === "accept" ) { 3357 this.accept = typeof value === "function" ? value : function( d ) { 3358 return d.is( value ); 3359 }; 3360 } else if ( key === "scope" ) { 3361 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 3362 3363 this._splice( drop ); 3364 this._addToManager( value ); 3365 } 3366 3367 this._super( key, value ); 3368 }, 3369 3370 _activate: function( event ) { 3371 var draggable = $.ui.ddmanager.current; 3372 3373 this._addActiveClass(); 3374 if ( draggable ) { 3375 this._trigger( "activate", event, this.ui( draggable ) ); 3376 } 3377 }, 3378 3379 _deactivate: function( event ) { 3380 var draggable = $.ui.ddmanager.current; 3381 3382 this._removeActiveClass(); 3383 if ( draggable ) { 3384 this._trigger( "deactivate", event, this.ui( draggable ) ); 3385 } 3386 }, 3387 3388 _over: function( event ) { 3389 3390 var draggable = $.ui.ddmanager.current; 3391 3392 // Bail if draggable and droppable are same element 3393 if ( !draggable || ( draggable.currentItem || 3394 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3395 return; 3396 } 3397 3398 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 3399 draggable.element ) ) ) { 3400 this._addHoverClass(); 3401 this._trigger( "over", event, this.ui( draggable ) ); 3402 } 3403 3404 }, 3405 3406 _out: function( event ) { 3407 3408 var draggable = $.ui.ddmanager.current; 3409 3410 // Bail if draggable and droppable are same element 3411 if ( !draggable || ( draggable.currentItem || 3412 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3413 return; 3414 } 3415 3416 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 3417 draggable.element ) ) ) { 3418 this._removeHoverClass(); 3419 this._trigger( "out", event, this.ui( draggable ) ); 3420 } 3421 3422 }, 3423 3424 _drop: function( event, custom ) { 3425 3426 var draggable = custom || $.ui.ddmanager.current, 3427 childrenIntersection = false; 3428 3429 // Bail if draggable and droppable are same element 3430 if ( !draggable || ( draggable.currentItem || 3431 draggable.element )[ 0 ] === this.element[ 0 ] ) { 3432 return false; 3433 } 3434 3435 this.element 3436 .find( ":data(ui-droppable)" ) 3437 .not( ".ui-draggable-dragging" ) 3438 .each( function() { 3439 var inst = $( this ).droppable( "instance" ); 3440 if ( 3441 inst.options.greedy && 3442 !inst.options.disabled && 3443 inst.options.scope === draggable.options.scope && 3444 inst.accept.call( 3445 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 3446 ) && 3447 $.ui.intersect( 3448 draggable, 3449 $.extend( inst, { offset: inst.element.offset() } ), 3450 inst.options.tolerance, event 3451 ) 3452 ) { 3453 childrenIntersection = true; 3454 return false; 3455 } 3456 } ); 3457 if ( childrenIntersection ) { 3458 return false; 3459 } 3460 3461 if ( this.accept.call( this.element[ 0 ], 3462 ( draggable.currentItem || draggable.element ) ) ) { 3463 this._removeActiveClass(); 3464 this._removeHoverClass(); 3465 3466 this._trigger( "drop", event, this.ui( draggable ) ); 3467 return this.element; 3468 } 3469 3470 return false; 3471 3472 }, 3473 3474 ui: function( c ) { 3475 return { 3476 draggable: ( c.currentItem || c.element ), 3477 helper: c.helper, 3478 position: c.position, 3479 offset: c.positionAbs 3480 }; 3481 }, 3482 3483 // Extension points just to make backcompat sane and avoid duplicating logic 3484 // TODO: Remove in 1.14 along with call to it below 3485 _addHoverClass: function() { 3486 this._addClass( "ui-droppable-hover" ); 3487 }, 3488 3489 _removeHoverClass: function() { 3490 this._removeClass( "ui-droppable-hover" ); 3491 }, 3492 3493 _addActiveClass: function() { 3494 this._addClass( "ui-droppable-active" ); 3495 }, 3496 3497 _removeActiveClass: function() { 3498 this._removeClass( "ui-droppable-active" ); 3499 } 3500} ); 3501 3502$.ui.intersect = ( function() { 3503 function isOverAxis( x, reference, size ) { 3504 return ( x >= reference ) && ( x < ( reference + size ) ); 3505 } 3506 3507 return function( draggable, droppable, toleranceMode, event ) { 3508 3509 if ( !droppable.offset ) { 3510 return false; 3511 } 3512 3513 var x1 = ( draggable.positionAbs || 3514 draggable.position.absolute ).left + draggable.margins.left, 3515 y1 = ( draggable.positionAbs || 3516 draggable.position.absolute ).top + draggable.margins.top, 3517 x2 = x1 + draggable.helperProportions.width, 3518 y2 = y1 + draggable.helperProportions.height, 3519 l = droppable.offset.left, 3520 t = droppable.offset.top, 3521 r = l + droppable.proportions().width, 3522 b = t + droppable.proportions().height; 3523 3524 switch ( toleranceMode ) { 3525 case "fit": 3526 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 3527 case "intersect": 3528 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 3529 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 3530 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 3531 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 3532 case "pointer": 3533 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 3534 isOverAxis( event.pageX, l, droppable.proportions().width ); 3535 case "touch": 3536 return ( 3537 ( y1 >= t && y1 <= b ) || // Top edge touching 3538 ( y2 >= t && y2 <= b ) || // Bottom edge touching 3539 ( y1 < t && y2 > b ) // Surrounded vertically 3540 ) && ( 3541 ( x1 >= l && x1 <= r ) || // Left edge touching 3542 ( x2 >= l && x2 <= r ) || // Right edge touching 3543 ( x1 < l && x2 > r ) // Surrounded horizontally 3544 ); 3545 default: 3546 return false; 3547 } 3548 }; 3549} )(); 3550 3551/* 3552 This manager tracks offsets of draggables and droppables 3553*/ 3554$.ui.ddmanager = { 3555 current: null, 3556 droppables: { "default": [] }, 3557 prepareOffsets: function( t, event ) { 3558 3559 var i, j, 3560 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 3561 type = event ? event.type : null, // workaround for #2317 3562 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 3563 3564 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 3565 3566 // No disabled and non-accepted 3567 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 3568 ( t.currentItem || t.element ) ) ) ) { 3569 continue; 3570 } 3571 3572 // Filter out elements in the current dragged item 3573 for ( j = 0; j < list.length; j++ ) { 3574 if ( list[ j ] === m[ i ].element[ 0 ] ) { 3575 m[ i ].proportions().height = 0; 3576 continue droppablesLoop; 3577 } 3578 } 3579 3580 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 3581 if ( !m[ i ].visible ) { 3582 continue; 3583 } 3584 3585 // Activate the droppable if used directly from draggables 3586 if ( type === "mousedown" ) { 3587 m[ i ]._activate.call( m[ i ], event ); 3588 } 3589 3590 m[ i ].offset = m[ i ].element.offset(); 3591 m[ i ].proportions( { 3592 width: m[ i ].element[ 0 ].offsetWidth, 3593 height: m[ i ].element[ 0 ].offsetHeight 3594 } ); 3595 3596 } 3597 3598 }, 3599 drop: function( draggable, event ) { 3600 3601 var dropped = false; 3602 3603 // Create a copy of the droppables in case the list changes during the drop (#9116) 3604 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 3605 3606 if ( !this.options ) { 3607 return; 3608 } 3609 if ( !this.options.disabled && this.visible && 3610 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { 3611 dropped = this._drop.call( this, event ) || dropped; 3612 } 3613 3614 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 3615 ( draggable.currentItem || draggable.element ) ) ) { 3616 this.isout = true; 3617 this.isover = false; 3618 this._deactivate.call( this, event ); 3619 } 3620 3621 } ); 3622 return dropped; 3623 3624 }, 3625 dragStart: function( draggable, event ) { 3626 3627 // Listen for scrolling so that if the dragging causes scrolling the position of the 3628 // droppables can be recalculated (see #5003) 3629 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 3630 if ( !draggable.options.refreshPositions ) { 3631 $.ui.ddmanager.prepareOffsets( draggable, event ); 3632 } 3633 } ); 3634 }, 3635 drag: function( draggable, event ) { 3636 3637 // If you have a highly dynamic page, you might try this option. It renders positions 3638 // every time you move the mouse. 3639 if ( draggable.options.refreshPositions ) { 3640 $.ui.ddmanager.prepareOffsets( draggable, event ); 3641 } 3642 3643 // Run through all droppables and check their positions based on specific tolerance options 3644 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 3645 3646 if ( this.options.disabled || this.greedyChild || !this.visible ) { 3647 return; 3648 } 3649 3650 var parentInstance, scope, parent, 3651 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), 3652 c = !intersects && this.isover ? 3653 "isout" : 3654 ( intersects && !this.isover ? "isover" : null ); 3655 if ( !c ) { 3656 return; 3657 } 3658 3659 if ( this.options.greedy ) { 3660 3661 // find droppable parents with same scope 3662 scope = this.options.scope; 3663 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 3664 return $( this ).droppable( "instance" ).options.scope === scope; 3665 } ); 3666 3667 if ( parent.length ) { 3668 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 3669 parentInstance.greedyChild = ( c === "isover" ); 3670 } 3671 } 3672 3673 // We just moved into a greedy child 3674 if ( parentInstance && c === "isover" ) { 3675 parentInstance.isover = false; 3676 parentInstance.isout = true; 3677 parentInstance._out.call( parentInstance, event ); 3678 } 3679 3680 this[ c ] = true; 3681 this[ c === "isout" ? "isover" : "isout" ] = false; 3682 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 3683 3684 // We just moved out of a greedy child 3685 if ( parentInstance && c === "isout" ) { 3686 parentInstance.isout = false; 3687 parentInstance.isover = true; 3688 parentInstance._over.call( parentInstance, event ); 3689 } 3690 } ); 3691 3692 }, 3693 dragStop: function( draggable, event ) { 3694 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 3695 3696 // Call prepareOffsets one final time since IE does not fire return scroll events when 3697 // overflow was caused by drag (see #5003) 3698 if ( !draggable.options.refreshPositions ) { 3699 $.ui.ddmanager.prepareOffsets( draggable, event ); 3700 } 3701 } 3702}; 3703 3704// DEPRECATED 3705// TODO: switch return back to widget declaration at top of file when this is removed 3706if ( $.uiBackCompat !== false ) { 3707 3708 // Backcompat for activeClass and hoverClass options 3709 $.widget( "ui.droppable", $.ui.droppable, { 3710 options: { 3711 hoverClass: false, 3712 activeClass: false 3713 }, 3714 _addActiveClass: function() { 3715 this._super(); 3716 if ( this.options.activeClass ) { 3717 this.element.addClass( this.options.activeClass ); 3718 } 3719 }, 3720 _removeActiveClass: function() { 3721 this._super(); 3722 if ( this.options.activeClass ) { 3723 this.element.removeClass( this.options.activeClass ); 3724 } 3725 }, 3726 _addHoverClass: function() { 3727 this._super(); 3728 if ( this.options.hoverClass ) { 3729 this.element.addClass( this.options.hoverClass ); 3730 } 3731 }, 3732 _removeHoverClass: function() { 3733 this._super(); 3734 if ( this.options.hoverClass ) { 3735 this.element.removeClass( this.options.hoverClass ); 3736 } 3737 } 3738 } ); 3739} 3740 3741var widgetsDroppable = $.ui.droppable; 3742 3743 3744/*! 3745 * jQuery UI
3745Resizable 1.13.0 3746 * http://jqueryui.com 3747 * 3748 * Copyright jQuery Foundation and other contributors 3749 * Released under the MIT license. 3750 * http://jquery.org/license 3751 */ 3752 3753//>>label: Resizable 3754//>>group: Interactions 3755//>>description: Enables resize functionality for any element. 3756//>>docs: http://api.jqueryui.com/resizable/ 3757//>>demos: http://jqueryui.com/resizable/ 3758//>>css.structure: ../../themes/base/core.css 3759//>>css.structure: ../../themes/base/resizable.css 3760//>>css.theme: ../../themes/base/theme.css 3761 3762 3763$.widget( "ui.resizable", $.ui.mouse, { 3764 version: "1.13.0
vendor: 11,739 bytes, lines 3764-4257
3764", 3765 widgetEventPrefix: "resize", 3766 options: { 3767 alsoResize: false, 3768 animate: false, 3769 animateDuration: "slow", 3770 animateEasing: "swing", 3771 aspectRatio: false, 3772 autoHide: false, 3773 classes: { 3774 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 3775 }, 3776 containment: false, 3777 ghost: false, 3778 grid: false, 3779 handles: "e,s,se", 3780 helper: false, 3781 maxHeight: null, 3782 maxWidth: null, 3783 minHeight: 10, 3784 minWidth: 10, 3785 3786 // See #7960 3787 zIndex: 90, 3788 3789 // Callbacks 3790 resize: null, 3791 start: null, 3792 stop: null 3793 }, 3794 3795 _num: function( value ) { 3796 return parseFloat( value ) || 0; 3797 }, 3798 3799 _isNumber: function( value ) { 3800 return !isNaN( parseFloat( value ) ); 3801 }, 3802 3803 _hasScroll: function( el, a ) { 3804 3805 if ( $( el ).css( "overflow" ) === "hidden" ) { 3806 return false; 3807 } 3808 3809 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 3810 has = false; 3811 3812 if ( el[ scroll ] > 0 ) { 3813 return true; 3814 } 3815 3816 // TODO: determine which cases actually cause this to happen 3817 // if the element doesn't have the scroll set, see if it's possible to 3818 // set the scroll 3819 try { 3820 el[ scroll ] = 1; 3821 has = ( el[ scroll ] > 0 ); 3822 el[ scroll ] = 0; 3823 } catch ( e ) { 3824 3825 // `el` might be a string, then setting `scroll` will throw 3826 // an error in strict mode; ignore it. 3827 } 3828 return has; 3829 }, 3830 3831 _create: function() { 3832 3833 var margins, 3834 o = this.options, 3835 that = this; 3836 this._addClass( "ui-resizable" ); 3837 3838 $.extend( this, { 3839 _aspectRatio: !!( o.aspectRatio ), 3840 aspectRatio: o.aspectRatio, 3841 originalElement: this.element, 3842 _proportionallyResizeElements: [], 3843 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 3844 } ); 3845 3846 // Wrap the element if it cannot hold child nodes 3847 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 3848 3849 this.element.wrap( 3850 $( "<div class='ui-wrapper'></div>" ).css( { 3851 overflow: "hidden", 3852 position: this.element.css( "position" ), 3853 width: this.element.outerWidth(), 3854 height: this.element.outerHeight(), 3855 top: this.element.css( "top" ), 3856 left: this.element.css( "left" ) 3857 } ) 3858 ); 3859 3860 this.element = this.element.parent().data( 3861 "ui-resizable", this.element.resizable( "instance" ) 3862 ); 3863 3864 this.elementIsWrapper = true; 3865 3866 margins = { 3867 marginTop: this.originalElement.css( "marginTop" ), 3868 marginRight: this.originalElement.css( "marginRight" ), 3869 marginBottom: this.originalElement.css( "marginBottom" ), 3870 marginLeft: this.originalElement.css( "marginLeft" ) 3871 }; 3872 3873 this.element.css( margins ); 3874 this.originalElement.css( "margin", 0 ); 3875 3876 // support: Safari 3877 // Prevent Safari textarea resize 3878 this.originalResizeStyle = this.originalElement.css( "resize" ); 3879 this.originalElement.css( "resize", "none" ); 3880 3881 this._proportionallyResizeElements.push( this.originalElement.css( { 3882 position: "static", 3883 zoom: 1, 3884 display: "block" 3885 } ) ); 3886 3887 // Support: IE9 3888 // avoid IE jump (hard set the margin) 3889 this.originalElement.css( margins ); 3890 3891 this._proportionallyResize(); 3892 } 3893 3894 this._setupHandles(); 3895 3896 if ( o.autoHide ) { 3897 $( this.element ) 3898 .on( "mouseenter", function() { 3899 if ( o.disabled ) { 3900 return; 3901 } 3902 that._removeClass( "ui-resizable-autohide" ); 3903 that._handles.show(); 3904 } ) 3905 .on( "mouseleave", function() { 3906 if ( o.disabled ) { 3907 return; 3908 } 3909 if ( !that.resizing ) { 3910 that._addClass( "ui-resizable-autohide" ); 3911 that._handles.hide(); 3912 } 3913 } ); 3914 } 3915 3916 this._mouseInit(); 3917 }, 3918 3919 _destroy: function() { 3920 3921 this._mouseDestroy(); 3922 this._addedHandles.remove(); 3923 3924 var wrapper, 3925 _destroy = function( exp ) { 3926 $( exp ) 3927 .removeData( "resizable" ) 3928 .removeData( "ui-resizable" ) 3929 .off( ".resizable" ); 3930 }; 3931 3932 // TODO: Unwrap at same DOM position 3933 if ( this.elementIsWrapper ) { 3934 _destroy( this.element ); 3935 wrapper = this.element; 3936 this.originalElement.css( { 3937 position: wrapper.css( "position" ), 3938 width: wrapper.outerWidth(), 3939 height: wrapper.outerHeight(), 3940 top: wrapper.css( "top" ), 3941 left: wrapper.css( "left" ) 3942 } ).insertAfter( wrapper ); 3943 wrapper.remove(); 3944 } 3945 3946 this.originalElement.css( "resize", this.originalResizeStyle ); 3947 _destroy( this.originalElement ); 3948 3949 return this; 3950 }, 3951 3952 _setOption: function( key, value ) { 3953 this._super( key, value ); 3954 3955 switch ( key ) { 3956 case "handles": 3957 this._removeHandles(); 3958 this._setupHandles(); 3959 break; 3960 case "aspectRatio": 3961 this._aspectRatio = !!value; 3962 break; 3963 default: 3964 break; 3965 } 3966 }, 3967 3968 _setupHandles: function() { 3969 var o = this.options, handle, i, n, hname, axis, that = this; 3970 this.handles = o.handles || 3971 ( !$( ".ui-resizable-handle", this.element ).length ? 3972 "e,s,se" : { 3973 n: ".ui-resizable-n", 3974 e: ".ui-resizable-e", 3975 s: ".ui-resizable-s", 3976 w: ".ui-resizable-w", 3977 se: ".ui-resizable-se", 3978 sw: ".ui-resizable-sw", 3979 ne: ".ui-resizable-ne", 3980 nw: ".ui-resizable-nw" 3981 } ); 3982 3983 this._handles = $(); 3984 this._addedHandles = $(); 3985 if ( this.handles.constructor === String ) { 3986 3987 if ( this.handles === "all" ) { 3988 this.handles = "n,e,s,w,se,sw,ne,nw"; 3989 } 3990 3991 n = this.handles.split( "," ); 3992 this.handles = {}; 3993 3994 for ( i = 0; i < n.length; i++ ) { 3995 3996 handle = String.prototype.trim.call( n[ i ] ); 3997 hname = "ui-resizable-" + handle; 3998 axis = $( "<div>" ); 3999 this._addClass( axis, "ui-resizable-handle " + hname ); 4000 4001 axis.css( { zIndex: o.zIndex } ); 4002 4003 this.handles[ handle ] = ".ui-resizable-" + handle; 4004 if ( !this.element.children( this.handles[ handle ] ).length ) { 4005 this.element.append( axis ); 4006 this._addedHandles = this._addedHandles.add( axis ); 4007 } 4008 } 4009 4010 } 4011 4012 this._renderAxis = function( target ) { 4013 4014 var i, axis, padPos, padWrapper; 4015 4016 target = target || this.element; 4017 4018 for ( i in this.handles ) { 4019 4020 if ( this.handles[ i ].constructor === String ) { 4021 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 4022 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 4023 this.handles[ i ] = $( this.handles[ i ] ); 4024 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 4025 } 4026 4027 if ( this.elementIsWrapper && 4028 this.originalElement[ 0 ] 4029 .nodeName 4030 .match( /^(textarea|input|select|button)$/i ) ) { 4031 axis = $( this.handles[ i ], this.element ); 4032 4033 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 4034 axis.outerHeight() : 4035 axis.outerWidth(); 4036 4037 padPos = [ "padding", 4038 /ne|nw|n/.test( i ) ? "Top" : 4039 /se|sw|s/.test( i ) ? "Bottom" : 4040 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 4041 4042 target.css( padPos, padWrapper ); 4043 4044 this._proportionallyResize(); 4045 } 4046 4047 this._handles = this._handles.add( this.handles[ i ] ); 4048 } 4049 }; 4050 4051 // TODO: make renderAxis a prototype function 4052 this._renderAxis( this.element ); 4053 4054 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 4055 this._handles.disableSelection(); 4056 4057 this._handles.on( "mouseover", function() { 4058 if ( !that.resizing ) { 4059 if ( this.className ) { 4060 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 4061 } 4062 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 4063 } 4064 } ); 4065 4066 if ( o.autoHide ) { 4067 this._handles.hide(); 4068 this._addClass( "ui-resizable-autohide" ); 4069 } 4070 }, 4071 4072 _removeHandles: function() { 4073 this._addedHandles.remove(); 4074 }, 4075 4076 _mouseCapture: function( event ) { 4077 var i, handle, 4078 capture = false; 4079 4080 for ( i in this.handles ) { 4081 handle = $( this.handles[ i ] )[ 0 ]; 4082 if ( handle === event.target || $.contains( handle, event.target ) ) { 4083 capture = true; 4084 } 4085 } 4086 4087 return !this.options.disabled && capture; 4088 }, 4089 4090 _mouseStart: function( event ) { 4091 4092 var curleft, curtop, cursor, 4093 o = this.options, 4094 el = this.element; 4095 4096 this.resizing = true; 4097 4098 this._renderProxy(); 4099 4100 curleft = this._num( this.helper.css( "left" ) ); 4101 curtop = this._num( this.helper.css( "top" ) ); 4102 4103 if ( o.containment ) { 4104 curleft += $( o.containment ).scrollLeft() || 0; 4105 curtop += $( o.containment ).scrollTop() || 0; 4106 } 4107 4108 this.offset = this.helper.offset(); 4109 this.position = { left: curleft, top: curtop }; 4110 4111 this.size = this._helper ? { 4112 width: this.helper.width(), 4113 height: this.helper.height() 4114 } : { 4115 width: el.width(), 4116 height: el.height() 4117 }; 4118 4119 this.originalSize = this._helper ? { 4120 width: el.outerWidth(), 4121 height: el.outerHeight() 4122 } : { 4123 width: el.width(), 4124 height: el.height() 4125 }; 4126 4127 this.sizeDiff = { 4128 width: el.outerWidth() - el.width(), 4129 height: el.outerHeight() - el.height() 4130 }; 4131 4132 this.originalPosition = { left: curleft, top: curtop }; 4133 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 4134 4135 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 4136 o.aspectRatio : 4137 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 4138 4139 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 4140 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 4141 4142 this._addClass( "ui-resizable-resizing" ); 4143 this._propagate( "start", event ); 4144 return true; 4145 }, 4146 4147 _mouseDrag: function( event ) { 4148 4149 var data, props, 4150 smp = this.originalMousePosition, 4151 a = this.axis, 4152 dx = ( event.pageX - smp.left ) || 0, 4153 dy = ( event.pageY - smp.top ) || 0, 4154 trigger = this._change[ a ]; 4155 4156 this._updatePrevProperties(); 4157 4158 if ( !trigger ) { 4159 return false; 4160 } 4161 4162 data = trigger.apply( this, [ event, dx, dy ] ); 4163 4164 this._updateVirtualBoundaries( event.shiftKey ); 4165 if ( this._aspectRatio || event.shiftKey ) { 4166 data = this._updateRatio( data, event ); 4167 } 4168 4169 data = this._respectSize( data, event ); 4170 4171 this._updateCache( data ); 4172 4173 this._propagate( "resize", event ); 4174 4175 props = this._applyChanges(); 4176 4177 if ( !this._helper && this._proportionallyResizeElements.length ) { 4178 this._proportionallyResize(); 4179 } 4180 4181 if ( !$.isEmptyObject( props ) ) { 4182 this._updatePrevProperties(); 4183 this._trigger( "resize", event, this.ui() ); 4184 this._applyChanges(); 4185 } 4186 4187 return false; 4188 }, 4189 4190 _mouseStop: function( event ) { 4191 4192 this.resizing = false; 4193 var pr, ista, soffseth, soffsetw, s, left, top, 4194 o = this.options, that = this; 4195 4196 if ( this._helper ) { 4197 4198 pr = this._proportionallyResizeElements; 4199 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 4200 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 4201 soffsetw = ista ? 0 : that.sizeDiff.width; 4202 4203 s = { 4204 width: ( that.helper.width() - soffsetw ), 4205 height: ( that.helper.height() - soffseth ) 4206 }; 4207 left = ( parseFloat( that.element.css( "left" ) ) + 4208 ( that.position.left - that.originalPosition.left ) ) || null; 4209 top = ( parseFloat( that.element.css( "top" ) ) + 4210 ( that.position.top - that.originalPosition.top ) ) || null; 4211 4212 if ( !o.animate ) { 4213 this.element.css( $.extend( s, { top: top, left: left } ) ); 4214 } 4215 4216 that.helper.height( that.size.height ); 4217 that.helper.width( that.size.width ); 4218 4219 if ( this._helper && !o.animate ) { 4220 this._proportionallyResize(); 4221 } 4222 } 4223 4224 $( "body" ).css( "cursor", "auto" ); 4225 4226 this._removeClass( "ui-resizable-resizing" ); 4227 4228 this._propagate( "stop", event ); 4229 4230 if ( this._helper ) { 4231 this.helper.remove(); 4232 } 4233 4234 return false; 4235 4236 }, 4237 4238 _updatePrevProperties: function() { 4239 this.prevPosition = { 4240 top: this.position.top, 4241 left: this.position.left 4242 }; 4243 this.prevSize = { 4244 width: this.size.width, 4245 height: this.size.height 4246 }; 4247 }, 4248 4249 _applyChanges: function() { 4250 var props = {}; 4251 4252 if ( this.position.top !== this.prevPosition.top ) { 4253 props.top = this.position.top + "px"; 4254 } 4255 if ( this.position.left !== this.prevPosition.left ) { 4256 props.left = this.position.left + "px"; 4257 }
vendor: 15,404 bytes, lines 4258-4850
4258 if ( this.size.width !== this.prevSize.width ) { 4259 props.width = this.size.width + "px"; 4260 } 4261 if ( this.size.height !== this.prevSize.height ) { 4262 props.height = this.size.height + "px"; 4263 } 4264 4265 this.helper.css( props ); 4266 4267 return props; 4268 }, 4269 4270 _updateVirtualBoundaries: function( forceAspectRatio ) { 4271 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 4272 o = this.options; 4273 4274 b = { 4275 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 4276 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 4277 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 4278 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 4279 }; 4280 4281 if ( this._aspectRatio || forceAspectRatio ) { 4282 pMinWidth = b.minHeight * this.aspectRatio; 4283 pMinHeight = b.minWidth / this.aspectRatio; 4284 pMaxWidth = b.maxHeight * this.aspectRatio; 4285 pMaxHeight = b.maxWidth / this.aspectRatio; 4286 4287 if ( pMinWidth > b.minWidth ) { 4288 b.minWidth = pMinWidth; 4289 } 4290 if ( pMinHeight > b.minHeight ) { 4291 b.minHeight = pMinHeight; 4292 } 4293 if ( pMaxWidth < b.maxWidth ) { 4294 b.maxWidth = pMaxWidth; 4295 } 4296 if ( pMaxHeight < b.maxHeight ) { 4297 b.maxHeight = pMaxHeight; 4298 } 4299 } 4300 this._vBoundaries = b; 4301 }, 4302 4303 _updateCache: function( data ) { 4304 this.offset = this.helper.offset(); 4305 if ( this._isNumber( data.left ) ) { 4306 this.position.left = data.left; 4307 } 4308 if ( this._isNumber( data.top ) ) { 4309 this.position.top = data.top; 4310 } 4311 if ( this._isNumber( data.height ) ) { 4312 this.size.height = data.height; 4313 } 4314 if ( this._isNumber( data.width ) ) { 4315 this.size.width = data.width; 4316 } 4317 }, 4318 4319 _updateRatio: function( data ) { 4320 4321 var cpos = this.position, 4322 csize = this.size, 4323 a = this.axis; 4324 4325 if ( this._isNumber( data.height ) ) { 4326 data.width = ( data.height * this.aspectRatio ); 4327 } else if ( this._isNumber( data.width ) ) { 4328 data.height = ( data.width / this.aspectRatio ); 4329 } 4330 4331 if ( a === "sw" ) { 4332 data.left = cpos.left + ( csize.width - data.width ); 4333 data.top = null; 4334 } 4335 if ( a === "nw" ) { 4336 data.top = cpos.top + ( csize.height - data.height ); 4337 data.left = cpos.left + ( csize.width - data.width ); 4338 } 4339 4340 return data; 4341 }, 4342 4343 _respectSize: function( data ) { 4344 4345 var o = this._vBoundaries, 4346 a = this.axis, 4347 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 4348 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 4349 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 4350 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 4351 dw = this.originalPosition.left + this.originalSize.width, 4352 dh = this.originalPosition.top + this.originalSize.height, 4353 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 4354 if ( isminw ) { 4355 data.width = o.minWidth; 4356 } 4357 if ( isminh ) { 4358 data.height = o.minHeight; 4359 } 4360 if ( ismaxw ) { 4361 data.width = o.maxWidth; 4362 } 4363 if ( ismaxh ) { 4364 data.height = o.maxHeight; 4365 } 4366 4367 if ( isminw && cw ) { 4368 data.left = dw - o.minWidth; 4369 } 4370 if ( ismaxw && cw ) { 4371 data.left = dw - o.maxWidth; 4372 } 4373 if ( isminh && ch ) { 4374 data.top = dh - o.minHeight; 4375 } 4376 if ( ismaxh && ch ) { 4377 data.top = dh - o.maxHeight; 4378 } 4379 4380 // Fixing jump error on top/left - bug #2330 4381 if ( !data.width && !data.height && !data.left && data.top ) { 4382 data.top = null; 4383 } else if ( !data.width && !data.height && !data.top && data.left ) { 4384 data.left = null; 4385 } 4386 4387 return data; 4388 }, 4389 4390 _getPaddingPlusBorderDimensions: function( element ) { 4391 var i = 0, 4392 widths = [], 4393 borders = [ 4394 element.css( "borderTopWidth" ), 4395 element.css( "borderRightWidth" ), 4396 element.css( "borderBottomWidth" ), 4397 element.css( "borderLeftWidth" ) 4398 ], 4399 paddings = [ 4400 element.css( "paddingTop" ), 4401 element.css( "paddingRight" ), 4402 element.css( "paddingBottom" ), 4403 element.css( "paddingLeft" ) 4404 ]; 4405 4406 for ( ; i < 4; i++ ) { 4407 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 4408 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 4409 } 4410 4411 return { 4412 height: widths[ 0 ] + widths[ 2 ], 4413 width: widths[ 1 ] + widths[ 3 ] 4414 }; 4415 }, 4416 4417 _proportionallyResize: function() { 4418 4419 if ( !this._proportionallyResizeElements.length ) { 4420 return; 4421 } 4422 4423 var prel, 4424 i = 0, 4425 element = this.helper || this.element; 4426 4427 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 4428 4429 prel = this._proportionallyResizeElements[ i ]; 4430 4431 // TODO: Seems like a bug to cache this.outerDimensions 4432 // considering that we are in a loop. 4433 if ( !this.outerDimensions ) { 4434 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 4435 } 4436 4437 prel.css( { 4438 height: ( element.height() - this.outerDimensions.height ) || 0, 4439 width: ( element.width() - this.outerDimensions.width ) || 0 4440 } ); 4441 4442 } 4443 4444 }, 4445 4446 _renderProxy: function() { 4447 4448 var el = this.element, o = this.options; 4449 this.elementOffset = el.offset(); 4450 4451 if ( this._helper ) { 4452 4453 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 4454 4455 this._addClass( this.helper, this._helper ); 4456 this.helper.css( { 4457 width: this.element.outerWidth(), 4458 height: this.element.outerHeight(), 4459 position: "absolute", 4460 left: this.elementOffset.left + "px", 4461 top: this.elementOffset.top + "px", 4462 zIndex: ++o.zIndex //TODO: Don't modify option 4463 } ); 4464 4465 this.helper 4466 .appendTo( "body" ) 4467 .disableSelection(); 4468 4469 } else { 4470 this.helper = this.element; 4471 } 4472 4473 }, 4474 4475 _change: { 4476 e: function( event, dx ) { 4477 return { width: this.originalSize.width + dx }; 4478 }, 4479 w: function( event, dx ) { 4480 var cs = this.originalSize, sp = this.originalPosition; 4481 return { left: sp.left + dx, width: cs.width - dx }; 4482 }, 4483 n: function( event, dx, dy ) { 4484 var cs = this.originalSize, sp = this.originalPosition; 4485 return { top: sp.top + dy, height: cs.height - dy }; 4486 }, 4487 s: function( event, dx, dy ) { 4488 return { height: this.originalSize.height + dy }; 4489 }, 4490 se: function( event, dx, dy ) { 4491 return $.extend( this._change.s.apply( this, arguments ), 4492 this._change.e.apply( this, [ event, dx, dy ] ) ); 4493 }, 4494 sw: function( event, dx, dy ) { 4495 return $.extend( this._change.s.apply( this, arguments ), 4496 this._change.w.apply( this, [ event, dx, dy ] ) ); 4497 }, 4498 ne: function( event, dx, dy ) { 4499 return $.extend( this._change.n.apply( this, arguments ), 4500 this._change.e.apply( this, [ event, dx, dy ] ) ); 4501 }, 4502 nw: function( event, dx, dy ) { 4503 return $.extend( this._change.n.apply( this, arguments ), 4504 this._change.w.apply( this, [ event, dx, dy ] ) ); 4505 } 4506 }, 4507 4508 _propagate: function( n, event ) { 4509 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 4510 if ( n !== "resize" ) { 4511 this._trigger( n, event, this.ui() ); 4512 } 4513 }, 4514 4515 plugins: {}, 4516 4517 ui: function() { 4518 return { 4519 originalElement: this.originalElement, 4520 element: this.element, 4521 helper: this.helper, 4522 position: this.position, 4523 size: this.size, 4524 originalSize: this.originalSize, 4525 originalPosition: this.originalPosition 4526 }; 4527 } 4528 4529} ); 4530 4531/* 4532 * Resizable Extensions 4533 */ 4534 4535$.ui.plugin.add( "resizable", "animate", { 4536 4537 stop: function( event ) { 4538 var that = $( this ).resizable( "instance" ), 4539 o = that.options, 4540 pr = that._proportionallyResizeElements, 4541 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 4542 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 4543 soffsetw = ista ? 0 : that.sizeDiff.width, 4544 style = { 4545 width: ( that.size.width - soffsetw ), 4546 height: ( that.size.height - soffseth ) 4547 }, 4548 left = ( parseFloat( that.element.css( "left" ) ) + 4549 ( that.position.left - that.originalPosition.left ) ) || null, 4550 top = ( parseFloat( that.element.css( "top" ) ) + 4551 ( that.position.top - that.originalPosition.top ) ) || null; 4552 4553 that.element.animate( 4554 $.extend( style, top && left ? { top: top, left: left } : {} ), { 4555 duration: o.animateDuration, 4556 easing: o.animateEasing, 4557 step: function() { 4558 4559 var data = { 4560 width: parseFloat( that.element.css( "width" ) ), 4561 height: parseFloat( that.element.css( "height" ) ), 4562 top: parseFloat( that.element.css( "top" ) ), 4563 left: parseFloat( that.element.css( "left" ) ) 4564 }; 4565 4566 if ( pr && pr.length ) { 4567 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 4568 } 4569 4570 // Propagating resize, and updating values for each animation step 4571 that._updateCache( data ); 4572 that._propagate( "resize", event ); 4573 4574 } 4575 } 4576 ); 4577 } 4578 4579} ); 4580 4581$.ui.plugin.add( "resizable", "containment", { 4582 4583 start: function() { 4584 var element, p, co, ch, cw, width, height, 4585 that = $( this ).resizable( "instance" ), 4586 o = that.options, 4587 el = that.element, 4588 oc = o.containment, 4589 ce = ( oc instanceof $ ) ? 4590 oc.get( 0 ) : 4591 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 4592 4593 if ( !ce ) { 4594 return; 4595 } 4596 4597 that.containerElement = $( ce ); 4598 4599 if ( /document/.test( oc ) || oc === document ) { 4600 that.containerOffset = { 4601 left: 0, 4602 top: 0 4603 }; 4604 that.containerPosition = { 4605 left: 0, 4606 top: 0 4607 }; 4608 4609 that.parentData = { 4610 element: $( document ), 4611 left: 0, 4612 top: 0, 4613 width: $( document ).width(), 4614 height: $( document ).height() || document.body.parentNode.scrollHeight 4615 }; 4616 } else { 4617 element = $( ce ); 4618 p = []; 4619 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 4620 p[ i ] = that._num( element.css( "padding" + name ) ); 4621 } ); 4622 4623 that.containerOffset = element.offset(); 4624 that.containerPosition = element.position(); 4625 that.containerSize = { 4626 height: ( element.innerHeight() - p[ 3 ] ), 4627 width: ( element.innerWidth() - p[ 1 ] ) 4628 }; 4629 4630 co = that.containerOffset; 4631 ch = that.containerSize.height; 4632 cw = that.containerSize.width; 4633 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 4634 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 4635 4636 that.parentData = { 4637 element: ce, 4638 left: co.left, 4639 top: co.top, 4640 width: width, 4641 height: height 4642 }; 4643 } 4644 }, 4645 4646 resize: function( event ) { 4647 var woset, hoset, isParent, isOffsetRelative, 4648 that = $( this ).resizable( "instance" ), 4649 o = that.options, 4650 co = that.containerOffset, 4651 cp = that.position, 4652 pRatio = that._aspectRatio || event.shiftKey, 4653 cop = { 4654 top: 0, 4655 left: 0 4656 }, 4657 ce = that.containerElement, 4658 continueResize = true; 4659 4660 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 4661 cop = co; 4662 } 4663 4664 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 4665 that.size.width = that.size.width + 4666 ( that._helper ? 4667 ( that.position.left - co.left ) : 4668 ( that.position.left - cop.left ) ); 4669 4670 if ( pRatio ) { 4671 that.size.height = that.size.width / that.aspectRatio; 4672 continueResize = false; 4673 } 4674 that.position.left = o.helper ? co.left : 0; 4675 } 4676 4677 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 4678 that.size.height = that.size.height + 4679 ( that._helper ? 4680 ( that.position.top - co.top ) : 4681 that.position.top ); 4682 4683 if ( pRatio ) { 4684 that.size.width = that.size.height * that.aspectRatio; 4685 continueResize = false; 4686 } 4687 that.position.top = that._helper ? co.top : 0; 4688 } 4689 4690 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 4691 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 4692 4693 if ( isParent && isOffsetRelative ) { 4694 that.offset.left = that.parentData.left + that.position.left; 4695 that.offset.top = that.parentData.top + that.position.top; 4696 } else { 4697 that.offset.left = that.element.offset().left; 4698 that.offset.top = that.element.offset().top; 4699 } 4700 4701 woset = Math.abs( that.sizeDiff.width + 4702 ( that._helper ? 4703 that.offset.left - cop.left : 4704 ( that.offset.left - co.left ) ) ); 4705 4706 hoset = Math.abs( that.sizeDiff.height + 4707 ( that._helper ? 4708 that.offset.top - cop.top : 4709 ( that.offset.top - co.top ) ) ); 4710 4711 if ( woset + that.size.width >= that.parentData.width ) { 4712 that.size.width = that.parentData.width - woset; 4713 if ( pRatio ) { 4714 that.size.height = that.size.width / that.aspectRatio; 4715 continueResize = false; 4716 } 4717 } 4718 4719 if ( hoset + that.size.height >= that.parentData.height ) { 4720 that.size.height = that.parentData.height - hoset; 4721 if ( pRatio ) { 4722 that.size.width = that.size.height * that.aspectRatio; 4723 continueResize = false; 4724 } 4725 } 4726 4727 if ( !continueResize ) { 4728 that.position.left = that.prevPosition.left; 4729 that.position.top = that.prevPosition.top; 4730 that.size.width = that.prevSize.width; 4731 that.size.height = that.prevSize.height; 4732 } 4733 }, 4734 4735 stop: function() { 4736 var that = $( this ).resizable( "instance" ), 4737 o = that.options, 4738 co = that.containerOffset, 4739 cop = that.containerPosition, 4740 ce = that.containerElement, 4741 helper = $( that.helper ), 4742 ho = helper.offset(), 4743 w = helper.outerWidth() - that.sizeDiff.width, 4744 h = helper.outerHeight() - that.sizeDiff.height; 4745 4746 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 4747 $( this ).css( { 4748 left: ho.left - cop.left - co.left, 4749 width: w, 4750 height: h 4751 } ); 4752 } 4753 4754 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 4755 $( this ).css( { 4756 left: ho.left - cop.left - co.left, 4757 width: w, 4758 height: h 4759 } ); 4760 } 4761 } 4762} ); 4763 4764$.ui.plugin.add( "resizable", "alsoResize", { 4765 4766 start: function() { 4767 var that = $( this ).resizable( "instance" ), 4768 o = that.options; 4769 4770 $( o.alsoResize ).each( function() { 4771 var el = $( this ); 4772 el.data( "ui-resizable-alsoresize", { 4773 width: parseFloat( el.width() ), height: parseFloat( el.height() ), 4774 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 4775 } ); 4776 } ); 4777 }, 4778 4779 resize: function( event, ui ) { 4780 var that = $( this ).resizable( "instance" ), 4781 o = that.options, 4782 os = that.originalSize, 4783 op = that.originalPosition, 4784 delta = { 4785 height: ( that.size.height - os.height ) || 0, 4786 width: ( that.size.width - os.width ) || 0, 4787 top: ( that.position.top - op.top ) || 0, 4788 left: ( that.position.left - op.left ) || 0 4789 }; 4790 4791 $( o.alsoResize ).each( function() { 4792 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 4793 css = el.parents( ui.originalElement[ 0 ] ).length ? 4794 [ "width", "height" ] : 4795 [ "width", "height", "top", "left" ]; 4796 4797 $.each( css, function( i, prop ) { 4798 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 4799 if ( sum && sum >= 0 ) { 4800 style[ prop ] = sum || null; 4801 } 4802 } ); 4803 4804 el.css( style ); 4805 } ); 4806 }, 4807 4808 stop: function() { 4809 $( this ).removeData( "ui-resizable-alsoresize" ); 4810 } 4811} ); 4812 4813$.ui.plugin.add( "resizable", "ghost", { 4814 4815 start: function() { 4816 4817 var that = $( this ).resizable( "instance" ), cs = that.size; 4818 4819 that.ghost = that.originalElement.clone(); 4820 that.ghost.css( { 4821 opacity: 0.25, 4822 display: "block", 4823 position: "relative", 4824 height: cs.height, 4825 width: cs.width, 4826 margin: 0, 4827 left: 0, 4828 top: 0 4829 } ); 4830 4831 that._addClass( that.ghost, "ui-resizable-ghost" ); 4832 4833 // DEPRECATED 4834 // TODO: remove after 1.12 4835 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { 4836 4837 // Ghost option 4838 that.ghost.addClass( this.options.ghost ); 4839 } 4840 4841 that.ghost.appendTo( that.helper ); 4842 4843 }, 4844 4845 resize: function() { 4846 var that = $( this ).resizable( "instance" ); 4847 if ( that.ghost ) { 4848 that.ghost.css( { 4849 position: "relative", 4850 height: that.size.height,
vendor: 10,664 bytes, lines 4851-5258
4851 width: that.size.width 4852 } ); 4853 } 4854 }, 4855 4856 stop: function() { 4857 var that = $( this ).resizable( "instance" ); 4858 if ( that.ghost && that.helper ) { 4859 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 4860 } 4861 } 4862 4863} ); 4864 4865$.ui.plugin.add( "resizable", "grid", { 4866 4867 resize: function() { 4868 var outerDimensions, 4869 that = $( this ).resizable( "instance" ), 4870 o = that.options, 4871 cs = that.size, 4872 os = that.originalSize, 4873 op = that.originalPosition, 4874 a = that.axis, 4875 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 4876 gridX = ( grid[ 0 ] || 1 ), 4877 gridY = ( grid[ 1 ] || 1 ), 4878 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 4879 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 4880 newWidth = os.width + ox, 4881 newHeight = os.height + oy, 4882 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 4883 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 4884 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 4885 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 4886 4887 o.grid = grid; 4888 4889 if ( isMinWidth ) { 4890 newWidth += gridX; 4891 } 4892 if ( isMinHeight ) { 4893 newHeight += gridY; 4894 } 4895 if ( isMaxWidth ) { 4896 newWidth -= gridX; 4897 } 4898 if ( isMaxHeight ) { 4899 newHeight -= gridY; 4900 } 4901 4902 if ( /^(se|s|e)$/.test( a ) ) { 4903 that.size.width = newWidth; 4904 that.size.height = newHeight; 4905 } else if ( /^(ne)$/.test( a ) ) { 4906 that.size.width = newWidth; 4907 that.size.height = newHeight; 4908 that.position.top = op.top - oy; 4909 } else if ( /^(sw)$/.test( a ) ) { 4910 that.size.width = newWidth; 4911 that.size.height = newHeight; 4912 that.position.left = op.left - ox; 4913 } else { 4914 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 4915 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 4916 } 4917 4918 if ( newHeight - gridY > 0 ) { 4919 that.size.height = newHeight; 4920 that.position.top = op.top - oy; 4921 } else { 4922 newHeight = gridY - outerDimensions.height; 4923 that.size.height = newHeight; 4924 that.position.top = op.top + os.height - newHeight; 4925 } 4926 if ( newWidth - gridX > 0 ) { 4927 that.size.width = newWidth; 4928 that.position.left = op.left - ox; 4929 } else { 4930 newWidth = gridX - outerDimensions.width; 4931 that.size.width = newWidth; 4932 that.position.left = op.left + os.width - newWidth; 4933 } 4934 } 4935 } 4936 4937} ); 4938 4939var widgetsResizable = $.ui.resizable; 4940 4941 4942/*! 4943 * jQuery UI Selectable 1.13.0 4944 * http://jqueryui.com 4945 * 4946 * Copyright jQuery Foundation and other contributors 4947 * Released under the MIT license. 4948 * http://jquery.org/license 4949 */ 4950 4951//>>label: Selectable 4952//>>group: Interactions 4953//>>description: Allows groups of elements to be selected with the mouse. 4954//>>docs: http://api.jqueryui.com/selectable/ 4955//>>demos: http://jqueryui.com/selectable/ 4956//>>css.structure: ../../themes/base/selectable.css 4957 4958 4959var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { 4960 version: "1.13.0", 4961 options: { 4962 appendTo: "body", 4963 autoRefresh: true, 4964 distance: 0, 4965 filter: "*", 4966 tolerance: "touch", 4967 4968 // Callbacks 4969 selected: null, 4970 selecting: null, 4971 start: null, 4972 stop: null, 4973 unselected: null, 4974 unselecting: null 4975 }, 4976 _create: function() { 4977 var that = this; 4978 4979 this._addClass( "ui-selectable" ); 4980 4981 this.dragged = false; 4982 4983 // Cache selectee children based on filter 4984 this.refresh = function() { 4985 that.elementPos = $( that.element[ 0 ] ).offset(); 4986 that.selectees = $( that.options.filter, that.element[ 0 ] ); 4987 that._addClass( that.selectees, "ui-selectee" ); 4988 that.selectees.each( function() { 4989 var $this = $( this ), 4990 selecteeOffset = $this.offset(), 4991 pos = { 4992 left: selecteeOffset.left - that.elementPos.left, 4993 top: selecteeOffset.top - that.elementPos.top 4994 }; 4995 $.data( this, "selectable-item", { 4996 element: this, 4997 $element: $this, 4998 left: pos.left, 4999 top: pos.top, 5000 right: pos.left + $this.outerWidth(), 5001 bottom: pos.top + $this.outerHeight(), 5002 startselected: false, 5003 selected: $this.hasClass( "ui-selected" ), 5004 selecting: $this.hasClass( "ui-selecting" ), 5005 unselecting: $this.hasClass( "ui-unselecting" ) 5006 } ); 5007 } ); 5008 }; 5009 this.refresh(); 5010 5011 this._mouseInit(); 5012 5013 this.helper = $( "<div>" ); 5014 this._addClass( this.helper, "ui-selectable-helper" ); 5015 }, 5016 5017 _destroy: function() { 5018 this.selectees.removeData( "selectable-item" ); 5019 this._mouseDestroy(); 5020 }, 5021 5022 _mouseStart: function( event ) { 5023 var that = this, 5024 options = this.options; 5025 5026 this.opos = [ event.pageX, event.pageY ]; 5027 this.elementPos = $( this.element[ 0 ] ).offset(); 5028 5029 if ( this.options.disabled ) { 5030 return; 5031 } 5032 5033 this.selectees = $( options.filter, this.element[ 0 ] ); 5034 5035 this._trigger( "start", event ); 5036 5037 $( options.appendTo ).append( this.helper ); 5038 5039 // position helper (lasso) 5040 this.helper.css( { 5041 "left": event.pageX, 5042 "top": event.pageY, 5043 "width": 0, 5044 "height": 0 5045 } ); 5046 5047 if ( options.autoRefresh ) { 5048 this.refresh(); 5049 } 5050 5051 this.selectees.filter( ".ui-selected" ).each( function() { 5052 var selectee = $.data( this, "selectable-item" ); 5053 selectee.startselected = true; 5054 if ( !event.metaKey && !event.ctrlKey ) { 5055 that._removeClass( selectee.$element, "ui-selected" ); 5056 selectee.selected = false; 5057 that._addClass( selectee.$element, "ui-unselecting" ); 5058 selectee.unselecting = true; 5059 5060 // selectable UNSELECTING callback 5061 that._trigger( "unselecting", event, { 5062 unselecting: selectee.element 5063 } ); 5064 } 5065 } ); 5066 5067 $( event.target ).parents().addBack().each( function() { 5068 var doSelect, 5069 selectee = $.data( this, "selectable-item" ); 5070 if ( selectee ) { 5071 doSelect = ( !event.metaKey && !event.ctrlKey ) || 5072 !selectee.$element.hasClass( "ui-selected" ); 5073 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 5074 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 5075 selectee.unselecting = !doSelect; 5076 selectee.selecting = doSelect; 5077 selectee.selected = doSelect; 5078 5079 // selectable (UN)SELECTING callback 5080 if ( doSelect ) { 5081 that._trigger( "selecting", event, { 5082 selecting: selectee.element 5083 } ); 5084 } else { 5085 that._trigger( "unselecting", event, { 5086 unselecting: selectee.element 5087 } ); 5088 } 5089 return false; 5090 } 5091 } ); 5092 5093 }, 5094 5095 _mouseDrag: function( event ) { 5096 5097 this.dragged = true; 5098 5099 if ( this.options.disabled ) { 5100 return; 5101 } 5102 5103 var tmp, 5104 that = this, 5105 options = this.options, 5106 x1 = this.opos[ 0 ], 5107 y1 = this.opos[ 1 ], 5108 x2 = event.pageX, 5109 y2 = event.pageY; 5110 5111 if ( x1 > x2 ) { 5112 tmp = x2; x2 = x1; x1 = tmp; 5113 } 5114 if ( y1 > y2 ) { 5115 tmp = y2; y2 = y1; y1 = tmp; 5116 } 5117 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 5118 5119 this.selectees.each( function() { 5120 var selectee = $.data( this, "selectable-item" ), 5121 hit = false, 5122 offset = {}; 5123 5124 //prevent helper from being selected if appendTo: selectable 5125 if ( !selectee || selectee.element === that.element[ 0 ] ) { 5126 return; 5127 } 5128 5129 offset.left = selectee.left + that.elementPos.left; 5130 offset.right = selectee.right + that.elementPos.left; 5131 offset.top = selectee.top + that.elementPos.top; 5132 offset.bottom = selectee.bottom + that.elementPos.top; 5133 5134 if ( options.tolerance === "touch" ) { 5135 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 5136 offset.bottom < y1 ) ); 5137 } else if ( options.tolerance === "fit" ) { 5138 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 5139 offset.bottom < y2 ); 5140 } 5141 5142 if ( hit ) { 5143 5144 // SELECT 5145 if ( selectee.selected ) { 5146 that._removeClass( selectee.$element, "ui-selected" ); 5147 selectee.selected = false; 5148 } 5149 if ( selectee.unselecting ) { 5150 that._removeClass( selectee.$element, "ui-unselecting" ); 5151 selectee.unselecting = false; 5152 } 5153 if ( !selectee.selecting ) { 5154 that._addClass( selectee.$element, "ui-selecting" ); 5155 selectee.selecting = true; 5156 5157 // selectable SELECTING callback 5158 that._trigger( "selecting", event, { 5159 selecting: selectee.element 5160 } ); 5161 } 5162 } else { 5163 5164 // UNSELECT 5165 if ( selectee.selecting ) { 5166 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 5167 that._removeClass( selectee.$element, "ui-selecting" ); 5168 selectee.selecting = false; 5169 that._addClass( selectee.$element, "ui-selected" ); 5170 selectee.selected = true; 5171 } else { 5172 that._removeClass( selectee.$element, "ui-selecting" ); 5173 selectee.selecting = false; 5174 if ( selectee.startselected ) { 5175 that._addClass( selectee.$element, "ui-unselecting" ); 5176 selectee.unselecting = true; 5177 } 5178 5179 // selectable UNSELECTING callback 5180 that._trigger( "unselecting", event, { 5181 unselecting: selectee.element 5182 } ); 5183 } 5184 } 5185 if ( selectee.selected ) { 5186 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 5187 that._removeClass( selectee.$element, "ui-selected" ); 5188 selectee.selected = false; 5189 5190 that._addClass( selectee.$element, "ui-unselecting" ); 5191 selectee.unselecting = true; 5192 5193 // selectable UNSELECTING callback 5194 that._trigger( "unselecting", event, { 5195 unselecting: selectee.element 5196 } ); 5197 } 5198 } 5199 } 5200 } ); 5201 5202 return false; 5203 }, 5204 5205 _mouseStop: function( event ) { 5206 var that = this; 5207 5208 this.dragged = false; 5209 5210 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 5211 var selectee = $.data( this, "selectable-item" ); 5212 that._removeClass( selectee.$element, "ui-unselecting" ); 5213 selectee.unselecting = false; 5214 selectee.startselected = false; 5215 that._trigger( "unselected", event, { 5216 unselected: selectee.element 5217 } ); 5218 } ); 5219 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 5220 var selectee = $.data( this, "selectable-item" ); 5221 that._removeClass( selectee.$element, "ui-selecting" ) 5222 ._addClass( selectee.$element, "ui-selected" ); 5223 selectee.selecting = false; 5224 selectee.selected = true; 5225 selectee.startselected = true; 5226 that._trigger( "selected", event, { 5227 selected: selectee.element 5228 } ); 5229 } ); 5230 this._trigger( "stop", event ); 5231 5232 this.helper.remove(); 5233 5234 return false; 5235 } 5236 5237} ); 5238 5239 5240/*! 5241 * jQuery UI Sortable 1.13.0 5242 * http://jqueryui.com 5243 * 5244 * Copyright jQuery Foundation and other contributors 5245 * Released under the MIT license. 5246 * http://jquery.org/license 5247 */ 5248 5249//>>label: Sortable 5250//>>group: Interactions 5251//>>description: Enables items in a list to be sorted using the mouse. 5252//>>docs: http://api.jqueryui.com/sortable/ 5253//>>demos: http://jqueryui.com/sortable/ 5254//>>css.structure: ../../themes/base/sortable.css 5255 5256 5257var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { 5258 version: "1.13.0
vendor: 10,175 bytes, lines 5258-5641
5258", 5259 widgetEventPrefix: "sort", 5260 ready: false, 5261 options: { 5262 appendTo: "parent", 5263 axis: false, 5264 connectWith: false, 5265 containment: false, 5266 cursor: "auto", 5267 cursorAt: false, 5268 dropOnEmpty: true, 5269 forcePlaceholderSize: false, 5270 forceHelperSize: false, 5271 grid: false, 5272 handle: false, 5273 helper: "original", 5274 items: "> *", 5275 opacity: false, 5276 placeholder: false, 5277 revert: false, 5278 scroll: true, 5279 scrollSensitivity: 20, 5280 scrollSpeed: 20, 5281 scope: "default", 5282 tolerance: "intersect", 5283 zIndex: 1000, 5284 5285 // Callbacks 5286 activate: null, 5287 beforeStop: null, 5288 change: null, 5289 deactivate: null, 5290 out: null, 5291 over: null, 5292 receive: null, 5293 remove: null, 5294 sort: null, 5295 start: null, 5296 stop: null, 5297 update: null 5298 }, 5299 5300 _isOverAxis: function( x, reference, size ) { 5301 return ( x >= reference ) && ( x < ( reference + size ) ); 5302 }, 5303 5304 _isFloating: function( item ) { 5305 return ( /left|right/ ).test( item.css( "float" ) ) || 5306 ( /inline|table-cell/ ).test( item.css( "display" ) ); 5307 }, 5308 5309 _create: function() { 5310 this.containerCache = {}; 5311 this._addClass( "ui-sortable" ); 5312 5313 //Get the items 5314 this.refresh(); 5315 5316 //Let's determine the parent's offset 5317 this.offset = this.element.offset(); 5318 5319 //Initialize mouse events for interaction 5320 this._mouseInit(); 5321 5322 this._setHandleClassName(); 5323 5324 //We're ready to go 5325 this.ready = true; 5326 5327 }, 5328 5329 _setOption: function( key, value ) { 5330 this._super( key, value ); 5331 5332 if ( key === "handle" ) { 5333 this._setHandleClassName(); 5334 } 5335 }, 5336 5337 _setHandleClassName: function() { 5338 var that = this; 5339 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 5340 $.each( this.items, function() { 5341 that._addClass( 5342 this.instance.options.handle ? 5343 this.item.find( this.instance.options.handle ) : 5344 this.item, 5345 "ui-sortable-handle" 5346 ); 5347 } ); 5348 }, 5349 5350 _destroy: function() { 5351 this._mouseDestroy(); 5352 5353 for ( var i = this.items.length - 1; i >= 0; i-- ) { 5354 this.items[ i ].item.removeData( this.widgetName + "-item" ); 5355 } 5356 5357 return this; 5358 }, 5359 5360 _mouseCapture: function( event, overrideHandle ) { 5361 var currentItem = null, 5362 validHandle = false, 5363 that = this; 5364 5365 if ( this.reverting ) { 5366 return false; 5367 } 5368 5369 if ( this.options.disabled || this.options.type === "static" ) { 5370 return false; 5371 } 5372 5373 //We have to refresh the items data once first 5374 this._refreshItems( event ); 5375 5376 //Find out if the clicked node (or one of its parents) is a actual item in this.items 5377 $( event.target ).parents().each( function() { 5378 if ( $.data( this, that.widgetName + "-item" ) === that ) { 5379 currentItem = $( this ); 5380 return false; 5381 } 5382 } ); 5383 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 5384 currentItem = $( event.target ); 5385 } 5386 5387 if ( !currentItem ) { 5388 return false; 5389 } 5390 if ( this.options.handle && !overrideHandle ) { 5391 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 5392 if ( this === event.target ) { 5393 validHandle = true; 5394 } 5395 } ); 5396 if ( !validHandle ) { 5397 return false; 5398 } 5399 } 5400 5401 this.currentItem = currentItem; 5402 this._removeCurrentsFromItems(); 5403 return true; 5404 5405 }, 5406 5407 _mouseStart: function( event, overrideHandle, noActivation ) { 5408 5409 var i, body, 5410 o = this.options; 5411 5412 this.currentContainer = this; 5413 5414 //We only need to call refreshPositions, because the refreshItems call has been moved to 5415 // mouseCapture 5416 this.refreshPositions(); 5417 5418 //Prepare the dragged items parent 5419 this.appendTo = $( o.appendTo !== "parent" ? 5420 o.appendTo : 5421 this.currentItem.parent() ); 5422 5423 //Create and append the visible helper 5424 this.helper = this._createHelper( event ); 5425 5426 //Cache the helper size 5427 this._cacheHelperProportions(); 5428 5429 /* 5430 * - Position generation - 5431 * This block generates everything position related - it's the core of draggables. 5432 */ 5433 5434 //Cache the margins of the original element 5435 this._cacheMargins(); 5436 5437 //The element's absolute position on the page minus margins 5438 this.offset = this.currentItem.offset(); 5439 this.offset = { 5440 top: this.offset.top - this.margins.top, 5441 left: this.offset.left - this.margins.left 5442 }; 5443 5444 $.extend( this.offset, { 5445 click: { //Where the click happened, relative to the element 5446 left: event.pageX - this.offset.left, 5447 top: event.pageY - this.offset.top 5448 }, 5449 5450 // This is a relative to absolute position minus the actual position calculation - 5451 // only used for relative positioned helper 5452 relative: this._getRelativeOffset() 5453 } ); 5454 5455 // After we get the helper offset, but before we get the parent offset we can 5456 // change the helper's position to absolute 5457 // TODO: Still need to figure out a way to make relative sorting possible 5458 this.helper.css( "position", "absolute" ); 5459 this.cssPosition = this.helper.css( "position" ); 5460 5461 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 5462 if ( o.cursorAt ) { 5463 this._adjustOffsetFromHelper( o.cursorAt ); 5464 } 5465 5466 //Cache the former DOM position 5467 this.domPosition = { 5468 prev: this.currentItem.prev()[ 0 ], 5469 parent: this.currentItem.parent()[ 0 ] 5470 }; 5471 5472 // If the helper is not the original, hide the original so it's not playing any role during 5473 // the drag, won't cause anything bad this way 5474 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 5475 this.currentItem.hide(); 5476 } 5477 5478 //Create the placeholder 5479 this._createPlaceholder(); 5480 5481 //Get the next scrolling parent 5482 this.scrollParent = this.placeholder.scrollParent(); 5483 5484 $.extend( this.offset, { 5485 parent: this._getParentOffset() 5486 } ); 5487 5488 //Set a containment if given in the options 5489 if ( o.containment ) { 5490 this._setContainment(); 5491 } 5492 5493 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 5494 body = this.document.find( "body" ); 5495 5496 // Support: IE 5497 this.storedCursor = body.css( "cursor" ); 5498 body.css( "cursor", o.cursor ); 5499 5500 this.storedStylesheet = 5501 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 5502 } 5503 5504 // We need to make sure to grab the zIndex before setting the 5505 // opacity, because setting the opacity to anything lower than 1 5506 // causes the zIndex to change from "auto" to 0. 5507 if ( o.zIndex ) { // zIndex option 5508 if ( this.helper.css( "zIndex" ) ) { 5509 this._storedZIndex = this.helper.css( "zIndex" ); 5510 } 5511 this.helper.css( "zIndex", o.zIndex ); 5512 } 5513 5514 if ( o.opacity ) { // opacity option 5515 if ( this.helper.css( "opacity" ) ) { 5516 this._storedOpacity = this.helper.css( "opacity" ); 5517 } 5518 this.helper.css( "opacity", o.opacity ); 5519 } 5520 5521 //Prepare scrolling 5522 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 5523 this.scrollParent[ 0 ].tagName !== "HTML" ) { 5524 this.overflowOffset = this.scrollParent.offset(); 5525 } 5526 5527 //Call callbacks 5528 this._trigger( "start", event, this._uiHash() ); 5529 5530 //Recache the helper size 5531 if ( !this._preserveHelperProportions ) { 5532 this._cacheHelperProportions(); 5533 } 5534 5535 //Post "activate" events to possible containers 5536 if ( !noActivation ) { 5537 for ( i = this.containers.length - 1; i >= 0; i-- ) { 5538 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 5539 } 5540 } 5541 5542 //Prepare possible droppables 5543 if ( $.ui.ddmanager ) { 5544 $.ui.ddmanager.current = this; 5545 } 5546 5547 if ( $.ui.ddmanager && !o.dropBehaviour ) { 5548 $.ui.ddmanager.prepareOffsets( this, event ); 5549 } 5550 5551 this.dragging = true; 5552 5553 this._addClass( this.helper, "ui-sortable-helper" ); 5554 5555 //Move the helper, if needed 5556 if ( !this.helper.parent().is( this.appendTo ) ) { 5557 this.helper.detach().appendTo( this.appendTo ); 5558 5559 //Update position 5560 this.offset.parent = this._getParentOffset(); 5561 } 5562 5563 //Generate the original position 5564 this.position = this.originalPosition = this._generatePosition( event ); 5565 this.originalPageX = event.pageX; 5566 this.originalPageY = event.pageY; 5567 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 5568 5569 this._mouseDrag( event ); 5570 5571 return true; 5572 5573 }, 5574 5575 _scroll: function( event ) { 5576 var o = this.options, 5577 scrolled = false; 5578 5579 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 5580 this.scrollParent[ 0 ].tagName !== "HTML" ) { 5581 5582 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 5583 event.pageY < o.scrollSensitivity ) { 5584 this.scrollParent[ 0 ].scrollTop = 5585 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 5586 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 5587 this.scrollParent[ 0 ].scrollTop = 5588 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 5589 } 5590 5591 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 5592 event.pageX < o.scrollSensitivity ) { 5593 this.scrollParent[ 0 ].scrollLeft = scrolled = 5594 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 5595 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 5596 this.scrollParent[ 0 ].scrollLeft = scrolled = 5597 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 5598 } 5599 5600 } else { 5601 5602 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 5603 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 5604 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 5605 o.scrollSensitivity ) { 5606 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 5607 } 5608 5609 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 5610 scrolled = this.document.scrollLeft( 5611 this.document.scrollLeft() - o.scrollSpeed 5612 ); 5613 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 5614 o.scrollSensitivity ) { 5615 scrolled = this.document.scrollLeft( 5616 this.document.scrollLeft() + o.scrollSpeed 5617 ); 5618 } 5619 5620 } 5621 5622 return scrolled; 5623 }, 5624 5625 _mouseDrag: function( event ) { 5626 var i, item, itemElement, intersection, 5627 o = this.options; 5628 5629 //Compute the helpers position 5630 this.position = this._generatePosition( event ); 5631 this.positionAbs = this._convertPositionTo( "absolute" ); 5632 5633 //Set the helper position 5634 if ( !this.options.axis || this.options.axis !== "y" ) { 5635 this.helper[ 0 ].style.left = this.position.left + "px"; 5636 } 5637 if ( !this.options.axis || this.options.axis !== "x" ) { 5638 this.helper[ 0 ].style.top = this.position.top + "px"; 5639 } 5640 5641 //
vendor: 2,110 bytes, lines 5641-5712
5641Post events to containers 5642 this._contactContainers( event ); 5643 5644 if ( this.innermostContainer !== null ) { 5645 5646 //Do scrolling 5647 if ( o.scroll ) { 5648 if ( this._scroll( event ) !== false ) { 5649 5650 //Update item positions used in position checks 5651 this._refreshItemPositions( true ); 5652 5653 if ( $.ui.ddmanager && !o.dropBehaviour ) { 5654 $.ui.ddmanager.prepareOffsets( this, event ); 5655 } 5656 } 5657 } 5658 5659 this.dragDirection = { 5660 vertical: this._getDragVerticalDirection(), 5661 horizontal: this._getDragHorizontalDirection() 5662 }; 5663 5664 //Rearrange 5665 for ( i = this.items.length - 1; i >= 0; i-- ) { 5666 5667 //Cache variables and intersection, continue if no intersection 5668 item = this.items[ i ]; 5669 itemElement = item.item[ 0 ]; 5670 intersection = this._intersectsWithPointer( item ); 5671 if ( !intersection ) { 5672 continue; 5673 } 5674 5675 // Only put the placeholder inside the current Container, skip all 5676 // items from other containers. This works because when moving 5677 // an item from one container to another the 5678 // currentContainer is switched before the placeholder is moved. 5679 // 5680 // Without this, moving items in "sub-sortables" can cause 5681 // the placeholder to jitter between the outer and inner container. 5682 if ( item.instance !== this.currentContainer ) { 5683 continue; 5684 } 5685 5686 // Cannot intersect with itself 5687 // no useless actions that have been done before 5688 // no action if the item moved is the parent of the item checked 5689 if ( itemElement !== this.currentItem[ 0 ] && 5690 this.placeholder[ intersection === 1 ? 5691 "next" : "prev" ]()[ 0 ] !== itemElement && 5692 !$.contains( this.placeholder[ 0 ], itemElement ) && 5693 ( this.options.type === "semi-dynamic" ? 5694 !$.contains( this.element[ 0 ], itemElement ) : 5695 true 5696 ) 5697 ) { 5698 5699 this.direction = intersection === 1 ? "down" : "up"; 5700 5701 if ( this.options.tolerance === "pointer" || 5702 this._intersectsWithSides( item ) ) { 5703 this._rearrange( event, item ); 5704 } else { 5705 break; 5706 } 5707 5708 this._trigger( "change", event, this._uiHash() ); 5709 break; 5710 } 5711 } 5712 }
vendor: 5,297 bytes, lines 5712-5913
5712 5713 5714 //Interconnect with droppables 5715 if ( $.ui.ddmanager ) { 5716 $.ui.ddmanager.drag( this, event ); 5717 } 5718 5719 //Call callbacks 5720 this._trigger( "sort", event, this._uiHash() ); 5721 5722 this.lastPositionAbs = this.positionAbs; 5723 return false; 5724 5725 }, 5726 5727 _mouseStop: function( event, noPropagation ) { 5728 5729 if ( !event ) { 5730 return; 5731 } 5732 5733 //If we are using droppables, inform the manager about the drop 5734 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 5735 $.ui.ddmanager.drop( this, event ); 5736 } 5737 5738 if ( this.options.revert ) { 5739 var that = this, 5740 cur = this.placeholder.offset(), 5741 axis = this.options.axis, 5742 animation = {}; 5743 5744 if ( !axis || axis === "x" ) { 5745 animation.left = cur.left - this.offset.parent.left - this.margins.left + 5746 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 5747 0 : 5748 this.offsetParent[ 0 ].scrollLeft 5749 ); 5750 } 5751 if ( !axis || axis === "y" ) { 5752 animation.top = cur.top - this.offset.parent.top - this.margins.top + 5753 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 5754 0 : 5755 this.offsetParent[ 0 ].scrollTop 5756 ); 5757 } 5758 this.reverting = true; 5759 $( this.helper ).animate( 5760 animation, 5761 parseInt( this.options.revert, 10 ) || 500, 5762 function() { 5763 that._clear( event ); 5764 } 5765 ); 5766 } else { 5767 this._clear( event, noPropagation ); 5768 } 5769 5770 return false; 5771 5772 }, 5773 5774 cancel: function() { 5775 5776 if ( this.dragging ) { 5777 5778 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 5779 5780 if ( this.options.helper === "original" ) { 5781 this.currentItem.css( this._storedCSS ); 5782 this._removeClass( this.currentItem, "ui-sortable-helper" ); 5783 } else { 5784 this.currentItem.show(); 5785 } 5786 5787 //Post deactivating events to containers 5788 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 5789 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 5790 if ( this.containers[ i ].containerCache.over ) { 5791 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 5792 this.containers[ i ].containerCache.over = 0; 5793 } 5794 } 5795 5796 } 5797 5798 if ( this.placeholder ) { 5799 5800 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 5801 // it unbinds ALL events from the original node! 5802 if ( this.placeholder[ 0 ].parentNode ) { 5803 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 5804 } 5805 if ( this.options.helper !== "original" && this.helper && 5806 this.helper[ 0 ].parentNode ) { 5807 this.helper.remove(); 5808 } 5809 5810 $.extend( this, { 5811 helper: null, 5812 dragging: false, 5813 reverting: false, 5814 _noFinalSort: null 5815 } ); 5816 5817 if ( this.domPosition.prev ) { 5818 $( this.domPosition.prev ).after( this.currentItem ); 5819 } else { 5820 $( this.domPosition.parent ).prepend( this.currentItem ); 5821 } 5822 } 5823 5824 return this; 5825 5826 }, 5827 5828 serialize: function( o ) { 5829 5830 var items = this._getItemsAsjQuery( o && o.connected ), 5831 str = []; 5832 o = o || {}; 5833 5834 $( items ).each( function() { 5835 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 5836 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 5837 if ( res ) { 5838 str.push( 5839 ( o.key || res[ 1 ] + "[]" ) + 5840 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 5841 } 5842 } ); 5843 5844 if ( !str.length && o.key ) { 5845 str.push( o.key + "=" ); 5846 } 5847 5848 return str.join( "&" ); 5849 5850 }, 5851 5852 toArray: function( o ) { 5853 5854 var items = this._getItemsAsjQuery( o && o.connected ), 5855 ret = []; 5856 5857 o = o || {}; 5858 5859 items.each( function() { 5860 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 5861 } ); 5862 return ret; 5863 5864 }, 5865 5866 /* Be careful with the following core functions */ 5867 _intersectsWith: function( item ) { 5868 5869 var x1 = this.positionAbs.left, 5870 x2 = x1 + this.helperProportions.width, 5871 y1 = this.positionAbs.top, 5872 y2 = y1 + this.helperProportions.height, 5873 l = item.left, 5874 r = l + item.width, 5875 t = item.top, 5876 b = t + item.height, 5877 dyClick = this.offset.click.top, 5878 dxClick = this.offset.click.left, 5879 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 5880 ( y1 + dyClick ) < b ), 5881 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 5882 ( x1 + dxClick ) < r ), 5883 isOverElement = isOverElementHeight && isOverElementWidth; 5884 5885 if ( this.options.tolerance === "pointer" || 5886 this.options.forcePointerForContainers || 5887 ( this.options.tolerance !== "pointer" && 5888 this.helperProportions[ this.floating ? "width" : "height" ] > 5889 item[ this.floating ? "width" : "height" ] ) 5890 ) { 5891 return isOverElement; 5892 } else { 5893 5894 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 5895 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 5896 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 5897 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 5898 5899 } 5900 }, 5901 5902 _intersectsWithPointer: function( item ) { 5903 var verticalDirection, horizontalDirection, 5904 isOverElementHeight = ( this.options.axis === "x" ) || 5905 this._isOverAxis( 5906 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 5907 isOverElementWidth = ( this.options.axis === "y" ) || 5908 this._isOverAxis( 5909 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 5910 isOverElement = isOverElementHeight && isOverElementWidth; 5911 5912 if ( !isOverElement ) { 5913 return false;
vendor: 5,624 bytes, lines 5914-6108
5914 } 5915 5916 verticalDirection = this.dragDirection.vertical; 5917 horizontalDirection = this.dragDirection.horizontal; 5918 5919 return this.floating ? 5920 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 5921 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 5922 5923 }, 5924 5925 _intersectsWithSides: function( item ) { 5926 5927 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 5928 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 5929 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 5930 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 5931 verticalDirection = this.dragDirection.vertical, 5932 horizontalDirection = this.dragDirection.horizontal; 5933 5934 if ( this.floating && horizontalDirection ) { 5935 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 5936 ( horizontalDirection === "left" && !isOverRightHalf ) ); 5937 } else { 5938 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 5939 ( verticalDirection === "up" && !isOverBottomHalf ) ); 5940 } 5941 5942 }, 5943 5944 _getDragVerticalDirection: function() { 5945 var delta = this.positionAbs.top - this.lastPositionAbs.top; 5946 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 5947 }, 5948 5949 _getDragHorizontalDirection: function() { 5950 var delta = this.positionAbs.left - this.lastPositionAbs.left; 5951 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 5952 }, 5953 5954 refresh: function( event ) { 5955 this._refreshItems( event ); 5956 this._setHandleClassName(); 5957 this.refreshPositions(); 5958 return this; 5959 }, 5960 5961 _connectWith: function() { 5962 var options = this.options; 5963 return options.connectWith.constructor === String ? 5964 [ options.connectWith ] : 5965 options.connectWith; 5966 }, 5967 5968 _getItemsAsjQuery: function( connected ) { 5969 5970 var i, j, cur, inst, 5971 items = [], 5972 queries = [], 5973 connectWith = this._connectWith(); 5974 5975 if ( connectWith && connected ) { 5976 for ( i = connectWith.length - 1; i >= 0; i-- ) { 5977 cur = $( connectWith[ i ], this.document[ 0 ] ); 5978 for ( j = cur.length - 1; j >= 0; j-- ) { 5979 inst = $.data( cur[ j ], this.widgetFullName ); 5980 if ( inst && inst !== this && !inst.options.disabled ) { 5981 queries.push( [ typeof inst.options.items === "function" ? 5982 inst.options.items.call( inst.element ) : 5983 $( inst.options.items, inst.element ) 5984 .not( ".ui-sortable-helper" ) 5985 .not( ".ui-sortable-placeholder" ), inst ] ); 5986 } 5987 } 5988 } 5989 } 5990 5991 queries.push( [ typeof this.options.items === "function" ? 5992 this.options.items 5993 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 5994 $( this.options.items, this.element ) 5995 .not( ".ui-sortable-helper" ) 5996 .not( ".ui-sortable-placeholder" ), this ] ); 5997 5998 function addItems() { 5999 items.push( this ); 6000 } 6001 for ( i = queries.length - 1; i >= 0; i-- ) { 6002 queries[ i ][ 0 ].each( addItems ); 6003 } 6004 6005 return $( items ); 6006 6007 }, 6008 6009 _removeCurrentsFromItems: function() { 6010 6011 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 6012 6013 this.items = $.grep( this.items, function( item ) { 6014 for ( var j = 0; j < list.length; j++ ) { 6015 if ( list[ j ] === item.item[ 0 ] ) { 6016 return false; 6017 } 6018 } 6019 return true; 6020 } ); 6021 6022 }, 6023 6024 _refreshItems: function( event ) { 6025 6026 this.items = []; 6027 this.containers = [ this ]; 6028 6029 var i, j, cur, inst, targetData, _queries, item, queriesLength, 6030 items = this.items, 6031 queries = [ [ typeof this.options.items === "function" ? 6032 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 6033 $( this.options.items, this.element ), this ] ], 6034 connectWith = this._connectWith(); 6035 6036 //Shouldn't be run the first time through due to massive slow-down 6037 if ( connectWith && this.ready ) { 6038 for ( i = connectWith.length - 1; i >= 0; i-- ) { 6039 cur = $( connectWith[ i ], this.document[ 0 ] ); 6040 for ( j = cur.length - 1; j >= 0; j-- ) { 6041 inst = $.data( cur[ j ], this.widgetFullName ); 6042 if ( inst && inst !== this && !inst.options.disabled ) { 6043 queries.push( [ typeof inst.options.items === "function" ? 6044 inst.options.items 6045 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 6046 $( inst.options.items, inst.element ), inst ] ); 6047 this.containers.push( inst ); 6048 } 6049 } 6050 } 6051 } 6052 6053 for ( i = queries.length - 1; i >= 0; i-- ) { 6054 targetData = queries[ i ][ 1 ]; 6055 _queries = queries[ i ][ 0 ]; 6056 6057 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 6058 item = $( _queries[ j ] ); 6059 6060 // Data for target checking (mouse manager) 6061 item.data( this.widgetName + "-item", targetData ); 6062 6063 items.push( { 6064 item: item, 6065 instance: targetData, 6066 width: 0, height: 0, 6067 left: 0, top: 0 6068 } ); 6069 } 6070 } 6071 6072 }, 6073 6074 _refreshItemPositions: function( fast ) { 6075 var i, item, t, p; 6076 6077 for ( i = this.items.length - 1; i >= 0; i-- ) { 6078 item = this.items[ i ]; 6079 6080 //We ignore calculating positions of all connected containers when we're not over them 6081 if ( this.currentContainer && item.instance !== this.currentContainer && 6082 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 6083 continue; 6084 } 6085 6086 t = this.options.toleranceElement ? 6087 $( this.options.toleranceElement, item.item ) : 6088 item.item; 6089 6090 if ( !fast ) { 6091 item.width = t.outerWidth(); 6092 item.height = t.outerHeight(); 6093 } 6094 6095 p = t.offset(); 6096 item.left = p.left; 6097 item.top = p.top; 6098 } 6099 }, 6100 6101 refreshPositions: function( fast ) { 6102 6103 // Determine whether items are being displayed horizontally 6104 this.floating = this.items.length ? 6105 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 6106 false; 6107 6108
vendor: 8,862 bytes, lines 6108-6382
6108if ( this.innermostContainer !== null ) { 6109 this._refreshItemPositions( fast ); 6110 } 6111 6112 var i, p; 6113 6114 if ( this.options.custom && this.options.custom.refreshContainers ) { 6115 this.options.custom.refreshContainers.call( this ); 6116 } else { 6117 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6118 p = this.containers[ i ].element.offset(); 6119 this.containers[ i ].containerCache.left = p.left; 6120 this.containers[ i ].containerCache.top = p.top; 6121 this.containers[ i ].containerCache.width = 6122 this.containers[ i ].element.outerWidth(); 6123 this.containers[ i ].containerCache.height = 6124 this.containers[ i ].element.outerHeight(); 6125 } 6126 } 6127 6128 return this; 6129 }, 6130 6131 _createPlaceholder: function( that ) { 6132 that = that || this; 6133 var className, nodeName, 6134 o = that.options; 6135 6136 if ( !o.placeholder || o.placeholder.constructor === String ) { 6137 className = o.placeholder; 6138 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 6139 o.placeholder = { 6140 element: function() { 6141 6142 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 6143 6144 that._addClass( element, "ui-sortable-placeholder", 6145 className || that.currentItem[ 0 ].className ) 6146 ._removeClass( element, "ui-sortable-helper" ); 6147 6148 if ( nodeName === "tbody" ) { 6149 that._createTrPlaceholder( 6150 that.currentItem.find( "tr" ).eq( 0 ), 6151 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 6152 ); 6153 } else if ( nodeName === "tr" ) { 6154 that._createTrPlaceholder( that.currentItem, element ); 6155 } else if ( nodeName === "img" ) { 6156 element.attr( "src", that.currentItem.attr( "src" ) ); 6157 } 6158 6159 if ( !className ) { 6160 element.css( "visibility", "hidden" ); 6161 } 6162 6163 return element; 6164 }, 6165 update: function( container, p ) { 6166 6167 // 1. If a className is set as 'placeholder option, we don't force sizes - 6168 // the class is responsible for that 6169 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 6170 // class name is specified 6171 if ( className && !o.forcePlaceholderSize ) { 6172 return; 6173 } 6174 6175 // If the element doesn't have a actual height or width by itself (without 6176 // styles coming from a stylesheet), it receives the inline height and width 6177 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 6178 // anyway since we're populating them with <td>s above, but they're unlikely to 6179 // be the correct height on their own if the row heights are dynamic, so we'll 6180 // always assign the height of the dragged item given forcePlaceholderSize 6181 // is true. 6182 if ( !p.height() || ( o.forcePlaceholderSize && 6183 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 6184 p.height( 6185 that.currentItem.innerHeight() - 6186 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 6187 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 6188 } 6189 if ( !p.width() ) { 6190 p.width( 6191 that.currentItem.innerWidth() - 6192 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 6193 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 6194 } 6195 } 6196 }; 6197 } 6198 6199 //Create the placeholder 6200 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 6201 6202 //Append it after the actual current item 6203 that.currentItem.after( that.placeholder ); 6204 6205 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 6206 o.placeholder.update( that, that.placeholder ); 6207 6208 }, 6209 6210 _createTrPlaceholder: function( sourceTr, targetTr ) { 6211 var that = this; 6212 6213 sourceTr.children().each( function() { 6214 $( "<td> </td>", that.document[ 0 ] ) 6215 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 6216 .appendTo( targetTr ); 6217 } ); 6218 }, 6219 6220 _contactContainers: function( event ) { 6221 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 6222 floating, axis, 6223 innermostContainer = null, 6224 innermostIndex = null; 6225 6226 // Get innermost container that intersects with item 6227 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6228 6229 // Never consider a container that's located within the item itself 6230 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 6231 continue; 6232 } 6233 6234 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 6235 6236 // If we've already found a container and it's more "inner" than this, then continue 6237 if ( innermostContainer && 6238 $.contains( 6239 this.containers[ i ].element[ 0 ], 6240 innermostContainer.element[ 0 ] ) ) { 6241 continue; 6242 } 6243 6244 innermostContainer = this.containers[ i ]; 6245 innermostIndex = i; 6246 6247 } else { 6248 6249 // container doesn't intersect. trigger "out" event if necessary 6250 if ( this.containers[ i ].containerCache.over ) { 6251 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 6252 this.containers[ i ].containerCache.over = 0; 6253 } 6254 } 6255 6256 } 6257 6258 this.innermostContainer = innermostContainer; 6259 6260 // If no intersecting containers found, return 6261 if ( !innermostContainer ) { 6262 return; 6263 } 6264 6265 // Move the item into the container if it's not there already 6266 if ( this.containers.length === 1 ) { 6267 if ( !this.containers[ innermostIndex ].containerCache.over ) { 6268 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 6269 this.containers[ innermostIndex ].containerCache.over = 1; 6270 } 6271 } else { 6272 6273 // When entering a new container, we will find the item with the least distance and 6274 // append our item near it 6275 dist = 10000; 6276 itemWithLeastDistance = null; 6277 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 6278 posProperty = floating ? "left" : "top"; 6279 sizeProperty = floating ? "width" : "height"; 6280 axis = floating ? "pageX" : "pageY"; 6281 6282 for ( j = this.items.length - 1; j >= 0; j-- ) { 6283 if ( !$.contains( 6284 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 6285 ) { 6286 continue; 6287 } 6288 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 6289 continue; 6290 } 6291 6292 cur = this.items[ j ].item.offset()[ posProperty ]; 6293 nearBottom = false; 6294 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 6295 nearBottom = true; 6296 } 6297 6298 if ( Math.abs( event[ axis ] - cur ) < dist ) { 6299 dist = Math.abs( event[ axis ] - cur ); 6300 itemWithLeastDistance = this.items[ j ]; 6301 this.direction = nearBottom ? "up" : "down"; 6302 } 6303 } 6304 6305 //Check if dropOnEmpty is enabled 6306 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 6307 return; 6308 } 6309 6310 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 6311 if ( !this.currentContainer.containerCache.over ) { 6312 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 6313 this.currentContainer.containerCache.over = 1; 6314 } 6315 return; 6316 } 6317 6318 if ( itemWithLeastDistance ) { 6319 this._rearrange( event, itemWithLeastDistance, null, true ); 6320 } else { 6321 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 6322 } 6323 this._trigger( "change", event, this._uiHash() ); 6324 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 6325 this.currentContainer = this.containers[ innermostIndex ]; 6326 6327 //Update the placeholder 6328 this.options.placeholder.update( this.currentContainer, this.placeholder ); 6329 6330 //Update scrollParent 6331 this.scrollParent = this.placeholder.scrollParent(); 6332 6333 //Update overflowOffset 6334 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6335 this.scrollParent[ 0 ].tagName !== "HTML" ) { 6336 this.overflowOffset = this.scrollParent.offset(); 6337 } 6338 6339 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 6340 this.containers[ innermostIndex ].containerCache.over = 1; 6341 } 6342 6343 }, 6344 6345 _createHelper: function( event ) { 6346 6347 var o = this.options, 6348 helper = typeof o.helper === "function" ? 6349 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 6350 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 6351 6352 //Add the helper to the DOM if that didn't happen already 6353 if ( !helper.parents( "body" ).length ) { 6354 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 6355 } 6356 6357 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 6358 this._storedCSS = { 6359 width: this.currentItem[ 0 ].style.width, 6360 height: this.currentItem[ 0 ].style.height, 6361 position: this.currentItem.css( "position" ), 6362 top: this.currentItem.css( "top" ), 6363 left: this.currentItem.css( "left" ) 6364 }; 6365 } 6366 6367 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 6368 helper.width( this.currentItem.width() ); 6369 } 6370 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 6371 helper.height( this.currentItem.height() ); 6372 } 6373 6374 return helper; 6375 6376 }, 6377 6378 _adjustOffsetFromHelper: function( obj ) { 6379 if ( typeof obj === "string" ) { 6380 obj = obj.split( " " ); 6381 } 6382 if ( Array
vendor: 5,789 bytes, lines 6382-6546
6382.isArray( obj ) ) { 6383 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 6384 } 6385 if ( "left" in obj ) { 6386 this.offset.click.left = obj.left + this.margins.left; 6387 } 6388 if ( "right" in obj ) { 6389 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 6390 } 6391 if ( "top" in obj ) { 6392 this.offset.click.top = obj.top + this.margins.top; 6393 } 6394 if ( "bottom" in obj ) { 6395 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 6396 } 6397 }, 6398 6399 _getParentOffset: function() { 6400 6401 //Get the offsetParent and cache its position 6402 this.offsetParent = this.helper.offsetParent(); 6403 var po = this.offsetParent.offset(); 6404 6405 // This is a special case where we need to modify a offset calculated on start, since the 6406 // following happened: 6407 // 1. The position of the helper is absolute, so it's position is calculated based on the 6408 // next positioned parent 6409 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 6410 // the document, which means that the scroll is included in the initial calculation of the 6411 // offset of the parent, and never recalculated upon drag 6412 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 6413 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 6414 po.left += this.scrollParent.scrollLeft(); 6415 po.top += this.scrollParent.scrollTop(); 6416 } 6417 6418 // This needs to be actually done for all browsers, since pageX/pageY includes this 6419 // information with an ugly IE fix 6420 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body || 6421 ( this.offsetParent[ 0 ].tagName && 6422 this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) { 6423 po = { top: 0, left: 0 }; 6424 } 6425 6426 return { 6427 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 6428 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 6429 }; 6430 6431 }, 6432 6433 _getRelativeOffset: function() { 6434 6435 if ( this.cssPosition === "relative" ) { 6436 var p = this.currentItem.position(); 6437 return { 6438 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 6439 this.scrollParent.scrollTop(), 6440 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 6441 this.scrollParent.scrollLeft() 6442 }; 6443 } else { 6444 return { top: 0, left: 0 }; 6445 } 6446 6447 }, 6448 6449 _cacheMargins: function() { 6450 this.margins = { 6451 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 6452 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 6453 }; 6454 }, 6455 6456 _cacheHelperProportions: function() { 6457 this.helperProportions = { 6458 width: this.helper.outerWidth(), 6459 height: this.helper.outerHeight() 6460 }; 6461 }, 6462 6463 _setContainment: function() { 6464 6465 var ce, co, over, 6466 o = this.options; 6467 if ( o.containment === "parent" ) { 6468 o.containment = this.helper[ 0 ].parentNode; 6469 } 6470 if ( o.containment === "document" || o.containment === "window" ) { 6471 this.containment = [ 6472 0 - this.offset.relative.left - this.offset.parent.left, 6473 0 - this.offset.relative.top - this.offset.parent.top, 6474 o.containment === "document" ? 6475 this.document.width() : 6476 this.window.width() - this.helperProportions.width - this.margins.left, 6477 ( o.containment === "document" ? 6478 ( this.document.height() || document.body.parentNode.scrollHeight ) : 6479 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 6480 ) - this.helperProportions.height - this.margins.top 6481 ]; 6482 } 6483 6484 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 6485 ce = $( o.containment )[ 0 ]; 6486 co = $( o.containment ).offset(); 6487 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 6488 6489 this.containment = [ 6490 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 6491 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 6492 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 6493 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 6494 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 6495 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 6496 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 6497 this.helperProportions.width - this.margins.left, 6498 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 6499 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 6500 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 6501 this.helperProportions.height - this.margins.top 6502 ]; 6503 } 6504 6505 }, 6506 6507 _convertPositionTo: function( d, pos ) { 6508 6509 if ( !pos ) { 6510 pos = this.position; 6511 } 6512 var mod = d === "absolute" ? 1 : -1, 6513 scroll = this.cssPosition === "absolute" && 6514 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6515 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 6516 this.offsetParent : 6517 this.scrollParent, 6518 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 6519 6520 return { 6521 top: ( 6522 6523 // The absolute mouse position 6524 pos.top + 6525 6526 // Only for relative positioned nodes: Relative offset from element to offset parent 6527 this.offset.relative.top * mod + 6528 6529 // The offsetParent's offset without borders (offset + border) 6530 this.offset.parent.top * mod - 6531 ( ( this.cssPosition === "fixed" ? 6532 -this.scrollParent.scrollTop() : 6533 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 6534 ), 6535 left: ( 6536 6537 // The absolute mouse position 6538 pos.left + 6539 6540 // Only for relative positioned nodes: Relative offset from element to offset parent 6541 this.offset.relative.left * mod + 6542 6543 // The offsetParent's offset without borders (offset + border) 6544 this.offset.parent.left * mod - 6545 ( ( this.cssPosition === "fixed" ? 6546 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,632 bytes, lines 6547-6690
6547 scroll.scrollLeft() ) * mod ) 6548 ) 6549 }; 6550 6551 }, 6552 6553 _generatePosition: function( event ) { 6554 6555 var top, left, 6556 o = this.options, 6557 pageX = event.pageX, 6558 pageY = event.pageY, 6559 scroll = this.cssPosition === "absolute" && 6560 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6561 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 6562 this.offsetParent : 6563 this.scrollParent, 6564 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 6565 6566 // This is another very weird special case that only happens for relative elements: 6567 // 1. If the css position is relative 6568 // 2. and the scroll parent is the document or similar to the offset parent 6569 // we have to refresh the relative offset during the scroll so there are no jumps 6570 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 6571 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 6572 this.offset.relative = this._getRelativeOffset(); 6573 } 6574 6575 /* 6576 * - Position constraining - 6577 * Constrain the position to a mix of grid, containment. 6578 */ 6579 6580 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 6581 6582 if ( this.containment ) { 6583 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 6584 pageX = this.containment[ 0 ] + this.offset.click.left; 6585 } 6586 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 6587 pageY = this.containment[ 1 ] + this.offset.click.top; 6588 } 6589 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 6590 pageX = this.containment[ 2 ] + this.offset.click.left; 6591 } 6592 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 6593 pageY = this.containment[ 3 ] + this.offset.click.top; 6594 } 6595 } 6596 6597 if ( o.grid ) { 6598 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 6599 o.grid[ 1 ] ) * o.grid[ 1 ]; 6600 pageY = this.containment ? 6601 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 6602 top - this.offset.click.top <= this.containment[ 3 ] ) ? 6603 top : 6604 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 6605 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 6606 top; 6607 6608 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 6609 o.grid[ 0 ] ) * o.grid[ 0 ]; 6610 pageX = this.containment ? 6611 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 6612 left - this.offset.click.left <= this.containment[ 2 ] ) ? 6613 left : 6614 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 6615 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 6616 left; 6617 } 6618 6619 } 6620 6621 return { 6622 top: ( 6623 6624 // The absolute mouse position 6625 pageY - 6626 6627 // Click offset (relative to the element) 6628 this.offset.click.top - 6629 6630 // Only for relative positioned nodes: Relative offset from element to offset parent 6631 this.offset.relative.top - 6632 6633 // The offsetParent's offset without borders (offset + border) 6634 this.offset.parent.top + 6635 ( ( this.cssPosition === "fixed" ? 6636 -this.scrollParent.scrollTop() : 6637 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 6638 ), 6639 left: ( 6640 6641 // The absolute mouse position 6642 pageX - 6643 6644 // Click offset (relative to the element) 6645 this.offset.click.left - 6646 6647 // Only for relative positioned nodes: Relative offset from element to offset parent 6648 this.offset.relative.left - 6649 6650 // The offsetParent's offset without borders (offset + border) 6651 this.offset.parent.left + 6652 ( ( this.cssPosition === "fixed" ? 6653 -this.scrollParent.scrollLeft() : 6654 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 6655 ) 6656 }; 6657 6658 }, 6659 6660 _rearrange: function( event, i, a, hardRefresh ) { 6661 6662 if ( a ) { 6663 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 6664 } else { 6665 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 6666 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 6667 } 6668 6669 //Various things done here to improve the performance: 6670 // 1. we create a setTimeout, that calls refreshPositions 6671 // 2. on the instance, we have a counter variable, that get's higher after every append 6672 // 3. on the local scope, we copy the counter variable, and check in the timeout, 6673 // if it's still the same 6674 // 4. this lets only the last addition to the timeout stack through 6675 this.counter = this.counter ? ++this.counter : 1; 6676 var counter = this.counter; 6677 6678 this._delay( function() { 6679 if ( counter === this.counter ) { 6680 6681 //Precompute after each DOM insertion, NOT on mousemove 6682 this.refreshPositions( !hardRefresh ); 6683 } 6684 } ); 6685 6686 }, 6687 6688 _clear: function( event, noPropagation ) { 6689 6690 this.reverting = false;
vendor: 4,270 bytes, lines 6691-6835
6691 6692 // We delay all events that have to be triggered to after the point where the placeholder 6693 // has been removed and everything else normalized again 6694 var i, 6695 delayedTriggers = []; 6696 6697 // We first have to update the dom position of the actual currentItem 6698 // Note: don't do it if the current item is already removed (by a user), or it gets 6699 // reappended (see #4088) 6700 if ( !this._noFinalSort && this.currentItem.parent().length ) { 6701 this.placeholder.before( this.currentItem ); 6702 } 6703 this._noFinalSort = null; 6704 6705 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 6706 for ( i in this._storedCSS ) { 6707 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 6708 this._storedCSS[ i ] = ""; 6709 } 6710 } 6711 this.currentItem.css( this._storedCSS ); 6712 this._removeClass( this.currentItem, "ui-sortable-helper" ); 6713 } else { 6714 this.currentItem.show(); 6715 } 6716 6717 if ( this.fromOutside && !noPropagation ) { 6718 delayedTriggers.push( function( event ) { 6719 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 6720 } ); 6721 } 6722 if ( ( this.fromOutside || 6723 this.domPosition.prev !== 6724 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 6725 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 6726 6727 // Trigger update callback if the DOM position has changed 6728 delayedTriggers.push( function( event ) { 6729 this._trigger( "update", event, this._uiHash() ); 6730 } ); 6731 } 6732 6733 // Check if the items Container has Changed and trigger appropriate 6734 // events. 6735 if ( this !== this.currentContainer ) { 6736 if ( !noPropagation ) { 6737 delayedTriggers.push( function( event ) { 6738 this._trigger( "remove", event, this._uiHash() ); 6739 } ); 6740 delayedTriggers.push( ( function( c ) { 6741 return function( event ) { 6742 c._trigger( "receive", event, this._uiHash( this ) ); 6743 }; 6744 } ).call( this, this.currentContainer ) ); 6745 delayedTriggers.push( ( function( c ) { 6746 return function( event ) { 6747 c._trigger( "update", event, this._uiHash( this ) ); 6748 }; 6749 } ).call( this, this.currentContainer ) ); 6750 } 6751 } 6752 6753 //Post events to containers 6754 function delayEvent( type, instance, container ) { 6755 return function( event ) { 6756 container._trigger( type, event, instance._uiHash( instance ) ); 6757 }; 6758 } 6759 for ( i = this.containers.length - 1; i >= 0; i-- ) { 6760 if ( !noPropagation ) { 6761 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 6762 } 6763 if ( this.containers[ i ].containerCache.over ) { 6764 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 6765 this.containers[ i ].containerCache.over = 0; 6766 } 6767 } 6768 6769 //Do what was originally in plugins 6770 if ( this.storedCursor ) { 6771 this.document.find( "body" ).css( "cursor", this.storedCursor ); 6772 this.storedStylesheet.remove(); 6773 } 6774 if ( this._storedOpacity ) { 6775 this.helper.css( "opacity", this._storedOpacity ); 6776 } 6777 if ( this._storedZIndex ) { 6778 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 6779 } 6780 6781 this.dragging = false; 6782 6783 if ( !noPropagation ) { 6784 this._trigger( "beforeStop", event, this._uiHash() ); 6785 } 6786 6787 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 6788 // it unbinds ALL events from the original node! 6789 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 6790 6791 if ( !this.cancelHelperRemoval ) { 6792 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 6793 this.helper.remove(); 6794 } 6795 this.helper = null; 6796 } 6797 6798 if ( !noPropagation ) { 6799 for ( i = 0; i < delayedTriggers.length; i++ ) { 6800 6801 // Trigger all delayed events 6802 delayedTriggers[ i ].call( this, event ); 6803 } 6804 this._trigger( "stop", event, this._uiHash() ); 6805 } 6806 6807 this.fromOutside = false; 6808 return !this.cancelHelperRemoval; 6809 6810 }, 6811 6812 _trigger: function() { 6813 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 6814 this.cancel(); 6815 } 6816 }, 6817 6818 _uiHash: function( _inst ) { 6819 var inst = _inst || this; 6820 return { 6821 helper: inst.helper, 6822 placeholder: inst.placeholder || $( [] ), 6823 position: inst.position, 6824 originalPosition: inst.originalPosition, 6825 offset: inst.positionAbs, 6826 item: inst.currentItem, 6827 sender: _inst ? _inst.element : null 6828 }; 6829 } 6830 6831} ); 6832 6833 6834/*! 6835 * jQuery UI
6835Accordion 1.13.0 6836 * http://jqueryui.com 6837 * 6838 * Copyright jQuery Foundation and other contributors 6839 * Released under the MIT license. 6840 * http://jquery.org/license 6841 */ 6842 6843//>>label: Accordion 6844//>>group: Widgets 6845/* eslint-disable max-len */ 6846//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 6847/* eslint-enable max-len */ 6848//>>docs: http://api.jqueryui.com/accordion/ 6849//>>demos: http://jqueryui.com/accordion/ 6850//>>css.structure: ../../themes/base/core.css 6851//>>css.structure: ../../themes/base/accordion.css 6852//>>css.theme: ../../themes/base/theme.css 6853 6854 6855var widgetsAccordion = $.widget( "ui.accordion", { 6856 version: "1.13.0
vendor: 15,122 bytes, lines 6856-7435
6856", 6857 options: { 6858 active: 0, 6859 animate: {}, 6860 classes: { 6861 "ui-accordion-header": "ui-corner-top", 6862 "ui-accordion-header-collapsed": "ui-corner-all", 6863 "ui-accordion-content": "ui-corner-bottom" 6864 }, 6865 collapsible: false, 6866 event: "click", 6867 header: function( elem ) { 6868 return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); 6869 }, 6870 heightStyle: "auto", 6871 icons: { 6872 activeHeader: "ui-icon-triangle-1-s", 6873 header: "ui-icon-triangle-1-e" 6874 }, 6875 6876 // Callbacks 6877 activate: null, 6878 beforeActivate: null 6879 }, 6880 6881 hideProps: { 6882 borderTopWidth: "hide", 6883 borderBottomWidth: "hide", 6884 paddingTop: "hide", 6885 paddingBottom: "hide", 6886 height: "hide" 6887 }, 6888 6889 showProps: { 6890 borderTopWidth: "show", 6891 borderBottomWidth: "show", 6892 paddingTop: "show", 6893 paddingBottom: "show", 6894 height: "show" 6895 }, 6896 6897 _create: function() { 6898 var options = this.options; 6899 6900 this.prevShow = this.prevHide = $(); 6901 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 6902 this.element.attr( "role", "tablist" ); 6903 6904 // Don't allow collapsible: false and active: false / null 6905 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 6906 options.active = 0; 6907 } 6908 6909 this._processPanels(); 6910 6911 // handle negative values 6912 if ( options.active < 0 ) { 6913 options.active += this.headers.length; 6914 } 6915 this._refresh(); 6916 }, 6917 6918 _getCreateEventData: function() { 6919 return { 6920 header: this.active, 6921 panel: !this.active.length ? $() : this.active.next() 6922 }; 6923 }, 6924 6925 _createIcons: function() { 6926 var icon, children, 6927 icons = this.options.icons; 6928 6929 if ( icons ) { 6930 icon = $( "<span>" ); 6931 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 6932 icon.prependTo( this.headers ); 6933 children = this.active.children( ".ui-accordion-header-icon" ); 6934 this._removeClass( children, icons.header ) 6935 ._addClass( children, null, icons.activeHeader ) 6936 ._addClass( this.headers, "ui-accordion-icons" ); 6937 } 6938 }, 6939 6940 _destroyIcons: function() { 6941 this._removeClass( this.headers, "ui-accordion-icons" ); 6942 this.headers.children( ".ui-accordion-header-icon" ).remove(); 6943 }, 6944 6945 _destroy: function() { 6946 var contents; 6947 6948 // Clean up main element 6949 this.element.removeAttr( "role" ); 6950 6951 // Clean up headers 6952 this.headers 6953 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 6954 .removeUniqueId(); 6955 6956 this._destroyIcons(); 6957 6958 // Clean up content panels 6959 contents = this.headers.next() 6960 .css( "display", "" ) 6961 .removeAttr( "role aria-hidden aria-labelledby" ) 6962 .removeUniqueId(); 6963 6964 if ( this.options.heightStyle !== "content" ) { 6965 contents.css( "height", "" ); 6966 } 6967 }, 6968 6969 _setOption: function( key, value ) { 6970 if ( key === "active" ) { 6971 6972 // _activate() will handle invalid values and update this.options 6973 this._activate( value ); 6974 return; 6975 } 6976 6977 if ( key === "event" ) { 6978 if ( this.options.event ) { 6979 this._off( this.headers, this.options.event ); 6980 } 6981 this._setupEvents( value ); 6982 } 6983 6984 this._super( key, value ); 6985 6986 // Setting collapsible: false while collapsed; open first panel 6987 if ( key === "collapsible" && !value && this.options.active === false ) { 6988 this._activate( 0 ); 6989 } 6990 6991 if ( key === "icons" ) { 6992 this._destroyIcons(); 6993 if ( value ) { 6994 this._createIcons(); 6995 } 6996 } 6997 }, 6998 6999 _setOptionDisabled: function( value ) { 7000 this._super( value ); 7001 7002 this.element.attr( "aria-disabled", value ); 7003 7004 // Support: IE8 Only 7005 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 7006 // so we need to add the disabled class to the headers and panels 7007 this._toggleClass( null, "ui-state-disabled", !!value ); 7008 this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", 7009 !!value ); 7010 }, 7011 7012 _keydown: function( event ) { 7013 if ( event.altKey || event.ctrlKey ) { 7014 return; 7015 } 7016 7017 var keyCode = $.ui.keyCode, 7018 length = this.headers.length, 7019 currentIndex = this.headers.index( event.target ), 7020 toFocus = false; 7021 7022 switch ( event.keyCode ) { 7023 case keyCode.RIGHT: 7024 case keyCode.DOWN: 7025 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 7026 break; 7027 case keyCode.LEFT: 7028 case keyCode.UP: 7029 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 7030 break; 7031 case keyCode.SPACE: 7032 case keyCode.ENTER: 7033 this._eventHandler( event ); 7034 break; 7035 case keyCode.HOME: 7036 toFocus = this.headers[ 0 ]; 7037 break; 7038 case keyCode.END: 7039 toFocus = this.headers[ length - 1 ]; 7040 break; 7041 } 7042 7043 if ( toFocus ) { 7044 $( event.target ).attr( "tabIndex", -1 ); 7045 $( toFocus ).attr( "tabIndex", 0 ); 7046 $( toFocus ).trigger( "focus" ); 7047 event.preventDefault(); 7048 } 7049 }, 7050 7051 _panelKeyDown: function( event ) { 7052 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 7053 $( event.currentTarget ).prev().trigger( "focus" ); 7054 } 7055 }, 7056 7057 refresh: function() { 7058 var options = this.options; 7059 this._processPanels(); 7060 7061 // Was collapsed or no panel 7062 if ( ( options.active === false && options.collapsible === true ) || 7063 !this.headers.length ) { 7064 options.active = false; 7065 this.active = $(); 7066 7067 // active false only when collapsible is true 7068 } else if ( options.active === false ) { 7069 this._activate( 0 ); 7070 7071 // was active, but active panel is gone 7072 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 7073 7074 // all remaining panel are disabled 7075 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 7076 options.active = false; 7077 this.active = $(); 7078 7079 // activate previous panel 7080 } else { 7081 this._activate( Math.max( 0, options.active - 1 ) ); 7082 } 7083 7084 // was active, active panel still exists 7085 } else { 7086 7087 // make sure active index is correct 7088 options.active = this.headers.index( this.active ); 7089 } 7090 7091 this._destroyIcons(); 7092 7093 this._refresh(); 7094 }, 7095 7096 _processPanels: function() { 7097 var prevHeaders = this.headers, 7098 prevPanels = this.panels; 7099 7100 if ( typeof this.options.header === "function" ) { 7101 this.headers = this.options.header( this.element ); 7102 } else { 7103 this.headers = this.element.find( this.options.header ); 7104 } 7105 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 7106 "ui-state-default" ); 7107 7108 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 7109 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 7110 7111 // Avoid memory leaks (#10056) 7112 if ( prevPanels ) { 7113 this._off( prevHeaders.not( this.headers ) ); 7114 this._off( prevPanels.not( this.panels ) ); 7115 } 7116 }, 7117 7118 _refresh: function() { 7119 var maxHeight, 7120 options = this.options, 7121 heightStyle = options.heightStyle, 7122 parent = this.element.parent(); 7123 7124 this.active = this._findActive( options.active ); 7125 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 7126 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 7127 this._addClass( this.active.next(), "ui-accordion-content-active" ); 7128 this.active.next().show(); 7129 7130 this.headers 7131 .attr( "role", "tab" ) 7132 .each( function() { 7133 var header = $( this ), 7134 headerId = header.uniqueId().attr( "id" ), 7135 panel = header.next(), 7136 panelId = panel.uniqueId().attr( "id" ); 7137 header.attr( "aria-controls", panelId ); 7138 panel.attr( "aria-labelledby", headerId ); 7139 } ) 7140 .next() 7141 .attr( "role", "tabpanel" ); 7142 7143 this.headers 7144 .not( this.active ) 7145 .attr( { 7146 "aria-selected": "false", 7147 "aria-expanded": "false", 7148 tabIndex: -1 7149 } ) 7150 .next() 7151 .attr( { 7152 "aria-hidden": "true" 7153 } ) 7154 .hide(); 7155 7156 // Make sure at least one header is in the tab order 7157 if ( !this.active.length ) { 7158 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 7159 } else { 7160 this.active.attr( { 7161 "aria-selected": "true", 7162 "aria-expanded": "true", 7163 tabIndex: 0 7164 } ) 7165 .next() 7166 .attr( { 7167 "aria-hidden": "false" 7168 } ); 7169 } 7170 7171 this._createIcons(); 7172 7173 this._setupEvents( options.event ); 7174 7175 if ( heightStyle === "fill" ) { 7176 maxHeight = parent.height(); 7177 this.element.siblings( ":visible" ).each( function() { 7178 var elem = $( this ), 7179 position = elem.css( "position" ); 7180 7181 if ( position === "absolute" || position === "fixed" ) { 7182 return; 7183 } 7184 maxHeight -= elem.outerHeight( true ); 7185 } ); 7186 7187 this.headers.each( function() { 7188 maxHeight -= $( this ).outerHeight( true ); 7189 } ); 7190 7191 this.headers.next() 7192 .each( function() { 7193 $( this ).height( Math.max( 0, maxHeight - 7194 $( this ).innerHeight() + $( this ).height() ) ); 7195 } ) 7196 .css( "overflow", "auto" ); 7197 } else if ( heightStyle === "auto" ) { 7198 maxHeight = 0; 7199 this.headers.next() 7200 .each( function() { 7201 var isVisible = $( this ).is( ":visible" ); 7202 if ( !isVisible ) { 7203 $( this ).show(); 7204 } 7205 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 7206 if ( !isVisible ) { 7207 $( this ).hide(); 7208 } 7209 } ) 7210 .height( maxHeight ); 7211 } 7212 }, 7213 7214 _activate: function( index ) { 7215 var active = this._findActive( index )[ 0 ]; 7216 7217 // Trying to activate the already active panel 7218 if ( active === this.active[ 0 ] ) { 7219 return; 7220 } 7221 7222 // Trying to collapse, simulate a click on the currently active header 7223 active = active || this.active[ 0 ]; 7224 7225 this._eventHandler( { 7226 target: active, 7227 currentTarget: active, 7228 preventDefault: $.noop 7229 } ); 7230 }, 7231 7232 _findActive: function( selector ) { 7233 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 7234 }, 7235 7236 _setupEvents: function( event ) { 7237 var events = { 7238 keydown: "_keydown" 7239 }; 7240 if ( event ) { 7241 $.each( event.split( " " ), function( index, eventName ) { 7242 events[ eventName ] = "_eventHandler"; 7243 } ); 7244 } 7245 7246 this._off( this.headers.add( this.headers.next() ) ); 7247 this._on( this.headers, events ); 7248 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 7249 this._hoverable( this.headers ); 7250 this._focusable( this.headers ); 7251 }, 7252 7253 _eventHandler: function( event ) { 7254 var activeChildren, clickedChildren, 7255 options = this.options, 7256 active = this.active, 7257 clicked = $( event.currentTarget ), 7258 clickedIsActive = clicked[ 0 ] === active[ 0 ], 7259 collapsing = clickedIsActive && options.collapsible, 7260 toShow = collapsing ? $() : clicked.next(), 7261 toHide = active.next(), 7262 eventData = { 7263 oldHeader: active, 7264 oldPanel: toHide, 7265 newHeader: collapsing ? $() : clicked, 7266 newPanel: toShow 7267 }; 7268 7269 event.preventDefault(); 7270 7271 if ( 7272 7273 // click on active header, but not collapsible 7274 ( clickedIsActive && !options.collapsible ) || 7275 7276 // allow canceling activation 7277 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 7278 return; 7279 } 7280 7281 options.active = collapsing ? false : this.headers.index( clicked ); 7282 7283 // When the call to ._toggle() comes after the class changes 7284 // it causes a very odd bug in IE 8 (see #6720) 7285 this.active = clickedIsActive ? $() : clicked; 7286 this._toggle( eventData ); 7287 7288 // Switch classes 7289 // corner classes on the previously active header stay after the animation 7290 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 7291 if ( options.icons ) { 7292 activeChildren = active.children( ".ui-accordion-header-icon" ); 7293 this._removeClass( activeChildren, null, options.icons.activeHeader ) 7294 ._addClass( activeChildren, null, options.icons.header ); 7295 } 7296 7297 if ( !clickedIsActive ) { 7298 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 7299 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 7300 if ( options.icons ) { 7301 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 7302 this._removeClass( clickedChildren, null, options.icons.header ) 7303 ._addClass( clickedChildren, null, options.icons.activeHeader ); 7304 } 7305 7306 this._addClass( clicked.next(), "ui-accordion-content-active" ); 7307 } 7308 }, 7309 7310 _toggle: function( data ) { 7311 var toShow = data.newPanel, 7312 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 7313 7314 // Handle activating a panel during the animation for another activation 7315 this.prevShow.add( this.prevHide ).stop( true, true ); 7316 this.prevShow = toShow; 7317 this.prevHide = toHide; 7318 7319 if ( this.options.animate ) { 7320 this._animate( toShow, toHide, data ); 7321 } else { 7322 toHide.hide(); 7323 toShow.show(); 7324 this._toggleComplete( data ); 7325 } 7326 7327 toHide.attr( { 7328 "aria-hidden": "true" 7329 } ); 7330 toHide.prev().attr( { 7331 "aria-selected": "false", 7332 "aria-expanded": "false" 7333 } ); 7334 7335 // if we're switching panels, remove the old header from the tab order 7336 // if we're opening from collapsed state, remove the previous header from the tab order 7337 // if we're collapsing, then keep the collapsing header in the tab order 7338 if ( toShow.length && toHide.length ) { 7339 toHide.prev().attr( { 7340 "tabIndex": -1, 7341 "aria-expanded": "false" 7342 } ); 7343 } else if ( toShow.length ) { 7344 this.headers.filter( function() { 7345 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 7346 } ) 7347 .attr( "tabIndex", -1 ); 7348 } 7349 7350 toShow 7351 .attr( "aria-hidden", "false" ) 7352 .prev() 7353 .attr( { 7354 "aria-selected": "true", 7355 "aria-expanded": "true", 7356 tabIndex: 0 7357 } ); 7358 }, 7359 7360 _animate: function( toShow, toHide, data ) { 7361 var total, easing, duration, 7362 that = this, 7363 adjust = 0, 7364 boxSizing = toShow.css( "box-sizing" ), 7365 down = toShow.length && 7366 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 7367 animate = this.options.animate || {}, 7368 options = down && animate.down || animate, 7369 complete = function() { 7370 that._toggleComplete( data ); 7371 }; 7372 7373 if ( typeof options === "number" ) { 7374 duration = options; 7375 } 7376 if ( typeof options === "string" ) { 7377 easing = options; 7378 } 7379 7380 // fall back from options to animation in case of partial down settings 7381 easing = easing || options.easing || animate.easing; 7382 duration = duration || options.duration || animate.duration; 7383 7384 if ( !toHide.length ) { 7385 return toShow.animate( this.showProps, duration, easing, complete ); 7386 } 7387 if ( !toShow.length ) { 7388 return toHide.animate( this.hideProps, duration, easing, complete ); 7389 } 7390 7391 total = toShow.show().outerHeight(); 7392 toHide.animate( this.hideProps, { 7393 duration: duration, 7394 easing: easing, 7395 step: function( now, fx ) { 7396 fx.now = Math.round( now ); 7397 } 7398 } ); 7399 toShow 7400 .hide() 7401 .animate( this.showProps, { 7402 duration: duration, 7403 easing: easing, 7404 complete: complete, 7405 step: function( now, fx ) { 7406 fx.now = Math.round( now ); 7407 if ( fx.prop !== "height" ) { 7408 if ( boxSizing === "content-box" ) { 7409 adjust += fx.now; 7410 } 7411 } else if ( that.options.heightStyle !== "content" ) { 7412 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 7413 adjust = 0; 7414 } 7415 } 7416 } ); 7417 }, 7418 7419 _toggleComplete: function( data ) { 7420 var toHide = data.oldPanel, 7421 prev = toHide.prev(); 7422 7423 this._removeClass( toHide, "ui-accordion-content-active" ); 7424 this._removeClass( prev, "ui-accordion-header-active" ) 7425 ._addClass( prev, "ui-accordion-header-collapsed" ); 7426 7427 // Work around for rendering bug in IE (#5421) 7428 if ( toHide.length ) { 7429 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; 7430 } 7431 this._trigger( "activate", null, data ); 7432 } 7433} ); 7434 7435
7436/*! 7437 * jQuery UI Menu 1.13.0 7438 * http://jqueryui.com 7439 * 7440 * Copyright jQuery Foundation and other contributors 7441 * Released under the MIT license. 7442 * http://jquery.org/license 7443 */ 7444 7445//>>label: Menu 7446//>>group: Widgets 7447//>>description: Creates nestable menus. 7448//>>docs: http://api.jqueryui.com/menu/ 7449//>>demos: http://jqueryui.com/menu/ 7450//>>css.structure: ../../themes/base/core.css 7451//>>css.structure: ../../themes/base/menu.css 7452//>>css.theme: ../../themes/base/theme.css 7453 7454 7455var widgetsMenu = $.widget( "ui.menu", { 7456 version: "1.13.0
vendor: 5,724 bytes, lines 7456-7675
7456", 7457 defaultElement: "<ul>", 7458 delay: 300, 7459 options: { 7460 icons: { 7461 submenu: "ui-icon-caret-1-e" 7462 }, 7463 items: "> *", 7464 menus: "ul", 7465 position: { 7466 my: "left top", 7467 at: "right top" 7468 }, 7469 role: "menu", 7470 7471 // Callbacks 7472 blur: null, 7473 focus: null, 7474 select: null 7475 }, 7476 7477 _create: function() { 7478 this.activeMenu = this.element; 7479 7480 // Flag used to prevent firing of the click handler 7481 // as the event bubbles up through nested menus 7482 this.mouseHandled = false; 7483 this.lastMousePosition = { x: null, y: null }; 7484 this.element 7485 .uniqueId() 7486 .attr( { 7487 role: this.options.role, 7488 tabIndex: 0 7489 } ); 7490 7491 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 7492 this._on( { 7493 7494 // Prevent focus from sticking to links inside menu after clicking 7495 // them (focus should always stay on UL during navigation). 7496 "mousedown .ui-menu-item": function( event ) { 7497 event.preventDefault(); 7498 7499 this._activateItem( event ); 7500 }, 7501 "click .ui-menu-item": function( event ) { 7502 var target = $( event.target ); 7503 var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 7504 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 7505 this.select( event ); 7506 7507 // Only set the mouseHandled flag if the event will bubble, see #9469. 7508 if ( !event.isPropagationStopped() ) { 7509 this.mouseHandled = true; 7510 } 7511 7512 // Open submenu on click 7513 if ( target.has( ".ui-menu" ).length ) { 7514 this.expand( event ); 7515 } else if ( !this.element.is( ":focus" ) && 7516 active.closest( ".ui-menu" ).length ) { 7517 7518 // Redirect focus to the menu 7519 this.element.trigger( "focus", [ true ] ); 7520 7521 // If the active item is on the top level, let it stay active. 7522 // Otherwise, blur the active item since it is no longer visible. 7523 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 7524 clearTimeout( this.timer ); 7525 } 7526 } 7527 } 7528 }, 7529 "mouseenter .ui-menu-item": "_activateItem", 7530 "mousemove .ui-menu-item": "_activateItem", 7531 mouseleave: "collapseAll", 7532 "mouseleave .ui-menu": "collapseAll", 7533 focus: function( event, keepActiveItem ) { 7534 7535 // If there's already an active item, keep it active 7536 // If not, activate the first item 7537 var item = this.active || this._menuItems().first(); 7538 7539 if ( !keepActiveItem ) { 7540 this.focus( event, item ); 7541 } 7542 }, 7543 blur: function( event ) { 7544 this._delay( function() { 7545 var notContained = !$.contains( 7546 this.element[ 0 ], 7547 $.ui.safeActiveElement( this.document[ 0 ] ) 7548 ); 7549 if ( notContained ) { 7550 this.collapseAll( event ); 7551 } 7552 } ); 7553 }, 7554 keydown: "_keydown" 7555 } ); 7556 7557 this.refresh(); 7558 7559 // Clicks outside of a menu collapse any open menus 7560 this._on( this.document, { 7561 click: function( event ) { 7562 if ( this._closeOnDocumentClick( event ) ) { 7563 this.collapseAll( event, true ); 7564 } 7565 7566 // Reset the mouseHandled flag 7567 this.mouseHandled = false; 7568 } 7569 } ); 7570 }, 7571 7572 _activateItem: function( event ) { 7573 7574 // Ignore mouse events while typeahead is active, see #10458. 7575 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 7576 // is over an item in the menu 7577 if ( this.previousFilter ) { 7578 return; 7579 } 7580 7581 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 7582 if ( event.clientX === this.lastMousePosition.x && 7583 event.clientY === this.lastMousePosition.y ) { 7584 return; 7585 } 7586 7587 this.lastMousePosition = { 7588 x: event.clientX, 7589 y: event.clientY 7590 }; 7591 7592 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 7593 target = $( event.currentTarget ); 7594 7595 // Ignore bubbled events on parent items, see #11641 7596 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 7597 return; 7598 } 7599 7600 // If the item is already active, there's nothing to do 7601 if ( target.is( ".ui-state-active" ) ) { 7602 return; 7603 } 7604 7605 // Remove ui-state-active class from siblings of the newly focused menu item 7606 // to avoid a jump caused by adjacent elements both having a class with a border 7607 this._removeClass( target.siblings().children( ".ui-state-active" ), 7608 null, "ui-state-active" ); 7609 this.focus( event, target ); 7610 }, 7611 7612 _destroy: function() { 7613 var items = this.element.find( ".ui-menu-item" ) 7614 .removeAttr( "role aria-disabled" ), 7615 submenus = items.children( ".ui-menu-item-wrapper" ) 7616 .removeUniqueId() 7617 .removeAttr( "tabIndex role aria-haspopup" ); 7618 7619 // Destroy (sub)menus 7620 this.element 7621 .removeAttr( "aria-activedescendant" ) 7622 .find( ".ui-menu" ).addBack() 7623 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 7624 "tabIndex" ) 7625 .removeUniqueId() 7626 .show(); 7627 7628 submenus.children().each( function() { 7629 var elem = $( this ); 7630 if ( elem.data( "ui-menu-submenu-caret" ) ) { 7631 elem.remove(); 7632 } 7633 } ); 7634 }, 7635 7636 _keydown: function( event ) { 7637 var match, prev, character, skip, 7638 preventDefault = true; 7639 7640 switch ( event.keyCode ) { 7641 case $.ui.keyCode.PAGE_UP: 7642 this.previousPage( event ); 7643 break; 7644 case $.ui.keyCode.PAGE_DOWN: 7645 this.nextPage( event ); 7646 break; 7647 case $.ui.keyCode.HOME: 7648 this._move( "first", "first", event ); 7649 break; 7650 case $.ui.keyCode.END: 7651 this._move( "last", "last", event ); 7652 break; 7653 case $.ui.keyCode.UP: 7654 this.previous( event ); 7655 break; 7656 case $.ui.keyCode.DOWN: 7657 this.next( event ); 7658 break; 7659 case $.ui.keyCode.LEFT: 7660 this.collapse( event ); 7661 break; 7662 case $.ui.keyCode.RIGHT: 7663 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 7664 this.expand( event ); 7665 } 7666 break; 7667 case $.ui.keyCode.ENTER: 7668 case $.ui.keyCode.SPACE: 7669 this._activate( event ); 7670 break; 7671 case $.ui.keyCode.ESCAPE: 7672 this.collapse( event ); 7673 break; 7674 default: 7675 preventDefault = false;
vendor: 6,930 bytes, lines 7676-7924
7676 prev = this.previousFilter || ""; 7677 skip = false; 7678 7679 // Support number pad values 7680 character = event.keyCode >= 96 && event.keyCode <= 105 ? 7681 ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode ); 7682 7683 clearTimeout( this.filterTimer ); 7684 7685 if ( character === prev ) { 7686 skip = true; 7687 } else { 7688 character = prev + character; 7689 } 7690 7691 match = this._filterMenuItems( character ); 7692 match = skip && match.index( this.active.next() ) !== -1 ? 7693 this.active.nextAll( ".ui-menu-item" ) : 7694 match; 7695 7696 // If no matches on the current filter, reset to the last character pressed 7697 // to move down the menu to the first item that starts with that character 7698 if ( !match.length ) { 7699 character = String.fromCharCode( event.keyCode ); 7700 match = this._filterMenuItems( character ); 7701 } 7702 7703 if ( match.length ) { 7704 this.focus( event, match ); 7705 this.previousFilter = character; 7706 this.filterTimer = this._delay( function() { 7707 delete this.previousFilter; 7708 }, 1000 ); 7709 } else { 7710 delete this.previousFilter; 7711 } 7712 } 7713 7714 if ( preventDefault ) { 7715 event.preventDefault(); 7716 } 7717 }, 7718 7719 _activate: function( event ) { 7720 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 7721 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 7722 this.expand( event ); 7723 } else { 7724 this.select( event ); 7725 } 7726 } 7727 }, 7728 7729 refresh: function() { 7730 var menus, items, newSubmenus, newItems, newWrappers, 7731 that = this, 7732 icon = this.options.icons.submenu, 7733 submenus = this.element.find( this.options.menus ); 7734 7735 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 7736 7737 // Initialize nested menus 7738 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 7739 .hide() 7740 .attr( { 7741 role: this.options.role, 7742 "aria-hidden": "true", 7743 "aria-expanded": "false" 7744 } ) 7745 .each( function() { 7746 var menu = $( this ), 7747 item = menu.prev(), 7748 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 7749 7750 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 7751 item 7752 .attr( "aria-haspopup", "true" ) 7753 .prepend( submenuCaret ); 7754 menu.attr( "aria-labelledby", item.attr( "id" ) ); 7755 } ); 7756 7757 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 7758 7759 menus = submenus.add( this.element ); 7760 items = menus.find( this.options.items ); 7761 7762 // Initialize menu-items containing spaces and/or dashes only as dividers 7763 items.not( ".ui-menu-item" ).each( function() { 7764 var item = $( this ); 7765 if ( that._isDivider( item ) ) { 7766 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 7767 } 7768 } ); 7769 7770 // Don't refresh list items that are already adapted 7771 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 7772 newWrappers = newItems.children() 7773 .not( ".ui-menu" ) 7774 .uniqueId() 7775 .attr( { 7776 tabIndex: -1, 7777 role: this._itemRole() 7778 } ); 7779 this._addClass( newItems, "ui-menu-item" ) 7780 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 7781 7782 // Add aria-disabled attribute to any disabled menu item 7783 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 7784 7785 // If the active item has been removed, blur the menu 7786 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 7787 this.blur(); 7788 } 7789 }, 7790 7791 _itemRole: function() { 7792 return { 7793 menu: "menuitem", 7794 listbox: "option" 7795 }[ this.options.role ]; 7796 }, 7797 7798 _setOption: function( key, value ) { 7799 if ( key === "icons" ) { 7800 var icons = this.element.find( ".ui-menu-icon" ); 7801 this._removeClass( icons, null, this.options.icons.submenu ) 7802 ._addClass( icons, null, value.submenu ); 7803 } 7804 this._super( key, value ); 7805 }, 7806 7807 _setOptionDisabled: function( value ) { 7808 this._super( value ); 7809 7810 this.element.attr( "aria-disabled", String( value ) ); 7811 this._toggleClass( null, "ui-state-disabled", !!value ); 7812 }, 7813 7814 focus: function( event, item ) { 7815 var nested, focused, activeParent; 7816 this.blur( event, event && event.type === "focus" ); 7817 7818 this._scrollIntoView( item ); 7819 7820 this.active = item.first(); 7821 7822 focused = this.active.children( ".ui-menu-item-wrapper" ); 7823 this._addClass( focused, null, "ui-state-active" ); 7824 7825 // Only update aria-activedescendant if there's a role 7826 // otherwise we assume focus is managed elsewhere 7827 if ( this.options.role ) { 7828 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 7829 } 7830 7831 // Highlight active parent menu item, if any 7832 activeParent = this.active 7833 .parent() 7834 .closest( ".ui-menu-item" ) 7835 .children( ".ui-menu-item-wrapper" ); 7836 this._addClass( activeParent, null, "ui-state-active" ); 7837 7838 if ( event && event.type === "keydown" ) { 7839 this._close(); 7840 } else { 7841 this.timer = this._delay( function() { 7842 this._close(); 7843 }, this.delay ); 7844 } 7845 7846 nested = item.children( ".ui-menu" ); 7847 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 7848 this._startOpening( nested ); 7849 } 7850 this.activeMenu = item.parent(); 7851 7852 this._trigger( "focus", event, { item: item } ); 7853 }, 7854 7855 _scrollIntoView: function( item ) { 7856 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 7857 if ( this._hasScroll() ) { 7858 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 7859 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 7860 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 7861 scroll = this.activeMenu.scrollTop(); 7862 elementHeight = this.activeMenu.height(); 7863 itemHeight = item.outerHeight(); 7864 7865 if ( offset < 0 ) { 7866 this.activeMenu.scrollTop( scroll + offset ); 7867 } else if ( offset + itemHeight > elementHeight ) { 7868 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 7869 } 7870 } 7871 }, 7872 7873 blur: function( event, fromFocus ) { 7874 if ( !fromFocus ) { 7875 clearTimeout( this.timer ); 7876 } 7877 7878 if ( !this.active ) { 7879 return; 7880 } 7881 7882 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 7883 null, "ui-state-active" ); 7884 7885 this._trigger( "blur", event, { item: this.active } ); 7886 this.active = null; 7887 }, 7888 7889 _startOpening: function( submenu ) { 7890 clearTimeout( this.timer ); 7891 7892 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 7893 // shift in the submenu position when mousing over the caret icon 7894 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 7895 return; 7896 } 7897 7898 this.timer = this._delay( function() { 7899 this._close(); 7900 this._open( submenu ); 7901 }, this.delay ); 7902 }, 7903 7904 _open: function( submenu ) { 7905 var position = $.extend( { 7906 of: this.active 7907 }, this.options.position ); 7908 7909 clearTimeout( this.timer ); 7910 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 7911 .hide() 7912 .attr( "aria-hidden", "true" ); 7913 7914 submenu 7915 .show() 7916 .removeAttr( "aria-hidden" ) 7917 .attr( "aria-expanded", "true" ) 7918 .position( position ); 7919 }, 7920 7921 collapseAll: function( event, all ) { 7922 clearTimeout( this.timer ); 7923 this.timer = this._delay( function() { 7924
vendor: 5,434 bytes, lines 7925-8128
7925 // If we were passed an event, look for the submenu that contains the event 7926 var currentMenu = all ? this.element : 7927 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 7928 7929 // If we found no valid submenu ancestor, use the main menu to close all 7930 // sub menus anyway 7931 if ( !currentMenu.length ) { 7932 currentMenu = this.element; 7933 } 7934 7935 this._close( currentMenu ); 7936 7937 this.blur( event ); 7938 7939 // Work around active item staying active after menu is blurred 7940 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 7941 7942 this.activeMenu = currentMenu; 7943 }, all ? 0 : this.delay ); 7944 }, 7945 7946 // With no arguments, closes the currently active menu - if nothing is active 7947 // it closes all menus. If passed an argument, it will search for menus BELOW 7948 _close: function( startMenu ) { 7949 if ( !startMenu ) { 7950 startMenu = this.active ? this.active.parent() : this.element; 7951 } 7952 7953 startMenu.find( ".ui-menu" ) 7954 .hide() 7955 .attr( "aria-hidden", "true" ) 7956 .attr( "aria-expanded", "false" ); 7957 }, 7958 7959 _closeOnDocumentClick: function( event ) { 7960 return !$( event.target ).closest( ".ui-menu" ).length; 7961 }, 7962 7963 _isDivider: function( item ) { 7964 7965 // Match hyphen, em dash, en dash 7966 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 7967 }, 7968 7969 collapse: function( event ) { 7970 var newItem = this.active && 7971 this.active.parent().closest( ".ui-menu-item", this.element ); 7972 if ( newItem && newItem.length ) { 7973 this._close(); 7974 this.focus( event, newItem ); 7975 } 7976 }, 7977 7978 expand: function( event ) { 7979 var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first(); 7980 7981 if ( newItem && newItem.length ) { 7982 this._open( newItem.parent() ); 7983 7984 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 7985 this._delay( function() { 7986 this.focus( event, newItem ); 7987 } ); 7988 } 7989 }, 7990 7991 next: function( event ) { 7992 this._move( "next", "first", event ); 7993 }, 7994 7995 previous: function( event ) { 7996 this._move( "prev", "last", event ); 7997 }, 7998 7999 isFirstItem: function() { 8000 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 8001 }, 8002 8003 isLastItem: function() { 8004 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 8005 }, 8006 8007 _menuItems: function( menu ) { 8008 return ( menu || this.element ) 8009 .find( this.options.items ) 8010 .filter( ".ui-menu-item" ); 8011 }, 8012 8013 _move: function( direction, filter, event ) { 8014 var next; 8015 if ( this.active ) { 8016 if ( direction === "first" || direction === "last" ) { 8017 next = this.active 8018 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 8019 .last(); 8020 } else { 8021 next = this.active 8022 [ direction + "All" ]( ".ui-menu-item" ) 8023 .first(); 8024 } 8025 } 8026 if ( !next || !next.length || !this.active ) { 8027 next = this._menuItems( this.activeMenu )[ filter ](); 8028 } 8029 8030 this.focus( event, next ); 8031 }, 8032 8033 nextPage: function( event ) { 8034 var item, base, height; 8035 8036 if ( !this.active ) { 8037 this.next( event ); 8038 return; 8039 } 8040 if ( this.isLastItem() ) { 8041 return; 8042 } 8043 if ( this._hasScroll() ) { 8044 base = this.active.offset().top; 8045 height = this.element.innerHeight(); 8046 8047 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 8048 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 8049 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 8050 } 8051 8052 this.active.nextAll( ".ui-menu-item" ).each( function() { 8053 item = $( this ); 8054 return item.offset().top - base - height < 0; 8055 } ); 8056 8057 this.focus( event, item ); 8058 } else { 8059 this.focus( event, this._menuItems( this.activeMenu ) 8060 [ !this.active ? "first" : "last" ]() ); 8061 } 8062 }, 8063 8064 previousPage: function( event ) { 8065 var item, base, height; 8066 if ( !this.active ) { 8067 this.next( event ); 8068 return; 8069 } 8070 if ( this.isFirstItem() ) { 8071 return; 8072 } 8073 if ( this._hasScroll() ) { 8074 base = this.active.offset().top; 8075 height = this.element.innerHeight(); 8076 8077 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 8078 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 8079 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 8080 } 8081 8082 this.active.prevAll( ".ui-menu-item" ).each( function() { 8083 item = $( this ); 8084 return item.offset().top - base + height > 0; 8085 } ); 8086 8087 this.focus( event, item ); 8088 } else { 8089 this.focus( event, this._menuItems( this.activeMenu ).first() ); 8090 } 8091 }, 8092 8093 _hasScroll: function() { 8094 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 8095 }, 8096 8097 select: function( event ) { 8098 8099 // TODO: It should never be possible to not have an active item at this 8100 // point, but the tests don't trigger mouseenter before click. 8101 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 8102 var ui = { item: this.active }; 8103 if ( !this.active.has( ".ui-menu" ).length ) { 8104 this.collapseAll( event, true ); 8105 } 8106 this._trigger( "select", event, ui ); 8107 }, 8108 8109 _filterMenuItems: function( character ) { 8110 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 8111 regex = new RegExp( "^" + escapedCharacter, "i" ); 8112 8113 return this.activeMenu 8114 .find( this.options.items ) 8115 8116 // Only match on items, not dividers or other content (#10571) 8117 .filter( ".ui-menu-item" ) 8118 .filter( function() { 8119 return regex.test( 8120 String.prototype.trim.call( 8121 $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 8122 } ); 8123 } 8124} ); 8125 8126 8127/*! 8128 * jQuery UI Autocomplete 1.13.
81280 8129 * http://jqueryui.com 8130 * 8131 * Copyright jQuery Foundation and other contributors 8132 * Released under the MIT license. 8133 * http://jquery.org/license 8134 */ 8135 8136//>>label: Autocomplete 8137//>>group: Widgets 8138//>>description: Lists suggested words as the user is typing. 8139//>>docs: http://api.jqueryui.com/autocomplete/ 8140//>>demos: http://jqueryui.com/autocomplete/ 8141//>>css.structure: ../../themes/base/core.css 8142//>>css.structure: ../../themes/base/autocomplete.css 8143//>>css.theme: ../../themes/base/theme.css 8144 8145 8146$.widget( "ui.autocomplete", { 8147 version: "1.13.0", 8148 defaultElement: "<input>", 8149 options: { 8150 appendTo: null, 8151 autoFocus: false, 8152 delay: 300, 8153 minLength: 1, 8154 position: { 8155 my: "left top", 8156 at: "left bottom", 8157 collision: "none" 8158 }, 8159 source: null, 8160 8161 // Callbacks 8162 change: null, 8163 close: null, 8164 focus: null, 8165 open: null, 8166 response: null, 8167 search: null, 8168 select: null 8169 }, 8170 8171 requestIndex: 0, 8172 pending: 0
vendor: 5,947 bytes, lines 8172-8374
8172, 8173 8174 _create: function() { 8175 8176 // Some browsers only repeat keydown events, not keypress events, 8177 // so we use the suppressKeyPress flag to determine if we've already 8178 // handled the keydown event. #7269 8179 // Unfortunately the code for & in keypress is the same as the up arrow, 8180 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 8181 // events when we know the keydown event was used to modify the 8182 // search term. #7799 8183 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 8184 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 8185 isTextarea = nodeName === "textarea", 8186 isInput = nodeName === "input"; 8187 8188 // Textareas are always multi-line 8189 // Inputs are always single-line, even if inside a contentEditable element 8190 // IE also treats inputs as contentEditable 8191 // All other element types are determined by whether or not they're contentEditable 8192 this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); 8193 8194 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 8195 this.isNewMenu = true; 8196 8197 this._addClass( "ui-autocomplete-input" ); 8198 this.element.attr( "autocomplete", "off" ); 8199 8200 this._on( this.element, { 8201 keydown: function( event ) { 8202 if ( this.element.prop( "readOnly" ) ) { 8203 suppressKeyPress = true; 8204 suppressInput = true; 8205 suppressKeyPressRepeat = true; 8206 return; 8207 } 8208 8209 suppressKeyPress = false; 8210 suppressInput = false; 8211 suppressKeyPressRepeat = false; 8212 var keyCode = $.ui.keyCode; 8213 switch ( event.keyCode ) { 8214 case keyCode.PAGE_UP: 8215 suppressKeyPress = true; 8216 this._move( "previousPage", event ); 8217 break; 8218 case keyCode.PAGE_DOWN: 8219 suppressKeyPress = true; 8220 this._move( "nextPage", event ); 8221 break; 8222 case keyCode.UP: 8223 suppressKeyPress = true; 8224 this._keyEvent( "previous", event ); 8225 break; 8226 case keyCode.DOWN: 8227 suppressKeyPress = true; 8228 this._keyEvent( "next", event ); 8229 break; 8230 case keyCode.ENTER: 8231 8232 // when menu is open and has focus 8233 if ( this.menu.active ) { 8234 8235 // #6055 - Opera still allows the keypress to occur 8236 // which causes forms to submit 8237 suppressKeyPress = true; 8238 event.preventDefault(); 8239 this.menu.select( event ); 8240 } 8241 break; 8242 case keyCode.TAB: 8243 if ( this.menu.active ) { 8244 this.menu.select( event ); 8245 } 8246 break; 8247 case keyCode.ESCAPE: 8248 if ( this.menu.element.is( ":visible" ) ) { 8249 if ( !this.isMultiLine ) { 8250 this._value( this.term ); 8251 } 8252 this.close( event ); 8253 8254 // Different browsers have different default behavior for escape 8255 // Single press can mean undo or clear 8256 // Double press in IE means clear the whole form 8257 event.preventDefault(); 8258 } 8259 break; 8260 default: 8261 suppressKeyPressRepeat = true; 8262 8263 // search timeout should be triggered before the input value is changed 8264 this._searchTimeout( event ); 8265 break; 8266 } 8267 }, 8268 keypress: function( event ) { 8269 if ( suppressKeyPress ) { 8270 suppressKeyPress = false; 8271 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 8272 event.preventDefault(); 8273 } 8274 return; 8275 } 8276 if ( suppressKeyPressRepeat ) { 8277 return; 8278 } 8279 8280 // Replicate some key handlers to allow them to repeat in Firefox and Opera 8281 var keyCode = $.ui.keyCode; 8282 switch ( event.keyCode ) { 8283 case keyCode.PAGE_UP: 8284 this._move( "previousPage", event ); 8285 break; 8286 case keyCode.PAGE_DOWN: 8287 this._move( "nextPage", event ); 8288 break; 8289 case keyCode.UP: 8290 this._keyEvent( "previous", event ); 8291 break; 8292 case keyCode.DOWN: 8293 this._keyEvent( "next", event ); 8294 break; 8295 } 8296 }, 8297 input: function( event ) { 8298 if ( suppressInput ) { 8299 suppressInput = false; 8300 event.preventDefault(); 8301 return; 8302 } 8303 this._searchTimeout( event ); 8304 }, 8305 focus: function() { 8306 this.selectedItem = null; 8307 this.previous = this._value(); 8308 }, 8309 blur: function( event ) { 8310 clearTimeout( this.searching ); 8311 this.close( event ); 8312 this._change( event ); 8313 } 8314 } ); 8315 8316 this._initSource(); 8317 this.menu = $( "<ul>" ) 8318 .appendTo( this._appendTo() ) 8319 .menu( { 8320 8321 // disable ARIA support, the live region takes care of that 8322 role: null 8323 } ) 8324 .hide() 8325 8326 // Support: IE 11 only, Edge <= 14 8327 // For other browsers, we preventDefault() on the mousedown event 8328 // to keep the dropdown from taking focus from the input. This doesn't 8329 // work for IE/Edge, causing problems with selection and scrolling (#9638) 8330 // Happily, IE and Edge support an "unselectable" attribute that 8331 // prevents an element from receiving focus, exactly what we want here. 8332 .attr( { 8333 "unselectable": "on" 8334 } ) 8335 .menu( "instance" ); 8336 8337 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 8338 this._on( this.menu.element, { 8339 mousedown: function( event ) { 8340 8341 // Prevent moving focus out of the text field 8342 event.preventDefault(); 8343 }, 8344 menufocus: function( event, ui ) { 8345 var label, item; 8346 8347 // support: Firefox 8348 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 8349 if ( this.isNewMenu ) { 8350 this.isNewMenu = false; 8351 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 8352 this.menu.blur(); 8353 8354 this.document.one( "mousemove", function() { 8355 $( event.target ).trigger( event.originalEvent ); 8356 } ); 8357 8358 return; 8359 } 8360 } 8361 8362 item = ui.item.data( "ui-autocomplete-item" ); 8363 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 8364 8365 // use value to match what will end up in the input, if it was a key event 8366 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 8367 this._value( item.value ); 8368 } 8369 } 8370 8371 // Announce the value in the liveRegion 8372 label = ui.item.attr( "aria-label" ) || item.value; 8373 if ( label && String.prototype.trim.call( label ).length ) { 8374
8374this.liveRegion.children().hide(); 8375 $( "<div>" ).text( label ).appendTo( this.liveRegion
vendor: 9,873 bytes, lines 8375-8770
8375 ); 8376 } 8377 }, 8378 menuselect: function( event, ui ) { 8379 var item = ui.item.data( "ui-autocomplete-item" ), 8380 previous = this.previous; 8381 8382 // Only trigger when focus was lost (click on menu) 8383 if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { 8384 this.element.trigger( "focus" ); 8385 this.previous = previous; 8386 8387 // #6109 - IE triggers two focus events and the second 8388 // is asynchronous, so we need to reset the previous 8389 // term synchronously and asynchronously :-( 8390 this._delay( function() { 8391 this.previous = previous; 8392 this.selectedItem = item; 8393 } ); 8394 } 8395 8396 if ( false !== this._trigger( "select", event, { item: item } ) ) { 8397 this._value( item.value ); 8398 } 8399 8400 // reset the term after the select event 8401 // this allows custom select handling to work properly 8402 this.term = this._value(); 8403 8404 this.close( event ); 8405 this.selectedItem = item; 8406 } 8407 } ); 8408 8409 this.liveRegion = $( "<div>", { 8410 role: "status", 8411 "aria-live": "assertive", 8412 "aria-relevant": "additions" 8413 } ) 8414 .appendTo( this.document[ 0 ].body ); 8415 8416 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 8417 8418 // Turning off autocomplete prevents the browser from remembering the 8419 // value when navigating through history, so we re-enable autocomplete 8420 // if the page is unloaded before the widget is destroyed. #7790 8421 this._on( this.window, { 8422 beforeunload: function() { 8423 this.element.removeAttr( "autocomplete" ); 8424 } 8425 } ); 8426 }, 8427 8428 _destroy: function() { 8429 clearTimeout( this.searching ); 8430 this.element.removeAttr( "autocomplete" ); 8431 this.menu.element.remove(); 8432 this.liveRegion.remove(); 8433 }, 8434 8435 _setOption: function( key, value ) { 8436 this._super( key, value ); 8437 if ( key === "source" ) { 8438 this._initSource(); 8439 } 8440 if ( key === "appendTo" ) { 8441 this.menu.element.appendTo( this._appendTo() ); 8442 } 8443 if ( key === "disabled" && value && this.xhr ) { 8444 this.xhr.abort(); 8445 } 8446 }, 8447 8448 _isEventTargetInWidget: function( event ) { 8449 var menuElement = this.menu.element[ 0 ]; 8450 8451 return event.target === this.element[ 0 ] || 8452 event.target === menuElement || 8453 $.contains( menuElement, event.target ); 8454 }, 8455 8456 _closeOnClickOutside: function( event ) { 8457 if ( !this._isEventTargetInWidget( event ) ) { 8458 this.close(); 8459 } 8460 }, 8461 8462 _appendTo: function() { 8463 var element = this.options.appendTo; 8464 8465 if ( element ) { 8466 element = element.jquery || element.nodeType ? 8467 $( element ) : 8468 this.document.find( element ).eq( 0 ); 8469 } 8470 8471 if ( !element || !element[ 0 ] ) { 8472 element = this.element.closest( ".ui-front, dialog" ); 8473 } 8474 8475 if ( !element.length ) { 8476 element = this.document[ 0 ].body; 8477 } 8478 8479 return element; 8480 }, 8481 8482 _initSource: function() { 8483 var array, url, 8484 that = this; 8485 if ( Array.isArray( this.options.source ) ) { 8486 array = this.options.source; 8487 this.source = function( request, response ) { 8488 response( $.ui.autocomplete.filter( array, request.term ) ); 8489 }; 8490 } else if ( typeof this.options.source === "string" ) { 8491 url = this.options.source; 8492 this.source = function( request, response ) { 8493 if ( that.xhr ) { 8494 that.xhr.abort(); 8495 } 8496 that.xhr = $.ajax( { 8497 url: url, 8498 data: request, 8499 dataType: "json", 8500 success: function( data ) { 8501 response( data ); 8502 }, 8503 error: function() { 8504 response( [] ); 8505 } 8506 } ); 8507 }; 8508 } else { 8509 this.source = this.options.source; 8510 } 8511 }, 8512 8513 _searchTimeout: function( event ) { 8514 clearTimeout( this.searching ); 8515 this.searching = this._delay( function() { 8516 8517 // Search if the value has changed, or if the user retypes the same value (see #7434) 8518 var equalValues = this.term === this._value(), 8519 menuVisible = this.menu.element.is( ":visible" ), 8520 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 8521 8522 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 8523 this.selectedItem = null; 8524 this.search( null, event ); 8525 } 8526 }, this.options.delay ); 8527 }, 8528 8529 search: function( value, event ) { 8530 value = value != null ? value : this._value(); 8531 8532 // Always save the actual value, not the one passed as an argument 8533 this.term = this._value(); 8534 8535 if ( value.length < this.options.minLength ) { 8536 return this.close( event ); 8537 } 8538 8539 if ( this._trigger( "search", event ) === false ) { 8540 return; 8541 } 8542 8543 return this._search( value ); 8544 }, 8545 8546 _search: function( value ) { 8547 this.pending++; 8548 this._addClass( "ui-autocomplete-loading" ); 8549 this.cancelSearch = false; 8550 8551 this.source( { term: value }, this._response() ); 8552 }, 8553 8554 _response: function() { 8555 var index = ++this.requestIndex; 8556 8557 return function( content ) { 8558 if ( index === this.requestIndex ) { 8559 this.__response( content ); 8560 } 8561 8562 this.pending--; 8563 if ( !this.pending ) { 8564 this._removeClass( "ui-autocomplete-loading" ); 8565 } 8566 }.bind( this ); 8567 }, 8568 8569 __response: function( content ) { 8570 if ( content ) { 8571 content = this._normalize( content ); 8572 } 8573 this._trigger( "response", null, { content: content } ); 8574 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 8575 this._suggest( content ); 8576 this._trigger( "open" ); 8577 } else { 8578 8579 // use ._close() instead of .close() so we don't cancel future searches 8580 this._close(); 8581 } 8582 }, 8583 8584 close: function( event ) { 8585 this.cancelSearch = true; 8586 this._close( event ); 8587 }, 8588 8589 _close: function( event ) { 8590 8591 // Remove the handler that closes the menu on outside clicks 8592 this._off( this.document, "mousedown" ); 8593 8594 if ( this.menu.element.is( ":visible" ) ) { 8595 this.menu.element.hide(); 8596 this.menu.blur(); 8597 this.isNewMenu = true; 8598 this._trigger( "close", event ); 8599 } 8600 }, 8601 8602 _change: function( event ) { 8603 if ( this.previous !== this._value() ) { 8604 this._trigger( "change", event, { item: this.selectedItem } ); 8605 } 8606 }, 8607 8608 _normalize: function( items ) { 8609 8610 // assume all items have the right format when the first item is complete 8611 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 8612 return items; 8613 } 8614 return $.map( items, function( item ) { 8615 if ( typeof item === "string" ) { 8616 return { 8617 label: item, 8618 value: item 8619 }; 8620 } 8621 return $.extend( {}, item, { 8622 label: item.label || item.value, 8623 value: item.value || item.label 8624 } ); 8625 } ); 8626 }, 8627 8628 _suggest: function( items ) { 8629 var ul = this.menu.element.empty(); 8630 this._renderMenu( ul, items ); 8631 this.isNewMenu = true; 8632 this.menu.refresh(); 8633 8634 // Size and position menu 8635 ul.show(); 8636 this._resizeMenu(); 8637 ul.position( $.extend( { 8638 of: this.element 8639 }, this.options.position ) ); 8640 8641 if ( this.options.autoFocus ) { 8642 this.menu.next(); 8643 } 8644 8645 // Listen for interactions outside of the widget (#6642) 8646 this._on( this.document, { 8647 mousedown: "_closeOnClickOutside" 8648 } ); 8649 }, 8650 8651 _resizeMenu: function() { 8652 var ul = this.menu.element; 8653 ul.outerWidth( Math.max( 8654 8655 // Firefox wraps long text (possibly a rounding bug) 8656 // so we add 1px to avoid the wrapping (#7513) 8657 ul.width( "" ).outerWidth() + 1, 8658 this.element.outerWidth() 8659 ) ); 8660 }, 8661 8662 _renderMenu: function( ul, items ) { 8663 var that = this; 8664 $.each( items, function( index, item ) { 8665 that._renderItemData( ul, item ); 8666 } ); 8667 }, 8668 8669 _renderItemData: function( ul, item ) { 8670 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 8671 }, 8672 8673 _renderItem: function( ul, item ) { 8674 return $( "<li>" ) 8675 .append( $( "<div>" ).text( item.label ) ) 8676 .appendTo( ul ); 8677 }, 8678 8679 _move: function( direction, event ) { 8680 if ( !this.menu.element.is( ":visible" ) ) { 8681 this.search( null, event ); 8682 return; 8683 } 8684 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 8685 this.menu.isLastItem() && /^next/.test( direction ) ) { 8686 8687 if ( !this.isMultiLine ) { 8688 this._value( this.term ); 8689 } 8690 8691 this.menu.blur(); 8692 return; 8693 } 8694 this.menu[ direction ]( event ); 8695 }, 8696 8697 widget: function() { 8698 return this.menu.element; 8699 }, 8700 8701 _value: function() { 8702 return this.valueMethod.apply( this.element, arguments ); 8703 }, 8704 8705 _keyEvent: function( keyEvent, event ) { 8706 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 8707 this._move( keyEvent, event ); 8708 8709 // Prevents moving cursor to beginning/end of the text field in some browsers 8710 event.preventDefault(); 8711 } 8712 }, 8713 8714 // Support: Chrome <=50 8715 // We should be able to just use this.element.prop( "isContentEditable" ) 8716 // but hidden elements always report false in Chrome. 8717 // https://code.google.com/p/chromium/issues/detail?id=313082 8718 _isContentEditable: function( element ) { 8719 if ( !element.length ) { 8720 return false; 8721 } 8722 8723 var editable = element.prop( "contentEditable" ); 8724 8725 if ( editable === "inherit" ) { 8726 return this._isContentEditable( element.parent() ); 8727 } 8728 8729 return editable === "true"; 8730 } 8731} ); 8732 8733$.extend( $.ui.autocomplete, { 8734 escapeRegex: function( value ) { 8735 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 8736 }, 8737 filter: function( array, term ) { 8738 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 8739 return $.grep( array, function( value ) { 8740 return matcher.test( value.label || value.value || value ); 8741 } ); 8742 } 8743} ); 8744 8745// Live region extension, adding a `messages` option 8746// NOTE: This is an experimental API. We are still investigating 8747// a full solution for string manipulation and internationalization. 8748$.widget( "ui.autocomplete", $.ui.autocomplete, { 8749 options: { 8750 messages: { 8751 noResults: "No search results.", 8752 results: function( amount ) { 8753 return amount + ( amount > 1 ? " results are" : " result is" ) + 8754 " available, use up and down arrow keys to navigate."; 8755 } 8756 } 8757 }, 8758 8759 __response: function( content ) { 8760 var message; 8761 this._superApply( arguments ); 8762 if ( this.options.disabled || this.cancelSearch ) { 8763 return; 8764 } 8765 if ( content && content.length ) { 8766 message = this.options.messages.results( content.length ); 8767 } else { 8768 message = this.options.messages.noResults; 8769 } 8770
vendor: 8,239 bytes, lines 8770-9050
8770this.liveRegion.children().hide(); 8771 $( "<div>" ).text( message ).appendTo( this.liveRegion ); 8772 } 8773} ); 8774 8775var widgetsAutocomplete = $.ui.autocomplete; 8776 8777 8778/*! 8779 * jQuery UI Controlgroup 1.13.0 8780 * http://jqueryui.com 8781 * 8782 * Copyright jQuery Foundation and other contributors 8783 * Released under the MIT license. 8784 * http://jquery.org/license 8785 */ 8786 8787//>>label: Controlgroup 8788//>>group: Widgets 8789//>>description: Visually groups form control widgets 8790//>>docs: http://api.jqueryui.com/controlgroup/ 8791//>>demos: http://jqueryui.com/controlgroup/ 8792//>>css.structure: ../../themes/base/core.css 8793//>>css.structure: ../../themes/base/controlgroup.css 8794//>>css.theme: ../../themes/base/theme.css 8795 8796 8797var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 8798 8799var widgetsControlgroup = $.widget( "ui.controlgroup", { 8800 version: "1.13.0", 8801 defaultElement: "<div>", 8802 options: { 8803 direction: "horizontal", 8804 disabled: null, 8805 onlyVisible: true, 8806 items: { 8807 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 8808 "controlgroupLabel": ".ui-controlgroup-label", 8809 "checkboxradio": "input[type='checkbox'], input[type='radio']", 8810 "selectmenu": "select", 8811 "spinner": ".ui-spinner-input" 8812 } 8813 }, 8814 8815 _create: function() { 8816 this._enhance(); 8817 }, 8818 8819 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 8820 _enhance: function() { 8821 this.element.attr( "role", "toolbar" ); 8822 this.refresh(); 8823 }, 8824 8825 _destroy: function() { 8826 this._callChildMethod( "destroy" ); 8827 this.childWidgets.removeData( "ui-controlgroup-data" ); 8828 this.element.removeAttr( "role" ); 8829 if ( this.options.items.controlgroupLabel ) { 8830 this.element 8831 .find( this.options.items.controlgroupLabel ) 8832 .find( ".ui-controlgroup-label-contents" ) 8833 .contents().unwrap(); 8834 } 8835 }, 8836 8837 _initWidgets: function() { 8838 var that = this, 8839 childWidgets = []; 8840 8841 // First we iterate over each of the items options 8842 $.each( this.options.items, function( widget, selector ) { 8843 var labels; 8844 var options = {}; 8845 8846 // Make sure the widget has a selector set 8847 if ( !selector ) { 8848 return; 8849 } 8850 8851 if ( widget === "controlgroupLabel" ) { 8852 labels = that.element.find( selector ); 8853 labels.each( function() { 8854 var element = $( this ); 8855 8856 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 8857 return; 8858 } 8859 element.contents() 8860 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 8861 } ); 8862 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 8863 childWidgets = childWidgets.concat( labels.get() ); 8864 return; 8865 } 8866 8867 // Make sure the widget actually exists 8868 if ( !$.fn[ widget ] ) { 8869 return; 8870 } 8871 8872 // We assume everything is in the middle to start because we can't determine 8873 // first / last elements until all enhancments are done. 8874 if ( that[ "_" + widget + "Options" ] ) { 8875 options = that[ "_" + widget + "Options" ]( "middle" ); 8876 } else { 8877 options = { classes: {} }; 8878 } 8879 8880 // Find instances of this widget inside controlgroup and init them 8881 that.element 8882 .find( selector ) 8883 .each( function() { 8884 var element = $( this ); 8885 var instance = element[ widget ]( "instance" ); 8886 8887 // We need to clone the default options for this type of widget to avoid 8888 // polluting the variable options which has a wider scope than a single widget. 8889 var instanceOptions = $.widget.extend( {}, options ); 8890 8891 // If the button is the child of a spinner ignore it 8892 // TODO: Find a more generic solution 8893 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 8894 return; 8895 } 8896 8897 // Create the widget if it doesn't exist 8898 if ( !instance ) { 8899 instance = element[ widget ]()[ widget ]( "instance" ); 8900 } 8901 if ( instance ) { 8902 instanceOptions.classes = 8903 that._resolveClassesValues( instanceOptions.classes, instance ); 8904 } 8905 element[ widget ]( instanceOptions ); 8906 8907 // Store an instance of the controlgroup to be able to reference 8908 // from the outermost element for changing options and refresh 8909 var widgetElement = element[ widget ]( "widget" ); 8910 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 8911 instance ? instance : element[ widget ]( "instance" ) ); 8912 8913 childWidgets.push( widgetElement[ 0 ] ); 8914 } ); 8915 } ); 8916 8917 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 8918 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 8919 }, 8920 8921 _callChildMethod: function( method ) { 8922 this.childWidgets.each( function() { 8923 var element = $( this ), 8924 data = element.data( "ui-controlgroup-data" ); 8925 if ( data && data[ method ] ) { 8926 data[ method ](); 8927 } 8928 } ); 8929 }, 8930 8931 _updateCornerClass: function( element, position ) { 8932 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 8933 var add = this._buildSimpleOptions( position, "label" ).classes.label; 8934 8935 this._removeClass( element, null, remove ); 8936 this._addClass( element, null, add ); 8937 }, 8938 8939 _buildSimpleOptions: function( position, key ) { 8940 var direction = this.options.direction === "vertical"; 8941 var result = { 8942 classes: {} 8943 }; 8944 result.classes[ key ] = { 8945 "middle": "", 8946 "first": "ui-corner-" + ( direction ? "top" : "left" ), 8947 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 8948 "only": "ui-corner-all" 8949 }[ position ]; 8950 8951 return result; 8952 }, 8953 8954 _spinnerOptions: function( position ) { 8955 var options = this._buildSimpleOptions( position, "ui-spinner" ); 8956 8957 options.classes[ "ui-spinner-up" ] = ""; 8958 options.classes[ "ui-spinner-down" ] = ""; 8959 8960 return options; 8961 }, 8962 8963 _buttonOptions: function( position ) { 8964 return this._buildSimpleOptions( position, "ui-button" ); 8965 }, 8966 8967 _checkboxradioOptions: function( position ) { 8968 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 8969 }, 8970 8971 _selectmenuOptions: function( position ) { 8972 var direction = this.options.direction === "vertical"; 8973 return { 8974 width: direction ? "auto" : false, 8975 classes: { 8976 middle: { 8977 "ui-selectmenu-button-open": "", 8978 "ui-selectmenu-button-closed": "" 8979 }, 8980 first: { 8981 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 8982 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 8983 }, 8984 last: { 8985 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 8986 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 8987 }, 8988 only: { 8989 "ui-selectmenu-button-open": "ui-corner-top", 8990 "ui-selectmenu-button-closed": "ui-corner-all" 8991 } 8992 8993 }[ position ] 8994 }; 8995 }, 8996 8997 _resolveClassesValues: function( classes, instance ) { 8998 var result = {}; 8999 $.each( classes, function( key ) { 9000 var current = instance.options.classes[ key ] || ""; 9001 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 9002 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 9003 } ); 9004 return result; 9005 }, 9006 9007 _setOption: function( key, value ) { 9008 if ( key === "direction" ) { 9009 this._removeClass( "ui-controlgroup-" + this.options.direction ); 9010 } 9011 9012 this._super( key, value ); 9013 if ( key === "disabled" ) { 9014 this._callChildMethod( value ? "disable" : "enable" ); 9015 return; 9016 } 9017 9018 this.refresh(); 9019 }, 9020 9021 refresh: function() { 9022 var children, 9023 that = this; 9024 9025 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 9026 9027 if ( this.options.direction === "horizontal" ) { 9028 this._addClass( null, "ui-helper-clearfix" ); 9029 } 9030 this._initWidgets(); 9031 9032 children = this.childWidgets; 9033 9034 // We filter here because we need to track all childWidgets not just the visible ones 9035 if ( this.options.onlyVisible ) { 9036 children = children.filter( ":visible" ); 9037 } 9038 9039 if ( children.length ) { 9040 9041 // We do this last because we need to make sure all enhancment is done 9042 // before determining first and last 9043 $.each( [ "first", "last" ], function( index, value ) { 9044 var instance = children[ value ]().data( "ui-controlgroup-data" ); 9045 9046 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 9047 var options = that[ "_" + instance.widgetName + "Options" ]( 9048 children.length === 1 ? "only" : value 9049 ); 9050 options.classes = that._resolveClassesValues( options.classes, instance );
vendor: 5,282 bytes, lines 9051-9242
9051 instance.element[ instance.widgetName ]( options ); 9052 } else { 9053 that._updateCornerClass( children[ value ](), value ); 9054 } 9055 } ); 9056 9057 // Finally call the refresh method on each of the child widgets. 9058 this._callChildMethod( "refresh" ); 9059 } 9060 } 9061} ); 9062 9063/*! 9064 * jQuery UI Checkboxradio 1.13.0 9065 * http://jqueryui.com 9066 * 9067 * Copyright jQuery Foundation and other contributors 9068 * Released under the MIT license. 9069 * http://jquery.org/license 9070 */ 9071 9072//>>label: Checkboxradio 9073//>>group: Widgets 9074//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 9075//>>docs: http://api.jqueryui.com/checkboxradio/ 9076//>>demos: http://jqueryui.com/checkboxradio/ 9077//>>css.structure: ../../themes/base/core.css 9078//>>css.structure: ../../themes/base/button.css 9079//>>css.structure: ../../themes/base/checkboxradio.css 9080//>>css.theme: ../../themes/base/theme.css 9081 9082 9083$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 9084 version: "1.13.0", 9085 options: { 9086 disabled: null, 9087 label: null, 9088 icon: true, 9089 classes: { 9090 "ui-checkboxradio-label": "ui-corner-all", 9091 "ui-checkboxradio-icon": "ui-corner-all" 9092 } 9093 }, 9094 9095 _getCreateOptions: function() { 9096 var disabled, labels; 9097 var that = this; 9098 var options = this._super() || {}; 9099 9100 // We read the type here, because it makes more sense to throw a element type error first, 9101 // rather then the error for lack of a label. Often if its the wrong type, it 9102 // won't have a label (e.g. calling on a div, btn, etc) 9103 this._readType(); 9104 9105 labels = this.element.labels(); 9106 9107 // If there are multiple labels, use the last one 9108 this.label = $( labels[ labels.length - 1 ] ); 9109 if ( !this.label.length ) { 9110 $.error( "No label found for checkboxradio widget" ); 9111 } 9112 9113 this.originalLabel = ""; 9114 9115 // We need to get the label text but this may also need to make sure it does not contain the 9116 // input itself. 9117 this.label.contents().not( this.element[ 0 ] ).each( function() { 9118 9119 // The label contents could be text, html, or a mix. We concat each element to get a 9120 // string representation of the label, without the input as part of it. 9121 that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML; 9122 } ); 9123 9124 // Set the label option if we found label text 9125 if ( this.originalLabel ) { 9126 options.label = this.originalLabel; 9127 } 9128 9129 disabled = this.element[ 0 ].disabled; 9130 if ( disabled != null ) { 9131 options.disabled = disabled; 9132 } 9133 return options; 9134 }, 9135 9136 _create: function() { 9137 var checked = this.element[ 0 ].checked; 9138 9139 this._bindFormResetHandler(); 9140 9141 if ( this.options.disabled == null ) { 9142 this.options.disabled = this.element[ 0 ].disabled; 9143 } 9144 9145 this._setOption( "disabled", this.options.disabled ); 9146 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 9147 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 9148 9149 if ( this.type === "radio" ) { 9150 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 9151 } 9152 9153 if ( this.options.label && this.options.label !== this.originalLabel ) { 9154 this._updateLabel(); 9155 } else if ( this.originalLabel ) { 9156 this.options.label = this.originalLabel; 9157 } 9158 9159 this._enhance(); 9160 9161 if ( checked ) { 9162 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 9163 } 9164 9165 this._on( { 9166 change: "_toggleClasses", 9167 focus: function() { 9168 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 9169 }, 9170 blur: function() { 9171 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 9172 } 9173 } ); 9174 }, 9175 9176 _readType: function() { 9177 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 9178 this.type = this.element[ 0 ].type; 9179 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 9180 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 9181 " and element.type=" + this.type ); 9182 } 9183 }, 9184 9185 // Support jQuery Mobile enhanced option 9186 _enhance: function() { 9187 this._updateIcon( this.element[ 0 ].checked ); 9188 }, 9189 9190 widget: function() { 9191 return this.label; 9192 }, 9193 9194 _getRadioGroup: function() { 9195 var group; 9196 var name = this.element[ 0 ].name; 9197 var nameSelector = "input[name='" + $.escapeSelector( name ) + "']"; 9198 9199 if ( !name ) { 9200 return $( [] ); 9201 } 9202 9203 if ( this.form.length ) { 9204 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 9205 } else { 9206 9207 // Not inside a form, check all inputs that also are not inside a form 9208 group = $( nameSelector ).filter( function() { 9209 return $( this )._form().length === 0; 9210 } ); 9211 } 9212 9213 return group.not( this.element ); 9214 }, 9215 9216 _toggleClasses: function() { 9217 var checked = this.element[ 0 ].checked; 9218 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 9219 9220 if ( this.options.icon && this.type === "checkbox" ) { 9221 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 9222 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 9223 } 9224 9225 if ( this.type === "radio" ) { 9226 this._getRadioGroup() 9227 .each( function() { 9228 var instance = $( this ).checkboxradio( "instance" ); 9229 9230 if ( instance ) { 9231 instance._removeClass( instance.label, 9232 "ui-checkboxradio-checked", "ui-state-active" ); 9233 } 9234 } ); 9235 } 9236 }, 9237 9238 _destroy: function() { 9239 this._unbindFormResetHandler(); 9240 9241 if ( this.icon ) { 9242 this.icon.remove();
vendor: 2,708 bytes, lines 9243-9349
9243 this.iconSpace.remove(); 9244 } 9245 }, 9246 9247 _setOption: function( key, value ) { 9248 9249 // We don't allow the value to be set to nothing 9250 if ( key === "label" && !value ) { 9251 return; 9252 } 9253 9254 this._super( key, value ); 9255 9256 if ( key === "disabled" ) { 9257 this._toggleClass( this.label, null, "ui-state-disabled", value ); 9258 this.element[ 0 ].disabled = value; 9259 9260 // Don't refresh when setting disabled 9261 return; 9262 } 9263 this.refresh(); 9264 }, 9265 9266 _updateIcon: function( checked ) { 9267 var toAdd = "ui-icon ui-icon-background "; 9268 9269 if ( this.options.icon ) { 9270 if ( !this.icon ) { 9271 this.icon = $( "<span>" ); 9272 this.iconSpace = $( "<span> </span>" ); 9273 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 9274 } 9275 9276 if ( this.type === "checkbox" ) { 9277 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 9278 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 9279 } else { 9280 toAdd += "ui-icon-blank"; 9281 } 9282 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 9283 if ( !checked ) { 9284 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 9285 } 9286 this.icon.prependTo( this.label ).after( this.iconSpace ); 9287 } else if ( this.icon !== undefined ) { 9288 this.icon.remove(); 9289 this.iconSpace.remove(); 9290 delete this.icon; 9291 } 9292 }, 9293 9294 _updateLabel: function() { 9295 9296 // Remove the contents of the label ( minus the icon, icon space, and input ) 9297 var contents = this.label.contents().not( this.element[ 0 ] ); 9298 if ( this.icon ) { 9299 contents = contents.not( this.icon[ 0 ] ); 9300 } 9301 if ( this.iconSpace ) { 9302 contents = contents.not( this.iconSpace[ 0 ] ); 9303 } 9304 contents.remove(); 9305 9306 this.label.append( this.options.label ); 9307 }, 9308 9309 refresh: function() { 9310 var checked = this.element[ 0 ].checked, 9311 isDisabled = this.element[ 0 ].disabled; 9312 9313 this._updateIcon( checked ); 9314 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 9315 if ( this.options.label !== null ) { 9316 this._updateLabel(); 9317 } 9318 9319 if ( isDisabled !== this.options.disabled ) { 9320 this._setOptions( { "disabled": isDisabled } ); 9321 } 9322 } 9323 9324} ] ); 9325 9326var widgetsCheckboxradio = $.ui.checkboxradio; 9327 9328 9329/*! 9330 * jQuery UI Button 1.13.0 9331 * http://jqueryui.com 9332 * 9333 * Copyright jQuery Foundation and other contributors 9334 * Released under the MIT license. 9335 * http://jquery.org/license 9336 */ 9337 9338//>>label: Button 9339//>>group: Widgets 9340//>>description: Enhances a form with themeable buttons. 9341//>>docs: http://api.jqueryui.com/button/ 9342//>>demos: http://jqueryui.com/button/ 9343//>>css.structure: ../../themes/base/core.css 9344//>>css.structure: ../../themes/base/button.css 9345//>>css.theme: ../../themes/base/theme.css 9346 9347 9348$.widget( "ui.button", { 9349 version: "1.13.0
vendor: 10,836 bytes, lines 9349-9756
9349", 9350 defaultElement: "<button>", 9351 options: { 9352 classes: { 9353 "ui-button": "ui-corner-all" 9354 }, 9355 disabled: null, 9356 icon: null, 9357 iconPosition: "beginning", 9358 label: null, 9359 showLabel: true 9360 }, 9361 9362 _getCreateOptions: function() { 9363 var disabled, 9364 9365 // This is to support cases like in jQuery Mobile where the base widget does have 9366 // an implementation of _getCreateOptions 9367 options = this._super() || {}; 9368 9369 this.isInput = this.element.is( "input" ); 9370 9371 disabled = this.element[ 0 ].disabled; 9372 if ( disabled != null ) { 9373 options.disabled = disabled; 9374 } 9375 9376 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 9377 if ( this.originalLabel ) { 9378 options.label = this.originalLabel; 9379 } 9380 9381 return options; 9382 }, 9383 9384 _create: function() { 9385 if ( !this.option.showLabel & !this.options.icon ) { 9386 this.options.showLabel = true; 9387 } 9388 9389 // We have to check the option again here even though we did in _getCreateOptions, 9390 // because null may have been passed on init which would override what was set in 9391 // _getCreateOptions 9392 if ( this.options.disabled == null ) { 9393 this.options.disabled = this.element[ 0 ].disabled || false; 9394 } 9395 9396 this.hasTitle = !!this.element.attr( "title" ); 9397 9398 // Check to see if the label needs to be set or if its already correct 9399 if ( this.options.label && this.options.label !== this.originalLabel ) { 9400 if ( this.isInput ) { 9401 this.element.val( this.options.label ); 9402 } else { 9403 this.element.html( this.options.label ); 9404 } 9405 } 9406 this._addClass( "ui-button", "ui-widget" ); 9407 this._setOption( "disabled", this.options.disabled ); 9408 this._enhance(); 9409 9410 if ( this.element.is( "a" ) ) { 9411 this._on( { 9412 "keyup": function( event ) { 9413 if ( event.keyCode === $.ui.keyCode.SPACE ) { 9414 event.preventDefault(); 9415 9416 // Support: PhantomJS <= 1.9, IE 8 Only 9417 // If a native click is available use it so we actually cause navigation 9418 // otherwise just trigger a click event 9419 if ( this.element[ 0 ].click ) { 9420 this.element[ 0 ].click(); 9421 } else { 9422 this.element.trigger( "click" ); 9423 } 9424 } 9425 } 9426 } ); 9427 } 9428 }, 9429 9430 _enhance: function() { 9431 if ( !this.element.is( "button" ) ) { 9432 this.element.attr( "role", "button" ); 9433 } 9434 9435 if ( this.options.icon ) { 9436 this._updateIcon( "icon", this.options.icon ); 9437 this._updateTooltip(); 9438 } 9439 }, 9440 9441 _updateTooltip: function() { 9442 this.title = this.element.attr( "title" ); 9443 9444 if ( !this.options.showLabel && !this.title ) { 9445 this.element.attr( "title", this.options.label ); 9446 } 9447 }, 9448 9449 _updateIcon: function( option, value ) { 9450 var icon = option !== "iconPosition", 9451 position = icon ? this.options.iconPosition : value, 9452 displayBlock = position === "top" || position === "bottom"; 9453 9454 // Create icon 9455 if ( !this.icon ) { 9456 this.icon = $( "<span>" ); 9457 9458 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 9459 9460 if ( !this.options.showLabel ) { 9461 this._addClass( "ui-button-icon-only" ); 9462 } 9463 } else if ( icon ) { 9464 9465 // If we are updating the icon remove the old icon class 9466 this._removeClass( this.icon, null, this.options.icon ); 9467 } 9468 9469 // If we are updating the icon add the new icon class 9470 if ( icon ) { 9471 this._addClass( this.icon, null, value ); 9472 } 9473 9474 this._attachIcon( position ); 9475 9476 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 9477 // the iconSpace if there is one. 9478 if ( displayBlock ) { 9479 this._addClass( this.icon, null, "ui-widget-icon-block" ); 9480 if ( this.iconSpace ) { 9481 this.iconSpace.remove(); 9482 } 9483 } else { 9484 9485 // Position is beginning or end so remove the ui-widget-icon-block class and add the 9486 // space if it does not exist 9487 if ( !this.iconSpace ) { 9488 this.iconSpace = $( "<span> </span>" ); 9489 this._addClass( this.iconSpace, "ui-button-icon-space" ); 9490 } 9491 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 9492 this._attachIconSpace( position ); 9493 } 9494 }, 9495 9496 _destroy: function() { 9497 this.element.removeAttr( "role" ); 9498 9499 if ( this.icon ) { 9500 this.icon.remove(); 9501 } 9502 if ( this.iconSpace ) { 9503 this.iconSpace.remove(); 9504 } 9505 if ( !this.hasTitle ) { 9506 this.element.removeAttr( "title" ); 9507 } 9508 }, 9509 9510 _attachIconSpace: function( iconPosition ) { 9511 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 9512 }, 9513 9514 _attachIcon: function( iconPosition ) { 9515 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 9516 }, 9517 9518 _setOptions: function( options ) { 9519 var newShowLabel = options.showLabel === undefined ? 9520 this.options.showLabel : 9521 options.showLabel, 9522 newIcon = options.icon === undefined ? this.options.icon : options.icon; 9523 9524 if ( !newShowLabel && !newIcon ) { 9525 options.showLabel = true; 9526 } 9527 this._super( options ); 9528 }, 9529 9530 _setOption: function( key, value ) { 9531 if ( key === "icon" ) { 9532 if ( value ) { 9533 this._updateIcon( key, value ); 9534 } else if ( this.icon ) { 9535 this.icon.remove(); 9536 if ( this.iconSpace ) { 9537 this.iconSpace.remove(); 9538 } 9539 } 9540 } 9541 9542 if ( key === "iconPosition" ) { 9543 this._updateIcon( key, value ); 9544 } 9545 9546 // Make sure we can't end up with a button that has neither text nor icon 9547 if ( key === "showLabel" ) { 9548 this._toggleClass( "ui-button-icon-only", null, !value ); 9549 this._updateTooltip(); 9550 } 9551 9552 if ( key === "label" ) { 9553 if ( this.isInput ) { 9554 this.element.val( value ); 9555 } else { 9556 9557 // If there is an icon, append it, else nothing then append the value 9558 // this avoids removal of the icon when setting label text 9559 this.element.html( value ); 9560 if ( this.icon ) { 9561 this._attachIcon( this.options.iconPosition ); 9562 this._attachIconSpace( this.options.iconPosition ); 9563 } 9564 } 9565 } 9566 9567 this._super( key, value ); 9568 9569 if ( key === "disabled" ) { 9570 this._toggleClass( null, "ui-state-disabled", value ); 9571 this.element[ 0 ].disabled = value; 9572 if ( value ) { 9573 this.element.trigger( "blur" ); 9574 } 9575 } 9576 }, 9577 9578 refresh: function() { 9579 9580 // Make sure to only check disabled if its an element that supports this otherwise 9581 // check for the disabled class to determine state 9582 var isDisabled = this.element.is( "input, button" ) ? 9583 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 9584 9585 if ( isDisabled !== this.options.disabled ) { 9586 this._setOptions( { disabled: isDisabled } ); 9587 } 9588 9589 this._updateTooltip(); 9590 } 9591} ); 9592 9593// DEPRECATED 9594if ( $.uiBackCompat !== false ) { 9595 9596 // Text and Icons options 9597 $.widget( "ui.button", $.ui.button, { 9598 options: { 9599 text: true, 9600 icons: { 9601 primary: null, 9602 secondary: null 9603 } 9604 }, 9605 9606 _create: function() { 9607 if ( this.options.showLabel && !this.options.text ) { 9608 this.options.showLabel = this.options.text; 9609 } 9610 if ( !this.options.showLabel && this.options.text ) { 9611 this.options.text = this.options.showLabel; 9612 } 9613 if ( !this.options.icon && ( this.options.icons.primary || 9614 this.options.icons.secondary ) ) { 9615 if ( this.options.icons.primary ) { 9616 this.options.icon = this.options.icons.primary; 9617 } else { 9618 this.options.icon = this.options.icons.secondary; 9619 this.options.iconPosition = "end"; 9620 } 9621 } else if ( this.options.icon ) { 9622 this.options.icons.primary = this.options.icon; 9623 } 9624 this._super(); 9625 }, 9626 9627 _setOption: function( key, value ) { 9628 if ( key === "text" ) { 9629 this._super( "showLabel", value ); 9630 return; 9631 } 9632 if ( key === "showLabel" ) { 9633 this.options.text = value; 9634 } 9635 if ( key === "icon" ) { 9636 this.options.icons.primary = value; 9637 } 9638 if ( key === "icons" ) { 9639 if ( value.primary ) { 9640 this._super( "icon", value.primary ); 9641 this._super( "iconPosition", "beginning" ); 9642 } else if ( value.secondary ) { 9643 this._super( "icon", value.secondary ); 9644 this._super( "iconPosition", "end" ); 9645 } 9646 } 9647 this._superApply( arguments ); 9648 } 9649 } ); 9650 9651 $.fn.button = ( function( orig ) { 9652 return function( options ) { 9653 var isMethodCall = typeof options === "string"; 9654 var args = Array.prototype.slice.call( arguments, 1 ); 9655 var returnValue = this; 9656 9657 if ( isMethodCall ) { 9658 9659 // If this is an empty collection, we need to have the instance method 9660 // return undefined instead of the jQuery instance 9661 if ( !this.length && options === "instance" ) { 9662 returnValue = undefined; 9663 } else { 9664 this.each( function() { 9665 var methodValue; 9666 var type = $( this ).attr( "type" ); 9667 var name = type !== "checkbox" && type !== "radio" ? 9668 "button" : 9669 "checkboxradio"; 9670 var instance = $.data( this, "ui-" + name ); 9671 9672 if ( options === "instance" ) { 9673 returnValue = instance; 9674 return false; 9675 } 9676 9677 if ( !instance ) { 9678 return $.error( "cannot call methods on button" + 9679 " prior to initialization; " + 9680 "attempted to call method '" + options + "'" ); 9681 } 9682 9683 if ( typeof instance[ options ] !== "function" || 9684 options.charAt( 0 ) === "_" ) { 9685 return $.error( "no such method '" + options + "' for button" + 9686 " widget instance" ); 9687 } 9688 9689 methodValue = instance[ options ].apply( instance, args ); 9690 9691 if ( methodValue !== instance && methodValue !== undefined ) { 9692 returnValue = methodValue && methodValue.jquery ? 9693 returnValue.pushStack( methodValue.get() ) : 9694 methodValue; 9695 return false; 9696 } 9697 } ); 9698 } 9699 } else { 9700 9701 // Allow multiple hashes to be passed on init 9702 if ( args.length ) { 9703 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 9704 } 9705 9706 this.each( function() { 9707 var type = $( this ).attr( "type" ); 9708 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 9709 var instance = $.data( this, "ui-" + name ); 9710 9711 if ( instance ) { 9712 instance.option( options || {} ); 9713 if ( instance._init ) { 9714 instance._init(); 9715 } 9716 } else { 9717 if ( name === "button" ) { 9718 orig.call( $( this ), options ); 9719 return; 9720 } 9721 9722 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 9723 } 9724 } ); 9725 } 9726 9727 return returnValue; 9728 }; 9729 } )( $.fn.button ); 9730 9731 $.fn.buttonset = function() { 9732 if ( !$.ui.controlgroup ) { 9733 $.error( "Controlgroup widget missing" ); 9734 } 9735 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 9736 return this.controlgroup.apply( this, 9737 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 9738 } 9739 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 9740 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 9741 } 9742 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 9743 arguments[ 0 ].items = { 9744 button: arguments[ 0 ].items 9745 }; 9746 } 9747 return this.controlgroup.apply( this, arguments ); 9748 }; 9749} 9750 9751var widgetsButton = $.ui.button; 9752 9753 9754/* eslint-disable max-len, camelcase */ 9755/*! 9756 * jQuery UI Datepicker 1.13.
97560 9757 * http://jqueryui.com 9758 * 9759 * Copyright jQuery Foundation and other contributors 9760 * Released under the MIT license. 9761 * http://jquery.org/license 9762 */ 9763 9764//>>label: Datepicker 9765//>>group: Widgets 9766//>>description: Displays a calendar from an input or inline for selecting dates. 9767//>>docs: http://api.jqueryui.com/datepicker/ 9768//>>demos: http://jqueryui.com/datepicker/ 9769//>>css.structure: ../../themes/base/core.css 9770//>>css.structure: ../../themes/base/datepicker.css 9771//>>css.theme: ../../themes/base/theme.css 9772 9773 9774$.extend( $.ui, { datepicker: { version: "1.13.0
vendor: 43,310 bytes, lines 9774-10927
9774" } } ); 9775 9776var datepicker_instActive; 9777 9778function datepicker_getZindex( elem ) { 9779 var position, value; 9780 while ( elem.length && elem[ 0 ] !== document ) { 9781 9782 // Ignore z-index if position is set to a value where z-index is ignored by the browser 9783 // This makes behavior of this function consistent across browsers 9784 // WebKit always returns auto if the element is positioned 9785 position = elem.css( "position" ); 9786 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 9787 9788 // IE returns 0 when zIndex is not specified 9789 // other browsers return a string 9790 // we ignore the case of nested elements with an explicit value of 0 9791 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 9792 value = parseInt( elem.css( "zIndex" ), 10 ); 9793 if ( !isNaN( value ) && value !== 0 ) { 9794 return value; 9795 } 9796 } 9797 elem = elem.parent(); 9798 } 9799 9800 return 0; 9801} 9802 9803/* Date picker manager. 9804 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 9805 Settings for (groups of) date pickers are maintained in an instance object, 9806 allowing multiple different settings on the same page. */ 9807 9808function Datepicker() { 9809 this._curInst = null; // The current instance in use 9810 this._keyEvent = false; // If the last event was a key event 9811 this._disabledInputs = []; // List of date picker inputs that have been disabled 9812 this._datepickerShowing = false; // True if the popup picker is showing , false if not 9813 this._inDialog = false; // True if showing within a "dialog", false if not 9814 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 9815 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 9816 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 9817 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 9818 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 9819 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 9820 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 9821 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 9822 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 9823 this.regional = []; // Available regional settings, indexed by language code 9824 this.regional[ "" ] = { // Default regional settings 9825 closeText: "Done", // Display text for close link 9826 prevText: "Prev", // Display text for previous month link 9827 nextText: "Next", // Display text for next month link 9828 currentText: "Today", // Display text for current month link 9829 monthNames: [ "January", "February", "March", "April", "May", "June", 9830 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 9831 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 9832 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 9833 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 9834 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 9835 weekHeader: "Wk", // Column header for week of the year 9836 dateFormat: "mm/dd/yy", // See format options on parseDate 9837 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 9838 isRTL: false, // True if right-to-left language, false if left-to-right 9839 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 9840 yearSuffix: "", // Additional text to append to the year in the month headers, 9841 selectMonthLabel: "Select month", // Invisible label for month selector 9842 selectYearLabel: "Select year" // Invisible label for year selector 9843 }; 9844 this._defaults = { // Global defaults for all the date picker instances 9845 showOn: "focus", // "focus" for popup on focus, 9846 // "button" for trigger button, or "both" for either 9847 showAnim: "fadeIn", // Name of jQuery animation for popup 9848 showOptions: {}, // Options for enhanced animations 9849 defaultDate: null, // Used when field is blank: actual date, 9850 // +/-number for offset from today, null for today 9851 appendText: "", // Display text following the input box, e.g. showing the format 9852 buttonText: "...", // Text for trigger button 9853 buttonImage: "", // URL for trigger button image 9854 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 9855 hideIfNoPrevNext: false, // True to hide next/previous month links 9856 // if not applicable, false to just disable them 9857 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 9858 gotoCurrent: false, // True if today link goes back to current selection instead 9859 changeMonth: false, // True if month can be selected directly, false if only prev/next 9860 changeYear: false, // True if year can be selected directly, false if only prev/next 9861 yearRange: "c-10:c+10", // Range of years to display in drop-down, 9862 // either relative to today's year (-nn:+nn), relative to currently displayed year 9863 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 9864 showOtherMonths: false, // True to show dates in other months, false to leave blank 9865 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 9866 showWeek: false, // True to show week of the year, false to not show it 9867 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 9868 // takes a Date and returns the number of the week for it 9869 shortYearCutoff: "+10", // Short year values < this are in the current century, 9870 // > this are in the previous century, 9871 // string value starting with "+" for current year + value 9872 minDate: null, // The earliest selectable date, or null for no limit 9873 maxDate: null, // The latest selectable date, or null for no limit 9874 duration: "fast", // Duration of display/closure 9875 beforeShowDay: null, // Function that takes a date and returns an array with 9876 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 9877 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 9878 beforeShow: null, // Function that takes an input field and 9879 // returns a set of custom settings for the date picker 9880 onSelect: null, // Define a callback function when a date is selected 9881 onChangeMonthYear: null, // Define a callback function when the month or year is changed 9882 onClose: null, // Define a callback function when the datepicker is closed 9883 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 9884 numberOfMonths: 1, // Number of months to show at a time 9885 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 9886 stepMonths: 1, // Number of months to step back/forward 9887 stepBigMonths: 12, // Number of months to step back/forward for the big links 9888 altField: "", // Selector for an alternate field to store selected dates into 9889 altFormat: "", // The date format to use for the alternate field 9890 constrainInput: true, // The input is constrained by the current date format 9891 showButtonPanel: false, // True to show button panel, false to not show it 9892 autoSize: false, // True to size the input for the date format, false to leave as is 9893 disabled: false // The initial disabled state 9894 }; 9895 $.extend( this._defaults, this.regional[ "" ] ); 9896 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 9897 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 9898 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 9899} 9900 9901$.extend( Datepicker.prototype, { 9902 9903 /* Class name added to elements to indicate already configured with a date picker. */ 9904 markerClassName: "hasDatepicker", 9905 9906 //Keep track of the maximum number of rows displayed (see #7043) 9907 maxRows: 4, 9908 9909 // TODO rename to "widget" when switching to widget factory 9910 _widgetDatepicker: function() { 9911 return this.dpDiv; 9912 }, 9913 9914 /* Override the default settings for all instances of the date picker. 9915 * @param settings object - the new settings to use as defaults (anonymous object) 9916 * @return the manager object 9917 */ 9918 setDefaults: function( settings ) { 9919 datepicker_extendRemove( this._defaults, settings || {} ); 9920 return this; 9921 }, 9922 9923 /* Attach the date picker to a jQuery selection. 9924 * @param target element - the target input field or division or span 9925 * @param settings object - the new settings to use for this date picker instance (anonymous) 9926 */ 9927 _attachDatepicker: function( target, settings ) { 9928 var nodeName, inline, inst; 9929 nodeName = target.nodeName.toLowerCase(); 9930 inline = ( nodeName === "div" || nodeName === "span" ); 9931 if ( !target.id ) { 9932 this.uuid += 1; 9933 target.id = "dp" + this.uuid; 9934 } 9935 inst = this._newInst( $( target ), inline ); 9936 inst.settings = $.extend( {}, settings || {} ); 9937 if ( nodeName === "input" ) { 9938 this._connectDatepicker( target, inst ); 9939 } else if ( inline ) { 9940 this._inlineDatepicker( target, inst ); 9941 } 9942 }, 9943 9944 /* Create a new instance object. */ 9945 _newInst: function( target, inline ) { 9946 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 9947 return { id: id, input: target, // associated target 9948 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 9949 drawMonth: 0, drawYear: 0, // month being drawn 9950 inline: inline, // is datepicker inline or not 9951 dpDiv: ( !inline ? this.dpDiv : // presentation div 9952 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 9953 }, 9954 9955 /* Attach the date picker to an input field. */ 9956 _connectDatepicker: function( target, inst ) { 9957 var input = $( target ); 9958 inst.append = $( [] ); 9959 inst.trigger = $( [] ); 9960 if ( input.hasClass( this.markerClassName ) ) { 9961 return; 9962 } 9963 this._attachments( input, inst ); 9964 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 9965 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 9966 this._autoSize( inst ); 9967 $.data( target, "datepicker", inst ); 9968 9969 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 9970 if ( inst.settings.disabled ) { 9971 this._disableDatepicker( target ); 9972 } 9973 }, 9974 9975 /* Make attachments based on settings. */ 9976 _attachments: function( input, inst ) { 9977 var showOn, buttonText, buttonImage, 9978 appendText = this._get( inst, "appendText" ), 9979 isRTL = this._get( inst, "isRTL" ); 9980 9981 if ( inst.append ) { 9982 inst.append.remove(); 9983 } 9984 if ( appendText ) { 9985 inst.append = $( "<span>" ) 9986 .addClass( this._appendClass ) 9987 .text( appendText ); 9988 input[ isRTL ? "before" : "after" ]( inst.append ); 9989 } 9990 9991 input.off( "focus", this._showDatepicker ); 9992 9993 if ( inst.trigger ) { 9994 inst.trigger.remove(); 9995 } 9996 9997 showOn = this._get( inst, "showOn" ); 9998 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 9999 input.on( "focus", this._showDatepicker ); 10000 } 10001 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 10002 buttonText = this._get( inst, "buttonText" ); 10003 buttonImage = this._get( inst, "buttonImage" ); 10004 10005 if ( this._get( inst, "buttonImageOnly" ) ) { 10006 inst.trigger = $( "<img>" ) 10007 .addClass( this._triggerClass ) 10008 .attr( { 10009 src: buttonImage, 10010 alt: buttonText, 10011 title: buttonText 10012 } ); 10013 } else { 10014 inst.trigger = $( "<button type='button'>" ) 10015 .addClass( this._triggerClass ); 10016 if ( buttonImage ) { 10017 inst.trigger.html( 10018 $( "<img>" ) 10019 .attr( { 10020 src: buttonImage, 10021 alt: buttonText, 10022 title: buttonText 10023 } ) 10024 ); 10025 } else { 10026 inst.trigger.text( buttonText ); 10027 } 10028 } 10029 10030 input[ isRTL ? "before" : "after" ]( inst.trigger ); 10031 inst.trigger.on( "click", function() { 10032 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 10033 $.datepicker._hideDatepicker(); 10034 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 10035 $.datepicker._hideDatepicker(); 10036 $.datepicker._showDatepicker( input[ 0 ] ); 10037 } else { 10038 $.datepicker._showDatepicker( input[ 0 ] ); 10039 } 10040 return false; 10041 } ); 10042 } 10043 }, 10044 10045 /* Apply the maximum length for the date format. */ 10046 _autoSize: function( inst ) { 10047 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 10048 var findMax, max, maxI, i, 10049 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 10050 dateFormat = this._get( inst, "dateFormat" ); 10051 10052 if ( dateFormat.match( /[DM]/ ) ) { 10053 findMax = function( names ) { 10054 max = 0; 10055 maxI = 0; 10056 for ( i = 0; i < names.length; i++ ) { 10057 if ( names[ i ].length > max ) { 10058 max = names[ i ].length; 10059 maxI = i; 10060 } 10061 } 10062 return maxI; 10063 }; 10064 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 10065 "monthNames" : "monthNamesShort" ) ) ) ); 10066 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 10067 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 10068 } 10069 inst.input.attr( "size", this._formatDate( inst, date ).length ); 10070 } 10071 }, 10072 10073 /* Attach an inline date picker to a div. */ 10074 _inlineDatepicker: function( target, inst ) { 10075 var divSpan = $( target ); 10076 if ( divSpan.hasClass( this.markerClassName ) ) { 10077 return; 10078 } 10079 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 10080 $.data( target, "datepicker", inst ); 10081 this._setDate( inst, this._getDefaultDate( inst ), true ); 10082 this._updateDatepicker( inst ); 10083 this._updateAlternate( inst ); 10084 10085 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 10086 if ( inst.settings.disabled ) { 10087 this._disableDatepicker( target ); 10088 } 10089 10090 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 10091 // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 10092 inst.dpDiv.css( "display", "block" ); 10093 }, 10094 10095 /* Pop-up the date picker in a "dialog" box. 10096 * @param input element - ignored 10097 * @param date string or Date - the initial date to display 10098 * @param onSelect function - the function to call when a date is selected 10099 * @param settings object - update the dialog date picker instance's settings (anonymous object) 10100 * @param pos int[2] - coordinates for the dialog's position within the screen or 10101 * event - with x/y coordinates or 10102 * leave empty for default (screen centre) 10103 * @return the manager object 10104 */ 10105 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 10106 var id, browserWidth, browserHeight, scrollX, scrollY, 10107 inst = this._dialogInst; // internal instance 10108 10109 if ( !inst ) { 10110 this.uuid += 1; 10111 id = "dp" + this.uuid; 10112 this._dialogInput = $( "<input type='text' id='" + id + 10113 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 10114 this._dialogInput.on( "keydown", this._doKeyDown ); 10115 $( "body" ).append( this._dialogInput ); 10116 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 10117 inst.settings = {}; 10118 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 10119 } 10120 datepicker_extendRemove( inst.settings, settings || {} ); 10121 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 10122 this._dialogInput.val( date ); 10123 10124 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 10125 if ( !this._pos ) { 10126 browserWidth = document.documentElement.clientWidth; 10127 browserHeight = document.documentElement.clientHeight; 10128 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 10129 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 10130 this._pos = // should use actual width/height below 10131 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 10132 } 10133 10134 // Move input on screen for focus, but hidden behind dialog 10135 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 10136 inst.settings.onSelect = onSelect; 10137 this._inDialog = true; 10138 this.dpDiv.addClass( this._dialogClass ); 10139 this._showDatepicker( this._dialogInput[ 0 ] ); 10140 if ( $.blockUI ) { 10141 $.blockUI( this.dpDiv ); 10142 } 10143 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 10144 return this; 10145 }, 10146 10147 /* Detach a datepicker from its control. 10148 * @param target element - the target input field or division or span 10149 */ 10150 _destroyDatepicker: function( target ) { 10151 var nodeName, 10152 $target = $( target ), 10153 inst = $.data( target, "datepicker" ); 10154 10155 if ( !$target.hasClass( this.markerClassName ) ) { 10156 return; 10157 } 10158 10159 nodeName = target.nodeName.toLowerCase(); 10160 $.removeData( target, "datepicker" ); 10161 if ( nodeName === "input" ) { 10162 inst.append.remove(); 10163 inst.trigger.remove(); 10164 $target.removeClass( this.markerClassName ). 10165 off( "focus", this._showDatepicker ). 10166 off( "keydown", this._doKeyDown ). 10167 off( "keypress", this._doKeyPress ). 10168 off( "keyup", this._doKeyUp ); 10169 } else if ( nodeName === "div" || nodeName === "span" ) { 10170 $target.removeClass( this.markerClassName ).empty(); 10171 } 10172 10173 if ( datepicker_instActive === inst ) { 10174 datepicker_instActive = null; 10175 this._curInst = null; 10176 } 10177 }, 10178 10179 /* Enable the date picker to a jQuery selection. 10180 * @param target element - the target input field or division or span 10181 */ 10182 _enableDatepicker: function( target ) { 10183 var nodeName, inline, 10184 $target = $( target ), 10185 inst = $.data( target, "datepicker" ); 10186 10187 if ( !$target.hasClass( this.markerClassName ) ) { 10188 return; 10189 } 10190 10191 nodeName = target.nodeName.toLowerCase(); 10192 if ( nodeName === "input" ) { 10193 target.disabled = false; 10194 inst.trigger.filter( "button" ). 10195 each( function() { 10196 this.disabled = false; 10197 } ).end(). 10198 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 10199 } else if ( nodeName === "div" || nodeName === "span" ) { 10200 inline = $target.children( "." + this._inlineClass ); 10201 inline.children().removeClass( "ui-state-disabled" ); 10202 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 10203 prop( "disabled", false ); 10204 } 10205 this._disabledInputs = $.map( this._disabledInputs, 10206 10207 // Delete entry 10208 function( value ) { 10209 return ( value === target ? null : value ); 10210 } ); 10211 }, 10212 10213 /* Disable the date picker to a jQuery selection. 10214 * @param target element - the target input field or division or span 10215 */ 10216 _disableDatepicker: function( target ) { 10217 var nodeName, inline, 10218 $target = $( target ), 10219 inst = $.data( target, "datepicker" ); 10220 10221 if ( !$target.hasClass( this.markerClassName ) ) { 10222 return; 10223 } 10224 10225 nodeName = target.nodeName.toLowerCase(); 10226 if ( nodeName === "input" ) { 10227 target.disabled = true; 10228 inst.trigger.filter( "button" ). 10229 each( function() { 10230 this.disabled = true; 10231 } ).end(). 10232 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 10233 } else if ( nodeName === "div" || nodeName === "span" ) { 10234 inline = $target.children( "." + this._inlineClass ); 10235 inline.children().addClass( "ui-state-disabled" ); 10236 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 10237 prop( "disabled", true ); 10238 } 10239 this._disabledInputs = $.map( this._disabledInputs, 10240 10241 // Delete entry 10242 function( value ) { 10243 return ( value === target ? null : value ); 10244 } ); 10245 this._disabledInputs[ this._disabledInputs.length ] = target; 10246 }, 10247 10248 /* Is the first field in a jQuery collection disabled as a datepicker? 10249 * @param target element - the target input field or division or span 10250 * @return boolean - true if disabled, false if enabled 10251 */ 10252 _isDisabledDatepicker: function( target ) { 10253 if ( !target ) { 10254 return false; 10255 } 10256 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 10257 if ( this._disabledInputs[ i ] === target ) { 10258 return true; 10259 } 10260 } 10261 return false; 10262 }, 10263 10264 /* Retrieve the instance data for the target control. 10265 * @param target element - the target input field or division or span 10266 * @return object - the associated instance data 10267 * @throws error if a jQuery problem getting data 10268 */ 10269 _getInst: function( target ) { 10270 try { 10271 return $.data( target, "datepicker" ); 10272 } catch ( err ) { 10273 throw "Missing instance data for this datepicker"; 10274 } 10275 }, 10276 10277 /* Update or retrieve the settings for a date picker attached to an input field or division. 10278 * @param target element - the target input field or division or span 10279 * @param name object - the new settings to update or 10280 * string - the name of the setting to change or retrieve, 10281 * when retrieving also "all" for all instance settings or 10282 * "defaults" for all global defaults 10283 * @param value any - the new value for the setting 10284 * (omit if above is an object or to retrieve a value) 10285 */ 10286 _optionDatepicker: function( target, name, value ) { 10287 var settings, date, minDate, maxDate, 10288 inst = this._getInst( target ); 10289 10290 if ( arguments.length === 2 && typeof name === "string" ) { 10291 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 10292 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 10293 this._get( inst, name ) ) : null ) ); 10294 } 10295 10296 settings = name || {}; 10297 if ( typeof name === "string" ) { 10298 settings = {}; 10299 settings[ name ] = value; 10300 } 10301 10302 if ( inst ) { 10303 if ( this._curInst === inst ) { 10304 this._hideDatepicker(); 10305 } 10306 10307 date = this._getDateDatepicker( target, true ); 10308 minDate = this._getMinMaxDate( inst, "min" ); 10309 maxDate = this._getMinMaxDate( inst, "max" ); 10310 datepicker_extendRemove( inst.settings, settings ); 10311 10312 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 10313 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 10314 inst.settings.minDate = this._formatDate( inst, minDate ); 10315 } 10316 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 10317 inst.settings.maxDate = this._formatDate( inst, maxDate ); 10318 } 10319 if ( "disabled" in settings ) { 10320 if ( settings.disabled ) { 10321 this._disableDatepicker( target ); 10322 } else { 10323 this._enableDatepicker( target ); 10324 } 10325 } 10326 this._attachments( $( target ), inst ); 10327 this._autoSize( inst ); 10328 this._setDate( inst, date ); 10329 this._updateAlternate( inst ); 10330 this._updateDatepicker( inst ); 10331 } 10332 }, 10333 10334 // Change method deprecated 10335 _changeDatepicker: function( target, name, value ) { 10336 this._optionDatepicker( target, name, value ); 10337 }, 10338 10339 /* Redraw the date picker attached to an input field or division. 10340 * @param target element - the target input field or division or span 10341 */ 10342 _refreshDatepicker: function( target ) { 10343 var inst = this._getInst( target ); 10344 if ( inst ) { 10345 this._updateDatepicker( inst ); 10346 } 10347 }, 10348 10349 /* Set the dates for a jQuery selection. 10350 * @param target element - the target input field or division or span 10351 * @param date Date - the new date 10352 */ 10353 _setDateDatepicker: function( target, date ) { 10354 var inst = this._getInst( target ); 10355 if ( inst ) { 10356 this._setDate( inst, date ); 10357 this._updateDatepicker( inst ); 10358 this._updateAlternate( inst ); 10359 } 10360 }, 10361 10362 /* Get the date(s) for the first entry in a jQuery selection. 10363 * @param target element - the target input field or division or span 10364 * @param noDefault boolean - true if no default date is to be used 10365 * @return Date - the current date 10366 */ 10367 _getDateDatepicker: function( target, noDefault ) { 10368 var inst = this._getInst( target ); 10369 if ( inst && !inst.inline ) { 10370 this._setDateFromField( inst, noDefault ); 10371 } 10372 return ( inst ? this._getDate( inst ) : null ); 10373 }, 10374 10375 /* Handle keystrokes. */ 10376 _doKeyDown: function( event ) { 10377 var onSelect, dateStr, sel, 10378 inst = $.datepicker._getInst( event.target ), 10379 handled = true, 10380 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 10381 10382 inst._keyEvent = true; 10383 if ( $.datepicker._datepickerShowing ) { 10384 switch ( event.keyCode ) { 10385 case 9: $.datepicker._hideDatepicker(); 10386 handled = false; 10387 break; // hide on tab out 10388 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 10389 $.datepicker._currentClass + ")", inst.dpDiv ); 10390 if ( sel[ 0 ] ) { 10391 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 10392 } 10393 10394 onSelect = $.datepicker._get( inst, "onSelect" ); 10395 if ( onSelect ) { 10396 dateStr = $.datepicker._formatDate( inst ); 10397 10398 // Trigger custom callback 10399 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 10400 } else { 10401 $.datepicker._hideDatepicker(); 10402 } 10403 10404 return false; // don't submit the form 10405 case 27: $.datepicker._hideDatepicker(); 10406 break; // hide on escape 10407 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10408 -$.datepicker._get( inst, "stepBigMonths" ) : 10409 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10410 break; // previous month/year on page up/+ ctrl 10411 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10412 +$.datepicker._get( inst, "stepBigMonths" ) : 10413 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10414 break; // next month/year on page down/+ ctrl 10415 case 35: if ( event.ctrlKey || event.metaKey ) { 10416 $.datepicker._clearDate( event.target ); 10417 } 10418 handled = event.ctrlKey || event.metaKey; 10419 break; // clear on ctrl or command +end 10420 case 36: if ( event.ctrlKey || event.metaKey ) { 10421 $.datepicker._gotoToday( event.target ); 10422 } 10423 handled = event.ctrlKey || event.metaKey; 10424 break; // current on ctrl or command +home 10425 case 37: if ( event.ctrlKey || event.metaKey ) { 10426 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 10427 } 10428 handled = event.ctrlKey || event.metaKey; 10429 10430 // -1 day on ctrl or command +left 10431 if ( event.originalEvent.altKey ) { 10432 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10433 -$.datepicker._get( inst, "stepBigMonths" ) : 10434 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10435 } 10436 10437 // next month/year on alt +left on Mac 10438 break; 10439 case 38: if ( event.ctrlKey || event.metaKey ) { 10440 $.datepicker._adjustDate( event.target, -7, "D" ); 10441 } 10442 handled = event.ctrlKey || event.metaKey; 10443 break; // -1 week on ctrl or command +up 10444 case 39: if ( event.ctrlKey || event.metaKey ) { 10445 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 10446 } 10447 handled = event.ctrlKey || event.metaKey; 10448 10449 // +1 day on ctrl or command +right 10450 if ( event.originalEvent.altKey ) { 10451 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 10452 +$.datepicker._get( inst, "stepBigMonths" ) : 10453 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 10454 } 10455 10456 // next month/year on alt +right 10457 break; 10458 case 40: if ( event.ctrlKey || event.metaKey ) { 10459 $.datepicker._adjustDate( event.target, +7, "D" ); 10460 } 10461 handled = event.ctrlKey || event.metaKey; 10462 break; // +1 week on ctrl or command +down 10463 default: handled = false; 10464 } 10465 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 10466 $.datepicker._showDatepicker( this ); 10467 } else { 10468 handled = false; 10469 } 10470 10471 if ( handled ) { 10472 event.preventDefault(); 10473 event.stopPropagation(); 10474 } 10475 }, 10476 10477 /* Filter entered characters - based on date format. */ 10478 _doKeyPress: function( event ) { 10479 var chars, chr, 10480 inst = $.datepicker._getInst( event.target ); 10481 10482 if ( $.datepicker._get( inst, "constrainInput" ) ) { 10483 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 10484 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 10485 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 10486 } 10487 }, 10488 10489 /* Synchronise manual entry and field/alternate field. */ 10490 _doKeyUp: function( event ) { 10491 var date, 10492 inst = $.datepicker._getInst( event.target ); 10493 10494 if ( inst.input.val() !== inst.lastVal ) { 10495 try { 10496 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 10497 ( inst.input ? inst.input.val() : null ), 10498 $.datepicker._getFormatConfig( inst ) ); 10499 10500 if ( date ) { // only if valid 10501 $.datepicker._setDateFromField( inst ); 10502 $.datepicker._updateAlternate( inst ); 10503 $.datepicker._updateDatepicker( inst ); 10504 } 10505 } catch ( err ) { 10506 } 10507 } 10508 return true; 10509 }, 10510 10511 /* Pop-up the date picker for a given input field. 10512 * If false returned from beforeShow event handler do not show. 10513 * @param input element - the input field attached to the date picker or 10514 * event - if triggered by focus 10515 */ 10516 _showDatepicker: function( input ) { 10517 input = input.target || input; 10518 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 10519 input = $( "input", input.parentNode )[ 0 ]; 10520 } 10521 10522 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 10523 return; 10524 } 10525 10526 var inst, beforeShow, beforeShowSettings, isFixed, 10527 offset, showAnim, duration; 10528 10529 inst = $.datepicker._getInst( input ); 10530 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 10531 $.datepicker._curInst.dpDiv.stop( true, true ); 10532 if ( inst && $.datepicker._datepickerShowing ) { 10533 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 10534 } 10535 } 10536 10537 beforeShow = $.datepicker._get( inst, "beforeShow" ); 10538 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 10539 if ( beforeShowSettings === false ) { 10540 return; 10541 } 10542 datepicker_extendRemove( inst.settings, beforeShowSettings ); 10543 10544 inst.lastVal = null; 10545 $.datepicker._lastInput = input; 10546 $.datepicker._setDateFromField( inst ); 10547 10548 if ( $.datepicker._inDialog ) { // hide cursor 10549 input.value = ""; 10550 } 10551 if ( !$.datepicker._pos ) { // position below input 10552 $.datepicker._pos = $.datepicker._findPos( input ); 10553 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 10554 } 10555 10556 isFixed = false; 10557 $( input ).parents().each( function() { 10558 isFixed |= $( this ).css( "position" ) === "fixed"; 10559 return !isFixed; 10560 } ); 10561 10562 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 10563 $.datepicker._pos = null; 10564 10565 //to avoid flashes on Firefox 10566 inst.dpDiv.empty(); 10567 10568 // determine sizing offscreen 10569 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 10570 $.datepicker._updateDatepicker( inst ); 10571 10572 // fix width for dynamic number of date pickers 10573 // and adjust position before showing 10574 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 10575 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 10576 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 10577 left: offset.left + "px", top: offset.top + "px" } ); 10578 10579 if ( !inst.inline ) { 10580 showAnim = $.datepicker._get( inst, "showAnim" ); 10581 duration = $.datepicker._get( inst, "duration" ); 10582 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 10583 $.datepicker._datepickerShowing = true; 10584 10585 if ( $.effects && $.effects.effect[ showAnim ] ) { 10586 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 10587 } else { 10588 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 10589 } 10590 10591 if ( $.datepicker._shouldFocusInput( inst ) ) { 10592 inst.input.trigger( "focus" ); 10593 } 10594 10595 $.datepicker._curInst = inst; 10596 } 10597 }, 10598 10599 /* Generate the date picker content. */ 10600 _updateDatepicker: function( inst ) { 10601 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 10602 datepicker_instActive = inst; // for delegate hover events 10603 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 10604 this._attachHandlers( inst ); 10605 10606 var origyearshtml, 10607 numMonths = this._getNumberOfMonths( inst ), 10608 cols = numMonths[ 1 ], 10609 width = 17, 10610 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 10611 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 10612 10613 if ( activeCell.length > 0 ) { 10614 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 10615 } 10616 10617 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 10618 if ( cols > 1 ) { 10619 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 10620 } 10621 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 10622 "Class" ]( "ui-datepicker-multi" ); 10623 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 10624 "Class" ]( "ui-datepicker-rtl" ); 10625 10626 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 10627 inst.input.trigger( "focus" ); 10628 } 10629 10630 // Deffered render of the years select (to avoid flashes on Firefox) 10631 if ( inst.yearshtml ) { 10632 origyearshtml = inst.yearshtml; 10633 setTimeout( function() { 10634 10635 //assure that inst.yearshtml didn't change. 10636 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 10637 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 10638 } 10639 origyearshtml = inst.yearshtml = null; 10640 }, 0 ); 10641 } 10642 10643 if ( onUpdateDatepicker ) { 10644 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 10645 } 10646 }, 10647 10648 // #6694 - don't focus the input if it's already focused 10649 // this breaks the change event in IE 10650 // Support: IE and jQuery <1.9 10651 _shouldFocusInput: function( inst ) { 10652 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); 10653 }, 10654 10655 /* Check positioning to remain on screen. */ 10656 _checkOffset: function( inst, offset, isFixed ) { 10657 var dpWidth = inst.dpDiv.outerWidth(), 10658 dpHeight = inst.dpDiv.outerHeight(), 10659 inputWidth = inst.input ? inst.input.outerWidth() : 0, 10660 inputHeight = inst.input ? inst.input.outerHeight() : 0, 10661 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 10662 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 10663 10664 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 10665 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 10666 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 10667 10668 // Now check if datepicker is showing outside window viewport - move to a better place if so. 10669 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 10670 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 10671 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 10672 Math.abs( dpHeight + inputHeight ) : 0 ); 10673 10674 return offset; 10675 }, 10676 10677 /* Find an object's position on the screen. */ 10678 _findPos: function( obj ) { 10679 var position, 10680 inst = this._getInst( obj ), 10681 isRTL = this._get( inst, "isRTL" ); 10682 10683 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 10684 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 10685 } 10686 10687 position = $( obj ).offset(); 10688 return [ position.left, position.top ]; 10689 }, 10690 10691 /* Hide the date picker from view. 10692 * @param input element - the input field attached to the date picker 10693 */ 10694 _hideDatepicker: function( input ) { 10695 var showAnim, duration, postProcess, onClose, 10696 inst = this._curInst; 10697 10698 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 10699 return; 10700 } 10701 10702 if ( this._datepickerShowing ) { 10703 showAnim = this._get( inst, "showAnim" ); 10704 duration = this._get( inst, "duration" ); 10705 postProcess = function() { 10706 $.datepicker._tidyDialog( inst ); 10707 }; 10708 10709 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 10710 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { 10711 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 10712 } else { 10713 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 10714 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 10715 } 10716 10717 if ( !showAnim ) { 10718 postProcess(); 10719 } 10720 this._datepickerShowing = false; 10721 10722 onClose = this._get( inst, "onClose" ); 10723 if ( onClose ) { 10724 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 10725 } 10726 10727 this._lastInput = null; 10728 if ( this._inDialog ) { 10729 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 10730 if ( $.blockUI ) { 10731 $.unblockUI(); 10732 $( "body" ).append( this.dpDiv ); 10733 } 10734 } 10735 this._inDialog = false; 10736 } 10737 }, 10738 10739 /* Tidy up after a dialog display. */ 10740 _tidyDialog: function( inst ) { 10741 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 10742 }, 10743 10744 /* Close date picker if clicked elsewhere. */ 10745 _checkExternalClick: function( event ) { 10746 if ( !$.datepicker._curInst ) { 10747 return; 10748 } 10749 10750 var $target = $( event.target ), 10751 inst = $.datepicker._getInst( $target[ 0 ] ); 10752 10753 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 10754 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 10755 !$target.hasClass( $.datepicker.markerClassName ) && 10756 !$target.closest( "." + $.datepicker._triggerClass ).length && 10757 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 10758 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 10759 $.datepicker._hideDatepicker(); 10760 } 10761 }, 10762 10763 /* Adjust one of the date sub-fields. */ 10764 _adjustDate: function( id, offset, period ) { 10765 var target = $( id ), 10766 inst = this._getInst( target[ 0 ] ); 10767 10768 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 10769 return; 10770 } 10771 this._adjustInstDate( inst, offset, period ); 10772 this._updateDatepicker( inst ); 10773 }, 10774 10775 /* Action for current link. */ 10776 _gotoToday: function( id ) { 10777 var date, 10778 target = $( id ), 10779 inst = this._getInst( target[ 0 ] ); 10780 10781 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 10782 inst.selectedDay = inst.currentDay; 10783 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 10784 inst.drawYear = inst.selectedYear = inst.currentYear; 10785 } else { 10786 date = new Date(); 10787 inst.selectedDay = date.getDate(); 10788 inst.drawMonth = inst.selectedMonth = date.getMonth(); 10789 inst.drawYear = inst.selectedYear = date.getFullYear(); 10790 } 10791 this._notifyChange( inst ); 10792 this._adjustDate( target ); 10793 }, 10794 10795 /* Action for selecting a new month/year. */ 10796 _selectMonthYear: function( id, select, period ) { 10797 var target = $( id ), 10798 inst = this._getInst( target[ 0 ] ); 10799 10800 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 10801 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 10802 parseInt( select.options[ select.selectedIndex ].value, 10 ); 10803 10804 this._notifyChange( inst ); 10805 this._adjustDate( target ); 10806 }, 10807 10808 /* Action for selecting a day. */ 10809 _selectDay: function( id, month, year, td ) { 10810 var inst, 10811 target = $( id ); 10812 10813 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 10814 return; 10815 } 10816 10817 inst = this._getInst( target[ 0 ] ); 10818 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 10819 inst.selectedMonth = inst.currentMonth = month; 10820 inst.selectedYear = inst.currentYear = year; 10821 this._selectDate( id, this._formatDate( inst, 10822 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 10823 }, 10824 10825 /* Erase the input field and hide the date picker. */ 10826 _clearDate: function( id ) { 10827 var target = $( id ); 10828 this._selectDate( target, "" ); 10829 }, 10830 10831 /* Update the input field with the selected date. */ 10832 _selectDate: function( id, dateStr ) { 10833 var onSelect, 10834 target = $( id ), 10835 inst = this._getInst( target[ 0 ] ); 10836 10837 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 10838 if ( inst.input ) { 10839 inst.input.val( dateStr ); 10840 } 10841 this._updateAlternate( inst ); 10842 10843 onSelect = this._get( inst, "onSelect" ); 10844 if ( onSelect ) { 10845 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 10846 } else if ( inst.input ) { 10847 inst.input.trigger( "change" ); // fire the change event 10848 } 10849 10850 if ( inst.inline ) { 10851 this._updateDatepicker( inst ); 10852 } else { 10853 this._hideDatepicker(); 10854 this._lastInput = inst.input[ 0 ]; 10855 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 10856 inst.input.trigger( "focus" ); // restore focus 10857 } 10858 this._lastInput = null; 10859 } 10860 }, 10861 10862 /* Update any alternate field to synchronise with the main field. */ 10863 _updateAlternate: function( inst ) { 10864 var altFormat, date, dateStr, 10865 altField = this._get( inst, "altField" ); 10866 10867 if ( altField ) { // update alternate field too 10868 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 10869 date = this._getDate( inst ); 10870 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 10871 $( document ).find( altField ).val( dateStr ); 10872 } 10873 }, 10874 10875 /* Set as beforeShowDay function to prevent selection of weekends. 10876 * @param date Date - the date to customise 10877 * @return [boolean, string] - is this date selectable?, what is its CSS class? 10878 */ 10879 noWeekends: function( date ) { 10880 var day = date.getDay(); 10881 return [ ( day > 0 && day < 6 ), "" ]; 10882 }, 10883 10884 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 10885 * @param date Date - the date to get the week for 10886 * @return number - the number of the week within the year that contains this date 10887 */ 10888 iso8601Week: function( date ) { 10889 var time, 10890 checkDate = new Date( date.getTime() ); 10891 10892 // Find Thursday of this week starting on Monday 10893 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 10894 10895 time = checkDate.getTime(); 10896 checkDate.setMonth( 0 ); // Compare with Jan 1 10897 checkDate.setDate( 1 ); 10898 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 10899 }, 10900 10901 /* Parse a string value into a date object. 10902 * See formatDate below for the possible formats. 10903 * 10904 * @param format string - the expected format of the date 10905 * @param value string - the date in the above format 10906 * @param settings Object - attributes include: 10907 * shortYearCutoff number - the cutoff year for determining the century (optional) 10908 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 10909 * dayNames string[7] - names of the days from Sunday (optional) 10910 * monthNamesShort string[12] - abbreviated names of the months (optional) 10911 * monthNames string[12] - names of the months (optional) 10912 * @return Date - the extracted date value or null if value is blank 10913 */ 10914 parseDate: function( format, value, settings ) { 10915 if ( format == null || value == null ) { 10916 throw "Invalid arguments"; 10917 } 10918 10919 value = ( typeof value === "object" ? value.toString() : value + "" ); 10920 if ( value === "" ) { 10921 return null; 10922 } 10923 10924 var iFormat, dim, extra, 10925 iValue = 0, 10926 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 10927 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 10927-11117
10927: 10928 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 10929 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 10930 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 10931 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 10932 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 10933 year = -1, 10934 month = -1, 10935 day = -1, 10936 doy = -1, 10937 literal = false, 10938 date, 10939 10940 // Check whether a format character is doubled 10941 lookAhead = function( match ) { 10942 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 10943 if ( matches ) { 10944 iFormat++; 10945 } 10946 return matches; 10947 }, 10948 10949 // Extract a number from the string value 10950 getNumber = function( match ) { 10951 var isDoubled = lookAhead( match ), 10952 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 10953 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 10954 minSize = ( match === "y" ? size : 1 ), 10955 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 10956 num = value.substring( iValue ).match( digits ); 10957 if ( !num ) { 10958 throw "Missing number at position " + iValue; 10959 } 10960 iValue += num[ 0 ].length; 10961 return parseInt( num[ 0 ], 10 ); 10962 }, 10963 10964 // Extract a name from the string value and convert to an index 10965 getName = function( match, shortNames, longNames ) { 10966 var index = -1, 10967 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 10968 return [ [ k, v ] ]; 10969 } ).sort( function( a, b ) { 10970 return -( a[ 1 ].length - b[ 1 ].length ); 10971 } ); 10972 10973 $.each( names, function( i, pair ) { 10974 var name = pair[ 1 ]; 10975 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 10976 index = pair[ 0 ]; 10977 iValue += name.length; 10978 return false; 10979 } 10980 } ); 10981 if ( index !== -1 ) { 10982 return index + 1; 10983 } else { 10984 throw "Unknown name at position " + iValue; 10985 } 10986 }, 10987 10988 // Confirm that a literal character matches the string value 10989 checkLiteral = function() { 10990 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 10991 throw "Unexpected literal at position " + iValue; 10992 } 10993 iValue++; 10994 }; 10995 10996 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 10997 if ( literal ) { 10998 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 10999 literal = false; 11000 } else { 11001 checkLiteral(); 11002 } 11003 } else { 11004 switch ( format.charAt( iFormat ) ) { 11005 case "d": 11006 day = getNumber( "d" ); 11007 break; 11008 case "D": 11009 getName( "D", dayNamesShort, dayNames ); 11010 break; 11011 case "o": 11012 doy = getNumber( "o" ); 11013 break; 11014 case "m": 11015 month = getNumber( "m" ); 11016 break; 11017 case "M": 11018 month = getName( "M", monthNamesShort, monthNames ); 11019 break; 11020 case "y": 11021 year = getNumber( "y" ); 11022 break; 11023 case "@": 11024 date = new Date( getNumber( "@" ) ); 11025 year = date.getFullYear(); 11026 month = date.getMonth() + 1; 11027 day = date.getDate(); 11028 break; 11029 case "!": 11030 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 11031 year = date.getFullYear(); 11032 month = date.getMonth() + 1; 11033 day = date.getDate(); 11034 break; 11035 case "'": 11036 if ( lookAhead( "'" ) ) { 11037 checkLiteral(); 11038 } else { 11039 literal = true; 11040 } 11041 break; 11042 default: 11043 checkLiteral(); 11044 } 11045 } 11046 } 11047 11048 if ( iValue < value.length ) { 11049 extra = value.substr( iValue ); 11050 if ( !/^\s+/.test( extra ) ) { 11051 throw "Extra/unparsed characters found in date: " + extra; 11052 } 11053 } 11054 11055 if ( year === -1 ) { 11056 year = new Date().getFullYear(); 11057 } else if ( year < 100 ) { 11058 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 11059 ( year <= shortYearCutoff ? 0 : -100 ); 11060 } 11061 11062 if ( doy > -1 ) { 11063 month = 1; 11064 day = doy; 11065 do { 11066 dim = this._getDaysInMonth( year, month - 1 ); 11067 if ( day <= dim ) { 11068 break; 11069 } 11070 month++; 11071 day -= dim; 11072 } while ( true ); 11073 } 11074 11075 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 11076 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 11077 throw "Invalid date"; // E.g. 31/02/00 11078 } 11079 return date; 11080 }, 11081 11082 /* Standard date formats. */ 11083 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 11084 COOKIE: "D, dd M yy", 11085 ISO_8601: "yy-mm-dd", 11086 RFC_822: "D, d M y", 11087 RFC_850: "DD, dd-M-y", 11088 RFC_1036: "D, d M y", 11089 RFC_1123: "D, d M yy", 11090 RFC_2822: "D, d M yy", 11091 RSS: "D, d M y", // RFC 822 11092 TICKS: "!", 11093 TIMESTAMP: "@", 11094 W3C: "yy-mm-dd", // ISO 8601 11095 11096 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 11097 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 11098 11099 /* Format a date object into a string value. 11100 * The format can be combinations of the following: 11101 * d - day of month (no leading zero) 11102 * dd - day of month (two digit) 11103 * o - day of year (no leading zeros) 11104 * oo - day of year (three digit) 11105 * D - day name short 11106 * DD - day name long 11107 * m - month of year (no leading zero) 11108 * mm - month of year (two digit) 11109 * M - month name short 11110 * MM - month name long 11111 * y - year (two digit) 11112 * yy - year (four digit) 11113 * @ - Unix timestamp (ms since 01/01/1970) 11114 * ! - Windows ticks (100ns since 01/01/0001) 11115 * "..." - literal text 11116 * '' - single quote 11117 *
vendor: 6,198 bytes, lines 11118-11317
11118 * @param format string - the desired format of the date 11119 * @param date Date - the date value to format 11120 * @param settings Object - attributes include: 11121 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 11122 * dayNames string[7] - names of the days from Sunday (optional) 11123 * monthNamesShort string[12] - abbreviated names of the months (optional) 11124 * monthNames string[12] - names of the months (optional) 11125 * @return string - the date in the above format 11126 */ 11127 formatDate: function( format, date, settings ) { 11128 if ( !date ) { 11129 return ""; 11130 } 11131 11132 var iFormat, 11133 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 11134 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 11135 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 11136 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 11137 11138 // Check whether a format character is doubled 11139 lookAhead = function( match ) { 11140 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 11141 if ( matches ) { 11142 iFormat++; 11143 } 11144 return matches; 11145 }, 11146 11147 // Format a number, with leading zero if necessary 11148 formatNumber = function( match, value, len ) { 11149 var num = "" + value; 11150 if ( lookAhead( match ) ) { 11151 while ( num.length < len ) { 11152 num = "0" + num; 11153 } 11154 } 11155 return num; 11156 }, 11157 11158 // Format a name, short or long as requested 11159 formatName = function( match, value, shortNames, longNames ) { 11160 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 11161 }, 11162 output = "", 11163 literal = false; 11164 11165 if ( date ) { 11166 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 11167 if ( literal ) { 11168 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 11169 literal = false; 11170 } else { 11171 output += format.charAt( iFormat ); 11172 } 11173 } else { 11174 switch ( format.charAt( iFormat ) ) { 11175 case "d": 11176 output += formatNumber( "d", date.getDate(), 2 ); 11177 break; 11178 case "D": 11179 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 11180 break; 11181 case "o": 11182 output += formatNumber( "o", 11183 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 11184 break; 11185 case "m": 11186 output += formatNumber( "m", date.getMonth() + 1, 2 ); 11187 break; 11188 case "M": 11189 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 11190 break; 11191 case "y": 11192 output += ( lookAhead( "y" ) ? date.getFullYear() : 11193 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 11194 break; 11195 case "@": 11196 output += date.getTime(); 11197 break; 11198 case "!": 11199 output += date.getTime() * 10000 + this._ticksTo1970; 11200 break; 11201 case "'": 11202 if ( lookAhead( "'" ) ) { 11203 output += "'"; 11204 } else { 11205 literal = true; 11206 } 11207 break; 11208 default: 11209 output += format.charAt( iFormat ); 11210 } 11211 } 11212 } 11213 } 11214 return output; 11215 }, 11216 11217 /* Extract all possible characters from the date format. */ 11218 _possibleChars: function( format ) { 11219 var iFormat, 11220 chars = "", 11221 literal = false, 11222 11223 // Check whether a format character is doubled 11224 lookAhead = function( match ) { 11225 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 11226 if ( matches ) { 11227 iFormat++; 11228 } 11229 return matches; 11230 }; 11231 11232 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 11233 if ( literal ) { 11234 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 11235 literal = false; 11236 } else { 11237 chars += format.charAt( iFormat ); 11238 } 11239 } else { 11240 switch ( format.charAt( iFormat ) ) { 11241 case "d": case "m": case "y": case "@": 11242 chars += "0123456789"; 11243 break; 11244 case "D": case "M": 11245 return null; // Accept anything 11246 case "'": 11247 if ( lookAhead( "'" ) ) { 11248 chars += "'"; 11249 } else { 11250 literal = true; 11251 } 11252 break; 11253 default: 11254 chars += format.charAt( iFormat ); 11255 } 11256 } 11257 } 11258 return chars; 11259 }, 11260 11261 /* Get a setting value, defaulting if necessary. */ 11262 _get: function( inst, name ) { 11263 return inst.settings[ name ] !== undefined ? 11264 inst.settings[ name ] : this._defaults[ name ]; 11265 }, 11266 11267 /* Parse existing date and initialise date picker. */ 11268 _setDateFromField: function( inst, noDefault ) { 11269 if ( inst.input.val() === inst.lastVal ) { 11270 return; 11271 } 11272 11273 var dateFormat = this._get( inst, "dateFormat" ), 11274 dates = inst.lastVal = inst.input ? inst.input.val() : null, 11275 defaultDate = this._getDefaultDate( inst ), 11276 date = defaultDate, 11277 settings = this._getFormatConfig( inst ); 11278 11279 try { 11280 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 11281 } catch ( event ) { 11282 dates = ( noDefault ? "" : dates ); 11283 } 11284 inst.selectedDay = date.getDate(); 11285 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11286 inst.drawYear = inst.selectedYear = date.getFullYear(); 11287 inst.currentDay = ( dates ? date.getDate() : 0 ); 11288 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 11289 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 11290 this._adjustInstDate( inst ); 11291 }, 11292 11293 /* Retrieve the default date shown on opening. */ 11294 _getDefaultDate: function( inst ) { 11295 return this._restrictMinMax( inst, 11296 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 11297 }, 11298 11299 /* A date may be specified as an exact value or a relative one. */ 11300 _determineDate: function( inst, date, defaultDate ) { 11301 var offsetNumeric = function( offset ) { 11302 var date = new Date(); 11303 date.setDate( date.getDate() + offset ); 11304 return date; 11305 }, 11306 offsetString = function( offset ) { 11307 try { 11308 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 11309 offset, $.datepicker._getFormatConfig( inst ) ); 11310 } catch ( e ) { 11311 11312 // Ignore 11313 } 11314 11315 var date = ( offset.toLowerCase().match( /^c/ ) ? 11316 $.datepicker._getDate( inst ) : null ) || new Date(), 11317 year = date.getFullYear(),
vendor: 5,359 bytes, lines 11318-11456
11318 month = date.getMonth(), 11319 day = date.getDate(), 11320 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 11321 matches = pattern.exec( offset ); 11322 11323 while ( matches ) { 11324 switch ( matches[ 2 ] || "d" ) { 11325 case "d" : case "D" : 11326 day += parseInt( matches[ 1 ], 10 ); break; 11327 case "w" : case "W" : 11328 day += parseInt( matches[ 1 ], 10 ) * 7; break; 11329 case "m" : case "M" : 11330 month += parseInt( matches[ 1 ], 10 ); 11331 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 11332 break; 11333 case "y": case "Y" : 11334 year += parseInt( matches[ 1 ], 10 ); 11335 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 11336 break; 11337 } 11338 matches = pattern.exec( offset ); 11339 } 11340 return new Date( year, month, day ); 11341 }, 11342 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 11343 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 11344 11345 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 11346 if ( newDate ) { 11347 newDate.setHours( 0 ); 11348 newDate.setMinutes( 0 ); 11349 newDate.setSeconds( 0 ); 11350 newDate.setMilliseconds( 0 ); 11351 } 11352 return this._daylightSavingAdjust( newDate ); 11353 }, 11354 11355 /* Handle switch to/from daylight saving. 11356 * Hours may be non-zero on daylight saving cut-over: 11357 * > 12 when midnight changeover, but then cannot generate 11358 * midnight datetime, so jump to 1AM, otherwise reset. 11359 * @param date (Date) the date to check 11360 * @return (Date) the corrected date 11361 */ 11362 _daylightSavingAdjust: function( date ) { 11363 if ( !date ) { 11364 return null; 11365 } 11366 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 11367 return date; 11368 }, 11369 11370 /* Set the date(s) directly. */ 11371 _setDate: function( inst, date, noChange ) { 11372 var clear = !date, 11373 origMonth = inst.selectedMonth, 11374 origYear = inst.selectedYear, 11375 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 11376 11377 inst.selectedDay = inst.currentDay = newDate.getDate(); 11378 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 11379 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 11380 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 11381 this._notifyChange( inst ); 11382 } 11383 this._adjustInstDate( inst ); 11384 if ( inst.input ) { 11385 inst.input.val( clear ? "" : this._formatDate( inst ) ); 11386 } 11387 }, 11388 11389 /* Retrieve the date(s) directly. */ 11390 _getDate: function( inst ) { 11391 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 11392 this._daylightSavingAdjust( new Date( 11393 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 11394 return startDate; 11395 }, 11396 11397 /* Attach the onxxx handlers. These are declared statically so 11398 * they work with static code transformers like Caja. 11399 */ 11400 _attachHandlers: function( inst ) { 11401 var stepMonths = this._get( inst, "stepMonths" ), 11402 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 11403 inst.dpDiv.find( "[data-handler]" ).map( function() { 11404 var handler = { 11405 prev: function() { 11406 $.datepicker._adjustDate( id, -stepMonths, "M" ); 11407 }, 11408 next: function() { 11409 $.datepicker._adjustDate( id, +stepMonths, "M" ); 11410 }, 11411 hide: function() { 11412 $.datepicker._hideDatepicker(); 11413 }, 11414 today: function() { 11415 $.datepicker._gotoToday( id ); 11416 }, 11417 selectDay: function() { 11418 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 11419 return false; 11420 }, 11421 selectMonth: function() { 11422 $.datepicker._selectMonthYear( id, this, "M" ); 11423 return false; 11424 }, 11425 selectYear: function() { 11426 $.datepicker._selectMonthYear( id, this, "Y" ); 11427 return false; 11428 } 11429 }; 11430 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 11431 } ); 11432 }, 11433 11434 /* Generate the HTML for the current state of the date picker. */ 11435 _generateHTML: function( inst ) { 11436 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 11437 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 11438 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 11439 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 11440 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 11441 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 11442 tempDate = new Date(), 11443 today = this._daylightSavingAdjust( 11444 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 11445 isRTL = this._get( inst, "isRTL" ), 11446 showButtonPanel = this._get( inst, "showButtonPanel" ), 11447 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 11448 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 11449 numMonths = this._getNumberOfMonths( inst ), 11450 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 11451 stepMonths = this._get( inst, "stepMonths" ), 11452 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 11453 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 11454 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 11455 minDate = this._getMinMaxDate( inst, "min" ), 11456 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,259 bytes, lines 11457-11971
11457 drawMonth = inst.drawMonth - showCurrentAtPos, 11458 drawYear = inst.drawYear; 11459 11460 if ( drawMonth < 0 ) { 11461 drawMonth += 12; 11462 drawYear--; 11463 } 11464 if ( maxDate ) { 11465 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 11466 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 11467 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 11468 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 11469 drawMonth--; 11470 if ( drawMonth < 0 ) { 11471 drawMonth = 11; 11472 drawYear--; 11473 } 11474 } 11475 } 11476 inst.drawMonth = drawMonth; 11477 inst.drawYear = drawYear; 11478 11479 prevText = this._get( inst, "prevText" ); 11480 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 11481 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 11482 this._getFormatConfig( inst ) ) ); 11483 11484 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 11485 prev = $( "<a>" ) 11486 .attr( { 11487 "class": "ui-datepicker-prev ui-corner-all", 11488 "data-handler": "prev", 11489 "data-event": "click", 11490 title: prevText 11491 } ) 11492 .append( 11493 $( "<span>" ) 11494 .addClass( "ui-icon ui-icon-circle-triangle-" + 11495 ( isRTL ? "e" : "w" ) ) 11496 .text( prevText ) 11497 )[ 0 ].outerHTML; 11498 } else if ( hideIfNoPrevNext ) { 11499 prev = ""; 11500 } else { 11501 prev = $( "<a>" ) 11502 .attr( { 11503 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 11504 title: prevText 11505 } ) 11506 .append( 11507 $( "<span>" ) 11508 .addClass( "ui-icon ui-icon-circle-triangle-" + 11509 ( isRTL ? "e" : "w" ) ) 11510 .text( prevText ) 11511 )[ 0 ].outerHTML; 11512 } 11513 11514 nextText = this._get( inst, "nextText" ); 11515 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 11516 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 11517 this._getFormatConfig( inst ) ) ); 11518 11519 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 11520 next = $( "<a>" ) 11521 .attr( { 11522 "class": "ui-datepicker-next ui-corner-all", 11523 "data-handler": "next", 11524 "data-event": "click", 11525 title: nextText 11526 } ) 11527 .append( 11528 $( "<span>" ) 11529 .addClass( "ui-icon ui-icon-circle-triangle-" + 11530 ( isRTL ? "w" : "e" ) ) 11531 .text( nextText ) 11532 )[ 0 ].outerHTML; 11533 } else if ( hideIfNoPrevNext ) { 11534 next = ""; 11535 } else { 11536 next = $( "<a>" ) 11537 .attr( { 11538 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 11539 title: nextText 11540 } ) 11541 .append( 11542 $( "<span>" ) 11543 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 11544 ( isRTL ? "w" : "e" ) ) 11545 .text( nextText ) 11546 )[ 0 ].outerHTML; 11547 } 11548 11549 currentText = this._get( inst, "currentText" ); 11550 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 11551 currentText = ( !navigationAsDateFormat ? currentText : 11552 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 11553 11554 controls = ""; 11555 if ( !inst.inline ) { 11556 controls = $( "<button>" ) 11557 .attr( { 11558 type: "button", 11559 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 11560 "data-handler": "hide", 11561 "data-event": "click" 11562 } ) 11563 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 11564 } 11565 11566 buttonPanel = ""; 11567 if ( showButtonPanel ) { 11568 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 11569 .append( isRTL ? controls : "" ) 11570 .append( this._isInRange( inst, gotoDate ) ? 11571 $( "<button>" ) 11572 .attr( { 11573 type: "button", 11574 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 11575 "data-handler": "today", 11576 "data-event": "click" 11577 } ) 11578 .text( currentText ) : 11579 "" ) 11580 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 11581 } 11582 11583 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 11584 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 11585 11586 showWeek = this._get( inst, "showWeek" ); 11587 dayNames = this._get( inst, "dayNames" ); 11588 dayNamesMin = this._get( inst, "dayNamesMin" ); 11589 monthNames = this._get( inst, "monthNames" ); 11590 monthNamesShort = this._get( inst, "monthNamesShort" ); 11591 beforeShowDay = this._get( inst, "beforeShowDay" ); 11592 showOtherMonths = this._get( inst, "showOtherMonths" ); 11593 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 11594 defaultDate = this._getDefaultDate( inst ); 11595 html = ""; 11596 11597 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 11598 group = ""; 11599 this.maxRows = 4; 11600 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 11601 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 11602 cornerClass = " ui-corner-all"; 11603 calender = ""; 11604 if ( isMultiMonth ) { 11605 calender += "<div class='ui-datepicker-group"; 11606 if ( numMonths[ 1 ] > 1 ) { 11607 switch ( col ) { 11608 case 0: calender += " ui-datepicker-group-first"; 11609 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 11610 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 11611 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 11612 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 11613 } 11614 } 11615 calender += "'>"; 11616 } 11617 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 11618 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 11619 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 11620 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 11621 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 11622 "</div><table class='ui-datepicker-calendar'><thead>" + 11623 "<tr>"; 11624 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 11625 for ( dow = 0; dow < 7; dow++ ) { // days of the week 11626 day = ( dow + firstDay ) % 7; 11627 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 11628 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 11629 } 11630 calender += thead + "</tr></thead><tbody>"; 11631 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 11632 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 11633 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 11634 } 11635 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 11636 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 11637 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 11638 this.maxRows = numRows; 11639 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 11640 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 11641 calender += "<tr>"; 11642 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 11643 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 11644 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 11645 daySettings = ( beforeShowDay ? 11646 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 11647 otherMonth = ( printDate.getMonth() !== drawMonth ); 11648 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 11649 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 11650 tbody += "<td class='" + 11651 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 11652 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 11653 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 11654 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 11655 11656 // or defaultDate is current printedDate and defaultDate is selectedDate 11657 " " + this._dayOverClass : "" ) + // highlight selected day 11658 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 11659 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 11660 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 11661 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 11662 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 11663 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 11664 ( otherMonth && !showOtherMonths ? " " : // display for other months 11665 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 11666 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 11667 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 11668 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 11669 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 11670 "' data-date='" + printDate.getDate() + // store date as data 11671 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 11672 printDate.setDate( printDate.getDate() + 1 ); 11673 printDate = this._daylightSavingAdjust( printDate ); 11674 } 11675 calender += tbody + "</tr>"; 11676 } 11677 drawMonth++; 11678 if ( drawMonth > 11 ) { 11679 drawMonth = 0; 11680 drawYear++; 11681 } 11682 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 11683 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 11684 group += calender; 11685 } 11686 html += group; 11687 } 11688 html += buttonPanel; 11689 inst._keyEvent = false; 11690 return html; 11691 }, 11692 11693 /* Generate the month and year header. */ 11694 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 11695 secondary, monthNames, monthNamesShort ) { 11696 11697 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 11698 changeMonth = this._get( inst, "changeMonth" ), 11699 changeYear = this._get( inst, "changeYear" ), 11700 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 11701 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 11702 selectYearLabel = this._get( inst, "selectYearLabel" ), 11703 html = "<div class='ui-datepicker-title'>", 11704 monthHtml = ""; 11705 11706 // Month selection 11707 if ( secondary || !changeMonth ) { 11708 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 11709 } else { 11710 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 11711 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 11712 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 11713 for ( month = 0; month < 12; month++ ) { 11714 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 11715 monthHtml += "<option value='" + month + "'" + 11716 ( month === drawMonth ? " selected='selected'" : "" ) + 11717 ">" + monthNamesShort[ month ] + "</option>"; 11718 } 11719 } 11720 monthHtml += "</select>"; 11721 } 11722 11723 if ( !showMonthAfterYear ) { 11724 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 11725 } 11726 11727 // Year selection 11728 if ( !inst.yearshtml ) { 11729 inst.yearshtml = ""; 11730 if ( secondary || !changeYear ) { 11731 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 11732 } else { 11733 11734 // determine range of years to display 11735 years = this._get( inst, "yearRange" ).split( ":" ); 11736 thisYear = new Date().getFullYear(); 11737 determineYear = function( value ) { 11738 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 11739 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 11740 parseInt( value, 10 ) ) ); 11741 return ( isNaN( year ) ? thisYear : year ); 11742 }; 11743 year = determineYear( years[ 0 ] ); 11744 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 11745 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 11746 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 11747 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 11748 for ( ; year <= endYear; year++ ) { 11749 inst.yearshtml += "<option value='" + year + "'" + 11750 ( year === drawYear ? " selected='selected'" : "" ) + 11751 ">" + year + "</option>"; 11752 } 11753 inst.yearshtml += "</select>"; 11754 11755 html += inst.yearshtml; 11756 inst.yearshtml = null; 11757 } 11758 } 11759 11760 html += this._get( inst, "yearSuffix" ); 11761 if ( showMonthAfterYear ) { 11762 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 11763 } 11764 html += "</div>"; // Close datepicker_header 11765 return html; 11766 }, 11767 11768 /* Adjust one of the date sub-fields. */ 11769 _adjustInstDate: function( inst, offset, period ) { 11770 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 11771 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 11772 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 11773 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 11774 11775 inst.selectedDay = date.getDate(); 11776 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11777 inst.drawYear = inst.selectedYear = date.getFullYear(); 11778 if ( period === "M" || period === "Y" ) { 11779 this._notifyChange( inst ); 11780 } 11781 }, 11782 11783 /* Ensure a date is within any min/max bounds. */ 11784 _restrictMinMax: function( inst, date ) { 11785 var minDate = this._getMinMaxDate( inst, "min" ), 11786 maxDate = this._getMinMaxDate( inst, "max" ), 11787 newDate = ( minDate && date < minDate ? minDate : date ); 11788 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 11789 }, 11790 11791 /* Notify change of month/year. */ 11792 _notifyChange: function( inst ) { 11793 var onChange = this._get( inst, "onChangeMonthYear" ); 11794 if ( onChange ) { 11795 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 11796 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 11797 } 11798 }, 11799 11800 /* Determine the number of months to show. */ 11801 _getNumberOfMonths: function( inst ) { 11802 var numMonths = this._get( inst, "numberOfMonths" ); 11803 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 11804 }, 11805 11806 /* Determine the current maximum date - ensure no time components are set. */ 11807 _getMinMaxDate: function( inst, minMax ) { 11808 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 11809 }, 11810 11811 /* Find the number of days in a given month. */ 11812 _getDaysInMonth: function( year, month ) { 11813 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 11814 }, 11815 11816 /* Find the day of the week of the first of a month. */ 11817 _getFirstDayOfMonth: function( year, month ) { 11818 return new Date( year, month, 1 ).getDay(); 11819 }, 11820 11821 /* Determines if we should allow a "next/prev" month display change. */ 11822 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 11823 var numMonths = this._getNumberOfMonths( inst ), 11824 date = this._daylightSavingAdjust( new Date( curYear, 11825 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 11826 11827 if ( offset < 0 ) { 11828 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 11829 } 11830 return this._isInRange( inst, date ); 11831 }, 11832 11833 /* Is the given date in the accepted range? */ 11834 _isInRange: function( inst, date ) { 11835 var yearSplit, currentYear, 11836 minDate = this._getMinMaxDate( inst, "min" ), 11837 maxDate = this._getMinMaxDate( inst, "max" ), 11838 minYear = null, 11839 maxYear = null, 11840 years = this._get( inst, "yearRange" ); 11841 if ( years ) { 11842 yearSplit = years.split( ":" ); 11843 currentYear = new Date().getFullYear(); 11844 minYear = parseInt( yearSplit[ 0 ], 10 ); 11845 maxYear = parseInt( yearSplit[ 1 ], 10 ); 11846 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 11847 minYear += currentYear; 11848 } 11849 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 11850 maxYear += currentYear; 11851 } 11852 } 11853 11854 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 11855 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 11856 ( !minYear || date.getFullYear() >= minYear ) && 11857 ( !maxYear || date.getFullYear() <= maxYear ) ); 11858 }, 11859 11860 /* Provide the configuration settings for formatting/parsing. */ 11861 _getFormatConfig: function( inst ) { 11862 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 11863 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 11864 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 11865 return { shortYearCutoff: shortYearCutoff, 11866 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 11867 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 11868 }, 11869 11870 /* Format the given date for display. */ 11871 _formatDate: function( inst, day, month, year ) { 11872 if ( !day ) { 11873 inst.currentDay = inst.selectedDay; 11874 inst.currentMonth = inst.selectedMonth; 11875 inst.currentYear = inst.selectedYear; 11876 } 11877 var date = ( day ? ( typeof day === "object" ? day : 11878 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 11879 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 11880 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 11881 } 11882} ); 11883 11884/* 11885 * Bind hover events for datepicker elements. 11886 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 11887 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 11888 */ 11889function datepicker_bindHover( dpDiv ) { 11890 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 11891 return dpDiv.on( "mouseout", selector, function() { 11892 $( this ).removeClass( "ui-state-hover" ); 11893 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 11894 $( this ).removeClass( "ui-datepicker-prev-hover" ); 11895 } 11896 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 11897 $( this ).removeClass( "ui-datepicker-next-hover" ); 11898 } 11899 } ) 11900 .on( "mouseover", selector, datepicker_handleMouseover ); 11901} 11902 11903function datepicker_handleMouseover() { 11904 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 11905 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 11906 $( this ).addClass( "ui-state-hover" ); 11907 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 11908 $( this ).addClass( "ui-datepicker-prev-hover" ); 11909 } 11910 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 11911 $( this ).addClass( "ui-datepicker-next-hover" ); 11912 } 11913 } 11914} 11915 11916/* jQuery extend now ignores nulls! */ 11917function datepicker_extendRemove( target, props ) { 11918 $.extend( target, props ); 11919 for ( var name in props ) { 11920 if ( props[ name ] == null ) { 11921 target[ name ] = props[ name ]; 11922 } 11923 } 11924 return target; 11925} 11926 11927/* Invoke the datepicker functionality. 11928 @param options string - a command, optionally followed by additional parameters or 11929 Object - settings for attaching new datepicker functionality 11930 @return jQuery object */ 11931$.fn.datepicker = function( options ) { 11932 11933 /* Verify an empty collection wasn't passed - Fixes #6976 */ 11934 if ( !this.length ) { 11935 return this; 11936 } 11937 11938 /* Initialise the date picker. */ 11939 if ( !$.datepicker.initialized ) { 11940 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 11941 $.datepicker.initialized = true; 11942 } 11943 11944 /* Append datepicker main container to body if not exist. */ 11945 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 11946 $( "body" ).append( $.datepicker.dpDiv ); 11947 } 11948 11949 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 11950 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 11951 return $.datepicker[ "_" + options + "Datepicker" ]. 11952 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 11953 } 11954 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 11955 return $.datepicker[ "_" + options + "Datepicker" ]. 11956 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 11957 } 11958 return this.each( function() { 11959 if ( typeof options === "string" ) { 11960 $.datepicker[ "_" + options + "Datepicker" ] 11961 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 11962 } else { 11963 $.datepicker._attachDatepicker( this, options ); 11964 } 11965 } ); 11966}; 11967 11968$.datepicker = new Datepicker(); // singleton instance 11969$.datepicker.initialized = false; 11970$.datepicker.uuid = new Date().getTime(); 11971$.datepicker.version = "1.13.
119710"; 11972 11973var widgetsDatepicker = $.datepicker; 11974 11975 11976/*! 11977 * jQuery UI Dialog 1.13.0 11978 * http://jqueryui.com 11979 * 11980 * Copyright jQuery Foundation and other contributors 11981 * Released under the MIT license. 11982 * http://jquery.org/license 11983 */ 11984 11985//>>label: Dialog 11986//>>group: Widgets 11987//>>description: Displays customizable dialog windows. 11988//>>docs: http://api.jqueryui.com/dialog/ 11989//>>demos: http://jqueryui.com/dialog/ 11990//>>css.structure: ../../themes/base/core.css 11991//>>css.structure: ../../themes/base/dialog.css 11992//>>css.theme: ../../themes/base/theme.css 11993 11994 11995$.widget( "ui.dialog", { 11996 version: "1.13.0
vendor: 20,928 bytes, lines 11996-12830
11996", 11997 options: { 11998 appendTo: "body", 11999 autoOpen: true, 12000 buttons: [], 12001 classes: { 12002 "ui-dialog": "ui-corner-all", 12003 "ui-dialog-titlebar": "ui-corner-all" 12004 }, 12005 closeOnEscape: true, 12006 closeText: "Close", 12007 draggable: true, 12008 hide: null, 12009 height: "auto", 12010 maxHeight: null, 12011 maxWidth: null, 12012 minHeight: 150, 12013 minWidth: 150, 12014 modal: false, 12015 position: { 12016 my: "center", 12017 at: "center", 12018 of: window, 12019 collision: "fit", 12020 12021 // Ensure the titlebar is always visible 12022 using: function( pos ) { 12023 var topOffset = $( this ).css( pos ).offset().top; 12024 if ( topOffset < 0 ) { 12025 $( this ).css( "top", pos.top - topOffset ); 12026 } 12027 } 12028 }, 12029 resizable: true, 12030 show: null, 12031 title: null, 12032 width: 300, 12033 12034 // Callbacks 12035 beforeClose: null, 12036 close: null, 12037 drag: null, 12038 dragStart: null, 12039 dragStop: null, 12040 focus: null, 12041 open: null, 12042 resize: null, 12043 resizeStart: null, 12044 resizeStop: null 12045 }, 12046 12047 sizeRelatedOptions: { 12048 buttons: true, 12049 height: true, 12050 maxHeight: true, 12051 maxWidth: true, 12052 minHeight: true, 12053 minWidth: true, 12054 width: true 12055 }, 12056 12057 resizableRelatedOptions: { 12058 maxHeight: true, 12059 maxWidth: true, 12060 minHeight: true, 12061 minWidth: true 12062 }, 12063 12064 _create: function() { 12065 this.originalCss = { 12066 display: this.element[ 0 ].style.display, 12067 width: this.element[ 0 ].style.width, 12068 minHeight: this.element[ 0 ].style.minHeight, 12069 maxHeight: this.element[ 0 ].style.maxHeight, 12070 height: this.element[ 0 ].style.height 12071 }; 12072 this.originalPosition = { 12073 parent: this.element.parent(), 12074 index: this.element.parent().children().index( this.element ) 12075 }; 12076 this.originalTitle = this.element.attr( "title" ); 12077 if ( this.options.title == null && this.originalTitle != null ) { 12078 this.options.title = this.originalTitle; 12079 } 12080 12081 // Dialogs can't be disabled 12082 if ( this.options.disabled ) { 12083 this.options.disabled = false; 12084 } 12085 12086 this._createWrapper(); 12087 12088 this.element 12089 .show() 12090 .removeAttr( "title" ) 12091 .appendTo( this.uiDialog ); 12092 12093 this._addClass( "ui-dialog-content", "ui-widget-content" ); 12094 12095 this._createTitlebar(); 12096 this._createButtonPane(); 12097 12098 if ( this.options.draggable && $.fn.draggable ) { 12099 this._makeDraggable(); 12100 } 12101 if ( this.options.resizable && $.fn.resizable ) { 12102 this._makeResizable(); 12103 } 12104 12105 this._isOpen = false; 12106 12107 this._trackFocus(); 12108 }, 12109 12110 _init: function() { 12111 if ( this.options.autoOpen ) { 12112 this.open(); 12113 } 12114 }, 12115 12116 _appendTo: function() { 12117 var element = this.options.appendTo; 12118 if ( element && ( element.jquery || element.nodeType ) ) { 12119 return $( element ); 12120 } 12121 return this.document.find( element || "body" ).eq( 0 ); 12122 }, 12123 12124 _destroy: function() { 12125 var next, 12126 originalPosition = this.originalPosition; 12127 12128 this._untrackInstance(); 12129 this._destroyOverlay(); 12130 12131 this.element 12132 .removeUniqueId() 12133 .css( this.originalCss ) 12134 12135 // Without detaching first, the following becomes really slow 12136 .detach(); 12137 12138 this.uiDialog.remove(); 12139 12140 if ( this.originalTitle ) { 12141 this.element.attr( "title", this.originalTitle ); 12142 } 12143 12144 next = originalPosition.parent.children().eq( originalPosition.index ); 12145 12146 // Don't try to place the dialog next to itself (#8613) 12147 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 12148 next.before( this.element ); 12149 } else { 12150 originalPosition.parent.append( this.element ); 12151 } 12152 }, 12153 12154 widget: function() { 12155 return this.uiDialog; 12156 }, 12157 12158 disable: $.noop, 12159 enable: $.noop, 12160 12161 close: function( event ) { 12162 var that = this; 12163 12164 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 12165 return; 12166 } 12167 12168 this._isOpen = false; 12169 this._focusedElement = null; 12170 this._destroyOverlay(); 12171 this._untrackInstance(); 12172 12173 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 12174 12175 // Hiding a focused element doesn't trigger blur in WebKit 12176 // so in case we have nothing to focus on, explicitly blur the active element 12177 // https://bugs.webkit.org/show_bug.cgi?id=47182 12178 $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12179 } 12180 12181 this._hide( this.uiDialog, this.options.hide, function() { 12182 that._trigger( "close", event ); 12183 } ); 12184 }, 12185 12186 isOpen: function() { 12187 return this._isOpen; 12188 }, 12189 12190 moveToTop: function() { 12191 this._moveToTop(); 12192 }, 12193 12194 _moveToTop: function( event, silent ) { 12195 var moved = false, 12196 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 12197 return +$( this ).css( "z-index" ); 12198 } ).get(), 12199 zIndexMax = Math.max.apply( null, zIndices ); 12200 12201 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 12202 this.uiDialog.css( "z-index", zIndexMax + 1 ); 12203 moved = true; 12204 } 12205 12206 if ( moved && !silent ) { 12207 this._trigger( "focus", event ); 12208 } 12209 return moved; 12210 }, 12211 12212 open: function() { 12213 var that = this; 12214 if ( this._isOpen ) { 12215 if ( this._moveToTop() ) { 12216 this._focusTabbable(); 12217 } 12218 return; 12219 } 12220 12221 this._isOpen = true; 12222 this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12223 12224 this._size(); 12225 this._position(); 12226 this._createOverlay(); 12227 this._moveToTop( null, true ); 12228 12229 // Ensure the overlay is moved to the top with the dialog, but only when 12230 // opening. The overlay shouldn't move after the dialog is open so that 12231 // modeless dialogs opened after the modal dialog stack properly. 12232 if ( this.overlay ) { 12233 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 12234 } 12235 12236 this._show( this.uiDialog, this.options.show, function() { 12237 that._focusTabbable(); 12238 that._trigger( "focus" ); 12239 } ); 12240 12241 // Track the dialog immediately upon opening in case a focus event 12242 // somehow occurs outside of the dialog before an element inside the 12243 // dialog is focused (#10152) 12244 this._makeFocusTarget(); 12245 12246 this._trigger( "open" ); 12247 }, 12248 12249 _focusTabbable: function() { 12250 12251 // Set focus to the first match: 12252 // 1. An element that was focused previously 12253 // 2. First element inside the dialog matching [autofocus] 12254 // 3. Tabbable element inside the content element 12255 // 4. Tabbable element inside the buttonpane 12256 // 5. The close button 12257 // 6. The dialog itself 12258 var hasFocus = this._focusedElement; 12259 if ( !hasFocus ) { 12260 hasFocus = this.element.find( "[autofocus]" ); 12261 } 12262 if ( !hasFocus.length ) { 12263 hasFocus = this.element.find( ":tabbable" ); 12264 } 12265 if ( !hasFocus.length ) { 12266 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 12267 } 12268 if ( !hasFocus.length ) { 12269 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 12270 } 12271 if ( !hasFocus.length ) { 12272 hasFocus = this.uiDialog; 12273 } 12274 hasFocus.eq( 0 ).trigger( "focus" ); 12275 }, 12276 12277 _restoreTabbableFocus: function() { 12278 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 12279 isActive = this.uiDialog[ 0 ] === activeElement || 12280 $.contains( this.uiDialog[ 0 ], activeElement ); 12281 if ( !isActive ) { 12282 this._focusTabbable(); 12283 } 12284 }, 12285 12286 _keepFocus: function( event ) { 12287 event.preventDefault(); 12288 this._restoreTabbableFocus(); 12289 12290 // support: IE 12291 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12292 // so we check again later 12293 this._delay( this._restoreTabbableFocus ); 12294 }, 12295 12296 _createWrapper: function() { 12297 this.uiDialog = $( "<div>" ) 12298 .hide() 12299 .attr( { 12300 12301 // Setting tabIndex makes the div focusable 12302 tabIndex: -1, 12303 role: "dialog" 12304 } ) 12305 .appendTo( this._appendTo() ); 12306 12307 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 12308 this._on( this.uiDialog, { 12309 keydown: function( event ) { 12310 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12311 event.keyCode === $.ui.keyCode.ESCAPE ) { 12312 event.preventDefault(); 12313 this.close( event ); 12314 return; 12315 } 12316 12317 // Prevent tabbing out of dialogs 12318 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 12319 return; 12320 } 12321 var tabbables = this.uiDialog.find( ":tabbable" ), 12322 first = tabbables.first(), 12323 last = tabbables.last(); 12324 12325 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 12326 !event.shiftKey ) { 12327 this._delay( function() { 12328 first.trigger( "focus" ); 12329 } ); 12330 event.preventDefault(); 12331 } else if ( ( event.target === first[ 0 ] || 12332 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 12333 this._delay( function() { 12334 last.trigger( "focus" ); 12335 } ); 12336 event.preventDefault(); 12337 } 12338 }, 12339 mousedown: function( event ) { 12340 if ( this._moveToTop( event ) ) { 12341 this._focusTabbable(); 12342 } 12343 } 12344 } ); 12345 12346 // We assume that any existing aria-describedby attribute means 12347 // that the dialog content is marked up properly 12348 // otherwise we brute force the content as the description 12349 if ( !this.element.find( "[aria-describedby]" ).length ) { 12350 this.uiDialog.attr( { 12351 "aria-describedby": this.element.uniqueId().attr( "id" ) 12352 } ); 12353 } 12354 }, 12355 12356 _createTitlebar: function() { 12357 var uiDialogTitle; 12358 12359 this.uiDialogTitlebar = $( "<div>" ); 12360 this._addClass( this.uiDialogTitlebar, 12361 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 12362 this._on( this.uiDialogTitlebar, { 12363 mousedown: function( event ) { 12364 12365 // Don't prevent click on close button (#8838) 12366 // Focusing a dialog that is partially scrolled out of view 12367 // causes the browser to scroll it into view, preventing the click event 12368 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 12369 12370 // Dialog isn't getting focus when dragging (#8063) 12371 this.uiDialog.trigger( "focus" ); 12372 } 12373 } 12374 } ); 12375 12376 // Support: IE 12377 // Use type="button" to prevent enter keypresses in textboxes from closing the 12378 // dialog in IE (#9312) 12379 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 12380 .button( { 12381 label: $( "<a>" ).text( this.options.closeText ).html(), 12382 icon: "ui-icon-closethick", 12383 showLabel: false 12384 } ) 12385 .appendTo( this.uiDialogTitlebar ); 12386 12387 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 12388 this._on( this.uiDialogTitlebarClose, { 12389 click: function( event ) { 12390 event.preventDefault(); 12391 this.close( event ); 12392 } 12393 } ); 12394 12395 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 12396 this._addClass( uiDialogTitle, "ui-dialog-title" ); 12397 this._title( uiDialogTitle ); 12398 12399 this.uiDialogTitlebar.prependTo( this.uiDialog ); 12400 12401 this.uiDialog.attr( { 12402 "aria-labelledby": uiDialogTitle.attr( "id" ) 12403 } ); 12404 }, 12405 12406 _title: function( title ) { 12407 if ( this.options.title ) { 12408 title.text( this.options.title ); 12409 } else { 12410 title.html( " " ); 12411 } 12412 }, 12413 12414 _createButtonPane: function() { 12415 this.uiDialogButtonPane = $( "<div>" ); 12416 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 12417 "ui-widget-content ui-helper-clearfix" ); 12418 12419 this.uiButtonSet = $( "<div>" ) 12420 .appendTo( this.uiDialogButtonPane ); 12421 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 12422 12423 this._createButtons(); 12424 }, 12425 12426 _createButtons: function() { 12427 var that = this, 12428 buttons = this.options.buttons; 12429 12430 // If we already have a button pane, remove it 12431 this.uiDialogButtonPane.remove(); 12432 this.uiButtonSet.empty(); 12433 12434 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 12435 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 12436 return; 12437 } 12438 12439 $.each( buttons, function( name, props ) { 12440 var click, buttonOptions; 12441 props = typeof props === "function" ? 12442 { click: props, text: name } : 12443 props; 12444 12445 // Default to a non-submitting button 12446 props = $.extend( { type: "button" }, props ); 12447 12448 // Change the context for the click callback to be the main element 12449 click = props.click; 12450 buttonOptions = { 12451 icon: props.icon, 12452 iconPosition: props.iconPosition, 12453 showLabel: props.showLabel, 12454 12455 // Deprecated options 12456 icons: props.icons, 12457 text: props.text 12458 }; 12459 12460 delete props.click; 12461 delete props.icon; 12462 delete props.iconPosition; 12463 delete props.showLabel; 12464 12465 // Deprecated options 12466 delete props.icons; 12467 if ( typeof props.text === "boolean" ) { 12468 delete props.text; 12469 } 12470 12471 $( "<button></button>", props ) 12472 .button( buttonOptions ) 12473 .appendTo( that.uiButtonSet ) 12474 .on( "click", function() { 12475 click.apply( that.element[ 0 ], arguments ); 12476 } ); 12477 } ); 12478 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 12479 this.uiDialogButtonPane.appendTo( this.uiDialog ); 12480 }, 12481 12482 _makeDraggable: function() { 12483 var that = this, 12484 options = this.options; 12485 12486 function filteredUi( ui ) { 12487 return { 12488 position: ui.position, 12489 offset: ui.offset 12490 }; 12491 } 12492 12493 this.uiDialog.draggable( { 12494 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12495 handle: ".ui-dialog-titlebar", 12496 containment: "document", 12497 start: function( event, ui ) { 12498 that._addClass( $( this ), "ui-dialog-dragging" ); 12499 that._blockFrames(); 12500 that._trigger( "dragStart", event, filteredUi( ui ) ); 12501 }, 12502 drag: function( event, ui ) { 12503 that._trigger( "drag", event, filteredUi( ui ) ); 12504 }, 12505 stop: function( event, ui ) { 12506 var left = ui.offset.left - that.document.scrollLeft(), 12507 top = ui.offset.top - that.document.scrollTop(); 12508 12509 options.position = { 12510 my: "left top", 12511 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12512 "top" + ( top >= 0 ? "+" : "" ) + top, 12513 of: that.window 12514 }; 12515 that._removeClass( $( this ), "ui-dialog-dragging" ); 12516 that._unblockFrames(); 12517 that._trigger( "dragStop", event, filteredUi( ui ) ); 12518 } 12519 } ); 12520 }, 12521 12522 _makeResizable: function() { 12523 var that = this, 12524 options = this.options, 12525 handles = options.resizable, 12526 12527 // .ui-resizable has position: relative defined in the stylesheet 12528 // but dialogs have to use absolute or fixed positioning 12529 position = this.uiDialog.css( "position" ), 12530 resizeHandles = typeof handles === "string" ? 12531 handles : 12532 "n,e,s,w,se,sw,ne,nw"; 12533 12534 function filteredUi( ui ) { 12535 return { 12536 originalPosition: ui.originalPosition, 12537 originalSize: ui.originalSize, 12538 position: ui.position, 12539 size: ui.size 12540 }; 12541 } 12542 12543 this.uiDialog.resizable( { 12544 cancel: ".ui-dialog-content", 12545 containment: "document", 12546 alsoResize: this.element, 12547 maxWidth: options.maxWidth, 12548 maxHeight: options.maxHeight, 12549 minWidth: options.minWidth, 12550 minHeight: this._minHeight(), 12551 handles: resizeHandles, 12552 start: function( event, ui ) { 12553 that._addClass( $( this ), "ui-dialog-resizing" ); 12554 that._blockFrames(); 12555 that._trigger( "resizeStart", event, filteredUi( ui ) ); 12556 }, 12557 resize: function( event, ui ) { 12558 that._trigger( "resize", event, filteredUi( ui ) ); 12559 }, 12560 stop: function( event, ui ) { 12561 var offset = that.uiDialog.offset(), 12562 left = offset.left - that.document.scrollLeft(), 12563 top = offset.top - that.document.scrollTop(); 12564 12565 options.height = that.uiDialog.height(); 12566 options.width = that.uiDialog.width(); 12567 options.position = { 12568 my: "left top", 12569 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12570 "top" + ( top >= 0 ? "+" : "" ) + top, 12571 of: that.window 12572 }; 12573 that._removeClass( $( this ), "ui-dialog-resizing" ); 12574 that._unblockFrames(); 12575 that._trigger( "resizeStop", event, filteredUi( ui ) ); 12576 } 12577 } ) 12578 .css( "position", position ); 12579 }, 12580 12581 _trackFocus: function() { 12582 this._on( this.widget(), { 12583 focusin: function( event ) { 12584 this._makeFocusTarget(); 12585 this._focusedElement = $( event.target ); 12586 } 12587 } ); 12588 }, 12589 12590 _makeFocusTarget: function() { 12591 this._untrackInstance(); 12592 this._trackingInstances().unshift( this ); 12593 }, 12594 12595 _untrackInstance: function() { 12596 var instances = this._trackingInstances(), 12597 exists = $.inArray( this, instances ); 12598 if ( exists !== -1 ) { 12599 instances.splice( exists, 1 ); 12600 } 12601 }, 12602 12603 _trackingInstances: function() { 12604 var instances = this.document.data( "ui-dialog-instances" ); 12605 if ( !instances ) { 12606 instances = []; 12607 this.document.data( "ui-dialog-instances", instances ); 12608 } 12609 return instances; 12610 }, 12611 12612 _minHeight: function() { 12613 var options = this.options; 12614 12615 return options.height === "auto" ? 12616 options.minHeight : 12617 Math.min( options.minHeight, options.height ); 12618 }, 12619 12620 _position: function() { 12621 12622 // Need to show the dialog to get the actual offset in the position plugin 12623 var isVisible = this.uiDialog.is( ":visible" ); 12624 if ( !isVisible ) { 12625 this.uiDialog.show(); 12626 } 12627 this.uiDialog.position( this.options.position ); 12628 if ( !isVisible ) { 12629 this.uiDialog.hide(); 12630 } 12631 }, 12632 12633 _setOptions: function( options ) { 12634 var that = this, 12635 resize = false, 12636 resizableOptions = {}; 12637 12638 $.each( options, function( key, value ) { 12639 that._setOption( key, value ); 12640 12641 if ( key in that.sizeRelatedOptions ) { 12642 resize = true; 12643 } 12644 if ( key in that.resizableRelatedOptions ) { 12645 resizableOptions[ key ] = value; 12646 } 12647 } ); 12648 12649 if ( resize ) { 12650 this._size(); 12651 this._position(); 12652 } 12653 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12654 this.uiDialog.resizable( "option", resizableOptions ); 12655 } 12656 }, 12657 12658 _setOption: function( key, value ) { 12659 var isDraggable, isResizable, 12660 uiDialog = this.uiDialog; 12661 12662 if ( key === "disabled" ) { 12663 return; 12664 } 12665 12666 this._super( key, value ); 12667 12668 if ( key === "appendTo" ) { 12669 this.uiDialog.appendTo( this._appendTo() ); 12670 } 12671 12672 if ( key === "buttons" ) { 12673 this._createButtons(); 12674 } 12675 12676 if ( key === "closeText" ) { 12677 this.uiDialogTitlebarClose.button( { 12678 12679 // Ensure that we always pass a string 12680 label: $( "<a>" ).text( "" + this.options.closeText ).html() 12681 } ); 12682 } 12683 12684 if ( key === "draggable" ) { 12685 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 12686 if ( isDraggable && !value ) { 12687 uiDialog.draggable( "destroy" ); 12688 } 12689 12690 if ( !isDraggable && value ) { 12691 this._makeDraggable(); 12692 } 12693 } 12694 12695 if ( key === "position" ) { 12696 this._position(); 12697 } 12698 12699 if ( key === "resizable" ) { 12700 12701 // currently resizable, becoming non-resizable 12702 isResizable = uiDialog.is( ":data(ui-resizable)" ); 12703 if ( isResizable && !value ) { 12704 uiDialog.resizable( "destroy" ); 12705 } 12706 12707 // Currently resizable, changing handles 12708 if ( isResizable && typeof value === "string" ) { 12709 uiDialog.resizable( "option", "handles", value ); 12710 } 12711 12712 // Currently non-resizable, becoming resizable 12713 if ( !isResizable && value !== false ) { 12714 this._makeResizable(); 12715 } 12716 } 12717 12718 if ( key === "title" ) { 12719 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 12720 } 12721 }, 12722 12723 _size: function() { 12724 12725 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12726 // divs will both have width and height set, so we need to reset them 12727 var nonContentHeight, minContentHeight, maxContentHeight, 12728 options = this.options; 12729 12730 // Reset content sizing 12731 this.element.show().css( { 12732 width: "auto", 12733 minHeight: 0, 12734 maxHeight: "none", 12735 height: 0 12736 } ); 12737 12738 if ( options.minWidth > options.width ) { 12739 options.width = options.minWidth; 12740 } 12741 12742 // Reset wrapper sizing 12743 // determine the height of all the non-content elements 12744 nonContentHeight = this.uiDialog.css( { 12745 height: "auto", 12746 width: options.width 12747 } ) 12748 .outerHeight(); 12749 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 12750 maxContentHeight = typeof options.maxHeight === "number" ? 12751 Math.max( 0, options.maxHeight - nonContentHeight ) : 12752 "none"; 12753 12754 if ( options.height === "auto" ) { 12755 this.element.css( { 12756 minHeight: minContentHeight, 12757 maxHeight: maxContentHeight, 12758 height: "auto" 12759 } ); 12760 } else { 12761 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 12762 } 12763 12764 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12765 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 12766 } 12767 }, 12768 12769 _blockFrames: function() { 12770 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 12771 var iframe = $( this ); 12772 12773 return $( "<div>" ) 12774 .css( { 12775 position: "absolute", 12776 width: iframe.outerWidth(), 12777 height: iframe.outerHeight() 12778 } ) 12779 .appendTo( iframe.parent() ) 12780 .offset( iframe.offset() )[ 0 ]; 12781 } ); 12782 }, 12783 12784 _unblockFrames: function() { 12785 if ( this.iframeBlocks ) { 12786 this.iframeBlocks.remove(); 12787 delete this.iframeBlocks; 12788 } 12789 }, 12790 12791 _allowInteraction: function( event ) { 12792 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 12793 return true; 12794 } 12795 12796 // TODO: Remove hack when datepicker implements 12797 // the .ui-front logic (#8989) 12798 return !!$( event.target ).closest( ".ui-datepicker" ).length; 12799 }, 12800 12801 _createOverlay: function() { 12802 if ( !this.options.modal ) { 12803 return; 12804 } 12805 12806 var jqMinor = $.fn.jquery.substring( 0, 4 ); 12807 12808 // We use a delay in case the overlay is created from an 12809 // event that we're going to be cancelling (#2804) 12810 var isOpening = true; 12811 this._delay( function() { 12812 isOpening = false; 12813 } ); 12814 12815 if ( !this.document.data( "ui-dialog-overlays" ) ) { 12816 12817 // Prevent use of anchors and inputs 12818 // This doesn't use `_on()` because it is a shared event handler 12819 // across all open modal dialogs. 12820 this.document.on( "focusin.ui-dialog", function( event ) { 12821 if ( isOpening ) { 12822 return; 12823 } 12824 12825 var instance = this._trackingInstances()[ 0 ]; 12826 if ( !instance._allowInteraction( event ) ) { 12827 event.preventDefault(); 12828 instance._focusTabbable(); 12829 12830 // Support: jQuery >=3.4 <3.
vendor: 3,764 bytes, lines 12830-12980
128306 only 12831 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 12832 // have its focus event propagated last, breaking the re-targeting. 12833 // Trigger focus in a delay in addition if needed to avoid the issue 12834 // See https://github.com/jquery/jquery/issues/4382 12835 if ( jqMinor === "3.4." || jqMinor === "3.5." ) { 12836 instance._delay( instance._restoreTabbableFocus ); 12837 } 12838 } 12839 }.bind( this ) ); 12840 } 12841 12842 this.overlay = $( "<div>" ) 12843 .appendTo( this._appendTo() ); 12844 12845 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 12846 this._on( this.overlay, { 12847 mousedown: "_keepFocus" 12848 } ); 12849 this.document.data( "ui-dialog-overlays", 12850 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 12851 }, 12852 12853 _destroyOverlay: function() { 12854 if ( !this.options.modal ) { 12855 return; 12856 } 12857 12858 if ( this.overlay ) { 12859 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 12860 12861 if ( !overlays ) { 12862 this.document.off( "focusin.ui-dialog" ); 12863 this.document.removeData( "ui-dialog-overlays" ); 12864 } else { 12865 this.document.data( "ui-dialog-overlays", overlays ); 12866 } 12867 12868 this.overlay.remove(); 12869 this.overlay = null; 12870 } 12871 } 12872} ); 12873 12874// DEPRECATED 12875// TODO: switch return back to widget declaration at top of file when this is removed 12876if ( $.uiBackCompat !== false ) { 12877 12878 // Backcompat for dialogClass option 12879 $.widget( "ui.dialog", $.ui.dialog, { 12880 options: { 12881 dialogClass: "" 12882 }, 12883 _createWrapper: function() { 12884 this._super(); 12885 this.uiDialog.addClass( this.options.dialogClass ); 12886 }, 12887 _setOption: function( key, value ) { 12888 if ( key === "dialogClass" ) { 12889 this.uiDialog 12890 .removeClass( this.options.dialogClass ) 12891 .addClass( value ); 12892 } 12893 this._superApply( arguments ); 12894 } 12895 } ); 12896} 12897 12898var widgetsDialog = $.ui.dialog; 12899 12900 12901/*! 12902 * jQuery UI Progressbar 1.13.0 12903 * http://jqueryui.com 12904 * 12905 * Copyright jQuery Foundation and other contributors 12906 * Released under the MIT license. 12907 * http://jquery.org/license 12908 */ 12909 12910//>>label: Progressbar 12911//>>group: Widgets 12912/* eslint-disable max-len */ 12913//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 12914/* eslint-enable max-len */ 12915//>>docs: http://api.jqueryui.com/progressbar/ 12916//>>demos: http://jqueryui.com/progressbar/ 12917//>>css.structure: ../../themes/base/core.css 12918//>>css.structure: ../../themes/base/progressbar.css 12919//>>css.theme: ../../themes/base/theme.css 12920 12921 12922var widgetsProgressbar = $.widget( "ui.progressbar", { 12923 version: "1.13.0", 12924 options: { 12925 classes: { 12926 "ui-progressbar": "ui-corner-all", 12927 "ui-progressbar-value": "ui-corner-left", 12928 "ui-progressbar-complete": "ui-corner-right" 12929 }, 12930 max: 100, 12931 value: 0, 12932 12933 change: null, 12934 complete: null 12935 }, 12936 12937 min: 0, 12938 12939 _create: function() { 12940 12941 // Constrain initial value 12942 this.oldValue = this.options.value = this._constrainedValue(); 12943 12944 this.element.attr( { 12945 12946 // Only set static values; aria-valuenow and aria-valuemax are 12947 // set inside _refreshValue() 12948 role: "progressbar", 12949 "aria-valuemin": this.min 12950 } ); 12951 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 12952 12953 this.valueDiv = $( "<div>" ).appendTo( this.element ); 12954 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 12955 this._refreshValue(); 12956 }, 12957 12958 _destroy: function() { 12959 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 12960 12961 this.valueDiv.remove(); 12962 }, 12963 12964 value: function( newValue ) { 12965 if ( newValue === undefined ) { 12966 return this.options.value; 12967 } 12968 12969 this.options.value = this._constrainedValue( newValue ); 12970 this._refreshValue(); 12971 }, 12972 12973 _constrainedValue: function( newValue ) { 12974 if ( newValue === undefined ) { 12975 newValue = this.options.value; 12976 } 12977 12978 this.indeterminate = newValue === false; 12979 12980 // Sanitize value
vendor: 5,670 bytes, lines 12981-13209
12981 if ( typeof newValue !== "number" ) { 12982 newValue = 0; 12983 } 12984 12985 return this.indeterminate ? false : 12986 Math.min( this.options.max, Math.max( this.min, newValue ) ); 12987 }, 12988 12989 _setOptions: function( options ) { 12990 12991 // Ensure "value" option is set after other values (like max) 12992 var value = options.value; 12993 delete options.value; 12994 12995 this._super( options ); 12996 12997 this.options.value = this._constrainedValue( value ); 12998 this._refreshValue(); 12999 }, 13000 13001 _setOption: function( key, value ) { 13002 if ( key === "max" ) { 13003 13004 // Don't allow a max less than min 13005 value = Math.max( this.min, value ); 13006 } 13007 this._super( key, value ); 13008 }, 13009 13010 _setOptionDisabled: function( value ) { 13011 this._super( value ); 13012 13013 this.element.attr( "aria-disabled", value ); 13014 this._toggleClass( null, "ui-state-disabled", !!value ); 13015 }, 13016 13017 _percentage: function() { 13018 return this.indeterminate ? 13019 100 : 13020 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 13021 }, 13022 13023 _refreshValue: function() { 13024 var value = this.options.value, 13025 percentage = this._percentage(); 13026 13027 this.valueDiv 13028 .toggle( this.indeterminate || value > this.min ) 13029 .width( percentage.toFixed( 0 ) + "%" ); 13030 13031 this 13032 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 13033 value === this.options.max ) 13034 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 13035 13036 if ( this.indeterminate ) { 13037 this.element.removeAttr( "aria-valuenow" ); 13038 if ( !this.overlayDiv ) { 13039 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 13040 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 13041 } 13042 } else { 13043 this.element.attr( { 13044 "aria-valuemax": this.options.max, 13045 "aria-valuenow": value 13046 } ); 13047 if ( this.overlayDiv ) { 13048 this.overlayDiv.remove(); 13049 this.overlayDiv = null; 13050 } 13051 } 13052 13053 if ( this.oldValue !== value ) { 13054 this.oldValue = value; 13055 this._trigger( "change" ); 13056 } 13057 if ( value === this.options.max ) { 13058 this._trigger( "complete" ); 13059 } 13060 } 13061} ); 13062 13063 13064/*! 13065 * jQuery UI Selectmenu 1.13.0 13066 * http://jqueryui.com 13067 * 13068 * Copyright jQuery Foundation and other contributors 13069 * Released under the MIT license. 13070 * http://jquery.org/license 13071 */ 13072 13073//>>label: Selectmenu 13074//>>group: Widgets 13075/* eslint-disable max-len */ 13076//>>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. 13077/* eslint-enable max-len */ 13078//>>docs: http://api.jqueryui.com/selectmenu/ 13079//>>demos: http://jqueryui.com/selectmenu/ 13080//>>css.structure: ../../themes/base/core.css 13081//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 13082//>>css.theme: ../../themes/base/theme.css 13083 13084 13085var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 13086 version: "1.13.0", 13087 defaultElement: "<select>", 13088 options: { 13089 appendTo: null, 13090 classes: { 13091 "ui-selectmenu-button-open": "ui-corner-top", 13092 "ui-selectmenu-button-closed": "ui-corner-all" 13093 }, 13094 disabled: null, 13095 icons: { 13096 button: "ui-icon-triangle-1-s" 13097 }, 13098 position: { 13099 my: "left top", 13100 at: "left bottom", 13101 collision: "none" 13102 }, 13103 width: false, 13104 13105 // Callbacks 13106 change: null, 13107 close: null, 13108 focus: null, 13109 open: null, 13110 select: null 13111 }, 13112 13113 _create: function() { 13114 var selectmenuId = this.element.uniqueId().attr( "id" ); 13115 this.ids = { 13116 element: selectmenuId, 13117 button: selectmenuId + "-button", 13118 menu: selectmenuId + "-menu" 13119 }; 13120 13121 this._drawButton(); 13122 this._drawMenu(); 13123 this._bindFormResetHandler(); 13124 13125 this._rendered = false; 13126 this.menuItems = $(); 13127 }, 13128 13129 _drawButton: function() { 13130 var icon, 13131 that = this, 13132 item = this._parseOption( 13133 this.element.find( "option:selected" ), 13134 this.element[ 0 ].selectedIndex 13135 ); 13136 13137 // Associate existing label with the new button 13138 this.labels = this.element.labels().attr( "for", this.ids.button ); 13139 this._on( this.labels, { 13140 click: function( event ) { 13141 this.button.trigger( "focus" ); 13142 event.preventDefault(); 13143 } 13144 } ); 13145 13146 // Hide original select element 13147 this.element.hide(); 13148 13149 // Create button 13150 this.button = $( "<span>", { 13151 tabindex: this.options.disabled ? -1 : 0, 13152 id: this.ids.button, 13153 role: "combobox", 13154 "aria-expanded": "false", 13155 "aria-autocomplete": "list", 13156 "aria-owns": this.ids.menu, 13157 "aria-haspopup": "true", 13158 title: this.element.attr( "title" ) 13159 } ) 13160 .insertAfter( this.element ); 13161 13162 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 13163 "ui-button ui-widget" ); 13164 13165 icon = $( "<span>" ).appendTo( this.button ); 13166 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 13167 this.buttonItem = this._renderButtonItem( item ) 13168 .appendTo( this.button ); 13169 13170 if ( this.options.width !== false ) { 13171 this._resizeButton(); 13172 } 13173 13174 this._on( this.button, this._buttonEvents ); 13175 this.button.one( "focusin", function() { 13176 13177 // Delay rendering the menu items until the button receives focus. 13178 // The menu may have already been rendered via a programmatic open. 13179 if ( !that._rendered ) { 13180 that._refreshMenu(); 13181 } 13182 } ); 13183 }, 13184 13185 _drawMenu: function() { 13186 var that = this; 13187 13188 // Create menu 13189 this.menu = $( "<ul>", { 13190 "aria-hidden": "true", 13191 "aria-labelledby": this.ids.button, 13192 id: this.ids.menu 13193 } ); 13194 13195 // Wrap menu 13196 this.menuWrap = $( "<div>" ).append( this.menu ); 13197 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 13198 this.menuWrap.appendTo( this._appendTo() ); 13199 13200 // Initialize menu widget 13201 this.menuInstance = this.menu 13202 .menu( { 13203 classes: { 13204 "ui-menu": "ui-corner-bottom" 13205 }, 13206 role: "listbox", 13207 select: function( event, ui ) { 13208 event.preventDefault(); 13209
vendor: 5,595 bytes, lines 13210-13450
13210 // Support: IE8 13211 // If the item was selected via a click, the text selection 13212 // will be destroyed in IE 13213 that._setSelection(); 13214 13215 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 13216 }, 13217 focus: function( event, ui ) { 13218 var item = ui.item.data( "ui-selectmenu-item" ); 13219 13220 // Prevent inital focus from firing and check if its a newly focused item 13221 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 13222 that._trigger( "focus", event, { item: item } ); 13223 if ( !that.isOpen ) { 13224 that._select( item, event ); 13225 } 13226 } 13227 that.focusIndex = item.index; 13228 13229 that.button.attr( "aria-activedescendant", 13230 that.menuItems.eq( item.index ).attr( "id" ) ); 13231 } 13232 } ) 13233 .menu( "instance" ); 13234 13235 // Don't close the menu on mouseleave 13236 this.menuInstance._off( this.menu, "mouseleave" ); 13237 13238 // Cancel the menu's collapseAll on document click 13239 this.menuInstance._closeOnDocumentClick = function() { 13240 return false; 13241 }; 13242 13243 // Selects often contain empty items, but never contain dividers 13244 this.menuInstance._isDivider = function() { 13245 return false; 13246 }; 13247 }, 13248 13249 refresh: function() { 13250 this._refreshMenu(); 13251 this.buttonItem.replaceWith( 13252 this.buttonItem = this._renderButtonItem( 13253 13254 // Fall back to an empty object in case there are no options 13255 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 13256 ) 13257 ); 13258 if ( this.options.width === null ) { 13259 this._resizeButton(); 13260 } 13261 }, 13262 13263 _refreshMenu: function() { 13264 var item, 13265 options = this.element.find( "option" ); 13266 13267 this.menu.empty(); 13268 13269 this._parseOptions( options ); 13270 this._renderMenu( this.menu, this.items ); 13271 13272 this.menuInstance.refresh(); 13273 this.menuItems = this.menu.find( "li" ) 13274 .not( ".ui-selectmenu-optgroup" ) 13275 .find( ".ui-menu-item-wrapper" ); 13276 13277 this._rendered = true; 13278 13279 if ( !options.length ) { 13280 return; 13281 } 13282 13283 item = this._getSelectedItem(); 13284 13285 // Update the menu to have the correct item focused 13286 this.menuInstance.focus( null, item ); 13287 this._setAria( item.data( "ui-selectmenu-item" ) ); 13288 13289 // Set disabled state 13290 this._setOption( "disabled", this.element.prop( "disabled" ) ); 13291 }, 13292 13293 open: function( event ) { 13294 if ( this.options.disabled ) { 13295 return; 13296 } 13297 13298 // If this is the first time the menu is being opened, render the items 13299 if ( !this._rendered ) { 13300 this._refreshMenu(); 13301 } else { 13302 13303 // Menu clears focus on close, reset focus to selected item 13304 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 13305 this.menuInstance.focus( null, this._getSelectedItem() ); 13306 } 13307 13308 // If there are no options, don't open the menu 13309 if ( !this.menuItems.length ) { 13310 return; 13311 } 13312 13313 this.isOpen = true; 13314 this._toggleAttr(); 13315 this._resizeMenu(); 13316 this._position(); 13317 13318 this._on( this.document, this._documentClick ); 13319 13320 this._trigger( "open", event ); 13321 }, 13322 13323 _position: function() { 13324 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 13325 }, 13326 13327 close: function( event ) { 13328 if ( !this.isOpen ) { 13329 return; 13330 } 13331 13332 this.isOpen = false; 13333 this._toggleAttr(); 13334 13335 this.range = null; 13336 this._off( this.document ); 13337 13338 this._trigger( "close", event ); 13339 }, 13340 13341 widget: function() { 13342 return this.button; 13343 }, 13344 13345 menuWidget: function() { 13346 return this.menu; 13347 }, 13348 13349 _renderButtonItem: function( item ) { 13350 var buttonItem = $( "<span>" ); 13351 13352 this._setText( buttonItem, item.label ); 13353 this._addClass( buttonItem, "ui-selectmenu-text" ); 13354 13355 return buttonItem; 13356 }, 13357 13358 _renderMenu: function( ul, items ) { 13359 var that = this, 13360 currentOptgroup = ""; 13361 13362 $.each( items, function( index, item ) { 13363 var li; 13364 13365 if ( item.optgroup !== currentOptgroup ) { 13366 li = $( "<li>", { 13367 text: item.optgroup 13368 } ); 13369 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 13370 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 13371 " ui-state-disabled" : 13372 "" ) ); 13373 13374 li.appendTo( ul ); 13375 13376 currentOptgroup = item.optgroup; 13377 } 13378 13379 that._renderItemData( ul, item ); 13380 } ); 13381 }, 13382 13383 _renderItemData: function( ul, item ) { 13384 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 13385 }, 13386 13387 _renderItem: function( ul, item ) { 13388 var li = $( "<li>" ), 13389 wrapper = $( "<div>", { 13390 title: item.element.attr( "title" ) 13391 } ); 13392 13393 if ( item.disabled ) { 13394 this._addClass( li, null, "ui-state-disabled" ); 13395 } 13396 this._setText( wrapper, item.label ); 13397 13398 return li.append( wrapper ).appendTo( ul ); 13399 }, 13400 13401 _setText: function( element, value ) { 13402 if ( value ) { 13403 element.text( value ); 13404 } else { 13405 element.html( " " ); 13406 } 13407 }, 13408 13409 _move: function( direction, event ) { 13410 var item, next, 13411 filter = ".ui-menu-item"; 13412 13413 if ( this.isOpen ) { 13414 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 13415 } else { 13416 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 13417 filter += ":not(.ui-state-disabled)"; 13418 } 13419 13420 if ( direction === "first" || direction === "last" ) { 13421 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 13422 } else { 13423 next = item[ direction + "All" ]( filter ).eq( 0 ); 13424 } 13425 13426 if ( next.length ) { 13427 this.menuInstance.focus( event, next ); 13428 } 13429 }, 13430 13431 _getSelectedItem: function() { 13432 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 13433 }, 13434 13435 _toggle: function( event ) { 13436 this[ this.isOpen ? "close" : "open" ]( event ); 13437 }, 13438 13439 _setSelection: function() { 13440 var selection; 13441 13442 if ( !this.range ) { 13443 return; 13444 } 13445 13446 if ( window.getSelection ) { 13447 selection = window.getSelection(); 13448 selection.removeAllRanges(); 13449 selection.addRange( this.range ); 13450
13451 // Support: IE8 13452 } else { 13453 this.range.select(); 13454 } 13455 13456 // Support: IE 13457 // Setting the text selection kills the button focus in IE, but 13458 // restoring the focus doesn't kill the selection. 13459 this.button.focus(); 13460 }, 13461 13462 _documentClick: { 13463 mousedown: function( event ) { 13464 if ( !this.isOpen ) { 13465 return; 13466 } 13467 13468 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 13469 $
vendor: 5,493 bytes, lines 13469-13700
13469.escapeSelector( this.ids.button ) ).length ) { 13470 this.close( event ); 13471 } 13472 } 13473 }, 13474 13475 _buttonEvents: { 13476 13477 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 13478 mousedown: function() { 13479 var selection; 13480 13481 if ( window.getSelection ) { 13482 selection = window.getSelection(); 13483 if ( selection.rangeCount ) { 13484 this.range = selection.getRangeAt( 0 ); 13485 } 13486 13487 // Support: IE8 13488 } else { 13489 this.range = document.selection.createRange(); 13490 } 13491 }, 13492 13493 click: function( event ) { 13494 this._setSelection(); 13495 this._toggle( event ); 13496 }, 13497 13498 keydown: function( event ) { 13499 var preventDefault = true; 13500 switch ( event.keyCode ) { 13501 case $.ui.keyCode.TAB: 13502 case $.ui.keyCode.ESCAPE: 13503 this.close( event ); 13504 preventDefault = false; 13505 break; 13506 case $.ui.keyCode.ENTER: 13507 if ( this.isOpen ) { 13508 this._selectFocusedItem( event ); 13509 } 13510 break; 13511 case $.ui.keyCode.UP: 13512 if ( event.altKey ) { 13513 this._toggle( event ); 13514 } else { 13515 this._move( "prev", event ); 13516 } 13517 break; 13518 case $.ui.keyCode.DOWN: 13519 if ( event.altKey ) { 13520 this._toggle( event ); 13521 } else { 13522 this._move( "next", event ); 13523 } 13524 break; 13525 case $.ui.keyCode.SPACE: 13526 if ( this.isOpen ) { 13527 this._selectFocusedItem( event ); 13528 } else { 13529 this._toggle( event ); 13530 } 13531 break; 13532 case $.ui.keyCode.LEFT: 13533 this._move( "prev", event ); 13534 break; 13535 case $.ui.keyCode.RIGHT: 13536 this._move( "next", event ); 13537 break; 13538 case $.ui.keyCode.HOME: 13539 case $.ui.keyCode.PAGE_UP: 13540 this._move( "first", event ); 13541 break; 13542 case $.ui.keyCode.END: 13543 case $.ui.keyCode.PAGE_DOWN: 13544 this._move( "last", event ); 13545 break; 13546 default: 13547 this.menu.trigger( event ); 13548 preventDefault = false; 13549 } 13550 13551 if ( preventDefault ) { 13552 event.preventDefault(); 13553 } 13554 } 13555 }, 13556 13557 _selectFocusedItem: function( event ) { 13558 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 13559 if ( !item.hasClass( "ui-state-disabled" ) ) { 13560 this._select( item.data( "ui-selectmenu-item" ), event ); 13561 } 13562 }, 13563 13564 _select: function( item, event ) { 13565 var oldIndex = this.element[ 0 ].selectedIndex; 13566 13567 // Change native select element 13568 this.element[ 0 ].selectedIndex = item.index; 13569 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 13570 this._setAria( item ); 13571 this._trigger( "select", event, { item: item } ); 13572 13573 if ( item.index !== oldIndex ) { 13574 this._trigger( "change", event, { item: item } ); 13575 } 13576 13577 this.close( event ); 13578 }, 13579 13580 _setAria: function( item ) { 13581 var id = this.menuItems.eq( item.index ).attr( "id" ); 13582 13583 this.button.attr( { 13584 "aria-labelledby": id, 13585 "aria-activedescendant": id 13586 } ); 13587 this.menu.attr( "aria-activedescendant", id ); 13588 }, 13589 13590 _setOption: function( key, value ) { 13591 if ( key === "icons" ) { 13592 var icon = this.button.find( "span.ui-icon" ); 13593 this._removeClass( icon, null, this.options.icons.button ) 13594 ._addClass( icon, null, value.button ); 13595 } 13596 13597 this._super( key, value ); 13598 13599 if ( key === "appendTo" ) { 13600 this.menuWrap.appendTo( this._appendTo() ); 13601 } 13602 13603 if ( key === "width" ) { 13604 this._resizeButton(); 13605 } 13606 }, 13607 13608 _setOptionDisabled: function( value ) { 13609 this._super( value ); 13610 13611 this.menuInstance.option( "disabled", value ); 13612 this.button.attr( "aria-disabled", value ); 13613 this._toggleClass( this.button, null, "ui-state-disabled", value ); 13614 13615 this.element.prop( "disabled", value ); 13616 if ( value ) { 13617 this.button.attr( "tabindex", -1 ); 13618 this.close(); 13619 } else { 13620 this.button.attr( "tabindex", 0 ); 13621 } 13622 }, 13623 13624 _appendTo: function() { 13625 var element = this.options.appendTo; 13626 13627 if ( element ) { 13628 element = element.jquery || element.nodeType ? 13629 $( element ) : 13630 this.document.find( element ).eq( 0 ); 13631 } 13632 13633 if ( !element || !element[ 0 ] ) { 13634 element = this.element.closest( ".ui-front, dialog" ); 13635 } 13636 13637 if ( !element.length ) { 13638 element = this.document[ 0 ].body; 13639 } 13640 13641 return element; 13642 }, 13643 13644 _toggleAttr: function() { 13645 this.button.attr( "aria-expanded", this.isOpen ); 13646 13647 // We can't use two _toggleClass() calls here, because we need to make sure 13648 // we always remove classes first and add them second, otherwise if both classes have the 13649 // same theme class, it will be removed after we add it. 13650 this._removeClass( this.button, "ui-selectmenu-button-" + 13651 ( this.isOpen ? "closed" : "open" ) ) 13652 ._addClass( this.button, "ui-selectmenu-button-" + 13653 ( this.isOpen ? "open" : "closed" ) ) 13654 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 13655 13656 this.menu.attr( "aria-hidden", !this.isOpen ); 13657 }, 13658 13659 _resizeButton: function() { 13660 var width = this.options.width; 13661 13662 // For `width: false`, just remove inline style and stop 13663 if ( width === false ) { 13664 this.button.css( "width", "" ); 13665 return; 13666 } 13667 13668 // For `width: null`, match the width of the original element 13669 if ( width === null ) { 13670 width = this.element.show().outerWidth(); 13671 this.element.hide(); 13672 } 13673 13674 this.button.outerWidth( width ); 13675 }, 13676 13677 _resizeMenu: function() { 13678 this.menu.outerWidth( Math.max( 13679 this.button.outerWidth(), 13680 13681 // Support: IE10 13682 // IE10 wraps long text (possibly a rounding bug) 13683 // so we add 1px to avoid the wrapping 13684 this.menu.width( "" ).outerWidth() + 1 13685 ) ); 13686 }, 13687 13688 _getCreateOptions: function() { 13689 var options = this._super(); 13690 13691 options.disabled = this.element.prop( "disabled" ); 13692 13693 return options; 13694 }, 13695 13696 _parseOptions: function( options ) { 13697 var that = this, 13698 data = []; 13699 options.each( function( index, item ) { 13700
vendor: 3,668 bytes, lines 13700-13850
13700if ( item.hidden ) { 13701 return; 13702 } 13703 13704 data.push( that._parseOption( $( item ), index ) ); 13705 } ); 13706 this.items = data; 13707 }, 13708 13709 _parseOption: function( option, index ) { 13710 var optgroup = option.parent( "optgroup" ); 13711 13712 return { 13713 element: option, 13714 index: index, 13715 value: option.val(), 13716 label: option.text(), 13717 optgroup: optgroup.attr( "label" ) || "", 13718 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 13719 }; 13720 }, 13721 13722 _destroy: function() { 13723 this._unbindFormResetHandler(); 13724 this.menuWrap.remove(); 13725 this.button.remove(); 13726 this.element.show(); 13727 this.element.removeUniqueId(); 13728 this.labels.attr( "for", this.ids.element ); 13729 } 13730} ] ); 13731 13732 13733/*! 13734 * jQuery UI Slider 1.13.0 13735 * http://jqueryui.com 13736 * 13737 * Copyright jQuery Foundation and other contributors 13738 * Released under the MIT license. 13739 * http://jquery.org/license 13740 */ 13741 13742//>>label: Slider 13743//>>group: Widgets 13744//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 13745//>>docs: http://api.jqueryui.com/slider/ 13746//>>demos: http://jqueryui.com/slider/ 13747//>>css.structure: ../../themes/base/core.css 13748//>>css.structure: ../../themes/base/slider.css 13749//>>css.theme: ../../themes/base/theme.css 13750 13751 13752var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { 13753 version: "1.13.0", 13754 widgetEventPrefix: "slide", 13755 13756 options: { 13757 animate: false, 13758 classes: { 13759 "ui-slider": "ui-corner-all", 13760 "ui-slider-handle": "ui-corner-all", 13761 13762 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 13763 // element, but worked best visually with a variety of themes 13764 "ui-slider-range": "ui-corner-all ui-widget-header" 13765 }, 13766 distance: 0, 13767 max: 100, 13768 min: 0, 13769 orientation: "horizontal", 13770 range: false, 13771 step: 1, 13772 value: 0, 13773 values: null, 13774 13775 // Callbacks 13776 change: null, 13777 slide: null, 13778 start: null, 13779 stop: null 13780 }, 13781 13782 // Number of pages in a slider 13783 // (how many times can you page up/down to go through the whole range) 13784 numPages: 5, 13785 13786 _create: function() { 13787 this._keySliding = false; 13788 this._mouseSliding = false; 13789 this._animateOff = true; 13790 this._handleIndex = null; 13791 this._detectOrientation(); 13792 this._mouseInit(); 13793 this._calculateNewMax(); 13794 13795 this._addClass( "ui-slider ui-slider-" + this.orientation, 13796 "ui-widget ui-widget-content" ); 13797 13798 this._refresh(); 13799 13800 this._animateOff = false; 13801 }, 13802 13803 _refresh: function() { 13804 this._createRange(); 13805 this._createHandles(); 13806 this._setupEvents(); 13807 this._refreshValue(); 13808 }, 13809 13810 _createHandles: function() { 13811 var i, handleCount, 13812 options = this.options, 13813 existingHandles = this.element.find( ".ui-slider-handle" ), 13814 handle = "<span tabindex='0'></span>", 13815 handles = []; 13816 13817 handleCount = ( options.values && options.values.length ) || 1; 13818 13819 if ( existingHandles.length > handleCount ) { 13820 existingHandles.slice( handleCount ).remove(); 13821 existingHandles = existingHandles.slice( 0, handleCount ); 13822 } 13823 13824 for ( i = existingHandles.length; i < handleCount; i++ ) { 13825 handles.push( handle ); 13826 } 13827 13828 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 13829 13830 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 13831 13832 this.handle = this.handles.eq( 0 ); 13833 13834 this.handles.each( function( i ) { 13835 $( this ) 13836 .data( "ui-slider-handle-index", i ) 13837 .attr( "tabIndex", 0 ); 13838 } ); 13839 }, 13840 13841 _createRange: function() { 13842 var options = this.options; 13843 13844 if ( options.range ) { 13845 if ( options.range === true ) { 13846 if ( !options.values ) { 13847 options.values = [ this._valueMin(), this._valueMin() ]; 13848 } else if ( options.values.length && options.values.length !== 2 ) { 13849 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 13850 } else if ( Array
vendor: 6,343 bytes, lines 13850-14096
13850.isArray( options.values ) ) { 13851 options.values = options.values.slice( 0 ); 13852 } 13853 } 13854 13855 if ( !this.range || !this.range.length ) { 13856 this.range = $( "<div>" ) 13857 .appendTo( this.element ); 13858 13859 this._addClass( this.range, "ui-slider-range" ); 13860 } else { 13861 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 13862 13863 // Handle range switching from true to min/max 13864 this.range.css( { 13865 "left": "", 13866 "bottom": "" 13867 } ); 13868 } 13869 if ( options.range === "min" || options.range === "max" ) { 13870 this._addClass( this.range, "ui-slider-range-" + options.range ); 13871 } 13872 } else { 13873 if ( this.range ) { 13874 this.range.remove(); 13875 } 13876 this.range = null; 13877 } 13878 }, 13879 13880 _setupEvents: function() { 13881 this._off( this.handles ); 13882 this._on( this.handles, this._handleEvents ); 13883 this._hoverable( this.handles ); 13884 this._focusable( this.handles ); 13885 }, 13886 13887 _destroy: function() { 13888 this.handles.remove(); 13889 if ( this.range ) { 13890 this.range.remove(); 13891 } 13892 13893 this._mouseDestroy(); 13894 }, 13895 13896 _mouseCapture: function( event ) { 13897 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 13898 that = this, 13899 o = this.options; 13900 13901 if ( o.disabled ) { 13902 return false; 13903 } 13904 13905 this.elementSize = { 13906 width: this.element.outerWidth(), 13907 height: this.element.outerHeight() 13908 }; 13909 this.elementOffset = this.element.offset(); 13910 13911 position = { x: event.pageX, y: event.pageY }; 13912 normValue = this._normValueFromMouse( position ); 13913 distance = this._valueMax() - this._valueMin() + 1; 13914 this.handles.each( function( i ) { 13915 var thisDistance = Math.abs( normValue - that.values( i ) ); 13916 if ( ( distance > thisDistance ) || 13917 ( distance === thisDistance && 13918 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 13919 distance = thisDistance; 13920 closestHandle = $( this ); 13921 index = i; 13922 } 13923 } ); 13924 13925 allowed = this._start( event, index ); 13926 if ( allowed === false ) { 13927 return false; 13928 } 13929 this._mouseSliding = true; 13930 13931 this._handleIndex = index; 13932 13933 this._addClass( closestHandle, null, "ui-state-active" ); 13934 closestHandle.trigger( "focus" ); 13935 13936 offset = closestHandle.offset(); 13937 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 13938 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 13939 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 13940 top: event.pageY - offset.top - 13941 ( closestHandle.height() / 2 ) - 13942 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 13943 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 13944 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 13945 }; 13946 13947 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 13948 this._slide( event, index, normValue ); 13949 } 13950 this._animateOff = true; 13951 return true; 13952 }, 13953 13954 _mouseStart: function() { 13955 return true; 13956 }, 13957 13958 _mouseDrag: function( event ) { 13959 var position = { x: event.pageX, y: event.pageY }, 13960 normValue = this._normValueFromMouse( position ); 13961 13962 this._slide( event, this._handleIndex, normValue ); 13963 13964 return false; 13965 }, 13966 13967 _mouseStop: function( event ) { 13968 this._removeClass( this.handles, null, "ui-state-active" ); 13969 this._mouseSliding = false; 13970 13971 this._stop( event, this._handleIndex ); 13972 this._change( event, this._handleIndex ); 13973 13974 this._handleIndex = null; 13975 this._clickOffset = null; 13976 this._animateOff = false; 13977 13978 return false; 13979 }, 13980 13981 _detectOrientation: function() { 13982 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 13983 }, 13984 13985 _normValueFromMouse: function( position ) { 13986 var pixelTotal, 13987 pixelMouse, 13988 percentMouse, 13989 valueTotal, 13990 valueMouse; 13991 13992 if ( this.orientation === "horizontal" ) { 13993 pixelTotal = this.elementSize.width; 13994 pixelMouse = position.x - this.elementOffset.left - 13995 ( this._clickOffset ? this._clickOffset.left : 0 ); 13996 } else { 13997 pixelTotal = this.elementSize.height; 13998 pixelMouse = position.y - this.elementOffset.top - 13999 ( this._clickOffset ? this._clickOffset.top : 0 ); 14000 } 14001 14002 percentMouse = ( pixelMouse / pixelTotal ); 14003 if ( percentMouse > 1 ) { 14004 percentMouse = 1; 14005 } 14006 if ( percentMouse < 0 ) { 14007 percentMouse = 0; 14008 } 14009 if ( this.orientation === "vertical" ) { 14010 percentMouse = 1 - percentMouse; 14011 } 14012 14013 valueTotal = this._valueMax() - this._valueMin(); 14014 valueMouse = this._valueMin() + percentMouse * valueTotal; 14015 14016 return this._trimAlignValue( valueMouse ); 14017 }, 14018 14019 _uiHash: function( index, value, values ) { 14020 var uiHash = { 14021 handle: this.handles[ index ], 14022 handleIndex: index, 14023 value: value !== undefined ? value : this.value() 14024 }; 14025 14026 if ( this._hasMultipleValues() ) { 14027 uiHash.value = value !== undefined ? value : this.values( index ); 14028 uiHash.values = values || this.values(); 14029 } 14030 14031 return uiHash; 14032 }, 14033 14034 _hasMultipleValues: function() { 14035 return this.options.values && this.options.values.length; 14036 }, 14037 14038 _start: function( event, index ) { 14039 return this._trigger( "start", event, this._uiHash( index ) ); 14040 }, 14041 14042 _slide: function( event, index, newVal ) { 14043 var allowed, otherVal, 14044 currentValue = this.value(), 14045 newValues = this.values(); 14046 14047 if ( this._hasMultipleValues() ) { 14048 otherVal = this.values( index ? 0 : 1 ); 14049 currentValue = this.values( index ); 14050 14051 if ( this.options.values.length === 2 && this.options.range === true ) { 14052 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 14053 } 14054 14055 newValues[ index ] = newVal; 14056 } 14057 14058 if ( newVal === currentValue ) { 14059 return; 14060 } 14061 14062 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 14063 14064 // A slide can be canceled by returning false from the slide callback 14065 if ( allowed === false ) { 14066 return; 14067 } 14068 14069 if ( this._hasMultipleValues() ) { 14070 this.values( index, newVal ); 14071 } else { 14072 this.value( newVal ); 14073 } 14074 }, 14075 14076 _stop: function( event, index ) { 14077 this._trigger( "stop", event, this._uiHash( index ) ); 14078 }, 14079 14080 _change: function( event, index ) { 14081 if ( !this._keySliding && !this._mouseSliding ) { 14082 14083 //store the last changed value index for reference when handles overlap 14084 this._lastChangedValue = index; 14085 this._trigger( "change", event, this._uiHash( index ) ); 14086 } 14087 }, 14088 14089 value: function( newValue ) { 14090 if ( arguments.length ) { 14091 this.options.value = this._trimAlignValue( newValue ); 14092 this._refreshValue(); 14093 this._change( null, 0 ); 14094 return; 14095 } 14096
vendor: 4,358 bytes, lines 14097-14269
14097 return this._value(); 14098 }, 14099 14100 values: function( index, newValue ) { 14101 var vals, 14102 newValues, 14103 i; 14104 14105 if ( arguments.length > 1 ) { 14106 this.options.values[ index ] = this._trimAlignValue( newValue ); 14107 this._refreshValue(); 14108 this._change( null, index ); 14109 return; 14110 } 14111 14112 if ( arguments.length ) { 14113 if ( Array.isArray( arguments[ 0 ] ) ) { 14114 vals = this.options.values; 14115 newValues = arguments[ 0 ]; 14116 for ( i = 0; i < vals.length; i += 1 ) { 14117 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 14118 this._change( null, i ); 14119 } 14120 this._refreshValue(); 14121 } else { 14122 if ( this._hasMultipleValues() ) { 14123 return this._values( index ); 14124 } else { 14125 return this.value(); 14126 } 14127 } 14128 } else { 14129 return this._values(); 14130 } 14131 }, 14132 14133 _setOption: function( key, value ) { 14134 var i, 14135 valsLength = 0; 14136 14137 if ( key === "range" && this.options.range === true ) { 14138 if ( value === "min" ) { 14139 this.options.value = this._values( 0 ); 14140 this.options.values = null; 14141 } else if ( value === "max" ) { 14142 this.options.value = this._values( this.options.values.length - 1 ); 14143 this.options.values = null; 14144 } 14145 } 14146 14147 if ( Array.isArray( this.options.values ) ) { 14148 valsLength = this.options.values.length; 14149 } 14150 14151 this._super( key, value ); 14152 14153 switch ( key ) { 14154 case "orientation": 14155 this._detectOrientation(); 14156 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 14157 ._addClass( "ui-slider-" + this.orientation ); 14158 this._refreshValue(); 14159 if ( this.options.range ) { 14160 this._refreshRange( value ); 14161 } 14162 14163 // Reset positioning from previous orientation 14164 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 14165 break; 14166 case "value": 14167 this._animateOff = true; 14168 this._refreshValue(); 14169 this._change( null, 0 ); 14170 this._animateOff = false; 14171 break; 14172 case "values": 14173 this._animateOff = true; 14174 this._refreshValue(); 14175 14176 // Start from the last handle to prevent unreachable handles (#9046) 14177 for ( i = valsLength - 1; i >= 0; i-- ) { 14178 this._change( null, i ); 14179 } 14180 this._animateOff = false; 14181 break; 14182 case "step": 14183 case "min": 14184 case "max": 14185 this._animateOff = true; 14186 this._calculateNewMax(); 14187 this._refreshValue(); 14188 this._animateOff = false; 14189 break; 14190 case "range": 14191 this._animateOff = true; 14192 this._refresh(); 14193 this._animateOff = false; 14194 break; 14195 } 14196 }, 14197 14198 _setOptionDisabled: function( value ) { 14199 this._super( value ); 14200 14201 this._toggleClass( null, "ui-state-disabled", !!value ); 14202 }, 14203 14204 //internal value getter 14205 // _value() returns value trimmed by min and max, aligned by step 14206 _value: function() { 14207 var val = this.options.value; 14208 val = this._trimAlignValue( val ); 14209 14210 return val; 14211 }, 14212 14213 //internal values getter 14214 // _values() returns array of values trimmed by min and max, aligned by step 14215 // _values( index ) returns single value trimmed by min and max, aligned by step 14216 _values: function( index ) { 14217 var val, 14218 vals, 14219 i; 14220 14221 if ( arguments.length ) { 14222 val = this.options.values[ index ]; 14223 val = this._trimAlignValue( val ); 14224 14225 return val; 14226 } else if ( this._hasMultipleValues() ) { 14227 14228 // .slice() creates a copy of the array 14229 // this copy gets trimmed by min and max and then returned 14230 vals = this.options.values.slice(); 14231 for ( i = 0; i < vals.length; i += 1 ) { 14232 vals[ i ] = this._trimAlignValue( vals[ i ] ); 14233 } 14234 14235 return vals; 14236 } else { 14237 return []; 14238 } 14239 }, 14240 14241 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 14242 _trimAlignValue: function( val ) { 14243 if ( val <= this._valueMin() ) { 14244 return this._valueMin(); 14245 } 14246 if ( val >= this._valueMax() ) { 14247 return this._valueMax(); 14248 } 14249 var step = ( this.options.step > 0 ) ? this.options.step : 1, 14250 valModStep = ( val - this._valueMin() ) % step, 14251 alignValue = val - valModStep; 14252 14253 if ( Math.abs( valModStep ) * 2 >= step ) { 14254 alignValue += ( valModStep > 0 ) ? step : ( -step ); 14255 } 14256 14257 // Since JavaScript has problems with large floats, round 14258 // the final value to 5 digits after the decimal point (see #4124) 14259 return parseFloat( alignValue.toFixed( 5 ) ); 14260 }, 14261 14262 _calculateNewMax: function() { 14263 var max = this.options.max, 14264 min = this._valueMin(), 14265 step = this.options.step, 14266 aboveMin = Math.round( ( max - min ) / step ) * step; 14267 max = aboveMin + min; 14268 if ( max > this.options.max ) { 14269
vendor: 5,583 bytes, lines 14270-14469
14270 //If max is not divisible by step, rounding off may increase its value 14271 max -= step; 14272 } 14273 this.max = parseFloat( max.toFixed( this._precision() ) ); 14274 }, 14275 14276 _precision: function() { 14277 var precision = this._precisionOf( this.options.step ); 14278 if ( this.options.min !== null ) { 14279 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 14280 } 14281 return precision; 14282 }, 14283 14284 _precisionOf: function( num ) { 14285 var str = num.toString(), 14286 decimal = str.indexOf( "." ); 14287 return decimal === -1 ? 0 : str.length - decimal - 1; 14288 }, 14289 14290 _valueMin: function() { 14291 return this.options.min; 14292 }, 14293 14294 _valueMax: function() { 14295 return this.max; 14296 }, 14297 14298 _refreshRange: function( orientation ) { 14299 if ( orientation === "vertical" ) { 14300 this.range.css( { "width": "", "left": "" } ); 14301 } 14302 if ( orientation === "horizontal" ) { 14303 this.range.css( { "height": "", "bottom": "" } ); 14304 } 14305 }, 14306 14307 _refreshValue: function() { 14308 var lastValPercent, valPercent, value, valueMin, valueMax, 14309 oRange = this.options.range, 14310 o = this.options, 14311 that = this, 14312 animate = ( !this._animateOff ) ? o.animate : false, 14313 _set = {}; 14314 14315 if ( this._hasMultipleValues() ) { 14316 this.handles.each( function( i ) { 14317 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 14318 that._valueMin() ) * 100; 14319 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 14320 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 14321 if ( that.options.range === true ) { 14322 if ( that.orientation === "horizontal" ) { 14323 if ( i === 0 ) { 14324 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14325 left: valPercent + "%" 14326 }, o.animate ); 14327 } 14328 if ( i === 1 ) { 14329 that.range[ animate ? "animate" : "css" ]( { 14330 width: ( valPercent - lastValPercent ) + "%" 14331 }, { 14332 queue: false, 14333 duration: o.animate 14334 } ); 14335 } 14336 } else { 14337 if ( i === 0 ) { 14338 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14339 bottom: ( valPercent ) + "%" 14340 }, o.animate ); 14341 } 14342 if ( i === 1 ) { 14343 that.range[ animate ? "animate" : "css" ]( { 14344 height: ( valPercent - lastValPercent ) + "%" 14345 }, { 14346 queue: false, 14347 duration: o.animate 14348 } ); 14349 } 14350 } 14351 } 14352 lastValPercent = valPercent; 14353 } ); 14354 } else { 14355 value = this.value(); 14356 valueMin = this._valueMin(); 14357 valueMax = this._valueMax(); 14358 valPercent = ( valueMax !== valueMin ) ? 14359 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 14360 0; 14361 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 14362 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 14363 14364 if ( oRange === "min" && this.orientation === "horizontal" ) { 14365 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14366 width: valPercent + "%" 14367 }, o.animate ); 14368 } 14369 if ( oRange === "max" && this.orientation === "horizontal" ) { 14370 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14371 width: ( 100 - valPercent ) + "%" 14372 }, o.animate ); 14373 } 14374 if ( oRange === "min" && this.orientation === "vertical" ) { 14375 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14376 height: valPercent + "%" 14377 }, o.animate ); 14378 } 14379 if ( oRange === "max" && this.orientation === "vertical" ) { 14380 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 14381 height: ( 100 - valPercent ) + "%" 14382 }, o.animate ); 14383 } 14384 } 14385 }, 14386 14387 _handleEvents: { 14388 keydown: function( event ) { 14389 var allowed, curVal, newVal, step, 14390 index = $( event.target ).data( "ui-slider-handle-index" ); 14391 14392 switch ( event.keyCode ) { 14393 case $.ui.keyCode.HOME: 14394 case $.ui.keyCode.END: 14395 case $.ui.keyCode.PAGE_UP: 14396 case $.ui.keyCode.PAGE_DOWN: 14397 case $.ui.keyCode.UP: 14398 case $.ui.keyCode.RIGHT: 14399 case $.ui.keyCode.DOWN: 14400 case $.ui.keyCode.LEFT: 14401 event.preventDefault(); 14402 if ( !this._keySliding ) { 14403 this._keySliding = true; 14404 this._addClass( $( event.target ), null, "ui-state-active" ); 14405 allowed = this._start( event, index ); 14406 if ( allowed === false ) { 14407 return; 14408 } 14409 } 14410 break; 14411 } 14412 14413 step = this.options.step; 14414 if ( this._hasMultipleValues() ) { 14415 curVal = newVal = this.values( index ); 14416 } else { 14417 curVal = newVal = this.value(); 14418 } 14419 14420 switch ( event.keyCode ) { 14421 case $.ui.keyCode.HOME: 14422 newVal = this._valueMin(); 14423 break; 14424 case $.ui.keyCode.END: 14425 newVal = this._valueMax(); 14426 break; 14427 case $.ui.keyCode.PAGE_UP: 14428 newVal = this._trimAlignValue( 14429 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 14430 ); 14431 break; 14432 case $.ui.keyCode.PAGE_DOWN: 14433 newVal = this._trimAlignValue( 14434 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 14435 break; 14436 case $.ui.keyCode.UP: 14437 case $.ui.keyCode.RIGHT: 14438 if ( curVal === this._valueMax() ) { 14439 return; 14440 } 14441 newVal = this._trimAlignValue( curVal + step ); 14442 break; 14443 case $.ui.keyCode.DOWN: 14444 case $.ui.keyCode.LEFT: 14445 if ( curVal === this._valueMin() ) { 14446 return; 14447 } 14448 newVal = this._trimAlignValue( curVal - step ); 14449 break; 14450 } 14451 14452 this._slide( event, index, newVal ); 14453 }, 14454 keyup: function( event ) { 14455 var index = $( event.target ).data( "ui-slider-handle-index" ); 14456 14457 if ( this._keySliding ) { 14458 this._keySliding = false; 14459 this._stop( event, index ); 14460 this._change( event, index ); 14461 this._removeClass( $( event.target ), null, "ui-state-active" ); 14462 } 14463 } 14464 } 14465} ); 14466 14467 14468/*! 14469 * jQuery UI S
14469pinner 1.13.0 14470 * http://jqueryui.com 14471 * 14472 * Copyright jQuery Foundation and other contributors 14473 * Released under the MIT license. 14474 * http://jquery.org/license 14475 */ 14476 14477//>>label: Spinner 14478//>>group: Widgets 14479//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 14480//>>docs: http://api.jqueryui.com/spinner/ 14481//>>demos: http://jqueryui.com/spinner/ 14482//>>css.structure: ../../themes/base/core.css 14483//>>css.structure: ../../themes/base/spinner.css 14484//>>css.theme: ../../themes/base/theme.css 14485 14486 14487function spinnerModifier( fn ) { 14488 return function() { 14489 var previous = this.element.val(); 14490 fn.apply( this, arguments ); 14491 this._refresh(); 14492 if ( previous !== this.element.val() ) { 14493 this._trigger( "change" ); 14494 } 14495 }; 14496} 14497 14498$.widget( "ui.spinner", { 14499 version: "1.13.0
vendor: 13,310 bytes, lines 14499-15030
14499", 14500 defaultElement: "<input>", 14501 widgetEventPrefix: "spin", 14502 options: { 14503 classes: { 14504 "ui-spinner": "ui-corner-all", 14505 "ui-spinner-down": "ui-corner-br", 14506 "ui-spinner-up": "ui-corner-tr" 14507 }, 14508 culture: null, 14509 icons: { 14510 down: "ui-icon-triangle-1-s", 14511 up: "ui-icon-triangle-1-n" 14512 }, 14513 incremental: true, 14514 max: null, 14515 min: null, 14516 numberFormat: null, 14517 page: 10, 14518 step: 1, 14519 14520 change: null, 14521 spin: null, 14522 start: null, 14523 stop: null 14524 }, 14525 14526 _create: function() { 14527 14528 // handle string values that need to be parsed 14529 this._setOption( "max", this.options.max ); 14530 this._setOption( "min", this.options.min ); 14531 this._setOption( "step", this.options.step ); 14532 14533 // Only format if there is a value, prevents the field from being marked 14534 // as invalid in Firefox, see #9573. 14535 if ( this.value() !== "" ) { 14536 14537 // Format the value, but don't constrain. 14538 this._value( this.element.val(), true ); 14539 } 14540 14541 this._draw(); 14542 this._on( this._events ); 14543 this._refresh(); 14544 14545 // Turning off autocomplete prevents the browser from remembering the 14546 // value when navigating through history, so we re-enable autocomplete 14547 // if the page is unloaded before the widget is destroyed. #7790 14548 this._on( this.window, { 14549 beforeunload: function() { 14550 this.element.removeAttr( "autocomplete" ); 14551 } 14552 } ); 14553 }, 14554 14555 _getCreateOptions: function() { 14556 var options = this._super(); 14557 var element = this.element; 14558 14559 $.each( [ "min", "max", "step" ], function( i, option ) { 14560 var value = element.attr( option ); 14561 if ( value != null && value.length ) { 14562 options[ option ] = value; 14563 } 14564 } ); 14565 14566 return options; 14567 }, 14568 14569 _events: { 14570 keydown: function( event ) { 14571 if ( this._start( event ) && this._keydown( event ) ) { 14572 event.preventDefault(); 14573 } 14574 }, 14575 keyup: "_stop", 14576 focus: function() { 14577 this.previous = this.element.val(); 14578 }, 14579 blur: function( event ) { 14580 if ( this.cancelBlur ) { 14581 delete this.cancelBlur; 14582 return; 14583 } 14584 14585 this._stop(); 14586 this._refresh(); 14587 if ( this.previous !== this.element.val() ) { 14588 this._trigger( "change", event ); 14589 } 14590 }, 14591 mousewheel: function( event, delta ) { 14592 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); 14593 var isActive = this.element[ 0 ] === activeElement; 14594 14595 if ( !isActive || !delta ) { 14596 return; 14597 } 14598 14599 if ( !this.spinning && !this._start( event ) ) { 14600 return false; 14601 } 14602 14603 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 14604 clearTimeout( this.mousewheelTimer ); 14605 this.mousewheelTimer = this._delay( function() { 14606 if ( this.spinning ) { 14607 this._stop( event ); 14608 } 14609 }, 100 ); 14610 event.preventDefault(); 14611 }, 14612 "mousedown .ui-spinner-button": function( event ) { 14613 var previous; 14614 14615 // We never want the buttons to have focus; whenever the user is 14616 // interacting with the spinner, the focus should be on the input. 14617 // If the input is focused then this.previous is properly set from 14618 // when the input first received focus. If the input is not focused 14619 // then we need to set this.previous based on the value before spinning. 14620 previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ? 14621 this.previous : this.element.val(); 14622 function checkFocus() { 14623 var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ); 14624 if ( !isActive ) { 14625 this.element.trigger( "focus" ); 14626 this.previous = previous; 14627 14628 // support: IE 14629 // IE sets focus asynchronously, so we need to check if focus 14630 // moved off of the input because the user clicked on the button. 14631 this._delay( function() { 14632 this.previous = previous; 14633 } ); 14634 } 14635 } 14636 14637 // Ensure focus is on (or stays on) the text field 14638 event.preventDefault(); 14639 checkFocus.call( this ); 14640 14641 // Support: IE 14642 // IE doesn't prevent moving focus even with event.preventDefault() 14643 // so we set a flag to know when we should ignore the blur event 14644 // and check (again) if focus moved off of the input. 14645 this.cancelBlur = true; 14646 this._delay( function() { 14647 delete this.cancelBlur; 14648 checkFocus.call( this ); 14649 } ); 14650 14651 if ( this._start( event ) === false ) { 14652 return; 14653 } 14654 14655 this._repeat( null, $( event.currentTarget ) 14656 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 14657 }, 14658 "mouseup .ui-spinner-button": "_stop", 14659 "mouseenter .ui-spinner-button": function( event ) { 14660 14661 // button will add ui-state-active if mouse was down while mouseleave and kept down 14662 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 14663 return; 14664 } 14665 14666 if ( this._start( event ) === false ) { 14667 return false; 14668 } 14669 this._repeat( null, $( event.currentTarget ) 14670 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 14671 }, 14672 14673 // TODO: do we really want to consider this a stop? 14674 // shouldn't we just stop the repeater and wait until mouseup before 14675 // we trigger the stop event? 14676 "mouseleave .ui-spinner-button": "_stop" 14677 }, 14678 14679 // Support mobile enhanced option and make backcompat more sane 14680 _enhance: function() { 14681 this.uiSpinner = this.element 14682 .attr( "autocomplete", "off" ) 14683 .wrap( "<span>" ) 14684 .parent() 14685 14686 // Add buttons 14687 .append( 14688 "<a></a><a></a>" 14689 ); 14690 }, 14691 14692 _draw: function() { 14693 this._enhance(); 14694 14695 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 14696 this._addClass( "ui-spinner-input" ); 14697 14698 this.element.attr( "role", "spinbutton" ); 14699 14700 // Button bindings 14701 this.buttons = this.uiSpinner.children( "a" ) 14702 .attr( "tabIndex", -1 ) 14703 .attr( "aria-hidden", true ) 14704 .button( { 14705 classes: { 14706 "ui-button": "" 14707 } 14708 } ); 14709 14710 // TODO: Right now button does not support classes this is already updated in button PR 14711 this._removeClass( this.buttons, "ui-corner-all" ); 14712 14713 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 14714 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 14715 this.buttons.first().button( { 14716 "icon": this.options.icons.up, 14717 "showLabel": false 14718 } ); 14719 this.buttons.last().button( { 14720 "icon": this.options.icons.down, 14721 "showLabel": false 14722 } ); 14723 14724 // IE 6 doesn't understand height: 50% for the buttons 14725 // unless the wrapper has an explicit height 14726 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 14727 this.uiSpinner.height() > 0 ) { 14728 this.uiSpinner.height( this.uiSpinner.height() ); 14729 } 14730 }, 14731 14732 _keydown: function( event ) { 14733 var options = this.options, 14734 keyCode = $.ui.keyCode; 14735 14736 switch ( event.keyCode ) { 14737 case keyCode.UP: 14738 this._repeat( null, 1, event ); 14739 return true; 14740 case keyCode.DOWN: 14741 this._repeat( null, -1, event ); 14742 return true; 14743 case keyCode.PAGE_UP: 14744 this._repeat( null, options.page, event ); 14745 return true; 14746 case keyCode.PAGE_DOWN: 14747 this._repeat( null, -options.page, event ); 14748 return true; 14749 } 14750 14751 return false; 14752 }, 14753 14754 _start: function( event ) { 14755 if ( !this.spinning && this._trigger( "start", event ) === false ) { 14756 return false; 14757 } 14758 14759 if ( !this.counter ) { 14760 this.counter = 1; 14761 } 14762 this.spinning = true; 14763 return true; 14764 }, 14765 14766 _repeat: function( i, steps, event ) { 14767 i = i || 500; 14768 14769 clearTimeout( this.timer ); 14770 this.timer = this._delay( function() { 14771 this._repeat( 40, steps, event ); 14772 }, i ); 14773 14774 this._spin( steps * this.options.step, event ); 14775 }, 14776 14777 _spin: function( step, event ) { 14778 var value = this.value() || 0; 14779 14780 if ( !this.counter ) { 14781 this.counter = 1; 14782 } 14783 14784 value = this._adjustValue( value + step * this._increment( this.counter ) ); 14785 14786 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 14787 this._value( value ); 14788 this.counter++; 14789 } 14790 }, 14791 14792 _increment: function( i ) { 14793 var incremental = this.options.incremental; 14794 14795 if ( incremental ) { 14796 return typeof incremental === "function" ? 14797 incremental( i ) : 14798 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 14799 } 14800 14801 return 1; 14802 }, 14803 14804 _precision: function() { 14805 var precision = this._precisionOf( this.options.step ); 14806 if ( this.options.min !== null ) { 14807 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 14808 } 14809 return precision; 14810 }, 14811 14812 _precisionOf: function( num ) { 14813 var str = num.toString(), 14814 decimal = str.indexOf( "." ); 14815 return decimal === -1 ? 0 : str.length - decimal - 1; 14816 }, 14817 14818 _adjustValue: function( value ) { 14819 var base, aboveMin, 14820 options = this.options; 14821 14822 // Make sure we're at a valid step 14823 // - find out where we are relative to the base (min or 0) 14824 base = options.min !== null ? options.min : 0; 14825 aboveMin = value - base; 14826 14827 // - round to the nearest step 14828 aboveMin = Math.round( aboveMin / options.step ) * options.step; 14829 14830 // - rounding is based on 0, so adjust back to our base 14831 value = base + aboveMin; 14832 14833 // Fix precision from bad JS floating point math 14834 value = parseFloat( value.toFixed( this._precision() ) ); 14835 14836 // Clamp the value 14837 if ( options.max !== null && value > options.max ) { 14838 return options.max; 14839 } 14840 if ( options.min !== null && value < options.min ) { 14841 return options.min; 14842 } 14843 14844 return value; 14845 }, 14846 14847 _stop: function( event ) { 14848 if ( !this.spinning ) { 14849 return; 14850 } 14851 14852 clearTimeout( this.timer ); 14853 clearTimeout( this.mousewheelTimer ); 14854 this.counter = 0; 14855 this.spinning = false; 14856 this._trigger( "stop", event ); 14857 }, 14858 14859 _setOption: function( key, value ) { 14860 var prevValue, first, last; 14861 14862 if ( key === "culture" || key === "numberFormat" ) { 14863 prevValue = this._parse( this.element.val() ); 14864 this.options[ key ] = value; 14865 this.element.val( this._format( prevValue ) ); 14866 return; 14867 } 14868 14869 if ( key === "max" || key === "min" || key === "step" ) { 14870 if ( typeof value === "string" ) { 14871 value = this._parse( value ); 14872 } 14873 } 14874 if ( key === "icons" ) { 14875 first = this.buttons.first().find( ".ui-icon" ); 14876 this._removeClass( first, null, this.options.icons.up ); 14877 this._addClass( first, null, value.up ); 14878 last = this.buttons.last().find( ".ui-icon" ); 14879 this._removeClass( last, null, this.options.icons.down ); 14880 this._addClass( last, null, value.down ); 14881 } 14882 14883 this._super( key, value ); 14884 }, 14885 14886 _setOptionDisabled: function( value ) { 14887 this._super( value ); 14888 14889 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 14890 this.element.prop( "disabled", !!value ); 14891 this.buttons.button( value ? "disable" : "enable" ); 14892 }, 14893 14894 _setOptions: spinnerModifier( function( options ) { 14895 this._super( options ); 14896 } ), 14897 14898 _parse: function( val ) { 14899 if ( typeof val === "string" && val !== "" ) { 14900 val = window.Globalize && this.options.numberFormat ? 14901 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 14902 } 14903 return val === "" || isNaN( val ) ? null : val; 14904 }, 14905 14906 _format: function( value ) { 14907 if ( value === "" ) { 14908 return ""; 14909 } 14910 return window.Globalize && this.options.numberFormat ? 14911 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 14912 value; 14913 }, 14914 14915 _refresh: function() { 14916 this.element.attr( { 14917 "aria-valuemin": this.options.min, 14918 "aria-valuemax": this.options.max, 14919 14920 // TODO: what should we do with values that can't be parsed? 14921 "aria-valuenow": this._parse( this.element.val() ) 14922 } ); 14923 }, 14924 14925 isValid: function() { 14926 var value = this.value(); 14927 14928 // Null is invalid 14929 if ( value === null ) { 14930 return false; 14931 } 14932 14933 // If value gets adjusted, it's invalid 14934 return value === this._adjustValue( value ); 14935 }, 14936 14937 // Update the value without triggering change 14938 _value: function( value, allowAny ) { 14939 var parsed; 14940 if ( value !== "" ) { 14941 parsed = this._parse( value ); 14942 if ( parsed !== null ) { 14943 if ( !allowAny ) { 14944 parsed = this._adjustValue( parsed ); 14945 } 14946 value = this._format( parsed ); 14947 } 14948 } 14949 this.element.val( value ); 14950 this._refresh(); 14951 }, 14952 14953 _destroy: function() { 14954 this.element 14955 .prop( "disabled", false ) 14956 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 14957 14958 this.uiSpinner.replaceWith( this.element ); 14959 }, 14960 14961 stepUp: spinnerModifier( function( steps ) { 14962 this._stepUp( steps ); 14963 } ), 14964 _stepUp: function( steps ) { 14965 if ( this._start() ) { 14966 this._spin( ( steps || 1 ) * this.options.step ); 14967 this._stop(); 14968 } 14969 }, 14970 14971 stepDown: spinnerModifier( function( steps ) { 14972 this._stepDown( steps ); 14973 } ), 14974 _stepDown: function( steps ) { 14975 if ( this._start() ) { 14976 this._spin( ( steps || 1 ) * -this.options.step ); 14977 this._stop(); 14978 } 14979 }, 14980 14981 pageUp: spinnerModifier( function( pages ) { 14982 this._stepUp( ( pages || 1 ) * this.options.page ); 14983 } ), 14984 14985 pageDown: spinnerModifier( function( pages ) { 14986 this._stepDown( ( pages || 1 ) * this.options.page ); 14987 } ), 14988 14989 value: function( newVal ) { 14990 if ( !arguments.length ) { 14991 return this._parse( this.element.val() ); 14992 } 14993 spinnerModifier( this._value ).call( this, newVal ); 14994 }, 14995 14996 widget: function() { 14997 return this.uiSpinner; 14998 } 14999} ); 15000 15001// DEPRECATED 15002// TODO: switch return back to widget declaration at top of file when this is removed 15003if ( $.uiBackCompat !== false ) { 15004 15005 // Backcompat for spinner html extension points 15006 $.widget( "ui.spinner", $.ui.spinner, { 15007 _enhance: function() { 15008 this.uiSpinner = this.element 15009 .attr( "autocomplete", "off" ) 15010 .wrap( this._uiSpinnerHtml() ) 15011 .parent() 15012 15013 // Add buttons 15014 .append( this._buttonHtml() ); 15015 }, 15016 _uiSpinnerHtml: function() { 15017 return "<span>"; 15018 }, 15019 15020 _buttonHtml: function() { 15021 return "<a></a><a></a>"; 15022 } 15023 } ); 15024} 15025 15026var widgetsSpinner = $.ui.spinner; 15027 15028 15029/*! 15030 * jQuery UI Tabs 1.13.
150300 15031 * http://jqueryui.com 15032 * 15033 * Copyright jQuery Foundation and other contributors 15034 * Released under the MIT license. 15035 * http://jquery.org/license 15036 */ 15037 15038//>>label: Tabs 15039//>>group: Widgets 15040//>>description: Transforms a set of container elements into a tab structure. 15041//>>docs: http://api.jqueryui.com/tabs/ 15042//>>demos: http://jqueryui.com/tabs/ 15043//>>css.structure: ../../themes/base/core.css 15044//>>css.structure: ../../themes/base/tabs.css 15045//>>css.theme: ../../themes/base/theme.css 15046 15047 15048$.widget( "ui.tabs", { 15049 version: "1.13.0
vendor: 12,261 bytes, lines 15049-15516
15049", 15050 delay: 300, 15051 options: { 15052 active: null, 15053 classes: { 15054 "ui-tabs": "ui-corner-all", 15055 "ui-tabs-nav": "ui-corner-all", 15056 "ui-tabs-panel": "ui-corner-bottom", 15057 "ui-tabs-tab": "ui-corner-top" 15058 }, 15059 collapsible: false, 15060 event: "click", 15061 heightStyle: "content", 15062 hide: null, 15063 show: null, 15064 15065 // Callbacks 15066 activate: null, 15067 beforeActivate: null, 15068 beforeLoad: null, 15069 load: null 15070 }, 15071 15072 _isLocal: ( function() { 15073 var rhash = /#.*$/; 15074 15075 return function( anchor ) { 15076 var anchorUrl, locationUrl; 15077 15078 anchorUrl = anchor.href.replace( rhash, "" ); 15079 locationUrl = location.href.replace( rhash, "" ); 15080 15081 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 15082 try { 15083 anchorUrl = decodeURIComponent( anchorUrl ); 15084 } catch ( error ) {} 15085 try { 15086 locationUrl = decodeURIComponent( locationUrl ); 15087 } catch ( error ) {} 15088 15089 return anchor.hash.length > 1 && anchorUrl === locationUrl; 15090 }; 15091 } )(), 15092 15093 _create: function() { 15094 var that = this, 15095 options = this.options; 15096 15097 this.running = false; 15098 15099 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 15100 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 15101 15102 this._processTabs(); 15103 options.active = this._initialActive(); 15104 15105 // Take disabling tabs via class attribute from HTML 15106 // into account and update option properly. 15107 if ( Array.isArray( options.disabled ) ) { 15108 options.disabled = $.uniqueSort( options.disabled.concat( 15109 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 15110 return that.tabs.index( li ); 15111 } ) 15112 ) ).sort(); 15113 } 15114 15115 // Check for length avoids error when initializing empty list 15116 if ( this.options.active !== false && this.anchors.length ) { 15117 this.active = this._findActive( options.active ); 15118 } else { 15119 this.active = $(); 15120 } 15121 15122 this._refresh(); 15123 15124 if ( this.active.length ) { 15125 this.load( options.active ); 15126 } 15127 }, 15128 15129 _initialActive: function() { 15130 var active = this.options.active, 15131 collapsible = this.options.collapsible, 15132 locationHash = location.hash.substring( 1 ); 15133 15134 if ( active === null ) { 15135 15136 // check the fragment identifier in the URL 15137 if ( locationHash ) { 15138 this.tabs.each( function( i, tab ) { 15139 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 15140 active = i; 15141 return false; 15142 } 15143 } ); 15144 } 15145 15146 // Check for a tab marked active via a class 15147 if ( active === null ) { 15148 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 15149 } 15150 15151 // No active tab, set to false 15152 if ( active === null || active === -1 ) { 15153 active = this.tabs.length ? 0 : false; 15154 } 15155 } 15156 15157 // Handle numbers: negative, out of range 15158 if ( active !== false ) { 15159 active = this.tabs.index( this.tabs.eq( active ) ); 15160 if ( active === -1 ) { 15161 active = collapsible ? false : 0; 15162 } 15163 } 15164 15165 // Don't allow collapsible: false and active: false 15166 if ( !collapsible && active === false && this.anchors.length ) { 15167 active = 0; 15168 } 15169 15170 return active; 15171 }, 15172 15173 _getCreateEventData: function() { 15174 return { 15175 tab: this.active, 15176 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 15177 }; 15178 }, 15179 15180 _tabKeydown: function( event ) { 15181 var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ), 15182 selectedIndex = this.tabs.index( focusedTab ), 15183 goingForward = true; 15184 15185 if ( this._handlePageNav( event ) ) { 15186 return; 15187 } 15188 15189 switch ( event.keyCode ) { 15190 case $.ui.keyCode.RIGHT: 15191 case $.ui.keyCode.DOWN: 15192 selectedIndex++; 15193 break; 15194 case $.ui.keyCode.UP: 15195 case $.ui.keyCode.LEFT: 15196 goingForward = false; 15197 selectedIndex--; 15198 break; 15199 case $.ui.keyCode.END: 15200 selectedIndex = this.anchors.length - 1; 15201 break; 15202 case $.ui.keyCode.HOME: 15203 selectedIndex = 0; 15204 break; 15205 case $.ui.keyCode.SPACE: 15206 15207 // Activate only, no collapsing 15208 event.preventDefault(); 15209 clearTimeout( this.activating ); 15210 this._activate( selectedIndex ); 15211 return; 15212 case $.ui.keyCode.ENTER: 15213 15214 // Toggle (cancel delayed activation, allow collapsing) 15215 event.preventDefault(); 15216 clearTimeout( this.activating ); 15217 15218 // Determine if we should collapse or activate 15219 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 15220 return; 15221 default: 15222 return; 15223 } 15224 15225 // Focus the appropriate tab, based on which key was pressed 15226 event.preventDefault(); 15227 clearTimeout( this.activating ); 15228 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 15229 15230 // Navigating with control/command key will prevent automatic activation 15231 if ( !event.ctrlKey && !event.metaKey ) { 15232 15233 // Update aria-selected immediately so that AT think the tab is already selected. 15234 // Otherwise AT may confuse the user by stating that they need to activate the tab, 15235 // but the tab will already be activated by the time the announcement finishes. 15236 focusedTab.attr( "aria-selected", "false" ); 15237 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 15238 15239 this.activating = this._delay( function() { 15240 this.option( "active", selectedIndex ); 15241 }, this.delay ); 15242 } 15243 }, 15244 15245 _panelKeydown: function( event ) { 15246 if ( this._handlePageNav( event ) ) { 15247 return; 15248 } 15249 15250 // Ctrl+up moves focus to the current tab 15251 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 15252 event.preventDefault(); 15253 this.active.trigger( "focus" ); 15254 } 15255 }, 15256 15257 // Alt+page up/down moves focus to the previous/next tab (and activates) 15258 _handlePageNav: function( event ) { 15259 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 15260 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 15261 return true; 15262 } 15263 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 15264 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 15265 return true; 15266 } 15267 }, 15268 15269 _findNextTab: function( index, goingForward ) { 15270 var lastTabIndex = this.tabs.length - 1; 15271 15272 function constrain() { 15273 if ( index > lastTabIndex ) { 15274 index = 0; 15275 } 15276 if ( index < 0 ) { 15277 index = lastTabIndex; 15278 } 15279 return index; 15280 } 15281 15282 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 15283 index = goingForward ? index + 1 : index - 1; 15284 } 15285 15286 return index; 15287 }, 15288 15289 _focusNextTab: function( index, goingForward ) { 15290 index = this._findNextTab( index, goingForward ); 15291 this.tabs.eq( index ).trigger( "focus" ); 15292 return index; 15293 }, 15294 15295 _setOption: function( key, value ) { 15296 if ( key === "active" ) { 15297 15298 // _activate() will handle invalid values and update this.options 15299 this._activate( value ); 15300 return; 15301 } 15302 15303 this._super( key, value ); 15304 15305 if ( key === "collapsible" ) { 15306 this._toggleClass( "ui-tabs-collapsible", null, value ); 15307 15308 // Setting collapsible: false while collapsed; open first panel 15309 if ( !value && this.options.active === false ) { 15310 this._activate( 0 ); 15311 } 15312 } 15313 15314 if ( key === "event" ) { 15315 this._setupEvents( value ); 15316 } 15317 15318 if ( key === "heightStyle" ) { 15319 this._setupHeightStyle( value ); 15320 } 15321 }, 15322 15323 _sanitizeSelector: function( hash ) { 15324 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 15325 }, 15326 15327 refresh: function() { 15328 var options = this.options, 15329 lis = this.tablist.children( ":has(a[href])" ); 15330 15331 // Get disabled tabs from class attribute from HTML 15332 // this will get converted to a boolean if needed in _refresh() 15333 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 15334 return lis.index( tab ); 15335 } ); 15336 15337 this._processTabs(); 15338 15339 // Was collapsed or no tabs 15340 if ( options.active === false || !this.anchors.length ) { 15341 options.active = false; 15342 this.active = $(); 15343 15344 // was active, but active tab is gone 15345 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 15346 15347 // all remaining tabs are disabled 15348 if ( this.tabs.length === options.disabled.length ) { 15349 options.active = false; 15350 this.active = $(); 15351 15352 // activate previous tab 15353 } else { 15354 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 15355 } 15356 15357 // was active, active tab still exists 15358 } else { 15359 15360 // make sure active index is correct 15361 options.active = this.tabs.index( this.active ); 15362 } 15363 15364 this._refresh(); 15365 }, 15366 15367 _refresh: function() { 15368 this._setOptionDisabled( this.options.disabled ); 15369 this._setupEvents( this.options.event ); 15370 this._setupHeightStyle( this.options.heightStyle ); 15371 15372 this.tabs.not( this.active ).attr( { 15373 "aria-selected": "false", 15374 "aria-expanded": "false", 15375 tabIndex: -1 15376 } ); 15377 this.panels.not( this._getPanelForTab( this.active ) ) 15378 .hide() 15379 .attr( { 15380 "aria-hidden": "true" 15381 } ); 15382 15383 // Make sure one tab is in the tab order 15384 if ( !this.active.length ) { 15385 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 15386 } else { 15387 this.active 15388 .attr( { 15389 "aria-selected": "true", 15390 "aria-expanded": "true", 15391 tabIndex: 0 15392 } ); 15393 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 15394 this._getPanelForTab( this.active ) 15395 .show() 15396 .attr( { 15397 "aria-hidden": "false" 15398 } ); 15399 } 15400 }, 15401 15402 _processTabs: function() { 15403 var that = this, 15404 prevTabs = this.tabs, 15405 prevAnchors = this.anchors, 15406 prevPanels = this.panels; 15407 15408 this.tablist = this._getList().attr( "role", "tablist" ); 15409 this._addClass( this.tablist, "ui-tabs-nav", 15410 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 15411 15412 // Prevent users from focusing disabled tabs via click 15413 this.tablist 15414 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 15415 if ( $( this ).is( ".ui-state-disabled" ) ) { 15416 event.preventDefault(); 15417 } 15418 } ) 15419 15420 // Support: IE <9 15421 // Preventing the default action in mousedown doesn't prevent IE 15422 // from focusing the element, so if the anchor gets focused, blur. 15423 // We don't have to worry about focusing the previously focused 15424 // element since clicking on a non-focusable element should focus 15425 // the body anyway. 15426 .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 15427 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 15428 this.blur(); 15429 } 15430 } ); 15431 15432 this.tabs = this.tablist.find( "> li:has(a[href])" ) 15433 .attr( { 15434 role: "tab", 15435 tabIndex: -1 15436 } ); 15437 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 15438 15439 this.anchors = this.tabs.map( function() { 15440 return $( "a", this )[ 0 ]; 15441 } ) 15442 .attr( { 15443 tabIndex: -1 15444 } ); 15445 this._addClass( this.anchors, "ui-tabs-anchor" ); 15446 15447 this.panels = $(); 15448 15449 this.anchors.each( function( i, anchor ) { 15450 var selector, panel, panelId, 15451 anchorId = $( anchor ).uniqueId().attr( "id" ), 15452 tab = $( anchor ).closest( "li" ), 15453 originalAriaControls = tab.attr( "aria-controls" ); 15454 15455 // Inline tab 15456 if ( that._isLocal( anchor ) ) { 15457 selector = anchor.hash; 15458 panelId = selector.substring( 1 ); 15459 panel = that.element.find( that._sanitizeSelector( selector ) ); 15460 15461 // remote tab 15462 } else { 15463 15464 // If the tab doesn't already have aria-controls, 15465 // generate an id by using a throw-away element 15466 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 15467 selector = "#" + panelId; 15468 panel = that.element.find( selector ); 15469 if ( !panel.length ) { 15470 panel = that._createPanel( panelId ); 15471 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 15472 } 15473 panel.attr( "aria-live", "polite" ); 15474 } 15475 15476 if ( panel.length ) { 15477 that.panels = that.panels.add( panel ); 15478 } 15479 if ( originalAriaControls ) { 15480 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 15481 } 15482 tab.attr( { 15483 "aria-controls": panelId, 15484 "aria-labelledby": anchorId 15485 } ); 15486 panel.attr( "aria-labelledby", anchorId ); 15487 } ); 15488 15489 this.panels.attr( "role", "tabpanel" ); 15490 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 15491 15492 // Avoid memory leaks (#10056) 15493 if ( prevTabs ) { 15494 this._off( prevTabs.not( this.tabs ) ); 15495 this._off( prevAnchors.not( this.anchors ) ); 15496 this._off( prevPanels.not( this.panels ) ); 15497 } 15498 }, 15499 15500 // Allow overriding how to find the list for rare usage scenarios (#7715) 15501 _getList: function() { 15502 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 15503 }, 15504 15505 _createPanel: function( id ) { 15506 return $( "<div>" ) 15507 .attr( "id", id ) 15508 .data( "ui-tabs-destroy", true ); 15509 }, 15510 15511 _setOptionDisabled: function( disabled ) { 15512 var currentItem, li, i; 15513 15514 if ( Array.isArray( disabled ) ) { 15515 if ( !disabled.length ) { 15516 disabled = false;
vendor: 6,148 bytes, lines 15517-15745
15517 } else if ( disabled.length === this.anchors.length ) { 15518 disabled = true; 15519 } 15520 } 15521 15522 // Disable tabs 15523 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 15524 currentItem = $( li ); 15525 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 15526 currentItem.attr( "aria-disabled", "true" ); 15527 this._addClass( currentItem, null, "ui-state-disabled" ); 15528 } else { 15529 currentItem.removeAttr( "aria-disabled" ); 15530 this._removeClass( currentItem, null, "ui-state-disabled" ); 15531 } 15532 } 15533 15534 this.options.disabled = disabled; 15535 15536 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 15537 disabled === true ); 15538 }, 15539 15540 _setupEvents: function( event ) { 15541 var events = {}; 15542 if ( event ) { 15543 $.each( event.split( " " ), function( index, eventName ) { 15544 events[ eventName ] = "_eventHandler"; 15545 } ); 15546 } 15547 15548 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 15549 15550 // Always prevent the default action, even when disabled 15551 this._on( true, this.anchors, { 15552 click: function( event ) { 15553 event.preventDefault(); 15554 } 15555 } ); 15556 this._on( this.anchors, events ); 15557 this._on( this.tabs, { keydown: "_tabKeydown" } ); 15558 this._on( this.panels, { keydown: "_panelKeydown" } ); 15559 15560 this._focusable( this.tabs ); 15561 this._hoverable( this.tabs ); 15562 }, 15563 15564 _setupHeightStyle: function( heightStyle ) { 15565 var maxHeight, 15566 parent = this.element.parent(); 15567 15568 if ( heightStyle === "fill" ) { 15569 maxHeight = parent.height(); 15570 maxHeight -= this.element.outerHeight() - this.element.height(); 15571 15572 this.element.siblings( ":visible" ).each( function() { 15573 var elem = $( this ), 15574 position = elem.css( "position" ); 15575 15576 if ( position === "absolute" || position === "fixed" ) { 15577 return; 15578 } 15579 maxHeight -= elem.outerHeight( true ); 15580 } ); 15581 15582 this.element.children().not( this.panels ).each( function() { 15583 maxHeight -= $( this ).outerHeight( true ); 15584 } ); 15585 15586 this.panels.each( function() { 15587 $( this ).height( Math.max( 0, maxHeight - 15588 $( this ).innerHeight() + $( this ).height() ) ); 15589 } ) 15590 .css( "overflow", "auto" ); 15591 } else if ( heightStyle === "auto" ) { 15592 maxHeight = 0; 15593 this.panels.each( function() { 15594 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 15595 } ).height( maxHeight ); 15596 } 15597 }, 15598 15599 _eventHandler: function( event ) { 15600 var options = this.options, 15601 active = this.active, 15602 anchor = $( event.currentTarget ), 15603 tab = anchor.closest( "li" ), 15604 clickedIsActive = tab[ 0 ] === active[ 0 ], 15605 collapsing = clickedIsActive && options.collapsible, 15606 toShow = collapsing ? $() : this._getPanelForTab( tab ), 15607 toHide = !active.length ? $() : this._getPanelForTab( active ), 15608 eventData = { 15609 oldTab: active, 15610 oldPanel: toHide, 15611 newTab: collapsing ? $() : tab, 15612 newPanel: toShow 15613 }; 15614 15615 event.preventDefault(); 15616 15617 if ( tab.hasClass( "ui-state-disabled" ) || 15618 15619 // tab is already loading 15620 tab.hasClass( "ui-tabs-loading" ) || 15621 15622 // can't switch durning an animation 15623 this.running || 15624 15625 // click on active header, but not collapsible 15626 ( clickedIsActive && !options.collapsible ) || 15627 15628 // allow canceling activation 15629 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 15630 return; 15631 } 15632 15633 options.active = collapsing ? false : this.tabs.index( tab ); 15634 15635 this.active = clickedIsActive ? $() : tab; 15636 if ( this.xhr ) { 15637 this.xhr.abort(); 15638 } 15639 15640 if ( !toHide.length && !toShow.length ) { 15641 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 15642 } 15643 15644 if ( toShow.length ) { 15645 this.load( this.tabs.index( tab ), event ); 15646 } 15647 this._toggle( event, eventData ); 15648 }, 15649 15650 // Handles show/hide for selecting tabs 15651 _toggle: function( event, eventData ) { 15652 var that = this, 15653 toShow = eventData.newPanel, 15654 toHide = eventData.oldPanel; 15655 15656 this.running = true; 15657 15658 function complete() { 15659 that.running = false; 15660 that._trigger( "activate", event, eventData ); 15661 } 15662 15663 function show() { 15664 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 15665 15666 if ( toShow.length && that.options.show ) { 15667 that._show( toShow, that.options.show, complete ); 15668 } else { 15669 toShow.show(); 15670 complete(); 15671 } 15672 } 15673 15674 // Start out by hiding, then showing, then completing 15675 if ( toHide.length && this.options.hide ) { 15676 this._hide( toHide, this.options.hide, function() { 15677 that._removeClass( eventData.oldTab.closest( "li" ), 15678 "ui-tabs-active", "ui-state-active" ); 15679 show(); 15680 } ); 15681 } else { 15682 this._removeClass( eventData.oldTab.closest( "li" ), 15683 "ui-tabs-active", "ui-state-active" ); 15684 toHide.hide(); 15685 show(); 15686 } 15687 15688 toHide.attr( "aria-hidden", "true" ); 15689 eventData.oldTab.attr( { 15690 "aria-selected": "false", 15691 "aria-expanded": "false" 15692 } ); 15693 15694 // If we're switching tabs, remove the old tab from the tab order. 15695 // If we're opening from collapsed state, remove the previous tab from the tab order. 15696 // If we're collapsing, then keep the collapsing tab in the tab order. 15697 if ( toShow.length && toHide.length ) { 15698 eventData.oldTab.attr( "tabIndex", -1 ); 15699 } else if ( toShow.length ) { 15700 this.tabs.filter( function() { 15701 return $( this ).attr( "tabIndex" ) === 0; 15702 } ) 15703 .attr( "tabIndex", -1 ); 15704 } 15705 15706 toShow.attr( "aria-hidden", "false" ); 15707 eventData.newTab.attr( { 15708 "aria-selected": "true", 15709 "aria-expanded": "true", 15710 tabIndex: 0 15711 } ); 15712 }, 15713 15714 _activate: function( index ) { 15715 var anchor, 15716 active = this._findActive( index ); 15717 15718 // Trying to activate the already active panel 15719 if ( active[ 0 ] === this.active[ 0 ] ) { 15720 return; 15721 } 15722 15723 // Trying to collapse, simulate a click on the current active header 15724 if ( !active.length ) { 15725 active = this.active; 15726 } 15727 15728 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 15729 this._eventHandler( { 15730 target: anchor, 15731 currentTarget: anchor, 15732 preventDefault: $.noop 15733 } ); 15734 }, 15735 15736 _findActive: function( index ) { 15737 return index === false ? $() : this.tabs.eq( index ); 15738 }, 15739 15740 _getIndex: function( index ) { 15741 15742 // meta-function to give users option to provide a href string instead of a numerical index. 15743 if ( typeof index === "string" ) { 15744 index = this.anchors.index( this.anchors.filter( "[href$='" + 15745 $.
vendor: 18,827 bytes, lines 15745-16450
15745escapeSelector( index ) + "']" ) ); 15746 } 15747 15748 return index; 15749 }, 15750 15751 _destroy: function() { 15752 if ( this.xhr ) { 15753 this.xhr.abort(); 15754 } 15755 15756 this.tablist 15757 .removeAttr( "role" ) 15758 .off( this.eventNamespace ); 15759 15760 this.anchors 15761 .removeAttr( "role tabIndex" ) 15762 .removeUniqueId(); 15763 15764 this.tabs.add( this.panels ).each( function() { 15765 if ( $.data( this, "ui-tabs-destroy" ) ) { 15766 $( this ).remove(); 15767 } else { 15768 $( this ).removeAttr( "role tabIndex " + 15769 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 15770 } 15771 } ); 15772 15773 this.tabs.each( function() { 15774 var li = $( this ), 15775 prev = li.data( "ui-tabs-aria-controls" ); 15776 if ( prev ) { 15777 li 15778 .attr( "aria-controls", prev ) 15779 .removeData( "ui-tabs-aria-controls" ); 15780 } else { 15781 li.removeAttr( "aria-controls" ); 15782 } 15783 } ); 15784 15785 this.panels.show(); 15786 15787 if ( this.options.heightStyle !== "content" ) { 15788 this.panels.css( "height", "" ); 15789 } 15790 }, 15791 15792 enable: function( index ) { 15793 var disabled = this.options.disabled; 15794 if ( disabled === false ) { 15795 return; 15796 } 15797 15798 if ( index === undefined ) { 15799 disabled = false; 15800 } else { 15801 index = this._getIndex( index ); 15802 if ( Array.isArray( disabled ) ) { 15803 disabled = $.map( disabled, function( num ) { 15804 return num !== index ? num : null; 15805 } ); 15806 } else { 15807 disabled = $.map( this.tabs, function( li, num ) { 15808 return num !== index ? num : null; 15809 } ); 15810 } 15811 } 15812 this._setOptionDisabled( disabled ); 15813 }, 15814 15815 disable: function( index ) { 15816 var disabled = this.options.disabled; 15817 if ( disabled === true ) { 15818 return; 15819 } 15820 15821 if ( index === undefined ) { 15822 disabled = true; 15823 } else { 15824 index = this._getIndex( index ); 15825 if ( $.inArray( index, disabled ) !== -1 ) { 15826 return; 15827 } 15828 if ( Array.isArray( disabled ) ) { 15829 disabled = $.merge( [ index ], disabled ).sort(); 15830 } else { 15831 disabled = [ index ]; 15832 } 15833 } 15834 this._setOptionDisabled( disabled ); 15835 }, 15836 15837 load: function( index, event ) { 15838 index = this._getIndex( index ); 15839 var that = this, 15840 tab = this.tabs.eq( index ), 15841 anchor = tab.find( ".ui-tabs-anchor" ), 15842 panel = this._getPanelForTab( tab ), 15843 eventData = { 15844 tab: tab, 15845 panel: panel 15846 }, 15847 complete = function( jqXHR, status ) { 15848 if ( status === "abort" ) { 15849 that.panels.stop( false, true ); 15850 } 15851 15852 that._removeClass( tab, "ui-tabs-loading" ); 15853 panel.removeAttr( "aria-busy" ); 15854 15855 if ( jqXHR === that.xhr ) { 15856 delete that.xhr; 15857 } 15858 }; 15859 15860 // Not remote 15861 if ( this._isLocal( anchor[ 0 ] ) ) { 15862 return; 15863 } 15864 15865 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 15866 15867 // Support: jQuery <1.8 15868 // jQuery <1.8 returns false if the request is canceled in beforeSend, 15869 // but as of 1.8, $.ajax() always returns a jqXHR object. 15870 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 15871 this._addClass( tab, "ui-tabs-loading" ); 15872 panel.attr( "aria-busy", "true" ); 15873 15874 this.xhr 15875 .done( function( response, status, jqXHR ) { 15876 15877 // support: jQuery <1.8 15878 // http://bugs.jquery.com/ticket/11778 15879 setTimeout( function() { 15880 panel.html( response ); 15881 that._trigger( "load", event, eventData ); 15882 15883 complete( jqXHR, status ); 15884 }, 1 ); 15885 } ) 15886 .fail( function( jqXHR, status ) { 15887 15888 // support: jQuery <1.8 15889 // http://bugs.jquery.com/ticket/11778 15890 setTimeout( function() { 15891 complete( jqXHR, status ); 15892 }, 1 ); 15893 } ); 15894 } 15895 }, 15896 15897 _ajaxSettings: function( anchor, event, eventData ) { 15898 var that = this; 15899 return { 15900 15901 // Support: IE <11 only 15902 // Strip any hash that exists to prevent errors with the Ajax request 15903 url: anchor.attr( "href" ).replace( /#.*$/, "" ), 15904 beforeSend: function( jqXHR, settings ) { 15905 return that._trigger( "beforeLoad", event, 15906 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 15907 } 15908 }; 15909 }, 15910 15911 _getPanelForTab: function( tab ) { 15912 var id = $( tab ).attr( "aria-controls" ); 15913 return this.element.find( this._sanitizeSelector( "#" + id ) ); 15914 } 15915} ); 15916 15917// DEPRECATED 15918// TODO: Switch return back to widget declaration at top of file when this is removed 15919if ( $.uiBackCompat !== false ) { 15920 15921 // Backcompat for ui-tab class (now ui-tabs-tab) 15922 $.widget( "ui.tabs", $.ui.tabs, { 15923 _processTabs: function() { 15924 this._superApply( arguments ); 15925 this._addClass( this.tabs, "ui-tab" ); 15926 } 15927 } ); 15928} 15929 15930var widgetsTabs = $.ui.tabs; 15931 15932 15933/*! 15934 * jQuery UI Tooltip 1.13.0 15935 * http://jqueryui.com 15936 * 15937 * Copyright jQuery Foundation and other contributors 15938 * Released under the MIT license. 15939 * http://jquery.org/license 15940 */ 15941 15942//>>label: Tooltip 15943//>>group: Widgets 15944//>>description: Shows additional information for any element on hover or focus. 15945//>>docs: http://api.jqueryui.com/tooltip/ 15946//>>demos: http://jqueryui.com/tooltip/ 15947//>>css.structure: ../../themes/base/core.css 15948//>>css.structure: ../../themes/base/tooltip.css 15949//>>css.theme: ../../themes/base/theme.css 15950 15951 15952$.widget( "ui.tooltip", { 15953 version: "1.13.0", 15954 options: { 15955 classes: { 15956 "ui-tooltip": "ui-corner-all ui-widget-shadow" 15957 }, 15958 content: function() { 15959 var title = $( this ).attr( "title" ); 15960 15961 // Escape title, since we're going from an attribute to raw HTML 15962 return $( "<a>" ).text( title ).html(); 15963 }, 15964 hide: true, 15965 15966 // Disabled elements have inconsistent behavior across browsers (#8661) 15967 items: "[title]:not([disabled])", 15968 position: { 15969 my: "left top+15", 15970 at: "left bottom", 15971 collision: "flipfit flip" 15972 }, 15973 show: true, 15974 track: false, 15975 15976 // Callbacks 15977 close: null, 15978 open: null 15979 }, 15980 15981 _addDescribedBy: function( elem, id ) { 15982 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 15983 describedby.push( id ); 15984 elem 15985 .data( "ui-tooltip-id", id ) 15986 .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) ); 15987 }, 15988 15989 _removeDescribedBy: function( elem ) { 15990 var id = elem.data( "ui-tooltip-id" ), 15991 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 15992 index = $.inArray( id, describedby ); 15993 15994 if ( index !== -1 ) { 15995 describedby.splice( index, 1 ); 15996 } 15997 15998 elem.removeData( "ui-tooltip-id" ); 15999 describedby = String.prototype.trim.call( describedby.join( " " ) ); 16000 if ( describedby ) { 16001 elem.attr( "aria-describedby", describedby ); 16002 } else { 16003 elem.removeAttr( "aria-describedby" ); 16004 } 16005 }, 16006 16007 _create: function() { 16008 this._on( { 16009 mouseover: "open", 16010 focusin: "open" 16011 } ); 16012 16013 // IDs of generated tooltips, needed for destroy 16014 this.tooltips = {}; 16015 16016 // IDs of parent tooltips where we removed the title attribute 16017 this.parents = {}; 16018 16019 // Append the aria-live region so tooltips announce correctly 16020 this.liveRegion = $( "<div>" ) 16021 .attr( { 16022 role: "log", 16023 "aria-live": "assertive", 16024 "aria-relevant": "additions" 16025 } ) 16026 .appendTo( this.document[ 0 ].body ); 16027 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 16028 16029 this.disabledTitles = $( [] ); 16030 }, 16031 16032 _setOption: function( key, value ) { 16033 var that = this; 16034 16035 this._super( key, value ); 16036 16037 if ( key === "content" ) { 16038 $.each( this.tooltips, function( id, tooltipData ) { 16039 that._updateContent( tooltipData.element ); 16040 } ); 16041 } 16042 }, 16043 16044 _setOptionDisabled: function( value ) { 16045 this[ value ? "_disable" : "_enable" ](); 16046 }, 16047 16048 _disable: function() { 16049 var that = this; 16050 16051 // Close open tooltips 16052 $.each( this.tooltips, function( id, tooltipData ) { 16053 var event = $.Event( "blur" ); 16054 event.target = event.currentTarget = tooltipData.element[ 0 ]; 16055 that.close( event, true ); 16056 } ); 16057 16058 // Remove title attributes to prevent native tooltips 16059 this.disabledTitles = this.disabledTitles.add( 16060 this.element.find( this.options.items ).addBack() 16061 .filter( function() { 16062 var element = $( this ); 16063 if ( element.is( "[title]" ) ) { 16064 return element 16065 .data( "ui-tooltip-title", element.attr( "title" ) ) 16066 .removeAttr( "title" ); 16067 } 16068 } ) 16069 ); 16070 }, 16071 16072 _enable: function() { 16073 16074 // restore title attributes 16075 this.disabledTitles.each( function() { 16076 var element = $( this ); 16077 if ( element.data( "ui-tooltip-title" ) ) { 16078 element.attr( "title", element.data( "ui-tooltip-title" ) ); 16079 } 16080 } ); 16081 this.disabledTitles = $( [] ); 16082 }, 16083 16084 open: function( event ) { 16085 var that = this, 16086 target = $( event ? event.target : this.element ) 16087 16088 // we need closest here due to mouseover bubbling, 16089 // but always pointing at the same event target 16090 .closest( this.options.items ); 16091 16092 // No element to show a tooltip for or the tooltip is already open 16093 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 16094 return; 16095 } 16096 16097 if ( target.attr( "title" ) ) { 16098 target.data( "ui-tooltip-title", target.attr( "title" ) ); 16099 } 16100 16101 target.data( "ui-tooltip-open", true ); 16102 16103 // Kill parent tooltips, custom or native, for hover 16104 if ( event && event.type === "mouseover" ) { 16105 target.parents().each( function() { 16106 var parent = $( this ), 16107 blurEvent; 16108 if ( parent.data( "ui-tooltip-open" ) ) { 16109 blurEvent = $.Event( "blur" ); 16110 blurEvent.target = blurEvent.currentTarget = this; 16111 that.close( blurEvent, true ); 16112 } 16113 if ( parent.attr( "title" ) ) { 16114 parent.uniqueId(); 16115 that.parents[ this.id ] = { 16116 element: this, 16117 title: parent.attr( "title" ) 16118 }; 16119 parent.attr( "title", "" ); 16120 } 16121 } ); 16122 } 16123 16124 this._registerCloseHandlers( event, target ); 16125 this._updateContent( target, event ); 16126 }, 16127 16128 _updateContent: function( target, event ) { 16129 var content, 16130 contentOption = this.options.content, 16131 that = this, 16132 eventType = event ? event.type : null; 16133 16134 if ( typeof contentOption === "string" || contentOption.nodeType || 16135 contentOption.jquery ) { 16136 return this._open( event, target, contentOption ); 16137 } 16138 16139 content = contentOption.call( target[ 0 ], function( response ) { 16140 16141 // IE may instantly serve a cached response for ajax requests 16142 // delay this call to _open so the other call to _open runs first 16143 that._delay( function() { 16144 16145 // Ignore async response if tooltip was closed already 16146 if ( !target.data( "ui-tooltip-open" ) ) { 16147 return; 16148 } 16149 16150 // JQuery creates a special event for focusin when it doesn't 16151 // exist natively. To improve performance, the native event 16152 // object is reused and the type is changed. Therefore, we can't 16153 // rely on the type being correct after the event finished 16154 // bubbling, so we set it back to the previous value. (#8740) 16155 if ( event ) { 16156 event.type = eventType; 16157 } 16158 this._open( event, target, response ); 16159 } ); 16160 } ); 16161 if ( content ) { 16162 this._open( event, target, content ); 16163 } 16164 }, 16165 16166 _open: function( event, target, content ) { 16167 var tooltipData, tooltip, delayedShow, a11yContent, 16168 positionOption = $.extend( {}, this.options.position ); 16169 16170 if ( !content ) { 16171 return; 16172 } 16173 16174 // Content can be updated multiple times. If the tooltip already 16175 // exists, then just update the content and bail. 16176 tooltipData = this._find( target ); 16177 if ( tooltipData ) { 16178 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 16179 return; 16180 } 16181 16182 // If we have a title, clear it to prevent the native tooltip 16183 // we have to check first to avoid defining a title if none exists 16184 // (we don't want to cause an element to start matching [title]) 16185 // 16186 // We use removeAttr only for key events, to allow IE to export the correct 16187 // accessible attributes. For mouse events, set to empty string to avoid 16188 // native tooltip showing up (happens only when removing inside mouseover). 16189 if ( target.is( "[title]" ) ) { 16190 if ( event && event.type === "mouseover" ) { 16191 target.attr( "title", "" ); 16192 } else { 16193 target.removeAttr( "title" ); 16194 } 16195 } 16196 16197 tooltipData = this._tooltip( target ); 16198 tooltip = tooltipData.tooltip; 16199 this._addDescribedBy( target, tooltip.attr( "id" ) ); 16200 tooltip.find( ".ui-tooltip-content" ).html( content ); 16201 16202 // Support: Voiceover on OS X, JAWS on IE <= 9 16203 // JAWS announces deletions even when aria-relevant="additions" 16204 // Voiceover will sometimes re-read the entire log region's contents from the beginning 16205 this.liveRegion.children().hide(); 16206 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 16207 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 16208 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 16209 a11yContent.appendTo( this.liveRegion ); 16210 16211 function position( event ) { 16212 positionOption.of = event; 16213 if ( tooltip.is( ":hidden" ) ) { 16214 return; 16215 } 16216 tooltip.position( positionOption ); 16217 } 16218 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 16219 this._on( this.document, { 16220 mousemove: position 16221 } ); 16222 16223 // trigger once to override element-relative positioning 16224 position( event ); 16225 } else { 16226 tooltip.position( $.extend( { 16227 of: target 16228 }, this.options.position ) ); 16229 } 16230 16231 tooltip.hide(); 16232 16233 this._show( tooltip, this.options.show ); 16234 16235 // Handle tracking tooltips that are shown with a delay (#8644). As soon 16236 // as the tooltip is visible, position the tooltip using the most recent 16237 // event. 16238 // Adds the check to add the timers only when both delay and track options are set (#14682) 16239 if ( this.options.track && this.options.show && this.options.show.delay ) { 16240 delayedShow = this.delayedShow = setInterval( function() { 16241 if ( tooltip.is( ":visible" ) ) { 16242 position( positionOption.of ); 16243 clearInterval( delayedShow ); 16244 } 16245 }, 13 ); 16246 } 16247 16248 this._trigger( "open", event, { tooltip: tooltip } ); 16249 }, 16250 16251 _registerCloseHandlers: function( event, target ) { 16252 var events = { 16253 keyup: function( event ) { 16254 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 16255 var fakeEvent = $.Event( event ); 16256 fakeEvent.currentTarget = target[ 0 ]; 16257 this.close( fakeEvent, true ); 16258 } 16259 } 16260 }; 16261 16262 // Only bind remove handler for delegated targets. Non-delegated 16263 // tooltips will handle this in destroy. 16264 if ( target[ 0 ] !== this.element[ 0 ] ) { 16265 events.remove = function() { 16266 this._removeTooltip( this._find( target ).tooltip ); 16267 }; 16268 } 16269 16270 if ( !event || event.type === "mouseover" ) { 16271 events.mouseleave = "close"; 16272 } 16273 if ( !event || event.type === "focusin" ) { 16274 events.focusout = "close"; 16275 } 16276 this._on( true, target, events ); 16277 }, 16278 16279 close: function( event ) { 16280 var tooltip, 16281 that = this, 16282 target = $( event ? event.currentTarget : this.element ), 16283 tooltipData = this._find( target ); 16284 16285 // The tooltip may already be closed 16286 if ( !tooltipData ) { 16287 16288 // We set ui-tooltip-open immediately upon open (in open()), but only set the 16289 // additional data once there's actually content to show (in _open()). So even if the 16290 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 16291 // the period between open() and _open(). 16292 target.removeData( "ui-tooltip-open" ); 16293 return; 16294 } 16295 16296 tooltip = tooltipData.tooltip; 16297 16298 // Disabling closes the tooltip, so we need to track when we're closing 16299 // to avoid an infinite loop in case the tooltip becomes disabled on close 16300 if ( tooltipData.closing ) { 16301 return; 16302 } 16303 16304 // Clear the interval for delayed tracking tooltips 16305 clearInterval( this.delayedShow ); 16306 16307 // Only set title if we had one before (see comment in _open()) 16308 // If the title attribute has changed since open(), don't restore 16309 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 16310 target.attr( "title", target.data( "ui-tooltip-title" ) ); 16311 } 16312 16313 this._removeDescribedBy( target ); 16314 16315 tooltipData.hiding = true; 16316 tooltip.stop( true ); 16317 this._hide( tooltip, this.options.hide, function() { 16318 that._removeTooltip( $( this ) ); 16319 } ); 16320 16321 target.removeData( "ui-tooltip-open" ); 16322 this._off( target, "mouseleave focusout keyup" ); 16323 16324 // Remove 'remove' binding only on delegated targets 16325 if ( target[ 0 ] !== this.element[ 0 ] ) { 16326 this._off( target, "remove" ); 16327 } 16328 this._off( this.document, "mousemove" ); 16329 16330 if ( event && event.type === "mouseleave" ) { 16331 $.each( this.parents, function( id, parent ) { 16332 $( parent.element ).attr( "title", parent.title ); 16333 delete that.parents[ id ]; 16334 } ); 16335 } 16336 16337 tooltipData.closing = true; 16338 this._trigger( "close", event, { tooltip: tooltip } ); 16339 if ( !tooltipData.hiding ) { 16340 tooltipData.closing = false; 16341 } 16342 }, 16343 16344 _tooltip: function( element ) { 16345 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 16346 content = $( "<div>" ).appendTo( tooltip ), 16347 id = tooltip.uniqueId().attr( "id" ); 16348 16349 this._addClass( content, "ui-tooltip-content" ); 16350 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 16351 16352 tooltip.appendTo( this._appendTo( element ) ); 16353 16354 return this.tooltips[ id ] = { 16355 element: element, 16356 tooltip: tooltip 16357 }; 16358 }, 16359 16360 _find: function( target ) { 16361 var id = target.data( "ui-tooltip-id" ); 16362 return id ? this.tooltips[ id ] : null; 16363 }, 16364 16365 _removeTooltip: function( tooltip ) { 16366 16367 // Clear the interval for delayed tracking tooltips 16368 clearInterval( this.delayedShow ); 16369 16370 tooltip.remove(); 16371 delete this.tooltips[ tooltip.attr( "id" ) ]; 16372 }, 16373 16374 _appendTo: function( target ) { 16375 var element = target.closest( ".ui-front, dialog" ); 16376 16377 if ( !element.length ) { 16378 element = this.document[ 0 ].body; 16379 } 16380 16381 return element; 16382 }, 16383 16384 _destroy: function() { 16385 var that = this; 16386 16387 // Close open tooltips 16388 $.each( this.tooltips, function( id, tooltipData ) { 16389 16390 // Delegate to close method to handle common cleanup 16391 var event = $.Event( "blur" ), 16392 element = tooltipData.element; 16393 event.target = event.currentTarget = element[ 0 ]; 16394 that.close( event, true ); 16395 16396 // Remove immediately; destroying an open tooltip doesn't use the 16397 // hide animation 16398 $( "#" + id ).remove(); 16399 16400 // Restore the title 16401 if ( element.data( "ui-tooltip-title" ) ) { 16402 16403 // If the title attribute has changed since open(), don't restore 16404 if ( !element.attr( "title" ) ) { 16405 element.attr( "title", element.data( "ui-tooltip-title" ) ); 16406 } 16407 element.removeData( "ui-tooltip-title" ); 16408 } 16409 } ); 16410 this.liveRegion.remove(); 16411 } 16412} ); 16413 16414// DEPRECATED 16415// TODO: Switch return back to widget declaration at top of file when this is removed 16416if ( $.uiBackCompat !== false ) { 16417 16418 // Backcompat for tooltipClass option 16419 $.widget( "ui.tooltip", $.ui.tooltip, { 16420 options: { 16421 tooltipClass: null 16422 }, 16423 _tooltip: function() { 16424 var tooltipData = this._superApply( arguments ); 16425 if ( this.options.tooltipClass ) { 16426 tooltipData.tooltip.addClass( this.options.tooltipClass ); 16427 } 16428 return tooltipData; 16429 } 16430 } ); 16431} 16432 16433var widgetsTooltip = $.ui.tooltip; 16434 16435 16436 16437// Create a local jQuery because jQuery Color relies on it and the 16438// global may not exist with AMD and a custom build (#10199). 16439// This module is a noop if used as a regular AMD module. 16440// eslint-disable-next-line no-unused-vars 16441var jQuery = $; 16442 16443 16444/*! 16445 * jQuery Color Animations v2.2.0 16446 * https://github.com/jquery/jquery-color 16447 * 16448 * Copyright OpenJS Foundation and other contributors 16449 * Released under the MIT license. 16450 * http
vendor: 16,926 bytes, lines 16450-17157
16450://jquery.org/license 16451 * 16452 * Date: Sun May 10 09:02:36 2020 +0200 16453 */ 16454 16455 16456 16457 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 16458 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 16459 16460 class2type = {}, 16461 toString = class2type.toString, 16462 16463 // plusequals test for += 100 -= 100 16464 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 16465 16466 // a set of RE's that can match strings and generate color tuples. 16467 stringParsers = [ { 16468 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16469 parse: function( execResult ) { 16470 return [ 16471 execResult[ 1 ], 16472 execResult[ 2 ], 16473 execResult[ 3 ], 16474 execResult[ 4 ] 16475 ]; 16476 } 16477 }, { 16478 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16479 parse: function( execResult ) { 16480 return [ 16481 execResult[ 1 ] * 2.55, 16482 execResult[ 2 ] * 2.55, 16483 execResult[ 3 ] * 2.55, 16484 execResult[ 4 ] 16485 ]; 16486 } 16487 }, { 16488 16489 // this regex ignores A-F because it's compared against an already lowercased string 16490 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 16491 parse: function( execResult ) { 16492 return [ 16493 parseInt( execResult[ 1 ], 16 ), 16494 parseInt( execResult[ 2 ], 16 ), 16495 parseInt( execResult[ 3 ], 16 ), 16496 execResult[ 4 ] ? 16497 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 16498 1 16499 ]; 16500 } 16501 }, { 16502 16503 // this regex ignores A-F because it's compared against an already lowercased string 16504 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 16505 parse: function( execResult ) { 16506 return [ 16507 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 16508 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 16509 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 16510 execResult[ 4 ] ? 16511 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 16512 .toFixed( 2 ) : 16513 1 16514 ]; 16515 } 16516 }, { 16517 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 16518 space: "hsla", 16519 parse: function( execResult ) { 16520 return [ 16521 execResult[ 1 ], 16522 execResult[ 2 ] / 100, 16523 execResult[ 3 ] / 100, 16524 execResult[ 4 ] 16525 ]; 16526 } 16527 } ], 16528 16529 // jQuery.Color( ) 16530 color = jQuery.Color = function( color, green, blue, alpha ) { 16531 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 16532 }, 16533 spaces = { 16534 rgba: { 16535 props: { 16536 red: { 16537 idx: 0, 16538 type: "byte" 16539 }, 16540 green: { 16541 idx: 1, 16542 type: "byte" 16543 }, 16544 blue: { 16545 idx: 2, 16546 type: "byte" 16547 } 16548 } 16549 }, 16550 16551 hsla: { 16552 props: { 16553 hue: { 16554 idx: 0, 16555 type: "degrees" 16556 }, 16557 saturation: { 16558 idx: 1, 16559 type: "percent" 16560 }, 16561 lightness: { 16562 idx: 2, 16563 type: "percent" 16564 } 16565 } 16566 } 16567 }, 16568 propTypes = { 16569 "byte": { 16570 floor: true, 16571 max: 255 16572 }, 16573 "percent": { 16574 max: 1 16575 }, 16576 "degrees": { 16577 mod: 360, 16578 floor: true 16579 } 16580 }, 16581 support = color.support = {}, 16582 16583 // element for support tests 16584 supportElem = jQuery( "<p>" )[ 0 ], 16585 16586 // colors = jQuery.Color.names 16587 colors, 16588 16589 // local aliases of functions called often 16590 each = jQuery.each; 16591 16592// determine rgba support immediately 16593supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 16594support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 16595 16596// define cache name and alpha properties 16597// for rgba and hsla spaces 16598each( spaces, function( spaceName, space ) { 16599 space.cache = "_" + spaceName; 16600 space.props.alpha = { 16601 idx: 3, 16602 type: "percent", 16603 def: 1 16604 }; 16605} ); 16606 16607// Populate the class2type map 16608jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 16609 function( _i, name ) { 16610 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 16611 } ); 16612 16613function getType( obj ) { 16614 if ( obj == null ) { 16615 return obj + ""; 16616 } 16617 16618 return typeof obj === "object" ? 16619 class2type[ toString.call( obj ) ] || "object" : 16620 typeof obj; 16621} 16622 16623function clamp( value, prop, allowEmpty ) { 16624 var type = propTypes[ prop.type ] || {}; 16625 16626 if ( value == null ) { 16627 return ( allowEmpty || !prop.def ) ? null : prop.def; 16628 } 16629 16630 // ~~ is an short way of doing floor for positive numbers 16631 value = type.floor ? ~~value : parseFloat( value ); 16632 16633 // IE will pass in empty strings as value for alpha, 16634 // which will hit this case 16635 if ( isNaN( value ) ) { 16636 return prop.def; 16637 } 16638 16639 if ( type.mod ) { 16640 16641 // we add mod before modding to make sure that negatives values 16642 // get converted properly: -10 -> 350 16643 return ( value + type.mod ) % type.mod; 16644 } 16645 16646 // for now all property types without mod have min and max 16647 return Math.min( type.max, Math.max( 0, value ) ); 16648} 16649 16650function stringParse( string ) { 16651 var inst = color(), 16652 rgba = inst._rgba = []; 16653 16654 string = string.toLowerCase(); 16655 16656 each( stringParsers, function( _i, parser ) { 16657 var parsed, 16658 match = parser.re.exec( string ), 16659 values = match && parser.parse( match ), 16660 spaceName = parser.space || "rgba"; 16661 16662 if ( values ) { 16663 parsed = inst[ spaceName ]( values ); 16664 16665 // if this was an rgba parse the assignment might happen twice 16666 // oh well.... 16667 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 16668 rgba = inst._rgba = parsed._rgba; 16669 16670 // exit each( stringParsers ) here because we matched 16671 return false; 16672 } 16673 } ); 16674 16675 // Found a stringParser that handled it 16676 if ( rgba.length ) { 16677 16678 // if this came from a parsed string, force "transparent" when alpha is 0 16679 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 16680 if ( rgba.join() === "0,0,0,0" ) { 16681 jQuery.extend( rgba, colors.transparent ); 16682 } 16683 return inst; 16684 } 16685 16686 // named colors 16687 return colors[ string ]; 16688} 16689 16690color.fn = jQuery.extend( color.prototype, { 16691 parse: function( red, green, blue, alpha ) { 16692 if ( red === undefined ) { 16693 this._rgba = [ null, null, null, null ]; 16694 return this; 16695 } 16696 if ( red.jquery || red.nodeType ) { 16697 red = jQuery( red ).css( green ); 16698 green = undefined; 16699 } 16700 16701 var inst = this, 16702 type = getType( red ), 16703 rgba = this._rgba = []; 16704 16705 // more than 1 argument specified - assume ( red, green, blue, alpha ) 16706 if ( green !== undefined ) { 16707 red = [ red, green, blue, alpha ]; 16708 type = "array"; 16709 } 16710 16711 if ( type === "string" ) { 16712 return this.parse( stringParse( red ) || colors._default ); 16713 } 16714 16715 if ( type === "array" ) { 16716 each( spaces.rgba.props, function( _key, prop ) { 16717 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 16718 } ); 16719 return this; 16720 } 16721 16722 if ( type === "object" ) { 16723 if ( red instanceof color ) { 16724 each( spaces, function( _spaceName, space ) { 16725 if ( red[ space.cache ] ) { 16726 inst[ space.cache ] = red[ space.cache ].slice(); 16727 } 16728 } ); 16729 } else { 16730 each( spaces, function( _spaceName, space ) { 16731 var cache = space.cache; 16732 each( space.props, function( key, prop ) { 16733 16734 // if the cache doesn't exist, and we know how to convert 16735 if ( !inst[ cache ] && space.to ) { 16736 16737 // if the value was null, we don't need to copy it 16738 // if the key was alpha, we don't need to copy it either 16739 if ( key === "alpha" || red[ key ] == null ) { 16740 return; 16741 } 16742 inst[ cache ] = space.to( inst._rgba ); 16743 } 16744 16745 // this is the only case where we allow nulls for ALL properties. 16746 // call clamp with alwaysAllowEmpty 16747 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 16748 } ); 16749 16750 // everything defined but alpha? 16751 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 16752 16753 // use the default of 1 16754 if ( inst[ cache ][ 3 ] == null ) { 16755 inst[ cache ][ 3 ] = 1; 16756 } 16757 16758 if ( space.from ) { 16759 inst._rgba = space.from( inst[ cache ] ); 16760 } 16761 } 16762 } ); 16763 } 16764 return this; 16765 } 16766 }, 16767 is: function( compare ) { 16768 var is = color( compare ), 16769 same = true, 16770 inst = this; 16771 16772 each( spaces, function( _, space ) { 16773 var localCache, 16774 isCache = is[ space.cache ]; 16775 if ( isCache ) { 16776 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 16777 each( space.props, function( _, prop ) { 16778 if ( isCache[ prop.idx ] != null ) { 16779 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 16780 return same; 16781 } 16782 } ); 16783 } 16784 return same; 16785 } ); 16786 return same; 16787 }, 16788 _space: function() { 16789 var used = [], 16790 inst = this; 16791 each( spaces, function( spaceName, space ) { 16792 if ( inst[ space.cache ] ) { 16793 used.push( spaceName ); 16794 } 16795 } ); 16796 return used.pop(); 16797 }, 16798 transition: function( other, distance ) { 16799 var end = color( other ), 16800 spaceName = end._space(), 16801 space = spaces[ spaceName ], 16802 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 16803 start = startColor[ space.cache ] || space.to( startColor._rgba ), 16804 result = start.slice(); 16805 16806 end = end[ space.cache ]; 16807 each( space.props, function( _key, prop ) { 16808 var index = prop.idx, 16809 startValue = start[ index ], 16810 endValue = end[ index ], 16811 type = propTypes[ prop.type ] || {}; 16812 16813 // if null, don't override start value 16814 if ( endValue === null ) { 16815 return; 16816 } 16817 16818 // if null - use end 16819 if ( startValue === null ) { 16820 result[ index ] = endValue; 16821 } else { 16822 if ( type.mod ) { 16823 if ( endValue - startValue > type.mod / 2 ) { 16824 startValue += type.mod; 16825 } else if ( startValue - endValue > type.mod / 2 ) { 16826 startValue -= type.mod; 16827 } 16828 } 16829 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 16830 } 16831 } ); 16832 return this[ spaceName ]( result ); 16833 }, 16834 blend: function( opaque ) { 16835 16836 // if we are already opaque - return ourself 16837 if ( this._rgba[ 3 ] === 1 ) { 16838 return this; 16839 } 16840 16841 var rgb = this._rgba.slice(), 16842 a = rgb.pop(), 16843 blend = color( opaque )._rgba; 16844 16845 return color( jQuery.map( rgb, function( v, i ) { 16846 return ( 1 - a ) * blend[ i ] + a * v; 16847 } ) ); 16848 }, 16849 toRgbaString: function() { 16850 var prefix = "rgba(", 16851 rgba = jQuery.map( this._rgba, function( v, i ) { 16852 if ( v != null ) { 16853 return v; 16854 } 16855 return i > 2 ? 1 : 0; 16856 } ); 16857 16858 if ( rgba[ 3 ] === 1 ) { 16859 rgba.pop(); 16860 prefix = "rgb("; 16861 } 16862 16863 return prefix + rgba.join() + ")"; 16864 }, 16865 toHslaString: function() { 16866 var prefix = "hsla(", 16867 hsla = jQuery.map( this.hsla(), function( v, i ) { 16868 if ( v == null ) { 16869 v = i > 2 ? 1 : 0; 16870 } 16871 16872 // catch 1 and 2 16873 if ( i && i < 3 ) { 16874 v = Math.round( v * 100 ) + "%"; 16875 } 16876 return v; 16877 } ); 16878 16879 if ( hsla[ 3 ] === 1 ) { 16880 hsla.pop(); 16881 prefix = "hsl("; 16882 } 16883 return prefix + hsla.join() + ")"; 16884 }, 16885 toHexString: function( includeAlpha ) { 16886 var rgba = this._rgba.slice(), 16887 alpha = rgba.pop(); 16888 16889 if ( includeAlpha ) { 16890 rgba.push( ~~( alpha * 255 ) ); 16891 } 16892 16893 return "#" + jQuery.map( rgba, function( v ) { 16894 16895 // default to 0 when nulls exist 16896 v = ( v || 0 ).toString( 16 ); 16897 return v.length === 1 ? "0" + v : v; 16898 } ).join( "" ); 16899 }, 16900 toString: function() { 16901 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 16902 } 16903} ); 16904color.fn.parse.prototype = color.fn; 16905 16906// hsla conversions adapted from: 16907// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 16908 16909function hue2rgb( p, q, h ) { 16910 h = ( h + 1 ) % 1; 16911 if ( h * 6 < 1 ) { 16912 return p + ( q - p ) * h * 6; 16913 } 16914 if ( h * 2 < 1 ) { 16915 return q; 16916 } 16917 if ( h * 3 < 2 ) { 16918 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 16919 } 16920 return p; 16921} 16922 16923spaces.hsla.to = function( rgba ) { 16924 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 16925 return [ null, null, null, rgba[ 3 ] ]; 16926 } 16927 var r = rgba[ 0 ] / 255, 16928 g = rgba[ 1 ] / 255, 16929 b = rgba[ 2 ] / 255, 16930 a = rgba[ 3 ], 16931 max = Math.max( r, g, b ), 16932 min = Math.min( r, g, b ), 16933 diff = max - min, 16934 add = max + min, 16935 l = add * 0.5, 16936 h, s; 16937 16938 if ( min === max ) { 16939 h = 0; 16940 } else if ( r === max ) { 16941 h = ( 60 * ( g - b ) / diff ) + 360; 16942 } else if ( g === max ) { 16943 h = ( 60 * ( b - r ) / diff ) + 120; 16944 } else { 16945 h = ( 60 * ( r - g ) / diff ) + 240; 16946 } 16947 16948 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 16949 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 16950 if ( diff === 0 ) { 16951 s = 0; 16952 } else if ( l <= 0.5 ) { 16953 s = diff / add; 16954 } else { 16955 s = diff / ( 2 - add ); 16956 } 16957 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 16958}; 16959 16960spaces.hsla.from = function( hsla ) { 16961 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 16962 return [ null, null, null, hsla[ 3 ] ]; 16963 } 16964 var h = hsla[ 0 ] / 360, 16965 s = hsla[ 1 ], 16966 l = hsla[ 2 ], 16967 a = hsla[ 3 ], 16968 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 16969 p = 2 * l - q; 16970 16971 return [ 16972 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 16973 Math.round( hue2rgb( p, q, h ) * 255 ), 16974 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 16975 a 16976 ]; 16977}; 16978 16979 16980each( spaces, function( spaceName, space ) { 16981 var props = space.props, 16982 cache = space.cache, 16983 to = space.to, 16984 from = space.from; 16985 16986 // makes rgba() and hsla() 16987 color.fn[ spaceName ] = function( value ) { 16988 16989 // generate a cache for this space if it doesn't exist 16990 if ( to && !this[ cache ] ) { 16991 this[ cache ] = to( this._rgba ); 16992 } 16993 if ( value === undefined ) { 16994 return this[ cache ].slice(); 16995 } 16996 16997 var ret, 16998 type = getType( value ), 16999 arr = ( type === "array" || type === "object" ) ? value : arguments, 17000 local = this[ cache ].slice(); 17001 17002 each( props, function( key, prop ) { 17003 var val = arr[ type === "object" ? key : prop.idx ]; 17004 if ( val == null ) { 17005 val = local[ prop.idx ]; 17006 } 17007 local[ prop.idx ] = clamp( val, prop ); 17008 } ); 17009 17010 if ( from ) { 17011 ret = color( from( local ) ); 17012 ret[ cache ] = local; 17013 return ret; 17014 } else { 17015 return color( local ); 17016 } 17017 }; 17018 17019 // makes red() green() blue() alpha() hue() saturation() lightness() 17020 each( props, function( key, prop ) { 17021 17022 // alpha is included in more than one space 17023 if ( color.fn[ key ] ) { 17024 return; 17025 } 17026 color.fn[ key ] = function( value ) { 17027 var local, cur, match, fn, 17028 vtype = getType( value ); 17029 17030 if ( key === "alpha" ) { 17031 fn = this._hsla ? "hsla" : "rgba"; 17032 } else { 17033 fn = spaceName; 17034 } 17035 local = this[ fn ](); 17036 cur = local[ prop.idx ]; 17037 17038 if ( vtype === "undefined" ) { 17039 return cur; 17040 } 17041 17042 if ( vtype === "function" ) { 17043 value = value.call( this, cur ); 17044 vtype = getType( value ); 17045 } 17046 if ( value == null && prop.empty ) { 17047 return this; 17048 } 17049 if ( vtype === "string" ) { 17050 match = rplusequals.exec( value ); 17051 if ( match ) { 17052 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 17053 } 17054 } 17055 local[ prop.idx ] = value; 17056 return this[ fn ]( local ); 17057 }; 17058 } ); 17059} ); 17060 17061// add cssHook and .fx.step function for each named hook. 17062// accept a space separated string of properties 17063color.hook = function( hook ) { 17064 var hooks = hook.split( " " ); 17065 each( hooks, function( _i, hook ) { 17066 jQuery.cssHooks[ hook ] = { 17067 set: function( elem, value ) { 17068 var parsed, curElem, 17069 backgroundColor = ""; 17070 17071 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { 17072 value = color( parsed || value ); 17073 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 17074 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 17075 while ( 17076 ( backgroundColor === "" || backgroundColor === "transparent" ) && 17077 curElem && curElem.style 17078 ) { 17079 try { 17080 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 17081 curElem = curElem.parentNode; 17082 } catch ( e ) { 17083 } 17084 } 17085 17086 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 17087 backgroundColor : 17088 "_default" ); 17089 } 17090 17091 value = value.toRgbaString(); 17092 } 17093 try { 17094 elem.style[ hook ] = value; 17095 } catch ( e ) { 17096 17097 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 17098 } 17099 } 17100 }; 17101 jQuery.fx.step[ hook ] = function( fx ) { 17102 if ( !fx.colorInit ) { 17103 fx.start = color( fx.elem, hook ); 17104 fx.end = color( fx.end ); 17105 fx.colorInit = true; 17106 } 17107 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 17108 }; 17109 } ); 17110 17111}; 17112 17113color.hook( stepHooks ); 17114 17115jQuery.cssHooks.borderColor = { 17116 expand: function( value ) { 17117 var expanded = {}; 17118 17119 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 17120 expanded[ "border" + part + "Color" ] = value; 17121 } ); 17122 return expanded; 17123 } 17124}; 17125 17126// Basic color names only. 17127// Usage of any of the other color names requires adding yourself or including 17128// jquery.color.svg-names.js. 17129colors = jQuery.Color.names = { 17130 17131 // 4.1. Basic color keywords 17132 aqua: "#00ffff", 17133 black: "#000000", 17134 blue: "#0000ff", 17135 fuchsia: "#ff00ff", 17136 gray: "#808080", 17137 green: "#008000", 17138 lime: "#00ff00", 17139 maroon: "#800000", 17140 navy: "#000080", 17141 olive: "#808000", 17142 purple: "#800080", 17143 red: "#ff0000", 17144 silver: "#c0c0c0", 17145 teal: "#008080", 17146 white: "#ffffff", 17147 yellow: "#ffff00", 17148 17149 // 4.2.3. "transparent" color keyword 17150 transparent: [ null, null, null, 0 ], 17151 17152 _default: "#ffffff" 17153}; 17154 17155 17156/*! 17157 * jQuery UI Effects 1.13.
171570 17158 * http://jqueryui.com 17159 * 17160 * Copyright jQuery Foundation and other contributors 17161 * Released under the MIT license. 17162 * http://jquery.org/license 17163 */ 17164 17165//>>label: Effects Core 17166//>>group: Effects 17167/* eslint-disable max-len */ 17168//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 17169/* eslint-enable max-len */ 17170//>>docs: http://api.jqueryui.com/category/effects-core/ 17171//>>demos: http
vendor: 9,484 bytes, lines 17171-17541
17171://jqueryui.com/effect/ 17172 17173 17174var dataSpace = "ui-effects-", 17175 dataSpaceStyle = "ui-effects-style", 17176 dataSpaceAnimated = "ui-effects-animated"; 17177 17178$.effects = { 17179 effect: {} 17180}; 17181 17182/******************************************************************************/ 17183/****************************** CLASS ANIMATIONS ******************************/ 17184/******************************************************************************/ 17185( function() { 17186 17187var classAnimationActions = [ "add", "remove", "toggle" ], 17188 shorthandStyles = { 17189 border: 1, 17190 borderBottom: 1, 17191 borderColor: 1, 17192 borderLeft: 1, 17193 borderRight: 1, 17194 borderTop: 1, 17195 borderWidth: 1, 17196 margin: 1, 17197 padding: 1 17198 }; 17199 17200$.each( 17201 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 17202 function( _, prop ) { 17203 $.fx.step[ prop ] = function( fx ) { 17204 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 17205 jQuery.style( fx.elem, prop, fx.end ); 17206 fx.setAttr = true; 17207 } 17208 }; 17209 } 17210); 17211 17212function camelCase( string ) { 17213 return string.replace( /-([\da-z])/gi, function( all, letter ) { 17214 return letter.toUpperCase(); 17215 } ); 17216} 17217 17218function getElementStyles( elem ) { 17219 var key, len, 17220 style = elem.ownerDocument.defaultView ? 17221 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 17222 elem.currentStyle, 17223 styles = {}; 17224 17225 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 17226 len = style.length; 17227 while ( len-- ) { 17228 key = style[ len ]; 17229 if ( typeof style[ key ] === "string" ) { 17230 styles[ camelCase( key ) ] = style[ key ]; 17231 } 17232 } 17233 17234 // Support: Opera, IE <9 17235 } else { 17236 for ( key in style ) { 17237 if ( typeof style[ key ] === "string" ) { 17238 styles[ key ] = style[ key ]; 17239 } 17240 } 17241 } 17242 17243 return styles; 17244} 17245 17246function styleDifference( oldStyle, newStyle ) { 17247 var diff = {}, 17248 name, value; 17249 17250 for ( name in newStyle ) { 17251 value = newStyle[ name ]; 17252 if ( oldStyle[ name ] !== value ) { 17253 if ( !shorthandStyles[ name ] ) { 17254 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 17255 diff[ name ] = value; 17256 } 17257 } 17258 } 17259 } 17260 17261 return diff; 17262} 17263 17264// Support: jQuery <1.8 17265if ( !$.fn.addBack ) { 17266 $.fn.addBack = function( selector ) { 17267 return this.add( selector == null ? 17268 this.prevObject : this.prevObject.filter( selector ) 17269 ); 17270 }; 17271} 17272 17273$.effects.animateClass = function( value, duration, easing, callback ) { 17274 var o = $.speed( duration, easing, callback ); 17275 17276 return this.queue( function() { 17277 var animated = $( this ), 17278 baseClass = animated.attr( "class" ) || "", 17279 applyClassChange, 17280 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 17281 17282 // Map the animated objects to store the original styles. 17283 allAnimations = allAnimations.map( function() { 17284 var el = $( this ); 17285 return { 17286 el: el, 17287 start: getElementStyles( this ) 17288 }; 17289 } ); 17290 17291 // Apply class change 17292 applyClassChange = function() { 17293 $.each( classAnimationActions, function( i, action ) { 17294 if ( value[ action ] ) { 17295 animated[ action + "Class" ]( value[ action ] ); 17296 } 17297 } ); 17298 }; 17299 applyClassChange(); 17300 17301 // Map all animated objects again - calculate new styles and diff 17302 allAnimations = allAnimations.map( function() { 17303 this.end = getElementStyles( this.el[ 0 ] ); 17304 this.diff = styleDifference( this.start, this.end ); 17305 return this; 17306 } ); 17307 17308 // Apply original class 17309 animated.attr( "class", baseClass ); 17310 17311 // Map all animated objects again - this time collecting a promise 17312 allAnimations = allAnimations.map( function() { 17313 var styleInfo = this, 17314 dfd = $.Deferred(), 17315 opts = $.extend( {}, o, { 17316 queue: false, 17317 complete: function() { 17318 dfd.resolve( styleInfo ); 17319 } 17320 } ); 17321 17322 this.el.animate( this.diff, opts ); 17323 return dfd.promise(); 17324 } ); 17325 17326 // Once all animations have completed: 17327 $.when.apply( $, allAnimations.get() ).done( function() { 17328 17329 // Set the final class 17330 applyClassChange(); 17331 17332 // For each animated element, 17333 // clear all css properties that were animated 17334 $.each( arguments, function() { 17335 var el = this.el; 17336 $.each( this.diff, function( key ) { 17337 el.css( key, "" ); 17338 } ); 17339 } ); 17340 17341 // This is guarnteed to be there if you use jQuery.speed() 17342 // it also handles dequeuing the next anim... 17343 o.complete.call( animated[ 0 ] ); 17344 } ); 17345 } ); 17346}; 17347 17348$.fn.extend( { 17349 addClass: ( function( orig ) { 17350 return function( classNames, speed, easing, callback ) { 17351 return speed ? 17352 $.effects.animateClass.call( this, 17353 { add: classNames }, speed, easing, callback ) : 17354 orig.apply( this, arguments ); 17355 }; 17356 } )( $.fn.addClass ), 17357 17358 removeClass: ( function( orig ) { 17359 return function( classNames, speed, easing, callback ) { 17360 return arguments.length > 1 ? 17361 $.effects.animateClass.call( this, 17362 { remove: classNames }, speed, easing, callback ) : 17363 orig.apply( this, arguments ); 17364 }; 17365 } )( $.fn.removeClass ), 17366 17367 toggleClass: ( function( orig ) { 17368 return function( classNames, force, speed, easing, callback ) { 17369 if ( typeof force === "boolean" || force === undefined ) { 17370 if ( !speed ) { 17371 17372 // Without speed parameter 17373 return orig.apply( this, arguments ); 17374 } else { 17375 return $.effects.animateClass.call( this, 17376 ( force ? { add: classNames } : { remove: classNames } ), 17377 speed, easing, callback ); 17378 } 17379 } else { 17380 17381 // Without force parameter 17382 return $.effects.animateClass.call( this, 17383 { toggle: classNames }, force, speed, easing ); 17384 } 17385 }; 17386 } )( $.fn.toggleClass ), 17387 17388 switchClass: function( remove, add, speed, easing, callback ) { 17389 return $.effects.animateClass.call( this, { 17390 add: add, 17391 remove: remove 17392 }, speed, easing, callback ); 17393 } 17394} ); 17395 17396} )(); 17397 17398/******************************************************************************/ 17399/*********************************** EFFECTS **********************************/ 17400/******************************************************************************/ 17401 17402( function() { 17403 17404if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 17405 $.expr.pseudos.animated = ( function( orig ) { 17406 return function( elem ) { 17407 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 17408 }; 17409 } )( $.expr.pseudos.animated ); 17410} 17411 17412if ( $.uiBackCompat !== false ) { 17413 $.extend( $.effects, { 17414 17415 // Saves a set of properties in a data storage 17416 save: function( element, set ) { 17417 var i = 0, length = set.length; 17418 for ( ; i < length; i++ ) { 17419 if ( set[ i ] !== null ) { 17420 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 17421 } 17422 } 17423 }, 17424 17425 // Restores a set of previously saved properties from a data storage 17426 restore: function( element, set ) { 17427 var val, i = 0, length = set.length; 17428 for ( ; i < length; i++ ) { 17429 if ( set[ i ] !== null ) { 17430 val = element.data( dataSpace + set[ i ] ); 17431 element.css( set[ i ], val ); 17432 } 17433 } 17434 }, 17435 17436 setMode: function( el, mode ) { 17437 if ( mode === "toggle" ) { 17438 mode = el.is( ":hidden" ) ? "show" : "hide"; 17439 } 17440 return mode; 17441 }, 17442 17443 // Wraps the element around a wrapper that copies position properties 17444 createWrapper: function( element ) { 17445 17446 // If the element is already wrapped, return it 17447 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 17448 return element.parent(); 17449 } 17450 17451 // Wrap the element 17452 var props = { 17453 width: element.outerWidth( true ), 17454 height: element.outerHeight( true ), 17455 "float": element.css( "float" ) 17456 }, 17457 wrapper = $( "<div></div>" ) 17458 .addClass( "ui-effects-wrapper" ) 17459 .css( { 17460 fontSize: "100%", 17461 background: "transparent", 17462 border: "none", 17463 margin: 0, 17464 padding: 0 17465 } ), 17466 17467 // Store the size in case width/height are defined in % - Fixes #5245 17468 size = { 17469 width: element.width(), 17470 height: element.height() 17471 }, 17472 active = document.activeElement; 17473 17474 // Support: Firefox 17475 // Firefox incorrectly exposes anonymous content 17476 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 17477 try { 17478 // eslint-disable-next-line no-unused-expressions 17479 active.id; 17480 } catch ( e ) { 17481 active = document.body; 17482 } 17483 17484 element.wrap( wrapper ); 17485 17486 // Fixes #7595 - Elements lose focus when wrapped. 17487 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 17488 $( active ).trigger( "focus" ); 17489 } 17490 17491 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 17492 // lose the reference to the wrapped element 17493 wrapper = element.parent(); 17494 17495 // Transfer positioning properties to the wrapper 17496 if ( element.css( "position" ) === "static" ) { 17497 wrapper.css( { position: "relative" } ); 17498 element.css( { position: "relative" } ); 17499 } else { 17500 $.extend( props, { 17501 position: element.css( "position" ), 17502 zIndex: element.css( "z-index" ) 17503 } ); 17504 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 17505 props[ pos ] = element.css( pos ); 17506 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 17507 props[ pos ] = "auto"; 17508 } 17509 } ); 17510 element.css( { 17511 position: "relative", 17512 top: 0, 17513 left: 0, 17514 right: "auto", 17515 bottom: "auto" 17516 } ); 17517 } 17518 element.css( size ); 17519 17520 return wrapper.css( props ).show(); 17521 }, 17522 17523 removeWrapper: function( element ) { 17524 var active = document.activeElement; 17525 17526 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 17527 element.parent().replaceWith( element ); 17528 17529 // Fixes #7595 - Elements lose focus when wrapped. 17530 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 17531 $( active ).trigger( "focus" ); 17532 } 17533 } 17534 17535 return element; 17536 } 17537 } ); 17538} 17539 17540$.extend( $.effects, { 17541 version: "1.13.
vendor: 2,055 bytes, lines 17541-17636
175410", 17542 17543 define: function( name, mode, effect ) { 17544 if ( !effect ) { 17545 effect = mode; 17546 mode = "effect"; 17547 } 17548 17549 $.effects.effect[ name ] = effect; 17550 $.effects.effect[ name ].mode = mode; 17551 17552 return effect; 17553 }, 17554 17555 scaledDimensions: function( element, percent, direction ) { 17556 if ( percent === 0 ) { 17557 return { 17558 height: 0, 17559 width: 0, 17560 outerHeight: 0, 17561 outerWidth: 0 17562 }; 17563 } 17564 17565 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 17566 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 17567 17568 return { 17569 height: element.height() * y, 17570 width: element.width() * x, 17571 outerHeight: element.outerHeight() * y, 17572 outerWidth: element.outerWidth() * x 17573 }; 17574 17575 }, 17576 17577 clipToBox: function( animation ) { 17578 return { 17579 width: animation.clip.right - animation.clip.left, 17580 height: animation.clip.bottom - animation.clip.top, 17581 left: animation.clip.left, 17582 top: animation.clip.top 17583 }; 17584 }, 17585 17586 // Injects recently queued functions to be first in line (after "inprogress") 17587 unshift: function( element, queueLength, count ) { 17588 var queue = element.queue(); 17589 17590 if ( queueLength > 1 ) { 17591 queue.splice.apply( queue, 17592 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 17593 } 17594 element.dequeue(); 17595 }, 17596 17597 saveStyle: function( element ) { 17598 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 17599 }, 17600 17601 restoreStyle: function( element ) { 17602 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 17603 element.removeData( dataSpaceStyle ); 17604 }, 17605 17606 mode: function( element, mode ) { 17607 var hidden = element.is( ":hidden" ); 17608 17609 if ( mode === "toggle" ) { 17610 mode = hidden ? "show" : "hide"; 17611 } 17612 if ( hidden ? mode === "hide" : mode === "show" ) { 17613 mode = "none"; 17614 } 17615 return mode; 17616 }, 17617 17618 // Translates a [top,left] array into a baseline value 17619 getBaseline: function( origin, original ) { 17620 var y, x; 17621 17622 switch ( origin[ 0 ] ) { 17623 case "top": 17624 y = 0; 17625 break; 17626 case "middle": 17627 y = 0.5; 17628 break; 17629 case "bottom": 17630 y = 1; 17631 break; 17632 default: 17633 y = origin[ 0 ] / original.height; 17634 } 17635 17636 switch ( origin[ 1 ] ) {
17637 case "left": 17638 x = 0; 17639 break; 17640 case "center": 17641 x = 0.5; 17642 break; 17643 case "right": 17644 x = 1; 17645 break; 17646 default: 17647 x = origin[ 1 ] / original.width; 17648 } 17649 17650 return { 17651 x: x, 17652 y: y 17653 }; 17654 }, 17655 17656 // Creates a placeholder element so that the original element can be made absolute 17657 createPlaceholder: function( element ) { 17658 var placeholder, 17659 cssPosition = element.css( "position" ), 17660 position = element.position(); 17661 17662 // Lock in margins first to account for form elements, which 17663 // will change margin if you explicitly set height 17664 // see: http
vendor: 10,558 bytes, lines 17664-18058
17664://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 17665 // Support: Safari 17666 element.css( { 17667 marginTop: element.css( "marginTop" ), 17668 marginBottom: element.css( "marginBottom" ), 17669 marginLeft: element.css( "marginLeft" ), 17670 marginRight: element.css( "marginRight" ) 17671 } ) 17672 .outerWidth( element.outerWidth() ) 17673 .outerHeight( element.outerHeight() ); 17674 17675 if ( /^(static|relative)/.test( cssPosition ) ) { 17676 cssPosition = "absolute"; 17677 17678 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 17679 17680 // Convert inline to inline block to account for inline elements 17681 // that turn to inline block based on content (like img) 17682 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 17683 "inline-block" : 17684 "block", 17685 visibility: "hidden", 17686 17687 // Margins need to be set to account for margin collapse 17688 marginTop: element.css( "marginTop" ), 17689 marginBottom: element.css( "marginBottom" ), 17690 marginLeft: element.css( "marginLeft" ), 17691 marginRight: element.css( "marginRight" ), 17692 "float": element.css( "float" ) 17693 } ) 17694 .outerWidth( element.outerWidth() ) 17695 .outerHeight( element.outerHeight() ) 17696 .addClass( "ui-effects-placeholder" ); 17697 17698 element.data( dataSpace + "placeholder", placeholder ); 17699 } 17700 17701 element.css( { 17702 position: cssPosition, 17703 left: position.left, 17704 top: position.top 17705 } ); 17706 17707 return placeholder; 17708 }, 17709 17710 removePlaceholder: function( element ) { 17711 var dataKey = dataSpace + "placeholder", 17712 placeholder = element.data( dataKey ); 17713 17714 if ( placeholder ) { 17715 placeholder.remove(); 17716 element.removeData( dataKey ); 17717 } 17718 }, 17719 17720 // Removes a placeholder if it exists and restores 17721 // properties that were modified during placeholder creation 17722 cleanUp: function( element ) { 17723 $.effects.restoreStyle( element ); 17724 $.effects.removePlaceholder( element ); 17725 }, 17726 17727 setTransition: function( element, list, factor, value ) { 17728 value = value || {}; 17729 $.each( list, function( i, x ) { 17730 var unit = element.cssUnit( x ); 17731 if ( unit[ 0 ] > 0 ) { 17732 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 17733 } 17734 } ); 17735 return value; 17736 } 17737} ); 17738 17739// Return an effect options object for the given parameters: 17740function _normalizeArguments( effect, options, speed, callback ) { 17741 17742 // Allow passing all options as the first parameter 17743 if ( $.isPlainObject( effect ) ) { 17744 options = effect; 17745 effect = effect.effect; 17746 } 17747 17748 // Convert to an object 17749 effect = { effect: effect }; 17750 17751 // Catch (effect, null, ...) 17752 if ( options == null ) { 17753 options = {}; 17754 } 17755 17756 // Catch (effect, callback) 17757 if ( typeof options === "function" ) { 17758 callback = options; 17759 speed = null; 17760 options = {}; 17761 } 17762 17763 // Catch (effect, speed, ?) 17764 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 17765 callback = speed; 17766 speed = options; 17767 options = {}; 17768 } 17769 17770 // Catch (effect, options, callback) 17771 if ( typeof speed === "function" ) { 17772 callback = speed; 17773 speed = null; 17774 } 17775 17776 // Add options to effect 17777 if ( options ) { 17778 $.extend( effect, options ); 17779 } 17780 17781 speed = speed || options.duration; 17782 effect.duration = $.fx.off ? 0 : 17783 typeof speed === "number" ? speed : 17784 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 17785 $.fx.speeds._default; 17786 17787 effect.complete = callback || options.complete; 17788 17789 return effect; 17790} 17791 17792function standardAnimationOption( option ) { 17793 17794 // Valid standard speeds (nothing, number, named speed) 17795 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 17796 return true; 17797 } 17798 17799 // Invalid strings - treat as "normal" speed 17800 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 17801 return true; 17802 } 17803 17804 // Complete callback 17805 if ( typeof option === "function" ) { 17806 return true; 17807 } 17808 17809 // Options hash (but not naming an effect) 17810 if ( typeof option === "object" && !option.effect ) { 17811 return true; 17812 } 17813 17814 // Didn't match any standard API 17815 return false; 17816} 17817 17818$.fn.extend( { 17819 effect: function( /* effect, options, speed, callback */ ) { 17820 var args = _normalizeArguments.apply( this, arguments ), 17821 effectMethod = $.effects.effect[ args.effect ], 17822 defaultMode = effectMethod.mode, 17823 queue = args.queue, 17824 queueName = queue || "fx", 17825 complete = args.complete, 17826 mode = args.mode, 17827 modes = [], 17828 prefilter = function( next ) { 17829 var el = $( this ), 17830 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 17831 17832 // Sentinel for duck-punching the :animated pseudo-selector 17833 el.data( dataSpaceAnimated, true ); 17834 17835 // Save effect mode for later use, 17836 // we can't just call $.effects.mode again later, 17837 // as the .show() below destroys the initial state 17838 modes.push( normalizedMode ); 17839 17840 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 17841 if ( defaultMode && ( normalizedMode === "show" || 17842 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 17843 el.show(); 17844 } 17845 17846 if ( !defaultMode || normalizedMode !== "none" ) { 17847 $.effects.saveStyle( el ); 17848 } 17849 17850 if ( typeof next === "function" ) { 17851 next(); 17852 } 17853 }; 17854 17855 if ( $.fx.off || !effectMethod ) { 17856 17857 // Delegate to the original method (e.g., .show()) if possible 17858 if ( mode ) { 17859 return this[ mode ]( args.duration, complete ); 17860 } else { 17861 return this.each( function() { 17862 if ( complete ) { 17863 complete.call( this ); 17864 } 17865 } ); 17866 } 17867 } 17868 17869 function run( next ) { 17870 var elem = $( this ); 17871 17872 function cleanup() { 17873 elem.removeData( dataSpaceAnimated ); 17874 17875 $.effects.cleanUp( elem ); 17876 17877 if ( args.mode === "hide" ) { 17878 elem.hide(); 17879 } 17880 17881 done(); 17882 } 17883 17884 function done() { 17885 if ( typeof complete === "function" ) { 17886 complete.call( elem[ 0 ] ); 17887 } 17888 17889 if ( typeof next === "function" ) { 17890 next(); 17891 } 17892 } 17893 17894 // Override mode option on a per element basis, 17895 // as toggle can be either show or hide depending on element state 17896 args.mode = modes.shift(); 17897 17898 if ( $.uiBackCompat !== false && !defaultMode ) { 17899 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 17900 17901 // Call the core method to track "olddisplay" properly 17902 elem[ mode ](); 17903 done(); 17904 } else { 17905 effectMethod.call( elem[ 0 ], args, done ); 17906 } 17907 } else { 17908 if ( args.mode === "none" ) { 17909 17910 // Call the core method to track "olddisplay" properly 17911 elem[ mode ](); 17912 done(); 17913 } else { 17914 effectMethod.call( elem[ 0 ], args, cleanup ); 17915 } 17916 } 17917 } 17918 17919 // Run prefilter on all elements first to ensure that 17920 // any showing or hiding happens before placeholder creation, 17921 // which ensures that any layout changes are correctly captured. 17922 return queue === false ? 17923 this.each( prefilter ).each( run ) : 17924 this.queue( queueName, prefilter ).queue( queueName, run ); 17925 }, 17926 17927 show: ( function( orig ) { 17928 return function( option ) { 17929 if ( standardAnimationOption( option ) ) { 17930 return orig.apply( this, arguments ); 17931 } else { 17932 var args = _normalizeArguments.apply( this, arguments ); 17933 args.mode = "show"; 17934 return this.effect.call( this, args ); 17935 } 17936 }; 17937 } )( $.fn.show ), 17938 17939 hide: ( function( orig ) { 17940 return function( option ) { 17941 if ( standardAnimationOption( option ) ) { 17942 return orig.apply( this, arguments ); 17943 } else { 17944 var args = _normalizeArguments.apply( this, arguments ); 17945 args.mode = "hide"; 17946 return this.effect.call( this, args ); 17947 } 17948 }; 17949 } )( $.fn.hide ), 17950 17951 toggle: ( function( orig ) { 17952 return function( option ) { 17953 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 17954 return orig.apply( this, arguments ); 17955 } else { 17956 var args = _normalizeArguments.apply( this, arguments ); 17957 args.mode = "toggle"; 17958 return this.effect.call( this, args ); 17959 } 17960 }; 17961 } )( $.fn.toggle ), 17962 17963 cssUnit: function( key ) { 17964 var style = this.css( key ), 17965 val = []; 17966 17967 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 17968 if ( style.indexOf( unit ) > 0 ) { 17969 val = [ parseFloat( style ), unit ]; 17970 } 17971 } ); 17972 return val; 17973 }, 17974 17975 cssClip: function( clipObj ) { 17976 if ( clipObj ) { 17977 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 17978 clipObj.bottom + "px " + clipObj.left + "px)" ); 17979 } 17980 return parseClip( this.css( "clip" ), this ); 17981 }, 17982 17983 transfer: function( options, done ) { 17984 var element = $( this ), 17985 target = $( options.to ), 17986 targetFixed = target.css( "position" ) === "fixed", 17987 body = $( "body" ), 17988 fixTop = targetFixed ? body.scrollTop() : 0, 17989 fixLeft = targetFixed ? body.scrollLeft() : 0, 17990 endPosition = target.offset(), 17991 animation = { 17992 top: endPosition.top - fixTop, 17993 left: endPosition.left - fixLeft, 17994 height: target.innerHeight(), 17995 width: target.innerWidth() 17996 }, 17997 startPosition = element.offset(), 17998 transfer = $( "<div class='ui-effects-transfer'></div>" ); 17999 18000 transfer 18001 .appendTo( "body" ) 18002 .addClass( options.className ) 18003 .css( { 18004 top: startPosition.top - fixTop, 18005 left: startPosition.left - fixLeft, 18006 height: element.innerHeight(), 18007 width: element.innerWidth(), 18008 position: targetFixed ? "fixed" : "absolute" 18009 } ) 18010 .animate( animation, options.duration, options.easing, function() { 18011 transfer.remove(); 18012 if ( typeof done === "function" ) { 18013 done(); 18014 } 18015 } ); 18016 } 18017} ); 18018 18019function parseClip( str, element ) { 18020 var outerWidth = element.outerWidth(), 18021 outerHeight = element.outerHeight(), 18022 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)\)$/, 18023 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 18024 18025 return { 18026 top: parseFloat( values[ 1 ] ) || 0, 18027 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 18028 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 18029 left: parseFloat( values[ 4 ] ) || 0 18030 }; 18031} 18032 18033$.fx.step.clip = function( fx ) { 18034 if ( !fx.clipInit ) { 18035 fx.start = $( fx.elem ).cssClip(); 18036 if ( typeof fx.end === "string" ) { 18037 fx.end = parseClip( fx.end, fx.elem ); 18038 } 18039 fx.clipInit = true; 18040 } 18041 18042 $( fx.elem ).cssClip( { 18043 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 18044 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 18045 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 18046 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 18047 } ); 18048}; 18049 18050} )(); 18051 18052/******************************************************************************/ 18053/*********************************** EASING ***********************************/ 18054/******************************************************************************/ 18055 18056( function() { 18057 18058// Based on easing equations from Robert Penner (http://
vendor: 24,998 bytes, lines 18058-19013
18058www.robertpenner.com/easing) 18059 18060var baseEasings = {}; 18061 18062$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 18063 baseEasings[ name ] = function( p ) { 18064 return Math.pow( p, i + 2 ); 18065 }; 18066} ); 18067 18068$.extend( baseEasings, { 18069 Sine: function( p ) { 18070 return 1 - Math.cos( p * Math.PI / 2 ); 18071 }, 18072 Circ: function( p ) { 18073 return 1 - Math.sqrt( 1 - p * p ); 18074 }, 18075 Elastic: function( p ) { 18076 return p === 0 || p === 1 ? p : 18077 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 18078 }, 18079 Back: function( p ) { 18080 return p * p * ( 3 * p - 2 ); 18081 }, 18082 Bounce: function( p ) { 18083 var pow2, 18084 bounce = 4; 18085 18086 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 18087 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 18088 } 18089} ); 18090 18091$.each( baseEasings, function( name, easeIn ) { 18092 $.easing[ "easeIn" + name ] = easeIn; 18093 $.easing[ "easeOut" + name ] = function( p ) { 18094 return 1 - easeIn( 1 - p ); 18095 }; 18096 $.easing[ "easeInOut" + name ] = function( p ) { 18097 return p < 0.5 ? 18098 easeIn( p * 2 ) / 2 : 18099 1 - easeIn( p * -2 + 2 ) / 2; 18100 }; 18101} ); 18102 18103} )(); 18104 18105var effect = $.effects; 18106 18107 18108/*! 18109 * jQuery UI Effects Blind 1.13.0 18110 * http://jqueryui.com 18111 * 18112 * Copyright jQuery Foundation and other contributors 18113 * Released under the MIT license. 18114 * http://jquery.org/license 18115 */ 18116 18117//>>label: Blind Effect 18118//>>group: Effects 18119//>>description: Blinds the element. 18120//>>docs: http://api.jqueryui.com/blind-effect/ 18121//>>demos: http://jqueryui.com/effect/ 18122 18123 18124var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) { 18125 var map = { 18126 up: [ "bottom", "top" ], 18127 vertical: [ "bottom", "top" ], 18128 down: [ "top", "bottom" ], 18129 left: [ "right", "left" ], 18130 horizontal: [ "right", "left" ], 18131 right: [ "left", "right" ] 18132 }, 18133 element = $( this ), 18134 direction = options.direction || "up", 18135 start = element.cssClip(), 18136 animate = { clip: $.extend( {}, start ) }, 18137 placeholder = $.effects.createPlaceholder( element ); 18138 18139 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 18140 18141 if ( options.mode === "show" ) { 18142 element.cssClip( animate.clip ); 18143 if ( placeholder ) { 18144 placeholder.css( $.effects.clipToBox( animate ) ); 18145 } 18146 18147 animate.clip = start; 18148 } 18149 18150 if ( placeholder ) { 18151 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 18152 } 18153 18154 element.animate( animate, { 18155 queue: false, 18156 duration: options.duration, 18157 easing: options.easing, 18158 complete: done 18159 } ); 18160} ); 18161 18162 18163/*! 18164 * jQuery UI Effects Bounce 1.13.0 18165 * http://jqueryui.com 18166 * 18167 * Copyright jQuery Foundation and other contributors 18168 * Released under the MIT license. 18169 * http://jquery.org/license 18170 */ 18171 18172//>>label: Bounce Effect 18173//>>group: Effects 18174//>>description: Bounces an element horizontally or vertically n times. 18175//>>docs: http://api.jqueryui.com/bounce-effect/ 18176//>>demos: http://jqueryui.com/effect/ 18177 18178 18179var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) { 18180 var upAnim, downAnim, refValue, 18181 element = $( this ), 18182 18183 // Defaults: 18184 mode = options.mode, 18185 hide = mode === "hide", 18186 show = mode === "show", 18187 direction = options.direction || "up", 18188 distance = options.distance, 18189 times = options.times || 5, 18190 18191 // Number of internal animations 18192 anims = times * 2 + ( show || hide ? 1 : 0 ), 18193 speed = options.duration / anims, 18194 easing = options.easing, 18195 18196 // Utility: 18197 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18198 motion = ( direction === "up" || direction === "left" ), 18199 i = 0, 18200 18201 queuelen = element.queue().length; 18202 18203 $.effects.createPlaceholder( element ); 18204 18205 refValue = element.css( ref ); 18206 18207 // Default distance for the BIGGEST bounce is the outer Distance / 3 18208 if ( !distance ) { 18209 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 18210 } 18211 18212 if ( show ) { 18213 downAnim = { opacity: 1 }; 18214 downAnim[ ref ] = refValue; 18215 18216 // If we are showing, force opacity 0 and set the initial position 18217 // then do the "first" animation 18218 element 18219 .css( "opacity", 0 ) 18220 .css( ref, motion ? -distance * 2 : distance * 2 ) 18221 .animate( downAnim, speed, easing ); 18222 } 18223 18224 // Start at the smallest distance if we are hiding 18225 if ( hide ) { 18226 distance = distance / Math.pow( 2, times - 1 ); 18227 } 18228 18229 downAnim = {}; 18230 downAnim[ ref ] = refValue; 18231 18232 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 18233 for ( ; i < times; i++ ) { 18234 upAnim = {}; 18235 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 18236 18237 element 18238 .animate( upAnim, speed, easing ) 18239 .animate( downAnim, speed, easing ); 18240 18241 distance = hide ? distance * 2 : distance / 2; 18242 } 18243 18244 // Last Bounce when Hiding 18245 if ( hide ) { 18246 upAnim = { opacity: 0 }; 18247 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 18248 18249 element.animate( upAnim, speed, easing ); 18250 } 18251 18252 element.queue( done ); 18253 18254 $.effects.unshift( element, queuelen, anims + 1 ); 18255} ); 18256 18257 18258/*! 18259 * jQuery UI Effects Clip 1.13.0 18260 * http://jqueryui.com 18261 * 18262 * Copyright jQuery Foundation and other contributors 18263 * Released under the MIT license. 18264 * http://jquery.org/license 18265 */ 18266 18267//>>label: Clip Effect 18268//>>group: Effects 18269//>>description: Clips the element on and off like an old TV. 18270//>>docs: http://api.jqueryui.com/clip-effect/ 18271//>>demos: http://jqueryui.com/effect/ 18272 18273 18274var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) { 18275 var start, 18276 animate = {}, 18277 element = $( this ), 18278 direction = options.direction || "vertical", 18279 both = direction === "both", 18280 horizontal = both || direction === "horizontal", 18281 vertical = both || direction === "vertical"; 18282 18283 start = element.cssClip(); 18284 animate.clip = { 18285 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 18286 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 18287 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 18288 left: horizontal ? ( start.right - start.left ) / 2 : start.left 18289 }; 18290 18291 $.effects.createPlaceholder( element ); 18292 18293 if ( options.mode === "show" ) { 18294 element.cssClip( animate.clip ); 18295 animate.clip = start; 18296 } 18297 18298 element.animate( animate, { 18299 queue: false, 18300 duration: options.duration, 18301 easing: options.easing, 18302 complete: done 18303 } ); 18304 18305} ); 18306 18307 18308/*! 18309 * jQuery UI Effects Drop 1.13.0 18310 * http://jqueryui.com 18311 * 18312 * Copyright jQuery Foundation and other contributors 18313 * Released under the MIT license. 18314 * http://jquery.org/license 18315 */ 18316 18317//>>label: Drop Effect 18318//>>group: Effects 18319//>>description: Moves an element in one direction and hides it at the same time. 18320//>>docs: http://api.jqueryui.com/drop-effect/ 18321//>>demos: http://jqueryui.com/effect/ 18322 18323 18324var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) { 18325 18326 var distance, 18327 element = $( this ), 18328 mode = options.mode, 18329 show = mode === "show", 18330 direction = options.direction || "left", 18331 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18332 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 18333 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 18334 animation = { 18335 opacity: 0 18336 }; 18337 18338 $.effects.createPlaceholder( element ); 18339 18340 distance = options.distance || 18341 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 18342 18343 animation[ ref ] = motion + distance; 18344 18345 if ( show ) { 18346 element.css( animation ); 18347 18348 animation[ ref ] = oppositeMotion + distance; 18349 animation.opacity = 1; 18350 } 18351 18352 // Animate 18353 element.animate( animation, { 18354 queue: false, 18355 duration: options.duration, 18356 easing: options.easing, 18357 complete: done 18358 } ); 18359} ); 18360 18361 18362/*! 18363 * jQuery UI Effects Explode 1.13.0 18364 * http://jqueryui.com 18365 * 18366 * Copyright jQuery Foundation and other contributors 18367 * Released under the MIT license. 18368 * http://jquery.org/license 18369 */ 18370 18371//>>label: Explode Effect 18372//>>group: Effects 18373/* eslint-disable max-len */ 18374//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 18375/* eslint-enable max-len */ 18376//>>docs: http://api.jqueryui.com/explode-effect/ 18377//>>demos: http://jqueryui.com/effect/ 18378 18379 18380var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) { 18381 18382 var i, j, left, top, mx, my, 18383 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 18384 cells = rows, 18385 element = $( this ), 18386 mode = options.mode, 18387 show = mode === "show", 18388 18389 // Show and then visibility:hidden the element before calculating offset 18390 offset = element.show().css( "visibility", "hidden" ).offset(), 18391 18392 // Width and height of a piece 18393 width = Math.ceil( element.outerWidth() / cells ), 18394 height = Math.ceil( element.outerHeight() / rows ), 18395 pieces = []; 18396 18397 // Children animate complete: 18398 function childComplete() { 18399 pieces.push( this ); 18400 if ( pieces.length === rows * cells ) { 18401 animComplete(); 18402 } 18403 } 18404 18405 // Clone the element for each row and cell. 18406 for ( i = 0; i < rows; i++ ) { // ===> 18407 top = offset.top + i * height; 18408 my = i - ( rows - 1 ) / 2; 18409 18410 for ( j = 0; j < cells; j++ ) { // ||| 18411 left = offset.left + j * width; 18412 mx = j - ( cells - 1 ) / 2; 18413 18414 // Create a clone of the now hidden main element that will be absolute positioned 18415 // within a wrapper div off the -left and -top equal to size of our pieces 18416 element 18417 .clone() 18418 .appendTo( "body" ) 18419 .wrap( "<div></div>" ) 18420 .css( { 18421 position: "absolute", 18422 visibility: "visible", 18423 left: -j * width, 18424 top: -i * height 18425 } ) 18426 18427 // Select the wrapper - make it overflow: hidden and absolute positioned based on 18428 // where the original was located +left and +top equal to the size of pieces 18429 .parent() 18430 .addClass( "ui-effects-explode" ) 18431 .css( { 18432 position: "absolute", 18433 overflow: "hidden", 18434 width: width, 18435 height: height, 18436 left: left + ( show ? mx * width : 0 ), 18437 top: top + ( show ? my * height : 0 ), 18438 opacity: show ? 0 : 1 18439 } ) 18440 .animate( { 18441 left: left + ( show ? 0 : mx * width ), 18442 top: top + ( show ? 0 : my * height ), 18443 opacity: show ? 1 : 0 18444 }, options.duration || 500, options.easing, childComplete ); 18445 } 18446 } 18447 18448 function animComplete() { 18449 element.css( { 18450 visibility: "visible" 18451 } ); 18452 $( pieces ).remove(); 18453 done(); 18454 } 18455} ); 18456 18457 18458/*! 18459 * jQuery UI Effects Fade 1.13.0 18460 * http://jqueryui.com 18461 * 18462 * Copyright jQuery Foundation and other contributors 18463 * Released under the MIT license. 18464 * http://jquery.org/license 18465 */ 18466 18467//>>label: Fade Effect 18468//>>group: Effects 18469//>>description: Fades the element. 18470//>>docs: http://api.jqueryui.com/fade-effect/ 18471//>>demos: http://jqueryui.com/effect/ 18472 18473 18474var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) { 18475 var show = options.mode === "show"; 18476 18477 $( this ) 18478 .css( "opacity", show ? 0 : 1 ) 18479 .animate( { 18480 opacity: show ? 1 : 0 18481 }, { 18482 queue: false, 18483 duration: options.duration, 18484 easing: options.easing, 18485 complete: done 18486 } ); 18487} ); 18488 18489 18490/*! 18491 * jQuery UI Effects Fold 1.13.0 18492 * http://jqueryui.com 18493 * 18494 * Copyright jQuery Foundation and other contributors 18495 * Released under the MIT license. 18496 * http://jquery.org/license 18497 */ 18498 18499//>>label: Fold Effect 18500//>>group: Effects 18501//>>description: Folds an element first horizontally and then vertically. 18502//>>docs: http://api.jqueryui.com/fold-effect/ 18503//>>demos: http://jqueryui.com/effect/ 18504 18505 18506var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) { 18507 18508 // Create element 18509 var element = $( this ), 18510 mode = options.mode, 18511 show = mode === "show", 18512 hide = mode === "hide", 18513 size = options.size || 15, 18514 percent = /([0-9]+)%/.exec( size ), 18515 horizFirst = !!options.horizFirst, 18516 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 18517 duration = options.duration / 2, 18518 18519 placeholder = $.effects.createPlaceholder( element ), 18520 18521 start = element.cssClip(), 18522 animation1 = { clip: $.extend( {}, start ) }, 18523 animation2 = { clip: $.extend( {}, start ) }, 18524 18525 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 18526 18527 queuelen = element.queue().length; 18528 18529 if ( percent ) { 18530 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 18531 } 18532 animation1.clip[ ref[ 0 ] ] = size; 18533 animation2.clip[ ref[ 0 ] ] = size; 18534 animation2.clip[ ref[ 1 ] ] = 0; 18535 18536 if ( show ) { 18537 element.cssClip( animation2.clip ); 18538 if ( placeholder ) { 18539 placeholder.css( $.effects.clipToBox( animation2 ) ); 18540 } 18541 18542 animation2.clip = start; 18543 } 18544 18545 // Animate 18546 element 18547 .queue( function( next ) { 18548 if ( placeholder ) { 18549 placeholder 18550 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 18551 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 18552 } 18553 18554 next(); 18555 } ) 18556 .animate( animation1, duration, options.easing ) 18557 .animate( animation2, duration, options.easing ) 18558 .queue( done ); 18559 18560 $.effects.unshift( element, queuelen, 4 ); 18561} ); 18562 18563 18564/*! 18565 * jQuery UI Effects Highlight 1.13.0 18566 * http://jqueryui.com 18567 * 18568 * Copyright jQuery Foundation and other contributors 18569 * Released under the MIT license. 18570 * http://jquery.org/license 18571 */ 18572 18573//>>label: Highlight Effect 18574//>>group: Effects 18575//>>description: Highlights the background of an element in a defined color for a custom duration. 18576//>>docs: http://api.jqueryui.com/highlight-effect/ 18577//>>demos: http://jqueryui.com/effect/ 18578 18579 18580var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) { 18581 var element = $( this ), 18582 animation = { 18583 backgroundColor: element.css( "backgroundColor" ) 18584 }; 18585 18586 if ( options.mode === "hide" ) { 18587 animation.opacity = 0; 18588 } 18589 18590 $.effects.saveStyle( element ); 18591 18592 element 18593 .css( { 18594 backgroundImage: "none", 18595 backgroundColor: options.color || "#ffff99" 18596 } ) 18597 .animate( animation, { 18598 queue: false, 18599 duration: options.duration, 18600 easing: options.easing, 18601 complete: done 18602 } ); 18603} ); 18604 18605 18606/*! 18607 * jQuery UI Effects Size 1.13.0 18608 * http://jqueryui.com 18609 * 18610 * Copyright jQuery Foundation and other contributors 18611 * Released under the MIT license. 18612 * http://jquery.org/license 18613 */ 18614 18615//>>label: Size Effect 18616//>>group: Effects 18617//>>description: Resize an element to a specified width and height. 18618//>>docs: http://api.jqueryui.com/size-effect/ 18619//>>demos: http://jqueryui.com/effect/ 18620 18621 18622var effectsEffectSize = $.effects.define( "size", function( options, done ) { 18623 18624 // Create element 18625 var baseline, factor, temp, 18626 element = $( this ), 18627 18628 // Copy for children 18629 cProps = [ "fontSize" ], 18630 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 18631 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 18632 18633 // Set options 18634 mode = options.mode, 18635 restore = mode !== "effect", 18636 scale = options.scale || "both", 18637 origin = options.origin || [ "middle", "center" ], 18638 position = element.css( "position" ), 18639 pos = element.position(), 18640 original = $.effects.scaledDimensions( element ), 18641 from = options.from || original, 18642 to = options.to || $.effects.scaledDimensions( element, 0 ); 18643 18644 $.effects.createPlaceholder( element ); 18645 18646 if ( mode === "show" ) { 18647 temp = from; 18648 from = to; 18649 to = temp; 18650 } 18651 18652 // Set scaling factor 18653 factor = { 18654 from: { 18655 y: from.height / original.height, 18656 x: from.width / original.width 18657 }, 18658 to: { 18659 y: to.height / original.height, 18660 x: to.width / original.width 18661 } 18662 }; 18663 18664 // Scale the css box 18665 if ( scale === "box" || scale === "both" ) { 18666 18667 // Vertical props scaling 18668 if ( factor.from.y !== factor.to.y ) { 18669 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 18670 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 18671 } 18672 18673 // Horizontal props scaling 18674 if ( factor.from.x !== factor.to.x ) { 18675 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 18676 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 18677 } 18678 } 18679 18680 // Scale the content 18681 if ( scale === "content" || scale === "both" ) { 18682 18683 // Vertical props scaling 18684 if ( factor.from.y !== factor.to.y ) { 18685 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 18686 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 18687 } 18688 } 18689 18690 // Adjust the position properties based on the provided origin points 18691 if ( origin ) { 18692 baseline = $.effects.getBaseline( origin, original ); 18693 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 18694 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 18695 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 18696 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 18697 } 18698 delete from.outerHeight; 18699 delete from.outerWidth; 18700 element.css( from ); 18701 18702 // Animate the children if desired 18703 if ( scale === "content" || scale === "both" ) { 18704 18705 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 18706 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 18707 18708 // Only animate children with width attributes specified 18709 // TODO: is this right? should we include anything with css width specified as well 18710 element.find( "*[width]" ).each( function() { 18711 var child = $( this ), 18712 childOriginal = $.effects.scaledDimensions( child ), 18713 childFrom = { 18714 height: childOriginal.height * factor.from.y, 18715 width: childOriginal.width * factor.from.x, 18716 outerHeight: childOriginal.outerHeight * factor.from.y, 18717 outerWidth: childOriginal.outerWidth * factor.from.x 18718 }, 18719 childTo = { 18720 height: childOriginal.height * factor.to.y, 18721 width: childOriginal.width * factor.to.x, 18722 outerHeight: childOriginal.height * factor.to.y, 18723 outerWidth: childOriginal.width * factor.to.x 18724 }; 18725 18726 // Vertical props scaling 18727 if ( factor.from.y !== factor.to.y ) { 18728 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 18729 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 18730 } 18731 18732 // Horizontal props scaling 18733 if ( factor.from.x !== factor.to.x ) { 18734 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 18735 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 18736 } 18737 18738 if ( restore ) { 18739 $.effects.saveStyle( child ); 18740 } 18741 18742 // Animate children 18743 child.css( childFrom ); 18744 child.animate( childTo, options.duration, options.easing, function() { 18745 18746 // Restore children 18747 if ( restore ) { 18748 $.effects.restoreStyle( child ); 18749 } 18750 } ); 18751 } ); 18752 } 18753 18754 // Animate 18755 element.animate( to, { 18756 queue: false, 18757 duration: options.duration, 18758 easing: options.easing, 18759 complete: function() { 18760 18761 var offset = element.offset(); 18762 18763 if ( to.opacity === 0 ) { 18764 element.css( "opacity", from.opacity ); 18765 } 18766 18767 if ( !restore ) { 18768 element 18769 .css( "position", position === "static" ? "relative" : position ) 18770 .offset( offset ); 18771 18772 // Need to save style here so that automatic style restoration 18773 // doesn't restore to the original styles from before the animation. 18774 $.effects.saveStyle( element ); 18775 } 18776 18777 done(); 18778 } 18779 } ); 18780 18781} ); 18782 18783 18784/*! 18785 * jQuery UI Effects Scale 1.13.0 18786 * http://jqueryui.com 18787 * 18788 * Copyright jQuery Foundation and other contributors 18789 * Released under the MIT license. 18790 * http://jquery.org/license 18791 */ 18792 18793//>>label: Scale Effect 18794//>>group: Effects 18795//>>description: Grows or shrinks an element and its content. 18796//>>docs: http://api.jqueryui.com/scale-effect/ 18797//>>demos: http://jqueryui.com/effect/ 18798 18799 18800var effectsEffectScale = $.effects.define( "scale", function( options, done ) { 18801 18802 // Create element 18803 var el = $( this ), 18804 mode = options.mode, 18805 percent = parseInt( options.percent, 10 ) || 18806 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 18807 18808 newOptions = $.extend( true, { 18809 from: $.effects.scaledDimensions( el ), 18810 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 18811 origin: options.origin || [ "middle", "center" ] 18812 }, options ); 18813 18814 // Fade option to support puff 18815 if ( options.fade ) { 18816 newOptions.from.opacity = 1; 18817 newOptions.to.opacity = 0; 18818 } 18819 18820 $.effects.effect.size.call( this, newOptions, done ); 18821} ); 18822 18823 18824/*! 18825 * jQuery UI Effects Puff 1.13.0 18826 * http://jqueryui.com 18827 * 18828 * Copyright jQuery Foundation and other contributors 18829 * Released under the MIT license. 18830 * http://jquery.org/license 18831 */ 18832 18833//>>label: Puff Effect 18834//>>group: Effects 18835//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 18836//>>docs: http://api.jqueryui.com/puff-effect/ 18837//>>demos: http://jqueryui.com/effect/ 18838 18839 18840var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) { 18841 var newOptions = $.extend( true, {}, options, { 18842 fade: true, 18843 percent: parseInt( options.percent, 10 ) || 150 18844 } ); 18845 18846 $.effects.effect.scale.call( this, newOptions, done ); 18847} ); 18848 18849 18850/*! 18851 * jQuery UI Effects Pulsate 1.13.0 18852 * http://jqueryui.com 18853 * 18854 * Copyright jQuery Foundation and other contributors 18855 * Released under the MIT license. 18856 * http://jquery.org/license 18857 */ 18858 18859//>>label: Pulsate Effect 18860//>>group: Effects 18861//>>description: Pulsates an element n times by changing the opacity to zero and back. 18862//>>docs: http://api.jqueryui.com/pulsate-effect/ 18863//>>demos: http://jqueryui.com/effect/ 18864 18865 18866var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) { 18867 var element = $( this ), 18868 mode = options.mode, 18869 show = mode === "show", 18870 hide = mode === "hide", 18871 showhide = show || hide, 18872 18873 // Showing or hiding leaves off the "last" animation 18874 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 18875 duration = options.duration / anims, 18876 animateTo = 0, 18877 i = 1, 18878 queuelen = element.queue().length; 18879 18880 if ( show || !element.is( ":visible" ) ) { 18881 element.css( "opacity", 0 ).show(); 18882 animateTo = 1; 18883 } 18884 18885 // Anims - 1 opacity "toggles" 18886 for ( ; i < anims; i++ ) { 18887 element.animate( { opacity: animateTo }, duration, options.easing ); 18888 animateTo = 1 - animateTo; 18889 } 18890 18891 element.animate( { opacity: animateTo }, duration, options.easing ); 18892 18893 element.queue( done ); 18894 18895 $.effects.unshift( element, queuelen, anims + 1 ); 18896} ); 18897 18898 18899/*! 18900 * jQuery UI Effects Shake 1.13.0 18901 * http://jqueryui.com 18902 * 18903 * Copyright jQuery Foundation and other contributors 18904 * Released under the MIT license. 18905 * http://jquery.org/license 18906 */ 18907 18908//>>label: Shake Effect 18909//>>group: Effects 18910//>>description: Shakes an element horizontally or vertically n times. 18911//>>docs: http://api.jqueryui.com/shake-effect/ 18912//>>demos: http://jqueryui.com/effect/ 18913 18914 18915var effectsEffectShake = $.effects.define( "shake", function( options, done ) { 18916 18917 var i = 1, 18918 element = $( this ), 18919 direction = options.direction || "left", 18920 distance = options.distance || 20, 18921 times = options.times || 3, 18922 anims = times * 2 + 1, 18923 speed = Math.round( options.duration / anims ), 18924 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18925 positiveMotion = ( direction === "up" || direction === "left" ), 18926 animation = {}, 18927 animation1 = {}, 18928 animation2 = {}, 18929 18930 queuelen = element.queue().length; 18931 18932 $.effects.createPlaceholder( element ); 18933 18934 // Animation 18935 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 18936 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 18937 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 18938 18939 // Animate 18940 element.animate( animation, speed, options.easing ); 18941 18942 // Shakes 18943 for ( ; i < times; i++ ) { 18944 element 18945 .animate( animation1, speed, options.easing ) 18946 .animate( animation2, speed, options.easing ); 18947 } 18948 18949 element 18950 .animate( animation1, speed, options.easing ) 18951 .animate( animation, speed / 2, options.easing ) 18952 .queue( done ); 18953 18954 $.effects.unshift( element, queuelen, anims + 1 ); 18955} ); 18956 18957 18958/*! 18959 * jQuery UI Effects Slide 1.13.0 18960 * http://jqueryui.com 18961 * 18962 * Copyright jQuery Foundation and other contributors 18963 * Released under the MIT license. 18964 * http://jquery.org/license 18965 */ 18966 18967//>>label: Slide Effect 18968//>>group: Effects 18969//>>description: Slides an element in and out of the viewport. 18970//>>docs: http://api.jqueryui.com/slide-effect/ 18971//>>demos: http://jqueryui.com/effect/ 18972 18973 18974var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) { 18975 var startClip, startRef, 18976 element = $( this ), 18977 map = { 18978 up: [ "bottom", "top" ], 18979 down: [ "top", "bottom" ], 18980 left: [ "right", "left" ], 18981 right: [ "left", "right" ] 18982 }, 18983 mode = options.mode, 18984 direction = options.direction || "left", 18985 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 18986 positiveMotion = ( direction === "up" || direction === "left" ), 18987 distance = options.distance || 18988 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 18989 animation = {}; 18990 18991 $.effects.createPlaceholder( element ); 18992 18993 startClip = element.cssClip(); 18994 startRef = element.position()[ ref ]; 18995 18996 // Define hide animation 18997 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 18998 animation.clip = element.cssClip(); 18999 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 19000 19001 // Reverse the animation if we're showing 19002 if ( mode === "show" ) { 19003 element.cssClip( animation.clip ); 19004 element.css( ref, animation[ ref ] ); 19005 animation.clip = startClip; 19006 animation[ ref ] = startRef; 19007 } 19008 19009 // Actually animate 19010 element.animate( animation, { 19011 queue: false, 19012 duration: options.duration, 19013 easing: options.easing,
19014 complete: done 19015 } ); 19016} ); 19017 19018 19019/*! 19020 * jQuery UI Effects Transfer 1.13.0 19021 * http://jqueryui.com 19022 * 19023 * Copyright jQuery Foundation and other contributors 19024 * Released under the MIT license. 19025 * http://jquery.org/license 19026 */ 19027 19028//>>label: Transfer Effect 19029//>>group: Effects 19030//>>description: Displays a transfer effect from one element to another. 19031//>>docs: http://api.jqueryui.com/transfer-effect/ 19032//>>demos: http://jqueryui.com/effect/ 19033 19034 19035var effect; 19036if ( $.uiBackCompat !== false ) { 19037 effect = $.effects.define( "transfer", function( options, done ) { 19038 $( this ).transfer( options, done ); 19039 } ); 19040} 19041var effectsEffectTransfer = effect; 19042 19043 19044 19045 19046} );
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.