vendor: 1,543 bytes, lines 1-66
1 2 3( function( factory ) { 4 "use strict"; 5 6 if ( typeof define === "function" && define.amd ) { 7 8 // AMD. Register as an anonymous module. 9 define( [ "jquery" ], factory ); 10 } else { 11 12 // Browser globals 13 factory( jQuery ); 14 } 15} )( function( $ ) { 16"use strict"; 17 18$.ui = $.ui || {}; 19 20var version = $.ui.version = "1.13.2"; 21 22 23/*! 24 * jQuery UI Widget 1.13.2 25 * http://jqueryui.com 26 * 27 * Copyright jQuery Foundation and other contributors 28 * Released under the MIT license. 29 * http://jquery.org/license 30 */ 31 32//>>label: Widget 33//>>group: Core 34//>>description: Provides a factory for creating stateful widgets with a common API. 35//>>docs: http://api.jqueryui.com/jQuery.widget/ 36//>>demos: http://jqueryui.com/widget/ 37 38 39var widgetUuid = 0; 40var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 41var widgetSlice = Array.prototype.slice; 42 43$.cleanData = ( function( orig ) { 44 return function( elems ) { 45 var events, elem, i; 46 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 47 48 // Only trigger remove when necessary to save time 49 events = $._data( elem, "events" ); 50 if ( events && events.remove ) { 51 $( elem ).triggerHandler( "remove" ); 52 } 53 } 54 orig( elems ); 55 }; 56} )( $.cleanData ); 57 58$.widget = function( name, base, prototype ) { 59 var existingConstructor, constructor, basePrototype; 60 61 // ProxiedPrototype allows the provided prototype to remain unmodified 62 // so that it can be used as a mixin for multiple widgets (#8876) 63 var proxiedPrototype = {}; 64 65 var namespace = name.split( "." )[ 0 ]; 66 name = name.split( "." )[ 1 ];
vendor: 18,823 bytes, lines 66-766
66 67 var fullName = namespace + "-" + name; 68 69 if ( !prototype ) { 70 prototype = base; 71 base = $.Widget; 72 } 73 74 if ( Array.isArray( prototype ) ) { 75 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 76 } 77 78 // Create selector for plugin 79 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 80 return !!$.data( elem, fullName ); 81 }; 82 83 $[ namespace ] = $[ namespace ] || {}; 84 existingConstructor = $[ namespace ][ name ]; 85 constructor = $[ namespace ][ name ] = function( options, element ) { 86 87 // Allow instantiation without "new" keyword 88 if ( !this || !this._createWidget ) { 89 return new constructor( options, element ); 90 } 91 92 // Allow instantiation without initializing for simple inheritance 93 // must use "new" keyword (the code above always passes args) 94 if ( arguments.length ) { 95 this._createWidget( options, element ); 96 } 97 }; 98 99 // Extend with the existing constructor to carry over any static properties 100 $.extend( constructor, existingConstructor, { 101 version: prototype.version, 102 103 // Copy the object used to create the prototype in case we need to 104 // redefine the widget later 105 _proto: $.extend( {}, prototype ), 106 107 // Track widgets that inherit from this widget in case this widget is 108 // redefined after a widget inherits from it 109 _childConstructors: [] 110 } ); 111 112 basePrototype = new base(); 113 114 // We need to make the options hash a property directly on the new instance 115 // otherwise we'll modify the options hash on the prototype that we're 116 // inheriting from 117 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 118 $.each( prototype, function( prop, value ) { 119 if ( typeof value !== "function" ) { 120 proxiedPrototype[ prop ] = value; 121 return; 122 } 123 proxiedPrototype[ prop ] = ( function() { 124 function _super() { 125 return base.prototype[ prop ].apply( this, arguments ); 126 } 127 128 function _superApply( args ) { 129 return base.prototype[ prop ].apply( this, args ); 130 } 131 132 return function() { 133 var __super = this._super; 134 var __superApply = this._superApply; 135 var returnValue; 136 137 this._super = _super; 138 this._superApply = _superApply; 139 140 returnValue = value.apply( this, arguments ); 141 142 this._super = __super; 143 this._superApply = __superApply; 144 145 return returnValue; 146 }; 147 } )(); 148 } ); 149 constructor.prototype = $.widget.extend( basePrototype, { 150 151 // TODO: remove support for widgetEventPrefix 152 // always use the name + a colon as the prefix, e.g., draggable:start 153 // don't prefix for widgets that aren't DOM-based 154 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 155 }, proxiedPrototype, { 156 constructor: constructor, 157 namespace: namespace, 158 widgetName: name, 159 widgetFullName: fullName 160 } ); 161 162 // If this widget is being redefined then we need to find all widgets that 163 // are inheriting from it and redefine all of them so that they inherit from 164 // the new version of this widget. We're essentially trying to replace one 165 // level in the prototype chain. 166 if ( existingConstructor ) { 167 $.each( existingConstructor._childConstructors, function( i, child ) { 168 var childPrototype = child.prototype; 169 170 // Redefine the child widget using the same prototype that was 171 // originally used, but inherit from the new version of the base 172 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 173 child._proto ); 174 } ); 175 176 // Remove the list of existing child constructors from the old constructor 177 // so the old child constructors can be garbage collected 178 delete existingConstructor._childConstructors; 179 } else { 180 base._childConstructors.push( constructor ); 181 } 182 183 $.widget.bridge( name, constructor ); 184 185 return constructor; 186}; 187 188$.widget.extend = function( target ) { 189 var input = widgetSlice.call( arguments, 1 ); 190 var inputIndex = 0; 191 var inputLength = input.length; 192 var key; 193 var value; 194 195 for ( ; inputIndex < inputLength; inputIndex++ ) { 196 for ( key in input[ inputIndex ] ) { 197 value = input[ inputIndex ][ key ]; 198 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 199 200 // Clone objects 201 if ( $.isPlainObject( value ) ) { 202 target[ key ] = $.isPlainObject( target[ key ] ) ? 203 $.widget.extend( {}, target[ key ], value ) : 204 205 // Don't extend strings, arrays, etc. with objects 206 $.widget.extend( {}, value ); 207 208 // Copy everything else by reference 209 } else { 210 target[ key ] = value; 211 } 212 } 213 } 214 } 215 return target; 216}; 217 218$.widget.bridge = function( name, object ) { 219 var fullName = object.prototype.widgetFullName || name; 220 $.fn[ name ] = function( options ) { 221 var isMethodCall = typeof options === "string"; 222 var args = widgetSlice.call( arguments, 1 ); 223 var returnValue = this; 224 225 if ( isMethodCall ) { 226 227 // If this is an empty collection, we need to have the instance method 228 // return undefined instead of the jQuery instance 229 if ( !this.length && options === "instance" ) { 230 returnValue = undefined; 231 } else { 232 this.each( function() { 233 var methodValue; 234 var instance = $.data( this, fullName ); 235 236 if ( options === "instance" ) { 237 returnValue = instance; 238 return false; 239 } 240 241 if ( !instance ) { 242 return $.error( "cannot call methods on " + name + 243 " prior to initialization; " + 244 "attempted to call method '" + options + "'" ); 245 } 246 247 if ( typeof instance[ options ] !== "function" || 248 options.charAt( 0 ) === "_" ) { 249 return $.error( "no such method '" + options + "' for " + name + 250 " widget instance" ); 251 } 252 253 methodValue = instance[ options ].apply( instance, args ); 254 255 if ( methodValue !== instance && methodValue !== undefined ) { 256 returnValue = methodValue && methodValue.jquery ? 257 returnValue.pushStack( methodValue.get() ) : 258 methodValue; 259 return false; 260 } 261 } ); 262 } 263 } else { 264 265 // Allow multiple hashes to be passed on init 266 if ( args.length ) { 267 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 268 } 269 270 this.each( function() { 271 var instance = $.data( this, fullName ); 272 if ( instance ) { 273 instance.option( options || {} ); 274 if ( instance._init ) { 275 instance._init(); 276 } 277 } else { 278 $.data( this, fullName, new object( options, this ) ); 279 } 280 } ); 281 } 282 283 return returnValue; 284 }; 285}; 286 287$.Widget = function( /* options, element */ ) {}; 288$.Widget._childConstructors = []; 289 290$.Widget.prototype = { 291 widgetName: "widget", 292 widgetEventPrefix: "", 293 defaultElement: "<div>", 294 295 options: { 296 classes: {}, 297 disabled: false, 298 299 // Callbacks 300 create: null 301 }, 302 303 _createWidget: function( options, element ) { 304 element = $( element || this.defaultElement || this )[ 0 ]; 305 this.element = $( element ); 306 this.uuid = widgetUuid++; 307 this.eventNamespace = "." + this.widgetName + this.uuid; 308 309 this.bindings = $(); 310 this.hoverable = $(); 311 this.focusable = $(); 312 this.classesElementLookup = {}; 313 314 if ( element !== this ) { 315 $.data( element, this.widgetFullName, this ); 316 this._on( true, this.element, { 317 remove: function( event ) { 318 if ( event.target === element ) { 319 this.destroy(); 320 } 321 } 322 } ); 323 this.document = $( element.style ? 324 325 // Element within the document 326 element.ownerDocument : 327 328 // Element is window or document 329 element.document || element ); 330 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 331 } 332 333 this.options = $.widget.extend( {}, 334 this.options, 335 this._getCreateOptions(), 336 options ); 337 338 this._create(); 339 340 if ( this.options.disabled ) { 341 this._setOptionDisabled( this.options.disabled ); 342 } 343 344 this._trigger( "create", null, this._getCreateEventData() ); 345 this._init(); 346 }, 347 348 _getCreateOptions: function() { 349 return {}; 350 }, 351 352 _getCreateEventData: $.noop, 353 354 _create: $.noop, 355 356 _init: $.noop, 357 358 destroy: function() { 359 var that = this; 360 361 this._destroy(); 362 $.each( this.classesElementLookup, function( key, value ) { 363 that._removeClass( value, key ); 364 } ); 365 366 // We can probably remove the unbind calls in 2.0 367 // all event bindings should go through this._on() 368 this.element 369 .off( this.eventNamespace ) 370 .removeData( this.widgetFullName ); 371 this.widget() 372 .off( this.eventNamespace ) 373 .removeAttr( "aria-disabled" ); 374 375 // Clean up events and states 376 this.bindings.off( this.eventNamespace ); 377 }, 378 379 _destroy: $.noop, 380 381 widget: function() { 382 return this.element; 383 }, 384 385 option: function( key, value ) { 386 var options = key; 387 var parts; 388 var curOption; 389 var i; 390 391 if ( arguments.length === 0 ) { 392 393 // Don't return a reference to the internal hash 394 return $.widget.extend( {}, this.options ); 395 } 396 397 if ( typeof key === "string" ) { 398 399 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 400 options = {}; 401 parts = key.split( "." ); 402 key = parts.shift(); 403 if ( parts.length ) { 404 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 405 for ( i = 0; i < parts.length - 1; i++ ) { 406 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 407 curOption = curOption[ parts[ i ] ]; 408 } 409 key = parts.pop(); 410 if ( arguments.length === 1 ) { 411 return curOption[ key ] === undefined ? null : curOption[ key ]; 412 } 413 curOption[ key ] = value; 414 } else { 415 if ( arguments.length === 1 ) { 416 return this.options[ key ] === undefined ? null : this.options[ key ]; 417 } 418 options[ key ] = value; 419 } 420 } 421 422 this._setOptions( options ); 423 424 return this; 425 }, 426 427 _setOptions: function( options ) { 428 var key; 429 430 for ( key in options ) { 431 this._setOption( key, options[ key ] ); 432 } 433 434 return this; 435 }, 436 437 _setOption: function( key, value ) { 438 if ( key === "classes" ) { 439 this._setOptionClasses( value ); 440 } 441 442 this.options[ key ] = value; 443 444 if ( key === "disabled" ) { 445 this._setOptionDisabled( value ); 446 } 447 448 return this; 449 }, 450 451 _setOptionClasses: function( value ) { 452 var classKey, elements, currentElements; 453 454 for ( classKey in value ) { 455 currentElements = this.classesElementLookup[ classKey ]; 456 if ( value[ classKey ] === this.options.classes[ classKey ] || 457 !currentElements || 458 !currentElements.length ) { 459 continue; 460 } 461 462 // We are doing this to create a new jQuery object because the _removeClass() call 463 // on the next line is going to destroy the reference to the current elements being 464 // tracked. We need to save a copy of this collection so that we can add the new classes 465 // below. 466 elements = $( currentElements.get() ); 467 this._removeClass( currentElements, classKey ); 468 469 // We don't use _addClass() here, because that uses this.options.classes 470 // for generating the string of classes. We want to use the value passed in from 471 // _setOption(), this is the new value of the classes option which was passed to 472 // _setOption(). We pass this value directly to _classes(). 473 elements.addClass( this._classes( { 474 element: elements, 475 keys: classKey, 476 classes: value, 477 add: true 478 } ) ); 479 } 480 }, 481 482 _setOptionDisabled: function( value ) { 483 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 484 485 // If the widget is becoming disabled, then nothing is interactive 486 if ( value ) { 487 this._removeClass( this.hoverable, null, "ui-state-hover" ); 488 this._removeClass( this.focusable, null, "ui-state-focus" ); 489 } 490 }, 491 492 enable: function() { 493 return this._setOptions( { disabled: false } ); 494 }, 495 496 disable: function() { 497 return this._setOptions( { disabled: true } ); 498 }, 499 500 _classes: function( options ) { 501 var full = []; 502 var that = this; 503 504 options = $.extend( { 505 element: this.element, 506 classes: this.options.classes || {} 507 }, options ); 508 509 function bindRemoveEvent() { 510 var nodesToBind = []; 511 512 options.element.each( function( _, element ) { 513 var isTracked = $.map( that.classesElementLookup, function( elements ) { 514 return elements; 515 } ) 516 .some( function( elements ) { 517 return elements.is( element ); 518 } ); 519 520 if ( !isTracked ) { 521 nodesToBind.push( element ); 522 } 523 } ); 524 525 that._on( $( nodesToBind ), { 526 remove: "_untrackClassesElement" 527 } ); 528 } 529 530 function processClassString( classes, checkOption ) { 531 var current, i; 532 for ( i = 0; i < classes.length; i++ ) { 533 current = that.classesElementLookup[ classes[ i ] ] || $(); 534 if ( options.add ) { 535 bindRemoveEvent(); 536 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 537 } else { 538 current = $( current.not( options.element ).get() ); 539 } 540 that.classesElementLookup[ classes[ i ] ] = current; 541 full.push( classes[ i ] ); 542 if ( checkOption && options.classes[ classes[ i ] ] ) { 543 full.push( options.classes[ classes[ i ] ] ); 544 } 545 } 546 } 547 548 if ( options.keys ) { 549 processClassString( options.keys.match( /\S+/g ) || [], true ); 550 } 551 if ( options.extra ) { 552 processClassString( options.extra.match( /\S+/g ) || [] ); 553 } 554 555 return full.join( " " ); 556 }, 557 558 _untrackClassesElement: function( event ) { 559 var that = this; 560 $.each( that.classesElementLookup, function( key, value ) { 561 if ( $.inArray( event.target, value ) !== -1 ) { 562 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 563 } 564 } ); 565 566 this._off( $( event.target ) ); 567 }, 568 569 _removeClass: function( element, keys, extra ) { 570 return this._toggleClass( element, keys, extra, false ); 571 }, 572 573 _addClass: function( element, keys, extra ) { 574 return this._toggleClass( element, keys, extra, true ); 575 }, 576 577 _toggleClass: function( element, keys, extra, add ) { 578 add = ( typeof add === "boolean" ) ? add : extra; 579 var shift = ( typeof element === "string" || element === null ), 580 options = { 581 extra: shift ? keys : extra, 582 keys: shift ? element : keys, 583 element: shift ? this.element : element, 584 add: add 585 }; 586 options.element.toggleClass( this._classes( options ), add ); 587 return this; 588 }, 589 590 _on: function( suppressDisabledCheck, element, handlers ) { 591 var delegateElement; 592 var instance = this; 593 594 // No suppressDisabledCheck flag, shuffle arguments 595 if ( typeof suppressDisabledCheck !== "boolean" ) { 596 handlers = element; 597 element = suppressDisabledCheck; 598 suppressDisabledCheck = false; 599 } 600 601 // No element argument, shuffle and use this.element 602 if ( !handlers ) { 603 handlers = element; 604 element = this.element; 605 delegateElement = this.widget(); 606 } else { 607 element = delegateElement = $( element ); 608 this.bindings = this.bindings.add( element ); 609 } 610 611 $.each( handlers, function( event, handler ) { 612 function handlerProxy() { 613 614 // Allow widgets to customize the disabled handling 615 // - disabled as an array instead of boolean 616 // - disabled class as method for disabling individual parts 617 if ( !suppressDisabledCheck && 618 ( instance.options.disabled === true || 619 $( this ).hasClass( "ui-state-disabled" ) ) ) { 620 return; 621 } 622 return ( typeof handler === "string" ? instance[ handler ] : handler ) 623 .apply( instance, arguments ); 624 } 625 626 // Copy the guid so direct unbinding works 627 if ( typeof handler !== "string" ) { 628 handlerProxy.guid = handler.guid = 629 handler.guid || handlerProxy.guid || $.guid++; 630 } 631 632 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 633 var eventName = match[ 1 ] + instance.eventNamespace; 634 var selector = match[ 2 ]; 635 636 if ( selector ) { 637 delegateElement.on( eventName, selector, handlerProxy ); 638 } else { 639 element.on( eventName, handlerProxy ); 640 } 641 } ); 642 }, 643 644 _off: function( element, eventName ) { 645 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 646 this.eventNamespace; 647 element.off( eventName ); 648 649 // Clear the stack to avoid memory leaks (#10056) 650 this.bindings = $( this.bindings.not( element ).get() ); 651 this.focusable = $( this.focusable.not( element ).get() ); 652 this.hoverable = $( this.hoverable.not( element ).get() ); 653 }, 654 655 _delay: function( handler, delay ) { 656 function handlerProxy() { 657 return ( typeof handler === "string" ? instance[ handler ] : handler ) 658 .apply( instance, arguments ); 659 } 660 var instance = this; 661 return setTimeout( handlerProxy, delay || 0 ); 662 }, 663 664 _hoverable: function( element ) { 665 this.hoverable = this.hoverable.add( element ); 666 this._on( element, { 667 mouseenter: function( event ) { 668 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 669 }, 670 mouseleave: function( event ) { 671 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 672 } 673 } ); 674 }, 675 676 _focusable: function( element ) { 677 this.focusable = this.focusable.add( element ); 678 this._on( element, { 679 focusin: function( event ) { 680 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 681 }, 682 focusout: function( event ) { 683 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 684 } 685 } ); 686 }, 687 688 _trigger: function( type, event, data ) { 689 var prop, orig; 690 var callback = this.options[ type ]; 691 692 data = data || {}; 693 event = $.Event( event ); 694 event.type = ( type === this.widgetEventPrefix ? 695 type : 696 this.widgetEventPrefix + type ).toLowerCase(); 697 698 // The original event may come from any element 699 // so we need to reset the target on the new event 700 event.target = this.element[ 0 ]; 701 702 // Copy original event properties over to the new event 703 orig = event.originalEvent; 704 if ( orig ) { 705 for ( prop in orig ) { 706 if ( !( prop in event ) ) { 707 event[ prop ] = orig[ prop ]; 708 } 709 } 710 } 711 712 this.element.trigger( event, data ); 713 return !( typeof callback === "function" && 714 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 715 event.isDefaultPrevented() ); 716 } 717}; 718 719$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 720 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 721 if ( typeof options === "string" ) { 722 options = { effect: options }; 723 } 724 725 var hasOptions; 726 var effectName = !options ? 727 method : 728 options === true || typeof options === "number" ? 729 defaultEffect : 730 options.effect || defaultEffect; 731 732 options = options || {}; 733 if ( typeof options === "number" ) { 734 options = { duration: options }; 735 } else if ( options === true ) { 736 options = {}; 737 } 738 739 hasOptions = !$.isEmptyObject( options ); 740 options.complete = callback; 741 742 if ( options.delay ) { 743 element.delay( options.delay ); 744 } 745 746 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 747 element[ method ]( options ); 748 } else if ( effectName !== method && element[ effectName ] ) { 749 element[ effectName ]( options.duration, options.easing, callback ); 750 } else { 751 element.queue( function( next ) { 752 $( this )[ method ](); 753 if ( callback ) { 754 callback.call( element[ 0 ] ); 755 } 756 next(); 757 } ); 758 } 759 }; 760} ); 761 762var widget = $.widget; 763 764 765/*! 766 * jQuery UI Position 1.1
vendor: 3,858 bytes, lines 766-909
7663.2 767 * http://jqueryui.com 768 * 769 * Copyright jQuery Foundation and other contributors 770 * Released under the MIT license. 771 * http://jquery.org/license 772 * 773 * http://api.jqueryui.com/position/ 774 */ 775 776//>>label: Position 777//>>group: Core 778//>>description: Positions elements relative to other elements. 779//>>docs: http://api.jqueryui.com/position/ 780//>>demos: http://jqueryui.com/position/ 781 782 783( function() { 784var cachedScrollbarWidth, 785 max = Math.max, 786 abs = Math.abs, 787 rhorizontal = /left|center|right/, 788 rvertical = /top|center|bottom/, 789 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 790 rposition = /^\w+/, 791 rpercent = /%$/, 792 _position = $.fn.position; 793 794function getOffsets( offsets, width, height ) { 795 return [ 796 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 797 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 798 ]; 799} 800 801function parseCss( element, property ) { 802 return parseInt( $.css( element, property ), 10 ) || 0; 803} 804 805function isWindow( obj ) { 806 return obj != null && obj === obj.window; 807} 808 809function getDimensions( elem ) { 810 var raw = elem[ 0 ]; 811 if ( raw.nodeType === 9 ) { 812 return { 813 width: elem.width(), 814 height: elem.height(), 815 offset: { top: 0, left: 0 } 816 }; 817 } 818 if ( isWindow( raw ) ) { 819 return { 820 width: elem.width(), 821 height: elem.height(), 822 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 823 }; 824 } 825 if ( raw.preventDefault ) { 826 return { 827 width: 0, 828 height: 0, 829 offset: { top: raw.pageY, left: raw.pageX } 830 }; 831 } 832 return { 833 width: elem.outerWidth(), 834 height: elem.outerHeight(), 835 offset: elem.offset() 836 }; 837} 838 839$.position = { 840 scrollbarWidth: function() { 841 if ( cachedScrollbarWidth !== undefined ) { 842 return cachedScrollbarWidth; 843 } 844 var w1, w2, 845 div = $( "<div style=" + 846 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 847 "<div style='height:300px;width:auto;'></div></div>" ), 848 innerDiv = div.children()[ 0 ]; 849 850 $( "body" ).append( div ); 851 w1 = innerDiv.offsetWidth; 852 div.css( "overflow", "scroll" ); 853 854 w2 = innerDiv.offsetWidth; 855 856 if ( w1 === w2 ) { 857 w2 = div[ 0 ].clientWidth; 858 } 859 860 div.remove(); 861 862 return ( cachedScrollbarWidth = w1 - w2 ); 863 }, 864 getScrollInfo: function( within ) { 865 var overflowX = within.isWindow || within.isDocument ? "" : 866 within.element.css( "overflow-x" ), 867 overflowY = within.isWindow || within.isDocument ? "" : 868 within.element.css( "overflow-y" ), 869 hasOverflowX = overflowX === "scroll" || 870 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 871 hasOverflowY = overflowY === "scroll" || 872 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 873 return { 874 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 875 height: hasOverflowX ? $.position.scrollbarWidth() : 0 876 }; 877 }, 878 getWithinInfo: function( element ) { 879 var withinElement = $( element || window ), 880 isElemWindow = isWindow( withinElement[ 0 ] ), 881 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 882 hasOffset = !isElemWindow && !isDocument; 883 return { 884 element: withinElement, 885 isWindow: isElemWindow, 886 isDocument: isDocument, 887 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 888 scrollLeft: withinElement.scrollLeft(), 889 scrollTop: withinElement.scrollTop(), 890 width: withinElement.outerWidth(), 891 height: withinElement.outerHeight() 892 }; 893 } 894}; 895 896$.fn.position = function( options ) { 897 if ( !options || !options.of ) { 898 return _position.apply( this, arguments ); 899 } 900 901 // Make a copy, we don't want to modify arguments 902 options = $.extend( {}, options ); 903 904 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 905 906 // Make sure string options are treated as CSS selectors 907 target = typeof options.of === "string" ? 908 $( document ).find( options.of ) : 909 $( options.of ),
vendor: 10,992 bytes, lines 910-1263
910 911 within = $.position.getWithinInfo( options.within ), 912 scrollInfo = $.position.getScrollInfo( within ), 913 collision = ( options.collision || "flip" ).split( " " ), 914 offsets = {}; 915 916 dimensions = getDimensions( target ); 917 if ( target[ 0 ].preventDefault ) { 918 919 // Force left top to allow flipping 920 options.at = "left top"; 921 } 922 targetWidth = dimensions.width; 923 targetHeight = dimensions.height; 924 targetOffset = dimensions.offset; 925 926 // Clone to reuse original targetOffset later 927 basePosition = $.extend( {}, targetOffset ); 928 929 // Force my and at to have valid horizontal and vertical positions 930 // if a value is missing or invalid, it will be converted to center 931 $.each( [ "my", "at" ], function() { 932 var pos = ( options[ this ] || "" ).split( " " ), 933 horizontalOffset, 934 verticalOffset; 935 936 if ( pos.length === 1 ) { 937 pos = rhorizontal.test( pos[ 0 ] ) ? 938 pos.concat( [ "center" ] ) : 939 rvertical.test( pos[ 0 ] ) ? 940 [ "center" ].concat( pos ) : 941 [ "center", "center" ]; 942 } 943 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 944 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 945 946 // Calculate offsets 947 horizontalOffset = roffset.exec( pos[ 0 ] ); 948 verticalOffset = roffset.exec( pos[ 1 ] ); 949 offsets[ this ] = [ 950 horizontalOffset ? horizontalOffset[ 0 ] : 0, 951 verticalOffset ? verticalOffset[ 0 ] : 0 952 ]; 953 954 // Reduce to just the positions without the offsets 955 options[ this ] = [ 956 rposition.exec( pos[ 0 ] )[ 0 ], 957 rposition.exec( pos[ 1 ] )[ 0 ] 958 ]; 959 } ); 960 961 // Normalize collision option 962 if ( collision.length === 1 ) { 963 collision[ 1 ] = collision[ 0 ]; 964 } 965 966 if ( options.at[ 0 ] === "right" ) { 967 basePosition.left += targetWidth; 968 } else if ( options.at[ 0 ] === "center" ) { 969 basePosition.left += targetWidth / 2; 970 } 971 972 if ( options.at[ 1 ] === "bottom" ) { 973 basePosition.top += targetHeight; 974 } else if ( options.at[ 1 ] === "center" ) { 975 basePosition.top += targetHeight / 2; 976 } 977 978 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 979 basePosition.left += atOffset[ 0 ]; 980 basePosition.top += atOffset[ 1 ]; 981 982 return this.each( function() { 983 var collisionPosition, using, 984 elem = $( this ), 985 elemWidth = elem.outerWidth(), 986 elemHeight = elem.outerHeight(), 987 marginLeft = parseCss( this, "marginLeft" ), 988 marginTop = parseCss( this, "marginTop" ), 989 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 990 scrollInfo.width, 991 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 992 scrollInfo.height, 993 position = $.extend( {}, basePosition ), 994 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 995 996 if ( options.my[ 0 ] === "right" ) { 997 position.left -= elemWidth; 998 } else if ( options.my[ 0 ] === "center" ) { 999 position.left -= elemWidth / 2; 1000 } 1001 1002 if ( options.my[ 1 ] === "bottom" ) { 1003 position.top -= elemHeight; 1004 } else if ( options.my[ 1 ] === "center" ) { 1005 position.top -= elemHeight / 2; 1006 } 1007 1008 position.left += myOffset[ 0 ]; 1009 position.top += myOffset[ 1 ]; 1010 1011 collisionPosition = { 1012 marginLeft: marginLeft, 1013 marginTop: marginTop 1014 }; 1015 1016 $.each( [ "left", "top" ], function( i, dir ) { 1017 if ( $.ui.position[ collision[ i ] ] ) { 1018 $.ui.position[ collision[ i ] ][ dir ]( position, { 1019 targetWidth: targetWidth, 1020 targetHeight: targetHeight, 1021 elemWidth: elemWidth, 1022 elemHeight: elemHeight, 1023 collisionPosition: collisionPosition, 1024 collisionWidth: collisionWidth, 1025 collisionHeight: collisionHeight, 1026 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1027 my: options.my, 1028 at: options.at, 1029 within: within, 1030 elem: elem 1031 } ); 1032 } 1033 } ); 1034 1035 if ( options.using ) { 1036 1037 // Adds feedback as second argument to using callback, if present 1038 using = function( props ) { 1039 var left = targetOffset.left - position.left, 1040 right = left + targetWidth - elemWidth, 1041 top = targetOffset.top - position.top, 1042 bottom = top + targetHeight - elemHeight, 1043 feedback = { 1044 target: { 1045 element: target, 1046 left: targetOffset.left, 1047 top: targetOffset.top, 1048 width: targetWidth, 1049 height: targetHeight 1050 }, 1051 element: { 1052 element: elem, 1053 left: position.left, 1054 top: position.top, 1055 width: elemWidth, 1056 height: elemHeight 1057 }, 1058 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1059 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1060 }; 1061 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1062 feedback.horizontal = "center"; 1063 } 1064 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1065 feedback.vertical = "middle"; 1066 } 1067 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1068 feedback.important = "horizontal"; 1069 } else { 1070 feedback.important = "vertical"; 1071 } 1072 options.using.call( this, props, feedback ); 1073 }; 1074 } 1075 1076 elem.offset( $.extend( position, { using: using } ) ); 1077 } ); 1078}; 1079 1080$.ui.position = { 1081 fit: { 1082 left: function( position, data ) { 1083 var within = data.within, 1084 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1085 outerWidth = within.width, 1086 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1087 overLeft = withinOffset - collisionPosLeft, 1088 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1089 newOverRight; 1090 1091 // Element is wider than within 1092 if ( data.collisionWidth > outerWidth ) { 1093 1094 // Element is initially over the left side of within 1095 if ( overLeft > 0 && overRight <= 0 ) { 1096 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 1097 withinOffset; 1098 position.left += overLeft - newOverRight; 1099 1100 // Element is initially over right side of within 1101 } else if ( overRight > 0 && overLeft <= 0 ) { 1102 position.left = withinOffset; 1103 1104 // Element is initially over both left and right sides of within 1105 } else { 1106 if ( overLeft > overRight ) { 1107 position.left = withinOffset + outerWidth - data.collisionWidth; 1108 } else { 1109 position.left = withinOffset; 1110 } 1111 } 1112 1113 // Too far left -> align with left edge 1114 } else if ( overLeft > 0 ) { 1115 position.left += overLeft; 1116 1117 // Too far right -> align with right edge 1118 } else if ( overRight > 0 ) { 1119 position.left -= overRight; 1120 1121 // Adjust based on position and margin 1122 } else { 1123 position.left = max( position.left - collisionPosLeft, position.left ); 1124 } 1125 }, 1126 top: function( position, data ) { 1127 var within = data.within, 1128 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1129 outerHeight = data.within.height, 1130 collisionPosTop = position.top - data.collisionPosition.marginTop, 1131 overTop = withinOffset - collisionPosTop, 1132 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1133 newOverBottom; 1134 1135 // Element is taller than within 1136 if ( data.collisionHeight > outerHeight ) { 1137 1138 // Element is initially over the top of within 1139 if ( overTop > 0 && overBottom <= 0 ) { 1140 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 1141 withinOffset; 1142 position.top += overTop - newOverBottom; 1143 1144 // Element is initially over bottom of within 1145 } else if ( overBottom > 0 && overTop <= 0 ) { 1146 position.top = withinOffset; 1147 1148 // Element is initially over both top and bottom of within 1149 } else { 1150 if ( overTop > overBottom ) { 1151 position.top = withinOffset + outerHeight - data.collisionHeight; 1152 } else { 1153 position.top = withinOffset; 1154 } 1155 } 1156 1157 // Too far up -> align with top 1158 } else if ( overTop > 0 ) { 1159 position.top += overTop; 1160 1161 // Too far down -> align with bottom edge 1162 } else if ( overBottom > 0 ) { 1163 position.top -= overBottom; 1164 1165 // Adjust based on position and margin 1166 } else { 1167 position.top = max( position.top - collisionPosTop, position.top ); 1168 } 1169 } 1170 }, 1171 flip: { 1172 left: function( position, data ) { 1173 var within = data.within, 1174 withinOffset = within.offset.left + within.scrollLeft, 1175 outerWidth = within.width, 1176 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1177 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1178 overLeft = collisionPosLeft - offsetLeft, 1179 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1180 myOffset = data.my[ 0 ] === "left" ? 1181 -data.elemWidth : 1182 data.my[ 0 ] === "right" ? 1183 data.elemWidth : 1184 0, 1185 atOffset = data.at[ 0 ] === "left" ? 1186 data.targetWidth : 1187 data.at[ 0 ] === "right" ? 1188 -data.targetWidth : 1189 0, 1190 offset = -2 * data.offset[ 0 ], 1191 newOverRight, 1192 newOverLeft; 1193 1194 if ( overLeft < 0 ) { 1195 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 1196 outerWidth - withinOffset; 1197 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1198 position.left += myOffset + atOffset + offset; 1199 } 1200 } else if ( overRight > 0 ) { 1201 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 1202 atOffset + offset - offsetLeft; 1203 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1204 position.left += myOffset + atOffset + offset; 1205 } 1206 } 1207 }, 1208 top: function( position, data ) { 1209 var within = data.within, 1210 withinOffset = within.offset.top + within.scrollTop, 1211 outerHeight = within.height, 1212 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1213 collisionPosTop = position.top - data.collisionPosition.marginTop, 1214 overTop = collisionPosTop - offsetTop, 1215 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1216 top = data.my[ 1 ] === "top", 1217 myOffset = top ? 1218 -data.elemHeight : 1219 data.my[ 1 ] === "bottom" ? 1220 data.elemHeight : 1221 0, 1222 atOffset = data.at[ 1 ] === "top" ? 1223 data.targetHeight : 1224 data.at[ 1 ] === "bottom" ? 1225 -data.targetHeight : 1226 0, 1227 offset = -2 * data.offset[ 1 ], 1228 newOverTop, 1229 newOverBottom; 1230 if ( overTop < 0 ) { 1231 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 1232 outerHeight - withinOffset; 1233 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1234 position.top += myOffset + atOffset + offset; 1235 } 1236 } else if ( overBottom > 0 ) { 1237 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 1238 offset - offsetTop; 1239 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1240 position.top += myOffset + atOffset + offset; 1241 } 1242 } 1243 } 1244 }, 1245 flipfit: { 1246 left: function() { 1247 $.ui.position.flip.left.apply( this, arguments ); 1248 $.ui.position.fit.left.apply( this, arguments ); 1249 }, 1250 top: function() { 1251 $.ui.position.flip.top.apply( this, arguments ); 1252 $.ui.position.fit.top.apply( this, arguments ); 1253 } 1254 } 1255}; 1256 1257} )(); 1258 1259var position = $.ui.position; 1260 1261 1262/*! 1263 * jQuery UI :data 1.1
12633.2 1264 * http://jqueryui.com 1265 * 1266 * Copyright jQuery Foundation and other contributors 1267 * Released under the MIT license. 1268 * http://jquery.org/license 1269 */ 1270 1271//>>label: :data Selector
vendor: 1,696 bytes, lines 1272-1340
1272//>>group: Core 1273//>>description: Selects elements which have data stored under the specified key. 1274//>>docs: http://api.jqueryui.com/data-selector/ 1275 1276 1277var data = $.extend( $.expr.pseudos, { 1278 data: $.expr.createPseudo ? 1279 $.expr.createPseudo( function( dataName ) { 1280 return function( elem ) { 1281 return !!$.data( elem, dataName ); 1282 }; 1283 } ) : 1284 1285 // Support: jQuery <1.8 1286 function( elem, i, match ) { 1287 return !!$.data( elem, match[ 3 ] ); 1288 } 1289} ); 1290 1291/*! 1292 * jQuery UI Disable Selection 1.13.2 1293 * http://jqueryui.com 1294 * 1295 * Copyright jQuery Foundation and other contributors 1296 * Released under the MIT license. 1297 * http://jquery.org/license 1298 */ 1299 1300//>>label: disableSelection 1301//>>group: Core 1302//>>description: Disable selection of text content within the set of matched elements. 1303//>>docs: http://api.jqueryui.com/disableSelection/ 1304 1305// This file is deprecated 1306 1307var disableSelection = $.fn.extend( { 1308 disableSelection: ( function() { 1309 var eventType = "onselectstart" in document.createElement( "div" ) ? 1310 "selectstart" : 1311 "mousedown"; 1312 1313 return function() { 1314 return this.on( eventType + ".ui-disableSelection", function( event ) { 1315 event.preventDefault(); 1316 } ); 1317 }; 1318 } )(), 1319 1320 enableSelection: function() { 1321 return this.off( ".ui-disableSelection" ); 1322 } 1323} ); 1324 1325 1326 1327// Create a local jQuery because jQuery Color relies on it and the 1328// global may not exist with AMD and a custom build (#10199). 1329// This module is a noop if used as a regular AMD module. 1330// eslint-disable-next-line no-unused-vars 1331var jQuery = $; 1332 1333 1334/*! 1335 * jQuery Color Animations v2.2.0 1336 * https://github.com/jquery/jquery-color 1337 * 1338 * Copyright OpenJS Foundation and other contributors 1339 * Released under the MIT license. 1340 * http
vendor: 16,926 bytes, lines 1340-2047
1340://jquery.org/license 1341 * 1342 * Date: Sun May 10 09:02:36 2020 +0200 1343 */ 1344 1345 1346 1347 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + 1348 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", 1349 1350 class2type = {}, 1351 toString = class2type.toString, 1352 1353 // plusequals test for += 100 -= 100 1354 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 1355 1356 // a set of RE's that can match strings and generate color tuples. 1357 stringParsers = [ { 1358 re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1359 parse: function( execResult ) { 1360 return [ 1361 execResult[ 1 ], 1362 execResult[ 2 ], 1363 execResult[ 3 ], 1364 execResult[ 4 ] 1365 ]; 1366 } 1367 }, { 1368 re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1369 parse: function( execResult ) { 1370 return [ 1371 execResult[ 1 ] * 2.55, 1372 execResult[ 2 ] * 2.55, 1373 execResult[ 3 ] * 2.55, 1374 execResult[ 4 ] 1375 ]; 1376 } 1377 }, { 1378 1379 // this regex ignores A-F because it's compared against an already lowercased string 1380 re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, 1381 parse: function( execResult ) { 1382 return [ 1383 parseInt( execResult[ 1 ], 16 ), 1384 parseInt( execResult[ 2 ], 16 ), 1385 parseInt( execResult[ 3 ], 16 ), 1386 execResult[ 4 ] ? 1387 ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : 1388 1 1389 ]; 1390 } 1391 }, { 1392 1393 // this regex ignores A-F because it's compared against an already lowercased string 1394 re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, 1395 parse: function( execResult ) { 1396 return [ 1397 parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 1398 parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 1399 parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), 1400 execResult[ 4 ] ? 1401 ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) 1402 .toFixed( 2 ) : 1403 1 1404 ]; 1405 } 1406 }, { 1407 re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, 1408 space: "hsla", 1409 parse: function( execResult ) { 1410 return [ 1411 execResult[ 1 ], 1412 execResult[ 2 ] / 100, 1413 execResult[ 3 ] / 100, 1414 execResult[ 4 ] 1415 ]; 1416 } 1417 } ], 1418 1419 // jQuery.Color( ) 1420 color = jQuery.Color = function( color, green, blue, alpha ) { 1421 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 1422 }, 1423 spaces = { 1424 rgba: { 1425 props: { 1426 red: { 1427 idx: 0, 1428 type: "byte" 1429 }, 1430 green: { 1431 idx: 1, 1432 type: "byte" 1433 }, 1434 blue: { 1435 idx: 2, 1436 type: "byte" 1437 } 1438 } 1439 }, 1440 1441 hsla: { 1442 props: { 1443 hue: { 1444 idx: 0, 1445 type: "degrees" 1446 }, 1447 saturation: { 1448 idx: 1, 1449 type: "percent" 1450 }, 1451 lightness: { 1452 idx: 2, 1453 type: "percent" 1454 } 1455 } 1456 } 1457 }, 1458 propTypes = { 1459 "byte": { 1460 floor: true, 1461 max: 255 1462 }, 1463 "percent": { 1464 max: 1 1465 }, 1466 "degrees": { 1467 mod: 360, 1468 floor: true 1469 } 1470 }, 1471 support = color.support = {}, 1472 1473 // element for support tests 1474 supportElem = jQuery( "<p>" )[ 0 ], 1475 1476 // colors = jQuery.Color.names 1477 colors, 1478 1479 // local aliases of functions called often 1480 each = jQuery.each; 1481 1482// determine rgba support immediately 1483supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 1484support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 1485 1486// define cache name and alpha properties 1487// for rgba and hsla spaces 1488each( spaces, function( spaceName, space ) { 1489 space.cache = "_" + spaceName; 1490 space.props.alpha = { 1491 idx: 3, 1492 type: "percent", 1493 def: 1 1494 }; 1495} ); 1496 1497// Populate the class2type map 1498jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 1499 function( _i, name ) { 1500 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 1501 } ); 1502 1503function getType( obj ) { 1504 if ( obj == null ) { 1505 return obj + ""; 1506 } 1507 1508 return typeof obj === "object" ? 1509 class2type[ toString.call( obj ) ] || "object" : 1510 typeof obj; 1511} 1512 1513function clamp( value, prop, allowEmpty ) { 1514 var type = propTypes[ prop.type ] || {}; 1515 1516 if ( value == null ) { 1517 return ( allowEmpty || !prop.def ) ? null : prop.def; 1518 } 1519 1520 // ~~ is an short way of doing floor for positive numbers 1521 value = type.floor ? ~~value : parseFloat( value ); 1522 1523 // IE will pass in empty strings as value for alpha, 1524 // which will hit this case 1525 if ( isNaN( value ) ) { 1526 return prop.def; 1527 } 1528 1529 if ( type.mod ) { 1530 1531 // we add mod before modding to make sure that negatives values 1532 // get converted properly: -10 -> 350 1533 return ( value + type.mod ) % type.mod; 1534 } 1535 1536 // for now all property types without mod have min and max 1537 return Math.min( type.max, Math.max( 0, value ) ); 1538} 1539 1540function stringParse( string ) { 1541 var inst = color(), 1542 rgba = inst._rgba = []; 1543 1544 string = string.toLowerCase(); 1545 1546 each( stringParsers, function( _i, parser ) { 1547 var parsed, 1548 match = parser.re.exec( string ), 1549 values = match && parser.parse( match ), 1550 spaceName = parser.space || "rgba"; 1551 1552 if ( values ) { 1553 parsed = inst[ spaceName ]( values ); 1554 1555 // if this was an rgba parse the assignment might happen twice 1556 // oh well.... 1557 inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 1558 rgba = inst._rgba = parsed._rgba; 1559 1560 // exit each( stringParsers ) here because we matched 1561 return false; 1562 } 1563 } ); 1564 1565 // Found a stringParser that handled it 1566 if ( rgba.length ) { 1567 1568 // if this came from a parsed string, force "transparent" when alpha is 0 1569 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 1570 if ( rgba.join() === "0,0,0,0" ) { 1571 jQuery.extend( rgba, colors.transparent ); 1572 } 1573 return inst; 1574 } 1575 1576 // named colors 1577 return colors[ string ]; 1578} 1579 1580color.fn = jQuery.extend( color.prototype, { 1581 parse: function( red, green, blue, alpha ) { 1582 if ( red === undefined ) { 1583 this._rgba = [ null, null, null, null ]; 1584 return this; 1585 } 1586 if ( red.jquery || red.nodeType ) { 1587 red = jQuery( red ).css( green ); 1588 green = undefined; 1589 } 1590 1591 var inst = this, 1592 type = getType( red ), 1593 rgba = this._rgba = []; 1594 1595 // more than 1 argument specified - assume ( red, green, blue, alpha ) 1596 if ( green !== undefined ) { 1597 red = [ red, green, blue, alpha ]; 1598 type = "array"; 1599 } 1600 1601 if ( type === "string" ) { 1602 return this.parse( stringParse( red ) || colors._default ); 1603 } 1604 1605 if ( type === "array" ) { 1606 each( spaces.rgba.props, function( _key, prop ) { 1607 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 1608 } ); 1609 return this; 1610 } 1611 1612 if ( type === "object" ) { 1613 if ( red instanceof color ) { 1614 each( spaces, function( _spaceName, space ) { 1615 if ( red[ space.cache ] ) { 1616 inst[ space.cache ] = red[ space.cache ].slice(); 1617 } 1618 } ); 1619 } else { 1620 each( spaces, function( _spaceName, space ) { 1621 var cache = space.cache; 1622 each( space.props, function( key, prop ) { 1623 1624 // if the cache doesn't exist, and we know how to convert 1625 if ( !inst[ cache ] && space.to ) { 1626 1627 // if the value was null, we don't need to copy it 1628 // if the key was alpha, we don't need to copy it either 1629 if ( key === "alpha" || red[ key ] == null ) { 1630 return; 1631 } 1632 inst[ cache ] = space.to( inst._rgba ); 1633 } 1634 1635 // this is the only case where we allow nulls for ALL properties. 1636 // call clamp with alwaysAllowEmpty 1637 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 1638 } ); 1639 1640 // everything defined but alpha? 1641 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 1642 1643 // use the default of 1 1644 if ( inst[ cache ][ 3 ] == null ) { 1645 inst[ cache ][ 3 ] = 1; 1646 } 1647 1648 if ( space.from ) { 1649 inst._rgba = space.from( inst[ cache ] ); 1650 } 1651 } 1652 } ); 1653 } 1654 return this; 1655 } 1656 }, 1657 is: function( compare ) { 1658 var is = color( compare ), 1659 same = true, 1660 inst = this; 1661 1662 each( spaces, function( _, space ) { 1663 var localCache, 1664 isCache = is[ space.cache ]; 1665 if ( isCache ) { 1666 localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 1667 each( space.props, function( _, prop ) { 1668 if ( isCache[ prop.idx ] != null ) { 1669 same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 1670 return same; 1671 } 1672 } ); 1673 } 1674 return same; 1675 } ); 1676 return same; 1677 }, 1678 _space: function() { 1679 var used = [], 1680 inst = this; 1681 each( spaces, function( spaceName, space ) { 1682 if ( inst[ space.cache ] ) { 1683 used.push( spaceName ); 1684 } 1685 } ); 1686 return used.pop(); 1687 }, 1688 transition: function( other, distance ) { 1689 var end = color( other ), 1690 spaceName = end._space(), 1691 space = spaces[ spaceName ], 1692 startColor = this.alpha() === 0 ? color( "transparent" ) : this, 1693 start = startColor[ space.cache ] || space.to( startColor._rgba ), 1694 result = start.slice(); 1695 1696 end = end[ space.cache ]; 1697 each( space.props, function( _key, prop ) { 1698 var index = prop.idx, 1699 startValue = start[ index ], 1700 endValue = end[ index ], 1701 type = propTypes[ prop.type ] || {}; 1702 1703 // if null, don't override start value 1704 if ( endValue === null ) { 1705 return; 1706 } 1707 1708 // if null - use end 1709 if ( startValue === null ) { 1710 result[ index ] = endValue; 1711 } else { 1712 if ( type.mod ) { 1713 if ( endValue - startValue > type.mod / 2 ) { 1714 startValue += type.mod; 1715 } else if ( startValue - endValue > type.mod / 2 ) { 1716 startValue -= type.mod; 1717 } 1718 } 1719 result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 1720 } 1721 } ); 1722 return this[ spaceName ]( result ); 1723 }, 1724 blend: function( opaque ) { 1725 1726 // if we are already opaque - return ourself 1727 if ( this._rgba[ 3 ] === 1 ) { 1728 return this; 1729 } 1730 1731 var rgb = this._rgba.slice(), 1732 a = rgb.pop(), 1733 blend = color( opaque )._rgba; 1734 1735 return color( jQuery.map( rgb, function( v, i ) { 1736 return ( 1 - a ) * blend[ i ] + a * v; 1737 } ) ); 1738 }, 1739 toRgbaString: function() { 1740 var prefix = "rgba(", 1741 rgba = jQuery.map( this._rgba, function( v, i ) { 1742 if ( v != null ) { 1743 return v; 1744 } 1745 return i > 2 ? 1 : 0; 1746 } ); 1747 1748 if ( rgba[ 3 ] === 1 ) { 1749 rgba.pop(); 1750 prefix = "rgb("; 1751 } 1752 1753 return prefix + rgba.join() + ")"; 1754 }, 1755 toHslaString: function() { 1756 var prefix = "hsla(", 1757 hsla = jQuery.map( this.hsla(), function( v, i ) { 1758 if ( v == null ) { 1759 v = i > 2 ? 1 : 0; 1760 } 1761 1762 // catch 1 and 2 1763 if ( i && i < 3 ) { 1764 v = Math.round( v * 100 ) + "%"; 1765 } 1766 return v; 1767 } ); 1768 1769 if ( hsla[ 3 ] === 1 ) { 1770 hsla.pop(); 1771 prefix = "hsl("; 1772 } 1773 return prefix + hsla.join() + ")"; 1774 }, 1775 toHexString: function( includeAlpha ) { 1776 var rgba = this._rgba.slice(), 1777 alpha = rgba.pop(); 1778 1779 if ( includeAlpha ) { 1780 rgba.push( ~~( alpha * 255 ) ); 1781 } 1782 1783 return "#" + jQuery.map( rgba, function( v ) { 1784 1785 // default to 0 when nulls exist 1786 v = ( v || 0 ).toString( 16 ); 1787 return v.length === 1 ? "0" + v : v; 1788 } ).join( "" ); 1789 }, 1790 toString: function() { 1791 return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 1792 } 1793} ); 1794color.fn.parse.prototype = color.fn; 1795 1796// hsla conversions adapted from: 1797// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 1798 1799function hue2rgb( p, q, h ) { 1800 h = ( h + 1 ) % 1; 1801 if ( h * 6 < 1 ) { 1802 return p + ( q - p ) * h * 6; 1803 } 1804 if ( h * 2 < 1 ) { 1805 return q; 1806 } 1807 if ( h * 3 < 2 ) { 1808 return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; 1809 } 1810 return p; 1811} 1812 1813spaces.hsla.to = function( rgba ) { 1814 if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 1815 return [ null, null, null, rgba[ 3 ] ]; 1816 } 1817 var r = rgba[ 0 ] / 255, 1818 g = rgba[ 1 ] / 255, 1819 b = rgba[ 2 ] / 255, 1820 a = rgba[ 3 ], 1821 max = Math.max( r, g, b ), 1822 min = Math.min( r, g, b ), 1823 diff = max - min, 1824 add = max + min, 1825 l = add * 0.5, 1826 h, s; 1827 1828 if ( min === max ) { 1829 h = 0; 1830 } else if ( r === max ) { 1831 h = ( 60 * ( g - b ) / diff ) + 360; 1832 } else if ( g === max ) { 1833 h = ( 60 * ( b - r ) / diff ) + 120; 1834 } else { 1835 h = ( 60 * ( r - g ) / diff ) + 240; 1836 } 1837 1838 // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% 1839 // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) 1840 if ( diff === 0 ) { 1841 s = 0; 1842 } else if ( l <= 0.5 ) { 1843 s = diff / add; 1844 } else { 1845 s = diff / ( 2 - add ); 1846 } 1847 return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ]; 1848}; 1849 1850spaces.hsla.from = function( hsla ) { 1851 if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 1852 return [ null, null, null, hsla[ 3 ] ]; 1853 } 1854 var h = hsla[ 0 ] / 360, 1855 s = hsla[ 1 ], 1856 l = hsla[ 2 ], 1857 a = hsla[ 3 ], 1858 q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 1859 p = 2 * l - q; 1860 1861 return [ 1862 Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 1863 Math.round( hue2rgb( p, q, h ) * 255 ), 1864 Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 1865 a 1866 ]; 1867}; 1868 1869 1870each( spaces, function( spaceName, space ) { 1871 var props = space.props, 1872 cache = space.cache, 1873 to = space.to, 1874 from = space.from; 1875 1876 // makes rgba() and hsla() 1877 color.fn[ spaceName ] = function( value ) { 1878 1879 // generate a cache for this space if it doesn't exist 1880 if ( to && !this[ cache ] ) { 1881 this[ cache ] = to( this._rgba ); 1882 } 1883 if ( value === undefined ) { 1884 return this[ cache ].slice(); 1885 } 1886 1887 var ret, 1888 type = getType( value ), 1889 arr = ( type === "array" || type === "object" ) ? value : arguments, 1890 local = this[ cache ].slice(); 1891 1892 each( props, function( key, prop ) { 1893 var val = arr[ type === "object" ? key : prop.idx ]; 1894 if ( val == null ) { 1895 val = local[ prop.idx ]; 1896 } 1897 local[ prop.idx ] = clamp( val, prop ); 1898 } ); 1899 1900 if ( from ) { 1901 ret = color( from( local ) ); 1902 ret[ cache ] = local; 1903 return ret; 1904 } else { 1905 return color( local ); 1906 } 1907 }; 1908 1909 // makes red() green() blue() alpha() hue() saturation() lightness() 1910 each( props, function( key, prop ) { 1911 1912 // alpha is included in more than one space 1913 if ( color.fn[ key ] ) { 1914 return; 1915 } 1916 color.fn[ key ] = function( value ) { 1917 var local, cur, match, fn, 1918 vtype = getType( value ); 1919 1920 if ( key === "alpha" ) { 1921 fn = this._hsla ? "hsla" : "rgba"; 1922 } else { 1923 fn = spaceName; 1924 } 1925 local = this[ fn ](); 1926 cur = local[ prop.idx ]; 1927 1928 if ( vtype === "undefined" ) { 1929 return cur; 1930 } 1931 1932 if ( vtype === "function" ) { 1933 value = value.call( this, cur ); 1934 vtype = getType( value ); 1935 } 1936 if ( value == null && prop.empty ) { 1937 return this; 1938 } 1939 if ( vtype === "string" ) { 1940 match = rplusequals.exec( value ); 1941 if ( match ) { 1942 value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 1943 } 1944 } 1945 local[ prop.idx ] = value; 1946 return this[ fn ]( local ); 1947 }; 1948 } ); 1949} ); 1950 1951// add cssHook and .fx.step function for each named hook. 1952// accept a space separated string of properties 1953color.hook = function( hook ) { 1954 var hooks = hook.split( " " ); 1955 each( hooks, function( _i, hook ) { 1956 jQuery.cssHooks[ hook ] = { 1957 set: function( elem, value ) { 1958 var parsed, curElem, 1959 backgroundColor = ""; 1960 1961 if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { 1962 value = color( parsed || value ); 1963 if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 1964 curElem = hook === "backgroundColor" ? elem.parentNode : elem; 1965 while ( 1966 ( backgroundColor === "" || backgroundColor === "transparent" ) && 1967 curElem && curElem.style 1968 ) { 1969 try { 1970 backgroundColor = jQuery.css( curElem, "backgroundColor" ); 1971 curElem = curElem.parentNode; 1972 } catch ( e ) { 1973 } 1974 } 1975 1976 value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 1977 backgroundColor : 1978 "_default" ); 1979 } 1980 1981 value = value.toRgbaString(); 1982 } 1983 try { 1984 elem.style[ hook ] = value; 1985 } catch ( e ) { 1986 1987 // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 1988 } 1989 } 1990 }; 1991 jQuery.fx.step[ hook ] = function( fx ) { 1992 if ( !fx.colorInit ) { 1993 fx.start = color( fx.elem, hook ); 1994 fx.end = color( fx.end ); 1995 fx.colorInit = true; 1996 } 1997 jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 1998 }; 1999 } ); 2000 2001}; 2002 2003color.hook( stepHooks ); 2004 2005jQuery.cssHooks.borderColor = { 2006 expand: function( value ) { 2007 var expanded = {}; 2008 2009 each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { 2010 expanded[ "border" + part + "Color" ] = value; 2011 } ); 2012 return expanded; 2013 } 2014}; 2015 2016// Basic color names only. 2017// Usage of any of the other color names requires adding yourself or including 2018// jquery.color.svg-names.js. 2019colors = jQuery.Color.names = { 2020 2021 // 4.1. Basic color keywords 2022 aqua: "#00ffff", 2023 black: "#000000", 2024 blue: "#0000ff", 2025 fuchsia: "#ff00ff", 2026 gray: "#808080", 2027 green: "#008000", 2028 lime: "#00ff00", 2029 maroon: "#800000", 2030 navy: "#000080", 2031 olive: "#808000", 2032 purple: "#800080", 2033 red: "#ff0000", 2034 silver: "#c0c0c0", 2035 teal: "#008080", 2036 white: "#ffffff", 2037 yellow: "#ffff00", 2038 2039 // 4.2.3. "transparent" color keyword 2040 transparent: [ null, null, null, 0 ], 2041 2042 _default: "#ffffff" 2043}; 2044 2045 2046/*! 2047 * jQuery UI Effects 1.13.
20472 2048 * http://jqueryui.com 2049 * 2050 * Copyright jQuery Foundation and other contributors 2051 * Released under the MIT license. 2052 * http://jquery.org/license 2053 */ 2054 2055//>>label: Effects Core 2056//>>group: Effects 2057/* eslint-disable max-len */ 2058//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. 2059/* eslint-enable max-len */ 2060//>>docs: http://api.jqueryui.com/category/effects-core/ 2061//>>demos: http
vendor: 9,484 bytes, lines 2061-2431
2061://jqueryui.com/effect/ 2062 2063 2064var dataSpace = "ui-effects-", 2065 dataSpaceStyle = "ui-effects-style", 2066 dataSpaceAnimated = "ui-effects-animated"; 2067 2068$.effects = { 2069 effect: {} 2070}; 2071 2072/******************************************************************************/ 2073/****************************** CLASS ANIMATIONS ******************************/ 2074/******************************************************************************/ 2075( function() { 2076 2077var classAnimationActions = [ "add", "remove", "toggle" ], 2078 shorthandStyles = { 2079 border: 1, 2080 borderBottom: 1, 2081 borderColor: 1, 2082 borderLeft: 1, 2083 borderRight: 1, 2084 borderTop: 1, 2085 borderWidth: 1, 2086 margin: 1, 2087 padding: 1 2088 }; 2089 2090$.each( 2091 [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], 2092 function( _, prop ) { 2093 $.fx.step[ prop ] = function( fx ) { 2094 if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { 2095 jQuery.style( fx.elem, prop, fx.end ); 2096 fx.setAttr = true; 2097 } 2098 }; 2099 } 2100); 2101 2102function camelCase( string ) { 2103 return string.replace( /-([\da-z])/gi, function( all, letter ) { 2104 return letter.toUpperCase(); 2105 } ); 2106} 2107 2108function getElementStyles( elem ) { 2109 var key, len, 2110 style = elem.ownerDocument.defaultView ? 2111 elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : 2112 elem.currentStyle, 2113 styles = {}; 2114 2115 if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { 2116 len = style.length; 2117 while ( len-- ) { 2118 key = style[ len ]; 2119 if ( typeof style[ key ] === "string" ) { 2120 styles[ camelCase( key ) ] = style[ key ]; 2121 } 2122 } 2123 2124 // Support: Opera, IE <9 2125 } else { 2126 for ( key in style ) { 2127 if ( typeof style[ key ] === "string" ) { 2128 styles[ key ] = style[ key ]; 2129 } 2130 } 2131 } 2132 2133 return styles; 2134} 2135 2136function styleDifference( oldStyle, newStyle ) { 2137 var diff = {}, 2138 name, value; 2139 2140 for ( name in newStyle ) { 2141 value = newStyle[ name ]; 2142 if ( oldStyle[ name ] !== value ) { 2143 if ( !shorthandStyles[ name ] ) { 2144 if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { 2145 diff[ name ] = value; 2146 } 2147 } 2148 } 2149 } 2150 2151 return diff; 2152} 2153 2154// Support: jQuery <1.8 2155if ( !$.fn.addBack ) { 2156 $.fn.addBack = function( selector ) { 2157 return this.add( selector == null ? 2158 this.prevObject : this.prevObject.filter( selector ) 2159 ); 2160 }; 2161} 2162 2163$.effects.animateClass = function( value, duration, easing, callback ) { 2164 var o = $.speed( duration, easing, callback ); 2165 2166 return this.queue( function() { 2167 var animated = $( this ), 2168 baseClass = animated.attr( "class" ) || "", 2169 applyClassChange, 2170 allAnimations = o.children ? animated.find( "*" ).addBack() : animated; 2171 2172 // Map the animated objects to store the original styles. 2173 allAnimations = allAnimations.map( function() { 2174 var el = $( this ); 2175 return { 2176 el: el, 2177 start: getElementStyles( this ) 2178 }; 2179 } ); 2180 2181 // Apply class change 2182 applyClassChange = function() { 2183 $.each( classAnimationActions, function( i, action ) { 2184 if ( value[ action ] ) { 2185 animated[ action + "Class" ]( value[ action ] ); 2186 } 2187 } ); 2188 }; 2189 applyClassChange(); 2190 2191 // Map all animated objects again - calculate new styles and diff 2192 allAnimations = allAnimations.map( function() { 2193 this.end = getElementStyles( this.el[ 0 ] ); 2194 this.diff = styleDifference( this.start, this.end ); 2195 return this; 2196 } ); 2197 2198 // Apply original class 2199 animated.attr( "class", baseClass ); 2200 2201 // Map all animated objects again - this time collecting a promise 2202 allAnimations = allAnimations.map( function() { 2203 var styleInfo = this, 2204 dfd = $.Deferred(), 2205 opts = $.extend( {}, o, { 2206 queue: false, 2207 complete: function() { 2208 dfd.resolve( styleInfo ); 2209 } 2210 } ); 2211 2212 this.el.animate( this.diff, opts ); 2213 return dfd.promise(); 2214 } ); 2215 2216 // Once all animations have completed: 2217 $.when.apply( $, allAnimations.get() ).done( function() { 2218 2219 // Set the final class 2220 applyClassChange(); 2221 2222 // For each animated element, 2223 // clear all css properties that were animated 2224 $.each( arguments, function() { 2225 var el = this.el; 2226 $.each( this.diff, function( key ) { 2227 el.css( key, "" ); 2228 } ); 2229 } ); 2230 2231 // This is guarnteed to be there if you use jQuery.speed() 2232 // it also handles dequeuing the next anim... 2233 o.complete.call( animated[ 0 ] ); 2234 } ); 2235 } ); 2236}; 2237 2238$.fn.extend( { 2239 addClass: ( function( orig ) { 2240 return function( classNames, speed, easing, callback ) { 2241 return speed ? 2242 $.effects.animateClass.call( this, 2243 { add: classNames }, speed, easing, callback ) : 2244 orig.apply( this, arguments ); 2245 }; 2246 } )( $.fn.addClass ), 2247 2248 removeClass: ( function( orig ) { 2249 return function( classNames, speed, easing, callback ) { 2250 return arguments.length > 1 ? 2251 $.effects.animateClass.call( this, 2252 { remove: classNames }, speed, easing, callback ) : 2253 orig.apply( this, arguments ); 2254 }; 2255 } )( $.fn.removeClass ), 2256 2257 toggleClass: ( function( orig ) { 2258 return function( classNames, force, speed, easing, callback ) { 2259 if ( typeof force === "boolean" || force === undefined ) { 2260 if ( !speed ) { 2261 2262 // Without speed parameter 2263 return orig.apply( this, arguments ); 2264 } else { 2265 return $.effects.animateClass.call( this, 2266 ( force ? { add: classNames } : { remove: classNames } ), 2267 speed, easing, callback ); 2268 } 2269 } else { 2270 2271 // Without force parameter 2272 return $.effects.animateClass.call( this, 2273 { toggle: classNames }, force, speed, easing ); 2274 } 2275 }; 2276 } )( $.fn.toggleClass ), 2277 2278 switchClass: function( remove, add, speed, easing, callback ) { 2279 return $.effects.animateClass.call( this, { 2280 add: add, 2281 remove: remove 2282 }, speed, easing, callback ); 2283 } 2284} ); 2285 2286} )(); 2287 2288/******************************************************************************/ 2289/*********************************** EFFECTS **********************************/ 2290/******************************************************************************/ 2291 2292( function() { 2293 2294if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { 2295 $.expr.pseudos.animated = ( function( orig ) { 2296 return function( elem ) { 2297 return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); 2298 }; 2299 } )( $.expr.pseudos.animated ); 2300} 2301 2302if ( $.uiBackCompat !== false ) { 2303 $.extend( $.effects, { 2304 2305 // Saves a set of properties in a data storage 2306 save: function( element, set ) { 2307 var i = 0, length = set.length; 2308 for ( ; i < length; i++ ) { 2309 if ( set[ i ] !== null ) { 2310 element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); 2311 } 2312 } 2313 }, 2314 2315 // Restores a set of previously saved properties from a data storage 2316 restore: function( element, set ) { 2317 var val, i = 0, length = set.length; 2318 for ( ; i < length; i++ ) { 2319 if ( set[ i ] !== null ) { 2320 val = element.data( dataSpace + set[ i ] ); 2321 element.css( set[ i ], val ); 2322 } 2323 } 2324 }, 2325 2326 setMode: function( el, mode ) { 2327 if ( mode === "toggle" ) { 2328 mode = el.is( ":hidden" ) ? "show" : "hide"; 2329 } 2330 return mode; 2331 }, 2332 2333 // Wraps the element around a wrapper that copies position properties 2334 createWrapper: function( element ) { 2335 2336 // If the element is already wrapped, return it 2337 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2338 return element.parent(); 2339 } 2340 2341 // Wrap the element 2342 var props = { 2343 width: element.outerWidth( true ), 2344 height: element.outerHeight( true ), 2345 "float": element.css( "float" ) 2346 }, 2347 wrapper = $( "<div></div>" ) 2348 .addClass( "ui-effects-wrapper" ) 2349 .css( { 2350 fontSize: "100%", 2351 background: "transparent", 2352 border: "none", 2353 margin: 0, 2354 padding: 0 2355 } ), 2356 2357 // Store the size in case width/height are defined in % - Fixes #5245 2358 size = { 2359 width: element.width(), 2360 height: element.height() 2361 }, 2362 active = document.activeElement; 2363 2364 // Support: Firefox 2365 // Firefox incorrectly exposes anonymous content 2366 // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 2367 try { 2368 // eslint-disable-next-line no-unused-expressions 2369 active.id; 2370 } catch ( e ) { 2371 active = document.body; 2372 } 2373 2374 element.wrap( wrapper ); 2375 2376 // Fixes #7595 - Elements lose focus when wrapped. 2377 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2378 $( active ).trigger( "focus" ); 2379 } 2380 2381 // Hotfix for jQuery 1.4 since some change in wrap() seems to actually 2382 // lose the reference to the wrapped element 2383 wrapper = element.parent(); 2384 2385 // Transfer positioning properties to the wrapper 2386 if ( element.css( "position" ) === "static" ) { 2387 wrapper.css( { position: "relative" } ); 2388 element.css( { position: "relative" } ); 2389 } else { 2390 $.extend( props, { 2391 position: element.css( "position" ), 2392 zIndex: element.css( "z-index" ) 2393 } ); 2394 $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) { 2395 props[ pos ] = element.css( pos ); 2396 if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { 2397 props[ pos ] = "auto"; 2398 } 2399 } ); 2400 element.css( { 2401 position: "relative", 2402 top: 0, 2403 left: 0, 2404 right: "auto", 2405 bottom: "auto" 2406 } ); 2407 } 2408 element.css( size ); 2409 2410 return wrapper.css( props ).show(); 2411 }, 2412 2413 removeWrapper: function( element ) { 2414 var active = document.activeElement; 2415 2416 if ( element.parent().is( ".ui-effects-wrapper" ) ) { 2417 element.parent().replaceWith( element ); 2418 2419 // Fixes #7595 - Elements lose focus when wrapped. 2420 if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { 2421 $( active ).trigger( "focus" ); 2422 } 2423 } 2424 2425 return element; 2426 } 2427 } ); 2428} 2429 2430$.extend( $.effects, { 2431 version: "1.13.
vendor: 2,055 bytes, lines 2431-2526
24312", 2432 2433 define: function( name, mode, effect ) { 2434 if ( !effect ) { 2435 effect = mode; 2436 mode = "effect"; 2437 } 2438 2439 $.effects.effect[ name ] = effect; 2440 $.effects.effect[ name ].mode = mode; 2441 2442 return effect; 2443 }, 2444 2445 scaledDimensions: function( element, percent, direction ) { 2446 if ( percent === 0 ) { 2447 return { 2448 height: 0, 2449 width: 0, 2450 outerHeight: 0, 2451 outerWidth: 0 2452 }; 2453 } 2454 2455 var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1, 2456 y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1; 2457 2458 return { 2459 height: element.height() * y, 2460 width: element.width() * x, 2461 outerHeight: element.outerHeight() * y, 2462 outerWidth: element.outerWidth() * x 2463 }; 2464 2465 }, 2466 2467 clipToBox: function( animation ) { 2468 return { 2469 width: animation.clip.right - animation.clip.left, 2470 height: animation.clip.bottom - animation.clip.top, 2471 left: animation.clip.left, 2472 top: animation.clip.top 2473 }; 2474 }, 2475 2476 // Injects recently queued functions to be first in line (after "inprogress") 2477 unshift: function( element, queueLength, count ) { 2478 var queue = element.queue(); 2479 2480 if ( queueLength > 1 ) { 2481 queue.splice.apply( queue, 2482 [ 1, 0 ].concat( queue.splice( queueLength, count ) ) ); 2483 } 2484 element.dequeue(); 2485 }, 2486 2487 saveStyle: function( element ) { 2488 element.data( dataSpaceStyle, element[ 0 ].style.cssText ); 2489 }, 2490 2491 restoreStyle: function( element ) { 2492 element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || ""; 2493 element.removeData( dataSpaceStyle ); 2494 }, 2495 2496 mode: function( element, mode ) { 2497 var hidden = element.is( ":hidden" ); 2498 2499 if ( mode === "toggle" ) { 2500 mode = hidden ? "show" : "hide"; 2501 } 2502 if ( hidden ? mode === "hide" : mode === "show" ) { 2503 mode = "none"; 2504 } 2505 return mode; 2506 }, 2507 2508 // Translates a [top,left] array into a baseline value 2509 getBaseline: function( origin, original ) { 2510 var y, x; 2511 2512 switch ( origin[ 0 ] ) { 2513 case "top": 2514 y = 0; 2515 break; 2516 case "middle": 2517 y = 0.5; 2518 break; 2519 case "bottom": 2520 y = 1; 2521 break; 2522 default: 2523 y = origin[ 0 ] / original.height; 2524 } 2525 2526 switch ( origin[ 1 ] ) {
2527 case "left": 2528 x = 0; 2529 break; 2530 case "center": 2531 x = 0.5; 2532 break; 2533 case "right": 2534 x = 1; 2535 break; 2536 default: 2537 x = origin[ 1 ] / original.width; 2538 } 2539 2540 return { 2541 x: x, 2542 y: y 2543 }; 2544 }, 2545 2546 // Creates a placeholder element so that the original element can be made absolute 2547 createPlaceholder: function( element ) { 2548 var placeholder, 2549 cssPosition = element.css( "position" ), 2550 position = element.position(); 2551 2552 // Lock in margins first to account for form elements, which 2553 // will change margin if you explicitly set height 2554 // see: http
vendor: 10,558 bytes, lines 2554-2948
2554://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380 2555 // Support: Safari 2556 element.css( { 2557 marginTop: element.css( "marginTop" ), 2558 marginBottom: element.css( "marginBottom" ), 2559 marginLeft: element.css( "marginLeft" ), 2560 marginRight: element.css( "marginRight" ) 2561 } ) 2562 .outerWidth( element.outerWidth() ) 2563 .outerHeight( element.outerHeight() ); 2564 2565 if ( /^(static|relative)/.test( cssPosition ) ) { 2566 cssPosition = "absolute"; 2567 2568 placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( { 2569 2570 // Convert inline to inline block to account for inline elements 2571 // that turn to inline block based on content (like img) 2572 display: /^(inline|ruby)/.test( element.css( "display" ) ) ? 2573 "inline-block" : 2574 "block", 2575 visibility: "hidden", 2576 2577 // Margins need to be set to account for margin collapse 2578 marginTop: element.css( "marginTop" ), 2579 marginBottom: element.css( "marginBottom" ), 2580 marginLeft: element.css( "marginLeft" ), 2581 marginRight: element.css( "marginRight" ), 2582 "float": element.css( "float" ) 2583 } ) 2584 .outerWidth( element.outerWidth() ) 2585 .outerHeight( element.outerHeight() ) 2586 .addClass( "ui-effects-placeholder" ); 2587 2588 element.data( dataSpace + "placeholder", placeholder ); 2589 } 2590 2591 element.css( { 2592 position: cssPosition, 2593 left: position.left, 2594 top: position.top 2595 } ); 2596 2597 return placeholder; 2598 }, 2599 2600 removePlaceholder: function( element ) { 2601 var dataKey = dataSpace + "placeholder", 2602 placeholder = element.data( dataKey ); 2603 2604 if ( placeholder ) { 2605 placeholder.remove(); 2606 element.removeData( dataKey ); 2607 } 2608 }, 2609 2610 // Removes a placeholder if it exists and restores 2611 // properties that were modified during placeholder creation 2612 cleanUp: function( element ) { 2613 $.effects.restoreStyle( element ); 2614 $.effects.removePlaceholder( element ); 2615 }, 2616 2617 setTransition: function( element, list, factor, value ) { 2618 value = value || {}; 2619 $.each( list, function( i, x ) { 2620 var unit = element.cssUnit( x ); 2621 if ( unit[ 0 ] > 0 ) { 2622 value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; 2623 } 2624 } ); 2625 return value; 2626 } 2627} ); 2628 2629// Return an effect options object for the given parameters: 2630function _normalizeArguments( effect, options, speed, callback ) { 2631 2632 // Allow passing all options as the first parameter 2633 if ( $.isPlainObject( effect ) ) { 2634 options = effect; 2635 effect = effect.effect; 2636 } 2637 2638 // Convert to an object 2639 effect = { effect: effect }; 2640 2641 // Catch (effect, null, ...) 2642 if ( options == null ) { 2643 options = {}; 2644 } 2645 2646 // Catch (effect, callback) 2647 if ( typeof options === "function" ) { 2648 callback = options; 2649 speed = null; 2650 options = {}; 2651 } 2652 2653 // Catch (effect, speed, ?) 2654 if ( typeof options === "number" || $.fx.speeds[ options ] ) { 2655 callback = speed; 2656 speed = options; 2657 options = {}; 2658 } 2659 2660 // Catch (effect, options, callback) 2661 if ( typeof speed === "function" ) { 2662 callback = speed; 2663 speed = null; 2664 } 2665 2666 // Add options to effect 2667 if ( options ) { 2668 $.extend( effect, options ); 2669 } 2670 2671 speed = speed || options.duration; 2672 effect.duration = $.fx.off ? 0 : 2673 typeof speed === "number" ? speed : 2674 speed in $.fx.speeds ? $.fx.speeds[ speed ] : 2675 $.fx.speeds._default; 2676 2677 effect.complete = callback || options.complete; 2678 2679 return effect; 2680} 2681 2682function standardAnimationOption( option ) { 2683 2684 // Valid standard speeds (nothing, number, named speed) 2685 if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { 2686 return true; 2687 } 2688 2689 // Invalid strings - treat as "normal" speed 2690 if ( typeof option === "string" && !$.effects.effect[ option ] ) { 2691 return true; 2692 } 2693 2694 // Complete callback 2695 if ( typeof option === "function" ) { 2696 return true; 2697 } 2698 2699 // Options hash (but not naming an effect) 2700 if ( typeof option === "object" && !option.effect ) { 2701 return true; 2702 } 2703 2704 // Didn't match any standard API 2705 return false; 2706} 2707 2708$.fn.extend( { 2709 effect: function( /* effect, options, speed, callback */ ) { 2710 var args = _normalizeArguments.apply( this, arguments ), 2711 effectMethod = $.effects.effect[ args.effect ], 2712 defaultMode = effectMethod.mode, 2713 queue = args.queue, 2714 queueName = queue || "fx", 2715 complete = args.complete, 2716 mode = args.mode, 2717 modes = [], 2718 prefilter = function( next ) { 2719 var el = $( this ), 2720 normalizedMode = $.effects.mode( el, mode ) || defaultMode; 2721 2722 // Sentinel for duck-punching the :animated pseudo-selector 2723 el.data( dataSpaceAnimated, true ); 2724 2725 // Save effect mode for later use, 2726 // we can't just call $.effects.mode again later, 2727 // as the .show() below destroys the initial state 2728 modes.push( normalizedMode ); 2729 2730 // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 2731 if ( defaultMode && ( normalizedMode === "show" || 2732 ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { 2733 el.show(); 2734 } 2735 2736 if ( !defaultMode || normalizedMode !== "none" ) { 2737 $.effects.saveStyle( el ); 2738 } 2739 2740 if ( typeof next === "function" ) { 2741 next(); 2742 } 2743 }; 2744 2745 if ( $.fx.off || !effectMethod ) { 2746 2747 // Delegate to the original method (e.g., .show()) if possible 2748 if ( mode ) { 2749 return this[ mode ]( args.duration, complete ); 2750 } else { 2751 return this.each( function() { 2752 if ( complete ) { 2753 complete.call( this ); 2754 } 2755 } ); 2756 } 2757 } 2758 2759 function run( next ) { 2760 var elem = $( this ); 2761 2762 function cleanup() { 2763 elem.removeData( dataSpaceAnimated ); 2764 2765 $.effects.cleanUp( elem ); 2766 2767 if ( args.mode === "hide" ) { 2768 elem.hide(); 2769 } 2770 2771 done(); 2772 } 2773 2774 function done() { 2775 if ( typeof complete === "function" ) { 2776 complete.call( elem[ 0 ] ); 2777 } 2778 2779 if ( typeof next === "function" ) { 2780 next(); 2781 } 2782 } 2783 2784 // Override mode option on a per element basis, 2785 // as toggle can be either show or hide depending on element state 2786 args.mode = modes.shift(); 2787 2788 if ( $.uiBackCompat !== false && !defaultMode ) { 2789 if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { 2790 2791 // Call the core method to track "olddisplay" properly 2792 elem[ mode ](); 2793 done(); 2794 } else { 2795 effectMethod.call( elem[ 0 ], args, done ); 2796 } 2797 } else { 2798 if ( args.mode === "none" ) { 2799 2800 // Call the core method to track "olddisplay" properly 2801 elem[ mode ](); 2802 done(); 2803 } else { 2804 effectMethod.call( elem[ 0 ], args, cleanup ); 2805 } 2806 } 2807 } 2808 2809 // Run prefilter on all elements first to ensure that 2810 // any showing or hiding happens before placeholder creation, 2811 // which ensures that any layout changes are correctly captured. 2812 return queue === false ? 2813 this.each( prefilter ).each( run ) : 2814 this.queue( queueName, prefilter ).queue( queueName, run ); 2815 }, 2816 2817 show: ( function( orig ) { 2818 return function( option ) { 2819 if ( standardAnimationOption( option ) ) { 2820 return orig.apply( this, arguments ); 2821 } else { 2822 var args = _normalizeArguments.apply( this, arguments ); 2823 args.mode = "show"; 2824 return this.effect.call( this, args ); 2825 } 2826 }; 2827 } )( $.fn.show ), 2828 2829 hide: ( function( orig ) { 2830 return function( option ) { 2831 if ( standardAnimationOption( option ) ) { 2832 return orig.apply( this, arguments ); 2833 } else { 2834 var args = _normalizeArguments.apply( this, arguments ); 2835 args.mode = "hide"; 2836 return this.effect.call( this, args ); 2837 } 2838 }; 2839 } )( $.fn.hide ), 2840 2841 toggle: ( function( orig ) { 2842 return function( option ) { 2843 if ( standardAnimationOption( option ) || typeof option === "boolean" ) { 2844 return orig.apply( this, arguments ); 2845 } else { 2846 var args = _normalizeArguments.apply( this, arguments ); 2847 args.mode = "toggle"; 2848 return this.effect.call( this, args ); 2849 } 2850 }; 2851 } )( $.fn.toggle ), 2852 2853 cssUnit: function( key ) { 2854 var style = this.css( key ), 2855 val = []; 2856 2857 $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { 2858 if ( style.indexOf( unit ) > 0 ) { 2859 val = [ parseFloat( style ), unit ]; 2860 } 2861 } ); 2862 return val; 2863 }, 2864 2865 cssClip: function( clipObj ) { 2866 if ( clipObj ) { 2867 return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + 2868 clipObj.bottom + "px " + clipObj.left + "px)" ); 2869 } 2870 return parseClip( this.css( "clip" ), this ); 2871 }, 2872 2873 transfer: function( options, done ) { 2874 var element = $( this ), 2875 target = $( options.to ), 2876 targetFixed = target.css( "position" ) === "fixed", 2877 body = $( "body" ), 2878 fixTop = targetFixed ? body.scrollTop() : 0, 2879 fixLeft = targetFixed ? body.scrollLeft() : 0, 2880 endPosition = target.offset(), 2881 animation = { 2882 top: endPosition.top - fixTop, 2883 left: endPosition.left - fixLeft, 2884 height: target.innerHeight(), 2885 width: target.innerWidth() 2886 }, 2887 startPosition = element.offset(), 2888 transfer = $( "<div class='ui-effects-transfer'></div>" ); 2889 2890 transfer 2891 .appendTo( "body" ) 2892 .addClass( options.className ) 2893 .css( { 2894 top: startPosition.top - fixTop, 2895 left: startPosition.left - fixLeft, 2896 height: element.innerHeight(), 2897 width: element.innerWidth(), 2898 position: targetFixed ? "fixed" : "absolute" 2899 } ) 2900 .animate( animation, options.duration, options.easing, function() { 2901 transfer.remove(); 2902 if ( typeof done === "function" ) { 2903 done(); 2904 } 2905 } ); 2906 } 2907} ); 2908 2909function parseClip( str, element ) { 2910 var outerWidth = element.outerWidth(), 2911 outerHeight = element.outerHeight(), 2912 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)\)$/, 2913 values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; 2914 2915 return { 2916 top: parseFloat( values[ 1 ] ) || 0, 2917 right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), 2918 bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), 2919 left: parseFloat( values[ 4 ] ) || 0 2920 }; 2921} 2922 2923$.fx.step.clip = function( fx ) { 2924 if ( !fx.clipInit ) { 2925 fx.start = $( fx.elem ).cssClip(); 2926 if ( typeof fx.end === "string" ) { 2927 fx.end = parseClip( fx.end, fx.elem ); 2928 } 2929 fx.clipInit = true; 2930 } 2931 2932 $( fx.elem ).cssClip( { 2933 top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top, 2934 right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right, 2935 bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom, 2936 left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left 2937 } ); 2938}; 2939 2940} )(); 2941 2942/******************************************************************************/ 2943/*********************************** EASING ***********************************/ 2944/******************************************************************************/ 2945 2946( function() { 2947 2948// Based on easing equations from Robert Penner (http://
vendor: 24,998 bytes, lines 2948-3903
2948www.robertpenner.com/easing) 2949 2950var baseEasings = {}; 2951 2952$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { 2953 baseEasings[ name ] = function( p ) { 2954 return Math.pow( p, i + 2 ); 2955 }; 2956} ); 2957 2958$.extend( baseEasings, { 2959 Sine: function( p ) { 2960 return 1 - Math.cos( p * Math.PI / 2 ); 2961 }, 2962 Circ: function( p ) { 2963 return 1 - Math.sqrt( 1 - p * p ); 2964 }, 2965 Elastic: function( p ) { 2966 return p === 0 || p === 1 ? p : 2967 -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 ); 2968 }, 2969 Back: function( p ) { 2970 return p * p * ( 3 * p - 2 ); 2971 }, 2972 Bounce: function( p ) { 2973 var pow2, 2974 bounce = 4; 2975 2976 while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} 2977 return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); 2978 } 2979} ); 2980 2981$.each( baseEasings, function( name, easeIn ) { 2982 $.easing[ "easeIn" + name ] = easeIn; 2983 $.easing[ "easeOut" + name ] = function( p ) { 2984 return 1 - easeIn( 1 - p ); 2985 }; 2986 $.easing[ "easeInOut" + name ] = function( p ) { 2987 return p < 0.5 ? 2988 easeIn( p * 2 ) / 2 : 2989 1 - easeIn( p * -2 + 2 ) / 2; 2990 }; 2991} ); 2992 2993} )(); 2994 2995var effect = $.effects; 2996 2997 2998/*! 2999 * jQuery UI Effects Blind 1.13.2 3000 * http://jqueryui.com 3001 * 3002 * Copyright jQuery Foundation and other contributors 3003 * Released under the MIT license. 3004 * http://jquery.org/license 3005 */ 3006 3007//>>label: Blind Effect 3008//>>group: Effects 3009//>>description: Blinds the element. 3010//>>docs: http://api.jqueryui.com/blind-effect/ 3011//>>demos: http://jqueryui.com/effect/ 3012 3013 3014var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) { 3015 var map = { 3016 up: [ "bottom", "top" ], 3017 vertical: [ "bottom", "top" ], 3018 down: [ "top", "bottom" ], 3019 left: [ "right", "left" ], 3020 horizontal: [ "right", "left" ], 3021 right: [ "left", "right" ] 3022 }, 3023 element = $( this ), 3024 direction = options.direction || "up", 3025 start = element.cssClip(), 3026 animate = { clip: $.extend( {}, start ) }, 3027 placeholder = $.effects.createPlaceholder( element ); 3028 3029 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; 3030 3031 if ( options.mode === "show" ) { 3032 element.cssClip( animate.clip ); 3033 if ( placeholder ) { 3034 placeholder.css( $.effects.clipToBox( animate ) ); 3035 } 3036 3037 animate.clip = start; 3038 } 3039 3040 if ( placeholder ) { 3041 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); 3042 } 3043 3044 element.animate( animate, { 3045 queue: false, 3046 duration: options.duration, 3047 easing: options.easing, 3048 complete: done 3049 } ); 3050} ); 3051 3052 3053/*! 3054 * jQuery UI Effects Bounce 1.13.2 3055 * http://jqueryui.com 3056 * 3057 * Copyright jQuery Foundation and other contributors 3058 * Released under the MIT license. 3059 * http://jquery.org/license 3060 */ 3061 3062//>>label: Bounce Effect 3063//>>group: Effects 3064//>>description: Bounces an element horizontally or vertically n times. 3065//>>docs: http://api.jqueryui.com/bounce-effect/ 3066//>>demos: http://jqueryui.com/effect/ 3067 3068 3069var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) { 3070 var upAnim, downAnim, refValue, 3071 element = $( this ), 3072 3073 // Defaults: 3074 mode = options.mode, 3075 hide = mode === "hide", 3076 show = mode === "show", 3077 direction = options.direction || "up", 3078 distance = options.distance, 3079 times = options.times || 5, 3080 3081 // Number of internal animations 3082 anims = times * 2 + ( show || hide ? 1 : 0 ), 3083 speed = options.duration / anims, 3084 easing = options.easing, 3085 3086 // Utility: 3087 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3088 motion = ( direction === "up" || direction === "left" ), 3089 i = 0, 3090 3091 queuelen = element.queue().length; 3092 3093 $.effects.createPlaceholder( element ); 3094 3095 refValue = element.css( ref ); 3096 3097 // Default distance for the BIGGEST bounce is the outer Distance / 3 3098 if ( !distance ) { 3099 distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; 3100 } 3101 3102 if ( show ) { 3103 downAnim = { opacity: 1 }; 3104 downAnim[ ref ] = refValue; 3105 3106 // If we are showing, force opacity 0 and set the initial position 3107 // then do the "first" animation 3108 element 3109 .css( "opacity", 0 ) 3110 .css( ref, motion ? -distance * 2 : distance * 2 ) 3111 .animate( downAnim, speed, easing ); 3112 } 3113 3114 // Start at the smallest distance if we are hiding 3115 if ( hide ) { 3116 distance = distance / Math.pow( 2, times - 1 ); 3117 } 3118 3119 downAnim = {}; 3120 downAnim[ ref ] = refValue; 3121 3122 // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here 3123 for ( ; i < times; i++ ) { 3124 upAnim = {}; 3125 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3126 3127 element 3128 .animate( upAnim, speed, easing ) 3129 .animate( downAnim, speed, easing ); 3130 3131 distance = hide ? distance * 2 : distance / 2; 3132 } 3133 3134 // Last Bounce when Hiding 3135 if ( hide ) { 3136 upAnim = { opacity: 0 }; 3137 upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; 3138 3139 element.animate( upAnim, speed, easing ); 3140 } 3141 3142 element.queue( done ); 3143 3144 $.effects.unshift( element, queuelen, anims + 1 ); 3145} ); 3146 3147 3148/*! 3149 * jQuery UI Effects Clip 1.13.2 3150 * http://jqueryui.com 3151 * 3152 * Copyright jQuery Foundation and other contributors 3153 * Released under the MIT license. 3154 * http://jquery.org/license 3155 */ 3156 3157//>>label: Clip Effect 3158//>>group: Effects 3159//>>description: Clips the element on and off like an old TV. 3160//>>docs: http://api.jqueryui.com/clip-effect/ 3161//>>demos: http://jqueryui.com/effect/ 3162 3163 3164var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) { 3165 var start, 3166 animate = {}, 3167 element = $( this ), 3168 direction = options.direction || "vertical", 3169 both = direction === "both", 3170 horizontal = both || direction === "horizontal", 3171 vertical = both || direction === "vertical"; 3172 3173 start = element.cssClip(); 3174 animate.clip = { 3175 top: vertical ? ( start.bottom - start.top ) / 2 : start.top, 3176 right: horizontal ? ( start.right - start.left ) / 2 : start.right, 3177 bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom, 3178 left: horizontal ? ( start.right - start.left ) / 2 : start.left 3179 }; 3180 3181 $.effects.createPlaceholder( element ); 3182 3183 if ( options.mode === "show" ) { 3184 element.cssClip( animate.clip ); 3185 animate.clip = start; 3186 } 3187 3188 element.animate( animate, { 3189 queue: false, 3190 duration: options.duration, 3191 easing: options.easing, 3192 complete: done 3193 } ); 3194 3195} ); 3196 3197 3198/*! 3199 * jQuery UI Effects Drop 1.13.2 3200 * http://jqueryui.com 3201 * 3202 * Copyright jQuery Foundation and other contributors 3203 * Released under the MIT license. 3204 * http://jquery.org/license 3205 */ 3206 3207//>>label: Drop Effect 3208//>>group: Effects 3209//>>description: Moves an element in one direction and hides it at the same time. 3210//>>docs: http://api.jqueryui.com/drop-effect/ 3211//>>demos: http://jqueryui.com/effect/ 3212 3213 3214var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) { 3215 3216 var distance, 3217 element = $( this ), 3218 mode = options.mode, 3219 show = mode === "show", 3220 direction = options.direction || "left", 3221 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3222 motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=", 3223 oppositeMotion = ( motion === "+=" ) ? "-=" : "+=", 3224 animation = { 3225 opacity: 0 3226 }; 3227 3228 $.effects.createPlaceholder( element ); 3229 3230 distance = options.distance || 3231 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2; 3232 3233 animation[ ref ] = motion + distance; 3234 3235 if ( show ) { 3236 element.css( animation ); 3237 3238 animation[ ref ] = oppositeMotion + distance; 3239 animation.opacity = 1; 3240 } 3241 3242 // Animate 3243 element.animate( animation, { 3244 queue: false, 3245 duration: options.duration, 3246 easing: options.easing, 3247 complete: done 3248 } ); 3249} ); 3250 3251 3252/*! 3253 * jQuery UI Effects Explode 1.13.2 3254 * http://jqueryui.com 3255 * 3256 * Copyright jQuery Foundation and other contributors 3257 * Released under the MIT license. 3258 * http://jquery.org/license 3259 */ 3260 3261//>>label: Explode Effect 3262//>>group: Effects 3263/* eslint-disable max-len */ 3264//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness. 3265/* eslint-enable max-len */ 3266//>>docs: http://api.jqueryui.com/explode-effect/ 3267//>>demos: http://jqueryui.com/effect/ 3268 3269 3270var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) { 3271 3272 var i, j, left, top, mx, my, 3273 rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3, 3274 cells = rows, 3275 element = $( this ), 3276 mode = options.mode, 3277 show = mode === "show", 3278 3279 // Show and then visibility:hidden the element before calculating offset 3280 offset = element.show().css( "visibility", "hidden" ).offset(), 3281 3282 // Width and height of a piece 3283 width = Math.ceil( element.outerWidth() / cells ), 3284 height = Math.ceil( element.outerHeight() / rows ), 3285 pieces = []; 3286 3287 // Children animate complete: 3288 function childComplete() { 3289 pieces.push( this ); 3290 if ( pieces.length === rows * cells ) { 3291 animComplete(); 3292 } 3293 } 3294 3295 // Clone the element for each row and cell. 3296 for ( i = 0; i < rows; i++ ) { // ===> 3297 top = offset.top + i * height; 3298 my = i - ( rows - 1 ) / 2; 3299 3300 for ( j = 0; j < cells; j++ ) { // ||| 3301 left = offset.left + j * width; 3302 mx = j - ( cells - 1 ) / 2; 3303 3304 // Create a clone of the now hidden main element that will be absolute positioned 3305 // within a wrapper div off the -left and -top equal to size of our pieces 3306 element 3307 .clone() 3308 .appendTo( "body" ) 3309 .wrap( "<div></div>" ) 3310 .css( { 3311 position: "absolute", 3312 visibility: "visible", 3313 left: -j * width, 3314 top: -i * height 3315 } ) 3316 3317 // Select the wrapper - make it overflow: hidden and absolute positioned based on 3318 // where the original was located +left and +top equal to the size of pieces 3319 .parent() 3320 .addClass( "ui-effects-explode" ) 3321 .css( { 3322 position: "absolute", 3323 overflow: "hidden", 3324 width: width, 3325 height: height, 3326 left: left + ( show ? mx * width : 0 ), 3327 top: top + ( show ? my * height : 0 ), 3328 opacity: show ? 0 : 1 3329 } ) 3330 .animate( { 3331 left: left + ( show ? 0 : mx * width ), 3332 top: top + ( show ? 0 : my * height ), 3333 opacity: show ? 1 : 0 3334 }, options.duration || 500, options.easing, childComplete ); 3335 } 3336 } 3337 3338 function animComplete() { 3339 element.css( { 3340 visibility: "visible" 3341 } ); 3342 $( pieces ).remove(); 3343 done(); 3344 } 3345} ); 3346 3347 3348/*! 3349 * jQuery UI Effects Fade 1.13.2 3350 * http://jqueryui.com 3351 * 3352 * Copyright jQuery Foundation and other contributors 3353 * Released under the MIT license. 3354 * http://jquery.org/license 3355 */ 3356 3357//>>label: Fade Effect 3358//>>group: Effects 3359//>>description: Fades the element. 3360//>>docs: http://api.jqueryui.com/fade-effect/ 3361//>>demos: http://jqueryui.com/effect/ 3362 3363 3364var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) { 3365 var show = options.mode === "show"; 3366 3367 $( this ) 3368 .css( "opacity", show ? 0 : 1 ) 3369 .animate( { 3370 opacity: show ? 1 : 0 3371 }, { 3372 queue: false, 3373 duration: options.duration, 3374 easing: options.easing, 3375 complete: done 3376 } ); 3377} ); 3378 3379 3380/*! 3381 * jQuery UI Effects Fold 1.13.2 3382 * http://jqueryui.com 3383 * 3384 * Copyright jQuery Foundation and other contributors 3385 * Released under the MIT license. 3386 * http://jquery.org/license 3387 */ 3388 3389//>>label: Fold Effect 3390//>>group: Effects 3391//>>description: Folds an element first horizontally and then vertically. 3392//>>docs: http://api.jqueryui.com/fold-effect/ 3393//>>demos: http://jqueryui.com/effect/ 3394 3395 3396var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) { 3397 3398 // Create element 3399 var element = $( this ), 3400 mode = options.mode, 3401 show = mode === "show", 3402 hide = mode === "hide", 3403 size = options.size || 15, 3404 percent = /([0-9]+)%/.exec( size ), 3405 horizFirst = !!options.horizFirst, 3406 ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ], 3407 duration = options.duration / 2, 3408 3409 placeholder = $.effects.createPlaceholder( element ), 3410 3411 start = element.cssClip(), 3412 animation1 = { clip: $.extend( {}, start ) }, 3413 animation2 = { clip: $.extend( {}, start ) }, 3414 3415 distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ], 3416 3417 queuelen = element.queue().length; 3418 3419 if ( percent ) { 3420 size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; 3421 } 3422 animation1.clip[ ref[ 0 ] ] = size; 3423 animation2.clip[ ref[ 0 ] ] = size; 3424 animation2.clip[ ref[ 1 ] ] = 0; 3425 3426 if ( show ) { 3427 element.cssClip( animation2.clip ); 3428 if ( placeholder ) { 3429 placeholder.css( $.effects.clipToBox( animation2 ) ); 3430 } 3431 3432 animation2.clip = start; 3433 } 3434 3435 // Animate 3436 element 3437 .queue( function( next ) { 3438 if ( placeholder ) { 3439 placeholder 3440 .animate( $.effects.clipToBox( animation1 ), duration, options.easing ) 3441 .animate( $.effects.clipToBox( animation2 ), duration, options.easing ); 3442 } 3443 3444 next(); 3445 } ) 3446 .animate( animation1, duration, options.easing ) 3447 .animate( animation2, duration, options.easing ) 3448 .queue( done ); 3449 3450 $.effects.unshift( element, queuelen, 4 ); 3451} ); 3452 3453 3454/*! 3455 * jQuery UI Effects Highlight 1.13.2 3456 * http://jqueryui.com 3457 * 3458 * Copyright jQuery Foundation and other contributors 3459 * Released under the MIT license. 3460 * http://jquery.org/license 3461 */ 3462 3463//>>label: Highlight Effect 3464//>>group: Effects 3465//>>description: Highlights the background of an element in a defined color for a custom duration. 3466//>>docs: http://api.jqueryui.com/highlight-effect/ 3467//>>demos: http://jqueryui.com/effect/ 3468 3469 3470var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) { 3471 var element = $( this ), 3472 animation = { 3473 backgroundColor: element.css( "backgroundColor" ) 3474 }; 3475 3476 if ( options.mode === "hide" ) { 3477 animation.opacity = 0; 3478 } 3479 3480 $.effects.saveStyle( element ); 3481 3482 element 3483 .css( { 3484 backgroundImage: "none", 3485 backgroundColor: options.color || "#ffff99" 3486 } ) 3487 .animate( animation, { 3488 queue: false, 3489 duration: options.duration, 3490 easing: options.easing, 3491 complete: done 3492 } ); 3493} ); 3494 3495 3496/*! 3497 * jQuery UI Effects Size 1.13.2 3498 * http://jqueryui.com 3499 * 3500 * Copyright jQuery Foundation and other contributors 3501 * Released under the MIT license. 3502 * http://jquery.org/license 3503 */ 3504 3505//>>label: Size Effect 3506//>>group: Effects 3507//>>description: Resize an element to a specified width and height. 3508//>>docs: http://api.jqueryui.com/size-effect/ 3509//>>demos: http://jqueryui.com/effect/ 3510 3511 3512var effectsEffectSize = $.effects.define( "size", function( options, done ) { 3513 3514 // Create element 3515 var baseline, factor, temp, 3516 element = $( this ), 3517 3518 // Copy for children 3519 cProps = [ "fontSize" ], 3520 vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], 3521 hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], 3522 3523 // Set options 3524 mode = options.mode, 3525 restore = mode !== "effect", 3526 scale = options.scale || "both", 3527 origin = options.origin || [ "middle", "center" ], 3528 position = element.css( "position" ), 3529 pos = element.position(), 3530 original = $.effects.scaledDimensions( element ), 3531 from = options.from || original, 3532 to = options.to || $.effects.scaledDimensions( element, 0 ); 3533 3534 $.effects.createPlaceholder( element ); 3535 3536 if ( mode === "show" ) { 3537 temp = from; 3538 from = to; 3539 to = temp; 3540 } 3541 3542 // Set scaling factor 3543 factor = { 3544 from: { 3545 y: from.height / original.height, 3546 x: from.width / original.width 3547 }, 3548 to: { 3549 y: to.height / original.height, 3550 x: to.width / original.width 3551 } 3552 }; 3553 3554 // Scale the css box 3555 if ( scale === "box" || scale === "both" ) { 3556 3557 // Vertical props scaling 3558 if ( factor.from.y !== factor.to.y ) { 3559 from = $.effects.setTransition( element, vProps, factor.from.y, from ); 3560 to = $.effects.setTransition( element, vProps, factor.to.y, to ); 3561 } 3562 3563 // Horizontal props scaling 3564 if ( factor.from.x !== factor.to.x ) { 3565 from = $.effects.setTransition( element, hProps, factor.from.x, from ); 3566 to = $.effects.setTransition( element, hProps, factor.to.x, to ); 3567 } 3568 } 3569 3570 // Scale the content 3571 if ( scale === "content" || scale === "both" ) { 3572 3573 // Vertical props scaling 3574 if ( factor.from.y !== factor.to.y ) { 3575 from = $.effects.setTransition( element, cProps, factor.from.y, from ); 3576 to = $.effects.setTransition( element, cProps, factor.to.y, to ); 3577 } 3578 } 3579 3580 // Adjust the position properties based on the provided origin points 3581 if ( origin ) { 3582 baseline = $.effects.getBaseline( origin, original ); 3583 from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top; 3584 from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left; 3585 to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top; 3586 to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left; 3587 } 3588 delete from.outerHeight; 3589 delete from.outerWidth; 3590 element.css( from ); 3591 3592 // Animate the children if desired 3593 if ( scale === "content" || scale === "both" ) { 3594 3595 vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps ); 3596 hProps = hProps.concat( [ "marginLeft", "marginRight" ] ); 3597 3598 // Only animate children with width attributes specified 3599 // TODO: is this right? should we include anything with css width specified as well 3600 element.find( "*[width]" ).each( function() { 3601 var child = $( this ), 3602 childOriginal = $.effects.scaledDimensions( child ), 3603 childFrom = { 3604 height: childOriginal.height * factor.from.y, 3605 width: childOriginal.width * factor.from.x, 3606 outerHeight: childOriginal.outerHeight * factor.from.y, 3607 outerWidth: childOriginal.outerWidth * factor.from.x 3608 }, 3609 childTo = { 3610 height: childOriginal.height * factor.to.y, 3611 width: childOriginal.width * factor.to.x, 3612 outerHeight: childOriginal.height * factor.to.y, 3613 outerWidth: childOriginal.width * factor.to.x 3614 }; 3615 3616 // Vertical props scaling 3617 if ( factor.from.y !== factor.to.y ) { 3618 childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom ); 3619 childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo ); 3620 } 3621 3622 // Horizontal props scaling 3623 if ( factor.from.x !== factor.to.x ) { 3624 childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom ); 3625 childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo ); 3626 } 3627 3628 if ( restore ) { 3629 $.effects.saveStyle( child ); 3630 } 3631 3632 // Animate children 3633 child.css( childFrom ); 3634 child.animate( childTo, options.duration, options.easing, function() { 3635 3636 // Restore children 3637 if ( restore ) { 3638 $.effects.restoreStyle( child ); 3639 } 3640 } ); 3641 } ); 3642 } 3643 3644 // Animate 3645 element.animate( to, { 3646 queue: false, 3647 duration: options.duration, 3648 easing: options.easing, 3649 complete: function() { 3650 3651 var offset = element.offset(); 3652 3653 if ( to.opacity === 0 ) { 3654 element.css( "opacity", from.opacity ); 3655 } 3656 3657 if ( !restore ) { 3658 element 3659 .css( "position", position === "static" ? "relative" : position ) 3660 .offset( offset ); 3661 3662 // Need to save style here so that automatic style restoration 3663 // doesn't restore to the original styles from before the animation. 3664 $.effects.saveStyle( element ); 3665 } 3666 3667 done(); 3668 } 3669 } ); 3670 3671} ); 3672 3673 3674/*! 3675 * jQuery UI Effects Scale 1.13.2 3676 * http://jqueryui.com 3677 * 3678 * Copyright jQuery Foundation and other contributors 3679 * Released under the MIT license. 3680 * http://jquery.org/license 3681 */ 3682 3683//>>label: Scale Effect 3684//>>group: Effects 3685//>>description: Grows or shrinks an element and its content. 3686//>>docs: http://api.jqueryui.com/scale-effect/ 3687//>>demos: http://jqueryui.com/effect/ 3688 3689 3690var effectsEffectScale = $.effects.define( "scale", function( options, done ) { 3691 3692 // Create element 3693 var el = $( this ), 3694 mode = options.mode, 3695 percent = parseInt( options.percent, 10 ) || 3696 ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ), 3697 3698 newOptions = $.extend( true, { 3699 from: $.effects.scaledDimensions( el ), 3700 to: $.effects.scaledDimensions( el, percent, options.direction || "both" ), 3701 origin: options.origin || [ "middle", "center" ] 3702 }, options ); 3703 3704 // Fade option to support puff 3705 if ( options.fade ) { 3706 newOptions.from.opacity = 1; 3707 newOptions.to.opacity = 0; 3708 } 3709 3710 $.effects.effect.size.call( this, newOptions, done ); 3711} ); 3712 3713 3714/*! 3715 * jQuery UI Effects Puff 1.13.2 3716 * http://jqueryui.com 3717 * 3718 * Copyright jQuery Foundation and other contributors 3719 * Released under the MIT license. 3720 * http://jquery.org/license 3721 */ 3722 3723//>>label: Puff Effect 3724//>>group: Effects 3725//>>description: Creates a puff effect by scaling the element up and hiding it at the same time. 3726//>>docs: http://api.jqueryui.com/puff-effect/ 3727//>>demos: http://jqueryui.com/effect/ 3728 3729 3730var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) { 3731 var newOptions = $.extend( true, {}, options, { 3732 fade: true, 3733 percent: parseInt( options.percent, 10 ) || 150 3734 } ); 3735 3736 $.effects.effect.scale.call( this, newOptions, done ); 3737} ); 3738 3739 3740/*! 3741 * jQuery UI Effects Pulsate 1.13.2 3742 * http://jqueryui.com 3743 * 3744 * Copyright jQuery Foundation and other contributors 3745 * Released under the MIT license. 3746 * http://jquery.org/license 3747 */ 3748 3749//>>label: Pulsate Effect 3750//>>group: Effects 3751//>>description: Pulsates an element n times by changing the opacity to zero and back. 3752//>>docs: http://api.jqueryui.com/pulsate-effect/ 3753//>>demos: http://jqueryui.com/effect/ 3754 3755 3756var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) { 3757 var element = $( this ), 3758 mode = options.mode, 3759 show = mode === "show", 3760 hide = mode === "hide", 3761 showhide = show || hide, 3762 3763 // Showing or hiding leaves off the "last" animation 3764 anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), 3765 duration = options.duration / anims, 3766 animateTo = 0, 3767 i = 1, 3768 queuelen = element.queue().length; 3769 3770 if ( show || !element.is( ":visible" ) ) { 3771 element.css( "opacity", 0 ).show(); 3772 animateTo = 1; 3773 } 3774 3775 // Anims - 1 opacity "toggles" 3776 for ( ; i < anims; i++ ) { 3777 element.animate( { opacity: animateTo }, duration, options.easing ); 3778 animateTo = 1 - animateTo; 3779 } 3780 3781 element.animate( { opacity: animateTo }, duration, options.easing ); 3782 3783 element.queue( done ); 3784 3785 $.effects.unshift( element, queuelen, anims + 1 ); 3786} ); 3787 3788 3789/*! 3790 * jQuery UI Effects Shake 1.13.2 3791 * http://jqueryui.com 3792 * 3793 * Copyright jQuery Foundation and other contributors 3794 * Released under the MIT license. 3795 * http://jquery.org/license 3796 */ 3797 3798//>>label: Shake Effect 3799//>>group: Effects 3800//>>description: Shakes an element horizontally or vertically n times. 3801//>>docs: http://api.jqueryui.com/shake-effect/ 3802//>>demos: http://jqueryui.com/effect/ 3803 3804 3805var effectsEffectShake = $.effects.define( "shake", function( options, done ) { 3806 3807 var i = 1, 3808 element = $( this ), 3809 direction = options.direction || "left", 3810 distance = options.distance || 20, 3811 times = options.times || 3, 3812 anims = times * 2 + 1, 3813 speed = Math.round( options.duration / anims ), 3814 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3815 positiveMotion = ( direction === "up" || direction === "left" ), 3816 animation = {}, 3817 animation1 = {}, 3818 animation2 = {}, 3819 3820 queuelen = element.queue().length; 3821 3822 $.effects.createPlaceholder( element ); 3823 3824 // Animation 3825 animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; 3826 animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; 3827 animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; 3828 3829 // Animate 3830 element.animate( animation, speed, options.easing ); 3831 3832 // Shakes 3833 for ( ; i < times; i++ ) { 3834 element 3835 .animate( animation1, speed, options.easing ) 3836 .animate( animation2, speed, options.easing ); 3837 } 3838 3839 element 3840 .animate( animation1, speed, options.easing ) 3841 .animate( animation, speed / 2, options.easing ) 3842 .queue( done ); 3843 3844 $.effects.unshift( element, queuelen, anims + 1 ); 3845} ); 3846 3847 3848/*! 3849 * jQuery UI Effects Slide 1.13.2 3850 * http://jqueryui.com 3851 * 3852 * Copyright jQuery Foundation and other contributors 3853 * Released under the MIT license. 3854 * http://jquery.org/license 3855 */ 3856 3857//>>label: Slide Effect 3858//>>group: Effects 3859//>>description: Slides an element in and out of the viewport. 3860//>>docs: http://api.jqueryui.com/slide-effect/ 3861//>>demos: http://jqueryui.com/effect/ 3862 3863 3864var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) { 3865 var startClip, startRef, 3866 element = $( this ), 3867 map = { 3868 up: [ "bottom", "top" ], 3869 down: [ "top", "bottom" ], 3870 left: [ "right", "left" ], 3871 right: [ "left", "right" ] 3872 }, 3873 mode = options.mode, 3874 direction = options.direction || "left", 3875 ref = ( direction === "up" || direction === "down" ) ? "top" : "left", 3876 positiveMotion = ( direction === "up" || direction === "left" ), 3877 distance = options.distance || 3878 element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ), 3879 animation = {}; 3880 3881 $.effects.createPlaceholder( element ); 3882 3883 startClip = element.cssClip(); 3884 startRef = element.position()[ ref ]; 3885 3886 // Define hide animation 3887 animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef; 3888 animation.clip = element.cssClip(); 3889 animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ]; 3890 3891 // Reverse the animation if we're showing 3892 if ( mode === "show" ) { 3893 element.cssClip( animation.clip ); 3894 element.css( ref, animation[ ref ] ); 3895 animation.clip = startClip; 3896 animation[ ref ] = startRef; 3897 } 3898 3899 // Actually animate 3900 element.animate( animation, { 3901 queue: false, 3902 duration: options.duration, 3903 easing: options.easing,
vendor: 9,661 bytes, lines 3904-4286
3904 complete: done 3905 } ); 3906} ); 3907 3908 3909/*! 3910 * jQuery UI Effects Transfer 1.13.2 3911 * http://jqueryui.com 3912 * 3913 * Copyright jQuery Foundation and other contributors 3914 * Released under the MIT license. 3915 * http://jquery.org/license 3916 */ 3917 3918//>>label: Transfer Effect 3919//>>group: Effects 3920//>>description: Displays a transfer effect from one element to another. 3921//>>docs: http://api.jqueryui.com/transfer-effect/ 3922//>>demos: http://jqueryui.com/effect/ 3923 3924 3925var effect; 3926if ( $.uiBackCompat !== false ) { 3927 effect = $.effects.define( "transfer", function( options, done ) { 3928 $( this ).transfer( options, done ); 3929 } ); 3930} 3931var effectsEffectTransfer = effect; 3932 3933 3934/*! 3935 * jQuery UI Focusable 1.13.2 3936 * http://jqueryui.com 3937 * 3938 * Copyright jQuery Foundation and other contributors 3939 * Released under the MIT license. 3940 * http://jquery.org/license 3941 */ 3942 3943//>>label: :focusable Selector 3944//>>group: Core 3945//>>description: Selects elements which can be focused. 3946//>>docs: http://api.jqueryui.com/focusable-selector/ 3947 3948 3949// Selectors 3950$.ui.focusable = function( element, hasTabindex ) { 3951 var map, mapName, img, focusableIfVisible, fieldset, 3952 nodeName = element.nodeName.toLowerCase(); 3953 3954 if ( "area" === nodeName ) { 3955 map = element.parentNode; 3956 mapName = map.name; 3957 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 3958 return false; 3959 } 3960 img = $( "img[usemap='#" + mapName + "']" ); 3961 return img.length > 0 && img.is( ":visible" ); 3962 } 3963 3964 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 3965 focusableIfVisible = !element.disabled; 3966 3967 if ( focusableIfVisible ) { 3968 3969 // Form controls within a disabled fieldset are disabled. 3970 // However, controls within the fieldset's legend do not get disabled. 3971 // Since controls generally aren't placed inside legends, we skip 3972 // this portion of the check. 3973 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 3974 if ( fieldset ) { 3975 focusableIfVisible = !fieldset.disabled; 3976 } 3977 } 3978 } else if ( "a" === nodeName ) { 3979 focusableIfVisible = element.href || hasTabindex; 3980 } else { 3981 focusableIfVisible = hasTabindex; 3982 } 3983 3984 return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) ); 3985}; 3986 3987// Support: IE 8 only 3988// IE 8 doesn't resolve inherit to visible/hidden for computed values 3989function visible( element ) { 3990 var visibility = element.css( "visibility" ); 3991 while ( visibility === "inherit" ) { 3992 element = element.parent(); 3993 visibility = element.css( "visibility" ); 3994 } 3995 return visibility === "visible"; 3996} 3997 3998$.extend( $.expr.pseudos, { 3999 focusable: function( element ) { 4000 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 4001 } 4002} ); 4003 4004var focusable = $.ui.focusable; 4005 4006 4007 4008// Support: IE8 Only 4009// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop 4010// with a string, so we need to find the proper form. 4011var form = $.fn._form = function() { 4012 return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form ); 4013}; 4014 4015 4016/*! 4017 * jQuery UI Form Reset Mixin 1.13.2 4018 * http://jqueryui.com 4019 * 4020 * Copyright jQuery Foundation and other contributors 4021 * Released under the MIT license. 4022 * http://jquery.org/license 4023 */ 4024 4025//>>label: Form Reset Mixin 4026//>>group: Core 4027//>>description: Refresh input widgets when their form is reset 4028//>>docs: http://api.jqueryui.com/form-reset-mixin/ 4029 4030 4031var formResetMixin = $.ui.formResetMixin = { 4032 _formResetHandler: function() { 4033 var form = $( this ); 4034 4035 // Wait for the form reset to actually happen before refreshing 4036 setTimeout( function() { 4037 var instances = form.data( "ui-form-reset-instances" ); 4038 $.each( instances, function() { 4039 this.refresh(); 4040 } ); 4041 } ); 4042 }, 4043 4044 _bindFormResetHandler: function() { 4045 this.form = this.element._form(); 4046 if ( !this.form.length ) { 4047 return; 4048 } 4049 4050 var instances = this.form.data( "ui-form-reset-instances" ) || []; 4051 if ( !instances.length ) { 4052 4053 // We don't use _on() here because we use a single event handler per form 4054 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 4055 } 4056 instances.push( this ); 4057 this.form.data( "ui-form-reset-instances", instances ); 4058 }, 4059 4060 _unbindFormResetHandler: function() { 4061 if ( !this.form.length ) { 4062 return; 4063 } 4064 4065 var instances = this.form.data( "ui-form-reset-instances" ); 4066 instances.splice( $.inArray( this, instances ), 1 ); 4067 if ( instances.length ) { 4068 this.form.data( "ui-form-reset-instances", instances ); 4069 } else { 4070 this.form 4071 .removeData( "ui-form-reset-instances" ) 4072 .off( "reset.ui-form-reset" ); 4073 } 4074 } 4075}; 4076 4077 4078/*! 4079 * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2 4080 * http://jqueryui.com 4081 * 4082 * Copyright jQuery Foundation and other contributors 4083 * Released under the MIT license. 4084 * http://jquery.org/license 4085 * 4086 */ 4087 4088//>>label: jQuery 1.8+ Support 4089//>>group: Core 4090//>>description: Support version 1.8.x and newer of jQuery core 4091 4092 4093// Support: jQuery 1.9.x or older 4094// $.expr[ ":" ] is deprecated. 4095if ( !$.expr.pseudos ) { 4096 $.expr.pseudos = $.expr[ ":" ]; 4097} 4098 4099// Support: jQuery 1.11.x or older 4100// $.unique has been renamed to $.uniqueSort 4101if ( !$.uniqueSort ) { 4102 $.uniqueSort = $.unique; 4103} 4104 4105// Support: jQuery 2.2.x or older. 4106// This method has been defined in jQuery 3.0.0. 4107// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js 4108if ( !$.escapeSelector ) { 4109 4110 // CSS string/identifier serialization 4111 // https://drafts.csswg.org/cssom/#common-serializing-idioms 4112 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 4113 4114 var fcssescape = function( ch, asCodePoint ) { 4115 if ( asCodePoint ) { 4116 4117 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 4118 if ( ch === "\0" ) { 4119 return "\uFFFD"; 4120 } 4121 4122 // Control characters and (dependent upon position) numbers get escaped as code points 4123 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 4124 } 4125 4126 // Other potentially-special ASCII characters get backslash-escaped 4127 return "\\" + ch; 4128 }; 4129 4130 $.escapeSelector = function( sel ) { 4131 return ( sel + "" ).replace( rcssescape, fcssescape ); 4132 }; 4133} 4134 4135// Support: jQuery 3.4.x or older 4136// These methods have been defined in jQuery 3.5.0. 4137if ( !$.fn.even || !$.fn.odd ) { 4138 $.fn.extend( { 4139 even: function() { 4140 return this.filter( function( i ) { 4141 return i % 2 === 0; 4142 } ); 4143 }, 4144 odd: function() { 4145 return this.filter( function( i ) { 4146 return i % 2 === 1; 4147 } ); 4148 } 4149 } ); 4150} 4151 4152; 4153/*! 4154 * jQuery UI Keycode 1.13.2 4155 * http://jqueryui.com 4156 * 4157 * Copyright jQuery Foundation and other contributors 4158 * Released under the MIT license. 4159 * http://jquery.org/license 4160 */ 4161 4162//>>label: Keycode 4163//>>group: Core 4164//>>description: Provide keycodes as keynames 4165//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/ 4166 4167 4168var keycode = $.ui.keyCode = { 4169 BACKSPACE: 8, 4170 COMMA: 188, 4171 DELETE: 46, 4172 DOWN: 40, 4173 END: 35, 4174 ENTER: 13, 4175 ESCAPE: 27, 4176 HOME: 36, 4177 LEFT: 37, 4178 PAGE_DOWN: 34, 4179 PAGE_UP: 33, 4180 PERIOD: 190, 4181 RIGHT: 39, 4182 SPACE: 32, 4183 TAB: 9, 4184 UP: 38 4185}; 4186 4187 4188/*! 4189 * jQuery UI Labels 1.13.2 4190 * http://jqueryui.com 4191 * 4192 * Copyright jQuery Foundation and other contributors 4193 * Released under the MIT license. 4194 * http://jquery.org/license 4195 */ 4196 4197//>>label: labels 4198//>>group: Core 4199//>>description: Find all the labels associated with a given input 4200//>>docs: http://api.jqueryui.com/labels/ 4201 4202 4203var labels = $.fn.labels = function() { 4204 var ancestor, selector, id, labels, ancestors; 4205 4206 if ( !this.length ) { 4207 return this.pushStack( [] ); 4208 } 4209 4210 // Check control.labels first 4211 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 4212 return this.pushStack( this[ 0 ].labels ); 4213 } 4214 4215 // Support: IE <= 11, FF <= 37, Android <= 2.3 only 4216 // Above browsers do not support control.labels. Everything below is to support them 4217 // as well as document fragments. control.labels does not work on document fragments 4218 labels = this.eq( 0 ).parents( "label" ); 4219 4220 // Look for the label based on the id 4221 id = this.attr( "id" ); 4222 if ( id ) { 4223 4224 // We don't search against the document in case the element 4225 // is disconnected from the DOM 4226 ancestor = this.eq( 0 ).parents().last(); 4227 4228 // Get a full set of top level ancestors 4229 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 4230 4231 // Create a selector for the label based on the id 4232 selector = "label[for='" + $.escapeSelector( id ) + "']"; 4233 4234 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 4235 4236 } 4237 4238 // Return whatever we have found for labels 4239 return this.pushStack( labels ); 4240}; 4241 4242 4243/*! 4244 * jQuery UI Scroll Parent 1.13.2 4245 * http://jqueryui.com 4246 * 4247 * Copyright jQuery Foundation and other contributors 4248 * Released under the MIT license. 4249 * http://jquery.org/license 4250 */ 4251 4252//>>label: scrollParent 4253//>>group: Core 4254//>>description: Get the closest ancestor element that is scrollable. 4255//>>docs: http://api.jqueryui.com/scrollParent/ 4256 4257 4258var scrollParent = $.fn.scrollParent = function( includeHidden ) { 4259 var position = this.css( "position" ), 4260 excludeStaticParent = position === "absolute", 4261 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 4262 scrollParent = this.parents().filter( function() { 4263 var parent = $( this ); 4264 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 4265 return false; 4266 } 4267 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 4268 parent.css( "overflow-x" ) ); 4269 } ).eq( 0 ); 4270 4271 return position === "fixed" || !scrollParent.length ? 4272 $( this[ 0 ].ownerDocument || document ) : 4273 scrollParent; 4274}; 4275 4276 4277/*! 4278 * jQuery UI Tabbable 1.13.2 4279 * http://jqueryui.com 4280 * 4281 * Copyright jQuery Foundation and other contributors 4282 * Released under the MIT license. 4283 * http://jquery.org/license 4284 */ 4285 4286//>>label: :tabbable Selector
vendor: 1,775 bytes, lines 4287-4361
4287//>>group: Core 4288//>>description: Selects elements which can be tabbed to. 4289//>>docs: http://api.jqueryui.com/tabbable-selector/ 4290 4291 4292var tabbable = $.extend( $.expr.pseudos, { 4293 tabbable: function( element ) { 4294 var tabIndex = $.attr( element, "tabindex" ), 4295 hasTabindex = tabIndex != null; 4296 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 4297 } 4298} ); 4299 4300 4301/*! 4302 * jQuery UI Unique ID 1.13.2 4303 * http://jqueryui.com 4304 * 4305 * Copyright jQuery Foundation and other contributors 4306 * Released under the MIT license. 4307 * http://jquery.org/license 4308 */ 4309 4310//>>label: uniqueId 4311//>>group: Core 4312//>>description: Functions to generate and remove uniqueId's 4313//>>docs: http://api.jqueryui.com/uniqueId/ 4314 4315 4316var uniqueId = $.fn.extend( { 4317 uniqueId: ( function() { 4318 var uuid = 0; 4319 4320 return function() { 4321 return this.each( function() { 4322 if ( !this.id ) { 4323 this.id = "ui-id-" + ( ++uuid ); 4324 } 4325 } ); 4326 }; 4327 } )(), 4328 4329 removeUniqueId: function() { 4330 return this.each( function() { 4331 if ( /^ui-id-\d+$/.test( this.id ) ) { 4332 $( this ).removeAttr( "id" ); 4333 } 4334 } ); 4335 } 4336} ); 4337 4338 4339/*! 4340 * jQuery UI Accordion 1.13.2 4341 * http://jqueryui.com 4342 * 4343 * Copyright jQuery Foundation and other contributors 4344 * Released under the MIT license. 4345 * http://jquery.org/license 4346 */ 4347 4348//>>label: Accordion 4349//>>group: Widgets 4350/* eslint-disable max-len */ 4351//>>description: Displays collapsible content panels for presenting information in a limited amount of space. 4352/* eslint-enable max-len */ 4353//>>docs: http://api.jqueryui.com/accordion/ 4354//>>demos: http://jqueryui.com/accordion/ 4355//>>css.structure: ../../themes/base/core.css 4356//>>css.structure: ../../themes/base/accordion.css 4357//>>css.theme: ../../themes/base/theme.css 4358 4359 4360var widgetsAccordion = $.widget( "ui.accordion", { 4361 version: "1.13.2
vendor: 15,900 bytes, lines 4361-4972
4361", 4362 options: { 4363 active: 0, 4364 animate: {}, 4365 classes: { 4366 "ui-accordion-header": "ui-corner-top", 4367 "ui-accordion-header-collapsed": "ui-corner-all", 4368 "ui-accordion-content": "ui-corner-bottom" 4369 }, 4370 collapsible: false, 4371 event: "click", 4372 header: function( elem ) { 4373 return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() ); 4374 }, 4375 heightStyle: "auto", 4376 icons: { 4377 activeHeader: "ui-icon-triangle-1-s", 4378 header: "ui-icon-triangle-1-e" 4379 }, 4380 4381 // Callbacks 4382 activate: null, 4383 beforeActivate: null 4384 }, 4385 4386 hideProps: { 4387 borderTopWidth: "hide", 4388 borderBottomWidth: "hide", 4389 paddingTop: "hide", 4390 paddingBottom: "hide", 4391 height: "hide" 4392 }, 4393 4394 showProps: { 4395 borderTopWidth: "show", 4396 borderBottomWidth: "show", 4397 paddingTop: "show", 4398 paddingBottom: "show", 4399 height: "show" 4400 }, 4401 4402 _create: function() { 4403 var options = this.options; 4404 4405 this.prevShow = this.prevHide = $(); 4406 this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); 4407 this.element.attr( "role", "tablist" ); 4408 4409 // Don't allow collapsible: false and active: false / null 4410 if ( !options.collapsible && ( options.active === false || options.active == null ) ) { 4411 options.active = 0; 4412 } 4413 4414 this._processPanels(); 4415 4416 // handle negative values 4417 if ( options.active < 0 ) { 4418 options.active += this.headers.length; 4419 } 4420 this._refresh(); 4421 }, 4422 4423 _getCreateEventData: function() { 4424 return { 4425 header: this.active, 4426 panel: !this.active.length ? $() : this.active.next() 4427 }; 4428 }, 4429 4430 _createIcons: function() { 4431 var icon, children, 4432 icons = this.options.icons; 4433 4434 if ( icons ) { 4435 icon = $( "<span>" ); 4436 this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); 4437 icon.prependTo( this.headers ); 4438 children = this.active.children( ".ui-accordion-header-icon" ); 4439 this._removeClass( children, icons.header ) 4440 ._addClass( children, null, icons.activeHeader ) 4441 ._addClass( this.headers, "ui-accordion-icons" ); 4442 } 4443 }, 4444 4445 _destroyIcons: function() { 4446 this._removeClass( this.headers, "ui-accordion-icons" ); 4447 this.headers.children( ".ui-accordion-header-icon" ).remove(); 4448 }, 4449 4450 _destroy: function() { 4451 var contents; 4452 4453 // Clean up main element 4454 this.element.removeAttr( "role" ); 4455 4456 // Clean up headers 4457 this.headers 4458 .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) 4459 .removeUniqueId(); 4460 4461 this._destroyIcons(); 4462 4463 // Clean up content panels 4464 contents = this.headers.next() 4465 .css( "display", "" ) 4466 .removeAttr( "role aria-hidden aria-labelledby" ) 4467 .removeUniqueId(); 4468 4469 if ( this.options.heightStyle !== "content" ) { 4470 contents.css( "height", "" ); 4471 } 4472 }, 4473 4474 _setOption: function( key, value ) { 4475 if ( key === "active" ) { 4476 4477 // _activate() will handle invalid values and update this.options 4478 this._activate( value ); 4479 return; 4480 } 4481 4482 if ( key === "event" ) { 4483 if ( this.options.event ) { 4484 this._off( this.headers, this.options.event ); 4485 } 4486 this._setupEvents( value ); 4487 } 4488 4489 this._super( key, value ); 4490 4491 // Setting collapsible: false while collapsed; open first panel 4492 if ( key === "collapsible" && !value && this.options.active === false ) { 4493 this._activate( 0 ); 4494 } 4495 4496 if ( key === "icons" ) { 4497 this._destroyIcons(); 4498 if ( value ) { 4499 this._createIcons(); 4500 } 4501 } 4502 }, 4503 4504 _setOptionDisabled: function( value ) { 4505 this._super( value ); 4506 4507 this.element.attr( "aria-disabled", value ); 4508 4509 // Support: IE8 Only 4510 // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE 4511 // so we need to add the disabled class to the headers and panels 4512 this._toggleClass( null, "ui-state-disabled", !!value ); 4513 this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled", 4514 !!value ); 4515 }, 4516 4517 _keydown: function( event ) { 4518 if ( event.altKey || event.ctrlKey ) { 4519 return; 4520 } 4521 4522 var keyCode = $.ui.keyCode, 4523 length = this.headers.length, 4524 currentIndex = this.headers.index( event.target ), 4525 toFocus = false; 4526 4527 switch ( event.keyCode ) { 4528 case keyCode.RIGHT: 4529 case keyCode.DOWN: 4530 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 4531 break; 4532 case keyCode.LEFT: 4533 case keyCode.UP: 4534 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 4535 break; 4536 case keyCode.SPACE: 4537 case keyCode.ENTER: 4538 this._eventHandler( event ); 4539 break; 4540 case keyCode.HOME: 4541 toFocus = this.headers[ 0 ]; 4542 break; 4543 case keyCode.END: 4544 toFocus = this.headers[ length - 1 ]; 4545 break; 4546 } 4547 4548 if ( toFocus ) { 4549 $( event.target ).attr( "tabIndex", -1 ); 4550 $( toFocus ).attr( "tabIndex", 0 ); 4551 $( toFocus ).trigger( "focus" ); 4552 event.preventDefault(); 4553 } 4554 }, 4555 4556 _panelKeyDown: function( event ) { 4557 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 4558 $( event.currentTarget ).prev().trigger( "focus" ); 4559 } 4560 }, 4561 4562 refresh: function() { 4563 var options = this.options; 4564 this._processPanels(); 4565 4566 // Was collapsed or no panel 4567 if ( ( options.active === false && options.collapsible === true ) || 4568 !this.headers.length ) { 4569 options.active = false; 4570 this.active = $(); 4571 4572 // active false only when collapsible is true 4573 } else if ( options.active === false ) { 4574 this._activate( 0 ); 4575 4576 // was active, but active panel is gone 4577 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 4578 4579 // all remaining panel are disabled 4580 if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { 4581 options.active = false; 4582 this.active = $(); 4583 4584 // activate previous panel 4585 } else { 4586 this._activate( Math.max( 0, options.active - 1 ) ); 4587 } 4588 4589 // was active, active panel still exists 4590 } else { 4591 4592 // make sure active index is correct 4593 options.active = this.headers.index( this.active ); 4594 } 4595 4596 this._destroyIcons(); 4597 4598 this._refresh(); 4599 }, 4600 4601 _processPanels: function() { 4602 var prevHeaders = this.headers, 4603 prevPanels = this.panels; 4604 4605 if ( typeof this.options.header === "function" ) { 4606 this.headers = this.options.header( this.element ); 4607 } else { 4608 this.headers = this.element.find( this.options.header ); 4609 } 4610 this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", 4611 "ui-state-default" ); 4612 4613 this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); 4614 this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); 4615 4616 // Avoid memory leaks (#10056) 4617 if ( prevPanels ) { 4618 this._off( prevHeaders.not( this.headers ) ); 4619 this._off( prevPanels.not( this.panels ) ); 4620 } 4621 }, 4622 4623 _refresh: function() { 4624 var maxHeight, 4625 options = this.options, 4626 heightStyle = options.heightStyle, 4627 parent = this.element.parent(); 4628 4629 this.active = this._findActive( options.active ); 4630 this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) 4631 ._removeClass( this.active, "ui-accordion-header-collapsed" ); 4632 this._addClass( this.active.next(), "ui-accordion-content-active" ); 4633 this.active.next().show(); 4634 4635 this.headers 4636 .attr( "role", "tab" ) 4637 .each( function() { 4638 var header = $( this ), 4639 headerId = header.uniqueId().attr( "id" ), 4640 panel = header.next(), 4641 panelId = panel.uniqueId().attr( "id" ); 4642 header.attr( "aria-controls", panelId ); 4643 panel.attr( "aria-labelledby", headerId ); 4644 } ) 4645 .next() 4646 .attr( "role", "tabpanel" ); 4647 4648 this.headers 4649 .not( this.active ) 4650 .attr( { 4651 "aria-selected": "false", 4652 "aria-expanded": "false", 4653 tabIndex: -1 4654 } ) 4655 .next() 4656 .attr( { 4657 "aria-hidden": "true" 4658 } ) 4659 .hide(); 4660 4661 // Make sure at least one header is in the tab order 4662 if ( !this.active.length ) { 4663 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 4664 } else { 4665 this.active.attr( { 4666 "aria-selected": "true", 4667 "aria-expanded": "true", 4668 tabIndex: 0 4669 } ) 4670 .next() 4671 .attr( { 4672 "aria-hidden": "false" 4673 } ); 4674 } 4675 4676 this._createIcons(); 4677 4678 this._setupEvents( options.event ); 4679 4680 if ( heightStyle === "fill" ) { 4681 maxHeight = parent.height(); 4682 this.element.siblings( ":visible" ).each( function() { 4683 var elem = $( this ), 4684 position = elem.css( "position" ); 4685 4686 if ( position === "absolute" || position === "fixed" ) { 4687 return; 4688 } 4689 maxHeight -= elem.outerHeight( true ); 4690 } ); 4691 4692 this.headers.each( function() { 4693 maxHeight -= $( this ).outerHeight( true ); 4694 } ); 4695 4696 this.headers.next() 4697 .each( function() { 4698 $( this ).height( Math.max( 0, maxHeight - 4699 $( this ).innerHeight() + $( this ).height() ) ); 4700 } ) 4701 .css( "overflow", "auto" ); 4702 } else if ( heightStyle === "auto" ) { 4703 maxHeight = 0; 4704 this.headers.next() 4705 .each( function() { 4706 var isVisible = $( this ).is( ":visible" ); 4707 if ( !isVisible ) { 4708 $( this ).show(); 4709 } 4710 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 4711 if ( !isVisible ) { 4712 $( this ).hide(); 4713 } 4714 } ) 4715 .height( maxHeight ); 4716 } 4717 }, 4718 4719 _activate: function( index ) { 4720 var active = this._findActive( index )[ 0 ]; 4721 4722 // Trying to activate the already active panel 4723 if ( active === this.active[ 0 ] ) { 4724 return; 4725 } 4726 4727 // Trying to collapse, simulate a click on the currently active header 4728 active = active || this.active[ 0 ]; 4729 4730 this._eventHandler( { 4731 target: active, 4732 currentTarget: active, 4733 preventDefault: $.noop 4734 } ); 4735 }, 4736 4737 _findActive: function( selector ) { 4738 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 4739 }, 4740 4741 _setupEvents: function( event ) { 4742 var events = { 4743 keydown: "_keydown" 4744 }; 4745 if ( event ) { 4746 $.each( event.split( " " ), function( index, eventName ) { 4747 events[ eventName ] = "_eventHandler"; 4748 } ); 4749 } 4750 4751 this._off( this.headers.add( this.headers.next() ) ); 4752 this._on( this.headers, events ); 4753 this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); 4754 this._hoverable( this.headers ); 4755 this._focusable( this.headers ); 4756 }, 4757 4758 _eventHandler: function( event ) { 4759 var activeChildren, clickedChildren, 4760 options = this.options, 4761 active = this.active, 4762 clicked = $( event.currentTarget ), 4763 clickedIsActive = clicked[ 0 ] === active[ 0 ], 4764 collapsing = clickedIsActive && options.collapsible, 4765 toShow = collapsing ? $() : clicked.next(), 4766 toHide = active.next(), 4767 eventData = { 4768 oldHeader: active, 4769 oldPanel: toHide, 4770 newHeader: collapsing ? $() : clicked, 4771 newPanel: toShow 4772 }; 4773 4774 event.preventDefault(); 4775 4776 if ( 4777 4778 // click on active header, but not collapsible 4779 ( clickedIsActive && !options.collapsible ) || 4780 4781 // allow canceling activation 4782 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 4783 return; 4784 } 4785 4786 options.active = collapsing ? false : this.headers.index( clicked ); 4787 4788 // When the call to ._toggle() comes after the class changes 4789 // it causes a very odd bug in IE 8 (see #6720) 4790 this.active = clickedIsActive ? $() : clicked; 4791 this._toggle( eventData ); 4792 4793 // Switch classes 4794 // corner classes on the previously active header stay after the animation 4795 this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); 4796 if ( options.icons ) { 4797 activeChildren = active.children( ".ui-accordion-header-icon" ); 4798 this._removeClass( activeChildren, null, options.icons.activeHeader ) 4799 ._addClass( activeChildren, null, options.icons.header ); 4800 } 4801 4802 if ( !clickedIsActive ) { 4803 this._removeClass( clicked, "ui-accordion-header-collapsed" ) 4804 ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); 4805 if ( options.icons ) { 4806 clickedChildren = clicked.children( ".ui-accordion-header-icon" ); 4807 this._removeClass( clickedChildren, null, options.icons.header ) 4808 ._addClass( clickedChildren, null, options.icons.activeHeader ); 4809 } 4810 4811 this._addClass( clicked.next(), "ui-accordion-content-active" ); 4812 } 4813 }, 4814 4815 _toggle: function( data ) { 4816 var toShow = data.newPanel, 4817 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 4818 4819 // Handle activating a panel during the animation for another activation 4820 this.prevShow.add( this.prevHide ).stop( true, true ); 4821 this.prevShow = toShow; 4822 this.prevHide = toHide; 4823 4824 if ( this.options.animate ) { 4825 this._animate( toShow, toHide, data ); 4826 } else { 4827 toHide.hide(); 4828 toShow.show(); 4829 this._toggleComplete( data ); 4830 } 4831 4832 toHide.attr( { 4833 "aria-hidden": "true" 4834 } ); 4835 toHide.prev().attr( { 4836 "aria-selected": "false", 4837 "aria-expanded": "false" 4838 } ); 4839 4840 // if we're switching panels, remove the old header from the tab order 4841 // if we're opening from collapsed state, remove the previous header from the tab order 4842 // if we're collapsing, then keep the collapsing header in the tab order 4843 if ( toShow.length && toHide.length ) { 4844 toHide.prev().attr( { 4845 "tabIndex": -1, 4846 "aria-expanded": "false" 4847 } ); 4848 } else if ( toShow.length ) { 4849 this.headers.filter( function() { 4850 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 4851 } ) 4852 .attr( "tabIndex", -1 ); 4853 } 4854 4855 toShow 4856 .attr( "aria-hidden", "false" ) 4857 .prev() 4858 .attr( { 4859 "aria-selected": "true", 4860 "aria-expanded": "true", 4861 tabIndex: 0 4862 } ); 4863 }, 4864 4865 _animate: function( toShow, toHide, data ) { 4866 var total, easing, duration, 4867 that = this, 4868 adjust = 0, 4869 boxSizing = toShow.css( "box-sizing" ), 4870 down = toShow.length && 4871 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 4872 animate = this.options.animate || {}, 4873 options = down && animate.down || animate, 4874 complete = function() { 4875 that._toggleComplete( data ); 4876 }; 4877 4878 if ( typeof options === "number" ) { 4879 duration = options; 4880 } 4881 if ( typeof options === "string" ) { 4882 easing = options; 4883 } 4884 4885 // fall back from options to animation in case of partial down settings 4886 easing = easing || options.easing || animate.easing; 4887 duration = duration || options.duration || animate.duration; 4888 4889 if ( !toHide.length ) { 4890 return toShow.animate( this.showProps, duration, easing, complete ); 4891 } 4892 if ( !toShow.length ) { 4893 return toHide.animate( this.hideProps, duration, easing, complete ); 4894 } 4895 4896 total = toShow.show().outerHeight(); 4897 toHide.animate( this.hideProps, { 4898 duration: duration, 4899 easing: easing, 4900 step: function( now, fx ) { 4901 fx.now = Math.round( now ); 4902 } 4903 } ); 4904 toShow 4905 .hide() 4906 .animate( this.showProps, { 4907 duration: duration, 4908 easing: easing, 4909 complete: complete, 4910 step: function( now, fx ) { 4911 fx.now = Math.round( now ); 4912 if ( fx.prop !== "height" ) { 4913 if ( boxSizing === "content-box" ) { 4914 adjust += fx.now; 4915 } 4916 } else if ( that.options.heightStyle !== "content" ) { 4917 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 4918 adjust = 0; 4919 } 4920 } 4921 } ); 4922 }, 4923 4924 _toggleComplete: function( data ) { 4925 var toHide = data.oldPanel, 4926 prev = toHide.prev(); 4927 4928 this._removeClass( toHide, "ui-accordion-content-active" ); 4929 this._removeClass( prev, "ui-accordion-header-active" ) 4930 ._addClass( prev, "ui-accordion-header-collapsed" ); 4931 4932 // Work around for rendering bug in IE (#5421) 4933 if ( toHide.length ) { 4934 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; 4935 } 4936 this._trigger( "activate", null, data ); 4937 } 4938} ); 4939 4940 4941 4942var safeActiveElement = $.ui.safeActiveElement = function( document ) { 4943 var activeElement; 4944 4945 // Support: IE 9 only 4946 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> 4947 try { 4948 activeElement = document.activeElement; 4949 } catch ( error ) { 4950 activeElement = document.body; 4951 } 4952 4953 // Support: IE 9 - 11 only 4954 // IE may return null instead of an element 4955 // Interestingly, this only seems to occur when NOT in an iframe 4956 if ( !activeElement ) { 4957 activeElement = document.body; 4958 } 4959 4960 // Support: IE 11 only 4961 // IE11 returns a seemingly empty object in some cases when accessing 4962 // document.activeElement from an <iframe> 4963 if ( !activeElement.nodeName ) { 4964 activeElement = document.body; 4965 } 4966 4967 return activeElement; 4968}; 4969 4970 4971/*! 4972 * jQuery UI Menu 1.13.
49722 4973 * http://jqueryui.com 4974 * 4975 * Copyright jQuery Foundation and other contributors 4976 * Released under the MIT license. 4977 * http://jquery.org/license 4978 */ 4979 4980//>>label: Menu 4981//>>group: Widgets 4982//>>description: Creates nestable menus. 4983//>>docs: http://api.jqueryui.com/menu/ 4984//>>demos: http://jqueryui.com/menu/ 4985//>>css.structure: ../../themes/base/core.css 4986//>>css.structure: ../../themes/base/menu.css 4987//>>css.theme: ../../themes/base/theme.css 4988 4989 4990var widgetsMenu = $.widget( "ui.menu", { 4991 version: "1.13.2
vendor: 2,668 bytes, lines 4991-5093
4991", 4992 defaultElement: "<ul>", 4993 delay: 300, 4994 options: { 4995 icons: { 4996 submenu: "ui-icon-caret-1-e" 4997 }, 4998 items: "> *", 4999 menus: "ul", 5000 position: { 5001 my: "left top", 5002 at: "right top" 5003 }, 5004 role: "menu", 5005 5006 // Callbacks 5007 blur: null, 5008 focus: null, 5009 select: null 5010 }, 5011 5012 _create: function() { 5013 this.activeMenu = this.element; 5014 5015 // Flag used to prevent firing of the click handler 5016 // as the event bubbles up through nested menus 5017 this.mouseHandled = false; 5018 this.lastMousePosition = { x: null, y: null }; 5019 this.element 5020 .uniqueId() 5021 .attr( { 5022 role: this.options.role, 5023 tabIndex: 0 5024 } ); 5025 5026 this._addClass( "ui-menu", "ui-widget ui-widget-content" ); 5027 this._on( { 5028 5029 // Prevent focus from sticking to links inside menu after clicking 5030 // them (focus should always stay on UL during navigation). 5031 "mousedown .ui-menu-item": function( event ) { 5032 event.preventDefault(); 5033 5034 this._activateItem( event ); 5035 }, 5036 "click .ui-menu-item": function( event ) { 5037 var target = $( event.target ); 5038 var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 5039 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 5040 this.select( event ); 5041 5042 // Only set the mouseHandled flag if the event will bubble, see #9469. 5043 if ( !event.isPropagationStopped() ) { 5044 this.mouseHandled = true; 5045 } 5046 5047 // Open submenu on click 5048 if ( target.has( ".ui-menu" ).length ) { 5049 this.expand( event ); 5050 } else if ( !this.element.is( ":focus" ) && 5051 active.closest( ".ui-menu" ).length ) { 5052 5053 // Redirect focus to the menu 5054 this.element.trigger( "focus", [ true ] ); 5055 5056 // If the active item is on the top level, let it stay active. 5057 // Otherwise, blur the active item since it is no longer visible. 5058 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 5059 clearTimeout( this.timer ); 5060 } 5061 } 5062 } 5063 }, 5064 "mouseenter .ui-menu-item": "_activateItem", 5065 "mousemove .ui-menu-item": "_activateItem", 5066 mouseleave: "collapseAll", 5067 "mouseleave .ui-menu": "collapseAll", 5068 focus: function( event, keepActiveItem ) { 5069 5070 // If there's already an active item, keep it active 5071 // If not, activate the first item 5072 var item = this.active || this._menuItems().first(); 5073 5074 if ( !keepActiveItem ) { 5075 this.focus( event, item ); 5076 } 5077 }, 5078 blur: function( event ) { 5079 this._delay( function() { 5080 var notContained = !$.contains( 5081 this.element[ 0 ], 5082 $.ui.safeActiveElement( this.document[ 0 ] ) 5083 ); 5084 if ( notContained ) { 5085 this.collapseAll( event ); 5086 } 5087 } ); 5088 }, 5089 keydown: "_keydown" 5090 } ); 5091 5092 this.refresh(); 5093
vendor: 3,056 bytes, lines 5094-5210
5094 // Clicks outside of a menu collapse any open menus 5095 this._on( this.document, { 5096 click: function( event ) { 5097 if ( this._closeOnDocumentClick( event ) ) { 5098 this.collapseAll( event, true ); 5099 } 5100 5101 // Reset the mouseHandled flag 5102 this.mouseHandled = false; 5103 } 5104 } ); 5105 }, 5106 5107 _activateItem: function( event ) { 5108 5109 // Ignore mouse events while typeahead is active, see #10458. 5110 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 5111 // is over an item in the menu 5112 if ( this.previousFilter ) { 5113 return; 5114 } 5115 5116 // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356) 5117 if ( event.clientX === this.lastMousePosition.x && 5118 event.clientY === this.lastMousePosition.y ) { 5119 return; 5120 } 5121 5122 this.lastMousePosition = { 5123 x: event.clientX, 5124 y: event.clientY 5125 }; 5126 5127 var actualTarget = $( event.target ).closest( ".ui-menu-item" ), 5128 target = $( event.currentTarget ); 5129 5130 // Ignore bubbled events on parent items, see #11641 5131 if ( actualTarget[ 0 ] !== target[ 0 ] ) { 5132 return; 5133 } 5134 5135 // If the item is already active, there's nothing to do 5136 if ( target.is( ".ui-state-active" ) ) { 5137 return; 5138 } 5139 5140 // Remove ui-state-active class from siblings of the newly focused menu item 5141 // to avoid a jump caused by adjacent elements both having a class with a border 5142 this._removeClass( target.siblings().children( ".ui-state-active" ), 5143 null, "ui-state-active" ); 5144 this.focus( event, target ); 5145 }, 5146 5147 _destroy: function() { 5148 var items = this.element.find( ".ui-menu-item" ) 5149 .removeAttr( "role aria-disabled" ), 5150 submenus = items.children( ".ui-menu-item-wrapper" ) 5151 .removeUniqueId() 5152 .removeAttr( "tabIndex role aria-haspopup" ); 5153 5154 // Destroy (sub)menus 5155 this.element 5156 .removeAttr( "aria-activedescendant" ) 5157 .find( ".ui-menu" ).addBack() 5158 .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " + 5159 "tabIndex" ) 5160 .removeUniqueId() 5161 .show(); 5162 5163 submenus.children().each( function() { 5164 var elem = $( this ); 5165 if ( elem.data( "ui-menu-submenu-caret" ) ) { 5166 elem.remove(); 5167 } 5168 } ); 5169 }, 5170 5171 _keydown: function( event ) { 5172 var match, prev, character, skip, 5173 preventDefault = true; 5174 5175 switch ( event.keyCode ) { 5176 case $.ui.keyCode.PAGE_UP: 5177 this.previousPage( event ); 5178 break; 5179 case $.ui.keyCode.PAGE_DOWN: 5180 this.nextPage( event ); 5181 break; 5182 case $.ui.keyCode.HOME: 5183 this._move( "first", "first", event ); 5184 break; 5185 case $.ui.keyCode.END: 5186 this._move( "last", "last", event ); 5187 break; 5188 case $.ui.keyCode.UP: 5189 this.previous( event ); 5190 break; 5191 case $.ui.keyCode.DOWN: 5192 this.next( event ); 5193 break; 5194 case $.ui.keyCode.LEFT: 5195 this.collapse( event ); 5196 break; 5197 case $.ui.keyCode.RIGHT: 5198 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5199 this.expand( event ); 5200 } 5201 break; 5202 case $.ui.keyCode.ENTER: 5203 case $.ui.keyCode.SPACE: 5204 this._activate( event ); 5205 break; 5206 case $.ui.keyCode.ESCAPE: 5207 this.collapse( event ); 5208 break; 5209 default: 5210 preventDefault = false;
vendor: 6,930 bytes, lines 5211-5459
5211 prev = this.previousFilter || ""; 5212 skip = false; 5213 5214 // Support number pad values 5215 character = event.keyCode >= 96 && event.keyCode <= 105 ? 5216 ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode ); 5217 5218 clearTimeout( this.filterTimer ); 5219 5220 if ( character === prev ) { 5221 skip = true; 5222 } else { 5223 character = prev + character; 5224 } 5225 5226 match = this._filterMenuItems( character ); 5227 match = skip && match.index( this.active.next() ) !== -1 ? 5228 this.active.nextAll( ".ui-menu-item" ) : 5229 match; 5230 5231 // If no matches on the current filter, reset to the last character pressed 5232 // to move down the menu to the first item that starts with that character 5233 if ( !match.length ) { 5234 character = String.fromCharCode( event.keyCode ); 5235 match = this._filterMenuItems( character ); 5236 } 5237 5238 if ( match.length ) { 5239 this.focus( event, match ); 5240 this.previousFilter = character; 5241 this.filterTimer = this._delay( function() { 5242 delete this.previousFilter; 5243 }, 1000 ); 5244 } else { 5245 delete this.previousFilter; 5246 } 5247 } 5248 5249 if ( preventDefault ) { 5250 event.preventDefault(); 5251 } 5252 }, 5253 5254 _activate: function( event ) { 5255 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 5256 if ( this.active.children( "[aria-haspopup='true']" ).length ) { 5257 this.expand( event ); 5258 } else { 5259 this.select( event ); 5260 } 5261 } 5262 }, 5263 5264 refresh: function() { 5265 var menus, items, newSubmenus, newItems, newWrappers, 5266 that = this, 5267 icon = this.options.icons.submenu, 5268 submenus = this.element.find( this.options.menus ); 5269 5270 this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length ); 5271 5272 // Initialize nested menus 5273 newSubmenus = submenus.filter( ":not(.ui-menu)" ) 5274 .hide() 5275 .attr( { 5276 role: this.options.role, 5277 "aria-hidden": "true", 5278 "aria-expanded": "false" 5279 } ) 5280 .each( function() { 5281 var menu = $( this ), 5282 item = menu.prev(), 5283 submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true ); 5284 5285 that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon ); 5286 item 5287 .attr( "aria-haspopup", "true" ) 5288 .prepend( submenuCaret ); 5289 menu.attr( "aria-labelledby", item.attr( "id" ) ); 5290 } ); 5291 5292 this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" ); 5293 5294 menus = submenus.add( this.element ); 5295 items = menus.find( this.options.items ); 5296 5297 // Initialize menu-items containing spaces and/or dashes only as dividers 5298 items.not( ".ui-menu-item" ).each( function() { 5299 var item = $( this ); 5300 if ( that._isDivider( item ) ) { 5301 that._addClass( item, "ui-menu-divider", "ui-widget-content" ); 5302 } 5303 } ); 5304 5305 // Don't refresh list items that are already adapted 5306 newItems = items.not( ".ui-menu-item, .ui-menu-divider" ); 5307 newWrappers = newItems.children() 5308 .not( ".ui-menu" ) 5309 .uniqueId() 5310 .attr( { 5311 tabIndex: -1, 5312 role: this._itemRole() 5313 } ); 5314 this._addClass( newItems, "ui-menu-item" ) 5315 ._addClass( newWrappers, "ui-menu-item-wrapper" ); 5316 5317 // Add aria-disabled attribute to any disabled menu item 5318 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 5319 5320 // If the active item has been removed, blur the menu 5321 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 5322 this.blur(); 5323 } 5324 }, 5325 5326 _itemRole: function() { 5327 return { 5328 menu: "menuitem", 5329 listbox: "option" 5330 }[ this.options.role ]; 5331 }, 5332 5333 _setOption: function( key, value ) { 5334 if ( key === "icons" ) { 5335 var icons = this.element.find( ".ui-menu-icon" ); 5336 this._removeClass( icons, null, this.options.icons.submenu ) 5337 ._addClass( icons, null, value.submenu ); 5338 } 5339 this._super( key, value ); 5340 }, 5341 5342 _setOptionDisabled: function( value ) { 5343 this._super( value ); 5344 5345 this.element.attr( "aria-disabled", String( value ) ); 5346 this._toggleClass( null, "ui-state-disabled", !!value ); 5347 }, 5348 5349 focus: function( event, item ) { 5350 var nested, focused, activeParent; 5351 this.blur( event, event && event.type === "focus" ); 5352 5353 this._scrollIntoView( item ); 5354 5355 this.active = item.first(); 5356 5357 focused = this.active.children( ".ui-menu-item-wrapper" ); 5358 this._addClass( focused, null, "ui-state-active" ); 5359 5360 // Only update aria-activedescendant if there's a role 5361 // otherwise we assume focus is managed elsewhere 5362 if ( this.options.role ) { 5363 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 5364 } 5365 5366 // Highlight active parent menu item, if any 5367 activeParent = this.active 5368 .parent() 5369 .closest( ".ui-menu-item" ) 5370 .children( ".ui-menu-item-wrapper" ); 5371 this._addClass( activeParent, null, "ui-state-active" ); 5372 5373 if ( event && event.type === "keydown" ) { 5374 this._close(); 5375 } else { 5376 this.timer = this._delay( function() { 5377 this._close(); 5378 }, this.delay ); 5379 } 5380 5381 nested = item.children( ".ui-menu" ); 5382 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 5383 this._startOpening( nested ); 5384 } 5385 this.activeMenu = item.parent(); 5386 5387 this._trigger( "focus", event, { item: item } ); 5388 }, 5389 5390 _scrollIntoView: function( item ) { 5391 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 5392 if ( this._hasScroll() ) { 5393 borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0; 5394 paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0; 5395 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 5396 scroll = this.activeMenu.scrollTop(); 5397 elementHeight = this.activeMenu.height(); 5398 itemHeight = item.outerHeight(); 5399 5400 if ( offset < 0 ) { 5401 this.activeMenu.scrollTop( scroll + offset ); 5402 } else if ( offset + itemHeight > elementHeight ) { 5403 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 5404 } 5405 } 5406 }, 5407 5408 blur: function( event, fromFocus ) { 5409 if ( !fromFocus ) { 5410 clearTimeout( this.timer ); 5411 } 5412 5413 if ( !this.active ) { 5414 return; 5415 } 5416 5417 this._removeClass( this.active.children( ".ui-menu-item-wrapper" ), 5418 null, "ui-state-active" ); 5419 5420 this._trigger( "blur", event, { item: this.active } ); 5421 this.active = null; 5422 }, 5423 5424 _startOpening: function( submenu ) { 5425 clearTimeout( this.timer ); 5426 5427 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 5428 // shift in the submenu position when mousing over the caret icon 5429 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 5430 return; 5431 } 5432 5433 this.timer = this._delay( function() { 5434 this._close(); 5435 this._open( submenu ); 5436 }, this.delay ); 5437 }, 5438 5439 _open: function( submenu ) { 5440 var position = $.extend( { 5441 of: this.active 5442 }, this.options.position ); 5443 5444 clearTimeout( this.timer ); 5445 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 5446 .hide() 5447 .attr( "aria-hidden", "true" ); 5448 5449 submenu 5450 .show() 5451 .removeAttr( "aria-hidden" ) 5452 .attr( "aria-expanded", "true" ) 5453 .position( position ); 5454 }, 5455 5456 collapseAll: function( event, all ) { 5457 clearTimeout( this.timer ); 5458 this.timer = this._delay( function() { 5459
vendor: 5,432 bytes, lines 5460-5663
5460 // If we were passed an event, look for the submenu that contains the event 5461 var currentMenu = all ? this.element : 5462 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 5463 5464 // If we found no valid submenu ancestor, use the main menu to close all 5465 // sub menus anyway 5466 if ( !currentMenu.length ) { 5467 currentMenu = this.element; 5468 } 5469 5470 this._close( currentMenu ); 5471 5472 this.blur( event ); 5473 5474 // Work around active item staying active after menu is blurred 5475 this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); 5476 5477 this.activeMenu = currentMenu; 5478 }, all ? 0 : this.delay ); 5479 }, 5480 5481 // With no arguments, closes the currently active menu - if nothing is active 5482 // it closes all menus. If passed an argument, it will search for menus BELOW 5483 _close: function( startMenu ) { 5484 if ( !startMenu ) { 5485 startMenu = this.active ? this.active.parent() : this.element; 5486 } 5487 5488 startMenu.find( ".ui-menu" ) 5489 .hide() 5490 .attr( "aria-hidden", "true" ) 5491 .attr( "aria-expanded", "false" ); 5492 }, 5493 5494 _closeOnDocumentClick: function( event ) { 5495 return !$( event.target ).closest( ".ui-menu" ).length; 5496 }, 5497 5498 _isDivider: function( item ) { 5499 5500 // Match hyphen, em dash, en dash 5501 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 5502 }, 5503 5504 collapse: function( event ) { 5505 var newItem = this.active && 5506 this.active.parent().closest( ".ui-menu-item", this.element ); 5507 if ( newItem && newItem.length ) { 5508 this._close(); 5509 this.focus( event, newItem ); 5510 } 5511 }, 5512 5513 expand: function( event ) { 5514 var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first(); 5515 5516 if ( newItem && newItem.length ) { 5517 this._open( newItem.parent() ); 5518 5519 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 5520 this._delay( function() { 5521 this.focus( event, newItem ); 5522 } ); 5523 } 5524 }, 5525 5526 next: function( event ) { 5527 this._move( "next", "first", event ); 5528 }, 5529 5530 previous: function( event ) { 5531 this._move( "prev", "last", event ); 5532 }, 5533 5534 isFirstItem: function() { 5535 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 5536 }, 5537 5538 isLastItem: function() { 5539 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 5540 }, 5541 5542 _menuItems: function( menu ) { 5543 return ( menu || this.element ) 5544 .find( this.options.items ) 5545 .filter( ".ui-menu-item" ); 5546 }, 5547 5548 _move: function( direction, filter, event ) { 5549 var next; 5550 if ( this.active ) { 5551 if ( direction === "first" || direction === "last" ) { 5552 next = this.active 5553 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 5554 .last(); 5555 } else { 5556 next = this.active 5557 [ direction + "All" ]( ".ui-menu-item" ) 5558 .first(); 5559 } 5560 } 5561 if ( !next || !next.length || !this.active ) { 5562 next = this._menuItems( this.activeMenu )[ filter ](); 5563 } 5564 5565 this.focus( event, next ); 5566 }, 5567 5568 nextPage: function( event ) { 5569 var item, base, height; 5570 5571 if ( !this.active ) { 5572 this.next( event ); 5573 return; 5574 } 5575 if ( this.isLastItem() ) { 5576 return; 5577 } 5578 if ( this._hasScroll() ) { 5579 base = this.active.offset().top; 5580 height = this.element.innerHeight(); 5581 5582 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 5583 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 5584 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 5585 } 5586 5587 this.active.nextAll( ".ui-menu-item" ).each( function() { 5588 item = $( this ); 5589 return item.offset().top - base - height < 0; 5590 } ); 5591 5592 this.focus( event, item ); 5593 } else { 5594 this.focus( event, this._menuItems( this.activeMenu ) 5595 [ !this.active ? "first" : "last" ]() ); 5596 } 5597 }, 5598 5599 previousPage: function( event ) { 5600 var item, base, height; 5601 if ( !this.active ) { 5602 this.next( event ); 5603 return; 5604 } 5605 if ( this.isFirstItem() ) { 5606 return; 5607 } 5608 if ( this._hasScroll() ) { 5609 base = this.active.offset().top; 5610 height = this.element.innerHeight(); 5611 5612 // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back. 5613 if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) { 5614 height += this.element[ 0 ].offsetHeight - this.element.outerHeight(); 5615 } 5616 5617 this.active.prevAll( ".ui-menu-item" ).each( function() { 5618 item = $( this ); 5619 return item.offset().top - base + height > 0; 5620 } ); 5621 5622 this.focus( event, item ); 5623 } else { 5624 this.focus( event, this._menuItems( this.activeMenu ).first() ); 5625 } 5626 }, 5627 5628 _hasScroll: function() { 5629 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 5630 }, 5631 5632 select: function( event ) { 5633 5634 // TODO: It should never be possible to not have an active item at this 5635 // point, but the tests don't trigger mouseenter before click. 5636 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 5637 var ui = { item: this.active }; 5638 if ( !this.active.has( ".ui-menu" ).length ) { 5639 this.collapseAll( event, true ); 5640 } 5641 this._trigger( "select", event, ui ); 5642 }, 5643 5644 _filterMenuItems: function( character ) { 5645 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 5646 regex = new RegExp( "^" + escapedCharacter, "i" ); 5647 5648 return this.activeMenu 5649 .find( this.options.items ) 5650 5651 // Only match on items, not dividers or other content (#10571) 5652 .filter( ".ui-menu-item" ) 5653 .filter( function() { 5654 return regex.test( 5655 String.prototype.trim.call( 5656 $( this ).children( ".ui-menu-item-wrapper" ).text() ) ); 5657 } ); 5658 } 5659} ); 5660 5661 5662/*! 5663 * jQuery UI Autocomplete 1.1
56633.2 5664 * http://jqueryui.com 5665 * 5666 * Copyright jQuery Foundation and other contributors 5667 * Released under the MIT license. 5668 * http://jquery.org/license 5669 */ 5670 5671//>>label: Autocomplete 5672//>>group: Widgets 5673//>>description: Lists suggested words as the user is typing. 5674//>>docs: http://api.jqueryui.com/autocomplete/ 5675//>>demos: http://jqueryui.com/autocomplete/ 5676//>>css.structure: ../../themes/base/core.css 5677//>>css.structure: ../../themes/base/autocomplete.css 5678//>>css.theme: ../../themes/base/theme.css 5679 5680 5681$.widget( "ui.autocomplete", { 5682 version: "1.13.2
vendor: 16,621 bytes, lines 5682-6319
5682", 5683 defaultElement: "<input>", 5684 options: { 5685 appendTo: null, 5686 autoFocus: false, 5687 delay: 300, 5688 minLength: 1, 5689 position: { 5690 my: "left top", 5691 at: "left bottom", 5692 collision: "none" 5693 }, 5694 source: null, 5695 5696 // Callbacks 5697 change: null, 5698 close: null, 5699 focus: null, 5700 open: null, 5701 response: null, 5702 search: null, 5703 select: null 5704 }, 5705 5706 requestIndex: 0, 5707 pending: 0, 5708 liveRegionTimer: null, 5709 5710 _create: function() { 5711 5712 // Some browsers only repeat keydown events, not keypress events, 5713 // so we use the suppressKeyPress flag to determine if we've already 5714 // handled the keydown event. #7269 5715 // Unfortunately the code for & in keypress is the same as the up arrow, 5716 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 5717 // events when we know the keydown event was used to modify the 5718 // search term. #7799 5719 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 5720 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 5721 isTextarea = nodeName === "textarea", 5722 isInput = nodeName === "input"; 5723 5724 // Textareas are always multi-line 5725 // Inputs are always single-line, even if inside a contentEditable element 5726 // IE also treats inputs as contentEditable 5727 // All other element types are determined by whether or not they're contentEditable 5728 this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); 5729 5730 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 5731 this.isNewMenu = true; 5732 5733 this._addClass( "ui-autocomplete-input" ); 5734 this.element.attr( "autocomplete", "off" ); 5735 5736 this._on( this.element, { 5737 keydown: function( event ) { 5738 if ( this.element.prop( "readOnly" ) ) { 5739 suppressKeyPress = true; 5740 suppressInput = true; 5741 suppressKeyPressRepeat = true; 5742 return; 5743 } 5744 5745 suppressKeyPress = false; 5746 suppressInput = false; 5747 suppressKeyPressRepeat = false; 5748 var keyCode = $.ui.keyCode; 5749 switch ( event.keyCode ) { 5750 case keyCode.PAGE_UP: 5751 suppressKeyPress = true; 5752 this._move( "previousPage", event ); 5753 break; 5754 case keyCode.PAGE_DOWN: 5755 suppressKeyPress = true; 5756 this._move( "nextPage", event ); 5757 break; 5758 case keyCode.UP: 5759 suppressKeyPress = true; 5760 this._keyEvent( "previous", event ); 5761 break; 5762 case keyCode.DOWN: 5763 suppressKeyPress = true; 5764 this._keyEvent( "next", event ); 5765 break; 5766 case keyCode.ENTER: 5767 5768 // when menu is open and has focus 5769 if ( this.menu.active ) { 5770 5771 // #6055 - Opera still allows the keypress to occur 5772 // which causes forms to submit 5773 suppressKeyPress = true; 5774 event.preventDefault(); 5775 this.menu.select( event ); 5776 } 5777 break; 5778 case keyCode.TAB: 5779 if ( this.menu.active ) { 5780 this.menu.select( event ); 5781 } 5782 break; 5783 case keyCode.ESCAPE: 5784 if ( this.menu.element.is( ":visible" ) ) { 5785 if ( !this.isMultiLine ) { 5786 this._value( this.term ); 5787 } 5788 this.close( event ); 5789 5790 // Different browsers have different default behavior for escape 5791 // Single press can mean undo or clear 5792 // Double press in IE means clear the whole form 5793 event.preventDefault(); 5794 } 5795 break; 5796 default: 5797 suppressKeyPressRepeat = true; 5798 5799 // search timeout should be triggered before the input value is changed 5800 this._searchTimeout( event ); 5801 break; 5802 } 5803 }, 5804 keypress: function( event ) { 5805 if ( suppressKeyPress ) { 5806 suppressKeyPress = false; 5807 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 5808 event.preventDefault(); 5809 } 5810 return; 5811 } 5812 if ( suppressKeyPressRepeat ) { 5813 return; 5814 } 5815 5816 // Replicate some key handlers to allow them to repeat in Firefox and Opera 5817 var keyCode = $.ui.keyCode; 5818 switch ( event.keyCode ) { 5819 case keyCode.PAGE_UP: 5820 this._move( "previousPage", event ); 5821 break; 5822 case keyCode.PAGE_DOWN: 5823 this._move( "nextPage", event ); 5824 break; 5825 case keyCode.UP: 5826 this._keyEvent( "previous", event ); 5827 break; 5828 case keyCode.DOWN: 5829 this._keyEvent( "next", event ); 5830 break; 5831 } 5832 }, 5833 input: function( event ) { 5834 if ( suppressInput ) { 5835 suppressInput = false; 5836 event.preventDefault(); 5837 return; 5838 } 5839 this._searchTimeout( event ); 5840 }, 5841 focus: function() { 5842 this.selectedItem = null; 5843 this.previous = this._value(); 5844 }, 5845 blur: function( event ) { 5846 clearTimeout( this.searching ); 5847 this.close( event ); 5848 this._change( event ); 5849 } 5850 } ); 5851 5852 this._initSource(); 5853 this.menu = $( "<ul>" ) 5854 .appendTo( this._appendTo() ) 5855 .menu( { 5856 5857 // disable ARIA support, the live region takes care of that 5858 role: null 5859 } ) 5860 .hide() 5861 5862 // Support: IE 11 only, Edge <= 14 5863 // For other browsers, we preventDefault() on the mousedown event 5864 // to keep the dropdown from taking focus from the input. This doesn't 5865 // work for IE/Edge, causing problems with selection and scrolling (#9638) 5866 // Happily, IE and Edge support an "unselectable" attribute that 5867 // prevents an element from receiving focus, exactly what we want here. 5868 .attr( { 5869 "unselectable": "on" 5870 } ) 5871 .menu( "instance" ); 5872 5873 this._addClass( this.menu.element, "ui-autocomplete", "ui-front" ); 5874 this._on( this.menu.element, { 5875 mousedown: function( event ) { 5876 5877 // Prevent moving focus out of the text field 5878 event.preventDefault(); 5879 }, 5880 menufocus: function( event, ui ) { 5881 var label, item; 5882 5883 // support: Firefox 5884 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 5885 if ( this.isNewMenu ) { 5886 this.isNewMenu = false; 5887 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 5888 this.menu.blur(); 5889 5890 this.document.one( "mousemove", function() { 5891 $( event.target ).trigger( event.originalEvent ); 5892 } ); 5893 5894 return; 5895 } 5896 } 5897 5898 item = ui.item.data( "ui-autocomplete-item" ); 5899 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 5900 5901 // use value to match what will end up in the input, if it was a key event 5902 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 5903 this._value( item.value ); 5904 } 5905 } 5906 5907 // Announce the value in the liveRegion 5908 label = ui.item.attr( "aria-label" ) || item.value; 5909 if ( label && String.prototype.trim.call( label ).length ) { 5910 clearTimeout( this.liveRegionTimer ); 5911 this.liveRegionTimer = this._delay( function() { 5912 this.liveRegion.html( $( "<div>" ).text( label ) ); 5913 }, 100 ); 5914 } 5915 }, 5916 menuselect: function( event, ui ) { 5917 var item = ui.item.data( "ui-autocomplete-item" ), 5918 previous = this.previous; 5919 5920 // Only trigger when focus was lost (click on menu) 5921 if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) { 5922 this.element.trigger( "focus" ); 5923 this.previous = previous; 5924 5925 // #6109 - IE triggers two focus events and the second 5926 // is asynchronous, so we need to reset the previous 5927 // term synchronously and asynchronously :-( 5928 this._delay( function() { 5929 this.previous = previous; 5930 this.selectedItem = item; 5931 } ); 5932 } 5933 5934 if ( false !== this._trigger( "select", event, { item: item } ) ) { 5935 this._value( item.value ); 5936 } 5937 5938 // reset the term after the select event 5939 // this allows custom select handling to work properly 5940 this.term = this._value(); 5941 5942 this.close( event ); 5943 this.selectedItem = item; 5944 } 5945 } ); 5946 5947 this.liveRegion = $( "<div>", { 5948 role: "status", 5949 "aria-live": "assertive", 5950 "aria-relevant": "additions" 5951 } ) 5952 .appendTo( this.document[ 0 ].body ); 5953 5954 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 5955 5956 // Turning off autocomplete prevents the browser from remembering the 5957 // value when navigating through history, so we re-enable autocomplete 5958 // if the page is unloaded before the widget is destroyed. #7790 5959 this._on( this.window, { 5960 beforeunload: function() { 5961 this.element.removeAttr( "autocomplete" ); 5962 } 5963 } ); 5964 }, 5965 5966 _destroy: function() { 5967 clearTimeout( this.searching ); 5968 this.element.removeAttr( "autocomplete" ); 5969 this.menu.element.remove(); 5970 this.liveRegion.remove(); 5971 }, 5972 5973 _setOption: function( key, value ) { 5974 this._super( key, value ); 5975 if ( key === "source" ) { 5976 this._initSource(); 5977 } 5978 if ( key === "appendTo" ) { 5979 this.menu.element.appendTo( this._appendTo() ); 5980 } 5981 if ( key === "disabled" && value && this.xhr ) { 5982 this.xhr.abort(); 5983 } 5984 }, 5985 5986 _isEventTargetInWidget: function( event ) { 5987 var menuElement = this.menu.element[ 0 ]; 5988 5989 return event.target === this.element[ 0 ] || 5990 event.target === menuElement || 5991 $.contains( menuElement, event.target ); 5992 }, 5993 5994 _closeOnClickOutside: function( event ) { 5995 if ( !this._isEventTargetInWidget( event ) ) { 5996 this.close(); 5997 } 5998 }, 5999 6000 _appendTo: function() { 6001 var element = this.options.appendTo; 6002 6003 if ( element ) { 6004 element = element.jquery || element.nodeType ? 6005 $( element ) : 6006 this.document.find( element ).eq( 0 ); 6007 } 6008 6009 if ( !element || !element[ 0 ] ) { 6010 element = this.element.closest( ".ui-front, dialog" ); 6011 } 6012 6013 if ( !element.length ) { 6014 element = this.document[ 0 ].body; 6015 } 6016 6017 return element; 6018 }, 6019 6020 _initSource: function() { 6021 var array, url, 6022 that = this; 6023 if ( Array.isArray( this.options.source ) ) { 6024 array = this.options.source; 6025 this.source = function( request, response ) { 6026 response( $.ui.autocomplete.filter( array, request.term ) ); 6027 }; 6028 } else if ( typeof this.options.source === "string" ) { 6029 url = this.options.source; 6030 this.source = function( request, response ) { 6031 if ( that.xhr ) { 6032 that.xhr.abort(); 6033 } 6034 that.xhr = $.ajax( { 6035 url: url, 6036 data: request, 6037 dataType: "json", 6038 success: function( data ) { 6039 response( data ); 6040 }, 6041 error: function() { 6042 response( [] ); 6043 } 6044 } ); 6045 }; 6046 } else { 6047 this.source = this.options.source; 6048 } 6049 }, 6050 6051 _searchTimeout: function( event ) { 6052 clearTimeout( this.searching ); 6053 this.searching = this._delay( function() { 6054 6055 // Search if the value has changed, or if the user retypes the same value (see #7434) 6056 var equalValues = this.term === this._value(), 6057 menuVisible = this.menu.element.is( ":visible" ), 6058 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 6059 6060 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 6061 this.selectedItem = null; 6062 this.search( null, event ); 6063 } 6064 }, this.options.delay ); 6065 }, 6066 6067 search: function( value, event ) { 6068 value = value != null ? value : this._value(); 6069 6070 // Always save the actual value, not the one passed as an argument 6071 this.term = this._value(); 6072 6073 if ( value.length < this.options.minLength ) { 6074 return this.close( event ); 6075 } 6076 6077 if ( this._trigger( "search", event ) === false ) { 6078 return; 6079 } 6080 6081 return this._search( value ); 6082 }, 6083 6084 _search: function( value ) { 6085 this.pending++; 6086 this._addClass( "ui-autocomplete-loading" ); 6087 this.cancelSearch = false; 6088 6089 this.source( { term: value }, this._response() ); 6090 }, 6091 6092 _response: function() { 6093 var index = ++this.requestIndex; 6094 6095 return function( content ) { 6096 if ( index === this.requestIndex ) { 6097 this.__response( content ); 6098 } 6099 6100 this.pending--; 6101 if ( !this.pending ) { 6102 this._removeClass( "ui-autocomplete-loading" ); 6103 } 6104 }.bind( this ); 6105 }, 6106 6107 __response: function( content ) { 6108 if ( content ) { 6109 content = this._normalize( content ); 6110 } 6111 this._trigger( "response", null, { content: content } ); 6112 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 6113 this._suggest( content ); 6114 this._trigger( "open" ); 6115 } else { 6116 6117 // use ._close() instead of .close() so we don't cancel future searches 6118 this._close(); 6119 } 6120 }, 6121 6122 close: function( event ) { 6123 this.cancelSearch = true; 6124 this._close( event ); 6125 }, 6126 6127 _close: function( event ) { 6128 6129 // Remove the handler that closes the menu on outside clicks 6130 this._off( this.document, "mousedown" ); 6131 6132 if ( this.menu.element.is( ":visible" ) ) { 6133 this.menu.element.hide(); 6134 this.menu.blur(); 6135 this.isNewMenu = true; 6136 this._trigger( "close", event ); 6137 } 6138 }, 6139 6140 _change: function( event ) { 6141 if ( this.previous !== this._value() ) { 6142 this._trigger( "change", event, { item: this.selectedItem } ); 6143 } 6144 }, 6145 6146 _normalize: function( items ) { 6147 6148 // assume all items have the right format when the first item is complete 6149 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 6150 return items; 6151 } 6152 return $.map( items, function( item ) { 6153 if ( typeof item === "string" ) { 6154 return { 6155 label: item, 6156 value: item 6157 }; 6158 } 6159 return $.extend( {}, item, { 6160 label: item.label || item.value, 6161 value: item.value || item.label 6162 } ); 6163 } ); 6164 }, 6165 6166 _suggest: function( items ) { 6167 var ul = this.menu.element.empty(); 6168 this._renderMenu( ul, items ); 6169 this.isNewMenu = true; 6170 this.menu.refresh(); 6171 6172 // Size and position menu 6173 ul.show(); 6174 this._resizeMenu(); 6175 ul.position( $.extend( { 6176 of: this.element 6177 }, this.options.position ) ); 6178 6179 if ( this.options.autoFocus ) { 6180 this.menu.next(); 6181 } 6182 6183 // Listen for interactions outside of the widget (#6642) 6184 this._on( this.document, { 6185 mousedown: "_closeOnClickOutside" 6186 } ); 6187 }, 6188 6189 _resizeMenu: function() { 6190 var ul = this.menu.element; 6191 ul.outerWidth( Math.max( 6192 6193 // Firefox wraps long text (possibly a rounding bug) 6194 // so we add 1px to avoid the wrapping (#7513) 6195 ul.width( "" ).outerWidth() + 1, 6196 this.element.outerWidth() 6197 ) ); 6198 }, 6199 6200 _renderMenu: function( ul, items ) { 6201 var that = this; 6202 $.each( items, function( index, item ) { 6203 that._renderItemData( ul, item ); 6204 } ); 6205 }, 6206 6207 _renderItemData: function( ul, item ) { 6208 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 6209 }, 6210 6211 _renderItem: function( ul, item ) { 6212 return $( "<li>" ) 6213 .append( $( "<div>" ).text( item.label ) ) 6214 .appendTo( ul ); 6215 }, 6216 6217 _move: function( direction, event ) { 6218 if ( !this.menu.element.is( ":visible" ) ) { 6219 this.search( null, event ); 6220 return; 6221 } 6222 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 6223 this.menu.isLastItem() && /^next/.test( direction ) ) { 6224 6225 if ( !this.isMultiLine ) { 6226 this._value( this.term ); 6227 } 6228 6229 this.menu.blur(); 6230 return; 6231 } 6232 this.menu[ direction ]( event ); 6233 }, 6234 6235 widget: function() { 6236 return this.menu.element; 6237 }, 6238 6239 _value: function() { 6240 return this.valueMethod.apply( this.element, arguments ); 6241 }, 6242 6243 _keyEvent: function( keyEvent, event ) { 6244 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 6245 this._move( keyEvent, event ); 6246 6247 // Prevents moving cursor to beginning/end of the text field in some browsers 6248 event.preventDefault(); 6249 } 6250 }, 6251 6252 // Support: Chrome <=50 6253 // We should be able to just use this.element.prop( "isContentEditable" ) 6254 // but hidden elements always report false in Chrome. 6255 // https://code.google.com/p/chromium/issues/detail?id=313082 6256 _isContentEditable: function( element ) { 6257 if ( !element.length ) { 6258 return false; 6259 } 6260 6261 var editable = element.prop( "contentEditable" ); 6262 6263 if ( editable === "inherit" ) { 6264 return this._isContentEditable( element.parent() ); 6265 } 6266 6267 return editable === "true"; 6268 } 6269} ); 6270 6271$.extend( $.ui.autocomplete, { 6272 escapeRegex: function( value ) { 6273 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 6274 }, 6275 filter: function( array, term ) { 6276 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 6277 return $.grep( array, function( value ) { 6278 return matcher.test( value.label || value.value || value ); 6279 } ); 6280 } 6281} ); 6282 6283// Live region extension, adding a `messages` option 6284// NOTE: This is an experimental API. We are still investigating 6285// a full solution for string manipulation and internationalization. 6286$.widget( "ui.autocomplete", $.ui.autocomplete, { 6287 options: { 6288 messages: { 6289 noResults: "No search results.", 6290 results: function( amount ) { 6291 return amount + ( amount > 1 ? " results are" : " result is" ) + 6292 " available, use up and down arrow keys to navigate."; 6293 } 6294 } 6295 }, 6296 6297 __response: function( content ) { 6298 var message; 6299 this._superApply( arguments ); 6300 if ( this.options.disabled || this.cancelSearch ) { 6301 return; 6302 } 6303 if ( content && content.length ) { 6304 message = this.options.messages.results( content.length ); 6305 } else { 6306 message = this.options.messages.noResults; 6307 } 6308 clearTimeout( this.liveRegionTimer ); 6309 this.liveRegionTimer = this._delay( function() { 6310 this.liveRegion.html( $( "<div>" ).text( message ) ); 6311 }, 100 ); 6312 } 6313} ); 6314 6315var widgetsAutocomplete = $.ui.autocomplete; 6316 6317 6318/*! 6319 * jQuery UI Controlgroup 1.13.
63192 6320 * http://jqueryui.com 6321 * 6322 * Copyright jQuery Foundation and other contributors 6323 * Released under the MIT license. 6324 * http://jquery.org/license 6325 */ 6326 6327//>>label: Controlgroup 6328//>>group: Widgets 6329//>>description: Visually groups form control widgets 6330//>>docs: http://api.jqueryui.com/controlgroup/ 6331//>>demos: http://jqueryui.com/controlgroup/ 6332//>>css.structure: ../../themes/base/core.css 6333//>>css.structure: ../../themes/base/controlgroup.css 6334//>>css.theme: ../../themes/base/theme.css 6335 6336 6337var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 6338 6339var widgetsControlgroup = $.widget( "ui.controlgroup", { 6340 version: "1.13
vendor: 7,736 bytes, lines 6340-6604
6340.2", 6341 defaultElement: "<div>", 6342 options: { 6343 direction: "horizontal", 6344 disabled: null, 6345 onlyVisible: true, 6346 items: { 6347 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 6348 "controlgroupLabel": ".ui-controlgroup-label", 6349 "checkboxradio": "input[type='checkbox'], input[type='radio']", 6350 "selectmenu": "select", 6351 "spinner": ".ui-spinner-input" 6352 } 6353 }, 6354 6355 _create: function() { 6356 this._enhance(); 6357 }, 6358 6359 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 6360 _enhance: function() { 6361 this.element.attr( "role", "toolbar" ); 6362 this.refresh(); 6363 }, 6364 6365 _destroy: function() { 6366 this._callChildMethod( "destroy" ); 6367 this.childWidgets.removeData( "ui-controlgroup-data" ); 6368 this.element.removeAttr( "role" ); 6369 if ( this.options.items.controlgroupLabel ) { 6370 this.element 6371 .find( this.options.items.controlgroupLabel ) 6372 .find( ".ui-controlgroup-label-contents" ) 6373 .contents().unwrap(); 6374 } 6375 }, 6376 6377 _initWidgets: function() { 6378 var that = this, 6379 childWidgets = []; 6380 6381 // First we iterate over each of the items options 6382 $.each( this.options.items, function( widget, selector ) { 6383 var labels; 6384 var options = {}; 6385 6386 // Make sure the widget has a selector set 6387 if ( !selector ) { 6388 return; 6389 } 6390 6391 if ( widget === "controlgroupLabel" ) { 6392 labels = that.element.find( selector ); 6393 labels.each( function() { 6394 var element = $( this ); 6395 6396 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 6397 return; 6398 } 6399 element.contents() 6400 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 6401 } ); 6402 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 6403 childWidgets = childWidgets.concat( labels.get() ); 6404 return; 6405 } 6406 6407 // Make sure the widget actually exists 6408 if ( !$.fn[ widget ] ) { 6409 return; 6410 } 6411 6412 // We assume everything is in the middle to start because we can't determine 6413 // first / last elements until all enhancments are done. 6414 if ( that[ "_" + widget + "Options" ] ) { 6415 options = that[ "_" + widget + "Options" ]( "middle" ); 6416 } else { 6417 options = { classes: {} }; 6418 } 6419 6420 // Find instances of this widget inside controlgroup and init them 6421 that.element 6422 .find( selector ) 6423 .each( function() { 6424 var element = $( this ); 6425 var instance = element[ widget ]( "instance" ); 6426 6427 // We need to clone the default options for this type of widget to avoid 6428 // polluting the variable options which has a wider scope than a single widget. 6429 var instanceOptions = $.widget.extend( {}, options ); 6430 6431 // If the button is the child of a spinner ignore it 6432 // TODO: Find a more generic solution 6433 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 6434 return; 6435 } 6436 6437 // Create the widget if it doesn't exist 6438 if ( !instance ) { 6439 instance = element[ widget ]()[ widget ]( "instance" ); 6440 } 6441 if ( instance ) { 6442 instanceOptions.classes = 6443 that._resolveClassesValues( instanceOptions.classes, instance ); 6444 } 6445 element[ widget ]( instanceOptions ); 6446 6447 // Store an instance of the controlgroup to be able to reference 6448 // from the outermost element for changing options and refresh 6449 var widgetElement = element[ widget ]( "widget" ); 6450 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 6451 instance ? instance : element[ widget ]( "instance" ) ); 6452 6453 childWidgets.push( widgetElement[ 0 ] ); 6454 } ); 6455 } ); 6456 6457 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 6458 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 6459 }, 6460 6461 _callChildMethod: function( method ) { 6462 this.childWidgets.each( function() { 6463 var element = $( this ), 6464 data = element.data( "ui-controlgroup-data" ); 6465 if ( data && data[ method ] ) { 6466 data[ method ](); 6467 } 6468 } ); 6469 }, 6470 6471 _updateCornerClass: function( element, position ) { 6472 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 6473 var add = this._buildSimpleOptions( position, "label" ).classes.label; 6474 6475 this._removeClass( element, null, remove ); 6476 this._addClass( element, null, add ); 6477 }, 6478 6479 _buildSimpleOptions: function( position, key ) { 6480 var direction = this.options.direction === "vertical"; 6481 var result = { 6482 classes: {} 6483 }; 6484 result.classes[ key ] = { 6485 "middle": "", 6486 "first": "ui-corner-" + ( direction ? "top" : "left" ), 6487 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 6488 "only": "ui-corner-all" 6489 }[ position ]; 6490 6491 return result; 6492 }, 6493 6494 _spinnerOptions: function( position ) { 6495 var options = this._buildSimpleOptions( position, "ui-spinner" ); 6496 6497 options.classes[ "ui-spinner-up" ] = ""; 6498 options.classes[ "ui-spinner-down" ] = ""; 6499 6500 return options; 6501 }, 6502 6503 _buttonOptions: function( position ) { 6504 return this._buildSimpleOptions( position, "ui-button" ); 6505 }, 6506 6507 _checkboxradioOptions: function( position ) { 6508 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 6509 }, 6510 6511 _selectmenuOptions: function( position ) { 6512 var direction = this.options.direction === "vertical"; 6513 return { 6514 width: direction ? "auto" : false, 6515 classes: { 6516 middle: { 6517 "ui-selectmenu-button-open": "", 6518 "ui-selectmenu-button-closed": "" 6519 }, 6520 first: { 6521 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 6522 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 6523 }, 6524 last: { 6525 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 6526 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 6527 }, 6528 only: { 6529 "ui-selectmenu-button-open": "ui-corner-top", 6530 "ui-selectmenu-button-closed": "ui-corner-all" 6531 } 6532 6533 }[ position ] 6534 }; 6535 }, 6536 6537 _resolveClassesValues: function( classes, instance ) { 6538 var result = {}; 6539 $.each( classes, function( key ) { 6540 var current = instance.options.classes[ key ] || ""; 6541 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 6542 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 6543 } ); 6544 return result; 6545 }, 6546 6547 _setOption: function( key, value ) { 6548 if ( key === "direction" ) { 6549 this._removeClass( "ui-controlgroup-" + this.options.direction ); 6550 } 6551 6552 this._super( key, value ); 6553 if ( key === "disabled" ) { 6554 this._callChildMethod( value ? "disable" : "enable" ); 6555 return; 6556 } 6557 6558 this.refresh(); 6559 }, 6560 6561 refresh: function() { 6562 var children, 6563 that = this; 6564 6565 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 6566 6567 if ( this.options.direction === "horizontal" ) { 6568 this._addClass( null, "ui-helper-clearfix" ); 6569 } 6570 this._initWidgets(); 6571 6572 children = this.childWidgets; 6573 6574 // We filter here because we need to track all childWidgets not just the visible ones 6575 if ( this.options.onlyVisible ) { 6576 children = children.filter( ":visible" ); 6577 } 6578 6579 if ( children.length ) { 6580 6581 // We do this last because we need to make sure all enhancment is done 6582 // before determining first and last 6583 $.each( [ "first", "last" ], function( index, value ) { 6584 var instance = children[ value ]().data( "ui-controlgroup-data" ); 6585 6586 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 6587 var options = that[ "_" + instance.widgetName + "Options" ]( 6588 children.length === 1 ? "only" : value 6589 ); 6590 options.classes = that._resolveClassesValues( options.classes, instance ); 6591 instance.element[ instance.widgetName ]( options ); 6592 } else { 6593 that._updateCornerClass( children[ value ](), value ); 6594 } 6595 } ); 6596 6597 // Finally call the refresh method on each of the child widgets. 6598 this._callChildMethod( "refresh" ); 6599 } 6600 } 6601} ); 6602 6603/*! 6604 * jQuery UI Checkboxradio 1.1
vendor: 5,069 bytes, lines 6604-6787
66043.2 6605 * http://jqueryui.com 6606 * 6607 * Copyright jQuery Foundation and other contributors 6608 * Released under the MIT license. 6609 * http://jquery.org/license 6610 */ 6611 6612//>>label: Checkboxradio 6613//>>group: Widgets 6614//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 6615//>>docs: http://api.jqueryui.com/checkboxradio/ 6616//>>demos: http://jqueryui.com/checkboxradio/ 6617//>>css.structure: ../../themes/base/core.css 6618//>>css.structure: ../../themes/base/button.css 6619//>>css.structure: ../../themes/base/checkboxradio.css 6620//>>css.theme: ../../themes/base/theme.css 6621 6622 6623$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 6624 version: "1.13.2", 6625 options: { 6626 disabled: null, 6627 label: null, 6628 icon: true, 6629 classes: { 6630 "ui-checkboxradio-label": "ui-corner-all", 6631 "ui-checkboxradio-icon": "ui-corner-all" 6632 } 6633 }, 6634 6635 _getCreateOptions: function() { 6636 var disabled, labels, labelContents; 6637 var options = this._super() || {}; 6638 6639 // We read the type here, because it makes more sense to throw a element type error first, 6640 // rather then the error for lack of a label. Often if its the wrong type, it 6641 // won't have a label (e.g. calling on a div, btn, etc) 6642 this._readType(); 6643 6644 labels = this.element.labels(); 6645 6646 // If there are multiple labels, use the last one 6647 this.label = $( labels[ labels.length - 1 ] ); 6648 if ( !this.label.length ) { 6649 $.error( "No label found for checkboxradio widget" ); 6650 } 6651 6652 this.originalLabel = ""; 6653 6654 // We need to get the label text but this may also need to make sure it does not contain the 6655 // input itself. 6656 // The label contents could be text, html, or a mix. We wrap all elements 6657 // and read the wrapper's `innerHTML` to get a string representation of 6658 // the label, without the input as part of it. 6659 labelContents = this.label.contents().not( this.element[ 0 ] ); 6660 6661 if ( labelContents.length ) { 6662 this.originalLabel += labelContents 6663 .clone() 6664 .wrapAll( "<div></div>" ) 6665 .parent() 6666 .html(); 6667 } 6668 6669 // Set the label option if we found label text 6670 if ( this.originalLabel ) { 6671 options.label = this.originalLabel; 6672 } 6673 6674 disabled = this.element[ 0 ].disabled; 6675 if ( disabled != null ) { 6676 options.disabled = disabled; 6677 } 6678 return options; 6679 }, 6680 6681 _create: function() { 6682 var checked = this.element[ 0 ].checked; 6683 6684 this._bindFormResetHandler(); 6685 6686 if ( this.options.disabled == null ) { 6687 this.options.disabled = this.element[ 0 ].disabled; 6688 } 6689 6690 this._setOption( "disabled", this.options.disabled ); 6691 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 6692 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 6693 6694 if ( this.type === "radio" ) { 6695 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 6696 } 6697 6698 if ( this.options.label && this.options.label !== this.originalLabel ) { 6699 this._updateLabel(); 6700 } else if ( this.originalLabel ) { 6701 this.options.label = this.originalLabel; 6702 } 6703 6704 this._enhance(); 6705 6706 if ( checked ) { 6707 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 6708 } 6709 6710 this._on( { 6711 change: "_toggleClasses", 6712 focus: function() { 6713 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 6714 }, 6715 blur: function() { 6716 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 6717 } 6718 } ); 6719 }, 6720 6721 _readType: function() { 6722 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 6723 this.type = this.element[ 0 ].type; 6724 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 6725 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 6726 " and element.type=" + this.type ); 6727 } 6728 }, 6729 6730 // Support jQuery Mobile enhanced option 6731 _enhance: function() { 6732 this._updateIcon( this.element[ 0 ].checked ); 6733 }, 6734 6735 widget: function() { 6736 return this.label; 6737 }, 6738 6739 _getRadioGroup: function() { 6740 var group; 6741 var name = this.element[ 0 ].name; 6742 var nameSelector = "input[name='" + $.escapeSelector( name ) + "']"; 6743 6744 if ( !name ) { 6745 return $( [] ); 6746 } 6747 6748 if ( this.form.length ) { 6749 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 6750 } else { 6751 6752 // Not inside a form, check all inputs that also are not inside a form 6753 group = $( nameSelector ).filter( function() { 6754 return $( this )._form().length === 0; 6755 } ); 6756 } 6757 6758 return group.not( this.element ); 6759 }, 6760 6761 _toggleClasses: function() { 6762 var checked = this.element[ 0 ].checked; 6763 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 6764 6765 if ( this.options.icon && this.type === "checkbox" ) { 6766 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 6767 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 6768 } 6769 6770 if ( this.type === "radio" ) { 6771 this._getRadioGroup() 6772 .each( function() { 6773 var instance = $( this ).checkboxradio( "instance" ); 6774 6775 if ( instance ) { 6776 instance._removeClass( instance.label, 6777 "ui-checkboxradio-checked", "ui-state-active" ); 6778 } 6779 } ); 6780 } 6781 }, 6782 6783 _destroy: function() { 6784 this._unbindFormResetHandler(); 6785 6786 if ( this.icon ) { 6787 this.icon.remove();
vendor: 2,708 bytes, lines 6788-6894
6788 this.iconSpace.remove(); 6789 } 6790 }, 6791 6792 _setOption: function( key, value ) { 6793 6794 // We don't allow the value to be set to nothing 6795 if ( key === "label" && !value ) { 6796 return; 6797 } 6798 6799 this._super( key, value ); 6800 6801 if ( key === "disabled" ) { 6802 this._toggleClass( this.label, null, "ui-state-disabled", value ); 6803 this.element[ 0 ].disabled = value; 6804 6805 // Don't refresh when setting disabled 6806 return; 6807 } 6808 this.refresh(); 6809 }, 6810 6811 _updateIcon: function( checked ) { 6812 var toAdd = "ui-icon ui-icon-background "; 6813 6814 if ( this.options.icon ) { 6815 if ( !this.icon ) { 6816 this.icon = $( "<span>" ); 6817 this.iconSpace = $( "<span> </span>" ); 6818 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 6819 } 6820 6821 if ( this.type === "checkbox" ) { 6822 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 6823 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 6824 } else { 6825 toAdd += "ui-icon-blank"; 6826 } 6827 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 6828 if ( !checked ) { 6829 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 6830 } 6831 this.icon.prependTo( this.label ).after( this.iconSpace ); 6832 } else if ( this.icon !== undefined ) { 6833 this.icon.remove(); 6834 this.iconSpace.remove(); 6835 delete this.icon; 6836 } 6837 }, 6838 6839 _updateLabel: function() { 6840 6841 // Remove the contents of the label ( minus the icon, icon space, and input ) 6842 var contents = this.label.contents().not( this.element[ 0 ] ); 6843 if ( this.icon ) { 6844 contents = contents.not( this.icon[ 0 ] ); 6845 } 6846 if ( this.iconSpace ) { 6847 contents = contents.not( this.iconSpace[ 0 ] ); 6848 } 6849 contents.remove(); 6850 6851 this.label.append( this.options.label ); 6852 }, 6853 6854 refresh: function() { 6855 var checked = this.element[ 0 ].checked, 6856 isDisabled = this.element[ 0 ].disabled; 6857 6858 this._updateIcon( checked ); 6859 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 6860 if ( this.options.label !== null ) { 6861 this._updateLabel(); 6862 } 6863 6864 if ( isDisabled !== this.options.disabled ) { 6865 this._setOptions( { "disabled": isDisabled } ); 6866 } 6867 } 6868 6869} ] ); 6870 6871var widgetsCheckboxradio = $.ui.checkboxradio; 6872 6873 6874/*! 6875 * jQuery UI Button 1.13.2 6876 * http://jqueryui.com 6877 * 6878 * Copyright jQuery Foundation and other contributors 6879 * Released under the MIT license. 6880 * http://jquery.org/license 6881 */ 6882 6883//>>label: Button 6884//>>group: Widgets 6885//>>description: Enhances a form with themeable buttons. 6886//>>docs: http://api.jqueryui.com/button/ 6887//>>demos: http://jqueryui.com/button/ 6888//>>css.structure: ../../themes/base/core.css 6889//>>css.structure: ../../themes/base/button.css 6890//>>css.theme: ../../themes/base/theme.css 6891 6892 6893$.widget( "ui.button", { 6894 version: "1.13.2
vendor: 10,836 bytes, lines 6894-7301
6894", 6895 defaultElement: "<button>", 6896 options: { 6897 classes: { 6898 "ui-button": "ui-corner-all" 6899 }, 6900 disabled: null, 6901 icon: null, 6902 iconPosition: "beginning", 6903 label: null, 6904 showLabel: true 6905 }, 6906 6907 _getCreateOptions: function() { 6908 var disabled, 6909 6910 // This is to support cases like in jQuery Mobile where the base widget does have 6911 // an implementation of _getCreateOptions 6912 options = this._super() || {}; 6913 6914 this.isInput = this.element.is( "input" ); 6915 6916 disabled = this.element[ 0 ].disabled; 6917 if ( disabled != null ) { 6918 options.disabled = disabled; 6919 } 6920 6921 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 6922 if ( this.originalLabel ) { 6923 options.label = this.originalLabel; 6924 } 6925 6926 return options; 6927 }, 6928 6929 _create: function() { 6930 if ( !this.option.showLabel & !this.options.icon ) { 6931 this.options.showLabel = true; 6932 } 6933 6934 // We have to check the option again here even though we did in _getCreateOptions, 6935 // because null may have been passed on init which would override what was set in 6936 // _getCreateOptions 6937 if ( this.options.disabled == null ) { 6938 this.options.disabled = this.element[ 0 ].disabled || false; 6939 } 6940 6941 this.hasTitle = !!this.element.attr( "title" ); 6942 6943 // Check to see if the label needs to be set or if its already correct 6944 if ( this.options.label && this.options.label !== this.originalLabel ) { 6945 if ( this.isInput ) { 6946 this.element.val( this.options.label ); 6947 } else { 6948 this.element.html( this.options.label ); 6949 } 6950 } 6951 this._addClass( "ui-button", "ui-widget" ); 6952 this._setOption( "disabled", this.options.disabled ); 6953 this._enhance(); 6954 6955 if ( this.element.is( "a" ) ) { 6956 this._on( { 6957 "keyup": function( event ) { 6958 if ( event.keyCode === $.ui.keyCode.SPACE ) { 6959 event.preventDefault(); 6960 6961 // Support: PhantomJS <= 1.9, IE 8 Only 6962 // If a native click is available use it so we actually cause navigation 6963 // otherwise just trigger a click event 6964 if ( this.element[ 0 ].click ) { 6965 this.element[ 0 ].click(); 6966 } else { 6967 this.element.trigger( "click" ); 6968 } 6969 } 6970 } 6971 } ); 6972 } 6973 }, 6974 6975 _enhance: function() { 6976 if ( !this.element.is( "button" ) ) { 6977 this.element.attr( "role", "button" ); 6978 } 6979 6980 if ( this.options.icon ) { 6981 this._updateIcon( "icon", this.options.icon ); 6982 this._updateTooltip(); 6983 } 6984 }, 6985 6986 _updateTooltip: function() { 6987 this.title = this.element.attr( "title" ); 6988 6989 if ( !this.options.showLabel && !this.title ) { 6990 this.element.attr( "title", this.options.label ); 6991 } 6992 }, 6993 6994 _updateIcon: function( option, value ) { 6995 var icon = option !== "iconPosition", 6996 position = icon ? this.options.iconPosition : value, 6997 displayBlock = position === "top" || position === "bottom"; 6998 6999 // Create icon 7000 if ( !this.icon ) { 7001 this.icon = $( "<span>" ); 7002 7003 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 7004 7005 if ( !this.options.showLabel ) { 7006 this._addClass( "ui-button-icon-only" ); 7007 } 7008 } else if ( icon ) { 7009 7010 // If we are updating the icon remove the old icon class 7011 this._removeClass( this.icon, null, this.options.icon ); 7012 } 7013 7014 // If we are updating the icon add the new icon class 7015 if ( icon ) { 7016 this._addClass( this.icon, null, value ); 7017 } 7018 7019 this._attachIcon( position ); 7020 7021 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 7022 // the iconSpace if there is one. 7023 if ( displayBlock ) { 7024 this._addClass( this.icon, null, "ui-widget-icon-block" ); 7025 if ( this.iconSpace ) { 7026 this.iconSpace.remove(); 7027 } 7028 } else { 7029 7030 // Position is beginning or end so remove the ui-widget-icon-block class and add the 7031 // space if it does not exist 7032 if ( !this.iconSpace ) { 7033 this.iconSpace = $( "<span> </span>" ); 7034 this._addClass( this.iconSpace, "ui-button-icon-space" ); 7035 } 7036 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 7037 this._attachIconSpace( position ); 7038 } 7039 }, 7040 7041 _destroy: function() { 7042 this.element.removeAttr( "role" ); 7043 7044 if ( this.icon ) { 7045 this.icon.remove(); 7046 } 7047 if ( this.iconSpace ) { 7048 this.iconSpace.remove(); 7049 } 7050 if ( !this.hasTitle ) { 7051 this.element.removeAttr( "title" ); 7052 } 7053 }, 7054 7055 _attachIconSpace: function( iconPosition ) { 7056 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 7057 }, 7058 7059 _attachIcon: function( iconPosition ) { 7060 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 7061 }, 7062 7063 _setOptions: function( options ) { 7064 var newShowLabel = options.showLabel === undefined ? 7065 this.options.showLabel : 7066 options.showLabel, 7067 newIcon = options.icon === undefined ? this.options.icon : options.icon; 7068 7069 if ( !newShowLabel && !newIcon ) { 7070 options.showLabel = true; 7071 } 7072 this._super( options ); 7073 }, 7074 7075 _setOption: function( key, value ) { 7076 if ( key === "icon" ) { 7077 if ( value ) { 7078 this._updateIcon( key, value ); 7079 } else if ( this.icon ) { 7080 this.icon.remove(); 7081 if ( this.iconSpace ) { 7082 this.iconSpace.remove(); 7083 } 7084 } 7085 } 7086 7087 if ( key === "iconPosition" ) { 7088 this._updateIcon( key, value ); 7089 } 7090 7091 // Make sure we can't end up with a button that has neither text nor icon 7092 if ( key === "showLabel" ) { 7093 this._toggleClass( "ui-button-icon-only", null, !value ); 7094 this._updateTooltip(); 7095 } 7096 7097 if ( key === "label" ) { 7098 if ( this.isInput ) { 7099 this.element.val( value ); 7100 } else { 7101 7102 // If there is an icon, append it, else nothing then append the value 7103 // this avoids removal of the icon when setting label text 7104 this.element.html( value ); 7105 if ( this.icon ) { 7106 this._attachIcon( this.options.iconPosition ); 7107 this._attachIconSpace( this.options.iconPosition ); 7108 } 7109 } 7110 } 7111 7112 this._super( key, value ); 7113 7114 if ( key === "disabled" ) { 7115 this._toggleClass( null, "ui-state-disabled", value ); 7116 this.element[ 0 ].disabled = value; 7117 if ( value ) { 7118 this.element.trigger( "blur" ); 7119 } 7120 } 7121 }, 7122 7123 refresh: function() { 7124 7125 // Make sure to only check disabled if its an element that supports this otherwise 7126 // check for the disabled class to determine state 7127 var isDisabled = this.element.is( "input, button" ) ? 7128 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 7129 7130 if ( isDisabled !== this.options.disabled ) { 7131 this._setOptions( { disabled: isDisabled } ); 7132 } 7133 7134 this._updateTooltip(); 7135 } 7136} ); 7137 7138// DEPRECATED 7139if ( $.uiBackCompat !== false ) { 7140 7141 // Text and Icons options 7142 $.widget( "ui.button", $.ui.button, { 7143 options: { 7144 text: true, 7145 icons: { 7146 primary: null, 7147 secondary: null 7148 } 7149 }, 7150 7151 _create: function() { 7152 if ( this.options.showLabel && !this.options.text ) { 7153 this.options.showLabel = this.options.text; 7154 } 7155 if ( !this.options.showLabel && this.options.text ) { 7156 this.options.text = this.options.showLabel; 7157 } 7158 if ( !this.options.icon && ( this.options.icons.primary || 7159 this.options.icons.secondary ) ) { 7160 if ( this.options.icons.primary ) { 7161 this.options.icon = this.options.icons.primary; 7162 } else { 7163 this.options.icon = this.options.icons.secondary; 7164 this.options.iconPosition = "end"; 7165 } 7166 } else if ( this.options.icon ) { 7167 this.options.icons.primary = this.options.icon; 7168 } 7169 this._super(); 7170 }, 7171 7172 _setOption: function( key, value ) { 7173 if ( key === "text" ) { 7174 this._super( "showLabel", value ); 7175 return; 7176 } 7177 if ( key === "showLabel" ) { 7178 this.options.text = value; 7179 } 7180 if ( key === "icon" ) { 7181 this.options.icons.primary = value; 7182 } 7183 if ( key === "icons" ) { 7184 if ( value.primary ) { 7185 this._super( "icon", value.primary ); 7186 this._super( "iconPosition", "beginning" ); 7187 } else if ( value.secondary ) { 7188 this._super( "icon", value.secondary ); 7189 this._super( "iconPosition", "end" ); 7190 } 7191 } 7192 this._superApply( arguments ); 7193 } 7194 } ); 7195 7196 $.fn.button = ( function( orig ) { 7197 return function( options ) { 7198 var isMethodCall = typeof options === "string"; 7199 var args = Array.prototype.slice.call( arguments, 1 ); 7200 var returnValue = this; 7201 7202 if ( isMethodCall ) { 7203 7204 // If this is an empty collection, we need to have the instance method 7205 // return undefined instead of the jQuery instance 7206 if ( !this.length && options === "instance" ) { 7207 returnValue = undefined; 7208 } else { 7209 this.each( function() { 7210 var methodValue; 7211 var type = $( this ).attr( "type" ); 7212 var name = type !== "checkbox" && type !== "radio" ? 7213 "button" : 7214 "checkboxradio"; 7215 var instance = $.data( this, "ui-" + name ); 7216 7217 if ( options === "instance" ) { 7218 returnValue = instance; 7219 return false; 7220 } 7221 7222 if ( !instance ) { 7223 return $.error( "cannot call methods on button" + 7224 " prior to initialization; " + 7225 "attempted to call method '" + options + "'" ); 7226 } 7227 7228 if ( typeof instance[ options ] !== "function" || 7229 options.charAt( 0 ) === "_" ) { 7230 return $.error( "no such method '" + options + "' for button" + 7231 " widget instance" ); 7232 } 7233 7234 methodValue = instance[ options ].apply( instance, args ); 7235 7236 if ( methodValue !== instance && methodValue !== undefined ) { 7237 returnValue = methodValue && methodValue.jquery ? 7238 returnValue.pushStack( methodValue.get() ) : 7239 methodValue; 7240 return false; 7241 } 7242 } ); 7243 } 7244 } else { 7245 7246 // Allow multiple hashes to be passed on init 7247 if ( args.length ) { 7248 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 7249 } 7250 7251 this.each( function() { 7252 var type = $( this ).attr( "type" ); 7253 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 7254 var instance = $.data( this, "ui-" + name ); 7255 7256 if ( instance ) { 7257 instance.option( options || {} ); 7258 if ( instance._init ) { 7259 instance._init(); 7260 } 7261 } else { 7262 if ( name === "button" ) { 7263 orig.call( $( this ), options ); 7264 return; 7265 } 7266 7267 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 7268 } 7269 } ); 7270 } 7271 7272 return returnValue; 7273 }; 7274 } )( $.fn.button ); 7275 7276 $.fn.buttonset = function() { 7277 if ( !$.ui.controlgroup ) { 7278 $.error( "Controlgroup widget missing" ); 7279 } 7280 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 7281 return this.controlgroup.apply( this, 7282 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 7283 } 7284 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 7285 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 7286 } 7287 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 7288 arguments[ 0 ].items = { 7289 button: arguments[ 0 ].items 7290 }; 7291 } 7292 return this.controlgroup.apply( this, arguments ); 7293 }; 7294} 7295 7296var widgetsButton = $.ui.button; 7297 7298 7299/* eslint-disable max-len, camelcase */ 7300/*! 7301 * jQuery UI Datepicker 1.13.
73012 7302 * http://jqueryui.com 7303 * 7304 * Copyright jQuery Foundation and other contributors 7305 * Released under the MIT license. 7306 * http://jquery.org/license 7307 */ 7308 7309//>>label: Datepicker 7310//>>group: Widgets 7311//>>description: Displays a calendar from an input or inline for selecting dates. 7312//>>docs: http://api.jqueryui.com/datepicker/ 7313//>>demos: http://jqueryui.com/datepicker/ 7314//>>css.structure: ../../themes/base/core.css 7315//>>css.structure: ../../themes/base/datepicker.css 7316//>>css.theme: ../../themes/base/theme.css 7317 7318 7319$.extend( $.ui, { datepicker: { version: "1.13
vendor: 14,164 bytes, lines 7319-7636
7319.2" } } ); 7320 7321var datepicker_instActive; 7322 7323function datepicker_getZindex( elem ) { 7324 var position, value; 7325 while ( elem.length && elem[ 0 ] !== document ) { 7326 7327 // Ignore z-index if position is set to a value where z-index is ignored by the browser 7328 // This makes behavior of this function consistent across browsers 7329 // WebKit always returns auto if the element is positioned 7330 position = elem.css( "position" ); 7331 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 7332 7333 // IE returns 0 when zIndex is not specified 7334 // other browsers return a string 7335 // we ignore the case of nested elements with an explicit value of 0 7336 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 7337 value = parseInt( elem.css( "zIndex" ), 10 ); 7338 if ( !isNaN( value ) && value !== 0 ) { 7339 return value; 7340 } 7341 } 7342 elem = elem.parent(); 7343 } 7344 7345 return 0; 7346} 7347 7348/* Date picker manager. 7349 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 7350 Settings for (groups of) date pickers are maintained in an instance object, 7351 allowing multiple different settings on the same page. */ 7352 7353function Datepicker() { 7354 this._curInst = null; // The current instance in use 7355 this._keyEvent = false; // If the last event was a key event 7356 this._disabledInputs = []; // List of date picker inputs that have been disabled 7357 this._datepickerShowing = false; // True if the popup picker is showing , false if not 7358 this._inDialog = false; // True if showing within a "dialog", false if not 7359 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 7360 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 7361 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 7362 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 7363 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 7364 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 7365 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 7366 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 7367 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 7368 this.regional = []; // Available regional settings, indexed by language code 7369 this.regional[ "" ] = { // Default regional settings 7370 closeText: "Done", // Display text for close link 7371 prevText: "Prev", // Display text for previous month link 7372 nextText: "Next", // Display text for next month link 7373 currentText: "Today", // Display text for current month link 7374 monthNames: [ "January", "February", "March", "April", "May", "June", 7375 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 7376 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 7377 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 7378 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 7379 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 7380 weekHeader: "Wk", // Column header for week of the year 7381 dateFormat: "mm/dd/yy", // See format options on parseDate 7382 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 7383 isRTL: false, // True if right-to-left language, false if left-to-right 7384 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 7385 yearSuffix: "", // Additional text to append to the year in the month headers, 7386 selectMonthLabel: "Select month", // Invisible label for month selector 7387 selectYearLabel: "Select year" // Invisible label for year selector 7388 }; 7389 this._defaults = { // Global defaults for all the date picker instances 7390 showOn: "focus", // "focus" for popup on focus, 7391 // "button" for trigger button, or "both" for either 7392 showAnim: "fadeIn", // Name of jQuery animation for popup 7393 showOptions: {}, // Options for enhanced animations 7394 defaultDate: null, // Used when field is blank: actual date, 7395 // +/-number for offset from today, null for today 7396 appendText: "", // Display text following the input box, e.g. showing the format 7397 buttonText: "...", // Text for trigger button 7398 buttonImage: "", // URL for trigger button image 7399 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 7400 hideIfNoPrevNext: false, // True to hide next/previous month links 7401 // if not applicable, false to just disable them 7402 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 7403 gotoCurrent: false, // True if today link goes back to current selection instead 7404 changeMonth: false, // True if month can be selected directly, false if only prev/next 7405 changeYear: false, // True if year can be selected directly, false if only prev/next 7406 yearRange: "c-10:c+10", // Range of years to display in drop-down, 7407 // either relative to today's year (-nn:+nn), relative to currently displayed year 7408 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 7409 showOtherMonths: false, // True to show dates in other months, false to leave blank 7410 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 7411 showWeek: false, // True to show week of the year, false to not show it 7412 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 7413 // takes a Date and returns the number of the week for it 7414 shortYearCutoff: "+10", // Short year values < this are in the current century, 7415 // > this are in the previous century, 7416 // string value starting with "+" for current year + value 7417 minDate: null, // The earliest selectable date, or null for no limit 7418 maxDate: null, // The latest selectable date, or null for no limit 7419 duration: "fast", // Duration of display/closure 7420 beforeShowDay: null, // Function that takes a date and returns an array with 7421 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 7422 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 7423 beforeShow: null, // Function that takes an input field and 7424 // returns a set of custom settings for the date picker 7425 onSelect: null, // Define a callback function when a date is selected 7426 onChangeMonthYear: null, // Define a callback function when the month or year is changed 7427 onClose: null, // Define a callback function when the datepicker is closed 7428 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 7429 numberOfMonths: 1, // Number of months to show at a time 7430 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 7431 stepMonths: 1, // Number of months to step back/forward 7432 stepBigMonths: 12, // Number of months to step back/forward for the big links 7433 altField: "", // Selector for an alternate field to store selected dates into 7434 altFormat: "", // The date format to use for the alternate field 7435 constrainInput: true, // The input is constrained by the current date format 7436 showButtonPanel: false, // True to show button panel, false to not show it 7437 autoSize: false, // True to size the input for the date format, false to leave as is 7438 disabled: false // The initial disabled state 7439 }; 7440 $.extend( this._defaults, this.regional[ "" ] ); 7441 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 7442 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 7443 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 7444} 7445 7446$.extend( Datepicker.prototype, { 7447 7448 /* Class name added to elements to indicate already configured with a date picker. */ 7449 markerClassName: "hasDatepicker", 7450 7451 //Keep track of the maximum number of rows displayed (see #7043) 7452 maxRows: 4, 7453 7454 // TODO rename to "widget" when switching to widget factory 7455 _widgetDatepicker: function() { 7456 return this.dpDiv; 7457 }, 7458 7459 /* Override the default settings for all instances of the date picker. 7460 * @param settings object - the new settings to use as defaults (anonymous object) 7461 * @return the manager object 7462 */ 7463 setDefaults: function( settings ) { 7464 datepicker_extendRemove( this._defaults, settings || {} ); 7465 return this; 7466 }, 7467 7468 /* Attach the date picker to a jQuery selection. 7469 * @param target element - the target input field or division or span 7470 * @param settings object - the new settings to use for this date picker instance (anonymous) 7471 */ 7472 _attachDatepicker: function( target, settings ) { 7473 var nodeName, inline, inst; 7474 nodeName = target.nodeName.toLowerCase(); 7475 inline = ( nodeName === "div" || nodeName === "span" ); 7476 if ( !target.id ) { 7477 this.uuid += 1; 7478 target.id = "dp" + this.uuid; 7479 } 7480 inst = this._newInst( $( target ), inline ); 7481 inst.settings = $.extend( {}, settings || {} ); 7482 if ( nodeName === "input" ) { 7483 this._connectDatepicker( target, inst ); 7484 } else if ( inline ) { 7485 this._inlineDatepicker( target, inst ); 7486 } 7487 }, 7488 7489 /* Create a new instance object. */ 7490 _newInst: function( target, inline ) { 7491 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 7492 return { id: id, input: target, // associated target 7493 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 7494 drawMonth: 0, drawYear: 0, // month being drawn 7495 inline: inline, // is datepicker inline or not 7496 dpDiv: ( !inline ? this.dpDiv : // presentation div 7497 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 7498 }, 7499 7500 /* Attach the date picker to an input field. */ 7501 _connectDatepicker: function( target, inst ) { 7502 var input = $( target ); 7503 inst.append = $( [] ); 7504 inst.trigger = $( [] ); 7505 if ( input.hasClass( this.markerClassName ) ) { 7506 return; 7507 } 7508 this._attachments( input, inst ); 7509 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 7510 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 7511 this._autoSize( inst ); 7512 $.data( target, "datepicker", inst ); 7513 7514 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 7515 if ( inst.settings.disabled ) { 7516 this._disableDatepicker( target ); 7517 } 7518 }, 7519 7520 /* Make attachments based on settings. */ 7521 _attachments: function( input, inst ) { 7522 var showOn, buttonText, buttonImage, 7523 appendText = this._get( inst, "appendText" ), 7524 isRTL = this._get( inst, "isRTL" ); 7525 7526 if ( inst.append ) { 7527 inst.append.remove(); 7528 } 7529 if ( appendText ) { 7530 inst.append = $( "<span>" ) 7531 .addClass( this._appendClass ) 7532 .text( appendText ); 7533 input[ isRTL ? "before" : "after" ]( inst.append ); 7534 } 7535 7536 input.off( "focus", this._showDatepicker ); 7537 7538 if ( inst.trigger ) { 7539 inst.trigger.remove(); 7540 } 7541 7542 showOn = this._get( inst, "showOn" ); 7543 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 7544 input.on( "focus", this._showDatepicker ); 7545 } 7546 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 7547 buttonText = this._get( inst, "buttonText" ); 7548 buttonImage = this._get( inst, "buttonImage" ); 7549 7550 if ( this._get( inst, "buttonImageOnly" ) ) { 7551 inst.trigger = $( "<img>" ) 7552 .addClass( this._triggerClass ) 7553 .attr( { 7554 src: buttonImage, 7555 alt: buttonText, 7556 title: buttonText 7557 } ); 7558 } else { 7559 inst.trigger = $( "<button type='button'>" ) 7560 .addClass( this._triggerClass ); 7561 if ( buttonImage ) { 7562 inst.trigger.html( 7563 $( "<img>" ) 7564 .attr( { 7565 src: buttonImage, 7566 alt: buttonText, 7567 title: buttonText 7568 } ) 7569 ); 7570 } else { 7571 inst.trigger.text( buttonText ); 7572 } 7573 } 7574 7575 input[ isRTL ? "before" : "after" ]( inst.trigger ); 7576 inst.trigger.on( "click", function() { 7577 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 7578 $.datepicker._hideDatepicker(); 7579 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 7580 $.datepicker._hideDatepicker(); 7581 $.datepicker._showDatepicker( input[ 0 ] ); 7582 } else { 7583 $.datepicker._showDatepicker( input[ 0 ] ); 7584 } 7585 return false; 7586 } ); 7587 } 7588 }, 7589 7590 /* Apply the maximum length for the date format. */ 7591 _autoSize: function( inst ) { 7592 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 7593 var findMax, max, maxI, i, 7594 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 7595 dateFormat = this._get( inst, "dateFormat" ); 7596 7597 if ( dateFormat.match( /[DM]/ ) ) { 7598 findMax = function( names ) { 7599 max = 0; 7600 maxI = 0; 7601 for ( i = 0; i < names.length; i++ ) { 7602 if ( names[ i ].length > max ) { 7603 max = names[ i ].length; 7604 maxI = i; 7605 } 7606 } 7607 return maxI; 7608 }; 7609 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 7610 "monthNames" : "monthNamesShort" ) ) ) ); 7611 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 7612 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 7613 } 7614 inst.input.attr( "size", this._formatDate( inst, date ).length ); 7615 } 7616 }, 7617 7618 /* Attach an inline date picker to a div. */ 7619 _inlineDatepicker: function( target, inst ) { 7620 var divSpan = $( target ); 7621 if ( divSpan.hasClass( this.markerClassName ) ) { 7622 return; 7623 } 7624 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 7625 $.data( target, "datepicker", inst ); 7626 this._setDate( inst, this._getDefaultDate( inst ), true ); 7627 this._updateDatepicker( inst ); 7628 this._updateAlternate( inst ); 7629 7630 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 7631 if ( inst.settings.disabled ) { 7632 this._disableDatepicker( target ); 7633 } 7634 7635 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 7636 // http
vendor: 14,693 bytes, lines 7636-8058
7636://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 7637 inst.dpDiv.css( "display", "block" ); 7638 }, 7639 7640 /* Pop-up the date picker in a "dialog" box. 7641 * @param input element - ignored 7642 * @param date string or Date - the initial date to display 7643 * @param onSelect function - the function to call when a date is selected 7644 * @param settings object - update the dialog date picker instance's settings (anonymous object) 7645 * @param pos int[2] - coordinates for the dialog's position within the screen or 7646 * event - with x/y coordinates or 7647 * leave empty for default (screen centre) 7648 * @return the manager object 7649 */ 7650 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 7651 var id, browserWidth, browserHeight, scrollX, scrollY, 7652 inst = this._dialogInst; // internal instance 7653 7654 if ( !inst ) { 7655 this.uuid += 1; 7656 id = "dp" + this.uuid; 7657 this._dialogInput = $( "<input type='text' id='" + id + 7658 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 7659 this._dialogInput.on( "keydown", this._doKeyDown ); 7660 $( "body" ).append( this._dialogInput ); 7661 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 7662 inst.settings = {}; 7663 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7664 } 7665 datepicker_extendRemove( inst.settings, settings || {} ); 7666 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 7667 this._dialogInput.val( date ); 7668 7669 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 7670 if ( !this._pos ) { 7671 browserWidth = document.documentElement.clientWidth; 7672 browserHeight = document.documentElement.clientHeight; 7673 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 7674 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 7675 this._pos = // should use actual width/height below 7676 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 7677 } 7678 7679 // Move input on screen for focus, but hidden behind dialog 7680 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 7681 inst.settings.onSelect = onSelect; 7682 this._inDialog = true; 7683 this.dpDiv.addClass( this._dialogClass ); 7684 this._showDatepicker( this._dialogInput[ 0 ] ); 7685 if ( $.blockUI ) { 7686 $.blockUI( this.dpDiv ); 7687 } 7688 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 7689 return this; 7690 }, 7691 7692 /* Detach a datepicker from its control. 7693 * @param target element - the target input field or division or span 7694 */ 7695 _destroyDatepicker: function( target ) { 7696 var nodeName, 7697 $target = $( target ), 7698 inst = $.data( target, "datepicker" ); 7699 7700 if ( !$target.hasClass( this.markerClassName ) ) { 7701 return; 7702 } 7703 7704 nodeName = target.nodeName.toLowerCase(); 7705 $.removeData( target, "datepicker" ); 7706 if ( nodeName === "input" ) { 7707 inst.append.remove(); 7708 inst.trigger.remove(); 7709 $target.removeClass( this.markerClassName ). 7710 off( "focus", this._showDatepicker ). 7711 off( "keydown", this._doKeyDown ). 7712 off( "keypress", this._doKeyPress ). 7713 off( "keyup", this._doKeyUp ); 7714 } else if ( nodeName === "div" || nodeName === "span" ) { 7715 $target.removeClass( this.markerClassName ).empty(); 7716 } 7717 7718 if ( datepicker_instActive === inst ) { 7719 datepicker_instActive = null; 7720 this._curInst = null; 7721 } 7722 }, 7723 7724 /* Enable the date picker to a jQuery selection. 7725 * @param target element - the target input field or division or span 7726 */ 7727 _enableDatepicker: function( target ) { 7728 var nodeName, inline, 7729 $target = $( target ), 7730 inst = $.data( target, "datepicker" ); 7731 7732 if ( !$target.hasClass( this.markerClassName ) ) { 7733 return; 7734 } 7735 7736 nodeName = target.nodeName.toLowerCase(); 7737 if ( nodeName === "input" ) { 7738 target.disabled = false; 7739 inst.trigger.filter( "button" ). 7740 each( function() { 7741 this.disabled = false; 7742 } ).end(). 7743 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 7744 } else if ( nodeName === "div" || nodeName === "span" ) { 7745 inline = $target.children( "." + this._inlineClass ); 7746 inline.children().removeClass( "ui-state-disabled" ); 7747 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7748 prop( "disabled", false ); 7749 } 7750 this._disabledInputs = $.map( this._disabledInputs, 7751 7752 // Delete entry 7753 function( value ) { 7754 return ( value === target ? null : value ); 7755 } ); 7756 }, 7757 7758 /* Disable the date picker to a jQuery selection. 7759 * @param target element - the target input field or division or span 7760 */ 7761 _disableDatepicker: function( target ) { 7762 var nodeName, inline, 7763 $target = $( target ), 7764 inst = $.data( target, "datepicker" ); 7765 7766 if ( !$target.hasClass( this.markerClassName ) ) { 7767 return; 7768 } 7769 7770 nodeName = target.nodeName.toLowerCase(); 7771 if ( nodeName === "input" ) { 7772 target.disabled = true; 7773 inst.trigger.filter( "button" ). 7774 each( function() { 7775 this.disabled = true; 7776 } ).end(). 7777 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 7778 } else if ( nodeName === "div" || nodeName === "span" ) { 7779 inline = $target.children( "." + this._inlineClass ); 7780 inline.children().addClass( "ui-state-disabled" ); 7781 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 7782 prop( "disabled", true ); 7783 } 7784 this._disabledInputs = $.map( this._disabledInputs, 7785 7786 // Delete entry 7787 function( value ) { 7788 return ( value === target ? null : value ); 7789 } ); 7790 this._disabledInputs[ this._disabledInputs.length ] = target; 7791 }, 7792 7793 /* Is the first field in a jQuery collection disabled as a datepicker? 7794 * @param target element - the target input field or division or span 7795 * @return boolean - true if disabled, false if enabled 7796 */ 7797 _isDisabledDatepicker: function( target ) { 7798 if ( !target ) { 7799 return false; 7800 } 7801 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 7802 if ( this._disabledInputs[ i ] === target ) { 7803 return true; 7804 } 7805 } 7806 return false; 7807 }, 7808 7809 /* Retrieve the instance data for the target control. 7810 * @param target element - the target input field or division or span 7811 * @return object - the associated instance data 7812 * @throws error if a jQuery problem getting data 7813 */ 7814 _getInst: function( target ) { 7815 try { 7816 return $.data( target, "datepicker" ); 7817 } catch ( err ) { 7818 throw "Missing instance data for this datepicker"; 7819 } 7820 }, 7821 7822 /* Update or retrieve the settings for a date picker attached to an input field or division. 7823 * @param target element - the target input field or division or span 7824 * @param name object - the new settings to update or 7825 * string - the name of the setting to change or retrieve, 7826 * when retrieving also "all" for all instance settings or 7827 * "defaults" for all global defaults 7828 * @param value any - the new value for the setting 7829 * (omit if above is an object or to retrieve a value) 7830 */ 7831 _optionDatepicker: function( target, name, value ) { 7832 var settings, date, minDate, maxDate, 7833 inst = this._getInst( target ); 7834 7835 if ( arguments.length === 2 && typeof name === "string" ) { 7836 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 7837 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 7838 this._get( inst, name ) ) : null ) ); 7839 } 7840 7841 settings = name || {}; 7842 if ( typeof name === "string" ) { 7843 settings = {}; 7844 settings[ name ] = value; 7845 } 7846 7847 if ( inst ) { 7848 if ( this._curInst === inst ) { 7849 this._hideDatepicker(); 7850 } 7851 7852 date = this._getDateDatepicker( target, true ); 7853 minDate = this._getMinMaxDate( inst, "min" ); 7854 maxDate = this._getMinMaxDate( inst, "max" ); 7855 datepicker_extendRemove( inst.settings, settings ); 7856 7857 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 7858 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 7859 inst.settings.minDate = this._formatDate( inst, minDate ); 7860 } 7861 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 7862 inst.settings.maxDate = this._formatDate( inst, maxDate ); 7863 } 7864 if ( "disabled" in settings ) { 7865 if ( settings.disabled ) { 7866 this._disableDatepicker( target ); 7867 } else { 7868 this._enableDatepicker( target ); 7869 } 7870 } 7871 this._attachments( $( target ), inst ); 7872 this._autoSize( inst ); 7873 this._setDate( inst, date ); 7874 this._updateAlternate( inst ); 7875 this._updateDatepicker( inst ); 7876 } 7877 }, 7878 7879 // Change method deprecated 7880 _changeDatepicker: function( target, name, value ) { 7881 this._optionDatepicker( target, name, value ); 7882 }, 7883 7884 /* Redraw the date picker attached to an input field or division. 7885 * @param target element - the target input field or division or span 7886 */ 7887 _refreshDatepicker: function( target ) { 7888 var inst = this._getInst( target ); 7889 if ( inst ) { 7890 this._updateDatepicker( inst ); 7891 } 7892 }, 7893 7894 /* Set the dates for a jQuery selection. 7895 * @param target element - the target input field or division or span 7896 * @param date Date - the new date 7897 */ 7898 _setDateDatepicker: function( target, date ) { 7899 var inst = this._getInst( target ); 7900 if ( inst ) { 7901 this._setDate( inst, date ); 7902 this._updateDatepicker( inst ); 7903 this._updateAlternate( inst ); 7904 } 7905 }, 7906 7907 /* Get the date(s) for the first entry in a jQuery selection. 7908 * @param target element - the target input field or division or span 7909 * @param noDefault boolean - true if no default date is to be used 7910 * @return Date - the current date 7911 */ 7912 _getDateDatepicker: function( target, noDefault ) { 7913 var inst = this._getInst( target ); 7914 if ( inst && !inst.inline ) { 7915 this._setDateFromField( inst, noDefault ); 7916 } 7917 return ( inst ? this._getDate( inst ) : null ); 7918 }, 7919 7920 /* Handle keystrokes. */ 7921 _doKeyDown: function( event ) { 7922 var onSelect, dateStr, sel, 7923 inst = $.datepicker._getInst( event.target ), 7924 handled = true, 7925 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 7926 7927 inst._keyEvent = true; 7928 if ( $.datepicker._datepickerShowing ) { 7929 switch ( event.keyCode ) { 7930 case 9: $.datepicker._hideDatepicker(); 7931 handled = false; 7932 break; // hide on tab out 7933 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 7934 $.datepicker._currentClass + ")", inst.dpDiv ); 7935 if ( sel[ 0 ] ) { 7936 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 7937 } 7938 7939 onSelect = $.datepicker._get( inst, "onSelect" ); 7940 if ( onSelect ) { 7941 dateStr = $.datepicker._formatDate( inst ); 7942 7943 // Trigger custom callback 7944 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 7945 } else { 7946 $.datepicker._hideDatepicker(); 7947 } 7948 7949 return false; // don't submit the form 7950 case 27: $.datepicker._hideDatepicker(); 7951 break; // hide on escape 7952 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7953 -$.datepicker._get( inst, "stepBigMonths" ) : 7954 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7955 break; // previous month/year on page up/+ ctrl 7956 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7957 +$.datepicker._get( inst, "stepBigMonths" ) : 7958 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7959 break; // next month/year on page down/+ ctrl 7960 case 35: if ( event.ctrlKey || event.metaKey ) { 7961 $.datepicker._clearDate( event.target ); 7962 } 7963 handled = event.ctrlKey || event.metaKey; 7964 break; // clear on ctrl or command +end 7965 case 36: if ( event.ctrlKey || event.metaKey ) { 7966 $.datepicker._gotoToday( event.target ); 7967 } 7968 handled = event.ctrlKey || event.metaKey; 7969 break; // current on ctrl or command +home 7970 case 37: if ( event.ctrlKey || event.metaKey ) { 7971 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 7972 } 7973 handled = event.ctrlKey || event.metaKey; 7974 7975 // -1 day on ctrl or command +left 7976 if ( event.originalEvent.altKey ) { 7977 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7978 -$.datepicker._get( inst, "stepBigMonths" ) : 7979 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7980 } 7981 7982 // next month/year on alt +left on Mac 7983 break; 7984 case 38: if ( event.ctrlKey || event.metaKey ) { 7985 $.datepicker._adjustDate( event.target, -7, "D" ); 7986 } 7987 handled = event.ctrlKey || event.metaKey; 7988 break; // -1 week on ctrl or command +up 7989 case 39: if ( event.ctrlKey || event.metaKey ) { 7990 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 7991 } 7992 handled = event.ctrlKey || event.metaKey; 7993 7994 // +1 day on ctrl or command +right 7995 if ( event.originalEvent.altKey ) { 7996 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 7997 +$.datepicker._get( inst, "stepBigMonths" ) : 7998 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 7999 } 8000 8001 // next month/year on alt +right 8002 break; 8003 case 40: if ( event.ctrlKey || event.metaKey ) { 8004 $.datepicker._adjustDate( event.target, +7, "D" ); 8005 } 8006 handled = event.ctrlKey || event.metaKey; 8007 break; // +1 week on ctrl or command +down 8008 default: handled = false; 8009 } 8010 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 8011 $.datepicker._showDatepicker( this ); 8012 } else { 8013 handled = false; 8014 } 8015 8016 if ( handled ) { 8017 event.preventDefault(); 8018 event.stopPropagation(); 8019 } 8020 }, 8021 8022 /* Filter entered characters - based on date format. */ 8023 _doKeyPress: function( event ) { 8024 var chars, chr, 8025 inst = $.datepicker._getInst( event.target ); 8026 8027 if ( $.datepicker._get( inst, "constrainInput" ) ) { 8028 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 8029 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 8030 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 8031 } 8032 }, 8033 8034 /* Synchronise manual entry and field/alternate field. */ 8035 _doKeyUp: function( event ) { 8036 var date, 8037 inst = $.datepicker._getInst( event.target ); 8038 8039 if ( inst.input.val() !== inst.lastVal ) { 8040 try { 8041 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8042 ( inst.input ? inst.input.val() : null ), 8043 $.datepicker._getFormatConfig( inst ) ); 8044 8045 if ( date ) { // only if valid 8046 $.datepicker._setDateFromField( inst ); 8047 $.datepicker._updateAlternate( inst ); 8048 $.datepicker._updateDatepicker( inst ); 8049 } 8050 } catch ( err ) { 8051 } 8052 } 8053 return true; 8054 }, 8055 8056 /* Pop-up the date picker for a given input field. 8057 * If false returned from beforeShow event handler do not show. 8058 * @param input element - the input field attached to the date picker or
vendor: 4,332 bytes, lines 8059-8181
8059 * event - if triggered by focus 8060 */ 8061 _showDatepicker: function( input ) { 8062 input = input.target || input; 8063 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 8064 input = $( "input", input.parentNode )[ 0 ]; 8065 } 8066 8067 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 8068 return; 8069 } 8070 8071 var inst, beforeShow, beforeShowSettings, isFixed, 8072 offset, showAnim, duration; 8073 8074 inst = $.datepicker._getInst( input ); 8075 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 8076 $.datepicker._curInst.dpDiv.stop( true, true ); 8077 if ( inst && $.datepicker._datepickerShowing ) { 8078 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 8079 } 8080 } 8081 8082 beforeShow = $.datepicker._get( inst, "beforeShow" ); 8083 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 8084 if ( beforeShowSettings === false ) { 8085 return; 8086 } 8087 datepicker_extendRemove( inst.settings, beforeShowSettings ); 8088 8089 inst.lastVal = null; 8090 $.datepicker._lastInput = input; 8091 $.datepicker._setDateFromField( inst ); 8092 8093 if ( $.datepicker._inDialog ) { // hide cursor 8094 input.value = ""; 8095 } 8096 if ( !$.datepicker._pos ) { // position below input 8097 $.datepicker._pos = $.datepicker._findPos( input ); 8098 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 8099 } 8100 8101 isFixed = false; 8102 $( input ).parents().each( function() { 8103 isFixed |= $( this ).css( "position" ) === "fixed"; 8104 return !isFixed; 8105 } ); 8106 8107 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 8108 $.datepicker._pos = null; 8109 8110 //to avoid flashes on Firefox 8111 inst.dpDiv.empty(); 8112 8113 // determine sizing offscreen 8114 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 8115 $.datepicker._updateDatepicker( inst ); 8116 8117 // fix width for dynamic number of date pickers 8118 // and adjust position before showing 8119 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 8120 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 8121 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 8122 left: offset.left + "px", top: offset.top + "px" } ); 8123 8124 if ( !inst.inline ) { 8125 showAnim = $.datepicker._get( inst, "showAnim" ); 8126 duration = $.datepicker._get( inst, "duration" ); 8127 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 8128 $.datepicker._datepickerShowing = true; 8129 8130 if ( $.effects && $.effects.effect[ showAnim ] ) { 8131 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 8132 } else { 8133 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 8134 } 8135 8136 if ( $.datepicker._shouldFocusInput( inst ) ) { 8137 inst.input.trigger( "focus" ); 8138 } 8139 8140 $.datepicker._curInst = inst; 8141 } 8142 }, 8143 8144 /* Generate the date picker content. */ 8145 _updateDatepicker: function( inst ) { 8146 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 8147 datepicker_instActive = inst; // for delegate hover events 8148 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 8149 this._attachHandlers( inst ); 8150 8151 var origyearshtml, 8152 numMonths = this._getNumberOfMonths( inst ), 8153 cols = numMonths[ 1 ], 8154 width = 17, 8155 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 8156 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 8157 8158 if ( activeCell.length > 0 ) { 8159 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 8160 } 8161 8162 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 8163 if ( cols > 1 ) { 8164 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 8165 } 8166 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 8167 "Class" ]( "ui-datepicker-multi" ); 8168 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 8169 "Class" ]( "ui-datepicker-rtl" ); 8170 8171 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 8172 inst.input.trigger( "focus" ); 8173 } 8174 8175 // Deffered render of the years select (to avoid flashes on Firefox) 8176 if ( inst.yearshtml ) { 8177 origyearshtml = inst.yearshtml; 8178 setTimeout( function() { 8179 8180 //assure that inst.yearshtml didn't change. 8181 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
vendor: 5,508 bytes, lines 8182-8340
8182 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 8183 } 8184 origyearshtml = inst.yearshtml = null; 8185 }, 0 ); 8186 } 8187 8188 if ( onUpdateDatepicker ) { 8189 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 8190 } 8191 }, 8192 8193 // #6694 - don't focus the input if it's already focused 8194 // this breaks the change event in IE 8195 // Support: IE and jQuery <1.9 8196 _shouldFocusInput: function( inst ) { 8197 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); 8198 }, 8199 8200 /* Check positioning to remain on screen. */ 8201 _checkOffset: function( inst, offset, isFixed ) { 8202 var dpWidth = inst.dpDiv.outerWidth(), 8203 dpHeight = inst.dpDiv.outerHeight(), 8204 inputWidth = inst.input ? inst.input.outerWidth() : 0, 8205 inputHeight = inst.input ? inst.input.outerHeight() : 0, 8206 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 8207 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 8208 8209 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 8210 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 8211 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 8212 8213 // Now check if datepicker is showing outside window viewport - move to a better place if so. 8214 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 8215 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 8216 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 8217 Math.abs( dpHeight + inputHeight ) : 0 ); 8218 8219 return offset; 8220 }, 8221 8222 /* Find an object's position on the screen. */ 8223 _findPos: function( obj ) { 8224 var position, 8225 inst = this._getInst( obj ), 8226 isRTL = this._get( inst, "isRTL" ); 8227 8228 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 8229 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 8230 } 8231 8232 position = $( obj ).offset(); 8233 return [ position.left, position.top ]; 8234 }, 8235 8236 /* Hide the date picker from view. 8237 * @param input element - the input field attached to the date picker 8238 */ 8239 _hideDatepicker: function( input ) { 8240 var showAnim, duration, postProcess, onClose, 8241 inst = this._curInst; 8242 8243 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 8244 return; 8245 } 8246 8247 if ( this._datepickerShowing ) { 8248 showAnim = this._get( inst, "showAnim" ); 8249 duration = this._get( inst, "duration" ); 8250 postProcess = function() { 8251 $.datepicker._tidyDialog( inst ); 8252 }; 8253 8254 // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed 8255 if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { 8256 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 8257 } else { 8258 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 8259 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 8260 } 8261 8262 if ( !showAnim ) { 8263 postProcess(); 8264 } 8265 this._datepickerShowing = false; 8266 8267 onClose = this._get( inst, "onClose" ); 8268 if ( onClose ) { 8269 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 8270 } 8271 8272 this._lastInput = null; 8273 if ( this._inDialog ) { 8274 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 8275 if ( $.blockUI ) { 8276 $.unblockUI(); 8277 $( "body" ).append( this.dpDiv ); 8278 } 8279 } 8280 this._inDialog = false; 8281 } 8282 }, 8283 8284 /* Tidy up after a dialog display. */ 8285 _tidyDialog: function( inst ) { 8286 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 8287 }, 8288 8289 /* Close date picker if clicked elsewhere. */ 8290 _checkExternalClick: function( event ) { 8291 if ( !$.datepicker._curInst ) { 8292 return; 8293 } 8294 8295 var $target = $( event.target ), 8296 inst = $.datepicker._getInst( $target[ 0 ] ); 8297 8298 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 8299 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 8300 !$target.hasClass( $.datepicker.markerClassName ) && 8301 !$target.closest( "." + $.datepicker._triggerClass ).length && 8302 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 8303 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 8304 $.datepicker._hideDatepicker(); 8305 } 8306 }, 8307 8308 /* Adjust one of the date sub-fields. */ 8309 _adjustDate: function( id, offset, period ) { 8310 var target = $( id ), 8311 inst = this._getInst( target[ 0 ] ); 8312 8313 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 8314 return; 8315 } 8316 this._adjustInstDate( inst, offset, period ); 8317 this._updateDatepicker( inst ); 8318 }, 8319 8320 /* Action for current link. */ 8321 _gotoToday: function( id ) { 8322 var date, 8323 target = $( id ), 8324 inst = this._getInst( target[ 0 ] ); 8325 8326 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 8327 inst.selectedDay = inst.currentDay; 8328 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 8329 inst.drawYear = inst.selectedYear = inst.currentYear; 8330 } else { 8331 date = new Date(); 8332 inst.selectedDay = date.getDate(); 8333 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8334 inst.drawYear = inst.selectedYear = date.getFullYear(); 8335 } 8336 this._notifyChange( inst ); 8337 this._adjustDate( target ); 8338 }, 8339 8340 /* Action for selecting a new month/year. */
vendor: 4,615 bytes, lines 8341-8472
8341 _selectMonthYear: function( id, select, period ) { 8342 var target = $( id ), 8343 inst = this._getInst( target[ 0 ] ); 8344 8345 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 8346 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 8347 parseInt( select.options[ select.selectedIndex ].value, 10 ); 8348 8349 this._notifyChange( inst ); 8350 this._adjustDate( target ); 8351 }, 8352 8353 /* Action for selecting a day. */ 8354 _selectDay: function( id, month, year, td ) { 8355 var inst, 8356 target = $( id ); 8357 8358 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 8359 return; 8360 } 8361 8362 inst = this._getInst( target[ 0 ] ); 8363 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 8364 inst.selectedMonth = inst.currentMonth = month; 8365 inst.selectedYear = inst.currentYear = year; 8366 this._selectDate( id, this._formatDate( inst, 8367 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 8368 }, 8369 8370 /* Erase the input field and hide the date picker. */ 8371 _clearDate: function( id ) { 8372 var target = $( id ); 8373 this._selectDate( target, "" ); 8374 }, 8375 8376 /* Update the input field with the selected date. */ 8377 _selectDate: function( id, dateStr ) { 8378 var onSelect, 8379 target = $( id ), 8380 inst = this._getInst( target[ 0 ] ); 8381 8382 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 8383 if ( inst.input ) { 8384 inst.input.val( dateStr ); 8385 } 8386 this._updateAlternate( inst ); 8387 8388 onSelect = this._get( inst, "onSelect" ); 8389 if ( onSelect ) { 8390 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 8391 } else if ( inst.input ) { 8392 inst.input.trigger( "change" ); // fire the change event 8393 } 8394 8395 if ( inst.inline ) { 8396 this._updateDatepicker( inst ); 8397 } else { 8398 this._hideDatepicker(); 8399 this._lastInput = inst.input[ 0 ]; 8400 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 8401 inst.input.trigger( "focus" ); // restore focus 8402 } 8403 this._lastInput = null; 8404 } 8405 }, 8406 8407 /* Update any alternate field to synchronise with the main field. */ 8408 _updateAlternate: function( inst ) { 8409 var altFormat, date, dateStr, 8410 altField = this._get( inst, "altField" ); 8411 8412 if ( altField ) { // update alternate field too 8413 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 8414 date = this._getDate( inst ); 8415 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 8416 $( document ).find( altField ).val( dateStr ); 8417 } 8418 }, 8419 8420 /* Set as beforeShowDay function to prevent selection of weekends. 8421 * @param date Date - the date to customise 8422 * @return [boolean, string] - is this date selectable?, what is its CSS class? 8423 */ 8424 noWeekends: function( date ) { 8425 var day = date.getDay(); 8426 return [ ( day > 0 && day < 6 ), "" ]; 8427 }, 8428 8429 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 8430 * @param date Date - the date to get the week for 8431 * @return number - the number of the week within the year that contains this date 8432 */ 8433 iso8601Week: function( date ) { 8434 var time, 8435 checkDate = new Date( date.getTime() ); 8436 8437 // Find Thursday of this week starting on Monday 8438 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 8439 8440 time = checkDate.getTime(); 8441 checkDate.setMonth( 0 ); // Compare with Jan 1 8442 checkDate.setDate( 1 ); 8443 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 8444 }, 8445 8446 /* Parse a string value into a date object. 8447 * See formatDate below for the possible formats. 8448 * 8449 * @param format string - the expected format of the date 8450 * @param value string - the date in the above format 8451 * @param settings Object - attributes include: 8452 * shortYearCutoff number - the cutoff year for determining the century (optional) 8453 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8454 * dayNames string[7] - names of the days from Sunday (optional) 8455 * monthNamesShort string[12] - abbreviated names of the months (optional) 8456 * monthNames string[12] - names of the months (optional) 8457 * @return Date - the extracted date value or null if value is blank 8458 */ 8459 parseDate: function( format, value, settings ) { 8460 if ( format == null || value == null ) { 8461 throw "Invalid arguments"; 8462 } 8463 8464 value = ( typeof value === "object" ? value.toString() : value + "" ); 8465 if ( value === "" ) { 8466 return null; 8467 } 8468 8469 var iFormat, dim, extra, 8470 iValue = 0, 8471 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 8472 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 8472-8662
8472: 8473 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 8474 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8475 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8476 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8477 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8478 year = -1, 8479 month = -1, 8480 day = -1, 8481 doy = -1, 8482 literal = false, 8483 date, 8484 8485 // Check whether a format character is doubled 8486 lookAhead = function( match ) { 8487 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8488 if ( matches ) { 8489 iFormat++; 8490 } 8491 return matches; 8492 }, 8493 8494 // Extract a number from the string value 8495 getNumber = function( match ) { 8496 var isDoubled = lookAhead( match ), 8497 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 8498 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 8499 minSize = ( match === "y" ? size : 1 ), 8500 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 8501 num = value.substring( iValue ).match( digits ); 8502 if ( !num ) { 8503 throw "Missing number at position " + iValue; 8504 } 8505 iValue += num[ 0 ].length; 8506 return parseInt( num[ 0 ], 10 ); 8507 }, 8508 8509 // Extract a name from the string value and convert to an index 8510 getName = function( match, shortNames, longNames ) { 8511 var index = -1, 8512 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 8513 return [ [ k, v ] ]; 8514 } ).sort( function( a, b ) { 8515 return -( a[ 1 ].length - b[ 1 ].length ); 8516 } ); 8517 8518 $.each( names, function( i, pair ) { 8519 var name = pair[ 1 ]; 8520 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 8521 index = pair[ 0 ]; 8522 iValue += name.length; 8523 return false; 8524 } 8525 } ); 8526 if ( index !== -1 ) { 8527 return index + 1; 8528 } else { 8529 throw "Unknown name at position " + iValue; 8530 } 8531 }, 8532 8533 // Confirm that a literal character matches the string value 8534 checkLiteral = function() { 8535 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 8536 throw "Unexpected literal at position " + iValue; 8537 } 8538 iValue++; 8539 }; 8540 8541 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8542 if ( literal ) { 8543 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8544 literal = false; 8545 } else { 8546 checkLiteral(); 8547 } 8548 } else { 8549 switch ( format.charAt( iFormat ) ) { 8550 case "d": 8551 day = getNumber( "d" ); 8552 break; 8553 case "D": 8554 getName( "D", dayNamesShort, dayNames ); 8555 break; 8556 case "o": 8557 doy = getNumber( "o" ); 8558 break; 8559 case "m": 8560 month = getNumber( "m" ); 8561 break; 8562 case "M": 8563 month = getName( "M", monthNamesShort, monthNames ); 8564 break; 8565 case "y": 8566 year = getNumber( "y" ); 8567 break; 8568 case "@": 8569 date = new Date( getNumber( "@" ) ); 8570 year = date.getFullYear(); 8571 month = date.getMonth() + 1; 8572 day = date.getDate(); 8573 break; 8574 case "!": 8575 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 8576 year = date.getFullYear(); 8577 month = date.getMonth() + 1; 8578 day = date.getDate(); 8579 break; 8580 case "'": 8581 if ( lookAhead( "'" ) ) { 8582 checkLiteral(); 8583 } else { 8584 literal = true; 8585 } 8586 break; 8587 default: 8588 checkLiteral(); 8589 } 8590 } 8591 } 8592 8593 if ( iValue < value.length ) { 8594 extra = value.substr( iValue ); 8595 if ( !/^\s+/.test( extra ) ) { 8596 throw "Extra/unparsed characters found in date: " + extra; 8597 } 8598 } 8599 8600 if ( year === -1 ) { 8601 year = new Date().getFullYear(); 8602 } else if ( year < 100 ) { 8603 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 8604 ( year <= shortYearCutoff ? 0 : -100 ); 8605 } 8606 8607 if ( doy > -1 ) { 8608 month = 1; 8609 day = doy; 8610 do { 8611 dim = this._getDaysInMonth( year, month - 1 ); 8612 if ( day <= dim ) { 8613 break; 8614 } 8615 month++; 8616 day -= dim; 8617 } while ( true ); 8618 } 8619 8620 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 8621 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 8622 throw "Invalid date"; // E.g. 31/02/00 8623 } 8624 return date; 8625 }, 8626 8627 /* Standard date formats. */ 8628 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 8629 COOKIE: "D, dd M yy", 8630 ISO_8601: "yy-mm-dd", 8631 RFC_822: "D, d M y", 8632 RFC_850: "DD, dd-M-y", 8633 RFC_1036: "D, d M y", 8634 RFC_1123: "D, d M yy", 8635 RFC_2822: "D, d M yy", 8636 RSS: "D, d M y", // RFC 822 8637 TICKS: "!", 8638 TIMESTAMP: "@", 8639 W3C: "yy-mm-dd", // ISO 8601 8640 8641 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 8642 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 8643 8644 /* Format a date object into a string value. 8645 * The format can be combinations of the following: 8646 * d - day of month (no leading zero) 8647 * dd - day of month (two digit) 8648 * o - day of year (no leading zeros) 8649 * oo - day of year (three digit) 8650 * D - day name short 8651 * DD - day name long 8652 * m - month of year (no leading zero) 8653 * mm - month of year (two digit) 8654 * M - month name short 8655 * MM - month name long 8656 * y - year (two digit) 8657 * yy - year (four digit) 8658 * @ - Unix timestamp (ms since 01/01/1970) 8659 * ! - Windows ticks (100ns since 01/01/0001) 8660 * "..." - literal text 8661 * '' - single quote 8662 *
vendor: 6,198 bytes, lines 8663-8862
8663 * @param format string - the desired format of the date 8664 * @param date Date - the date value to format 8665 * @param settings Object - attributes include: 8666 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 8667 * dayNames string[7] - names of the days from Sunday (optional) 8668 * monthNamesShort string[12] - abbreviated names of the months (optional) 8669 * monthNames string[12] - names of the months (optional) 8670 * @return string - the date in the above format 8671 */ 8672 formatDate: function( format, date, settings ) { 8673 if ( !date ) { 8674 return ""; 8675 } 8676 8677 var iFormat, 8678 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 8679 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 8680 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 8681 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 8682 8683 // Check whether a format character is doubled 8684 lookAhead = function( match ) { 8685 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8686 if ( matches ) { 8687 iFormat++; 8688 } 8689 return matches; 8690 }, 8691 8692 // Format a number, with leading zero if necessary 8693 formatNumber = function( match, value, len ) { 8694 var num = "" + value; 8695 if ( lookAhead( match ) ) { 8696 while ( num.length < len ) { 8697 num = "0" + num; 8698 } 8699 } 8700 return num; 8701 }, 8702 8703 // Format a name, short or long as requested 8704 formatName = function( match, value, shortNames, longNames ) { 8705 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 8706 }, 8707 output = "", 8708 literal = false; 8709 8710 if ( date ) { 8711 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8712 if ( literal ) { 8713 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8714 literal = false; 8715 } else { 8716 output += format.charAt( iFormat ); 8717 } 8718 } else { 8719 switch ( format.charAt( iFormat ) ) { 8720 case "d": 8721 output += formatNumber( "d", date.getDate(), 2 ); 8722 break; 8723 case "D": 8724 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 8725 break; 8726 case "o": 8727 output += formatNumber( "o", 8728 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 8729 break; 8730 case "m": 8731 output += formatNumber( "m", date.getMonth() + 1, 2 ); 8732 break; 8733 case "M": 8734 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 8735 break; 8736 case "y": 8737 output += ( lookAhead( "y" ) ? date.getFullYear() : 8738 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 8739 break; 8740 case "@": 8741 output += date.getTime(); 8742 break; 8743 case "!": 8744 output += date.getTime() * 10000 + this._ticksTo1970; 8745 break; 8746 case "'": 8747 if ( lookAhead( "'" ) ) { 8748 output += "'"; 8749 } else { 8750 literal = true; 8751 } 8752 break; 8753 default: 8754 output += format.charAt( iFormat ); 8755 } 8756 } 8757 } 8758 } 8759 return output; 8760 }, 8761 8762 /* Extract all possible characters from the date format. */ 8763 _possibleChars: function( format ) { 8764 var iFormat, 8765 chars = "", 8766 literal = false, 8767 8768 // Check whether a format character is doubled 8769 lookAhead = function( match ) { 8770 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 8771 if ( matches ) { 8772 iFormat++; 8773 } 8774 return matches; 8775 }; 8776 8777 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 8778 if ( literal ) { 8779 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 8780 literal = false; 8781 } else { 8782 chars += format.charAt( iFormat ); 8783 } 8784 } else { 8785 switch ( format.charAt( iFormat ) ) { 8786 case "d": case "m": case "y": case "@": 8787 chars += "0123456789"; 8788 break; 8789 case "D": case "M": 8790 return null; // Accept anything 8791 case "'": 8792 if ( lookAhead( "'" ) ) { 8793 chars += "'"; 8794 } else { 8795 literal = true; 8796 } 8797 break; 8798 default: 8799 chars += format.charAt( iFormat ); 8800 } 8801 } 8802 } 8803 return chars; 8804 }, 8805 8806 /* Get a setting value, defaulting if necessary. */ 8807 _get: function( inst, name ) { 8808 return inst.settings[ name ] !== undefined ? 8809 inst.settings[ name ] : this._defaults[ name ]; 8810 }, 8811 8812 /* Parse existing date and initialise date picker. */ 8813 _setDateFromField: function( inst, noDefault ) { 8814 if ( inst.input.val() === inst.lastVal ) { 8815 return; 8816 } 8817 8818 var dateFormat = this._get( inst, "dateFormat" ), 8819 dates = inst.lastVal = inst.input ? inst.input.val() : null, 8820 defaultDate = this._getDefaultDate( inst ), 8821 date = defaultDate, 8822 settings = this._getFormatConfig( inst ); 8823 8824 try { 8825 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 8826 } catch ( event ) { 8827 dates = ( noDefault ? "" : dates ); 8828 } 8829 inst.selectedDay = date.getDate(); 8830 inst.drawMonth = inst.selectedMonth = date.getMonth(); 8831 inst.drawYear = inst.selectedYear = date.getFullYear(); 8832 inst.currentDay = ( dates ? date.getDate() : 0 ); 8833 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 8834 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 8835 this._adjustInstDate( inst ); 8836 }, 8837 8838 /* Retrieve the default date shown on opening. */ 8839 _getDefaultDate: function( inst ) { 8840 return this._restrictMinMax( inst, 8841 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 8842 }, 8843 8844 /* A date may be specified as an exact value or a relative one. */ 8845 _determineDate: function( inst, date, defaultDate ) { 8846 var offsetNumeric = function( offset ) { 8847 var date = new Date(); 8848 date.setDate( date.getDate() + offset ); 8849 return date; 8850 }, 8851 offsetString = function( offset ) { 8852 try { 8853 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 8854 offset, $.datepicker._getFormatConfig( inst ) ); 8855 } catch ( e ) { 8856 8857 // Ignore 8858 } 8859 8860 var date = ( offset.toLowerCase().match( /^c/ ) ? 8861 $.datepicker._getDate( inst ) : null ) || new Date(), 8862 year = date.getFullYear(),
vendor: 5,359 bytes, lines 8863-9001
8863 month = date.getMonth(), 8864 day = date.getDate(), 8865 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 8866 matches = pattern.exec( offset ); 8867 8868 while ( matches ) { 8869 switch ( matches[ 2 ] || "d" ) { 8870 case "d" : case "D" : 8871 day += parseInt( matches[ 1 ], 10 ); break; 8872 case "w" : case "W" : 8873 day += parseInt( matches[ 1 ], 10 ) * 7; break; 8874 case "m" : case "M" : 8875 month += parseInt( matches[ 1 ], 10 ); 8876 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8877 break; 8878 case "y": case "Y" : 8879 year += parseInt( matches[ 1 ], 10 ); 8880 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 8881 break; 8882 } 8883 matches = pattern.exec( offset ); 8884 } 8885 return new Date( year, month, day ); 8886 }, 8887 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 8888 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 8889 8890 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 8891 if ( newDate ) { 8892 newDate.setHours( 0 ); 8893 newDate.setMinutes( 0 ); 8894 newDate.setSeconds( 0 ); 8895 newDate.setMilliseconds( 0 ); 8896 } 8897 return this._daylightSavingAdjust( newDate ); 8898 }, 8899 8900 /* Handle switch to/from daylight saving. 8901 * Hours may be non-zero on daylight saving cut-over: 8902 * > 12 when midnight changeover, but then cannot generate 8903 * midnight datetime, so jump to 1AM, otherwise reset. 8904 * @param date (Date) the date to check 8905 * @return (Date) the corrected date 8906 */ 8907 _daylightSavingAdjust: function( date ) { 8908 if ( !date ) { 8909 return null; 8910 } 8911 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 8912 return date; 8913 }, 8914 8915 /* Set the date(s) directly. */ 8916 _setDate: function( inst, date, noChange ) { 8917 var clear = !date, 8918 origMonth = inst.selectedMonth, 8919 origYear = inst.selectedYear, 8920 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 8921 8922 inst.selectedDay = inst.currentDay = newDate.getDate(); 8923 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 8924 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 8925 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 8926 this._notifyChange( inst ); 8927 } 8928 this._adjustInstDate( inst ); 8929 if ( inst.input ) { 8930 inst.input.val( clear ? "" : this._formatDate( inst ) ); 8931 } 8932 }, 8933 8934 /* Retrieve the date(s) directly. */ 8935 _getDate: function( inst ) { 8936 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 8937 this._daylightSavingAdjust( new Date( 8938 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 8939 return startDate; 8940 }, 8941 8942 /* Attach the onxxx handlers. These are declared statically so 8943 * they work with static code transformers like Caja. 8944 */ 8945 _attachHandlers: function( inst ) { 8946 var stepMonths = this._get( inst, "stepMonths" ), 8947 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 8948 inst.dpDiv.find( "[data-handler]" ).map( function() { 8949 var handler = { 8950 prev: function() { 8951 $.datepicker._adjustDate( id, -stepMonths, "M" ); 8952 }, 8953 next: function() { 8954 $.datepicker._adjustDate( id, +stepMonths, "M" ); 8955 }, 8956 hide: function() { 8957 $.datepicker._hideDatepicker(); 8958 }, 8959 today: function() { 8960 $.datepicker._gotoToday( id ); 8961 }, 8962 selectDay: function() { 8963 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 8964 return false; 8965 }, 8966 selectMonth: function() { 8967 $.datepicker._selectMonthYear( id, this, "M" ); 8968 return false; 8969 }, 8970 selectYear: function() { 8971 $.datepicker._selectMonthYear( id, this, "Y" ); 8972 return false; 8973 } 8974 }; 8975 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 8976 } ); 8977 }, 8978 8979 /* Generate the HTML for the current state of the date picker. */ 8980 _generateHTML: function( inst ) { 8981 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 8982 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 8983 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 8984 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 8985 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 8986 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 8987 tempDate = new Date(), 8988 today = this._daylightSavingAdjust( 8989 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 8990 isRTL = this._get( inst, "isRTL" ), 8991 showButtonPanel = this._get( inst, "showButtonPanel" ), 8992 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 8993 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 8994 numMonths = this._getNumberOfMonths( inst ), 8995 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 8996 stepMonths = this._get( inst, "stepMonths" ), 8997 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 8998 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 8999 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 9000 minDate = this._getMinMaxDate( inst, "min" ), 9001 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,257 bytes, lines 9002-9516
9002 drawMonth = inst.drawMonth - showCurrentAtPos, 9003 drawYear = inst.drawYear; 9004 9005 if ( drawMonth < 0 ) { 9006 drawMonth += 12; 9007 drawYear--; 9008 } 9009 if ( maxDate ) { 9010 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 9011 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 9012 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 9013 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 9014 drawMonth--; 9015 if ( drawMonth < 0 ) { 9016 drawMonth = 11; 9017 drawYear--; 9018 } 9019 } 9020 } 9021 inst.drawMonth = drawMonth; 9022 inst.drawYear = drawYear; 9023 9024 prevText = this._get( inst, "prevText" ); 9025 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 9026 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 9027 this._getFormatConfig( inst ) ) ); 9028 9029 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 9030 prev = $( "<a>" ) 9031 .attr( { 9032 "class": "ui-datepicker-prev ui-corner-all", 9033 "data-handler": "prev", 9034 "data-event": "click", 9035 title: prevText 9036 } ) 9037 .append( 9038 $( "<span>" ) 9039 .addClass( "ui-icon ui-icon-circle-triangle-" + 9040 ( isRTL ? "e" : "w" ) ) 9041 .text( prevText ) 9042 )[ 0 ].outerHTML; 9043 } else if ( hideIfNoPrevNext ) { 9044 prev = ""; 9045 } else { 9046 prev = $( "<a>" ) 9047 .attr( { 9048 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 9049 title: prevText 9050 } ) 9051 .append( 9052 $( "<span>" ) 9053 .addClass( "ui-icon ui-icon-circle-triangle-" + 9054 ( isRTL ? "e" : "w" ) ) 9055 .text( prevText ) 9056 )[ 0 ].outerHTML; 9057 } 9058 9059 nextText = this._get( inst, "nextText" ); 9060 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 9061 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 9062 this._getFormatConfig( inst ) ) ); 9063 9064 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 9065 next = $( "<a>" ) 9066 .attr( { 9067 "class": "ui-datepicker-next ui-corner-all", 9068 "data-handler": "next", 9069 "data-event": "click", 9070 title: nextText 9071 } ) 9072 .append( 9073 $( "<span>" ) 9074 .addClass( "ui-icon ui-icon-circle-triangle-" + 9075 ( isRTL ? "w" : "e" ) ) 9076 .text( nextText ) 9077 )[ 0 ].outerHTML; 9078 } else if ( hideIfNoPrevNext ) { 9079 next = ""; 9080 } else { 9081 next = $( "<a>" ) 9082 .attr( { 9083 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 9084 title: nextText 9085 } ) 9086 .append( 9087 $( "<span>" ) 9088 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 9089 ( isRTL ? "w" : "e" ) ) 9090 .text( nextText ) 9091 )[ 0 ].outerHTML; 9092 } 9093 9094 currentText = this._get( inst, "currentText" ); 9095 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 9096 currentText = ( !navigationAsDateFormat ? currentText : 9097 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 9098 9099 controls = ""; 9100 if ( !inst.inline ) { 9101 controls = $( "<button>" ) 9102 .attr( { 9103 type: "button", 9104 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 9105 "data-handler": "hide", 9106 "data-event": "click" 9107 } ) 9108 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 9109 } 9110 9111 buttonPanel = ""; 9112 if ( showButtonPanel ) { 9113 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 9114 .append( isRTL ? controls : "" ) 9115 .append( this._isInRange( inst, gotoDate ) ? 9116 $( "<button>" ) 9117 .attr( { 9118 type: "button", 9119 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 9120 "data-handler": "today", 9121 "data-event": "click" 9122 } ) 9123 .text( currentText ) : 9124 "" ) 9125 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 9126 } 9127 9128 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 9129 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 9130 9131 showWeek = this._get( inst, "showWeek" ); 9132 dayNames = this._get( inst, "dayNames" ); 9133 dayNamesMin = this._get( inst, "dayNamesMin" ); 9134 monthNames = this._get( inst, "monthNames" ); 9135 monthNamesShort = this._get( inst, "monthNamesShort" ); 9136 beforeShowDay = this._get( inst, "beforeShowDay" ); 9137 showOtherMonths = this._get( inst, "showOtherMonths" ); 9138 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 9139 defaultDate = this._getDefaultDate( inst ); 9140 html = ""; 9141 9142 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 9143 group = ""; 9144 this.maxRows = 4; 9145 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 9146 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 9147 cornerClass = " ui-corner-all"; 9148 calender = ""; 9149 if ( isMultiMonth ) { 9150 calender += "<div class='ui-datepicker-group"; 9151 if ( numMonths[ 1 ] > 1 ) { 9152 switch ( col ) { 9153 case 0: calender += " ui-datepicker-group-first"; 9154 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 9155 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 9156 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 9157 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 9158 } 9159 } 9160 calender += "'>"; 9161 } 9162 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 9163 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 9164 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 9165 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 9166 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 9167 "</div><table class='ui-datepicker-calendar'><thead>" + 9168 "<tr>"; 9169 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 9170 for ( dow = 0; dow < 7; dow++ ) { // days of the week 9171 day = ( dow + firstDay ) % 7; 9172 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 9173 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 9174 } 9175 calender += thead + "</tr></thead><tbody>"; 9176 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 9177 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 9178 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 9179 } 9180 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 9181 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 9182 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 9183 this.maxRows = numRows; 9184 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 9185 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 9186 calender += "<tr>"; 9187 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 9188 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 9189 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 9190 daySettings = ( beforeShowDay ? 9191 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 9192 otherMonth = ( printDate.getMonth() !== drawMonth ); 9193 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 9194 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 9195 tbody += "<td class='" + 9196 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 9197 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 9198 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 9199 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 9200 9201 // or defaultDate is current printedDate and defaultDate is selectedDate 9202 " " + this._dayOverClass : "" ) + // highlight selected day 9203 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 9204 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 9205 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 9206 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 9207 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 9208 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 9209 ( otherMonth && !showOtherMonths ? " " : // display for other months 9210 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 9211 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 9212 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 9213 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 9214 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 9215 "' data-date='" + printDate.getDate() + // store date as data 9216 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 9217 printDate.setDate( printDate.getDate() + 1 ); 9218 printDate = this._daylightSavingAdjust( printDate ); 9219 } 9220 calender += tbody + "</tr>"; 9221 } 9222 drawMonth++; 9223 if ( drawMonth > 11 ) { 9224 drawMonth = 0; 9225 drawYear++; 9226 } 9227 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 9228 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 9229 group += calender; 9230 } 9231 html += group; 9232 } 9233 html += buttonPanel; 9234 inst._keyEvent = false; 9235 return html; 9236 }, 9237 9238 /* Generate the month and year header. */ 9239 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 9240 secondary, monthNames, monthNamesShort ) { 9241 9242 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 9243 changeMonth = this._get( inst, "changeMonth" ), 9244 changeYear = this._get( inst, "changeYear" ), 9245 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 9246 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 9247 selectYearLabel = this._get( inst, "selectYearLabel" ), 9248 html = "<div class='ui-datepicker-title'>", 9249 monthHtml = ""; 9250 9251 // Month selection 9252 if ( secondary || !changeMonth ) { 9253 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 9254 } else { 9255 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 9256 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 9257 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 9258 for ( month = 0; month < 12; month++ ) { 9259 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 9260 monthHtml += "<option value='" + month + "'" + 9261 ( month === drawMonth ? " selected='selected'" : "" ) + 9262 ">" + monthNamesShort[ month ] + "</option>"; 9263 } 9264 } 9265 monthHtml += "</select>"; 9266 } 9267 9268 if ( !showMonthAfterYear ) { 9269 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 9270 } 9271 9272 // Year selection 9273 if ( !inst.yearshtml ) { 9274 inst.yearshtml = ""; 9275 if ( secondary || !changeYear ) { 9276 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 9277 } else { 9278 9279 // determine range of years to display 9280 years = this._get( inst, "yearRange" ).split( ":" ); 9281 thisYear = new Date().getFullYear(); 9282 determineYear = function( value ) { 9283 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 9284 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 9285 parseInt( value, 10 ) ) ); 9286 return ( isNaN( year ) ? thisYear : year ); 9287 }; 9288 year = determineYear( years[ 0 ] ); 9289 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 9290 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 9291 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 9292 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 9293 for ( ; year <= endYear; year++ ) { 9294 inst.yearshtml += "<option value='" + year + "'" + 9295 ( year === drawYear ? " selected='selected'" : "" ) + 9296 ">" + year + "</option>"; 9297 } 9298 inst.yearshtml += "</select>"; 9299 9300 html += inst.yearshtml; 9301 inst.yearshtml = null; 9302 } 9303 } 9304 9305 html += this._get( inst, "yearSuffix" ); 9306 if ( showMonthAfterYear ) { 9307 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 9308 } 9309 html += "</div>"; // Close datepicker_header 9310 return html; 9311 }, 9312 9313 /* Adjust one of the date sub-fields. */ 9314 _adjustInstDate: function( inst, offset, period ) { 9315 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 9316 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 9317 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 9318 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 9319 9320 inst.selectedDay = date.getDate(); 9321 inst.drawMonth = inst.selectedMonth = date.getMonth(); 9322 inst.drawYear = inst.selectedYear = date.getFullYear(); 9323 if ( period === "M" || period === "Y" ) { 9324 this._notifyChange( inst ); 9325 } 9326 }, 9327 9328 /* Ensure a date is within any min/max bounds. */ 9329 _restrictMinMax: function( inst, date ) { 9330 var minDate = this._getMinMaxDate( inst, "min" ), 9331 maxDate = this._getMinMaxDate( inst, "max" ), 9332 newDate = ( minDate && date < minDate ? minDate : date ); 9333 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 9334 }, 9335 9336 /* Notify change of month/year. */ 9337 _notifyChange: function( inst ) { 9338 var onChange = this._get( inst, "onChangeMonthYear" ); 9339 if ( onChange ) { 9340 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 9341 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 9342 } 9343 }, 9344 9345 /* Determine the number of months to show. */ 9346 _getNumberOfMonths: function( inst ) { 9347 var numMonths = this._get( inst, "numberOfMonths" ); 9348 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 9349 }, 9350 9351 /* Determine the current maximum date - ensure no time components are set. */ 9352 _getMinMaxDate: function( inst, minMax ) { 9353 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 9354 }, 9355 9356 /* Find the number of days in a given month. */ 9357 _getDaysInMonth: function( year, month ) { 9358 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 9359 }, 9360 9361 /* Find the day of the week of the first of a month. */ 9362 _getFirstDayOfMonth: function( year, month ) { 9363 return new Date( year, month, 1 ).getDay(); 9364 }, 9365 9366 /* Determines if we should allow a "next/prev" month display change. */ 9367 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 9368 var numMonths = this._getNumberOfMonths( inst ), 9369 date = this._daylightSavingAdjust( new Date( curYear, 9370 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 9371 9372 if ( offset < 0 ) { 9373 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 9374 } 9375 return this._isInRange( inst, date ); 9376 }, 9377 9378 /* Is the given date in the accepted range? */ 9379 _isInRange: function( inst, date ) { 9380 var yearSplit, currentYear, 9381 minDate = this._getMinMaxDate( inst, "min" ), 9382 maxDate = this._getMinMaxDate( inst, "max" ), 9383 minYear = null, 9384 maxYear = null, 9385 years = this._get( inst, "yearRange" ); 9386 if ( years ) { 9387 yearSplit = years.split( ":" ); 9388 currentYear = new Date().getFullYear(); 9389 minYear = parseInt( yearSplit[ 0 ], 10 ); 9390 maxYear = parseInt( yearSplit[ 1 ], 10 ); 9391 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 9392 minYear += currentYear; 9393 } 9394 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 9395 maxYear += currentYear; 9396 } 9397 } 9398 9399 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 9400 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 9401 ( !minYear || date.getFullYear() >= minYear ) && 9402 ( !maxYear || date.getFullYear() <= maxYear ) ); 9403 }, 9404 9405 /* Provide the configuration settings for formatting/parsing. */ 9406 _getFormatConfig: function( inst ) { 9407 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 9408 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 9409 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 9410 return { shortYearCutoff: shortYearCutoff, 9411 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 9412 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 9413 }, 9414 9415 /* Format the given date for display. */ 9416 _formatDate: function( inst, day, month, year ) { 9417 if ( !day ) { 9418 inst.currentDay = inst.selectedDay; 9419 inst.currentMonth = inst.selectedMonth; 9420 inst.currentYear = inst.selectedYear; 9421 } 9422 var date = ( day ? ( typeof day === "object" ? day : 9423 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 9424 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 9425 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 9426 } 9427} ); 9428 9429/* 9430 * Bind hover events for datepicker elements. 9431 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 9432 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 9433 */ 9434function datepicker_bindHover( dpDiv ) { 9435 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 9436 return dpDiv.on( "mouseout", selector, function() { 9437 $( this ).removeClass( "ui-state-hover" ); 9438 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9439 $( this ).removeClass( "ui-datepicker-prev-hover" ); 9440 } 9441 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9442 $( this ).removeClass( "ui-datepicker-next-hover" ); 9443 } 9444 } ) 9445 .on( "mouseover", selector, datepicker_handleMouseover ); 9446} 9447 9448function datepicker_handleMouseover() { 9449 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 9450 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 9451 $( this ).addClass( "ui-state-hover" ); 9452 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 9453 $( this ).addClass( "ui-datepicker-prev-hover" ); 9454 } 9455 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 9456 $( this ).addClass( "ui-datepicker-next-hover" ); 9457 } 9458 } 9459} 9460 9461/* jQuery extend now ignores nulls! */ 9462function datepicker_extendRemove( target, props ) { 9463 $.extend( target, props ); 9464 for ( var name in props ) { 9465 if ( props[ name ] == null ) { 9466 target[ name ] = props[ name ]; 9467 } 9468 } 9469 return target; 9470} 9471 9472/* Invoke the datepicker functionality. 9473 @param options string - a command, optionally followed by additional parameters or 9474 Object - settings for attaching new datepicker functionality 9475 @return jQuery object */ 9476$.fn.datepicker = function( options ) { 9477 9478 /* Verify an empty collection wasn't passed - Fixes #6976 */ 9479 if ( !this.length ) { 9480 return this; 9481 } 9482 9483 /* Initialise the date picker. */ 9484 if ( !$.datepicker.initialized ) { 9485 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 9486 $.datepicker.initialized = true; 9487 } 9488 9489 /* Append datepicker main container to body if not exist. */ 9490 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 9491 $( "body" ).append( $.datepicker.dpDiv ); 9492 } 9493 9494 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 9495 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 9496 return $.datepicker[ "_" + options + "Datepicker" ]. 9497 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9498 } 9499 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 9500 return $.datepicker[ "_" + options + "Datepicker" ]. 9501 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 9502 } 9503 return this.each( function() { 9504 if ( typeof options === "string" ) { 9505 $.datepicker[ "_" + options + "Datepicker" ] 9506 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 9507 } else { 9508 $.datepicker._attachDatepicker( this, options ); 9509 } 9510 } ); 9511}; 9512 9513$.datepicker = new Datepicker(); // singleton instance 9514$.datepicker.initialized = false; 9515$.datepicker.uuid = new Date().getTime(); 9516$.datepicker.version = "1.1
vendor: 7,560 bytes, lines 9516-9805
95163.2"; 9517 9518var widgetsDatepicker = $.datepicker; 9519 9520 9521 9522// This file is deprecated 9523var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 9524 9525/*! 9526 * jQuery UI Mouse 1.13.2 9527 * http://jqueryui.com 9528 * 9529 * Copyright jQuery Foundation and other contributors 9530 * Released under the MIT license. 9531 * http://jquery.org/license 9532 */ 9533 9534//>>label: Mouse 9535//>>group: Widgets 9536//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 9537//>>docs: http://api.jqueryui.com/mouse/ 9538 9539 9540var mouseHandled = false; 9541$( document ).on( "mouseup", function() { 9542 mouseHandled = false; 9543} ); 9544 9545var widgetsMouse = $.widget( "ui.mouse", { 9546 version: "1.13.2", 9547 options: { 9548 cancel: "input, textarea, button, select, option", 9549 distance: 1, 9550 delay: 0 9551 }, 9552 _mouseInit: function() { 9553 var that = this; 9554 9555 this.element 9556 .on( "mousedown." + this.widgetName, function( event ) { 9557 return that._mouseDown( event ); 9558 } ) 9559 .on( "click." + this.widgetName, function( event ) { 9560 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 9561 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 9562 event.stopImmediatePropagation(); 9563 return false; 9564 } 9565 } ); 9566 9567 this.started = false; 9568 }, 9569 9570 // TODO: make sure destroying one instance of mouse doesn't mess with 9571 // other instances of mouse 9572 _mouseDestroy: function() { 9573 this.element.off( "." + this.widgetName ); 9574 if ( this._mouseMoveDelegate ) { 9575 this.document 9576 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9577 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9578 } 9579 }, 9580 9581 _mouseDown: function( event ) { 9582 9583 // don't let more than one widget handle mouseStart 9584 if ( mouseHandled ) { 9585 return; 9586 } 9587 9588 this._mouseMoved = false; 9589 9590 // We may have missed mouseup (out of window) 9591 if ( this._mouseStarted ) { 9592 this._mouseUp( event ); 9593 } 9594 9595 this._mouseDownEvent = event; 9596 9597 var that = this, 9598 btnIsLeft = ( event.which === 1 ), 9599 9600 // event.target.nodeName works around a bug in IE 8 with 9601 // disabled inputs (#7620) 9602 elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ? 9603 $( event.target ).closest( this.options.cancel ).length : false ); 9604 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 9605 return true; 9606 } 9607 9608 this.mouseDelayMet = !this.options.delay; 9609 if ( !this.mouseDelayMet ) { 9610 this._mouseDelayTimer = setTimeout( function() { 9611 that.mouseDelayMet = true; 9612 }, this.options.delay ); 9613 } 9614 9615 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 9616 this._mouseStarted = ( this._mouseStart( event ) !== false ); 9617 if ( !this._mouseStarted ) { 9618 event.preventDefault(); 9619 return true; 9620 } 9621 } 9622 9623 // Click event may never have fired (Gecko & Opera) 9624 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 9625 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 9626 } 9627 9628 // These delegates are required to keep context 9629 this._mouseMoveDelegate = function( event ) { 9630 return that._mouseMove( event ); 9631 }; 9632 this._mouseUpDelegate = function( event ) { 9633 return that._mouseUp( event ); 9634 }; 9635 9636 this.document 9637 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9638 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9639 9640 event.preventDefault(); 9641 9642 mouseHandled = true; 9643 return true; 9644 }, 9645 9646 _mouseMove: function( event ) { 9647 9648 // Only check for mouseups outside the document if you've moved inside the document 9649 // at least once. This prevents the firing of mouseup in the case of IE<9, which will 9650 // fire a mousemove event if content is placed under the cursor. See #7778 9651 // Support: IE <9 9652 if ( this._mouseMoved ) { 9653 9654 // IE mouseup check - mouseup happened when mouse was out of window 9655 if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && 9656 !event.button ) { 9657 return this._mouseUp( event ); 9658 9659 // Iframe mouseup check - mouseup occurred in another document 9660 } else if ( !event.which ) { 9661 9662 // Support: Safari <=8 - 9 9663 // Safari sets which to 0 if you press any of the following keys 9664 // during a drag (#14461) 9665 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 9666 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 9667 this.ignoreMissingWhich = true; 9668 } else if ( !this.ignoreMissingWhich ) { 9669 return this._mouseUp( event ); 9670 } 9671 } 9672 } 9673 9674 if ( event.which || event.button ) { 9675 this._mouseMoved = true; 9676 } 9677 9678 if ( this._mouseStarted ) { 9679 this._mouseDrag( event ); 9680 return event.preventDefault(); 9681 } 9682 9683 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 9684 this._mouseStarted = 9685 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 9686 if ( this._mouseStarted ) { 9687 this._mouseDrag( event ); 9688 } else { 9689 this._mouseUp( event ); 9690 } 9691 } 9692 9693 return !this._mouseStarted; 9694 }, 9695 9696 _mouseUp: function( event ) { 9697 this.document 9698 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 9699 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 9700 9701 if ( this._mouseStarted ) { 9702 this._mouseStarted = false; 9703 9704 if ( event.target === this._mouseDownEvent.target ) { 9705 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 9706 } 9707 9708 this._mouseStop( event ); 9709 } 9710 9711 if ( this._mouseDelayTimer ) { 9712 clearTimeout( this._mouseDelayTimer ); 9713 delete this._mouseDelayTimer; 9714 } 9715 9716 this.ignoreMissingWhich = false; 9717 mouseHandled = false; 9718 event.preventDefault(); 9719 }, 9720 9721 _mouseDistanceMet: function( event ) { 9722 return ( Math.max( 9723 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 9724 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 9725 ) >= this.options.distance 9726 ); 9727 }, 9728 9729 _mouseDelayMet: function( /* event */ ) { 9730 return this.mouseDelayMet; 9731 }, 9732 9733 // These are placeholder methods, to be overriden by extending plugin 9734 _mouseStart: function( /* event */ ) {}, 9735 _mouseDrag: function( /* event */ ) {}, 9736 _mouseStop: function( /* event */ ) {}, 9737 _mouseCapture: function( /* event */ ) { 9738 return true; 9739 } 9740} ); 9741 9742 9743 9744// $.ui.plugin is deprecated. Use $.widget() extensions instead. 9745var plugin = $.ui.plugin = { 9746 add: function( module, option, set ) { 9747 var i, 9748 proto = $.ui[ module ].prototype; 9749 for ( i in set ) { 9750 proto.plugins[ i ] = proto.plugins[ i ] || []; 9751 proto.plugins[ i ].push( [ option, set[ i ] ] ); 9752 } 9753 }, 9754 call: function( instance, name, args, allowDisconnected ) { 9755 var i, 9756 set = instance.plugins[ name ]; 9757 9758 if ( !set ) { 9759 return; 9760 } 9761 9762 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 9763 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 9764 return; 9765 } 9766 9767 for ( i = 0; i < set.length; i++ ) { 9768 if ( instance.options[ set[ i ][ 0 ] ] ) { 9769 set[ i ][ 1 ].apply( instance.element, args ); 9770 } 9771 } 9772 } 9773}; 9774 9775 9776 9777var safeBlur = $.ui.safeBlur = function( element ) { 9778 9779 // Support: IE9 - 10 only 9780 // If the <body> is blurred, IE will switch windows, see #9420 9781 if ( element && element.nodeName.toLowerCase() !== "body" ) { 9782 $( element ).trigger( "blur" ); 9783 } 9784}; 9785 9786 9787/*! 9788 * jQuery UI Draggable 1.13.2 9789 * http://jqueryui.com 9790 * 9791 * Copyright jQuery Foundation and other contributors 9792 * Released under the MIT license. 9793 * http://jquery.org/license 9794 */ 9795 9796//>>label: Draggable 9797//>>group: Interactions 9798//>>description: Enables dragging functionality for any element. 9799//>>docs: http://api.jqueryui.com/draggable/ 9800//>>demos: http://jqueryui.com/draggable/ 9801//>>css.structure: ../../themes/base/draggable.css 9802 9803 9804$.widget( "ui.draggable", $.ui.mouse, { 9805 version: "1.13.2
vendor: 8,684 bytes, lines 9805-10151
9805", 9806 widgetEventPrefix: "drag", 9807 options: { 9808 addClasses: true, 9809 appendTo: "parent", 9810 axis: false, 9811 connectToSortable: false, 9812 containment: false, 9813 cursor: "auto", 9814 cursorAt: false, 9815 grid: false, 9816 handle: false, 9817 helper: "original", 9818 iframeFix: false, 9819 opacity: false, 9820 refreshPositions: false, 9821 revert: false, 9822 revertDuration: 500, 9823 scope: "default", 9824 scroll: true, 9825 scrollSensitivity: 20, 9826 scrollSpeed: 20, 9827 snap: false, 9828 snapMode: "both", 9829 snapTolerance: 20, 9830 stack: false, 9831 zIndex: false, 9832 9833 // Callbacks 9834 drag: null, 9835 start: null, 9836 stop: null 9837 }, 9838 _create: function() { 9839 9840 if ( this.options.helper === "original" ) { 9841 this._setPositionRelative(); 9842 } 9843 if ( this.options.addClasses ) { 9844 this._addClass( "ui-draggable" ); 9845 } 9846 this._setHandleClassName(); 9847 9848 this._mouseInit(); 9849 }, 9850 9851 _setOption: function( key, value ) { 9852 this._super( key, value ); 9853 if ( key === "handle" ) { 9854 this._removeHandleClassName(); 9855 this._setHandleClassName(); 9856 } 9857 }, 9858 9859 _destroy: function() { 9860 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 9861 this.destroyOnClear = true; 9862 return; 9863 } 9864 this._removeHandleClassName(); 9865 this._mouseDestroy(); 9866 }, 9867 9868 _mouseCapture: function( event ) { 9869 var o = this.options; 9870 9871 // Among others, prevent a drag on a resizable-handle 9872 if ( this.helper || o.disabled || 9873 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 9874 return false; 9875 } 9876 9877 //Quit if we're not on a valid handle 9878 this.handle = this._getHandle( event ); 9879 if ( !this.handle ) { 9880 return false; 9881 } 9882 9883 this._blurActiveElement( event ); 9884 9885 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 9886 9887 return true; 9888 9889 }, 9890 9891 _blockFrames: function( selector ) { 9892 this.iframeBlocks = this.document.find( selector ).map( function() { 9893 var iframe = $( this ); 9894 9895 return $( "<div>" ) 9896 .css( "position", "absolute" ) 9897 .appendTo( iframe.parent() ) 9898 .outerWidth( iframe.outerWidth() ) 9899 .outerHeight( iframe.outerHeight() ) 9900 .offset( iframe.offset() )[ 0 ]; 9901 } ); 9902 }, 9903 9904 _unblockFrames: function() { 9905 if ( this.iframeBlocks ) { 9906 this.iframeBlocks.remove(); 9907 delete this.iframeBlocks; 9908 } 9909 }, 9910 9911 _blurActiveElement: function( event ) { 9912 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 9913 target = $( event.target ); 9914 9915 // Don't blur if the event occurred on an element that is within 9916 // the currently focused element 9917 // See #10527, #12472 9918 if ( target.closest( activeElement ).length ) { 9919 return; 9920 } 9921 9922 // Blur any element that currently has focus, see #4261 9923 $.ui.safeBlur( activeElement ); 9924 }, 9925 9926 _mouseStart: function( event ) { 9927 9928 var o = this.options; 9929 9930 //Create and append the visible helper 9931 this.helper = this._createHelper( event ); 9932 9933 this._addClass( this.helper, "ui-draggable-dragging" ); 9934 9935 //Cache the helper size 9936 this._cacheHelperProportions(); 9937 9938 //If ddmanager is used for droppables, set the global draggable 9939 if ( $.ui.ddmanager ) { 9940 $.ui.ddmanager.current = this; 9941 } 9942 9943 /* 9944 * - Position generation - 9945 * This block generates everything position related - it's the core of draggables. 9946 */ 9947 9948 //Cache the margins of the original element 9949 this._cacheMargins(); 9950 9951 //Store the helper's css position 9952 this.cssPosition = this.helper.css( "position" ); 9953 this.scrollParent = this.helper.scrollParent( true ); 9954 this.offsetParent = this.helper.offsetParent(); 9955 this.hasFixedAncestor = this.helper.parents().filter( function() { 9956 return $( this ).css( "position" ) === "fixed"; 9957 } ).length > 0; 9958 9959 //The element's absolute position on the page minus margins 9960 this.positionAbs = this.element.offset(); 9961 this._refreshOffsets( event ); 9962 9963 //Generate the original position 9964 this.originalPosition = this.position = this._generatePosition( event, false ); 9965 this.originalPageX = event.pageX; 9966 this.originalPageY = event.pageY; 9967 9968 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 9969 if ( o.cursorAt ) { 9970 this._adjustOffsetFromHelper( o.cursorAt ); 9971 } 9972 9973 //Set a containment if given in the options 9974 this._setContainment(); 9975 9976 //Trigger event + callbacks 9977 if ( this._trigger( "start", event ) === false ) { 9978 this._clear(); 9979 return false; 9980 } 9981 9982 //Recache the helper size 9983 this._cacheHelperProportions(); 9984 9985 //Prepare the droppable offsets 9986 if ( $.ui.ddmanager && !o.dropBehaviour ) { 9987 $.ui.ddmanager.prepareOffsets( this, event ); 9988 } 9989 9990 // Execute the drag once - this causes the helper not to be visible before getting its 9991 // correct position 9992 this._mouseDrag( event, true ); 9993 9994 // If the ddmanager is used for droppables, inform the manager that dragging has started 9995 // (see #5003) 9996 if ( $.ui.ddmanager ) { 9997 $.ui.ddmanager.dragStart( this, event ); 9998 } 9999 10000 return true; 10001 }, 10002 10003 _refreshOffsets: function( event ) { 10004 this.offset = { 10005 top: this.positionAbs.top - this.margins.top, 10006 left: this.positionAbs.left - this.margins.left, 10007 scroll: false, 10008 parent: this._getParentOffset(), 10009 relative: this._getRelativeOffset() 10010 }; 10011 10012 this.offset.click = { 10013 left: event.pageX - this.offset.left, 10014 top: event.pageY - this.offset.top 10015 }; 10016 }, 10017 10018 _mouseDrag: function( event, noPropagation ) { 10019 10020 // reset any necessary cached properties (see #5009) 10021 if ( this.hasFixedAncestor ) { 10022 this.offset.parent = this._getParentOffset(); 10023 } 10024 10025 //Compute the helpers position 10026 this.position = this._generatePosition( event, true ); 10027 this.positionAbs = this._convertPositionTo( "absolute" ); 10028 10029 //Call plugins and callbacks and use the resulting position if something is returned 10030 if ( !noPropagation ) { 10031 var ui = this._uiHash(); 10032 if ( this._trigger( "drag", event, ui ) === false ) { 10033 this._mouseUp( new $.Event( "mouseup", event ) ); 10034 return false; 10035 } 10036 this.position = ui.position; 10037 } 10038 10039 this.helper[ 0 ].style.left = this.position.left + "px"; 10040 this.helper[ 0 ].style.top = this.position.top + "px"; 10041 10042 if ( $.ui.ddmanager ) { 10043 $.ui.ddmanager.drag( this, event ); 10044 } 10045 10046 return false; 10047 }, 10048 10049 _mouseStop: function( event ) { 10050 10051 //If we are using droppables, inform the manager about the drop 10052 var that = this, 10053 dropped = false; 10054 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 10055 dropped = $.ui.ddmanager.drop( this, event ); 10056 } 10057 10058 //if a drop comes from outside (a sortable) 10059 if ( this.dropped ) { 10060 dropped = this.dropped; 10061 this.dropped = false; 10062 } 10063 10064 if ( ( this.options.revert === "invalid" && !dropped ) || 10065 ( this.options.revert === "valid" && dropped ) || 10066 this.options.revert === true || ( typeof this.options.revert === "function" && 10067 this.options.revert.call( this.element, dropped ) ) 10068 ) { 10069 $( this.helper ).animate( 10070 this.originalPosition, 10071 parseInt( this.options.revertDuration, 10 ), 10072 function() { 10073 if ( that._trigger( "stop", event ) !== false ) { 10074 that._clear(); 10075 } 10076 } 10077 ); 10078 } else { 10079 if ( this._trigger( "stop", event ) !== false ) { 10080 this._clear(); 10081 } 10082 } 10083 10084 return false; 10085 }, 10086 10087 _mouseUp: function( event ) { 10088 this._unblockFrames(); 10089 10090 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 10091 // (see #5003) 10092 if ( $.ui.ddmanager ) { 10093 $.ui.ddmanager.dragStop( this, event ); 10094 } 10095 10096 // Only need to focus if the event occurred on the draggable itself, see #10527 10097 if ( this.handleElement.is( event.target ) ) { 10098 10099 // The interaction is over; whether or not the click resulted in a drag, 10100 // focus the element 10101 this.element.trigger( "focus" ); 10102 } 10103 10104 return $.ui.mouse.prototype._mouseUp.call( this, event ); 10105 }, 10106 10107 cancel: function() { 10108 10109 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 10110 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 10111 } else { 10112 this._clear(); 10113 } 10114 10115 return this; 10116 10117 }, 10118 10119 _getHandle: function( event ) { 10120 return this.options.handle ? 10121 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 10122 true; 10123 }, 10124 10125 _setHandleClassName: function() { 10126 this.handleElement = this.options.handle ? 10127 this.element.find( this.options.handle ) : this.element; 10128 this._addClass( this.handleElement, "ui-draggable-handle" ); 10129 }, 10130 10131 _removeHandleClassName: function() { 10132 this._removeClass( this.handleElement, "ui-draggable-handle" ); 10133 }, 10134 10135 _createHelper: function( event ) { 10136 10137 var o = this.options, 10138 helperIsFunction = typeof o.helper === "function", 10139 helper = helperIsFunction ? 10140 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 10141 ( o.helper === "clone" ? 10142 this.element.clone().removeAttr( "id" ) : 10143 this.element ); 10144 10145 if ( !helper.parents( "body" ).length ) { 10146 helper.appendTo( ( o.appendTo === "parent" ? 10147 this.element[ 0 ].parentNode : 10148 o.appendTo ) ); 10149 } 10150 10151 //
10151Http://bugs.jqueryui.com/ticket/9446 10152 // a helper function can return the original element 10153 // which wouldn't have been set to relative in _create 10154 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 10155 this._setPositionRelative(); 10156 } 10157 10158 if ( helper[ 0 ] !== this.element[ 0 ] && 10159 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 10160 helper.css( "position", "absolute" ); 10161 } 10162 10163 return helper; 10164 10165 }, 10166 10167 _setPositionRelative: function() { 10168 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 10169 this.element[ 0 ].style.position = "relative"; 10170 } 10171 }, 10172 10173 _adjustOffsetFromHelper: function( obj ) { 10174 if ( typeof obj === "string" ) { 10175 obj = obj.split( " " ); 10176 } 10177 if ( Array
vendor: 14,647 bytes, lines 10177-10657
10177.isArray( obj ) ) { 10178 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 10179 } 10180 if ( "left" in obj ) { 10181 this.offset.click.left = obj.left + this.margins.left; 10182 } 10183 if ( "right" in obj ) { 10184 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 10185 } 10186 if ( "top" in obj ) { 10187 this.offset.click.top = obj.top + this.margins.top; 10188 } 10189 if ( "bottom" in obj ) { 10190 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 10191 } 10192 }, 10193 10194 _isRootNode: function( element ) { 10195 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 10196 }, 10197 10198 _getParentOffset: function() { 10199 10200 //Get the offsetParent and cache its position 10201 var po = this.offsetParent.offset(), 10202 document = this.document[ 0 ]; 10203 10204 // This is a special case where we need to modify a offset calculated on start, since the 10205 // following happened: 10206 // 1. The position of the helper is absolute, so it's position is calculated based on the 10207 // next positioned parent 10208 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 10209 // the document, which means that the scroll is included in the initial calculation of the 10210 // offset of the parent, and never recalculated upon drag 10211 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 10212 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 10213 po.left += this.scrollParent.scrollLeft(); 10214 po.top += this.scrollParent.scrollTop(); 10215 } 10216 10217 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 10218 po = { top: 0, left: 0 }; 10219 } 10220 10221 return { 10222 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 10223 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 10224 }; 10225 10226 }, 10227 10228 _getRelativeOffset: function() { 10229 if ( this.cssPosition !== "relative" ) { 10230 return { top: 0, left: 0 }; 10231 } 10232 10233 var p = this.element.position(), 10234 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10235 10236 return { 10237 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 10238 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 10239 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 10240 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 10241 }; 10242 10243 }, 10244 10245 _cacheMargins: function() { 10246 this.margins = { 10247 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 10248 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 10249 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 10250 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 10251 }; 10252 }, 10253 10254 _cacheHelperProportions: function() { 10255 this.helperProportions = { 10256 width: this.helper.outerWidth(), 10257 height: this.helper.outerHeight() 10258 }; 10259 }, 10260 10261 _setContainment: function() { 10262 10263 var isUserScrollable, c, ce, 10264 o = this.options, 10265 document = this.document[ 0 ]; 10266 10267 this.relativeContainer = null; 10268 10269 if ( !o.containment ) { 10270 this.containment = null; 10271 return; 10272 } 10273 10274 if ( o.containment === "window" ) { 10275 this.containment = [ 10276 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 10277 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 10278 $( window ).scrollLeft() + $( window ).width() - 10279 this.helperProportions.width - this.margins.left, 10280 $( window ).scrollTop() + 10281 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 10282 this.helperProportions.height - this.margins.top 10283 ]; 10284 return; 10285 } 10286 10287 if ( o.containment === "document" ) { 10288 this.containment = [ 10289 0, 10290 0, 10291 $( document ).width() - this.helperProportions.width - this.margins.left, 10292 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 10293 this.helperProportions.height - this.margins.top 10294 ]; 10295 return; 10296 } 10297 10298 if ( o.containment.constructor === Array ) { 10299 this.containment = o.containment; 10300 return; 10301 } 10302 10303 if ( o.containment === "parent" ) { 10304 o.containment = this.helper[ 0 ].parentNode; 10305 } 10306 10307 c = $( o.containment ); 10308 ce = c[ 0 ]; 10309 10310 if ( !ce ) { 10311 return; 10312 } 10313 10314 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 10315 10316 this.containment = [ 10317 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 10318 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 10319 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 10320 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 10321 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 10322 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 10323 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 10324 this.helperProportions.width - 10325 this.margins.left - 10326 this.margins.right, 10327 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 10328 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 10329 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 10330 this.helperProportions.height - 10331 this.margins.top - 10332 this.margins.bottom 10333 ]; 10334 this.relativeContainer = c; 10335 }, 10336 10337 _convertPositionTo: function( d, pos ) { 10338 10339 if ( !pos ) { 10340 pos = this.position; 10341 } 10342 10343 var mod = d === "absolute" ? 1 : -1, 10344 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 10345 10346 return { 10347 top: ( 10348 10349 // The absolute mouse position 10350 pos.top + 10351 10352 // Only for relative positioned nodes: Relative offset from element to offset parent 10353 this.offset.relative.top * mod + 10354 10355 // The offsetParent's offset without borders (offset + border) 10356 this.offset.parent.top * mod - 10357 ( ( this.cssPosition === "fixed" ? 10358 -this.offset.scroll.top : 10359 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 10360 ), 10361 left: ( 10362 10363 // The absolute mouse position 10364 pos.left + 10365 10366 // Only for relative positioned nodes: Relative offset from element to offset parent 10367 this.offset.relative.left * mod + 10368 10369 // The offsetParent's offset without borders (offset + border) 10370 this.offset.parent.left * mod - 10371 ( ( this.cssPosition === "fixed" ? 10372 -this.offset.scroll.left : 10373 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 10374 ) 10375 }; 10376 10377 }, 10378 10379 _generatePosition: function( event, constrainPosition ) { 10380 10381 var containment, co, top, left, 10382 o = this.options, 10383 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 10384 pageX = event.pageX, 10385 pageY = event.pageY; 10386 10387 // Cache the scroll 10388 if ( !scrollIsRootNode || !this.offset.scroll ) { 10389 this.offset.scroll = { 10390 top: this.scrollParent.scrollTop(), 10391 left: this.scrollParent.scrollLeft() 10392 }; 10393 } 10394 10395 /* 10396 * - Position constraining - 10397 * Constrain the position to a mix of grid, containment. 10398 */ 10399 10400 // If we are not dragging yet, we won't check for options 10401 if ( constrainPosition ) { 10402 if ( this.containment ) { 10403 if ( this.relativeContainer ) { 10404 co = this.relativeContainer.offset(); 10405 containment = [ 10406 this.containment[ 0 ] + co.left, 10407 this.containment[ 1 ] + co.top, 10408 this.containment[ 2 ] + co.left, 10409 this.containment[ 3 ] + co.top 10410 ]; 10411 } else { 10412 containment = this.containment; 10413 } 10414 10415 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 10416 pageX = containment[ 0 ] + this.offset.click.left; 10417 } 10418 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 10419 pageY = containment[ 1 ] + this.offset.click.top; 10420 } 10421 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 10422 pageX = containment[ 2 ] + this.offset.click.left; 10423 } 10424 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 10425 pageY = containment[ 3 ] + this.offset.click.top; 10426 } 10427 } 10428 10429 if ( o.grid ) { 10430 10431 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 10432 // argument errors in IE (see ticket #6950) 10433 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 10434 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 10435 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 10436 top - this.offset.click.top > containment[ 3 ] ) ? 10437 top : 10438 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 10439 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 10440 10441 left = o.grid[ 0 ] ? this.originalPageX + 10442 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 10443 this.originalPageX; 10444 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 10445 left - this.offset.click.left > containment[ 2 ] ) ? 10446 left : 10447 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 10448 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 10449 } 10450 10451 if ( o.axis === "y" ) { 10452 pageX = this.originalPageX; 10453 } 10454 10455 if ( o.axis === "x" ) { 10456 pageY = this.originalPageY; 10457 } 10458 } 10459 10460 return { 10461 top: ( 10462 10463 // The absolute mouse position 10464 pageY - 10465 10466 // Click offset (relative to the element) 10467 this.offset.click.top - 10468 10469 // Only for relative positioned nodes: Relative offset from element to offset parent 10470 this.offset.relative.top - 10471 10472 // The offsetParent's offset without borders (offset + border) 10473 this.offset.parent.top + 10474 ( this.cssPosition === "fixed" ? 10475 -this.offset.scroll.top : 10476 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 10477 ), 10478 left: ( 10479 10480 // The absolute mouse position 10481 pageX - 10482 10483 // Click offset (relative to the element) 10484 this.offset.click.left - 10485 10486 // Only for relative positioned nodes: Relative offset from element to offset parent 10487 this.offset.relative.left - 10488 10489 // The offsetParent's offset without borders (offset + border) 10490 this.offset.parent.left + 10491 ( this.cssPosition === "fixed" ? 10492 -this.offset.scroll.left : 10493 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 10494 ) 10495 }; 10496 10497 }, 10498 10499 _clear: function() { 10500 this._removeClass( this.helper, "ui-draggable-dragging" ); 10501 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 10502 this.helper.remove(); 10503 } 10504 this.helper = null; 10505 this.cancelHelperRemoval = false; 10506 if ( this.destroyOnClear ) { 10507 this.destroy(); 10508 } 10509 }, 10510 10511 // From now on bulk stuff - mainly helpers 10512 10513 _trigger: function( type, event, ui ) { 10514 ui = ui || this._uiHash(); 10515 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 10516 10517 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 10518 if ( /^(drag|start|stop)/.test( type ) ) { 10519 this.positionAbs = this._convertPositionTo( "absolute" ); 10520 ui.offset = this.positionAbs; 10521 } 10522 return $.Widget.prototype._trigger.call( this, type, event, ui ); 10523 }, 10524 10525 plugins: {}, 10526 10527 _uiHash: function() { 10528 return { 10529 helper: this.helper, 10530 position: this.position, 10531 originalPosition: this.originalPosition, 10532 offset: this.positionAbs 10533 }; 10534 } 10535 10536} ); 10537 10538$.ui.plugin.add( "draggable", "connectToSortable", { 10539 start: function( event, ui, draggable ) { 10540 var uiSortable = $.extend( {}, ui, { 10541 item: draggable.element 10542 } ); 10543 10544 draggable.sortables = []; 10545 $( draggable.options.connectToSortable ).each( function() { 10546 var sortable = $( this ).sortable( "instance" ); 10547 10548 if ( sortable && !sortable.options.disabled ) { 10549 draggable.sortables.push( sortable ); 10550 10551 // RefreshPositions is called at drag start to refresh the containerCache 10552 // which is used in drag. This ensures it's initialized and synchronized 10553 // with any changes that might have happened on the page since initialization. 10554 sortable.refreshPositions(); 10555 sortable._trigger( "activate", event, uiSortable ); 10556 } 10557 } ); 10558 }, 10559 stop: function( event, ui, draggable ) { 10560 var uiSortable = $.extend( {}, ui, { 10561 item: draggable.element 10562 } ); 10563 10564 draggable.cancelHelperRemoval = false; 10565 10566 $.each( draggable.sortables, function() { 10567 var sortable = this; 10568 10569 if ( sortable.isOver ) { 10570 sortable.isOver = 0; 10571 10572 // Allow this sortable to handle removing the helper 10573 draggable.cancelHelperRemoval = true; 10574 sortable.cancelHelperRemoval = false; 10575 10576 // Use _storedCSS To restore properties in the sortable, 10577 // as this also handles revert (#9675) since the draggable 10578 // may have modified them in unexpected ways (#8809) 10579 sortable._storedCSS = { 10580 position: sortable.placeholder.css( "position" ), 10581 top: sortable.placeholder.css( "top" ), 10582 left: sortable.placeholder.css( "left" ) 10583 }; 10584 10585 sortable._mouseStop( event ); 10586 10587 // Once drag has ended, the sortable should return to using 10588 // its original helper, not the shared helper from draggable 10589 sortable.options.helper = sortable.options._helper; 10590 } else { 10591 10592 // Prevent this Sortable from removing the helper. 10593 // However, don't set the draggable to remove the helper 10594 // either as another connected Sortable may yet handle the removal. 10595 sortable.cancelHelperRemoval = true; 10596 10597 sortable._trigger( "deactivate", event, uiSortable ); 10598 } 10599 } ); 10600 }, 10601 drag: function( event, ui, draggable ) { 10602 $.each( draggable.sortables, function() { 10603 var innermostIntersecting = false, 10604 sortable = this; 10605 10606 // Copy over variables that sortable's _intersectsWith uses 10607 sortable.positionAbs = draggable.positionAbs; 10608 sortable.helperProportions = draggable.helperProportions; 10609 sortable.offset.click = draggable.offset.click; 10610 10611 if ( sortable._intersectsWith( sortable.containerCache ) ) { 10612 innermostIntersecting = true; 10613 10614 $.each( draggable.sortables, function() { 10615 10616 // Copy over variables that sortable's _intersectsWith uses 10617 this.positionAbs = draggable.positionAbs; 10618 this.helperProportions = draggable.helperProportions; 10619 this.offset.click = draggable.offset.click; 10620 10621 if ( this !== sortable && 10622 this._intersectsWith( this.containerCache ) && 10623 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 10624 innermostIntersecting = false; 10625 } 10626 10627 return innermostIntersecting; 10628 } ); 10629 } 10630 10631 if ( innermostIntersecting ) { 10632 10633 // If it intersects, we use a little isOver variable and set it once, 10634 // so that the move-in stuff gets fired only once. 10635 if ( !sortable.isOver ) { 10636 sortable.isOver = 1; 10637 10638 // Store draggable's parent in case we need to reappend to it later. 10639 draggable._parent = ui.helper.parent(); 10640 10641 sortable.currentItem = ui.helper 10642 .appendTo( sortable.element ) 10643 .data( "ui-sortable-item", true ); 10644 10645 // Store helper option to later restore it 10646 sortable.options._helper = sortable.options.helper; 10647 10648 sortable.options.helper = function() { 10649 return ui.helper[ 0 ]; 10650 }; 10651 10652 // Fire the start events of the sortable with our passed browser event, 10653 // and our own helper (so it doesn't create a new one) 10654 event.target = sortable.currentItem[ 0 ]; 10655 sortable._mouseCapture( event, true ); 10656 sortable._mouseStart( event, true, true ); 10657
vendor: 10,634 bytes, lines 10658-11023
10658 // Because the browser event is way off the new appended portlet, 10659 // modify necessary variables to reflect the changes 10660 sortable.offset.click.top = draggable.offset.click.top; 10661 sortable.offset.click.left = draggable.offset.click.left; 10662 sortable.offset.parent.left -= draggable.offset.parent.left - 10663 sortable.offset.parent.left; 10664 sortable.offset.parent.top -= draggable.offset.parent.top - 10665 sortable.offset.parent.top; 10666 10667 draggable._trigger( "toSortable", event ); 10668 10669 // Inform draggable that the helper is in a valid drop zone, 10670 // used solely in the revert option to handle "valid/invalid". 10671 draggable.dropped = sortable.element; 10672 10673 // Need to refreshPositions of all sortables in the case that 10674 // adding to one sortable changes the location of the other sortables (#9675) 10675 $.each( draggable.sortables, function() { 10676 this.refreshPositions(); 10677 } ); 10678 10679 // Hack so receive/update callbacks work (mostly) 10680 draggable.currentItem = draggable.element; 10681 sortable.fromOutside = draggable; 10682 } 10683 10684 if ( sortable.currentItem ) { 10685 sortable._mouseDrag( event ); 10686 10687 // Copy the sortable's position because the draggable's can potentially reflect 10688 // a relative position, while sortable is always absolute, which the dragged 10689 // element has now become. (#8809) 10690 ui.position = sortable.position; 10691 } 10692 } else { 10693 10694 // If it doesn't intersect with the sortable, and it intersected before, 10695 // we fake the drag stop of the sortable, but make sure it doesn't remove 10696 // the helper by using cancelHelperRemoval. 10697 if ( sortable.isOver ) { 10698 10699 sortable.isOver = 0; 10700 sortable.cancelHelperRemoval = true; 10701 10702 // Calling sortable's mouseStop would trigger a revert, 10703 // so revert must be temporarily false until after mouseStop is called. 10704 sortable.options._revert = sortable.options.revert; 10705 sortable.options.revert = false; 10706 10707 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 10708 sortable._mouseStop( event, true ); 10709 10710 // Restore sortable behaviors that were modfied 10711 // when the draggable entered the sortable area (#9481) 10712 sortable.options.revert = sortable.options._revert; 10713 sortable.options.helper = sortable.options._helper; 10714 10715 if ( sortable.placeholder ) { 10716 sortable.placeholder.remove(); 10717 } 10718 10719 // Restore and recalculate the draggable's offset considering the sortable 10720 // may have modified them in unexpected ways. (#8809, #10669) 10721 ui.helper.appendTo( draggable._parent ); 10722 draggable._refreshOffsets( event ); 10723 ui.position = draggable._generatePosition( event, true ); 10724 10725 draggable._trigger( "fromSortable", event ); 10726 10727 // Inform draggable that the helper is no longer in a valid drop zone 10728 draggable.dropped = false; 10729 10730 // Need to refreshPositions of all sortables just in case removing 10731 // from one sortable changes the location of other sortables (#9675) 10732 $.each( draggable.sortables, function() { 10733 this.refreshPositions(); 10734 } ); 10735 } 10736 } 10737 } ); 10738 } 10739} ); 10740 10741$.ui.plugin.add( "draggable", "cursor", { 10742 start: function( event, ui, instance ) { 10743 var t = $( "body" ), 10744 o = instance.options; 10745 10746 if ( t.css( "cursor" ) ) { 10747 o._cursor = t.css( "cursor" ); 10748 } 10749 t.css( "cursor", o.cursor ); 10750 }, 10751 stop: function( event, ui, instance ) { 10752 var o = instance.options; 10753 if ( o._cursor ) { 10754 $( "body" ).css( "cursor", o._cursor ); 10755 } 10756 } 10757} ); 10758 10759$.ui.plugin.add( "draggable", "opacity", { 10760 start: function( event, ui, instance ) { 10761 var t = $( ui.helper ), 10762 o = instance.options; 10763 if ( t.css( "opacity" ) ) { 10764 o._opacity = t.css( "opacity" ); 10765 } 10766 t.css( "opacity", o.opacity ); 10767 }, 10768 stop: function( event, ui, instance ) { 10769 var o = instance.options; 10770 if ( o._opacity ) { 10771 $( ui.helper ).css( "opacity", o._opacity ); 10772 } 10773 } 10774} ); 10775 10776$.ui.plugin.add( "draggable", "scroll", { 10777 start: function( event, ui, i ) { 10778 if ( !i.scrollParentNotHidden ) { 10779 i.scrollParentNotHidden = i.helper.scrollParent( false ); 10780 } 10781 10782 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 10783 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 10784 i.overflowOffset = i.scrollParentNotHidden.offset(); 10785 } 10786 }, 10787 drag: function( event, ui, i ) { 10788 10789 var o = i.options, 10790 scrolled = false, 10791 scrollParent = i.scrollParentNotHidden[ 0 ], 10792 document = i.document[ 0 ]; 10793 10794 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 10795 if ( !o.axis || o.axis !== "x" ) { 10796 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 10797 o.scrollSensitivity ) { 10798 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 10799 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 10800 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 10801 } 10802 } 10803 10804 if ( !o.axis || o.axis !== "y" ) { 10805 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 10806 o.scrollSensitivity ) { 10807 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 10808 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 10809 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 10810 } 10811 } 10812 10813 } else { 10814 10815 if ( !o.axis || o.axis !== "x" ) { 10816 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 10817 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 10818 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 10819 o.scrollSensitivity ) { 10820 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 10821 } 10822 } 10823 10824 if ( !o.axis || o.axis !== "y" ) { 10825 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 10826 scrolled = $( document ).scrollLeft( 10827 $( document ).scrollLeft() - o.scrollSpeed 10828 ); 10829 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 10830 o.scrollSensitivity ) { 10831 scrolled = $( document ).scrollLeft( 10832 $( document ).scrollLeft() + o.scrollSpeed 10833 ); 10834 } 10835 } 10836 10837 } 10838 10839 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 10840 $.ui.ddmanager.prepareOffsets( i, event ); 10841 } 10842 10843 } 10844} ); 10845 10846$.ui.plugin.add( "draggable", "snap", { 10847 start: function( event, ui, i ) { 10848 10849 var o = i.options; 10850 10851 i.snapElements = []; 10852 10853 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 10854 .each( function() { 10855 var $t = $( this ), 10856 $o = $t.offset(); 10857 if ( this !== i.element[ 0 ] ) { 10858 i.snapElements.push( { 10859 item: this, 10860 width: $t.outerWidth(), height: $t.outerHeight(), 10861 top: $o.top, left: $o.left 10862 } ); 10863 } 10864 } ); 10865 10866 }, 10867 drag: function( event, ui, inst ) { 10868 10869 var ts, bs, ls, rs, l, r, t, b, i, first, 10870 o = inst.options, 10871 d = o.snapTolerance, 10872 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 10873 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 10874 10875 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 10876 10877 l = inst.snapElements[ i ].left - inst.margins.left; 10878 r = l + inst.snapElements[ i ].width; 10879 t = inst.snapElements[ i ].top - inst.margins.top; 10880 b = t + inst.snapElements[ i ].height; 10881 10882 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 10883 !$.contains( inst.snapElements[ i ].item.ownerDocument, 10884 inst.snapElements[ i ].item ) ) { 10885 if ( inst.snapElements[ i ].snapping ) { 10886 if ( inst.options.snap.release ) { 10887 inst.options.snap.release.call( 10888 inst.element, 10889 event, 10890 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 10891 ); 10892 } 10893 } 10894 inst.snapElements[ i ].snapping = false; 10895 continue; 10896 } 10897 10898 if ( o.snapMode !== "inner" ) { 10899 ts = Math.abs( t - y2 ) <= d; 10900 bs = Math.abs( b - y1 ) <= d; 10901 ls = Math.abs( l - x2 ) <= d; 10902 rs = Math.abs( r - x1 ) <= d; 10903 if ( ts ) { 10904 ui.position.top = inst._convertPositionTo( "relative", { 10905 top: t - inst.helperProportions.height, 10906 left: 0 10907 } ).top; 10908 } 10909 if ( bs ) { 10910 ui.position.top = inst._convertPositionTo( "relative", { 10911 top: b, 10912 left: 0 10913 } ).top; 10914 } 10915 if ( ls ) { 10916 ui.position.left = inst._convertPositionTo( "relative", { 10917 top: 0, 10918 left: l - inst.helperProportions.width 10919 } ).left; 10920 } 10921 if ( rs ) { 10922 ui.position.left = inst._convertPositionTo( "relative", { 10923 top: 0, 10924 left: r 10925 } ).left; 10926 } 10927 } 10928 10929 first = ( ts || bs || ls || rs ); 10930 10931 if ( o.snapMode !== "outer" ) { 10932 ts = Math.abs( t - y1 ) <= d; 10933 bs = Math.abs( b - y2 ) <= d; 10934 ls = Math.abs( l - x1 ) <= d; 10935 rs = Math.abs( r - x2 ) <= d; 10936 if ( ts ) { 10937 ui.position.top = inst._convertPositionTo( "relative", { 10938 top: t, 10939 left: 0 10940 } ).top; 10941 } 10942 if ( bs ) { 10943 ui.position.top = inst._convertPositionTo( "relative", { 10944 top: b - inst.helperProportions.height, 10945 left: 0 10946 } ).top; 10947 } 10948 if ( ls ) { 10949 ui.position.left = inst._convertPositionTo( "relative", { 10950 top: 0, 10951 left: l 10952 } ).left; 10953 } 10954 if ( rs ) { 10955 ui.position.left = inst._convertPositionTo( "relative", { 10956 top: 0, 10957 left: r - inst.helperProportions.width 10958 } ).left; 10959 } 10960 } 10961 10962 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 10963 if ( inst.options.snap.snap ) { 10964 inst.options.snap.snap.call( 10965 inst.element, 10966 event, 10967 $.extend( inst._uiHash(), { 10968 snapItem: inst.snapElements[ i ].item 10969 } ) ); 10970 } 10971 } 10972 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 10973 10974 } 10975 10976 } 10977} ); 10978 10979$.ui.plugin.add( "draggable", "stack", { 10980 start: function( event, ui, instance ) { 10981 var min, 10982 o = instance.options, 10983 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 10984 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 10985 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 10986 } ); 10987 10988 if ( !group.length ) { 10989 return; 10990 } 10991 10992 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 10993 $( group ).each( function( i ) { 10994 $( this ).css( "zIndex", min + i ); 10995 } ); 10996 this.css( "zIndex", ( min + group.length ) ); 10997 } 10998} ); 10999 11000$.ui.plugin.add( "draggable", "zIndex", { 11001 start: function( event, ui, instance ) { 11002 var t = $( ui.helper ), 11003 o = instance.options; 11004 11005 if ( t.css( "zIndex" ) ) { 11006 o._zIndex = t.css( "zIndex" ); 11007 } 11008 t.css( "zIndex", o.zIndex ); 11009 }, 11010 stop: function( event, ui, instance ) { 11011 var o = instance.options; 11012 11013 if ( o._zIndex ) { 11014 $( ui.helper ).css( "zIndex", o._zIndex ); 11015 } 11016 } 11017} ); 11018 11019var widgetsDraggable = $.ui.draggable; 11020 11021 11022/*! 11023 * jQuery UI Resizable 1.13.
110232 11024 * http://jqueryui.com 11025 * 11026 * Copyright jQuery Foundation and other contributors 11027 * Released under the MIT license. 11028 * http://jquery.org/license 11029 */ 11030 11031//>>label: Resizable 11032//>>group: Interactions 11033//>>description: Enables resize functionality for any element. 11034//>>docs: http://api.jqueryui.com/resizable/ 11035//>>demos: http://jqueryui.com/resizable/ 11036//>>css.structure: ../../themes/base/core.css 11037//>>css.structure: ../../themes/base/resizable.css 11038//>>css.theme: ../../themes/base/theme.css 11039 11040 11041$.widget( "ui.resizable", $.ui.mouse, { 11042 version: "1.13.2
vendor: 11,739 bytes, lines 11042-11535
11042", 11043 widgetEventPrefix: "resize", 11044 options: { 11045 alsoResize: false, 11046 animate: false, 11047 animateDuration: "slow", 11048 animateEasing: "swing", 11049 aspectRatio: false, 11050 autoHide: false, 11051 classes: { 11052 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 11053 }, 11054 containment: false, 11055 ghost: false, 11056 grid: false, 11057 handles: "e,s,se", 11058 helper: false, 11059 maxHeight: null, 11060 maxWidth: null, 11061 minHeight: 10, 11062 minWidth: 10, 11063 11064 // See #7960 11065 zIndex: 90, 11066 11067 // Callbacks 11068 resize: null, 11069 start: null, 11070 stop: null 11071 }, 11072 11073 _num: function( value ) { 11074 return parseFloat( value ) || 0; 11075 }, 11076 11077 _isNumber: function( value ) { 11078 return !isNaN( parseFloat( value ) ); 11079 }, 11080 11081 _hasScroll: function( el, a ) { 11082 11083 if ( $( el ).css( "overflow" ) === "hidden" ) { 11084 return false; 11085 } 11086 11087 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", 11088 has = false; 11089 11090 if ( el[ scroll ] > 0 ) { 11091 return true; 11092 } 11093 11094 // TODO: determine which cases actually cause this to happen 11095 // if the element doesn't have the scroll set, see if it's possible to 11096 // set the scroll 11097 try { 11098 el[ scroll ] = 1; 11099 has = ( el[ scroll ] > 0 ); 11100 el[ scroll ] = 0; 11101 } catch ( e ) { 11102 11103 // `el` might be a string, then setting `scroll` will throw 11104 // an error in strict mode; ignore it. 11105 } 11106 return has; 11107 }, 11108 11109 _create: function() { 11110 11111 var margins, 11112 o = this.options, 11113 that = this; 11114 this._addClass( "ui-resizable" ); 11115 11116 $.extend( this, { 11117 _aspectRatio: !!( o.aspectRatio ), 11118 aspectRatio: o.aspectRatio, 11119 originalElement: this.element, 11120 _proportionallyResizeElements: [], 11121 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 11122 } ); 11123 11124 // Wrap the element if it cannot hold child nodes 11125 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 11126 11127 this.element.wrap( 11128 $( "<div class='ui-wrapper'></div>" ).css( { 11129 overflow: "hidden", 11130 position: this.element.css( "position" ), 11131 width: this.element.outerWidth(), 11132 height: this.element.outerHeight(), 11133 top: this.element.css( "top" ), 11134 left: this.element.css( "left" ) 11135 } ) 11136 ); 11137 11138 this.element = this.element.parent().data( 11139 "ui-resizable", this.element.resizable( "instance" ) 11140 ); 11141 11142 this.elementIsWrapper = true; 11143 11144 margins = { 11145 marginTop: this.originalElement.css( "marginTop" ), 11146 marginRight: this.originalElement.css( "marginRight" ), 11147 marginBottom: this.originalElement.css( "marginBottom" ), 11148 marginLeft: this.originalElement.css( "marginLeft" ) 11149 }; 11150 11151 this.element.css( margins ); 11152 this.originalElement.css( "margin", 0 ); 11153 11154 // support: Safari 11155 // Prevent Safari textarea resize 11156 this.originalResizeStyle = this.originalElement.css( "resize" ); 11157 this.originalElement.css( "resize", "none" ); 11158 11159 this._proportionallyResizeElements.push( this.originalElement.css( { 11160 position: "static", 11161 zoom: 1, 11162 display: "block" 11163 } ) ); 11164 11165 // Support: IE9 11166 // avoid IE jump (hard set the margin) 11167 this.originalElement.css( margins ); 11168 11169 this._proportionallyResize(); 11170 } 11171 11172 this._setupHandles(); 11173 11174 if ( o.autoHide ) { 11175 $( this.element ) 11176 .on( "mouseenter", function() { 11177 if ( o.disabled ) { 11178 return; 11179 } 11180 that._removeClass( "ui-resizable-autohide" ); 11181 that._handles.show(); 11182 } ) 11183 .on( "mouseleave", function() { 11184 if ( o.disabled ) { 11185 return; 11186 } 11187 if ( !that.resizing ) { 11188 that._addClass( "ui-resizable-autohide" ); 11189 that._handles.hide(); 11190 } 11191 } ); 11192 } 11193 11194 this._mouseInit(); 11195 }, 11196 11197 _destroy: function() { 11198 11199 this._mouseDestroy(); 11200 this._addedHandles.remove(); 11201 11202 var wrapper, 11203 _destroy = function( exp ) { 11204 $( exp ) 11205 .removeData( "resizable" ) 11206 .removeData( "ui-resizable" ) 11207 .off( ".resizable" ); 11208 }; 11209 11210 // TODO: Unwrap at same DOM position 11211 if ( this.elementIsWrapper ) { 11212 _destroy( this.element ); 11213 wrapper = this.element; 11214 this.originalElement.css( { 11215 position: wrapper.css( "position" ), 11216 width: wrapper.outerWidth(), 11217 height: wrapper.outerHeight(), 11218 top: wrapper.css( "top" ), 11219 left: wrapper.css( "left" ) 11220 } ).insertAfter( wrapper ); 11221 wrapper.remove(); 11222 } 11223 11224 this.originalElement.css( "resize", this.originalResizeStyle ); 11225 _destroy( this.originalElement ); 11226 11227 return this; 11228 }, 11229 11230 _setOption: function( key, value ) { 11231 this._super( key, value ); 11232 11233 switch ( key ) { 11234 case "handles": 11235 this._removeHandles(); 11236 this._setupHandles(); 11237 break; 11238 case "aspectRatio": 11239 this._aspectRatio = !!value; 11240 break; 11241 default: 11242 break; 11243 } 11244 }, 11245 11246 _setupHandles: function() { 11247 var o = this.options, handle, i, n, hname, axis, that = this; 11248 this.handles = o.handles || 11249 ( !$( ".ui-resizable-handle", this.element ).length ? 11250 "e,s,se" : { 11251 n: ".ui-resizable-n", 11252 e: ".ui-resizable-e", 11253 s: ".ui-resizable-s", 11254 w: ".ui-resizable-w", 11255 se: ".ui-resizable-se", 11256 sw: ".ui-resizable-sw", 11257 ne: ".ui-resizable-ne", 11258 nw: ".ui-resizable-nw" 11259 } ); 11260 11261 this._handles = $(); 11262 this._addedHandles = $(); 11263 if ( this.handles.constructor === String ) { 11264 11265 if ( this.handles === "all" ) { 11266 this.handles = "n,e,s,w,se,sw,ne,nw"; 11267 } 11268 11269 n = this.handles.split( "," ); 11270 this.handles = {}; 11271 11272 for ( i = 0; i < n.length; i++ ) { 11273 11274 handle = String.prototype.trim.call( n[ i ] ); 11275 hname = "ui-resizable-" + handle; 11276 axis = $( "<div>" ); 11277 this._addClass( axis, "ui-resizable-handle " + hname ); 11278 11279 axis.css( { zIndex: o.zIndex } ); 11280 11281 this.handles[ handle ] = ".ui-resizable-" + handle; 11282 if ( !this.element.children( this.handles[ handle ] ).length ) { 11283 this.element.append( axis ); 11284 this._addedHandles = this._addedHandles.add( axis ); 11285 } 11286 } 11287 11288 } 11289 11290 this._renderAxis = function( target ) { 11291 11292 var i, axis, padPos, padWrapper; 11293 11294 target = target || this.element; 11295 11296 for ( i in this.handles ) { 11297 11298 if ( this.handles[ i ].constructor === String ) { 11299 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 11300 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 11301 this.handles[ i ] = $( this.handles[ i ] ); 11302 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 11303 } 11304 11305 if ( this.elementIsWrapper && 11306 this.originalElement[ 0 ] 11307 .nodeName 11308 .match( /^(textarea|input|select|button)$/i ) ) { 11309 axis = $( this.handles[ i ], this.element ); 11310 11311 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 11312 axis.outerHeight() : 11313 axis.outerWidth(); 11314 11315 padPos = [ "padding", 11316 /ne|nw|n/.test( i ) ? "Top" : 11317 /se|sw|s/.test( i ) ? "Bottom" : 11318 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 11319 11320 target.css( padPos, padWrapper ); 11321 11322 this._proportionallyResize(); 11323 } 11324 11325 this._handles = this._handles.add( this.handles[ i ] ); 11326 } 11327 }; 11328 11329 // TODO: make renderAxis a prototype function 11330 this._renderAxis( this.element ); 11331 11332 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 11333 this._handles.disableSelection(); 11334 11335 this._handles.on( "mouseover", function() { 11336 if ( !that.resizing ) { 11337 if ( this.className ) { 11338 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 11339 } 11340 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 11341 } 11342 } ); 11343 11344 if ( o.autoHide ) { 11345 this._handles.hide(); 11346 this._addClass( "ui-resizable-autohide" ); 11347 } 11348 }, 11349 11350 _removeHandles: function() { 11351 this._addedHandles.remove(); 11352 }, 11353 11354 _mouseCapture: function( event ) { 11355 var i, handle, 11356 capture = false; 11357 11358 for ( i in this.handles ) { 11359 handle = $( this.handles[ i ] )[ 0 ]; 11360 if ( handle === event.target || $.contains( handle, event.target ) ) { 11361 capture = true; 11362 } 11363 } 11364 11365 return !this.options.disabled && capture; 11366 }, 11367 11368 _mouseStart: function( event ) { 11369 11370 var curleft, curtop, cursor, 11371 o = this.options, 11372 el = this.element; 11373 11374 this.resizing = true; 11375 11376 this._renderProxy(); 11377 11378 curleft = this._num( this.helper.css( "left" ) ); 11379 curtop = this._num( this.helper.css( "top" ) ); 11380 11381 if ( o.containment ) { 11382 curleft += $( o.containment ).scrollLeft() || 0; 11383 curtop += $( o.containment ).scrollTop() || 0; 11384 } 11385 11386 this.offset = this.helper.offset(); 11387 this.position = { left: curleft, top: curtop }; 11388 11389 this.size = this._helper ? { 11390 width: this.helper.width(), 11391 height: this.helper.height() 11392 } : { 11393 width: el.width(), 11394 height: el.height() 11395 }; 11396 11397 this.originalSize = this._helper ? { 11398 width: el.outerWidth(), 11399 height: el.outerHeight() 11400 } : { 11401 width: el.width(), 11402 height: el.height() 11403 }; 11404 11405 this.sizeDiff = { 11406 width: el.outerWidth() - el.width(), 11407 height: el.outerHeight() - el.height() 11408 }; 11409 11410 this.originalPosition = { left: curleft, top: curtop }; 11411 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 11412 11413 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 11414 o.aspectRatio : 11415 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 11416 11417 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 11418 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 11419 11420 this._addClass( "ui-resizable-resizing" ); 11421 this._propagate( "start", event ); 11422 return true; 11423 }, 11424 11425 _mouseDrag: function( event ) { 11426 11427 var data, props, 11428 smp = this.originalMousePosition, 11429 a = this.axis, 11430 dx = ( event.pageX - smp.left ) || 0, 11431 dy = ( event.pageY - smp.top ) || 0, 11432 trigger = this._change[ a ]; 11433 11434 this._updatePrevProperties(); 11435 11436 if ( !trigger ) { 11437 return false; 11438 } 11439 11440 data = trigger.apply( this, [ event, dx, dy ] ); 11441 11442 this._updateVirtualBoundaries( event.shiftKey ); 11443 if ( this._aspectRatio || event.shiftKey ) { 11444 data = this._updateRatio( data, event ); 11445 } 11446 11447 data = this._respectSize( data, event ); 11448 11449 this._updateCache( data ); 11450 11451 this._propagate( "resize", event ); 11452 11453 props = this._applyChanges(); 11454 11455 if ( !this._helper && this._proportionallyResizeElements.length ) { 11456 this._proportionallyResize(); 11457 } 11458 11459 if ( !$.isEmptyObject( props ) ) { 11460 this._updatePrevProperties(); 11461 this._trigger( "resize", event, this.ui() ); 11462 this._applyChanges(); 11463 } 11464 11465 return false; 11466 }, 11467 11468 _mouseStop: function( event ) { 11469 11470 this.resizing = false; 11471 var pr, ista, soffseth, soffsetw, s, left, top, 11472 o = this.options, that = this; 11473 11474 if ( this._helper ) { 11475 11476 pr = this._proportionallyResizeElements; 11477 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 11478 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 11479 soffsetw = ista ? 0 : that.sizeDiff.width; 11480 11481 s = { 11482 width: ( that.helper.width() - soffsetw ), 11483 height: ( that.helper.height() - soffseth ) 11484 }; 11485 left = ( parseFloat( that.element.css( "left" ) ) + 11486 ( that.position.left - that.originalPosition.left ) ) || null; 11487 top = ( parseFloat( that.element.css( "top" ) ) + 11488 ( that.position.top - that.originalPosition.top ) ) || null; 11489 11490 if ( !o.animate ) { 11491 this.element.css( $.extend( s, { top: top, left: left } ) ); 11492 } 11493 11494 that.helper.height( that.size.height ); 11495 that.helper.width( that.size.width ); 11496 11497 if ( this._helper && !o.animate ) { 11498 this._proportionallyResize(); 11499 } 11500 } 11501 11502 $( "body" ).css( "cursor", "auto" ); 11503 11504 this._removeClass( "ui-resizable-resizing" ); 11505 11506 this._propagate( "stop", event ); 11507 11508 if ( this._helper ) { 11509 this.helper.remove(); 11510 } 11511 11512 return false; 11513 11514 }, 11515 11516 _updatePrevProperties: function() { 11517 this.prevPosition = { 11518 top: this.position.top, 11519 left: this.position.left 11520 }; 11521 this.prevSize = { 11522 width: this.size.width, 11523 height: this.size.height 11524 }; 11525 }, 11526 11527 _applyChanges: function() { 11528 var props = {}; 11529 11530 if ( this.position.top !== this.prevPosition.top ) { 11531 props.top = this.position.top + "px"; 11532 } 11533 if ( this.position.left !== this.prevPosition.left ) { 11534 props.left = this.position.left + "px"; 11535 }
vendor: 9,533 bytes, lines 11536-11903
11536 if ( this.size.width !== this.prevSize.width ) { 11537 props.width = this.size.width + "px"; 11538 } 11539 if ( this.size.height !== this.prevSize.height ) { 11540 props.height = this.size.height + "px"; 11541 } 11542 11543 this.helper.css( props ); 11544 11545 return props; 11546 }, 11547 11548 _updateVirtualBoundaries: function( forceAspectRatio ) { 11549 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 11550 o = this.options; 11551 11552 b = { 11553 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 11554 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 11555 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 11556 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 11557 }; 11558 11559 if ( this._aspectRatio || forceAspectRatio ) { 11560 pMinWidth = b.minHeight * this.aspectRatio; 11561 pMinHeight = b.minWidth / this.aspectRatio; 11562 pMaxWidth = b.maxHeight * this.aspectRatio; 11563 pMaxHeight = b.maxWidth / this.aspectRatio; 11564 11565 if ( pMinWidth > b.minWidth ) { 11566 b.minWidth = pMinWidth; 11567 } 11568 if ( pMinHeight > b.minHeight ) { 11569 b.minHeight = pMinHeight; 11570 } 11571 if ( pMaxWidth < b.maxWidth ) { 11572 b.maxWidth = pMaxWidth; 11573 } 11574 if ( pMaxHeight < b.maxHeight ) { 11575 b.maxHeight = pMaxHeight; 11576 } 11577 } 11578 this._vBoundaries = b; 11579 }, 11580 11581 _updateCache: function( data ) { 11582 this.offset = this.helper.offset(); 11583 if ( this._isNumber( data.left ) ) { 11584 this.position.left = data.left; 11585 } 11586 if ( this._isNumber( data.top ) ) { 11587 this.position.top = data.top; 11588 } 11589 if ( this._isNumber( data.height ) ) { 11590 this.size.height = data.height; 11591 } 11592 if ( this._isNumber( data.width ) ) { 11593 this.size.width = data.width; 11594 } 11595 }, 11596 11597 _updateRatio: function( data ) { 11598 11599 var cpos = this.position, 11600 csize = this.size, 11601 a = this.axis; 11602 11603 if ( this._isNumber( data.height ) ) { 11604 data.width = ( data.height * this.aspectRatio ); 11605 } else if ( this._isNumber( data.width ) ) { 11606 data.height = ( data.width / this.aspectRatio ); 11607 } 11608 11609 if ( a === "sw" ) { 11610 data.left = cpos.left + ( csize.width - data.width ); 11611 data.top = null; 11612 } 11613 if ( a === "nw" ) { 11614 data.top = cpos.top + ( csize.height - data.height ); 11615 data.left = cpos.left + ( csize.width - data.width ); 11616 } 11617 11618 return data; 11619 }, 11620 11621 _respectSize: function( data ) { 11622 11623 var o = this._vBoundaries, 11624 a = this.axis, 11625 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 11626 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 11627 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 11628 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 11629 dw = this.originalPosition.left + this.originalSize.width, 11630 dh = this.originalPosition.top + this.originalSize.height, 11631 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 11632 if ( isminw ) { 11633 data.width = o.minWidth; 11634 } 11635 if ( isminh ) { 11636 data.height = o.minHeight; 11637 } 11638 if ( ismaxw ) { 11639 data.width = o.maxWidth; 11640 } 11641 if ( ismaxh ) { 11642 data.height = o.maxHeight; 11643 } 11644 11645 if ( isminw && cw ) { 11646 data.left = dw - o.minWidth; 11647 } 11648 if ( ismaxw && cw ) { 11649 data.left = dw - o.maxWidth; 11650 } 11651 if ( isminh && ch ) { 11652 data.top = dh - o.minHeight; 11653 } 11654 if ( ismaxh && ch ) { 11655 data.top = dh - o.maxHeight; 11656 } 11657 11658 // Fixing jump error on top/left - bug #2330 11659 if ( !data.width && !data.height && !data.left && data.top ) { 11660 data.top = null; 11661 } else if ( !data.width && !data.height && !data.top && data.left ) { 11662 data.left = null; 11663 } 11664 11665 return data; 11666 }, 11667 11668 _getPaddingPlusBorderDimensions: function( element ) { 11669 var i = 0, 11670 widths = [], 11671 borders = [ 11672 element.css( "borderTopWidth" ), 11673 element.css( "borderRightWidth" ), 11674 element.css( "borderBottomWidth" ), 11675 element.css( "borderLeftWidth" ) 11676 ], 11677 paddings = [ 11678 element.css( "paddingTop" ), 11679 element.css( "paddingRight" ), 11680 element.css( "paddingBottom" ), 11681 element.css( "paddingLeft" ) 11682 ]; 11683 11684 for ( ; i < 4; i++ ) { 11685 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 11686 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 11687 } 11688 11689 return { 11690 height: widths[ 0 ] + widths[ 2 ], 11691 width: widths[ 1 ] + widths[ 3 ] 11692 }; 11693 }, 11694 11695 _proportionallyResize: function() { 11696 11697 if ( !this._proportionallyResizeElements.length ) { 11698 return; 11699 } 11700 11701 var prel, 11702 i = 0, 11703 element = this.helper || this.element; 11704 11705 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 11706 11707 prel = this._proportionallyResizeElements[ i ]; 11708 11709 // TODO: Seems like a bug to cache this.outerDimensions 11710 // considering that we are in a loop. 11711 if ( !this.outerDimensions ) { 11712 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 11713 } 11714 11715 prel.css( { 11716 height: ( element.height() - this.outerDimensions.height ) || 0, 11717 width: ( element.width() - this.outerDimensions.width ) || 0 11718 } ); 11719 11720 } 11721 11722 }, 11723 11724 _renderProxy: function() { 11725 11726 var el = this.element, o = this.options; 11727 this.elementOffset = el.offset(); 11728 11729 if ( this._helper ) { 11730 11731 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 11732 11733 this._addClass( this.helper, this._helper ); 11734 this.helper.css( { 11735 width: this.element.outerWidth(), 11736 height: this.element.outerHeight(), 11737 position: "absolute", 11738 left: this.elementOffset.left + "px", 11739 top: this.elementOffset.top + "px", 11740 zIndex: ++o.zIndex //TODO: Don't modify option 11741 } ); 11742 11743 this.helper 11744 .appendTo( "body" ) 11745 .disableSelection(); 11746 11747 } else { 11748 this.helper = this.element; 11749 } 11750 11751 }, 11752 11753 _change: { 11754 e: function( event, dx ) { 11755 return { width: this.originalSize.width + dx }; 11756 }, 11757 w: function( event, dx ) { 11758 var cs = this.originalSize, sp = this.originalPosition; 11759 return { left: sp.left + dx, width: cs.width - dx }; 11760 }, 11761 n: function( event, dx, dy ) { 11762 var cs = this.originalSize, sp = this.originalPosition; 11763 return { top: sp.top + dy, height: cs.height - dy }; 11764 }, 11765 s: function( event, dx, dy ) { 11766 return { height: this.originalSize.height + dy }; 11767 }, 11768 se: function( event, dx, dy ) { 11769 return $.extend( this._change.s.apply( this, arguments ), 11770 this._change.e.apply( this, [ event, dx, dy ] ) ); 11771 }, 11772 sw: function( event, dx, dy ) { 11773 return $.extend( this._change.s.apply( this, arguments ), 11774 this._change.w.apply( this, [ event, dx, dy ] ) ); 11775 }, 11776 ne: function( event, dx, dy ) { 11777 return $.extend( this._change.n.apply( this, arguments ), 11778 this._change.e.apply( this, [ event, dx, dy ] ) ); 11779 }, 11780 nw: function( event, dx, dy ) { 11781 return $.extend( this._change.n.apply( this, arguments ), 11782 this._change.w.apply( this, [ event, dx, dy ] ) ); 11783 } 11784 }, 11785 11786 _propagate: function( n, event ) { 11787 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 11788 if ( n !== "resize" ) { 11789 this._trigger( n, event, this.ui() ); 11790 } 11791 }, 11792 11793 plugins: {}, 11794 11795 ui: function() { 11796 return { 11797 originalElement: this.originalElement, 11798 element: this.element, 11799 helper: this.helper, 11800 position: this.position, 11801 size: this.size, 11802 originalSize: this.originalSize, 11803 originalPosition: this.originalPosition 11804 }; 11805 } 11806 11807} ); 11808 11809/* 11810 * Resizable Extensions 11811 */ 11812 11813$.ui.plugin.add( "resizable", "animate", { 11814 11815 stop: function( event ) { 11816 var that = $( this ).resizable( "instance" ), 11817 o = that.options, 11818 pr = that._proportionallyResizeElements, 11819 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 11820 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 11821 soffsetw = ista ? 0 : that.sizeDiff.width, 11822 style = { 11823 width: ( that.size.width - soffsetw ), 11824 height: ( that.size.height - soffseth ) 11825 }, 11826 left = ( parseFloat( that.element.css( "left" ) ) + 11827 ( that.position.left - that.originalPosition.left ) ) || null, 11828 top = ( parseFloat( that.element.css( "top" ) ) + 11829 ( that.position.top - that.originalPosition.top ) ) || null; 11830 11831 that.element.animate( 11832 $.extend( style, top && left ? { top: top, left: left } : {} ), { 11833 duration: o.animateDuration, 11834 easing: o.animateEasing, 11835 step: function() { 11836 11837 var data = { 11838 width: parseFloat( that.element.css( "width" ) ), 11839 height: parseFloat( that.element.css( "height" ) ), 11840 top: parseFloat( that.element.css( "top" ) ), 11841 left: parseFloat( that.element.css( "left" ) ) 11842 }; 11843 11844 if ( pr && pr.length ) { 11845 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 11846 } 11847 11848 // Propagating resize, and updating values for each animation step 11849 that._updateCache( data ); 11850 that._propagate( "resize", event ); 11851 11852 } 11853 } 11854 ); 11855 } 11856 11857} ); 11858 11859$.ui.plugin.add( "resizable", "containment", { 11860 11861 start: function() { 11862 var element, p, co, ch, cw, width, height, 11863 that = $( this ).resizable( "instance" ), 11864 o = that.options, 11865 el = that.element, 11866 oc = o.containment, 11867 ce = ( oc instanceof $ ) ? 11868 oc.get( 0 ) : 11869 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 11870 11871 if ( !ce ) { 11872 return; 11873 } 11874 11875 that.containerElement = $( ce ); 11876 11877 if ( /document/.test( oc ) || oc === document ) { 11878 that.containerOffset = { 11879 left: 0, 11880 top: 0 11881 }; 11882 that.containerPosition = { 11883 left: 0, 11884 top: 0 11885 }; 11886 11887 that.parentData = { 11888 element: $( document ), 11889 left: 0, 11890 top: 0, 11891 width: $( document ).width(), 11892 height: $( document ).height() || document.body.parentNode.scrollHeight 11893 }; 11894 } else { 11895 element = $( ce ); 11896 p = []; 11897 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 11898 p[ i ] = that._num( element.css( "padding" + name ) ); 11899 } ); 11900 11901 that.containerOffset = element.offset(); 11902 that.containerPosition = element.position(); 11903 that.containerSize = {
vendor: 5,871 bytes, lines 11904-12128
11904 height: ( element.innerHeight() - p[ 3 ] ), 11905 width: ( element.innerWidth() - p[ 1 ] ) 11906 }; 11907 11908 co = that.containerOffset; 11909 ch = that.containerSize.height; 11910 cw = that.containerSize.width; 11911 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 11912 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 11913 11914 that.parentData = { 11915 element: ce, 11916 left: co.left, 11917 top: co.top, 11918 width: width, 11919 height: height 11920 }; 11921 } 11922 }, 11923 11924 resize: function( event ) { 11925 var woset, hoset, isParent, isOffsetRelative, 11926 that = $( this ).resizable( "instance" ), 11927 o = that.options, 11928 co = that.containerOffset, 11929 cp = that.position, 11930 pRatio = that._aspectRatio || event.shiftKey, 11931 cop = { 11932 top: 0, 11933 left: 0 11934 }, 11935 ce = that.containerElement, 11936 continueResize = true; 11937 11938 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 11939 cop = co; 11940 } 11941 11942 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 11943 that.size.width = that.size.width + 11944 ( that._helper ? 11945 ( that.position.left - co.left ) : 11946 ( that.position.left - cop.left ) ); 11947 11948 if ( pRatio ) { 11949 that.size.height = that.size.width / that.aspectRatio; 11950 continueResize = false; 11951 } 11952 that.position.left = o.helper ? co.left : 0; 11953 } 11954 11955 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 11956 that.size.height = that.size.height + 11957 ( that._helper ? 11958 ( that.position.top - co.top ) : 11959 that.position.top ); 11960 11961 if ( pRatio ) { 11962 that.size.width = that.size.height * that.aspectRatio; 11963 continueResize = false; 11964 } 11965 that.position.top = that._helper ? co.top : 0; 11966 } 11967 11968 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 11969 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 11970 11971 if ( isParent && isOffsetRelative ) { 11972 that.offset.left = that.parentData.left + that.position.left; 11973 that.offset.top = that.parentData.top + that.position.top; 11974 } else { 11975 that.offset.left = that.element.offset().left; 11976 that.offset.top = that.element.offset().top; 11977 } 11978 11979 woset = Math.abs( that.sizeDiff.width + 11980 ( that._helper ? 11981 that.offset.left - cop.left : 11982 ( that.offset.left - co.left ) ) ); 11983 11984 hoset = Math.abs( that.sizeDiff.height + 11985 ( that._helper ? 11986 that.offset.top - cop.top : 11987 ( that.offset.top - co.top ) ) ); 11988 11989 if ( woset + that.size.width >= that.parentData.width ) { 11990 that.size.width = that.parentData.width - woset; 11991 if ( pRatio ) { 11992 that.size.height = that.size.width / that.aspectRatio; 11993 continueResize = false; 11994 } 11995 } 11996 11997 if ( hoset + that.size.height >= that.parentData.height ) { 11998 that.size.height = that.parentData.height - hoset; 11999 if ( pRatio ) { 12000 that.size.width = that.size.height * that.aspectRatio; 12001 continueResize = false; 12002 } 12003 } 12004 12005 if ( !continueResize ) { 12006 that.position.left = that.prevPosition.left; 12007 that.position.top = that.prevPosition.top; 12008 that.size.width = that.prevSize.width; 12009 that.size.height = that.prevSize.height; 12010 } 12011 }, 12012 12013 stop: function() { 12014 var that = $( this ).resizable( "instance" ), 12015 o = that.options, 12016 co = that.containerOffset, 12017 cop = that.containerPosition, 12018 ce = that.containerElement, 12019 helper = $( that.helper ), 12020 ho = helper.offset(), 12021 w = helper.outerWidth() - that.sizeDiff.width, 12022 h = helper.outerHeight() - that.sizeDiff.height; 12023 12024 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 12025 $( this ).css( { 12026 left: ho.left - cop.left - co.left, 12027 width: w, 12028 height: h 12029 } ); 12030 } 12031 12032 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 12033 $( this ).css( { 12034 left: ho.left - cop.left - co.left, 12035 width: w, 12036 height: h 12037 } ); 12038 } 12039 } 12040} ); 12041 12042$.ui.plugin.add( "resizable", "alsoResize", { 12043 12044 start: function() { 12045 var that = $( this ).resizable( "instance" ), 12046 o = that.options; 12047 12048 $( o.alsoResize ).each( function() { 12049 var el = $( this ); 12050 el.data( "ui-resizable-alsoresize", { 12051 width: parseFloat( el.width() ), height: parseFloat( el.height() ), 12052 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 12053 } ); 12054 } ); 12055 }, 12056 12057 resize: function( event, ui ) { 12058 var that = $( this ).resizable( "instance" ), 12059 o = that.options, 12060 os = that.originalSize, 12061 op = that.originalPosition, 12062 delta = { 12063 height: ( that.size.height - os.height ) || 0, 12064 width: ( that.size.width - os.width ) || 0, 12065 top: ( that.position.top - op.top ) || 0, 12066 left: ( that.position.left - op.left ) || 0 12067 }; 12068 12069 $( o.alsoResize ).each( function() { 12070 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 12071 css = el.parents( ui.originalElement[ 0 ] ).length ? 12072 [ "width", "height" ] : 12073 [ "width", "height", "top", "left" ]; 12074 12075 $.each( css, function( i, prop ) { 12076 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 12077 if ( sum && sum >= 0 ) { 12078 style[ prop ] = sum || null; 12079 } 12080 } ); 12081 12082 el.css( style ); 12083 } ); 12084 }, 12085 12086 stop: function() { 12087 $( this ).removeData( "ui-resizable-alsoresize" ); 12088 } 12089} ); 12090 12091$.ui.plugin.add( "resizable", "ghost", { 12092 12093 start: function() { 12094 12095 var that = $( this ).resizable( "instance" ), cs = that.size; 12096 12097 that.ghost = that.originalElement.clone(); 12098 that.ghost.css( { 12099 opacity: 0.25, 12100 display: "block", 12101 position: "relative", 12102 height: cs.height, 12103 width: cs.width, 12104 margin: 0, 12105 left: 0, 12106 top: 0 12107 } ); 12108 12109 that._addClass( that.ghost, "ui-resizable-ghost" ); 12110 12111 // DEPRECATED 12112 // TODO: remove after 1.12 12113 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) { 12114 12115 // Ghost option 12116 that.ghost.addClass( this.options.ghost ); 12117 } 12118 12119 that.ghost.appendTo( that.helper ); 12120 12121 }, 12122 12123 resize: function() { 12124 var that = $( this ).resizable( "instance" ); 12125 if ( that.ghost ) { 12126 that.ghost.css( { 12127 position: "relative", 12128 height: that.size.height,
vendor: 2,863 bytes, lines 12129-12240
12129 width: that.size.width 12130 } ); 12131 } 12132 }, 12133 12134 stop: function() { 12135 var that = $( this ).resizable( "instance" ); 12136 if ( that.ghost && that.helper ) { 12137 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 12138 } 12139 } 12140 12141} ); 12142 12143$.ui.plugin.add( "resizable", "grid", { 12144 12145 resize: function() { 12146 var outerDimensions, 12147 that = $( this ).resizable( "instance" ), 12148 o = that.options, 12149 cs = that.size, 12150 os = that.originalSize, 12151 op = that.originalPosition, 12152 a = that.axis, 12153 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 12154 gridX = ( grid[ 0 ] || 1 ), 12155 gridY = ( grid[ 1 ] || 1 ), 12156 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 12157 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 12158 newWidth = os.width + ox, 12159 newHeight = os.height + oy, 12160 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 12161 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 12162 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 12163 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 12164 12165 o.grid = grid; 12166 12167 if ( isMinWidth ) { 12168 newWidth += gridX; 12169 } 12170 if ( isMinHeight ) { 12171 newHeight += gridY; 12172 } 12173 if ( isMaxWidth ) { 12174 newWidth -= gridX; 12175 } 12176 if ( isMaxHeight ) { 12177 newHeight -= gridY; 12178 } 12179 12180 if ( /^(se|s|e)$/.test( a ) ) { 12181 that.size.width = newWidth; 12182 that.size.height = newHeight; 12183 } else if ( /^(ne)$/.test( a ) ) { 12184 that.size.width = newWidth; 12185 that.size.height = newHeight; 12186 that.position.top = op.top - oy; 12187 } else if ( /^(sw)$/.test( a ) ) { 12188 that.size.width = newWidth; 12189 that.size.height = newHeight; 12190 that.position.left = op.left - ox; 12191 } else { 12192 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 12193 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 12194 } 12195 12196 if ( newHeight - gridY > 0 ) { 12197 that.size.height = newHeight; 12198 that.position.top = op.top - oy; 12199 } else { 12200 newHeight = gridY - outerDimensions.height; 12201 that.size.height = newHeight; 12202 that.position.top = op.top + os.height - newHeight; 12203 } 12204 if ( newWidth - gridX > 0 ) { 12205 that.size.width = newWidth; 12206 that.position.left = op.left - ox; 12207 } else { 12208 newWidth = gridX - outerDimensions.width; 12209 that.size.width = newWidth; 12210 that.position.left = op.left + os.width - newWidth; 12211 } 12212 } 12213 } 12214 12215} ); 12216 12217var widgetsResizable = $.ui.resizable; 12218 12219 12220/*! 12221 * jQuery UI Dialog 1.13.2 12222 * http://jqueryui.com 12223 * 12224 * Copyright jQuery Foundation and other contributors 12225 * Released under the MIT license. 12226 * http://jquery.org/license 12227 */ 12228 12229//>>label: Dialog 12230//>>group: Widgets 12231//>>description: Displays customizable dialog windows. 12232//>>docs: http://api.jqueryui.com/dialog/ 12233//>>demos: http://jqueryui.com/dialog/ 12234//>>css.structure: ../../themes/base/core.css 12235//>>css.structure: ../../themes/base/dialog.css 12236//>>css.theme: ../../themes/base/theme.css 12237 12238 12239$.widget( "ui.dialog", { 12240 version: "1.13.2
vendor: 20,928 bytes, lines 12240-13074
12240", 12241 options: { 12242 appendTo: "body", 12243 autoOpen: true, 12244 buttons: [], 12245 classes: { 12246 "ui-dialog": "ui-corner-all", 12247 "ui-dialog-titlebar": "ui-corner-all" 12248 }, 12249 closeOnEscape: true, 12250 closeText: "Close", 12251 draggable: true, 12252 hide: null, 12253 height: "auto", 12254 maxHeight: null, 12255 maxWidth: null, 12256 minHeight: 150, 12257 minWidth: 150, 12258 modal: false, 12259 position: { 12260 my: "center", 12261 at: "center", 12262 of: window, 12263 collision: "fit", 12264 12265 // Ensure the titlebar is always visible 12266 using: function( pos ) { 12267 var topOffset = $( this ).css( pos ).offset().top; 12268 if ( topOffset < 0 ) { 12269 $( this ).css( "top", pos.top - topOffset ); 12270 } 12271 } 12272 }, 12273 resizable: true, 12274 show: null, 12275 title: null, 12276 width: 300, 12277 12278 // Callbacks 12279 beforeClose: null, 12280 close: null, 12281 drag: null, 12282 dragStart: null, 12283 dragStop: null, 12284 focus: null, 12285 open: null, 12286 resize: null, 12287 resizeStart: null, 12288 resizeStop: null 12289 }, 12290 12291 sizeRelatedOptions: { 12292 buttons: true, 12293 height: true, 12294 maxHeight: true, 12295 maxWidth: true, 12296 minHeight: true, 12297 minWidth: true, 12298 width: true 12299 }, 12300 12301 resizableRelatedOptions: { 12302 maxHeight: true, 12303 maxWidth: true, 12304 minHeight: true, 12305 minWidth: true 12306 }, 12307 12308 _create: function() { 12309 this.originalCss = { 12310 display: this.element[ 0 ].style.display, 12311 width: this.element[ 0 ].style.width, 12312 minHeight: this.element[ 0 ].style.minHeight, 12313 maxHeight: this.element[ 0 ].style.maxHeight, 12314 height: this.element[ 0 ].style.height 12315 }; 12316 this.originalPosition = { 12317 parent: this.element.parent(), 12318 index: this.element.parent().children().index( this.element ) 12319 }; 12320 this.originalTitle = this.element.attr( "title" ); 12321 if ( this.options.title == null && this.originalTitle != null ) { 12322 this.options.title = this.originalTitle; 12323 } 12324 12325 // Dialogs can't be disabled 12326 if ( this.options.disabled ) { 12327 this.options.disabled = false; 12328 } 12329 12330 this._createWrapper(); 12331 12332 this.element 12333 .show() 12334 .removeAttr( "title" ) 12335 .appendTo( this.uiDialog ); 12336 12337 this._addClass( "ui-dialog-content", "ui-widget-content" ); 12338 12339 this._createTitlebar(); 12340 this._createButtonPane(); 12341 12342 if ( this.options.draggable && $.fn.draggable ) { 12343 this._makeDraggable(); 12344 } 12345 if ( this.options.resizable && $.fn.resizable ) { 12346 this._makeResizable(); 12347 } 12348 12349 this._isOpen = false; 12350 12351 this._trackFocus(); 12352 }, 12353 12354 _init: function() { 12355 if ( this.options.autoOpen ) { 12356 this.open(); 12357 } 12358 }, 12359 12360 _appendTo: function() { 12361 var element = this.options.appendTo; 12362 if ( element && ( element.jquery || element.nodeType ) ) { 12363 return $( element ); 12364 } 12365 return this.document.find( element || "body" ).eq( 0 ); 12366 }, 12367 12368 _destroy: function() { 12369 var next, 12370 originalPosition = this.originalPosition; 12371 12372 this._untrackInstance(); 12373 this._destroyOverlay(); 12374 12375 this.element 12376 .removeUniqueId() 12377 .css( this.originalCss ) 12378 12379 // Without detaching first, the following becomes really slow 12380 .detach(); 12381 12382 this.uiDialog.remove(); 12383 12384 if ( this.originalTitle ) { 12385 this.element.attr( "title", this.originalTitle ); 12386 } 12387 12388 next = originalPosition.parent.children().eq( originalPosition.index ); 12389 12390 // Don't try to place the dialog next to itself (#8613) 12391 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 12392 next.before( this.element ); 12393 } else { 12394 originalPosition.parent.append( this.element ); 12395 } 12396 }, 12397 12398 widget: function() { 12399 return this.uiDialog; 12400 }, 12401 12402 disable: $.noop, 12403 enable: $.noop, 12404 12405 close: function( event ) { 12406 var that = this; 12407 12408 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 12409 return; 12410 } 12411 12412 this._isOpen = false; 12413 this._focusedElement = null; 12414 this._destroyOverlay(); 12415 this._untrackInstance(); 12416 12417 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 12418 12419 // Hiding a focused element doesn't trigger blur in WebKit 12420 // so in case we have nothing to focus on, explicitly blur the active element 12421 // https://bugs.webkit.org/show_bug.cgi?id=47182 12422 $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12423 } 12424 12425 this._hide( this.uiDialog, this.options.hide, function() { 12426 that._trigger( "close", event ); 12427 } ); 12428 }, 12429 12430 isOpen: function() { 12431 return this._isOpen; 12432 }, 12433 12434 moveToTop: function() { 12435 this._moveToTop(); 12436 }, 12437 12438 _moveToTop: function( event, silent ) { 12439 var moved = false, 12440 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 12441 return +$( this ).css( "z-index" ); 12442 } ).get(), 12443 zIndexMax = Math.max.apply( null, zIndices ); 12444 12445 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 12446 this.uiDialog.css( "z-index", zIndexMax + 1 ); 12447 moved = true; 12448 } 12449 12450 if ( moved && !silent ) { 12451 this._trigger( "focus", event ); 12452 } 12453 return moved; 12454 }, 12455 12456 open: function() { 12457 var that = this; 12458 if ( this._isOpen ) { 12459 if ( this._moveToTop() ) { 12460 this._focusTabbable(); 12461 } 12462 return; 12463 } 12464 12465 this._isOpen = true; 12466 this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) ); 12467 12468 this._size(); 12469 this._position(); 12470 this._createOverlay(); 12471 this._moveToTop( null, true ); 12472 12473 // Ensure the overlay is moved to the top with the dialog, but only when 12474 // opening. The overlay shouldn't move after the dialog is open so that 12475 // modeless dialogs opened after the modal dialog stack properly. 12476 if ( this.overlay ) { 12477 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 12478 } 12479 12480 this._show( this.uiDialog, this.options.show, function() { 12481 that._focusTabbable(); 12482 that._trigger( "focus" ); 12483 } ); 12484 12485 // Track the dialog immediately upon opening in case a focus event 12486 // somehow occurs outside of the dialog before an element inside the 12487 // dialog is focused (#10152) 12488 this._makeFocusTarget(); 12489 12490 this._trigger( "open" ); 12491 }, 12492 12493 _focusTabbable: function() { 12494 12495 // Set focus to the first match: 12496 // 1. An element that was focused previously 12497 // 2. First element inside the dialog matching [autofocus] 12498 // 3. Tabbable element inside the content element 12499 // 4. Tabbable element inside the buttonpane 12500 // 5. The close button 12501 // 6. The dialog itself 12502 var hasFocus = this._focusedElement; 12503 if ( !hasFocus ) { 12504 hasFocus = this.element.find( "[autofocus]" ); 12505 } 12506 if ( !hasFocus.length ) { 12507 hasFocus = this.element.find( ":tabbable" ); 12508 } 12509 if ( !hasFocus.length ) { 12510 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 12511 } 12512 if ( !hasFocus.length ) { 12513 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 12514 } 12515 if ( !hasFocus.length ) { 12516 hasFocus = this.uiDialog; 12517 } 12518 hasFocus.eq( 0 ).trigger( "focus" ); 12519 }, 12520 12521 _restoreTabbableFocus: function() { 12522 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), 12523 isActive = this.uiDialog[ 0 ] === activeElement || 12524 $.contains( this.uiDialog[ 0 ], activeElement ); 12525 if ( !isActive ) { 12526 this._focusTabbable(); 12527 } 12528 }, 12529 12530 _keepFocus: function( event ) { 12531 event.preventDefault(); 12532 this._restoreTabbableFocus(); 12533 12534 // support: IE 12535 // IE <= 8 doesn't prevent moving focus even with event.preventDefault() 12536 // so we check again later 12537 this._delay( this._restoreTabbableFocus ); 12538 }, 12539 12540 _createWrapper: function() { 12541 this.uiDialog = $( "<div>" ) 12542 .hide() 12543 .attr( { 12544 12545 // Setting tabIndex makes the div focusable 12546 tabIndex: -1, 12547 role: "dialog" 12548 } ) 12549 .appendTo( this._appendTo() ); 12550 12551 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 12552 this._on( this.uiDialog, { 12553 keydown: function( event ) { 12554 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 12555 event.keyCode === $.ui.keyCode.ESCAPE ) { 12556 event.preventDefault(); 12557 this.close( event ); 12558 return; 12559 } 12560 12561 // Prevent tabbing out of dialogs 12562 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 12563 return; 12564 } 12565 var tabbables = this.uiDialog.find( ":tabbable" ), 12566 first = tabbables.first(), 12567 last = tabbables.last(); 12568 12569 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 12570 !event.shiftKey ) { 12571 this._delay( function() { 12572 first.trigger( "focus" ); 12573 } ); 12574 event.preventDefault(); 12575 } else if ( ( event.target === first[ 0 ] || 12576 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 12577 this._delay( function() { 12578 last.trigger( "focus" ); 12579 } ); 12580 event.preventDefault(); 12581 } 12582 }, 12583 mousedown: function( event ) { 12584 if ( this._moveToTop( event ) ) { 12585 this._focusTabbable(); 12586 } 12587 } 12588 } ); 12589 12590 // We assume that any existing aria-describedby attribute means 12591 // that the dialog content is marked up properly 12592 // otherwise we brute force the content as the description 12593 if ( !this.element.find( "[aria-describedby]" ).length ) { 12594 this.uiDialog.attr( { 12595 "aria-describedby": this.element.uniqueId().attr( "id" ) 12596 } ); 12597 } 12598 }, 12599 12600 _createTitlebar: function() { 12601 var uiDialogTitle; 12602 12603 this.uiDialogTitlebar = $( "<div>" ); 12604 this._addClass( this.uiDialogTitlebar, 12605 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 12606 this._on( this.uiDialogTitlebar, { 12607 mousedown: function( event ) { 12608 12609 // Don't prevent click on close button (#8838) 12610 // Focusing a dialog that is partially scrolled out of view 12611 // causes the browser to scroll it into view, preventing the click event 12612 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 12613 12614 // Dialog isn't getting focus when dragging (#8063) 12615 this.uiDialog.trigger( "focus" ); 12616 } 12617 } 12618 } ); 12619 12620 // Support: IE 12621 // Use type="button" to prevent enter keypresses in textboxes from closing the 12622 // dialog in IE (#9312) 12623 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 12624 .button( { 12625 label: $( "<a>" ).text( this.options.closeText ).html(), 12626 icon: "ui-icon-closethick", 12627 showLabel: false 12628 } ) 12629 .appendTo( this.uiDialogTitlebar ); 12630 12631 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 12632 this._on( this.uiDialogTitlebarClose, { 12633 click: function( event ) { 12634 event.preventDefault(); 12635 this.close( event ); 12636 } 12637 } ); 12638 12639 uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar ); 12640 this._addClass( uiDialogTitle, "ui-dialog-title" ); 12641 this._title( uiDialogTitle ); 12642 12643 this.uiDialogTitlebar.prependTo( this.uiDialog ); 12644 12645 this.uiDialog.attr( { 12646 "aria-labelledby": uiDialogTitle.attr( "id" ) 12647 } ); 12648 }, 12649 12650 _title: function( title ) { 12651 if ( this.options.title ) { 12652 title.text( this.options.title ); 12653 } else { 12654 title.html( " " ); 12655 } 12656 }, 12657 12658 _createButtonPane: function() { 12659 this.uiDialogButtonPane = $( "<div>" ); 12660 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 12661 "ui-widget-content ui-helper-clearfix" ); 12662 12663 this.uiButtonSet = $( "<div>" ) 12664 .appendTo( this.uiDialogButtonPane ); 12665 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 12666 12667 this._createButtons(); 12668 }, 12669 12670 _createButtons: function() { 12671 var that = this, 12672 buttons = this.options.buttons; 12673 12674 // If we already have a button pane, remove it 12675 this.uiDialogButtonPane.remove(); 12676 this.uiButtonSet.empty(); 12677 12678 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 12679 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 12680 return; 12681 } 12682 12683 $.each( buttons, function( name, props ) { 12684 var click, buttonOptions; 12685 props = typeof props === "function" ? 12686 { click: props, text: name } : 12687 props; 12688 12689 // Default to a non-submitting button 12690 props = $.extend( { type: "button" }, props ); 12691 12692 // Change the context for the click callback to be the main element 12693 click = props.click; 12694 buttonOptions = { 12695 icon: props.icon, 12696 iconPosition: props.iconPosition, 12697 showLabel: props.showLabel, 12698 12699 // Deprecated options 12700 icons: props.icons, 12701 text: props.text 12702 }; 12703 12704 delete props.click; 12705 delete props.icon; 12706 delete props.iconPosition; 12707 delete props.showLabel; 12708 12709 // Deprecated options 12710 delete props.icons; 12711 if ( typeof props.text === "boolean" ) { 12712 delete props.text; 12713 } 12714 12715 $( "<button></button>", props ) 12716 .button( buttonOptions ) 12717 .appendTo( that.uiButtonSet ) 12718 .on( "click", function() { 12719 click.apply( that.element[ 0 ], arguments ); 12720 } ); 12721 } ); 12722 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 12723 this.uiDialogButtonPane.appendTo( this.uiDialog ); 12724 }, 12725 12726 _makeDraggable: function() { 12727 var that = this, 12728 options = this.options; 12729 12730 function filteredUi( ui ) { 12731 return { 12732 position: ui.position, 12733 offset: ui.offset 12734 }; 12735 } 12736 12737 this.uiDialog.draggable( { 12738 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 12739 handle: ".ui-dialog-titlebar", 12740 containment: "document", 12741 start: function( event, ui ) { 12742 that._addClass( $( this ), "ui-dialog-dragging" ); 12743 that._blockFrames(); 12744 that._trigger( "dragStart", event, filteredUi( ui ) ); 12745 }, 12746 drag: function( event, ui ) { 12747 that._trigger( "drag", event, filteredUi( ui ) ); 12748 }, 12749 stop: function( event, ui ) { 12750 var left = ui.offset.left - that.document.scrollLeft(), 12751 top = ui.offset.top - that.document.scrollTop(); 12752 12753 options.position = { 12754 my: "left top", 12755 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12756 "top" + ( top >= 0 ? "+" : "" ) + top, 12757 of: that.window 12758 }; 12759 that._removeClass( $( this ), "ui-dialog-dragging" ); 12760 that._unblockFrames(); 12761 that._trigger( "dragStop", event, filteredUi( ui ) ); 12762 } 12763 } ); 12764 }, 12765 12766 _makeResizable: function() { 12767 var that = this, 12768 options = this.options, 12769 handles = options.resizable, 12770 12771 // .ui-resizable has position: relative defined in the stylesheet 12772 // but dialogs have to use absolute or fixed positioning 12773 position = this.uiDialog.css( "position" ), 12774 resizeHandles = typeof handles === "string" ? 12775 handles : 12776 "n,e,s,w,se,sw,ne,nw"; 12777 12778 function filteredUi( ui ) { 12779 return { 12780 originalPosition: ui.originalPosition, 12781 originalSize: ui.originalSize, 12782 position: ui.position, 12783 size: ui.size 12784 }; 12785 } 12786 12787 this.uiDialog.resizable( { 12788 cancel: ".ui-dialog-content", 12789 containment: "document", 12790 alsoResize: this.element, 12791 maxWidth: options.maxWidth, 12792 maxHeight: options.maxHeight, 12793 minWidth: options.minWidth, 12794 minHeight: this._minHeight(), 12795 handles: resizeHandles, 12796 start: function( event, ui ) { 12797 that._addClass( $( this ), "ui-dialog-resizing" ); 12798 that._blockFrames(); 12799 that._trigger( "resizeStart", event, filteredUi( ui ) ); 12800 }, 12801 resize: function( event, ui ) { 12802 that._trigger( "resize", event, filteredUi( ui ) ); 12803 }, 12804 stop: function( event, ui ) { 12805 var offset = that.uiDialog.offset(), 12806 left = offset.left - that.document.scrollLeft(), 12807 top = offset.top - that.document.scrollTop(); 12808 12809 options.height = that.uiDialog.height(); 12810 options.width = that.uiDialog.width(); 12811 options.position = { 12812 my: "left top", 12813 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 12814 "top" + ( top >= 0 ? "+" : "" ) + top, 12815 of: that.window 12816 }; 12817 that._removeClass( $( this ), "ui-dialog-resizing" ); 12818 that._unblockFrames(); 12819 that._trigger( "resizeStop", event, filteredUi( ui ) ); 12820 } 12821 } ) 12822 .css( "position", position ); 12823 }, 12824 12825 _trackFocus: function() { 12826 this._on( this.widget(), { 12827 focusin: function( event ) { 12828 this._makeFocusTarget(); 12829 this._focusedElement = $( event.target ); 12830 } 12831 } ); 12832 }, 12833 12834 _makeFocusTarget: function() { 12835 this._untrackInstance(); 12836 this._trackingInstances().unshift( this ); 12837 }, 12838 12839 _untrackInstance: function() { 12840 var instances = this._trackingInstances(), 12841 exists = $.inArray( this, instances ); 12842 if ( exists !== -1 ) { 12843 instances.splice( exists, 1 ); 12844 } 12845 }, 12846 12847 _trackingInstances: function() { 12848 var instances = this.document.data( "ui-dialog-instances" ); 12849 if ( !instances ) { 12850 instances = []; 12851 this.document.data( "ui-dialog-instances", instances ); 12852 } 12853 return instances; 12854 }, 12855 12856 _minHeight: function() { 12857 var options = this.options; 12858 12859 return options.height === "auto" ? 12860 options.minHeight : 12861 Math.min( options.minHeight, options.height ); 12862 }, 12863 12864 _position: function() { 12865 12866 // Need to show the dialog to get the actual offset in the position plugin 12867 var isVisible = this.uiDialog.is( ":visible" ); 12868 if ( !isVisible ) { 12869 this.uiDialog.show(); 12870 } 12871 this.uiDialog.position( this.options.position ); 12872 if ( !isVisible ) { 12873 this.uiDialog.hide(); 12874 } 12875 }, 12876 12877 _setOptions: function( options ) { 12878 var that = this, 12879 resize = false, 12880 resizableOptions = {}; 12881 12882 $.each( options, function( key, value ) { 12883 that._setOption( key, value ); 12884 12885 if ( key in that.sizeRelatedOptions ) { 12886 resize = true; 12887 } 12888 if ( key in that.resizableRelatedOptions ) { 12889 resizableOptions[ key ] = value; 12890 } 12891 } ); 12892 12893 if ( resize ) { 12894 this._size(); 12895 this._position(); 12896 } 12897 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 12898 this.uiDialog.resizable( "option", resizableOptions ); 12899 } 12900 }, 12901 12902 _setOption: function( key, value ) { 12903 var isDraggable, isResizable, 12904 uiDialog = this.uiDialog; 12905 12906 if ( key === "disabled" ) { 12907 return; 12908 } 12909 12910 this._super( key, value ); 12911 12912 if ( key === "appendTo" ) { 12913 this.uiDialog.appendTo( this._appendTo() ); 12914 } 12915 12916 if ( key === "buttons" ) { 12917 this._createButtons(); 12918 } 12919 12920 if ( key === "closeText" ) { 12921 this.uiDialogTitlebarClose.button( { 12922 12923 // Ensure that we always pass a string 12924 label: $( "<a>" ).text( "" + this.options.closeText ).html() 12925 } ); 12926 } 12927 12928 if ( key === "draggable" ) { 12929 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 12930 if ( isDraggable && !value ) { 12931 uiDialog.draggable( "destroy" ); 12932 } 12933 12934 if ( !isDraggable && value ) { 12935 this._makeDraggable(); 12936 } 12937 } 12938 12939 if ( key === "position" ) { 12940 this._position(); 12941 } 12942 12943 if ( key === "resizable" ) { 12944 12945 // currently resizable, becoming non-resizable 12946 isResizable = uiDialog.is( ":data(ui-resizable)" ); 12947 if ( isResizable && !value ) { 12948 uiDialog.resizable( "destroy" ); 12949 } 12950 12951 // Currently resizable, changing handles 12952 if ( isResizable && typeof value === "string" ) { 12953 uiDialog.resizable( "option", "handles", value ); 12954 } 12955 12956 // Currently non-resizable, becoming resizable 12957 if ( !isResizable && value !== false ) { 12958 this._makeResizable(); 12959 } 12960 } 12961 12962 if ( key === "title" ) { 12963 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 12964 } 12965 }, 12966 12967 _size: function() { 12968 12969 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 12970 // divs will both have width and height set, so we need to reset them 12971 var nonContentHeight, minContentHeight, maxContentHeight, 12972 options = this.options; 12973 12974 // Reset content sizing 12975 this.element.show().css( { 12976 width: "auto", 12977 minHeight: 0, 12978 maxHeight: "none", 12979 height: 0 12980 } ); 12981 12982 if ( options.minWidth > options.width ) { 12983 options.width = options.minWidth; 12984 } 12985 12986 // Reset wrapper sizing 12987 // determine the height of all the non-content elements 12988 nonContentHeight = this.uiDialog.css( { 12989 height: "auto", 12990 width: options.width 12991 } ) 12992 .outerHeight(); 12993 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 12994 maxContentHeight = typeof options.maxHeight === "number" ? 12995 Math.max( 0, options.maxHeight - nonContentHeight ) : 12996 "none"; 12997 12998 if ( options.height === "auto" ) { 12999 this.element.css( { 13000 minHeight: minContentHeight, 13001 maxHeight: maxContentHeight, 13002 height: "auto" 13003 } ); 13004 } else { 13005 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 13006 } 13007 13008 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 13009 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 13010 } 13011 }, 13012 13013 _blockFrames: function() { 13014 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 13015 var iframe = $( this ); 13016 13017 return $( "<div>" ) 13018 .css( { 13019 position: "absolute", 13020 width: iframe.outerWidth(), 13021 height: iframe.outerHeight() 13022 } ) 13023 .appendTo( iframe.parent() ) 13024 .offset( iframe.offset() )[ 0 ]; 13025 } ); 13026 }, 13027 13028 _unblockFrames: function() { 13029 if ( this.iframeBlocks ) { 13030 this.iframeBlocks.remove(); 13031 delete this.iframeBlocks; 13032 } 13033 }, 13034 13035 _allowInteraction: function( event ) { 13036 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 13037 return true; 13038 } 13039 13040 // TODO: Remove hack when datepicker implements 13041 // the .ui-front logic (#8989) 13042 return !!$( event.target ).closest( ".ui-datepicker" ).length; 13043 }, 13044 13045 _createOverlay: function() { 13046 if ( !this.options.modal ) { 13047 return; 13048 } 13049 13050 var jqMinor = $.fn.jquery.substring( 0, 4 ); 13051 13052 // We use a delay in case the overlay is created from an 13053 // event that we're going to be cancelling (#2804) 13054 var isOpening = true; 13055 this._delay( function() { 13056 isOpening = false; 13057 } ); 13058 13059 if ( !this.document.data( "ui-dialog-overlays" ) ) { 13060 13061 // Prevent use of anchors and inputs 13062 // This doesn't use `_on()` because it is a shared event handler 13063 // across all open modal dialogs. 13064 this.document.on( "focusin.ui-dialog", function( event ) { 13065 if ( isOpening ) { 13066 return; 13067 } 13068 13069 var instance = this._trackingInstances()[ 0 ]; 13070 if ( !instance._allowInteraction( event ) ) { 13071 event.preventDefault(); 13072 instance._focusTabbable(); 13073 13074 // Support: jQuery >=3.4 <3.
vendor: 2,202 bytes, lines 13074-13162
130746 only 13075 // Focus re-triggering in jQuery 3.4/3.5 makes the original element 13076 // have its focus event propagated last, breaking the re-targeting. 13077 // Trigger focus in a delay in addition if needed to avoid the issue 13078 // See https://github.com/jquery/jquery/issues/4382 13079 if ( jqMinor === "3.4." || jqMinor === "3.5." ) { 13080 instance._delay( instance._restoreTabbableFocus ); 13081 } 13082 } 13083 }.bind( this ) ); 13084 } 13085 13086 this.overlay = $( "<div>" ) 13087 .appendTo( this._appendTo() ); 13088 13089 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 13090 this._on( this.overlay, { 13091 mousedown: "_keepFocus" 13092 } ); 13093 this.document.data( "ui-dialog-overlays", 13094 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 13095 }, 13096 13097 _destroyOverlay: function() { 13098 if ( !this.options.modal ) { 13099 return; 13100 } 13101 13102 if ( this.overlay ) { 13103 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 13104 13105 if ( !overlays ) { 13106 this.document.off( "focusin.ui-dialog" ); 13107 this.document.removeData( "ui-dialog-overlays" ); 13108 } else { 13109 this.document.data( "ui-dialog-overlays", overlays ); 13110 } 13111 13112 this.overlay.remove(); 13113 this.overlay = null; 13114 } 13115 } 13116} ); 13117 13118// DEPRECATED 13119// TODO: switch return back to widget declaration at top of file when this is removed 13120if ( $.uiBackCompat !== false ) { 13121 13122 // Backcompat for dialogClass option 13123 $.widget( "ui.dialog", $.ui.dialog, { 13124 options: { 13125 dialogClass: "" 13126 }, 13127 _createWrapper: function() { 13128 this._super(); 13129 this.uiDialog.addClass( this.options.dialogClass ); 13130 }, 13131 _setOption: function( key, value ) { 13132 if ( key === "dialogClass" ) { 13133 this.uiDialog 13134 .removeClass( this.options.dialogClass ) 13135 .addClass( value ); 13136 } 13137 this._superApply( arguments ); 13138 } 13139 } ); 13140} 13141 13142var widgetsDialog = $.ui.dialog; 13143 13144 13145/*! 13146 * jQuery UI Droppable 1.13.2 13147 * http://jqueryui.com 13148 * 13149 * Copyright jQuery Foundation and other contributors 13150 * Released under the MIT license. 13151 * http://jquery.org/license 13152 */ 13153 13154//>>label: Droppable 13155//>>group: Interactions 13156//>>description: Enables drop targets for draggable elements. 13157//>>docs: http://api.jqueryui.com/droppable/ 13158//>>demos: http://jqueryui.com/droppable/ 13159 13160 13161$.widget( "ui.droppable", { 13162 version: "1.13
vendor: 11,313 bytes, lines 13162-13590
13162.2", 13163 widgetEventPrefix: "drop", 13164 options: { 13165 accept: "*", 13166 addClasses: true, 13167 greedy: false, 13168 scope: "default", 13169 tolerance: "intersect", 13170 13171 // Callbacks 13172 activate: null, 13173 deactivate: null, 13174 drop: null, 13175 out: null, 13176 over: null 13177 }, 13178 _create: function() { 13179 13180 var proportions, 13181 o = this.options, 13182 accept = o.accept; 13183 13184 this.isover = false; 13185 this.isout = true; 13186 13187 this.accept = typeof accept === "function" ? accept : function( d ) { 13188 return d.is( accept ); 13189 }; 13190 13191 this.proportions = function( /* valueToWrite */ ) { 13192 if ( arguments.length ) { 13193 13194 // Store the droppable's proportions 13195 proportions = arguments[ 0 ]; 13196 } else { 13197 13198 // Retrieve or derive the droppable's proportions 13199 return proportions ? 13200 proportions : 13201 proportions = { 13202 width: this.element[ 0 ].offsetWidth, 13203 height: this.element[ 0 ].offsetHeight 13204 }; 13205 } 13206 }; 13207 13208 this._addToManager( o.scope ); 13209 13210 if ( o.addClasses ) { 13211 this._addClass( "ui-droppable" ); 13212 } 13213 13214 }, 13215 13216 _addToManager: function( scope ) { 13217 13218 // Add the reference and positions to the manager 13219 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; 13220 $.ui.ddmanager.droppables[ scope ].push( this ); 13221 }, 13222 13223 _splice: function( drop ) { 13224 var i = 0; 13225 for ( ; i < drop.length; i++ ) { 13226 if ( drop[ i ] === this ) { 13227 drop.splice( i, 1 ); 13228 } 13229 } 13230 }, 13231 13232 _destroy: function() { 13233 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13234 13235 this._splice( drop ); 13236 }, 13237 13238 _setOption: function( key, value ) { 13239 13240 if ( key === "accept" ) { 13241 this.accept = typeof value === "function" ? value : function( d ) { 13242 return d.is( value ); 13243 }; 13244 } else if ( key === "scope" ) { 13245 var drop = $.ui.ddmanager.droppables[ this.options.scope ]; 13246 13247 this._splice( drop ); 13248 this._addToManager( value ); 13249 } 13250 13251 this._super( key, value ); 13252 }, 13253 13254 _activate: function( event ) { 13255 var draggable = $.ui.ddmanager.current; 13256 13257 this._addActiveClass(); 13258 if ( draggable ) { 13259 this._trigger( "activate", event, this.ui( draggable ) ); 13260 } 13261 }, 13262 13263 _deactivate: function( event ) { 13264 var draggable = $.ui.ddmanager.current; 13265 13266 this._removeActiveClass(); 13267 if ( draggable ) { 13268 this._trigger( "deactivate", event, this.ui( draggable ) ); 13269 } 13270 }, 13271 13272 _over: function( event ) { 13273 13274 var draggable = $.ui.ddmanager.current; 13275 13276 // Bail if draggable and droppable are same element 13277 if ( !draggable || ( draggable.currentItem || 13278 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13279 return; 13280 } 13281 13282 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 13283 draggable.element ) ) ) { 13284 this._addHoverClass(); 13285 this._trigger( "over", event, this.ui( draggable ) ); 13286 } 13287 13288 }, 13289 13290 _out: function( event ) { 13291 13292 var draggable = $.ui.ddmanager.current; 13293 13294 // Bail if draggable and droppable are same element 13295 if ( !draggable || ( draggable.currentItem || 13296 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13297 return; 13298 } 13299 13300 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || 13301 draggable.element ) ) ) { 13302 this._removeHoverClass(); 13303 this._trigger( "out", event, this.ui( draggable ) ); 13304 } 13305 13306 }, 13307 13308 _drop: function( event, custom ) { 13309 13310 var draggable = custom || $.ui.ddmanager.current, 13311 childrenIntersection = false; 13312 13313 // Bail if draggable and droppable are same element 13314 if ( !draggable || ( draggable.currentItem || 13315 draggable.element )[ 0 ] === this.element[ 0 ] ) { 13316 return false; 13317 } 13318 13319 this.element 13320 .find( ":data(ui-droppable)" ) 13321 .not( ".ui-draggable-dragging" ) 13322 .each( function() { 13323 var inst = $( this ).droppable( "instance" ); 13324 if ( 13325 inst.options.greedy && 13326 !inst.options.disabled && 13327 inst.options.scope === draggable.options.scope && 13328 inst.accept.call( 13329 inst.element[ 0 ], ( draggable.currentItem || draggable.element ) 13330 ) && 13331 $.ui.intersect( 13332 draggable, 13333 $.extend( inst, { offset: inst.element.offset() } ), 13334 inst.options.tolerance, event 13335 ) 13336 ) { 13337 childrenIntersection = true; 13338 return false; 13339 } 13340 } ); 13341 if ( childrenIntersection ) { 13342 return false; 13343 } 13344 13345 if ( this.accept.call( this.element[ 0 ], 13346 ( draggable.currentItem || draggable.element ) ) ) { 13347 this._removeActiveClass(); 13348 this._removeHoverClass(); 13349 13350 this._trigger( "drop", event, this.ui( draggable ) ); 13351 return this.element; 13352 } 13353 13354 return false; 13355 13356 }, 13357 13358 ui: function( c ) { 13359 return { 13360 draggable: ( c.currentItem || c.element ), 13361 helper: c.helper, 13362 position: c.position, 13363 offset: c.positionAbs 13364 }; 13365 }, 13366 13367 // Extension points just to make backcompat sane and avoid duplicating logic 13368 // TODO: Remove in 1.14 along with call to it below 13369 _addHoverClass: function() { 13370 this._addClass( "ui-droppable-hover" ); 13371 }, 13372 13373 _removeHoverClass: function() { 13374 this._removeClass( "ui-droppable-hover" ); 13375 }, 13376 13377 _addActiveClass: function() { 13378 this._addClass( "ui-droppable-active" ); 13379 }, 13380 13381 _removeActiveClass: function() { 13382 this._removeClass( "ui-droppable-active" ); 13383 } 13384} ); 13385 13386$.ui.intersect = ( function() { 13387 function isOverAxis( x, reference, size ) { 13388 return ( x >= reference ) && ( x < ( reference + size ) ); 13389 } 13390 13391 return function( draggable, droppable, toleranceMode, event ) { 13392 13393 if ( !droppable.offset ) { 13394 return false; 13395 } 13396 13397 var x1 = ( draggable.positionAbs || 13398 draggable.position.absolute ).left + draggable.margins.left, 13399 y1 = ( draggable.positionAbs || 13400 draggable.position.absolute ).top + draggable.margins.top, 13401 x2 = x1 + draggable.helperProportions.width, 13402 y2 = y1 + draggable.helperProportions.height, 13403 l = droppable.offset.left, 13404 t = droppable.offset.top, 13405 r = l + droppable.proportions().width, 13406 b = t + droppable.proportions().height; 13407 13408 switch ( toleranceMode ) { 13409 case "fit": 13410 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); 13411 case "intersect": 13412 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half 13413 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half 13414 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half 13415 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half 13416 case "pointer": 13417 return isOverAxis( event.pageY, t, droppable.proportions().height ) && 13418 isOverAxis( event.pageX, l, droppable.proportions().width ); 13419 case "touch": 13420 return ( 13421 ( y1 >= t && y1 <= b ) || // Top edge touching 13422 ( y2 >= t && y2 <= b ) || // Bottom edge touching 13423 ( y1 < t && y2 > b ) // Surrounded vertically 13424 ) && ( 13425 ( x1 >= l && x1 <= r ) || // Left edge touching 13426 ( x2 >= l && x2 <= r ) || // Right edge touching 13427 ( x1 < l && x2 > r ) // Surrounded horizontally 13428 ); 13429 default: 13430 return false; 13431 } 13432 }; 13433} )(); 13434 13435/* 13436 This manager tracks offsets of draggables and droppables 13437*/ 13438$.ui.ddmanager = { 13439 current: null, 13440 droppables: { "default": [] }, 13441 prepareOffsets: function( t, event ) { 13442 13443 var i, j, 13444 m = $.ui.ddmanager.droppables[ t.options.scope ] || [], 13445 type = event ? event.type : null, // workaround for #2317 13446 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); 13447 13448 droppablesLoop: for ( i = 0; i < m.length; i++ ) { 13449 13450 // No disabled and non-accepted 13451 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], 13452 ( t.currentItem || t.element ) ) ) ) { 13453 continue; 13454 } 13455 13456 // Filter out elements in the current dragged item 13457 for ( j = 0; j < list.length; j++ ) { 13458 if ( list[ j ] === m[ i ].element[ 0 ] ) { 13459 m[ i ].proportions().height = 0; 13460 continue droppablesLoop; 13461 } 13462 } 13463 13464 m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; 13465 if ( !m[ i ].visible ) { 13466 continue; 13467 } 13468 13469 // Activate the droppable if used directly from draggables 13470 if ( type === "mousedown" ) { 13471 m[ i ]._activate.call( m[ i ], event ); 13472 } 13473 13474 m[ i ].offset = m[ i ].element.offset(); 13475 m[ i ].proportions( { 13476 width: m[ i ].element[ 0 ].offsetWidth, 13477 height: m[ i ].element[ 0 ].offsetHeight 13478 } ); 13479 13480 } 13481 13482 }, 13483 drop: function( draggable, event ) { 13484 13485 var dropped = false; 13486 13487 // Create a copy of the droppables in case the list changes during the drop (#9116) 13488 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { 13489 13490 if ( !this.options ) { 13491 return; 13492 } 13493 if ( !this.options.disabled && this.visible && 13494 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { 13495 dropped = this._drop.call( this, event ) || dropped; 13496 } 13497 13498 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], 13499 ( draggable.currentItem || draggable.element ) ) ) { 13500 this.isout = true; 13501 this.isover = false; 13502 this._deactivate.call( this, event ); 13503 } 13504 13505 } ); 13506 return dropped; 13507 13508 }, 13509 dragStart: function( draggable, event ) { 13510 13511 // Listen for scrolling so that if the dragging causes scrolling the position of the 13512 // droppables can be recalculated (see #5003) 13513 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { 13514 if ( !draggable.options.refreshPositions ) { 13515 $.ui.ddmanager.prepareOffsets( draggable, event ); 13516 } 13517 } ); 13518 }, 13519 drag: function( draggable, event ) { 13520 13521 // If you have a highly dynamic page, you might try this option. It renders positions 13522 // every time you move the mouse. 13523 if ( draggable.options.refreshPositions ) { 13524 $.ui.ddmanager.prepareOffsets( draggable, event ); 13525 } 13526 13527 // Run through all droppables and check their positions based on specific tolerance options 13528 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { 13529 13530 if ( this.options.disabled || this.greedyChild || !this.visible ) { 13531 return; 13532 } 13533 13534 var parentInstance, scope, parent, 13535 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), 13536 c = !intersects && this.isover ? 13537 "isout" : 13538 ( intersects && !this.isover ? "isover" : null ); 13539 if ( !c ) { 13540 return; 13541 } 13542 13543 if ( this.options.greedy ) { 13544 13545 // find droppable parents with same scope 13546 scope = this.options.scope; 13547 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { 13548 return $( this ).droppable( "instance" ).options.scope === scope; 13549 } ); 13550 13551 if ( parent.length ) { 13552 parentInstance = $( parent[ 0 ] ).droppable( "instance" ); 13553 parentInstance.greedyChild = ( c === "isover" ); 13554 } 13555 } 13556 13557 // We just moved into a greedy child 13558 if ( parentInstance && c === "isover" ) { 13559 parentInstance.isover = false; 13560 parentInstance.isout = true; 13561 parentInstance._out.call( parentInstance, event ); 13562 } 13563 13564 this[ c ] = true; 13565 this[ c === "isout" ? "isover" : "isout" ] = false; 13566 this[ c === "isover" ? "_over" : "_out" ].call( this, event ); 13567 13568 // We just moved out of a greedy child 13569 if ( parentInstance && c === "isout" ) { 13570 parentInstance.isout = false; 13571 parentInstance.isover = true; 13572 parentInstance._over.call( parentInstance, event ); 13573 } 13574 } ); 13575 13576 }, 13577 dragStop: function( draggable, event ) { 13578 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); 13579 13580 // Call prepareOffsets one final time since IE does not fire return scroll events when 13581 // overflow was caused by drag (see #5003) 13582 if ( !draggable.options.refreshPositions ) { 13583 $.ui.ddmanager.prepareOffsets( draggable, event ); 13584 } 13585 } 13586}; 13587 13588// DEPRECATED 13589// TODO: switch return back to widget declaration at top of file when this is removed 13590if ( $.uiBackCompat
13590!== false ) { 13591 13592 // Backcompat for activeClass and hoverClass options 13593 $.widget( "ui.droppable", $.ui.droppable, { 13594 options: { 13595 hoverClass: false, 13596 activeClass: false 13597 }, 13598 _addActiveClass: function() { 13599 this._super(); 13600 if ( this.options.activeClass ) { 13601 this.element.addClass( this.options.activeClass ); 13602 } 13603 }, 13604 _removeActiveClass: function() { 13605 this._super(); 13606 if ( this.options.activeClass ) { 13607 this.element.removeClass( this.options.activeClass ); 13608 } 13609 }, 13610 _addHoverClass: function() { 13611 this._super(); 13612 if ( this.options.hoverClass ) { 13613 this.element.addClass( this.options.hoverClass ); 13614 } 13615 }, 13616 _removeHoverClass: function() { 13617 this._super(); 13618 if ( this.options.hoverClass ) { 13619 this.element.removeClass( this.options.hoverClass ); 13620 } 13621 } 13622 } ); 13623} 13624 13625var widgetsDroppable = $.ui.droppable; 13626 13627 13628/*! 13629 * jQuery UI Progressbar 1.13.2 13630 * http://jqueryui.com 13631 * 13632 * Copyright jQuery Foundation and other contributors 13633 * Released under the MIT license. 13634 * http://jquery.org/license 13635 */ 13636 13637//>>label: Progressbar 13638//>>group: Widgets 13639/* eslint-disable max-len */ 13640//>>
vendor: 4,215 bytes, lines 13640-13809
13640description: Displays a status indicator for loading state, standard percentage, and other progress indicators. 13641/* eslint-enable max-len */ 13642//>>docs: http://api.jqueryui.com/progressbar/ 13643//>>demos: http://jqueryui.com/progressbar/ 13644//>>css.structure: ../../themes/base/core.css 13645//>>css.structure: ../../themes/base/progressbar.css 13646//>>css.theme: ../../themes/base/theme.css 13647 13648 13649var widgetsProgressbar = $.widget( "ui.progressbar", { 13650 version: "1.13.2", 13651 options: { 13652 classes: { 13653 "ui-progressbar": "ui-corner-all", 13654 "ui-progressbar-value": "ui-corner-left", 13655 "ui-progressbar-complete": "ui-corner-right" 13656 }, 13657 max: 100, 13658 value: 0, 13659 13660 change: null, 13661 complete: null 13662 }, 13663 13664 min: 0, 13665 13666 _create: function() { 13667 13668 // Constrain initial value 13669 this.oldValue = this.options.value = this._constrainedValue(); 13670 13671 this.element.attr( { 13672 13673 // Only set static values; aria-valuenow and aria-valuemax are 13674 // set inside _refreshValue() 13675 role: "progressbar", 13676 "aria-valuemin": this.min 13677 } ); 13678 this._addClass( "ui-progressbar", "ui-widget ui-widget-content" ); 13679 13680 this.valueDiv = $( "<div>" ).appendTo( this.element ); 13681 this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" ); 13682 this._refreshValue(); 13683 }, 13684 13685 _destroy: function() { 13686 this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" ); 13687 13688 this.valueDiv.remove(); 13689 }, 13690 13691 value: function( newValue ) { 13692 if ( newValue === undefined ) { 13693 return this.options.value; 13694 } 13695 13696 this.options.value = this._constrainedValue( newValue ); 13697 this._refreshValue(); 13698 }, 13699 13700 _constrainedValue: function( newValue ) { 13701 if ( newValue === undefined ) { 13702 newValue = this.options.value; 13703 } 13704 13705 this.indeterminate = newValue === false; 13706 13707 // Sanitize value 13708 if ( typeof newValue !== "number" ) { 13709 newValue = 0; 13710 } 13711 13712 return this.indeterminate ? false : 13713 Math.min( this.options.max, Math.max( this.min, newValue ) ); 13714 }, 13715 13716 _setOptions: function( options ) { 13717 13718 // Ensure "value" option is set after other values (like max) 13719 var value = options.value; 13720 delete options.value; 13721 13722 this._super( options ); 13723 13724 this.options.value = this._constrainedValue( value ); 13725 this._refreshValue(); 13726 }, 13727 13728 _setOption: function( key, value ) { 13729 if ( key === "max" ) { 13730 13731 // Don't allow a max less than min 13732 value = Math.max( this.min, value ); 13733 } 13734 this._super( key, value ); 13735 }, 13736 13737 _setOptionDisabled: function( value ) { 13738 this._super( value ); 13739 13740 this.element.attr( "aria-disabled", value ); 13741 this._toggleClass( null, "ui-state-disabled", !!value ); 13742 }, 13743 13744 _percentage: function() { 13745 return this.indeterminate ? 13746 100 : 13747 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); 13748 }, 13749 13750 _refreshValue: function() { 13751 var value = this.options.value, 13752 percentage = this._percentage(); 13753 13754 this.valueDiv 13755 .toggle( this.indeterminate || value > this.min ) 13756 .width( percentage.toFixed( 0 ) + "%" ); 13757 13758 this 13759 ._toggleClass( this.valueDiv, "ui-progressbar-complete", null, 13760 value === this.options.max ) 13761 ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate ); 13762 13763 if ( this.indeterminate ) { 13764 this.element.removeAttr( "aria-valuenow" ); 13765 if ( !this.overlayDiv ) { 13766 this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv ); 13767 this._addClass( this.overlayDiv, "ui-progressbar-overlay" ); 13768 } 13769 } else { 13770 this.element.attr( { 13771 "aria-valuemax": this.options.max, 13772 "aria-valuenow": value 13773 } ); 13774 if ( this.overlayDiv ) { 13775 this.overlayDiv.remove(); 13776 this.overlayDiv = null; 13777 } 13778 } 13779 13780 if ( this.oldValue !== value ) { 13781 this.oldValue = value; 13782 this._trigger( "change" ); 13783 } 13784 if ( value === this.options.max ) { 13785 this._trigger( "complete" ); 13786 } 13787 } 13788} ); 13789 13790 13791/*! 13792 * jQuery UI Selectable 1.13.2 13793 * http://jqueryui.com 13794 * 13795 * Copyright jQuery Foundation and other contributors 13796 * Released under the MIT license. 13797 * http://jquery.org/license 13798 */ 13799 13800//>>label: Selectable 13801//>>group: Interactions 13802//>>description: Allows groups of elements to be selected with the mouse. 13803//>>docs: http://api.jqueryui.com/selectable/ 13804//>>demos: http://jqueryui.com/selectable/ 13805//>>css.structure: ../../themes/base/selectable.css 13806 13807 13808var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { 13809 version: "1.13
vendor: 7,327 bytes, lines 13809-14090
13809.2", 13810 options: { 13811 appendTo: "body", 13812 autoRefresh: true, 13813 distance: 0, 13814 filter: "*", 13815 tolerance: "touch", 13816 13817 // Callbacks 13818 selected: null, 13819 selecting: null, 13820 start: null, 13821 stop: null, 13822 unselected: null, 13823 unselecting: null 13824 }, 13825 _create: function() { 13826 var that = this; 13827 13828 this._addClass( "ui-selectable" ); 13829 13830 this.dragged = false; 13831 13832 // Cache selectee children based on filter 13833 this.refresh = function() { 13834 that.elementPos = $( that.element[ 0 ] ).offset(); 13835 that.selectees = $( that.options.filter, that.element[ 0 ] ); 13836 that._addClass( that.selectees, "ui-selectee" ); 13837 that.selectees.each( function() { 13838 var $this = $( this ), 13839 selecteeOffset = $this.offset(), 13840 pos = { 13841 left: selecteeOffset.left - that.elementPos.left, 13842 top: selecteeOffset.top - that.elementPos.top 13843 }; 13844 $.data( this, "selectable-item", { 13845 element: this, 13846 $element: $this, 13847 left: pos.left, 13848 top: pos.top, 13849 right: pos.left + $this.outerWidth(), 13850 bottom: pos.top + $this.outerHeight(), 13851 startselected: false, 13852 selected: $this.hasClass( "ui-selected" ), 13853 selecting: $this.hasClass( "ui-selecting" ), 13854 unselecting: $this.hasClass( "ui-unselecting" ) 13855 } ); 13856 } ); 13857 }; 13858 this.refresh(); 13859 13860 this._mouseInit(); 13861 13862 this.helper = $( "<div>" ); 13863 this._addClass( this.helper, "ui-selectable-helper" ); 13864 }, 13865 13866 _destroy: function() { 13867 this.selectees.removeData( "selectable-item" ); 13868 this._mouseDestroy(); 13869 }, 13870 13871 _mouseStart: function( event ) { 13872 var that = this, 13873 options = this.options; 13874 13875 this.opos = [ event.pageX, event.pageY ]; 13876 this.elementPos = $( this.element[ 0 ] ).offset(); 13877 13878 if ( this.options.disabled ) { 13879 return; 13880 } 13881 13882 this.selectees = $( options.filter, this.element[ 0 ] ); 13883 13884 this._trigger( "start", event ); 13885 13886 $( options.appendTo ).append( this.helper ); 13887 13888 // position helper (lasso) 13889 this.helper.css( { 13890 "left": event.pageX, 13891 "top": event.pageY, 13892 "width": 0, 13893 "height": 0 13894 } ); 13895 13896 if ( options.autoRefresh ) { 13897 this.refresh(); 13898 } 13899 13900 this.selectees.filter( ".ui-selected" ).each( function() { 13901 var selectee = $.data( this, "selectable-item" ); 13902 selectee.startselected = true; 13903 if ( !event.metaKey && !event.ctrlKey ) { 13904 that._removeClass( selectee.$element, "ui-selected" ); 13905 selectee.selected = false; 13906 that._addClass( selectee.$element, "ui-unselecting" ); 13907 selectee.unselecting = true; 13908 13909 // selectable UNSELECTING callback 13910 that._trigger( "unselecting", event, { 13911 unselecting: selectee.element 13912 } ); 13913 } 13914 } ); 13915 13916 $( event.target ).parents().addBack().each( function() { 13917 var doSelect, 13918 selectee = $.data( this, "selectable-item" ); 13919 if ( selectee ) { 13920 doSelect = ( !event.metaKey && !event.ctrlKey ) || 13921 !selectee.$element.hasClass( "ui-selected" ); 13922 that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) 13923 ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); 13924 selectee.unselecting = !doSelect; 13925 selectee.selecting = doSelect; 13926 selectee.selected = doSelect; 13927 13928 // selectable (UN)SELECTING callback 13929 if ( doSelect ) { 13930 that._trigger( "selecting", event, { 13931 selecting: selectee.element 13932 } ); 13933 } else { 13934 that._trigger( "unselecting", event, { 13935 unselecting: selectee.element 13936 } ); 13937 } 13938 return false; 13939 } 13940 } ); 13941 13942 }, 13943 13944 _mouseDrag: function( event ) { 13945 13946 this.dragged = true; 13947 13948 if ( this.options.disabled ) { 13949 return; 13950 } 13951 13952 var tmp, 13953 that = this, 13954 options = this.options, 13955 x1 = this.opos[ 0 ], 13956 y1 = this.opos[ 1 ], 13957 x2 = event.pageX, 13958 y2 = event.pageY; 13959 13960 if ( x1 > x2 ) { 13961 tmp = x2; x2 = x1; x1 = tmp; 13962 } 13963 if ( y1 > y2 ) { 13964 tmp = y2; y2 = y1; y1 = tmp; 13965 } 13966 this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); 13967 13968 this.selectees.each( function() { 13969 var selectee = $.data( this, "selectable-item" ), 13970 hit = false, 13971 offset = {}; 13972 13973 //prevent helper from being selected if appendTo: selectable 13974 if ( !selectee || selectee.element === that.element[ 0 ] ) { 13975 return; 13976 } 13977 13978 offset.left = selectee.left + that.elementPos.left; 13979 offset.right = selectee.right + that.elementPos.left; 13980 offset.top = selectee.top + that.elementPos.top; 13981 offset.bottom = selectee.bottom + that.elementPos.top; 13982 13983 if ( options.tolerance === "touch" ) { 13984 hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || 13985 offset.bottom < y1 ) ); 13986 } else if ( options.tolerance === "fit" ) { 13987 hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && 13988 offset.bottom < y2 ); 13989 } 13990 13991 if ( hit ) { 13992 13993 // SELECT 13994 if ( selectee.selected ) { 13995 that._removeClass( selectee.$element, "ui-selected" ); 13996 selectee.selected = false; 13997 } 13998 if ( selectee.unselecting ) { 13999 that._removeClass( selectee.$element, "ui-unselecting" ); 14000 selectee.unselecting = false; 14001 } 14002 if ( !selectee.selecting ) { 14003 that._addClass( selectee.$element, "ui-selecting" ); 14004 selectee.selecting = true; 14005 14006 // selectable SELECTING callback 14007 that._trigger( "selecting", event, { 14008 selecting: selectee.element 14009 } ); 14010 } 14011 } else { 14012 14013 // UNSELECT 14014 if ( selectee.selecting ) { 14015 if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { 14016 that._removeClass( selectee.$element, "ui-selecting" ); 14017 selectee.selecting = false; 14018 that._addClass( selectee.$element, "ui-selected" ); 14019 selectee.selected = true; 14020 } else { 14021 that._removeClass( selectee.$element, "ui-selecting" ); 14022 selectee.selecting = false; 14023 if ( selectee.startselected ) { 14024 that._addClass( selectee.$element, "ui-unselecting" ); 14025 selectee.unselecting = true; 14026 } 14027 14028 // selectable UNSELECTING callback 14029 that._trigger( "unselecting", event, { 14030 unselecting: selectee.element 14031 } ); 14032 } 14033 } 14034 if ( selectee.selected ) { 14035 if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { 14036 that._removeClass( selectee.$element, "ui-selected" ); 14037 selectee.selected = false; 14038 14039 that._addClass( selectee.$element, "ui-unselecting" ); 14040 selectee.unselecting = true; 14041 14042 // selectable UNSELECTING callback 14043 that._trigger( "unselecting", event, { 14044 unselecting: selectee.element 14045 } ); 14046 } 14047 } 14048 } 14049 } ); 14050 14051 return false; 14052 }, 14053 14054 _mouseStop: function( event ) { 14055 var that = this; 14056 14057 this.dragged = false; 14058 14059 $( ".ui-unselecting", this.element[ 0 ] ).each( function() { 14060 var selectee = $.data( this, "selectable-item" ); 14061 that._removeClass( selectee.$element, "ui-unselecting" ); 14062 selectee.unselecting = false; 14063 selectee.startselected = false; 14064 that._trigger( "unselected", event, { 14065 unselected: selectee.element 14066 } ); 14067 } ); 14068 $( ".ui-selecting", this.element[ 0 ] ).each( function() { 14069 var selectee = $.data( this, "selectable-item" ); 14070 that._removeClass( selectee.$element, "ui-selecting" ) 14071 ._addClass( selectee.$element, "ui-selected" ); 14072 selectee.selecting = false; 14073 selectee.selected = true; 14074 selectee.startselected = true; 14075 that._trigger( "selected", event, { 14076 selected: selectee.element 14077 } ); 14078 } ); 14079 this._trigger( "stop", event ); 14080 14081 this.helper.remove(); 14082 14083 return false; 14084 } 14085 14086} ); 14087 14088 14089/*! 14090 * jQuery UI Selectmenu 1.1
vendor: 1,951 bytes, lines 14090-14166
140903.2 14091 * http://jqueryui.com 14092 * 14093 * Copyright jQuery Foundation and other contributors 14094 * Released under the MIT license. 14095 * http://jquery.org/license 14096 */ 14097 14098//>>label: Selectmenu 14099//>>group: Widgets 14100/* eslint-disable max-len */ 14101//>>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. 14102/* eslint-enable max-len */ 14103//>>docs: http://api.jqueryui.com/selectmenu/ 14104//>>demos: http://jqueryui.com/selectmenu/ 14105//>>css.structure: ../../themes/base/core.css 14106//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css 14107//>>css.theme: ../../themes/base/theme.css 14108 14109 14110var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { 14111 version: "1.13.2", 14112 defaultElement: "<select>", 14113 options: { 14114 appendTo: null, 14115 classes: { 14116 "ui-selectmenu-button-open": "ui-corner-top", 14117 "ui-selectmenu-button-closed": "ui-corner-all" 14118 }, 14119 disabled: null, 14120 icons: { 14121 button: "ui-icon-triangle-1-s" 14122 }, 14123 position: { 14124 my: "left top", 14125 at: "left bottom", 14126 collision: "none" 14127 }, 14128 width: false, 14129 14130 // Callbacks 14131 change: null, 14132 close: null, 14133 focus: null, 14134 open: null, 14135 select: null 14136 }, 14137 14138 _create: function() { 14139 var selectmenuId = this.element.uniqueId().attr( "id" ); 14140 this.ids = { 14141 element: selectmenuId, 14142 button: selectmenuId + "-button", 14143 menu: selectmenuId + "-menu" 14144 }; 14145 14146 this._drawButton(); 14147 this._drawMenu(); 14148 this._bindFormResetHandler(); 14149 14150 this._rendered = false; 14151 this.menuItems = $(); 14152 }, 14153 14154 _drawButton: function() { 14155 var icon, 14156 that = this, 14157 item = this._parseOption( 14158 this.element.find( "option:selected" ), 14159 this.element[ 0 ].selectedIndex 14160 ); 14161 14162 // Associate existing label with the new button 14163 this.labels = this.element.labels().attr( "for", this.ids.button ); 14164 this._on( this.labels, { 14165 click: function( event ) { 14166 this.button.trigger( "focus"
vendor: 7,319 bytes, lines 14166-14475
14166); 14167 event.preventDefault(); 14168 } 14169 } ); 14170 14171 // Hide original select element 14172 this.element.hide(); 14173 14174 // Create button 14175 this.button = $( "<span>", { 14176 tabindex: this.options.disabled ? -1 : 0, 14177 id: this.ids.button, 14178 role: "combobox", 14179 "aria-expanded": "false", 14180 "aria-autocomplete": "list", 14181 "aria-owns": this.ids.menu, 14182 "aria-haspopup": "true", 14183 title: this.element.attr( "title" ) 14184 } ) 14185 .insertAfter( this.element ); 14186 14187 this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", 14188 "ui-button ui-widget" ); 14189 14190 icon = $( "<span>" ).appendTo( this.button ); 14191 this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); 14192 this.buttonItem = this._renderButtonItem( item ) 14193 .appendTo( this.button ); 14194 14195 if ( this.options.width !== false ) { 14196 this._resizeButton(); 14197 } 14198 14199 this._on( this.button, this._buttonEvents ); 14200 this.button.one( "focusin", function() { 14201 14202 // Delay rendering the menu items until the button receives focus. 14203 // The menu may have already been rendered via a programmatic open. 14204 if ( !that._rendered ) { 14205 that._refreshMenu(); 14206 } 14207 } ); 14208 }, 14209 14210 _drawMenu: function() { 14211 var that = this; 14212 14213 // Create menu 14214 this.menu = $( "<ul>", { 14215 "aria-hidden": "true", 14216 "aria-labelledby": this.ids.button, 14217 id: this.ids.menu 14218 } ); 14219 14220 // Wrap menu 14221 this.menuWrap = $( "<div>" ).append( this.menu ); 14222 this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" ); 14223 this.menuWrap.appendTo( this._appendTo() ); 14224 14225 // Initialize menu widget 14226 this.menuInstance = this.menu 14227 .menu( { 14228 classes: { 14229 "ui-menu": "ui-corner-bottom" 14230 }, 14231 role: "listbox", 14232 select: function( event, ui ) { 14233 event.preventDefault(); 14234 14235 // Support: IE8 14236 // If the item was selected via a click, the text selection 14237 // will be destroyed in IE 14238 that._setSelection(); 14239 14240 that._select( ui.item.data( "ui-selectmenu-item" ), event ); 14241 }, 14242 focus: function( event, ui ) { 14243 var item = ui.item.data( "ui-selectmenu-item" ); 14244 14245 // Prevent inital focus from firing and check if its a newly focused item 14246 if ( that.focusIndex != null && item.index !== that.focusIndex ) { 14247 that._trigger( "focus", event, { item: item } ); 14248 if ( !that.isOpen ) { 14249 that._select( item, event ); 14250 } 14251 } 14252 that.focusIndex = item.index; 14253 14254 that.button.attr( "aria-activedescendant", 14255 that.menuItems.eq( item.index ).attr( "id" ) ); 14256 } 14257 } ) 14258 .menu( "instance" ); 14259 14260 // Don't close the menu on mouseleave 14261 this.menuInstance._off( this.menu, "mouseleave" ); 14262 14263 // Cancel the menu's collapseAll on document click 14264 this.menuInstance._closeOnDocumentClick = function() { 14265 return false; 14266 }; 14267 14268 // Selects often contain empty items, but never contain dividers 14269 this.menuInstance._isDivider = function() { 14270 return false; 14271 }; 14272 }, 14273 14274 refresh: function() { 14275 this._refreshMenu(); 14276 this.buttonItem.replaceWith( 14277 this.buttonItem = this._renderButtonItem( 14278 14279 // Fall back to an empty object in case there are no options 14280 this._getSelectedItem().data( "ui-selectmenu-item" ) || {} 14281 ) 14282 ); 14283 if ( this.options.width === null ) { 14284 this._resizeButton(); 14285 } 14286 }, 14287 14288 _refreshMenu: function() { 14289 var item, 14290 options = this.element.find( "option" ); 14291 14292 this.menu.empty(); 14293 14294 this._parseOptions( options ); 14295 this._renderMenu( this.menu, this.items ); 14296 14297 this.menuInstance.refresh(); 14298 this.menuItems = this.menu.find( "li" ) 14299 .not( ".ui-selectmenu-optgroup" ) 14300 .find( ".ui-menu-item-wrapper" ); 14301 14302 this._rendered = true; 14303 14304 if ( !options.length ) { 14305 return; 14306 } 14307 14308 item = this._getSelectedItem(); 14309 14310 // Update the menu to have the correct item focused 14311 this.menuInstance.focus( null, item ); 14312 this._setAria( item.data( "ui-selectmenu-item" ) ); 14313 14314 // Set disabled state 14315 this._setOption( "disabled", this.element.prop( "disabled" ) ); 14316 }, 14317 14318 open: function( event ) { 14319 if ( this.options.disabled ) { 14320 return; 14321 } 14322 14323 // If this is the first time the menu is being opened, render the items 14324 if ( !this._rendered ) { 14325 this._refreshMenu(); 14326 } else { 14327 14328 // Menu clears focus on close, reset focus to selected item 14329 this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" ); 14330 this.menuInstance.focus( null, this._getSelectedItem() ); 14331 } 14332 14333 // If there are no options, don't open the menu 14334 if ( !this.menuItems.length ) { 14335 return; 14336 } 14337 14338 this.isOpen = true; 14339 this._toggleAttr(); 14340 this._resizeMenu(); 14341 this._position(); 14342 14343 this._on( this.document, this._documentClick ); 14344 14345 this._trigger( "open", event ); 14346 }, 14347 14348 _position: function() { 14349 this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); 14350 }, 14351 14352 close: function( event ) { 14353 if ( !this.isOpen ) { 14354 return; 14355 } 14356 14357 this.isOpen = false; 14358 this._toggleAttr(); 14359 14360 this.range = null; 14361 this._off( this.document ); 14362 14363 this._trigger( "close", event ); 14364 }, 14365 14366 widget: function() { 14367 return this.button; 14368 }, 14369 14370 menuWidget: function() { 14371 return this.menu; 14372 }, 14373 14374 _renderButtonItem: function( item ) { 14375 var buttonItem = $( "<span>" ); 14376 14377 this._setText( buttonItem, item.label ); 14378 this._addClass( buttonItem, "ui-selectmenu-text" ); 14379 14380 return buttonItem; 14381 }, 14382 14383 _renderMenu: function( ul, items ) { 14384 var that = this, 14385 currentOptgroup = ""; 14386 14387 $.each( items, function( index, item ) { 14388 var li; 14389 14390 if ( item.optgroup !== currentOptgroup ) { 14391 li = $( "<li>", { 14392 text: item.optgroup 14393 } ); 14394 that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" + 14395 ( item.element.parent( "optgroup" ).prop( "disabled" ) ? 14396 " ui-state-disabled" : 14397 "" ) ); 14398 14399 li.appendTo( ul ); 14400 14401 currentOptgroup = item.optgroup; 14402 } 14403 14404 that._renderItemData( ul, item ); 14405 } ); 14406 }, 14407 14408 _renderItemData: function( ul, item ) { 14409 return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); 14410 }, 14411 14412 _renderItem: function( ul, item ) { 14413 var li = $( "<li>" ), 14414 wrapper = $( "<div>", { 14415 title: item.element.attr( "title" ) 14416 } ); 14417 14418 if ( item.disabled ) { 14419 this._addClass( li, null, "ui-state-disabled" ); 14420 } 14421 this._setText( wrapper, item.label ); 14422 14423 return li.append( wrapper ).appendTo( ul ); 14424 }, 14425 14426 _setText: function( element, value ) { 14427 if ( value ) { 14428 element.text( value ); 14429 } else { 14430 element.html( " " ); 14431 } 14432 }, 14433 14434 _move: function( direction, event ) { 14435 var item, next, 14436 filter = ".ui-menu-item"; 14437 14438 if ( this.isOpen ) { 14439 item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 14440 } else { 14441 item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14442 filter += ":not(.ui-state-disabled)"; 14443 } 14444 14445 if ( direction === "first" || direction === "last" ) { 14446 next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); 14447 } else { 14448 next = item[ direction + "All" ]( filter ).eq( 0 ); 14449 } 14450 14451 if ( next.length ) { 14452 this.menuInstance.focus( event, next ); 14453 } 14454 }, 14455 14456 _getSelectedItem: function() { 14457 return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" ); 14458 }, 14459 14460 _toggle: function( event ) { 14461 this[ this.isOpen ? "close" : "open" ]( event ); 14462 }, 14463 14464 _setSelection: function() { 14465 var selection; 14466 14467 if ( !this.range ) { 14468 return; 14469 } 14470 14471 if ( window.getSelection ) { 14472 selection = window.getSelection(); 14473 selection.removeAllRanges(); 14474 selection.addRange( this.range ); 14475
vendor: 1,173 bytes, lines 14476-14529
14476 // Support: IE8 14477 } else { 14478 this.range.select(); 14479 } 14480 14481 // Support: IE 14482 // Setting the text selection kills the button focus in IE, but 14483 // restoring the focus doesn't kill the selection. 14484 this.button.trigger( "focus" ); 14485 }, 14486 14487 _documentClick: { 14488 mousedown: function( event ) { 14489 if ( !this.isOpen ) { 14490 return; 14491 } 14492 14493 if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + 14494 $.escapeSelector( this.ids.button ) ).length ) { 14495 this.close( event ); 14496 } 14497 } 14498 }, 14499 14500 _buttonEvents: { 14501 14502 // Prevent text selection from being reset when interacting with the selectmenu (#10144) 14503 mousedown: function() { 14504 var selection; 14505 14506 if ( window.getSelection ) { 14507 selection = window.getSelection(); 14508 if ( selection.rangeCount ) { 14509 this.range = selection.getRangeAt( 0 ); 14510 } 14511 14512 // Support: IE8 14513 } else { 14514 this.range = document.selection.createRange(); 14515 } 14516 }, 14517 14518 click: function( event ) { 14519 this._setSelection(); 14520 this._toggle( event ); 14521 }, 14522 14523 keydown: function( event ) { 14524 var preventDefault = true; 14525 switch ( event.keyCode ) { 14526 case $.ui.keyCode.TAB: 14527 case $.ui.keyCode.ESCAPE: 14528 this.close( event ); 14529 preventDefault = false;
vendor: 4,716 bytes, lines 14530-14725
14530 break; 14531 case $.ui.keyCode.ENTER: 14532 if ( this.isOpen ) { 14533 this._selectFocusedItem( event ); 14534 } 14535 break; 14536 case $.ui.keyCode.UP: 14537 if ( event.altKey ) { 14538 this._toggle( event ); 14539 } else { 14540 this._move( "prev", event ); 14541 } 14542 break; 14543 case $.ui.keyCode.DOWN: 14544 if ( event.altKey ) { 14545 this._toggle( event ); 14546 } else { 14547 this._move( "next", event ); 14548 } 14549 break; 14550 case $.ui.keyCode.SPACE: 14551 if ( this.isOpen ) { 14552 this._selectFocusedItem( event ); 14553 } else { 14554 this._toggle( event ); 14555 } 14556 break; 14557 case $.ui.keyCode.LEFT: 14558 this._move( "prev", event ); 14559 break; 14560 case $.ui.keyCode.RIGHT: 14561 this._move( "next", event ); 14562 break; 14563 case $.ui.keyCode.HOME: 14564 case $.ui.keyCode.PAGE_UP: 14565 this._move( "first", event ); 14566 break; 14567 case $.ui.keyCode.END: 14568 case $.ui.keyCode.PAGE_DOWN: 14569 this._move( "last", event ); 14570 break; 14571 default: 14572 this.menu.trigger( event ); 14573 preventDefault = false; 14574 } 14575 14576 if ( preventDefault ) { 14577 event.preventDefault(); 14578 } 14579 } 14580 }, 14581 14582 _selectFocusedItem: function( event ) { 14583 var item = this.menuItems.eq( this.focusIndex ).parent( "li" ); 14584 if ( !item.hasClass( "ui-state-disabled" ) ) { 14585 this._select( item.data( "ui-selectmenu-item" ), event ); 14586 } 14587 }, 14588 14589 _select: function( item, event ) { 14590 var oldIndex = this.element[ 0 ].selectedIndex; 14591 14592 // Change native select element 14593 this.element[ 0 ].selectedIndex = item.index; 14594 this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) ); 14595 this._setAria( item ); 14596 this._trigger( "select", event, { item: item } ); 14597 14598 if ( item.index !== oldIndex ) { 14599 this._trigger( "change", event, { item: item } ); 14600 } 14601 14602 this.close( event ); 14603 }, 14604 14605 _setAria: function( item ) { 14606 var id = this.menuItems.eq( item.index ).attr( "id" ); 14607 14608 this.button.attr( { 14609 "aria-labelledby": id, 14610 "aria-activedescendant": id 14611 } ); 14612 this.menu.attr( "aria-activedescendant", id ); 14613 }, 14614 14615 _setOption: function( key, value ) { 14616 if ( key === "icons" ) { 14617 var icon = this.button.find( "span.ui-icon" ); 14618 this._removeClass( icon, null, this.options.icons.button ) 14619 ._addClass( icon, null, value.button ); 14620 } 14621 14622 this._super( key, value ); 14623 14624 if ( key === "appendTo" ) { 14625 this.menuWrap.appendTo( this._appendTo() ); 14626 } 14627 14628 if ( key === "width" ) { 14629 this._resizeButton(); 14630 } 14631 }, 14632 14633 _setOptionDisabled: function( value ) { 14634 this._super( value ); 14635 14636 this.menuInstance.option( "disabled", value ); 14637 this.button.attr( "aria-disabled", value ); 14638 this._toggleClass( this.button, null, "ui-state-disabled", value ); 14639 14640 this.element.prop( "disabled", value ); 14641 if ( value ) { 14642 this.button.attr( "tabindex", -1 ); 14643 this.close(); 14644 } else { 14645 this.button.attr( "tabindex", 0 ); 14646 } 14647 }, 14648 14649 _appendTo: function() { 14650 var element = this.options.appendTo; 14651 14652 if ( element ) { 14653 element = element.jquery || element.nodeType ? 14654 $( element ) : 14655 this.document.find( element ).eq( 0 ); 14656 } 14657 14658 if ( !element || !element[ 0 ] ) { 14659 element = this.element.closest( ".ui-front, dialog" ); 14660 } 14661 14662 if ( !element.length ) { 14663 element = this.document[ 0 ].body; 14664 } 14665 14666 return element; 14667 }, 14668 14669 _toggleAttr: function() { 14670 this.button.attr( "aria-expanded", this.isOpen ); 14671 14672 // We can't use two _toggleClass() calls here, because we need to make sure 14673 // we always remove classes first and add them second, otherwise if both classes have the 14674 // same theme class, it will be removed after we add it. 14675 this._removeClass( this.button, "ui-selectmenu-button-" + 14676 ( this.isOpen ? "closed" : "open" ) ) 14677 ._addClass( this.button, "ui-selectmenu-button-" + 14678 ( this.isOpen ? "open" : "closed" ) ) 14679 ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen ); 14680 14681 this.menu.attr( "aria-hidden", !this.isOpen ); 14682 }, 14683 14684 _resizeButton: function() { 14685 var width = this.options.width; 14686 14687 // For `width: false`, just remove inline style and stop 14688 if ( width === false ) { 14689 this.button.css( "width", "" ); 14690 return; 14691 } 14692 14693 // For `width: null`, match the width of the original element 14694 if ( width === null ) { 14695 width = this.element.show().outerWidth(); 14696 this.element.hide(); 14697 } 14698 14699 this.button.outerWidth( width ); 14700 }, 14701 14702 _resizeMenu: function() { 14703 this.menu.outerWidth( Math.max( 14704 this.button.outerWidth(), 14705 14706 // Support: IE10 14707 // IE10 wraps long text (possibly a rounding bug) 14708 // so we add 1px to avoid the wrapping 14709 this.menu.width( "" ).outerWidth() + 1 14710 ) ); 14711 }, 14712 14713 _getCreateOptions: function() { 14714 var options = this._super(); 14715 14716 options.disabled = this.element.prop( "disabled" ); 14717 14718 return options; 14719 }, 14720 14721 _parseOptions: function( options ) { 14722 var that = this, 14723 data = []; 14724 options.each( function( index, item ) { 14725
vendor: 3,668 bytes, lines 14725-14875
14725if ( item.hidden ) { 14726 return; 14727 } 14728 14729 data.push( that._parseOption( $( item ), index ) ); 14730 } ); 14731 this.items = data; 14732 }, 14733 14734 _parseOption: function( option, index ) { 14735 var optgroup = option.parent( "optgroup" ); 14736 14737 return { 14738 element: option, 14739 index: index, 14740 value: option.val(), 14741 label: option.text(), 14742 optgroup: optgroup.attr( "label" ) || "", 14743 disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) 14744 }; 14745 }, 14746 14747 _destroy: function() { 14748 this._unbindFormResetHandler(); 14749 this.menuWrap.remove(); 14750 this.button.remove(); 14751 this.element.show(); 14752 this.element.removeUniqueId(); 14753 this.labels.attr( "for", this.ids.element ); 14754 } 14755} ] ); 14756 14757 14758/*! 14759 * jQuery UI Slider 1.13.2 14760 * http://jqueryui.com 14761 * 14762 * Copyright jQuery Foundation and other contributors 14763 * Released under the MIT license. 14764 * http://jquery.org/license 14765 */ 14766 14767//>>label: Slider 14768//>>group: Widgets 14769//>>description: Displays a flexible slider with ranges and accessibility via keyboard. 14770//>>docs: http://api.jqueryui.com/slider/ 14771//>>demos: http://jqueryui.com/slider/ 14772//>>css.structure: ../../themes/base/core.css 14773//>>css.structure: ../../themes/base/slider.css 14774//>>css.theme: ../../themes/base/theme.css 14775 14776 14777var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, { 14778 version: "1.13.2", 14779 widgetEventPrefix: "slide", 14780 14781 options: { 14782 animate: false, 14783 classes: { 14784 "ui-slider": "ui-corner-all", 14785 "ui-slider-handle": "ui-corner-all", 14786 14787 // Note: ui-widget-header isn't the most fittingly semantic framework class for this 14788 // element, but worked best visually with a variety of themes 14789 "ui-slider-range": "ui-corner-all ui-widget-header" 14790 }, 14791 distance: 0, 14792 max: 100, 14793 min: 0, 14794 orientation: "horizontal", 14795 range: false, 14796 step: 1, 14797 value: 0, 14798 values: null, 14799 14800 // Callbacks 14801 change: null, 14802 slide: null, 14803 start: null, 14804 stop: null 14805 }, 14806 14807 // Number of pages in a slider 14808 // (how many times can you page up/down to go through the whole range) 14809 numPages: 5, 14810 14811 _create: function() { 14812 this._keySliding = false; 14813 this._mouseSliding = false; 14814 this._animateOff = true; 14815 this._handleIndex = null; 14816 this._detectOrientation(); 14817 this._mouseInit(); 14818 this._calculateNewMax(); 14819 14820 this._addClass( "ui-slider ui-slider-" + this.orientation, 14821 "ui-widget ui-widget-content" ); 14822 14823 this._refresh(); 14824 14825 this._animateOff = false; 14826 }, 14827 14828 _refresh: function() { 14829 this._createRange(); 14830 this._createHandles(); 14831 this._setupEvents(); 14832 this._refreshValue(); 14833 }, 14834 14835 _createHandles: function() { 14836 var i, handleCount, 14837 options = this.options, 14838 existingHandles = this.element.find( ".ui-slider-handle" ), 14839 handle = "<span tabindex='0'></span>", 14840 handles = []; 14841 14842 handleCount = ( options.values && options.values.length ) || 1; 14843 14844 if ( existingHandles.length > handleCount ) { 14845 existingHandles.slice( handleCount ).remove(); 14846 existingHandles = existingHandles.slice( 0, handleCount ); 14847 } 14848 14849 for ( i = existingHandles.length; i < handleCount; i++ ) { 14850 handles.push( handle ); 14851 } 14852 14853 this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); 14854 14855 this._addClass( this.handles, "ui-slider-handle", "ui-state-default" ); 14856 14857 this.handle = this.handles.eq( 0 ); 14858 14859 this.handles.each( function( i ) { 14860 $( this ) 14861 .data( "ui-slider-handle-index", i ) 14862 .attr( "tabIndex", 0 ); 14863 } ); 14864 }, 14865 14866 _createRange: function() { 14867 var options = this.options; 14868 14869 if ( options.range ) { 14870 if ( options.range === true ) { 14871 if ( !options.values ) { 14872 options.values = [ this._valueMin(), this._valueMin() ]; 14873 } else if ( options.values.length && options.values.length !== 2 ) { 14874 options.values = [ options.values[ 0 ], options.values[ 0 ] ]; 14875 } else if ( Array
vendor: 6,343 bytes, lines 14875-15121
14875.isArray( options.values ) ) { 14876 options.values = options.values.slice( 0 ); 14877 } 14878 } 14879 14880 if ( !this.range || !this.range.length ) { 14881 this.range = $( "<div>" ) 14882 .appendTo( this.element ); 14883 14884 this._addClass( this.range, "ui-slider-range" ); 14885 } else { 14886 this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" ); 14887 14888 // Handle range switching from true to min/max 14889 this.range.css( { 14890 "left": "", 14891 "bottom": "" 14892 } ); 14893 } 14894 if ( options.range === "min" || options.range === "max" ) { 14895 this._addClass( this.range, "ui-slider-range-" + options.range ); 14896 } 14897 } else { 14898 if ( this.range ) { 14899 this.range.remove(); 14900 } 14901 this.range = null; 14902 } 14903 }, 14904 14905 _setupEvents: function() { 14906 this._off( this.handles ); 14907 this._on( this.handles, this._handleEvents ); 14908 this._hoverable( this.handles ); 14909 this._focusable( this.handles ); 14910 }, 14911 14912 _destroy: function() { 14913 this.handles.remove(); 14914 if ( this.range ) { 14915 this.range.remove(); 14916 } 14917 14918 this._mouseDestroy(); 14919 }, 14920 14921 _mouseCapture: function( event ) { 14922 var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, 14923 that = this, 14924 o = this.options; 14925 14926 if ( o.disabled ) { 14927 return false; 14928 } 14929 14930 this.elementSize = { 14931 width: this.element.outerWidth(), 14932 height: this.element.outerHeight() 14933 }; 14934 this.elementOffset = this.element.offset(); 14935 14936 position = { x: event.pageX, y: event.pageY }; 14937 normValue = this._normValueFromMouse( position ); 14938 distance = this._valueMax() - this._valueMin() + 1; 14939 this.handles.each( function( i ) { 14940 var thisDistance = Math.abs( normValue - that.values( i ) ); 14941 if ( ( distance > thisDistance ) || 14942 ( distance === thisDistance && 14943 ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) { 14944 distance = thisDistance; 14945 closestHandle = $( this ); 14946 index = i; 14947 } 14948 } ); 14949 14950 allowed = this._start( event, index ); 14951 if ( allowed === false ) { 14952 return false; 14953 } 14954 this._mouseSliding = true; 14955 14956 this._handleIndex = index; 14957 14958 this._addClass( closestHandle, null, "ui-state-active" ); 14959 closestHandle.trigger( "focus" ); 14960 14961 offset = closestHandle.offset(); 14962 mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); 14963 this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { 14964 left: event.pageX - offset.left - ( closestHandle.width() / 2 ), 14965 top: event.pageY - offset.top - 14966 ( closestHandle.height() / 2 ) - 14967 ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) - 14968 ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) + 14969 ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 ) 14970 }; 14971 14972 if ( !this.handles.hasClass( "ui-state-hover" ) ) { 14973 this._slide( event, index, normValue ); 14974 } 14975 this._animateOff = true; 14976 return true; 14977 }, 14978 14979 _mouseStart: function() { 14980 return true; 14981 }, 14982 14983 _mouseDrag: function( event ) { 14984 var position = { x: event.pageX, y: event.pageY }, 14985 normValue = this._normValueFromMouse( position ); 14986 14987 this._slide( event, this._handleIndex, normValue ); 14988 14989 return false; 14990 }, 14991 14992 _mouseStop: function( event ) { 14993 this._removeClass( this.handles, null, "ui-state-active" ); 14994 this._mouseSliding = false; 14995 14996 this._stop( event, this._handleIndex ); 14997 this._change( event, this._handleIndex ); 14998 14999 this._handleIndex = null; 15000 this._clickOffset = null; 15001 this._animateOff = false; 15002 15003 return false; 15004 }, 15005 15006 _detectOrientation: function() { 15007 this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; 15008 }, 15009 15010 _normValueFromMouse: function( position ) { 15011 var pixelTotal, 15012 pixelMouse, 15013 percentMouse, 15014 valueTotal, 15015 valueMouse; 15016 15017 if ( this.orientation === "horizontal" ) { 15018 pixelTotal = this.elementSize.width; 15019 pixelMouse = position.x - this.elementOffset.left - 15020 ( this._clickOffset ? this._clickOffset.left : 0 ); 15021 } else { 15022 pixelTotal = this.elementSize.height; 15023 pixelMouse = position.y - this.elementOffset.top - 15024 ( this._clickOffset ? this._clickOffset.top : 0 ); 15025 } 15026 15027 percentMouse = ( pixelMouse / pixelTotal ); 15028 if ( percentMouse > 1 ) { 15029 percentMouse = 1; 15030 } 15031 if ( percentMouse < 0 ) { 15032 percentMouse = 0; 15033 } 15034 if ( this.orientation === "vertical" ) { 15035 percentMouse = 1 - percentMouse; 15036 } 15037 15038 valueTotal = this._valueMax() - this._valueMin(); 15039 valueMouse = this._valueMin() + percentMouse * valueTotal; 15040 15041 return this._trimAlignValue( valueMouse ); 15042 }, 15043 15044 _uiHash: function( index, value, values ) { 15045 var uiHash = { 15046 handle: this.handles[ index ], 15047 handleIndex: index, 15048 value: value !== undefined ? value : this.value() 15049 }; 15050 15051 if ( this._hasMultipleValues() ) { 15052 uiHash.value = value !== undefined ? value : this.values( index ); 15053 uiHash.values = values || this.values(); 15054 } 15055 15056 return uiHash; 15057 }, 15058 15059 _hasMultipleValues: function() { 15060 return this.options.values && this.options.values.length; 15061 }, 15062 15063 _start: function( event, index ) { 15064 return this._trigger( "start", event, this._uiHash( index ) ); 15065 }, 15066 15067 _slide: function( event, index, newVal ) { 15068 var allowed, otherVal, 15069 currentValue = this.value(), 15070 newValues = this.values(); 15071 15072 if ( this._hasMultipleValues() ) { 15073 otherVal = this.values( index ? 0 : 1 ); 15074 currentValue = this.values( index ); 15075 15076 if ( this.options.values.length === 2 && this.options.range === true ) { 15077 newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal ); 15078 } 15079 15080 newValues[ index ] = newVal; 15081 } 15082 15083 if ( newVal === currentValue ) { 15084 return; 15085 } 15086 15087 allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) ); 15088 15089 // A slide can be canceled by returning false from the slide callback 15090 if ( allowed === false ) { 15091 return; 15092 } 15093 15094 if ( this._hasMultipleValues() ) { 15095 this.values( index, newVal ); 15096 } else { 15097 this.value( newVal ); 15098 } 15099 }, 15100 15101 _stop: function( event, index ) { 15102 this._trigger( "stop", event, this._uiHash( index ) ); 15103 }, 15104 15105 _change: function( event, index ) { 15106 if ( !this._keySliding && !this._mouseSliding ) { 15107 15108 //store the last changed value index for reference when handles overlap 15109 this._lastChangedValue = index; 15110 this._trigger( "change", event, this._uiHash( index ) ); 15111 } 15112 }, 15113 15114 value: function( newValue ) { 15115 if ( arguments.length ) { 15116 this.options.value = this._trimAlignValue( newValue ); 15117 this._refreshValue(); 15118 this._change( null, 0 ); 15119 return; 15120 } 15121
vendor: 4,358 bytes, lines 15122-15294
15122 return this._value(); 15123 }, 15124 15125 values: function( index, newValue ) { 15126 var vals, 15127 newValues, 15128 i; 15129 15130 if ( arguments.length > 1 ) { 15131 this.options.values[ index ] = this._trimAlignValue( newValue ); 15132 this._refreshValue(); 15133 this._change( null, index ); 15134 return; 15135 } 15136 15137 if ( arguments.length ) { 15138 if ( Array.isArray( arguments[ 0 ] ) ) { 15139 vals = this.options.values; 15140 newValues = arguments[ 0 ]; 15141 for ( i = 0; i < vals.length; i += 1 ) { 15142 vals[ i ] = this._trimAlignValue( newValues[ i ] ); 15143 this._change( null, i ); 15144 } 15145 this._refreshValue(); 15146 } else { 15147 if ( this._hasMultipleValues() ) { 15148 return this._values( index ); 15149 } else { 15150 return this.value(); 15151 } 15152 } 15153 } else { 15154 return this._values(); 15155 } 15156 }, 15157 15158 _setOption: function( key, value ) { 15159 var i, 15160 valsLength = 0; 15161 15162 if ( key === "range" && this.options.range === true ) { 15163 if ( value === "min" ) { 15164 this.options.value = this._values( 0 ); 15165 this.options.values = null; 15166 } else if ( value === "max" ) { 15167 this.options.value = this._values( this.options.values.length - 1 ); 15168 this.options.values = null; 15169 } 15170 } 15171 15172 if ( Array.isArray( this.options.values ) ) { 15173 valsLength = this.options.values.length; 15174 } 15175 15176 this._super( key, value ); 15177 15178 switch ( key ) { 15179 case "orientation": 15180 this._detectOrientation(); 15181 this._removeClass( "ui-slider-horizontal ui-slider-vertical" ) 15182 ._addClass( "ui-slider-" + this.orientation ); 15183 this._refreshValue(); 15184 if ( this.options.range ) { 15185 this._refreshRange( value ); 15186 } 15187 15188 // Reset positioning from previous orientation 15189 this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); 15190 break; 15191 case "value": 15192 this._animateOff = true; 15193 this._refreshValue(); 15194 this._change( null, 0 ); 15195 this._animateOff = false; 15196 break; 15197 case "values": 15198 this._animateOff = true; 15199 this._refreshValue(); 15200 15201 // Start from the last handle to prevent unreachable handles (#9046) 15202 for ( i = valsLength - 1; i >= 0; i-- ) { 15203 this._change( null, i ); 15204 } 15205 this._animateOff = false; 15206 break; 15207 case "step": 15208 case "min": 15209 case "max": 15210 this._animateOff = true; 15211 this._calculateNewMax(); 15212 this._refreshValue(); 15213 this._animateOff = false; 15214 break; 15215 case "range": 15216 this._animateOff = true; 15217 this._refresh(); 15218 this._animateOff = false; 15219 break; 15220 } 15221 }, 15222 15223 _setOptionDisabled: function( value ) { 15224 this._super( value ); 15225 15226 this._toggleClass( null, "ui-state-disabled", !!value ); 15227 }, 15228 15229 //internal value getter 15230 // _value() returns value trimmed by min and max, aligned by step 15231 _value: function() { 15232 var val = this.options.value; 15233 val = this._trimAlignValue( val ); 15234 15235 return val; 15236 }, 15237 15238 //internal values getter 15239 // _values() returns array of values trimmed by min and max, aligned by step 15240 // _values( index ) returns single value trimmed by min and max, aligned by step 15241 _values: function( index ) { 15242 var val, 15243 vals, 15244 i; 15245 15246 if ( arguments.length ) { 15247 val = this.options.values[ index ]; 15248 val = this._trimAlignValue( val ); 15249 15250 return val; 15251 } else if ( this._hasMultipleValues() ) { 15252 15253 // .slice() creates a copy of the array 15254 // this copy gets trimmed by min and max and then returned 15255 vals = this.options.values.slice(); 15256 for ( i = 0; i < vals.length; i += 1 ) { 15257 vals[ i ] = this._trimAlignValue( vals[ i ] ); 15258 } 15259 15260 return vals; 15261 } else { 15262 return []; 15263 } 15264 }, 15265 15266 // Returns the step-aligned value that val is closest to, between (inclusive) min and max 15267 _trimAlignValue: function( val ) { 15268 if ( val <= this._valueMin() ) { 15269 return this._valueMin(); 15270 } 15271 if ( val >= this._valueMax() ) { 15272 return this._valueMax(); 15273 } 15274 var step = ( this.options.step > 0 ) ? this.options.step : 1, 15275 valModStep = ( val - this._valueMin() ) % step, 15276 alignValue = val - valModStep; 15277 15278 if ( Math.abs( valModStep ) * 2 >= step ) { 15279 alignValue += ( valModStep > 0 ) ? step : ( -step ); 15280 } 15281 15282 // Since JavaScript has problems with large floats, round 15283 // the final value to 5 digits after the decimal point (see #4124) 15284 return parseFloat( alignValue.toFixed( 5 ) ); 15285 }, 15286 15287 _calculateNewMax: function() { 15288 var max = this.options.max, 15289 min = this._valueMin(), 15290 step = this.options.step, 15291 aboveMin = Math.round( ( max - min ) / step ) * step; 15292 max = aboveMin + min; 15293 if ( max > this.options.max ) { 15294
vendor: 5,594 bytes, lines 15295-15494
15295 //If max is not divisible by step, rounding off may increase its value 15296 max -= step; 15297 } 15298 this.max = parseFloat( max.toFixed( this._precision() ) ); 15299 }, 15300 15301 _precision: function() { 15302 var precision = this._precisionOf( this.options.step ); 15303 if ( this.options.min !== null ) { 15304 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 15305 } 15306 return precision; 15307 }, 15308 15309 _precisionOf: function( num ) { 15310 var str = num.toString(), 15311 decimal = str.indexOf( "." ); 15312 return decimal === -1 ? 0 : str.length - decimal - 1; 15313 }, 15314 15315 _valueMin: function() { 15316 return this.options.min; 15317 }, 15318 15319 _valueMax: function() { 15320 return this.max; 15321 }, 15322 15323 _refreshRange: function( orientation ) { 15324 if ( orientation === "vertical" ) { 15325 this.range.css( { "width": "", "left": "" } ); 15326 } 15327 if ( orientation === "horizontal" ) { 15328 this.range.css( { "height": "", "bottom": "" } ); 15329 } 15330 }, 15331 15332 _refreshValue: function() { 15333 var lastValPercent, valPercent, value, valueMin, valueMax, 15334 oRange = this.options.range, 15335 o = this.options, 15336 that = this, 15337 animate = ( !this._animateOff ) ? o.animate : false, 15338 _set = {}; 15339 15340 if ( this._hasMultipleValues() ) { 15341 this.handles.each( function( i ) { 15342 valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() - 15343 that._valueMin() ) * 100; 15344 _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15345 $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15346 if ( that.options.range === true ) { 15347 if ( that.orientation === "horizontal" ) { 15348 if ( i === 0 ) { 15349 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15350 left: valPercent + "%" 15351 }, o.animate ); 15352 } 15353 if ( i === 1 ) { 15354 that.range[ animate ? "animate" : "css" ]( { 15355 width: ( valPercent - lastValPercent ) + "%" 15356 }, { 15357 queue: false, 15358 duration: o.animate 15359 } ); 15360 } 15361 } else { 15362 if ( i === 0 ) { 15363 that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15364 bottom: ( valPercent ) + "%" 15365 }, o.animate ); 15366 } 15367 if ( i === 1 ) { 15368 that.range[ animate ? "animate" : "css" ]( { 15369 height: ( valPercent - lastValPercent ) + "%" 15370 }, { 15371 queue: false, 15372 duration: o.animate 15373 } ); 15374 } 15375 } 15376 } 15377 lastValPercent = valPercent; 15378 } ); 15379 } else { 15380 value = this.value(); 15381 valueMin = this._valueMin(); 15382 valueMax = this._valueMax(); 15383 valPercent = ( valueMax !== valueMin ) ? 15384 ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 15385 0; 15386 _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; 15387 this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); 15388 15389 if ( oRange === "min" && this.orientation === "horizontal" ) { 15390 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15391 width: valPercent + "%" 15392 }, o.animate ); 15393 } 15394 if ( oRange === "max" && this.orientation === "horizontal" ) { 15395 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15396 width: ( 100 - valPercent ) + "%" 15397 }, o.animate ); 15398 } 15399 if ( oRange === "min" && this.orientation === "vertical" ) { 15400 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15401 height: valPercent + "%" 15402 }, o.animate ); 15403 } 15404 if ( oRange === "max" && this.orientation === "vertical" ) { 15405 this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { 15406 height: ( 100 - valPercent ) + "%" 15407 }, o.animate ); 15408 } 15409 } 15410 }, 15411 15412 _handleEvents: { 15413 keydown: function( event ) { 15414 var allowed, curVal, newVal, step, 15415 index = $( event.target ).data( "ui-slider-handle-index" ); 15416 15417 switch ( event.keyCode ) { 15418 case $.ui.keyCode.HOME: 15419 case $.ui.keyCode.END: 15420 case $.ui.keyCode.PAGE_UP: 15421 case $.ui.keyCode.PAGE_DOWN: 15422 case $.ui.keyCode.UP: 15423 case $.ui.keyCode.RIGHT: 15424 case $.ui.keyCode.DOWN: 15425 case $.ui.keyCode.LEFT: 15426 event.preventDefault(); 15427 if ( !this._keySliding ) { 15428 this._keySliding = true; 15429 this._addClass( $( event.target ), null, "ui-state-active" ); 15430 allowed = this._start( event, index ); 15431 if ( allowed === false ) { 15432 return; 15433 } 15434 } 15435 break; 15436 } 15437 15438 step = this.options.step; 15439 if ( this._hasMultipleValues() ) { 15440 curVal = newVal = this.values( index ); 15441 } else { 15442 curVal = newVal = this.value(); 15443 } 15444 15445 switch ( event.keyCode ) { 15446 case $.ui.keyCode.HOME: 15447 newVal = this._valueMin(); 15448 break; 15449 case $.ui.keyCode.END: 15450 newVal = this._valueMax(); 15451 break; 15452 case $.ui.keyCode.PAGE_UP: 15453 newVal = this._trimAlignValue( 15454 curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) 15455 ); 15456 break; 15457 case $.ui.keyCode.PAGE_DOWN: 15458 newVal = this._trimAlignValue( 15459 curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); 15460 break; 15461 case $.ui.keyCode.UP: 15462 case $.ui.keyCode.RIGHT: 15463 if ( curVal === this._valueMax() ) { 15464 return; 15465 } 15466 newVal = this._trimAlignValue( curVal + step ); 15467 break; 15468 case $.ui.keyCode.DOWN: 15469 case $.ui.keyCode.LEFT: 15470 if ( curVal === this._valueMin() ) { 15471 return; 15472 } 15473 newVal = this._trimAlignValue( curVal - step ); 15474 break; 15475 } 15476 15477 this._slide( event, index, newVal ); 15478 }, 15479 keyup: function( event ) { 15480 var index = $( event.target ).data( "ui-slider-handle-index" ); 15481 15482 if ( this._keySliding ) { 15483 this._keySliding = false; 15484 this._stop( event, index ); 15485 this._change( event, index ); 15486 this._removeClass( $( event.target ), null, "ui-state-active" ); 15487 } 15488 } 15489 } 15490} ); 15491 15492 15493/*! 15494 * jQuery UI Sortable 1.1
154943.2 15495 * http://jqueryui.com 15496 * 15497 * Copyright jQuery Foundation and other contributors 15498 * Released under the MIT license. 15499 * http://jquery.org/license 15500 */ 15501 15502//>>label: Sortable 15503//>>group: Interactions 15504//>>description: Enables items in a list to be sorted using the mouse. 15505//>>docs: http://api.jqueryui.com/sortable/ 15506//>>demos: http://jqueryui.com/sortable/ 15507//>>css.structure: ../../themes/base/sortable.css 15508 15509 15510var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { 15511 version: "1.13.2
vendor: 7,925 bytes, lines 15511-15830
15511", 15512 widgetEventPrefix: "sort", 15513 ready: false, 15514 options: { 15515 appendTo: "parent", 15516 axis: false, 15517 connectWith: false, 15518 containment: false, 15519 cursor: "auto", 15520 cursorAt: false, 15521 dropOnEmpty: true, 15522 forcePlaceholderSize: false, 15523 forceHelperSize: false, 15524 grid: false, 15525 handle: false, 15526 helper: "original", 15527 items: "> *", 15528 opacity: false, 15529 placeholder: false, 15530 revert: false, 15531 scroll: true, 15532 scrollSensitivity: 20, 15533 scrollSpeed: 20, 15534 scope: "default", 15535 tolerance: "intersect", 15536 zIndex: 1000, 15537 15538 // Callbacks 15539 activate: null, 15540 beforeStop: null, 15541 change: null, 15542 deactivate: null, 15543 out: null, 15544 over: null, 15545 receive: null, 15546 remove: null, 15547 sort: null, 15548 start: null, 15549 stop: null, 15550 update: null 15551 }, 15552 15553 _isOverAxis: function( x, reference, size ) { 15554 return ( x >= reference ) && ( x < ( reference + size ) ); 15555 }, 15556 15557 _isFloating: function( item ) { 15558 return ( /left|right/ ).test( item.css( "float" ) ) || 15559 ( /inline|table-cell/ ).test( item.css( "display" ) ); 15560 }, 15561 15562 _create: function() { 15563 this.containerCache = {}; 15564 this._addClass( "ui-sortable" ); 15565 15566 //Get the items 15567 this.refresh(); 15568 15569 //Let's determine the parent's offset 15570 this.offset = this.element.offset(); 15571 15572 //Initialize mouse events for interaction 15573 this._mouseInit(); 15574 15575 this._setHandleClassName(); 15576 15577 //We're ready to go 15578 this.ready = true; 15579 15580 }, 15581 15582 _setOption: function( key, value ) { 15583 this._super( key, value ); 15584 15585 if ( key === "handle" ) { 15586 this._setHandleClassName(); 15587 } 15588 }, 15589 15590 _setHandleClassName: function() { 15591 var that = this; 15592 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 15593 $.each( this.items, function() { 15594 that._addClass( 15595 this.instance.options.handle ? 15596 this.item.find( this.instance.options.handle ) : 15597 this.item, 15598 "ui-sortable-handle" 15599 ); 15600 } ); 15601 }, 15602 15603 _destroy: function() { 15604 this._mouseDestroy(); 15605 15606 for ( var i = this.items.length - 1; i >= 0; i-- ) { 15607 this.items[ i ].item.removeData( this.widgetName + "-item" ); 15608 } 15609 15610 return this; 15611 }, 15612 15613 _mouseCapture: function( event, overrideHandle ) { 15614 var currentItem = null, 15615 validHandle = false, 15616 that = this; 15617 15618 if ( this.reverting ) { 15619 return false; 15620 } 15621 15622 if ( this.options.disabled || this.options.type === "static" ) { 15623 return false; 15624 } 15625 15626 //We have to refresh the items data once first 15627 this._refreshItems( event ); 15628 15629 //Find out if the clicked node (or one of its parents) is a actual item in this.items 15630 $( event.target ).parents().each( function() { 15631 if ( $.data( this, that.widgetName + "-item" ) === that ) { 15632 currentItem = $( this ); 15633 return false; 15634 } 15635 } ); 15636 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 15637 currentItem = $( event.target ); 15638 } 15639 15640 if ( !currentItem ) { 15641 return false; 15642 } 15643 if ( this.options.handle && !overrideHandle ) { 15644 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 15645 if ( this === event.target ) { 15646 validHandle = true; 15647 } 15648 } ); 15649 if ( !validHandle ) { 15650 return false; 15651 } 15652 } 15653 15654 this.currentItem = currentItem; 15655 this._removeCurrentsFromItems(); 15656 return true; 15657 15658 }, 15659 15660 _mouseStart: function( event, overrideHandle, noActivation ) { 15661 15662 var i, body, 15663 o = this.options; 15664 15665 this.currentContainer = this; 15666 15667 //We only need to call refreshPositions, because the refreshItems call has been moved to 15668 // mouseCapture 15669 this.refreshPositions(); 15670 15671 //Prepare the dragged items parent 15672 this.appendTo = $( o.appendTo !== "parent" ? 15673 o.appendTo : 15674 this.currentItem.parent() ); 15675 15676 //Create and append the visible helper 15677 this.helper = this._createHelper( event ); 15678 15679 //Cache the helper size 15680 this._cacheHelperProportions(); 15681 15682 /* 15683 * - Position generation - 15684 * This block generates everything position related - it's the core of draggables. 15685 */ 15686 15687 //Cache the margins of the original element 15688 this._cacheMargins(); 15689 15690 //The element's absolute position on the page minus margins 15691 this.offset = this.currentItem.offset(); 15692 this.offset = { 15693 top: this.offset.top - this.margins.top, 15694 left: this.offset.left - this.margins.left 15695 }; 15696 15697 $.extend( this.offset, { 15698 click: { //Where the click happened, relative to the element 15699 left: event.pageX - this.offset.left, 15700 top: event.pageY - this.offset.top 15701 }, 15702 15703 // This is a relative to absolute position minus the actual position calculation - 15704 // only used for relative positioned helper 15705 relative: this._getRelativeOffset() 15706 } ); 15707 15708 // After we get the helper offset, but before we get the parent offset we can 15709 // change the helper's position to absolute 15710 // TODO: Still need to figure out a way to make relative sorting possible 15711 this.helper.css( "position", "absolute" ); 15712 this.cssPosition = this.helper.css( "position" ); 15713 15714 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 15715 if ( o.cursorAt ) { 15716 this._adjustOffsetFromHelper( o.cursorAt ); 15717 } 15718 15719 //Cache the former DOM position 15720 this.domPosition = { 15721 prev: this.currentItem.prev()[ 0 ], 15722 parent: this.currentItem.parent()[ 0 ] 15723 }; 15724 15725 // If the helper is not the original, hide the original so it's not playing any role during 15726 // the drag, won't cause anything bad this way 15727 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 15728 this.currentItem.hide(); 15729 } 15730 15731 //Create the placeholder 15732 this._createPlaceholder(); 15733 15734 //Get the next scrolling parent 15735 this.scrollParent = this.placeholder.scrollParent(); 15736 15737 $.extend( this.offset, { 15738 parent: this._getParentOffset() 15739 } ); 15740 15741 //Set a containment if given in the options 15742 if ( o.containment ) { 15743 this._setContainment(); 15744 } 15745 15746 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 15747 body = this.document.find( "body" ); 15748 15749 // Support: IE 15750 this.storedCursor = body.css( "cursor" ); 15751 body.css( "cursor", o.cursor ); 15752 15753 this.storedStylesheet = 15754 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 15755 } 15756 15757 // We need to make sure to grab the zIndex before setting the 15758 // opacity, because setting the opacity to anything lower than 1 15759 // causes the zIndex to change from "auto" to 0. 15760 if ( o.zIndex ) { // zIndex option 15761 if ( this.helper.css( "zIndex" ) ) { 15762 this._storedZIndex = this.helper.css( "zIndex" ); 15763 } 15764 this.helper.css( "zIndex", o.zIndex ); 15765 } 15766 15767 if ( o.opacity ) { // opacity option 15768 if ( this.helper.css( "opacity" ) ) { 15769 this._storedOpacity = this.helper.css( "opacity" ); 15770 } 15771 this.helper.css( "opacity", o.opacity ); 15772 } 15773 15774 //Prepare scrolling 15775 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 15776 this.scrollParent[ 0 ].tagName !== "HTML" ) { 15777 this.overflowOffset = this.scrollParent.offset(); 15778 } 15779 15780 //Call callbacks 15781 this._trigger( "start", event, this._uiHash() ); 15782 15783 //Recache the helper size 15784 if ( !this._preserveHelperProportions ) { 15785 this._cacheHelperProportions(); 15786 } 15787 15788 //Post "activate" events to possible containers 15789 if ( !noActivation ) { 15790 for ( i = this.containers.length - 1; i >= 0; i-- ) { 15791 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 15792 } 15793 } 15794 15795 //Prepare possible droppables 15796 if ( $.ui.ddmanager ) { 15797 $.ui.ddmanager.current = this; 15798 } 15799 15800 if ( $.ui.ddmanager && !o.dropBehaviour ) { 15801 $.ui.ddmanager.prepareOffsets( this, event ); 15802 } 15803 15804 this.dragging = true; 15805 15806 this._addClass( this.helper, "ui-sortable-helper" ); 15807 15808 //Move the helper, if needed 15809 if ( !this.helper.parent().is( this.appendTo ) ) { 15810 this.helper.detach().appendTo( this.appendTo ); 15811 15812 //Update position 15813 this.offset.parent = this._getParentOffset(); 15814 } 15815 15816 //Generate the original position 15817 this.position = this.originalPosition = this._generatePosition( event ); 15818 this.originalPageX = event.pageX; 15819 this.originalPageY = event.pageY; 15820 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 15821 15822 this._mouseDrag( event ); 15823 15824 return true; 15825 15826 }, 15827 15828 _scroll: function( event ) { 15829 var o = this.options, 15830 scrolled = false;
vendor: 4,489 bytes, lines 15831-15973
15831 15832 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 15833 this.scrollParent[ 0 ].tagName !== "HTML" ) { 15834 15835 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 15836 event.pageY < o.scrollSensitivity ) { 15837 this.scrollParent[ 0 ].scrollTop = 15838 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 15839 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 15840 this.scrollParent[ 0 ].scrollTop = 15841 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 15842 } 15843 15844 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 15845 event.pageX < o.scrollSensitivity ) { 15846 this.scrollParent[ 0 ].scrollLeft = scrolled = 15847 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 15848 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 15849 this.scrollParent[ 0 ].scrollLeft = scrolled = 15850 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 15851 } 15852 15853 } else { 15854 15855 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 15856 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 15857 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 15858 o.scrollSensitivity ) { 15859 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 15860 } 15861 15862 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 15863 scrolled = this.document.scrollLeft( 15864 this.document.scrollLeft() - o.scrollSpeed 15865 ); 15866 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 15867 o.scrollSensitivity ) { 15868 scrolled = this.document.scrollLeft( 15869 this.document.scrollLeft() + o.scrollSpeed 15870 ); 15871 } 15872 15873 } 15874 15875 return scrolled; 15876 }, 15877 15878 _mouseDrag: function( event ) { 15879 var i, item, itemElement, intersection, 15880 o = this.options; 15881 15882 //Compute the helpers position 15883 this.position = this._generatePosition( event ); 15884 this.positionAbs = this._convertPositionTo( "absolute" ); 15885 15886 //Set the helper position 15887 if ( !this.options.axis || this.options.axis !== "y" ) { 15888 this.helper[ 0 ].style.left = this.position.left + "px"; 15889 } 15890 if ( !this.options.axis || this.options.axis !== "x" ) { 15891 this.helper[ 0 ].style.top = this.position.top + "px"; 15892 } 15893 15894 //Do scrolling 15895 if ( o.scroll ) { 15896 if ( this._scroll( event ) !== false ) { 15897 15898 //Update item positions used in position checks 15899 this._refreshItemPositions( true ); 15900 15901 if ( $.ui.ddmanager && !o.dropBehaviour ) { 15902 $.ui.ddmanager.prepareOffsets( this, event ); 15903 } 15904 } 15905 } 15906 15907 this.dragDirection = { 15908 vertical: this._getDragVerticalDirection(), 15909 horizontal: this._getDragHorizontalDirection() 15910 }; 15911 15912 //Rearrange 15913 for ( i = this.items.length - 1; i >= 0; i-- ) { 15914 15915 //Cache variables and intersection, continue if no intersection 15916 item = this.items[ i ]; 15917 itemElement = item.item[ 0 ]; 15918 intersection = this._intersectsWithPointer( item ); 15919 if ( !intersection ) { 15920 continue; 15921 } 15922 15923 // Only put the placeholder inside the current Container, skip all 15924 // items from other containers. This works because when moving 15925 // an item from one container to another the 15926 // currentContainer is switched before the placeholder is moved. 15927 // 15928 // Without this, moving items in "sub-sortables" can cause 15929 // the placeholder to jitter between the outer and inner container. 15930 if ( item.instance !== this.currentContainer ) { 15931 continue; 15932 } 15933 15934 // Cannot intersect with itself 15935 // no useless actions that have been done before 15936 // no action if the item moved is the parent of the item checked 15937 if ( itemElement !== this.currentItem[ 0 ] && 15938 this.placeholder[ intersection === 1 ? 15939 "next" : "prev" ]()[ 0 ] !== itemElement && 15940 !$.contains( this.placeholder[ 0 ], itemElement ) && 15941 ( this.options.type === "semi-dynamic" ? 15942 !$.contains( this.element[ 0 ], itemElement ) : 15943 true 15944 ) 15945 ) { 15946 15947 this.direction = intersection === 1 ? "down" : "up"; 15948 15949 if ( this.options.tolerance === "pointer" || 15950 this._intersectsWithSides( item ) ) { 15951 this._rearrange( event, item ); 15952 } else { 15953 break; 15954 } 15955 15956 this._trigger( "change", event, this._uiHash() ); 15957 break; 15958 } 15959 } 15960 15961 //Post events to containers 15962 this._contactContainers( event ); 15963 15964 //Interconnect with droppables 15965 if ( $.ui.ddmanager ) { 15966 $.ui.ddmanager.drag( this, event ); 15967 } 15968 15969 //Call callbacks 15970 this._trigger( "sort", event, this._uiHash() ); 15971 15972 this.lastPositionAbs = this.positionAbs; 15973 return false;
vendor: 5,063 bytes, lines 15974-16163
15974 15975 }, 15976 15977 _mouseStop: function( event, noPropagation ) { 15978 15979 if ( !event ) { 15980 return; 15981 } 15982 15983 //If we are using droppables, inform the manager about the drop 15984 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 15985 $.ui.ddmanager.drop( this, event ); 15986 } 15987 15988 if ( this.options.revert ) { 15989 var that = this, 15990 cur = this.placeholder.offset(), 15991 axis = this.options.axis, 15992 animation = {}; 15993 15994 if ( !axis || axis === "x" ) { 15995 animation.left = cur.left - this.offset.parent.left - this.margins.left + 15996 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 15997 0 : 15998 this.offsetParent[ 0 ].scrollLeft 15999 ); 16000 } 16001 if ( !axis || axis === "y" ) { 16002 animation.top = cur.top - this.offset.parent.top - this.margins.top + 16003 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 16004 0 : 16005 this.offsetParent[ 0 ].scrollTop 16006 ); 16007 } 16008 this.reverting = true; 16009 $( this.helper ).animate( 16010 animation, 16011 parseInt( this.options.revert, 10 ) || 500, 16012 function() { 16013 that._clear( event ); 16014 } 16015 ); 16016 } else { 16017 this._clear( event, noPropagation ); 16018 } 16019 16020 return false; 16021 16022 }, 16023 16024 cancel: function() { 16025 16026 if ( this.dragging ) { 16027 16028 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 16029 16030 if ( this.options.helper === "original" ) { 16031 this.currentItem.css( this._storedCSS ); 16032 this._removeClass( this.currentItem, "ui-sortable-helper" ); 16033 } else { 16034 this.currentItem.show(); 16035 } 16036 16037 //Post deactivating events to containers 16038 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 16039 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 16040 if ( this.containers[ i ].containerCache.over ) { 16041 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 16042 this.containers[ i ].containerCache.over = 0; 16043 } 16044 } 16045 16046 } 16047 16048 if ( this.placeholder ) { 16049 16050 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 16051 // it unbinds ALL events from the original node! 16052 if ( this.placeholder[ 0 ].parentNode ) { 16053 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 16054 } 16055 if ( this.options.helper !== "original" && this.helper && 16056 this.helper[ 0 ].parentNode ) { 16057 this.helper.remove(); 16058 } 16059 16060 $.extend( this, { 16061 helper: null, 16062 dragging: false, 16063 reverting: false, 16064 _noFinalSort: null 16065 } ); 16066 16067 if ( this.domPosition.prev ) { 16068 $( this.domPosition.prev ).after( this.currentItem ); 16069 } else { 16070 $( this.domPosition.parent ).prepend( this.currentItem ); 16071 } 16072 } 16073 16074 return this; 16075 16076 }, 16077 16078 serialize: function( o ) { 16079 16080 var items = this._getItemsAsjQuery( o && o.connected ), 16081 str = []; 16082 o = o || {}; 16083 16084 $( items ).each( function() { 16085 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 16086 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 16087 if ( res ) { 16088 str.push( 16089 ( o.key || res[ 1 ] + "[]" ) + 16090 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 16091 } 16092 } ); 16093 16094 if ( !str.length && o.key ) { 16095 str.push( o.key + "=" ); 16096 } 16097 16098 return str.join( "&" ); 16099 16100 }, 16101 16102 toArray: function( o ) { 16103 16104 var items = this._getItemsAsjQuery( o && o.connected ), 16105 ret = []; 16106 16107 o = o || {}; 16108 16109 items.each( function() { 16110 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 16111 } ); 16112 return ret; 16113 16114 }, 16115 16116 /* Be careful with the following core functions */ 16117 _intersectsWith: function( item ) { 16118 16119 var x1 = this.positionAbs.left, 16120 x2 = x1 + this.helperProportions.width, 16121 y1 = this.positionAbs.top, 16122 y2 = y1 + this.helperProportions.height, 16123 l = item.left, 16124 r = l + item.width, 16125 t = item.top, 16126 b = t + item.height, 16127 dyClick = this.offset.click.top, 16128 dxClick = this.offset.click.left, 16129 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 16130 ( y1 + dyClick ) < b ), 16131 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 16132 ( x1 + dxClick ) < r ), 16133 isOverElement = isOverElementHeight && isOverElementWidth; 16134 16135 if ( this.options.tolerance === "pointer" || 16136 this.options.forcePointerForContainers || 16137 ( this.options.tolerance !== "pointer" && 16138 this.helperProportions[ this.floating ? "width" : "height" ] > 16139 item[ this.floating ? "width" : "height" ] ) 16140 ) { 16141 return isOverElement; 16142 } else { 16143 16144 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 16145 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 16146 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 16147 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 16148 16149 } 16150 }, 16151 16152 _intersectsWithPointer: function( item ) { 16153 var verticalDirection, horizontalDirection, 16154 isOverElementHeight = ( this.options.axis === "x" ) || 16155 this._isOverAxis( 16156 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 16157 isOverElementWidth = ( this.options.axis === "y" ) || 16158 this._isOverAxis( 16159 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 16160 isOverElement = isOverElementHeight && isOverElementWidth; 16161 16162 if ( !isOverElement ) { 16163 return false;
vendor: 8,518 bytes, lines 16164-16438
16164 } 16165 16166 verticalDirection = this.dragDirection.vertical; 16167 horizontalDirection = this.dragDirection.horizontal; 16168 16169 return this.floating ? 16170 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 16171 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 16172 16173 }, 16174 16175 _intersectsWithSides: function( item ) { 16176 16177 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 16178 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 16179 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 16180 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 16181 verticalDirection = this.dragDirection.vertical, 16182 horizontalDirection = this.dragDirection.horizontal; 16183 16184 if ( this.floating && horizontalDirection ) { 16185 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 16186 ( horizontalDirection === "left" && !isOverRightHalf ) ); 16187 } else { 16188 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 16189 ( verticalDirection === "up" && !isOverBottomHalf ) ); 16190 } 16191 16192 }, 16193 16194 _getDragVerticalDirection: function() { 16195 var delta = this.positionAbs.top - this.lastPositionAbs.top; 16196 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 16197 }, 16198 16199 _getDragHorizontalDirection: function() { 16200 var delta = this.positionAbs.left - this.lastPositionAbs.left; 16201 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 16202 }, 16203 16204 refresh: function( event ) { 16205 this._refreshItems( event ); 16206 this._setHandleClassName(); 16207 this.refreshPositions(); 16208 return this; 16209 }, 16210 16211 _connectWith: function() { 16212 var options = this.options; 16213 return options.connectWith.constructor === String ? 16214 [ options.connectWith ] : 16215 options.connectWith; 16216 }, 16217 16218 _getItemsAsjQuery: function( connected ) { 16219 16220 var i, j, cur, inst, 16221 items = [], 16222 queries = [], 16223 connectWith = this._connectWith(); 16224 16225 if ( connectWith && connected ) { 16226 for ( i = connectWith.length - 1; i >= 0; i-- ) { 16227 cur = $( connectWith[ i ], this.document[ 0 ] ); 16228 for ( j = cur.length - 1; j >= 0; j-- ) { 16229 inst = $.data( cur[ j ], this.widgetFullName ); 16230 if ( inst && inst !== this && !inst.options.disabled ) { 16231 queries.push( [ typeof inst.options.items === "function" ? 16232 inst.options.items.call( inst.element ) : 16233 $( inst.options.items, inst.element ) 16234 .not( ".ui-sortable-helper" ) 16235 .not( ".ui-sortable-placeholder" ), inst ] ); 16236 } 16237 } 16238 } 16239 } 16240 16241 queries.push( [ typeof this.options.items === "function" ? 16242 this.options.items 16243 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 16244 $( this.options.items, this.element ) 16245 .not( ".ui-sortable-helper" ) 16246 .not( ".ui-sortable-placeholder" ), this ] ); 16247 16248 function addItems() { 16249 items.push( this ); 16250 } 16251 for ( i = queries.length - 1; i >= 0; i-- ) { 16252 queries[ i ][ 0 ].each( addItems ); 16253 } 16254 16255 return $( items ); 16256 16257 }, 16258 16259 _removeCurrentsFromItems: function() { 16260 16261 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 16262 16263 this.items = $.grep( this.items, function( item ) { 16264 for ( var j = 0; j < list.length; j++ ) { 16265 if ( list[ j ] === item.item[ 0 ] ) { 16266 return false; 16267 } 16268 } 16269 return true; 16270 } ); 16271 16272 }, 16273 16274 _refreshItems: function( event ) { 16275 16276 this.items = []; 16277 this.containers = [ this ]; 16278 16279 var i, j, cur, inst, targetData, _queries, item, queriesLength, 16280 items = this.items, 16281 queries = [ [ typeof this.options.items === "function" ? 16282 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 16283 $( this.options.items, this.element ), this ] ], 16284 connectWith = this._connectWith(); 16285 16286 //Shouldn't be run the first time through due to massive slow-down 16287 if ( connectWith && this.ready ) { 16288 for ( i = connectWith.length - 1; i >= 0; i-- ) { 16289 cur = $( connectWith[ i ], this.document[ 0 ] ); 16290 for ( j = cur.length - 1; j >= 0; j-- ) { 16291 inst = $.data( cur[ j ], this.widgetFullName ); 16292 if ( inst && inst !== this && !inst.options.disabled ) { 16293 queries.push( [ typeof inst.options.items === "function" ? 16294 inst.options.items 16295 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 16296 $( inst.options.items, inst.element ), inst ] ); 16297 this.containers.push( inst ); 16298 } 16299 } 16300 } 16301 } 16302 16303 for ( i = queries.length - 1; i >= 0; i-- ) { 16304 targetData = queries[ i ][ 1 ]; 16305 _queries = queries[ i ][ 0 ]; 16306 16307 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 16308 item = $( _queries[ j ] ); 16309 16310 // Data for target checking (mouse manager) 16311 item.data( this.widgetName + "-item", targetData ); 16312 16313 items.push( { 16314 item: item, 16315 instance: targetData, 16316 width: 0, height: 0, 16317 left: 0, top: 0 16318 } ); 16319 } 16320 } 16321 16322 }, 16323 16324 _refreshItemPositions: function( fast ) { 16325 var i, item, t, p; 16326 16327 for ( i = this.items.length - 1; i >= 0; i-- ) { 16328 item = this.items[ i ]; 16329 16330 //We ignore calculating positions of all connected containers when we're not over them 16331 if ( this.currentContainer && item.instance !== this.currentContainer && 16332 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 16333 continue; 16334 } 16335 16336 t = this.options.toleranceElement ? 16337 $( this.options.toleranceElement, item.item ) : 16338 item.item; 16339 16340 if ( !fast ) { 16341 item.width = t.outerWidth(); 16342 item.height = t.outerHeight(); 16343 } 16344 16345 p = t.offset(); 16346 item.left = p.left; 16347 item.top = p.top; 16348 } 16349 }, 16350 16351 refreshPositions: function( fast ) { 16352 16353 // Determine whether items are being displayed horizontally 16354 this.floating = this.items.length ? 16355 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 16356 false; 16357 16358 // This has to be redone because due to the item being moved out/into the offsetParent, 16359 // the offsetParent's position will change 16360 if ( this.offsetParent && this.helper ) { 16361 this.offset.parent = this._getParentOffset(); 16362 } 16363 16364 this._refreshItemPositions( fast ); 16365 16366 var i, p; 16367 16368 if ( this.options.custom && this.options.custom.refreshContainers ) { 16369 this.options.custom.refreshContainers.call( this ); 16370 } else { 16371 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16372 p = this.containers[ i ].element.offset(); 16373 this.containers[ i ].containerCache.left = p.left; 16374 this.containers[ i ].containerCache.top = p.top; 16375 this.containers[ i ].containerCache.width = 16376 this.containers[ i ].element.outerWidth(); 16377 this.containers[ i ].containerCache.height = 16378 this.containers[ i ].element.outerHeight(); 16379 } 16380 } 16381 16382 return this; 16383 }, 16384 16385 _createPlaceholder: function( that ) { 16386 that = that || this; 16387 var className, nodeName, 16388 o = that.options; 16389 16390 if ( !o.placeholder || o.placeholder.constructor === String ) { 16391 className = o.placeholder; 16392 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 16393 o.placeholder = { 16394 element: function() { 16395 16396 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 16397 16398 that._addClass( element, "ui-sortable-placeholder", 16399 className || that.currentItem[ 0 ].className ) 16400 ._removeClass( element, "ui-sortable-helper" ); 16401 16402 if ( nodeName === "tbody" ) { 16403 that._createTrPlaceholder( 16404 that.currentItem.find( "tr" ).eq( 0 ), 16405 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 16406 ); 16407 } else if ( nodeName === "tr" ) { 16408 that._createTrPlaceholder( that.currentItem, element ); 16409 } else if ( nodeName === "img" ) { 16410 element.attr( "src", that.currentItem.attr( "src" ) ); 16411 } 16412 16413 if ( !className ) { 16414 element.css( "visibility", "hidden" ); 16415 } 16416 16417 return element; 16418 }, 16419 update: function( container, p ) { 16420 16421 // 1. If a className is set as 'placeholder option, we don't force sizes - 16422 // the class is responsible for that 16423 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 16424 // class name is specified 16425 if ( className && !o.forcePlaceholderSize ) { 16426 return; 16427 } 16428 16429 // If the element doesn't have a actual height or width by itself (without 16430 // styles coming from a stylesheet), it receives the inline height and width 16431 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 16432 // anyway since we're populating them with <td>s above, but they're unlikely to 16433 // be the correct height on their own if the row heights are dynamic, so we'll 16434 // always assign the height of the dragged item given forcePlaceholderSize 16435 // is true. 16436 if ( !p.height() || ( o.forcePlaceholderSize && 16437 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 16438 p.height(
vendor: 10,145 bytes, lines 16439-16746
16439 that.currentItem.innerHeight() - 16440 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 16441 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 16442 } 16443 if ( !p.width() ) { 16444 p.width( 16445 that.currentItem.innerWidth() - 16446 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 16447 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 16448 } 16449 } 16450 }; 16451 } 16452 16453 //Create the placeholder 16454 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 16455 16456 //Append it after the actual current item 16457 that.currentItem.after( that.placeholder ); 16458 16459 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 16460 o.placeholder.update( that, that.placeholder ); 16461 16462 }, 16463 16464 _createTrPlaceholder: function( sourceTr, targetTr ) { 16465 var that = this; 16466 16467 sourceTr.children().each( function() { 16468 $( "<td> </td>", that.document[ 0 ] ) 16469 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 16470 .appendTo( targetTr ); 16471 } ); 16472 }, 16473 16474 _contactContainers: function( event ) { 16475 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 16476 floating, axis, 16477 innermostContainer = null, 16478 innermostIndex = null; 16479 16480 // Get innermost container that intersects with item 16481 for ( i = this.containers.length - 1; i >= 0; i-- ) { 16482 16483 // Never consider a container that's located within the item itself 16484 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 16485 continue; 16486 } 16487 16488 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 16489 16490 // If we've already found a container and it's more "inner" than this, then continue 16491 if ( innermostContainer && 16492 $.contains( 16493 this.containers[ i ].element[ 0 ], 16494 innermostContainer.element[ 0 ] ) ) { 16495 continue; 16496 } 16497 16498 innermostContainer = this.containers[ i ]; 16499 innermostIndex = i; 16500 16501 } else { 16502 16503 // container doesn't intersect. trigger "out" event if necessary 16504 if ( this.containers[ i ].containerCache.over ) { 16505 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 16506 this.containers[ i ].containerCache.over = 0; 16507 } 16508 } 16509 16510 } 16511 16512 // If no intersecting containers found, return 16513 if ( !innermostContainer ) { 16514 return; 16515 } 16516 16517 // Move the item into the container if it's not there already 16518 if ( this.containers.length === 1 ) { 16519 if ( !this.containers[ innermostIndex ].containerCache.over ) { 16520 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 16521 this.containers[ innermostIndex ].containerCache.over = 1; 16522 } 16523 } else { 16524 16525 // When entering a new container, we will find the item with the least distance and 16526 // append our item near it 16527 dist = 10000; 16528 itemWithLeastDistance = null; 16529 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 16530 posProperty = floating ? "left" : "top"; 16531 sizeProperty = floating ? "width" : "height"; 16532 axis = floating ? "pageX" : "pageY"; 16533 16534 for ( j = this.items.length - 1; j >= 0; j-- ) { 16535 if ( !$.contains( 16536 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 16537 ) { 16538 continue; 16539 } 16540 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 16541 continue; 16542 } 16543 16544 cur = this.items[ j ].item.offset()[ posProperty ]; 16545 nearBottom = false; 16546 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 16547 nearBottom = true; 16548 } 16549 16550 if ( Math.abs( event[ axis ] - cur ) < dist ) { 16551 dist = Math.abs( event[ axis ] - cur ); 16552 itemWithLeastDistance = this.items[ j ]; 16553 this.direction = nearBottom ? "up" : "down"; 16554 } 16555 } 16556 16557 //Check if dropOnEmpty is enabled 16558 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 16559 return; 16560 } 16561 16562 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 16563 if ( !this.currentContainer.containerCache.over ) { 16564 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 16565 this.currentContainer.containerCache.over = 1; 16566 } 16567 return; 16568 } 16569 16570 if ( itemWithLeastDistance ) { 16571 this._rearrange( event, itemWithLeastDistance, null, true ); 16572 } else { 16573 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 16574 } 16575 this._trigger( "change", event, this._uiHash() ); 16576 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 16577 this.currentContainer = this.containers[ innermostIndex ]; 16578 16579 //Update the placeholder 16580 this.options.placeholder.update( this.currentContainer, this.placeholder ); 16581 16582 //Update scrollParent 16583 this.scrollParent = this.placeholder.scrollParent(); 16584 16585 //Update overflowOffset 16586 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16587 this.scrollParent[ 0 ].tagName !== "HTML" ) { 16588 this.overflowOffset = this.scrollParent.offset(); 16589 } 16590 16591 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 16592 this.containers[ innermostIndex ].containerCache.over = 1; 16593 } 16594 16595 }, 16596 16597 _createHelper: function( event ) { 16598 16599 var o = this.options, 16600 helper = typeof o.helper === "function" ? 16601 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 16602 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 16603 16604 //Add the helper to the DOM if that didn't happen already 16605 if ( !helper.parents( "body" ).length ) { 16606 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 16607 } 16608 16609 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 16610 this._storedCSS = { 16611 width: this.currentItem[ 0 ].style.width, 16612 height: this.currentItem[ 0 ].style.height, 16613 position: this.currentItem.css( "position" ), 16614 top: this.currentItem.css( "top" ), 16615 left: this.currentItem.css( "left" ) 16616 }; 16617 } 16618 16619 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 16620 helper.width( this.currentItem.width() ); 16621 } 16622 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 16623 helper.height( this.currentItem.height() ); 16624 } 16625 16626 return helper; 16627 16628 }, 16629 16630 _adjustOffsetFromHelper: function( obj ) { 16631 if ( typeof obj === "string" ) { 16632 obj = obj.split( " " ); 16633 } 16634 if ( Array.isArray( obj ) ) { 16635 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 16636 } 16637 if ( "left" in obj ) { 16638 this.offset.click.left = obj.left + this.margins.left; 16639 } 16640 if ( "right" in obj ) { 16641 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 16642 } 16643 if ( "top" in obj ) { 16644 this.offset.click.top = obj.top + this.margins.top; 16645 } 16646 if ( "bottom" in obj ) { 16647 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 16648 } 16649 }, 16650 16651 _getParentOffset: function() { 16652 16653 //Get the offsetParent and cache its position 16654 this.offsetParent = this.helper.offsetParent(); 16655 var po = this.offsetParent.offset(); 16656 16657 // This is a special case where we need to modify a offset calculated on start, since the 16658 // following happened: 16659 // 1. The position of the helper is absolute, so it's position is calculated based on the 16660 // next positioned parent 16661 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 16662 // the document, which means that the scroll is included in the initial calculation of the 16663 // offset of the parent, and never recalculated upon drag 16664 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 16665 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 16666 po.left += this.scrollParent.scrollLeft(); 16667 po.top += this.scrollParent.scrollTop(); 16668 } 16669 16670 // This needs to be actually done for all browsers, since pageX/pageY includes this 16671 // information with an ugly IE fix 16672 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body || 16673 ( this.offsetParent[ 0 ].tagName && 16674 this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) { 16675 po = { top: 0, left: 0 }; 16676 } 16677 16678 return { 16679 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 16680 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 16681 }; 16682 16683 }, 16684 16685 _getRelativeOffset: function() { 16686 16687 if ( this.cssPosition === "relative" ) { 16688 var p = this.currentItem.position(); 16689 return { 16690 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 16691 this.scrollParent.scrollTop(), 16692 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 16693 this.scrollParent.scrollLeft() 16694 }; 16695 } else { 16696 return { top: 0, left: 0 }; 16697 } 16698 16699 }, 16700 16701 _cacheMargins: function() { 16702 this.margins = { 16703 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 16704 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 16705 }; 16706 }, 16707 16708 _cacheHelperProportions: function() { 16709 this.helperProportions = { 16710 width: this.helper.outerWidth(), 16711 height: this.helper.outerHeight() 16712 }; 16713 }, 16714 16715 _setContainment: function() { 16716 16717 var ce, co, over, 16718 o = this.options; 16719 if ( o.containment === "parent" ) { 16720 o.containment = this.helper[ 0 ].parentNode; 16721 } 16722 if ( o.containment === "document" || o.containment === "window" ) { 16723 this.containment = [ 16724 0 - this.offset.relative.left - this.offset.parent.left, 16725 0 - this.offset.relative.top - this.offset.parent.top, 16726 o.containment === "document" ? 16727 this.document.width() : 16728 this.window.width() - this.helperProportions.width - this.margins.left, 16729 ( o.containment === "document" ? 16730 ( this.document.height() || document.body.parentNode.scrollHeight ) : 16731 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 16732 ) - this.helperProportions.height - this.margins.top 16733 ]; 16734 } 16735 16736 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 16737 ce = $( o.containment )[ 0 ]; 16738 co = $( o.containment ).offset(); 16739 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 16740 16741 this.containment = [ 16742 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 16743 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 16744 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 16745 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 16746 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth )
vendor: 1,747 bytes, lines 16746-16798
16746: ce.offsetWidth ) - 16747 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 16748 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 16749 this.helperProportions.width - this.margins.left, 16750 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 16751 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 16752 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 16753 this.helperProportions.height - this.margins.top 16754 ]; 16755 } 16756 16757 }, 16758 16759 _convertPositionTo: function( d, pos ) { 16760 16761 if ( !pos ) { 16762 pos = this.position; 16763 } 16764 var mod = d === "absolute" ? 1 : -1, 16765 scroll = this.cssPosition === "absolute" && 16766 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16767 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 16768 this.offsetParent : 16769 this.scrollParent, 16770 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 16771 16772 return { 16773 top: ( 16774 16775 // The absolute mouse position 16776 pos.top + 16777 16778 // Only for relative positioned nodes: Relative offset from element to offset parent 16779 this.offset.relative.top * mod + 16780 16781 // The offsetParent's offset without borders (offset + border) 16782 this.offset.parent.top * mod - 16783 ( ( this.cssPosition === "fixed" ? 16784 -this.scrollParent.scrollTop() : 16785 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 16786 ), 16787 left: ( 16788 16789 // The absolute mouse position 16790 pos.left + 16791 16792 // Only for relative positioned nodes: Relative offset from element to offset parent 16793 this.offset.relative.left * mod + 16794 16795 // The offsetParent's offset without borders (offset + border) 16796 this.offset.parent.left * mod - 16797 ( ( this.cssPosition === "fixed" ? 16798 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 4,632 bytes, lines 16799-16942
16799 scroll.scrollLeft() ) * mod ) 16800 ) 16801 }; 16802 16803 }, 16804 16805 _generatePosition: function( event ) { 16806 16807 var top, left, 16808 o = this.options, 16809 pageX = event.pageX, 16810 pageY = event.pageY, 16811 scroll = this.cssPosition === "absolute" && 16812 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16813 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 16814 this.offsetParent : 16815 this.scrollParent, 16816 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 16817 16818 // This is another very weird special case that only happens for relative elements: 16819 // 1. If the css position is relative 16820 // 2. and the scroll parent is the document or similar to the offset parent 16821 // we have to refresh the relative offset during the scroll so there are no jumps 16822 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 16823 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 16824 this.offset.relative = this._getRelativeOffset(); 16825 } 16826 16827 /* 16828 * - Position constraining - 16829 * Constrain the position to a mix of grid, containment. 16830 */ 16831 16832 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 16833 16834 if ( this.containment ) { 16835 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 16836 pageX = this.containment[ 0 ] + this.offset.click.left; 16837 } 16838 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 16839 pageY = this.containment[ 1 ] + this.offset.click.top; 16840 } 16841 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 16842 pageX = this.containment[ 2 ] + this.offset.click.left; 16843 } 16844 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 16845 pageY = this.containment[ 3 ] + this.offset.click.top; 16846 } 16847 } 16848 16849 if ( o.grid ) { 16850 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 16851 o.grid[ 1 ] ) * o.grid[ 1 ]; 16852 pageY = this.containment ? 16853 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 16854 top - this.offset.click.top <= this.containment[ 3 ] ) ? 16855 top : 16856 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 16857 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 16858 top; 16859 16860 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 16861 o.grid[ 0 ] ) * o.grid[ 0 ]; 16862 pageX = this.containment ? 16863 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 16864 left - this.offset.click.left <= this.containment[ 2 ] ) ? 16865 left : 16866 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 16867 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 16868 left; 16869 } 16870 16871 } 16872 16873 return { 16874 top: ( 16875 16876 // The absolute mouse position 16877 pageY - 16878 16879 // Click offset (relative to the element) 16880 this.offset.click.top - 16881 16882 // Only for relative positioned nodes: Relative offset from element to offset parent 16883 this.offset.relative.top - 16884 16885 // The offsetParent's offset without borders (offset + border) 16886 this.offset.parent.top + 16887 ( ( this.cssPosition === "fixed" ? 16888 -this.scrollParent.scrollTop() : 16889 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 16890 ), 16891 left: ( 16892 16893 // The absolute mouse position 16894 pageX - 16895 16896 // Click offset (relative to the element) 16897 this.offset.click.left - 16898 16899 // Only for relative positioned nodes: Relative offset from element to offset parent 16900 this.offset.relative.left - 16901 16902 // The offsetParent's offset without borders (offset + border) 16903 this.offset.parent.left + 16904 ( ( this.cssPosition === "fixed" ? 16905 -this.scrollParent.scrollLeft() : 16906 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 16907 ) 16908 }; 16909 16910 }, 16911 16912 _rearrange: function( event, i, a, hardRefresh ) { 16913 16914 if ( a ) { 16915 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 16916 } else { 16917 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 16918 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 16919 } 16920 16921 //Various things done here to improve the performance: 16922 // 1. we create a setTimeout, that calls refreshPositions 16923 // 2. on the instance, we have a counter variable, that get's higher after every append 16924 // 3. on the local scope, we copy the counter variable, and check in the timeout, 16925 // if it's still the same 16926 // 4. this lets only the last addition to the timeout stack through 16927 this.counter = this.counter ? ++this.counter : 1; 16928 var counter = this.counter; 16929 16930 this._delay( function() { 16931 if ( counter === this.counter ) { 16932 16933 //Precompute after each DOM insertion, NOT on mousemove 16934 this.refreshPositions( !hardRefresh ); 16935 } 16936 } ); 16937 16938 }, 16939 16940 _clear: function( event, noPropagation ) { 16941 16942 this.reverting = false;
vendor: 4,281 bytes, lines 16943-17087
16943 16944 // We delay all events that have to be triggered to after the point where the placeholder 16945 // has been removed and everything else normalized again 16946 var i, 16947 delayedTriggers = []; 16948 16949 // We first have to update the dom position of the actual currentItem 16950 // Note: don't do it if the current item is already removed (by a user), or it gets 16951 // reappended (see #4088) 16952 if ( !this._noFinalSort && this.currentItem.parent().length ) { 16953 this.placeholder.before( this.currentItem ); 16954 } 16955 this._noFinalSort = null; 16956 16957 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 16958 for ( i in this._storedCSS ) { 16959 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 16960 this._storedCSS[ i ] = ""; 16961 } 16962 } 16963 this.currentItem.css( this._storedCSS ); 16964 this._removeClass( this.currentItem, "ui-sortable-helper" ); 16965 } else { 16966 this.currentItem.show(); 16967 } 16968 16969 if ( this.fromOutside && !noPropagation ) { 16970 delayedTriggers.push( function( event ) { 16971 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 16972 } ); 16973 } 16974 if ( ( this.fromOutside || 16975 this.domPosition.prev !== 16976 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 16977 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 16978 16979 // Trigger update callback if the DOM position has changed 16980 delayedTriggers.push( function( event ) { 16981 this._trigger( "update", event, this._uiHash() ); 16982 } ); 16983 } 16984 16985 // Check if the items Container has Changed and trigger appropriate 16986 // events. 16987 if ( this !== this.currentContainer ) { 16988 if ( !noPropagation ) { 16989 delayedTriggers.push( function( event ) { 16990 this._trigger( "remove", event, this._uiHash() ); 16991 } ); 16992 delayedTriggers.push( ( function( c ) { 16993 return function( event ) { 16994 c._trigger( "receive", event, this._uiHash( this ) ); 16995 }; 16996 } ).call( this, this.currentContainer ) ); 16997 delayedTriggers.push( ( function( c ) { 16998 return function( event ) { 16999 c._trigger( "update", event, this._uiHash( this ) ); 17000 }; 17001 } ).call( this, this.currentContainer ) ); 17002 } 17003 } 17004 17005 //Post events to containers 17006 function delayEvent( type, instance, container ) { 17007 return function( event ) { 17008 container._trigger( type, event, instance._uiHash( instance ) ); 17009 }; 17010 } 17011 for ( i = this.containers.length - 1; i >= 0; i-- ) { 17012 if ( !noPropagation ) { 17013 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 17014 } 17015 if ( this.containers[ i ].containerCache.over ) { 17016 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 17017 this.containers[ i ].containerCache.over = 0; 17018 } 17019 } 17020 17021 //Do what was originally in plugins 17022 if ( this.storedCursor ) { 17023 this.document.find( "body" ).css( "cursor", this.storedCursor ); 17024 this.storedStylesheet.remove(); 17025 } 17026 if ( this._storedOpacity ) { 17027 this.helper.css( "opacity", this._storedOpacity ); 17028 } 17029 if ( this._storedZIndex ) { 17030 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 17031 } 17032 17033 this.dragging = false; 17034 17035 if ( !noPropagation ) { 17036 this._trigger( "beforeStop", event, this._uiHash() ); 17037 } 17038 17039 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 17040 // it unbinds ALL events from the original node! 17041 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 17042 17043 if ( !this.cancelHelperRemoval ) { 17044 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 17045 this.helper.remove(); 17046 } 17047 this.helper = null; 17048 } 17049 17050 if ( !noPropagation ) { 17051 for ( i = 0; i < delayedTriggers.length; i++ ) { 17052 17053 // Trigger all delayed events 17054 delayedTriggers[ i ].call( this, event ); 17055 } 17056 this._trigger( "stop", event, this._uiHash() ); 17057 } 17058 17059 this.fromOutside = false; 17060 return !this.cancelHelperRemoval; 17061 17062 }, 17063 17064 _trigger: function() { 17065 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 17066 this.cancel(); 17067 } 17068 }, 17069 17070 _uiHash: function( _inst ) { 17071 var inst = _inst || this; 17072 return { 17073 helper: inst.helper, 17074 placeholder: inst.placeholder || $( [] ), 17075 position: inst.position, 17076 originalPosition: inst.originalPosition, 17077 offset: inst.positionAbs, 17078 item: inst.currentItem, 17079 sender: _inst ? _inst.element : null 17080 }; 17081 } 17082 17083} ); 17084 17085 17086/*! 17087 * jQuery UI Spinner 1.1
170873.2 17088 * http://jqueryui.com 17089 * 17090 * Copyright jQuery Foundation and other contributors 17091 * Released under the MIT license. 17092 * http://jquery.org/license 17093 */ 17094 17095//>>label: Spinner 17096//>>group: Widgets 17097//>>description: Displays buttons to easily input numbers via the keyboard or mouse. 17098//>>docs: http://api.jqueryui.com/spinner/ 17099//>>demos: http://jqueryui.com/spinner/ 17100//>>css.structure: ../../themes/base/core.css 17101//>>css.structure: ../../themes/base/spinner.css 17102//>>css.theme: ../../themes/base/theme.css 17103 17104 17105function spinnerModifier( fn ) { 17106 return function() { 17107 var previous = this.element.val(); 17108 fn.apply( this, arguments ); 17109 this._refresh(); 17110 if ( previous !== this.element.val() ) { 17111 this._trigger( "change" ); 17112 } 17113 }; 17114} 17115 17116$.widget( "ui.spinner", { 17117 version: "1.13.2
vendor: 13,310 bytes, lines 17117-17648
17117", 17118 defaultElement: "<input>", 17119 widgetEventPrefix: "spin", 17120 options: { 17121 classes: { 17122 "ui-spinner": "ui-corner-all", 17123 "ui-spinner-down": "ui-corner-br", 17124 "ui-spinner-up": "ui-corner-tr" 17125 }, 17126 culture: null, 17127 icons: { 17128 down: "ui-icon-triangle-1-s", 17129 up: "ui-icon-triangle-1-n" 17130 }, 17131 incremental: true, 17132 max: null, 17133 min: null, 17134 numberFormat: null, 17135 page: 10, 17136 step: 1, 17137 17138 change: null, 17139 spin: null, 17140 start: null, 17141 stop: null 17142 }, 17143 17144 _create: function() { 17145 17146 // handle string values that need to be parsed 17147 this._setOption( "max", this.options.max ); 17148 this._setOption( "min", this.options.min ); 17149 this._setOption( "step", this.options.step ); 17150 17151 // Only format if there is a value, prevents the field from being marked 17152 // as invalid in Firefox, see #9573. 17153 if ( this.value() !== "" ) { 17154 17155 // Format the value, but don't constrain. 17156 this._value( this.element.val(), true ); 17157 } 17158 17159 this._draw(); 17160 this._on( this._events ); 17161 this._refresh(); 17162 17163 // Turning off autocomplete prevents the browser from remembering the 17164 // value when navigating through history, so we re-enable autocomplete 17165 // if the page is unloaded before the widget is destroyed. #7790 17166 this._on( this.window, { 17167 beforeunload: function() { 17168 this.element.removeAttr( "autocomplete" ); 17169 } 17170 } ); 17171 }, 17172 17173 _getCreateOptions: function() { 17174 var options = this._super(); 17175 var element = this.element; 17176 17177 $.each( [ "min", "max", "step" ], function( i, option ) { 17178 var value = element.attr( option ); 17179 if ( value != null && value.length ) { 17180 options[ option ] = value; 17181 } 17182 } ); 17183 17184 return options; 17185 }, 17186 17187 _events: { 17188 keydown: function( event ) { 17189 if ( this._start( event ) && this._keydown( event ) ) { 17190 event.preventDefault(); 17191 } 17192 }, 17193 keyup: "_stop", 17194 focus: function() { 17195 this.previous = this.element.val(); 17196 }, 17197 blur: function( event ) { 17198 if ( this.cancelBlur ) { 17199 delete this.cancelBlur; 17200 return; 17201 } 17202 17203 this._stop(); 17204 this._refresh(); 17205 if ( this.previous !== this.element.val() ) { 17206 this._trigger( "change", event ); 17207 } 17208 }, 17209 mousewheel: function( event, delta ) { 17210 var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ); 17211 var isActive = this.element[ 0 ] === activeElement; 17212 17213 if ( !isActive || !delta ) { 17214 return; 17215 } 17216 17217 if ( !this.spinning && !this._start( event ) ) { 17218 return false; 17219 } 17220 17221 this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event ); 17222 clearTimeout( this.mousewheelTimer ); 17223 this.mousewheelTimer = this._delay( function() { 17224 if ( this.spinning ) { 17225 this._stop( event ); 17226 } 17227 }, 100 ); 17228 event.preventDefault(); 17229 }, 17230 "mousedown .ui-spinner-button": function( event ) { 17231 var previous; 17232 17233 // We never want the buttons to have focus; whenever the user is 17234 // interacting with the spinner, the focus should be on the input. 17235 // If the input is focused then this.previous is properly set from 17236 // when the input first received focus. If the input is not focused 17237 // then we need to set this.previous based on the value before spinning. 17238 previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ? 17239 this.previous : this.element.val(); 17240 function checkFocus() { 17241 var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ); 17242 if ( !isActive ) { 17243 this.element.trigger( "focus" ); 17244 this.previous = previous; 17245 17246 // support: IE 17247 // IE sets focus asynchronously, so we need to check if focus 17248 // moved off of the input because the user clicked on the button. 17249 this._delay( function() { 17250 this.previous = previous; 17251 } ); 17252 } 17253 } 17254 17255 // Ensure focus is on (or stays on) the text field 17256 event.preventDefault(); 17257 checkFocus.call( this ); 17258 17259 // Support: IE 17260 // IE doesn't prevent moving focus even with event.preventDefault() 17261 // so we set a flag to know when we should ignore the blur event 17262 // and check (again) if focus moved off of the input. 17263 this.cancelBlur = true; 17264 this._delay( function() { 17265 delete this.cancelBlur; 17266 checkFocus.call( this ); 17267 } ); 17268 17269 if ( this._start( event ) === false ) { 17270 return; 17271 } 17272 17273 this._repeat( null, $( event.currentTarget ) 17274 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 17275 }, 17276 "mouseup .ui-spinner-button": "_stop", 17277 "mouseenter .ui-spinner-button": function( event ) { 17278 17279 // button will add ui-state-active if mouse was down while mouseleave and kept down 17280 if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { 17281 return; 17282 } 17283 17284 if ( this._start( event ) === false ) { 17285 return false; 17286 } 17287 this._repeat( null, $( event.currentTarget ) 17288 .hasClass( "ui-spinner-up" ) ? 1 : -1, event ); 17289 }, 17290 17291 // TODO: do we really want to consider this a stop? 17292 // shouldn't we just stop the repeater and wait until mouseup before 17293 // we trigger the stop event? 17294 "mouseleave .ui-spinner-button": "_stop" 17295 }, 17296 17297 // Support mobile enhanced option and make backcompat more sane 17298 _enhance: function() { 17299 this.uiSpinner = this.element 17300 .attr( "autocomplete", "off" ) 17301 .wrap( "<span>" ) 17302 .parent() 17303 17304 // Add buttons 17305 .append( 17306 "<a></a><a></a>" 17307 ); 17308 }, 17309 17310 _draw: function() { 17311 this._enhance(); 17312 17313 this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" ); 17314 this._addClass( "ui-spinner-input" ); 17315 17316 this.element.attr( "role", "spinbutton" ); 17317 17318 // Button bindings 17319 this.buttons = this.uiSpinner.children( "a" ) 17320 .attr( "tabIndex", -1 ) 17321 .attr( "aria-hidden", true ) 17322 .button( { 17323 classes: { 17324 "ui-button": "" 17325 } 17326 } ); 17327 17328 // TODO: Right now button does not support classes this is already updated in button PR 17329 this._removeClass( this.buttons, "ui-corner-all" ); 17330 17331 this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" ); 17332 this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" ); 17333 this.buttons.first().button( { 17334 "icon": this.options.icons.up, 17335 "showLabel": false 17336 } ); 17337 this.buttons.last().button( { 17338 "icon": this.options.icons.down, 17339 "showLabel": false 17340 } ); 17341 17342 // IE 6 doesn't understand height: 50% for the buttons 17343 // unless the wrapper has an explicit height 17344 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && 17345 this.uiSpinner.height() > 0 ) { 17346 this.uiSpinner.height( this.uiSpinner.height() ); 17347 } 17348 }, 17349 17350 _keydown: function( event ) { 17351 var options = this.options, 17352 keyCode = $.ui.keyCode; 17353 17354 switch ( event.keyCode ) { 17355 case keyCode.UP: 17356 this._repeat( null, 1, event ); 17357 return true; 17358 case keyCode.DOWN: 17359 this._repeat( null, -1, event ); 17360 return true; 17361 case keyCode.PAGE_UP: 17362 this._repeat( null, options.page, event ); 17363 return true; 17364 case keyCode.PAGE_DOWN: 17365 this._repeat( null, -options.page, event ); 17366 return true; 17367 } 17368 17369 return false; 17370 }, 17371 17372 _start: function( event ) { 17373 if ( !this.spinning && this._trigger( "start", event ) === false ) { 17374 return false; 17375 } 17376 17377 if ( !this.counter ) { 17378 this.counter = 1; 17379 } 17380 this.spinning = true; 17381 return true; 17382 }, 17383 17384 _repeat: function( i, steps, event ) { 17385 i = i || 500; 17386 17387 clearTimeout( this.timer ); 17388 this.timer = this._delay( function() { 17389 this._repeat( 40, steps, event ); 17390 }, i ); 17391 17392 this._spin( steps * this.options.step, event ); 17393 }, 17394 17395 _spin: function( step, event ) { 17396 var value = this.value() || 0; 17397 17398 if ( !this.counter ) { 17399 this.counter = 1; 17400 } 17401 17402 value = this._adjustValue( value + step * this._increment( this.counter ) ); 17403 17404 if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) { 17405 this._value( value ); 17406 this.counter++; 17407 } 17408 }, 17409 17410 _increment: function( i ) { 17411 var incremental = this.options.incremental; 17412 17413 if ( incremental ) { 17414 return typeof incremental === "function" ? 17415 incremental( i ) : 17416 Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); 17417 } 17418 17419 return 1; 17420 }, 17421 17422 _precision: function() { 17423 var precision = this._precisionOf( this.options.step ); 17424 if ( this.options.min !== null ) { 17425 precision = Math.max( precision, this._precisionOf( this.options.min ) ); 17426 } 17427 return precision; 17428 }, 17429 17430 _precisionOf: function( num ) { 17431 var str = num.toString(), 17432 decimal = str.indexOf( "." ); 17433 return decimal === -1 ? 0 : str.length - decimal - 1; 17434 }, 17435 17436 _adjustValue: function( value ) { 17437 var base, aboveMin, 17438 options = this.options; 17439 17440 // Make sure we're at a valid step 17441 // - find out where we are relative to the base (min or 0) 17442 base = options.min !== null ? options.min : 0; 17443 aboveMin = value - base; 17444 17445 // - round to the nearest step 17446 aboveMin = Math.round( aboveMin / options.step ) * options.step; 17447 17448 // - rounding is based on 0, so adjust back to our base 17449 value = base + aboveMin; 17450 17451 // Fix precision from bad JS floating point math 17452 value = parseFloat( value.toFixed( this._precision() ) ); 17453 17454 // Clamp the value 17455 if ( options.max !== null && value > options.max ) { 17456 return options.max; 17457 } 17458 if ( options.min !== null && value < options.min ) { 17459 return options.min; 17460 } 17461 17462 return value; 17463 }, 17464 17465 _stop: function( event ) { 17466 if ( !this.spinning ) { 17467 return; 17468 } 17469 17470 clearTimeout( this.timer ); 17471 clearTimeout( this.mousewheelTimer ); 17472 this.counter = 0; 17473 this.spinning = false; 17474 this._trigger( "stop", event ); 17475 }, 17476 17477 _setOption: function( key, value ) { 17478 var prevValue, first, last; 17479 17480 if ( key === "culture" || key === "numberFormat" ) { 17481 prevValue = this._parse( this.element.val() ); 17482 this.options[ key ] = value; 17483 this.element.val( this._format( prevValue ) ); 17484 return; 17485 } 17486 17487 if ( key === "max" || key === "min" || key === "step" ) { 17488 if ( typeof value === "string" ) { 17489 value = this._parse( value ); 17490 } 17491 } 17492 if ( key === "icons" ) { 17493 first = this.buttons.first().find( ".ui-icon" ); 17494 this._removeClass( first, null, this.options.icons.up ); 17495 this._addClass( first, null, value.up ); 17496 last = this.buttons.last().find( ".ui-icon" ); 17497 this._removeClass( last, null, this.options.icons.down ); 17498 this._addClass( last, null, value.down ); 17499 } 17500 17501 this._super( key, value ); 17502 }, 17503 17504 _setOptionDisabled: function( value ) { 17505 this._super( value ); 17506 17507 this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value ); 17508 this.element.prop( "disabled", !!value ); 17509 this.buttons.button( value ? "disable" : "enable" ); 17510 }, 17511 17512 _setOptions: spinnerModifier( function( options ) { 17513 this._super( options ); 17514 } ), 17515 17516 _parse: function( val ) { 17517 if ( typeof val === "string" && val !== "" ) { 17518 val = window.Globalize && this.options.numberFormat ? 17519 Globalize.parseFloat( val, 10, this.options.culture ) : +val; 17520 } 17521 return val === "" || isNaN( val ) ? null : val; 17522 }, 17523 17524 _format: function( value ) { 17525 if ( value === "" ) { 17526 return ""; 17527 } 17528 return window.Globalize && this.options.numberFormat ? 17529 Globalize.format( value, this.options.numberFormat, this.options.culture ) : 17530 value; 17531 }, 17532 17533 _refresh: function() { 17534 this.element.attr( { 17535 "aria-valuemin": this.options.min, 17536 "aria-valuemax": this.options.max, 17537 17538 // TODO: what should we do with values that can't be parsed? 17539 "aria-valuenow": this._parse( this.element.val() ) 17540 } ); 17541 }, 17542 17543 isValid: function() { 17544 var value = this.value(); 17545 17546 // Null is invalid 17547 if ( value === null ) { 17548 return false; 17549 } 17550 17551 // If value gets adjusted, it's invalid 17552 return value === this._adjustValue( value ); 17553 }, 17554 17555 // Update the value without triggering change 17556 _value: function( value, allowAny ) { 17557 var parsed; 17558 if ( value !== "" ) { 17559 parsed = this._parse( value ); 17560 if ( parsed !== null ) { 17561 if ( !allowAny ) { 17562 parsed = this._adjustValue( parsed ); 17563 } 17564 value = this._format( parsed ); 17565 } 17566 } 17567 this.element.val( value ); 17568 this._refresh(); 17569 }, 17570 17571 _destroy: function() { 17572 this.element 17573 .prop( "disabled", false ) 17574 .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" ); 17575 17576 this.uiSpinner.replaceWith( this.element ); 17577 }, 17578 17579 stepUp: spinnerModifier( function( steps ) { 17580 this._stepUp( steps ); 17581 } ), 17582 _stepUp: function( steps ) { 17583 if ( this._start() ) { 17584 this._spin( ( steps || 1 ) * this.options.step ); 17585 this._stop(); 17586 } 17587 }, 17588 17589 stepDown: spinnerModifier( function( steps ) { 17590 this._stepDown( steps ); 17591 } ), 17592 _stepDown: function( steps ) { 17593 if ( this._start() ) { 17594 this._spin( ( steps || 1 ) * -this.options.step ); 17595 this._stop(); 17596 } 17597 }, 17598 17599 pageUp: spinnerModifier( function( pages ) { 17600 this._stepUp( ( pages || 1 ) * this.options.page ); 17601 } ), 17602 17603 pageDown: spinnerModifier( function( pages ) { 17604 this._stepDown( ( pages || 1 ) * this.options.page ); 17605 } ), 17606 17607 value: function( newVal ) { 17608 if ( !arguments.length ) { 17609 return this._parse( this.element.val() ); 17610 } 17611 spinnerModifier( this._value ).call( this, newVal ); 17612 }, 17613 17614 widget: function() { 17615 return this.uiSpinner; 17616 } 17617} ); 17618 17619// DEPRECATED 17620// TODO: switch return back to widget declaration at top of file when this is removed 17621if ( $.uiBackCompat !== false ) { 17622 17623 // Backcompat for spinner html extension points 17624 $.widget( "ui.spinner", $.ui.spinner, { 17625 _enhance: function() { 17626 this.uiSpinner = this.element 17627 .attr( "autocomplete", "off" ) 17628 .wrap( this._uiSpinnerHtml() ) 17629 .parent() 17630 17631 // Add buttons 17632 .append( this._buttonHtml() ); 17633 }, 17634 _uiSpinnerHtml: function() { 17635 return "<span>"; 17636 }, 17637 17638 _buttonHtml: function() { 17639 return "<a></a><a></a>"; 17640 } 17641 } ); 17642} 17643 17644var widgetsSpinner = $.ui.spinner; 17645 17646 17647/*! 17648 * jQuery UI Tabs 1.13.
176482 17649 * http://jqueryui.com 17650 * 17651 * Copyright jQuery Foundation and other contributors 17652 * Released under the MIT license. 17653 * http://jquery.org/license 17654 */ 17655 17656//>>label: Tabs 17657//>>group: Widgets 17658//>>description: Transforms a set of container elements into a tab structure. 17659//>>docs: http://api.jqueryui.com/tabs/ 17660//>>demos: http://jqueryui.com/tabs/ 17661//>>css.structure: ../../themes/base/core.css 17662//>>css.structure: ../../themes/base/tabs.css 17663//>>css.theme: ../../themes/base/theme.css 17664 17665 17666$.widget( "ui.tabs", { 17667 version: "1.13.2
vendor: 12,261 bytes, lines 17667-18134
17667", 17668 delay: 300, 17669 options: { 17670 active: null, 17671 classes: { 17672 "ui-tabs": "ui-corner-all", 17673 "ui-tabs-nav": "ui-corner-all", 17674 "ui-tabs-panel": "ui-corner-bottom", 17675 "ui-tabs-tab": "ui-corner-top" 17676 }, 17677 collapsible: false, 17678 event: "click", 17679 heightStyle: "content", 17680 hide: null, 17681 show: null, 17682 17683 // Callbacks 17684 activate: null, 17685 beforeActivate: null, 17686 beforeLoad: null, 17687 load: null 17688 }, 17689 17690 _isLocal: ( function() { 17691 var rhash = /#.*$/; 17692 17693 return function( anchor ) { 17694 var anchorUrl, locationUrl; 17695 17696 anchorUrl = anchor.href.replace( rhash, "" ); 17697 locationUrl = location.href.replace( rhash, "" ); 17698 17699 // Decoding may throw an error if the URL isn't UTF-8 (#9518) 17700 try { 17701 anchorUrl = decodeURIComponent( anchorUrl ); 17702 } catch ( error ) {} 17703 try { 17704 locationUrl = decodeURIComponent( locationUrl ); 17705 } catch ( error ) {} 17706 17707 return anchor.hash.length > 1 && anchorUrl === locationUrl; 17708 }; 17709 } )(), 17710 17711 _create: function() { 17712 var that = this, 17713 options = this.options; 17714 17715 this.running = false; 17716 17717 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 17718 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 17719 17720 this._processTabs(); 17721 options.active = this._initialActive(); 17722 17723 // Take disabling tabs via class attribute from HTML 17724 // into account and update option properly. 17725 if ( Array.isArray( options.disabled ) ) { 17726 options.disabled = $.uniqueSort( options.disabled.concat( 17727 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 17728 return that.tabs.index( li ); 17729 } ) 17730 ) ).sort(); 17731 } 17732 17733 // Check for length avoids error when initializing empty list 17734 if ( this.options.active !== false && this.anchors.length ) { 17735 this.active = this._findActive( options.active ); 17736 } else { 17737 this.active = $(); 17738 } 17739 17740 this._refresh(); 17741 17742 if ( this.active.length ) { 17743 this.load( options.active ); 17744 } 17745 }, 17746 17747 _initialActive: function() { 17748 var active = this.options.active, 17749 collapsible = this.options.collapsible, 17750 locationHash = location.hash.substring( 1 ); 17751 17752 if ( active === null ) { 17753 17754 // check the fragment identifier in the URL 17755 if ( locationHash ) { 17756 this.tabs.each( function( i, tab ) { 17757 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 17758 active = i; 17759 return false; 17760 } 17761 } ); 17762 } 17763 17764 // Check for a tab marked active via a class 17765 if ( active === null ) { 17766 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 17767 } 17768 17769 // No active tab, set to false 17770 if ( active === null || active === -1 ) { 17771 active = this.tabs.length ? 0 : false; 17772 } 17773 } 17774 17775 // Handle numbers: negative, out of range 17776 if ( active !== false ) { 17777 active = this.tabs.index( this.tabs.eq( active ) ); 17778 if ( active === -1 ) { 17779 active = collapsible ? false : 0; 17780 } 17781 } 17782 17783 // Don't allow collapsible: false and active: false 17784 if ( !collapsible && active === false && this.anchors.length ) { 17785 active = 0; 17786 } 17787 17788 return active; 17789 }, 17790 17791 _getCreateEventData: function() { 17792 return { 17793 tab: this.active, 17794 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 17795 }; 17796 }, 17797 17798 _tabKeydown: function( event ) { 17799 var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ), 17800 selectedIndex = this.tabs.index( focusedTab ), 17801 goingForward = true; 17802 17803 if ( this._handlePageNav( event ) ) { 17804 return; 17805 } 17806 17807 switch ( event.keyCode ) { 17808 case $.ui.keyCode.RIGHT: 17809 case $.ui.keyCode.DOWN: 17810 selectedIndex++; 17811 break; 17812 case $.ui.keyCode.UP: 17813 case $.ui.keyCode.LEFT: 17814 goingForward = false; 17815 selectedIndex--; 17816 break; 17817 case $.ui.keyCode.END: 17818 selectedIndex = this.anchors.length - 1; 17819 break; 17820 case $.ui.keyCode.HOME: 17821 selectedIndex = 0; 17822 break; 17823 case $.ui.keyCode.SPACE: 17824 17825 // Activate only, no collapsing 17826 event.preventDefault(); 17827 clearTimeout( this.activating ); 17828 this._activate( selectedIndex ); 17829 return; 17830 case $.ui.keyCode.ENTER: 17831 17832 // Toggle (cancel delayed activation, allow collapsing) 17833 event.preventDefault(); 17834 clearTimeout( this.activating ); 17835 17836 // Determine if we should collapse or activate 17837 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 17838 return; 17839 default: 17840 return; 17841 } 17842 17843 // Focus the appropriate tab, based on which key was pressed 17844 event.preventDefault(); 17845 clearTimeout( this.activating ); 17846 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 17847 17848 // Navigating with control/command key will prevent automatic activation 17849 if ( !event.ctrlKey && !event.metaKey ) { 17850 17851 // Update aria-selected immediately so that AT think the tab is already selected. 17852 // Otherwise AT may confuse the user by stating that they need to activate the tab, 17853 // but the tab will already be activated by the time the announcement finishes. 17854 focusedTab.attr( "aria-selected", "false" ); 17855 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 17856 17857 this.activating = this._delay( function() { 17858 this.option( "active", selectedIndex ); 17859 }, this.delay ); 17860 } 17861 }, 17862 17863 _panelKeydown: function( event ) { 17864 if ( this._handlePageNav( event ) ) { 17865 return; 17866 } 17867 17868 // Ctrl+up moves focus to the current tab 17869 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 17870 event.preventDefault(); 17871 this.active.trigger( "focus" ); 17872 } 17873 }, 17874 17875 // Alt+page up/down moves focus to the previous/next tab (and activates) 17876 _handlePageNav: function( event ) { 17877 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 17878 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 17879 return true; 17880 } 17881 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 17882 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 17883 return true; 17884 } 17885 }, 17886 17887 _findNextTab: function( index, goingForward ) { 17888 var lastTabIndex = this.tabs.length - 1; 17889 17890 function constrain() { 17891 if ( index > lastTabIndex ) { 17892 index = 0; 17893 } 17894 if ( index < 0 ) { 17895 index = lastTabIndex; 17896 } 17897 return index; 17898 } 17899 17900 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 17901 index = goingForward ? index + 1 : index - 1; 17902 } 17903 17904 return index; 17905 }, 17906 17907 _focusNextTab: function( index, goingForward ) { 17908 index = this._findNextTab( index, goingForward ); 17909 this.tabs.eq( index ).trigger( "focus" ); 17910 return index; 17911 }, 17912 17913 _setOption: function( key, value ) { 17914 if ( key === "active" ) { 17915 17916 // _activate() will handle invalid values and update this.options 17917 this._activate( value ); 17918 return; 17919 } 17920 17921 this._super( key, value ); 17922 17923 if ( key === "collapsible" ) { 17924 this._toggleClass( "ui-tabs-collapsible", null, value ); 17925 17926 // Setting collapsible: false while collapsed; open first panel 17927 if ( !value && this.options.active === false ) { 17928 this._activate( 0 ); 17929 } 17930 } 17931 17932 if ( key === "event" ) { 17933 this._setupEvents( value ); 17934 } 17935 17936 if ( key === "heightStyle" ) { 17937 this._setupHeightStyle( value ); 17938 } 17939 }, 17940 17941 _sanitizeSelector: function( hash ) { 17942 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 17943 }, 17944 17945 refresh: function() { 17946 var options = this.options, 17947 lis = this.tablist.children( ":has(a[href])" ); 17948 17949 // Get disabled tabs from class attribute from HTML 17950 // this will get converted to a boolean if needed in _refresh() 17951 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 17952 return lis.index( tab ); 17953 } ); 17954 17955 this._processTabs(); 17956 17957 // Was collapsed or no tabs 17958 if ( options.active === false || !this.anchors.length ) { 17959 options.active = false; 17960 this.active = $(); 17961 17962 // was active, but active tab is gone 17963 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 17964 17965 // all remaining tabs are disabled 17966 if ( this.tabs.length === options.disabled.length ) { 17967 options.active = false; 17968 this.active = $(); 17969 17970 // activate previous tab 17971 } else { 17972 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 17973 } 17974 17975 // was active, active tab still exists 17976 } else { 17977 17978 // make sure active index is correct 17979 options.active = this.tabs.index( this.active ); 17980 } 17981 17982 this._refresh(); 17983 }, 17984 17985 _refresh: function() { 17986 this._setOptionDisabled( this.options.disabled ); 17987 this._setupEvents( this.options.event ); 17988 this._setupHeightStyle( this.options.heightStyle ); 17989 17990 this.tabs.not( this.active ).attr( { 17991 "aria-selected": "false", 17992 "aria-expanded": "false", 17993 tabIndex: -1 17994 } ); 17995 this.panels.not( this._getPanelForTab( this.active ) ) 17996 .hide() 17997 .attr( { 17998 "aria-hidden": "true" 17999 } ); 18000 18001 // Make sure one tab is in the tab order 18002 if ( !this.active.length ) { 18003 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 18004 } else { 18005 this.active 18006 .attr( { 18007 "aria-selected": "true", 18008 "aria-expanded": "true", 18009 tabIndex: 0 18010 } ); 18011 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 18012 this._getPanelForTab( this.active ) 18013 .show() 18014 .attr( { 18015 "aria-hidden": "false" 18016 } ); 18017 } 18018 }, 18019 18020 _processTabs: function() { 18021 var that = this, 18022 prevTabs = this.tabs, 18023 prevAnchors = this.anchors, 18024 prevPanels = this.panels; 18025 18026 this.tablist = this._getList().attr( "role", "tablist" ); 18027 this._addClass( this.tablist, "ui-tabs-nav", 18028 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 18029 18030 // Prevent users from focusing disabled tabs via click 18031 this.tablist 18032 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 18033 if ( $( this ).is( ".ui-state-disabled" ) ) { 18034 event.preventDefault(); 18035 } 18036 } ) 18037 18038 // Support: IE <9 18039 // Preventing the default action in mousedown doesn't prevent IE 18040 // from focusing the element, so if the anchor gets focused, blur. 18041 // We don't have to worry about focusing the previously focused 18042 // element since clicking on a non-focusable element should focus 18043 // the body anyway. 18044 .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() { 18045 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 18046 this.blur(); 18047 } 18048 } ); 18049 18050 this.tabs = this.tablist.find( "> li:has(a[href])" ) 18051 .attr( { 18052 role: "tab", 18053 tabIndex: -1 18054 } ); 18055 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 18056 18057 this.anchors = this.tabs.map( function() { 18058 return $( "a", this )[ 0 ]; 18059 } ) 18060 .attr( { 18061 tabIndex: -1 18062 } ); 18063 this._addClass( this.anchors, "ui-tabs-anchor" ); 18064 18065 this.panels = $(); 18066 18067 this.anchors.each( function( i, anchor ) { 18068 var selector, panel, panelId, 18069 anchorId = $( anchor ).uniqueId().attr( "id" ), 18070 tab = $( anchor ).closest( "li" ), 18071 originalAriaControls = tab.attr( "aria-controls" ); 18072 18073 // Inline tab 18074 if ( that._isLocal( anchor ) ) { 18075 selector = anchor.hash; 18076 panelId = selector.substring( 1 ); 18077 panel = that.element.find( that._sanitizeSelector( selector ) ); 18078 18079 // remote tab 18080 } else { 18081 18082 // If the tab doesn't already have aria-controls, 18083 // generate an id by using a throw-away element 18084 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 18085 selector = "#" + panelId; 18086 panel = that.element.find( selector ); 18087 if ( !panel.length ) { 18088 panel = that._createPanel( panelId ); 18089 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 18090 } 18091 panel.attr( "aria-live", "polite" ); 18092 } 18093 18094 if ( panel.length ) { 18095 that.panels = that.panels.add( panel ); 18096 } 18097 if ( originalAriaControls ) { 18098 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 18099 } 18100 tab.attr( { 18101 "aria-controls": panelId, 18102 "aria-labelledby": anchorId 18103 } ); 18104 panel.attr( "aria-labelledby", anchorId ); 18105 } ); 18106 18107 this.panels.attr( "role", "tabpanel" ); 18108 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 18109 18110 // Avoid memory leaks (#10056) 18111 if ( prevTabs ) { 18112 this._off( prevTabs.not( this.tabs ) ); 18113 this._off( prevAnchors.not( this.anchors ) ); 18114 this._off( prevPanels.not( this.panels ) ); 18115 } 18116 }, 18117 18118 // Allow overriding how to find the list for rare usage scenarios (#7715) 18119 _getList: function() { 18120 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 18121 }, 18122 18123 _createPanel: function( id ) { 18124 return $( "<div>" ) 18125 .attr( "id", id ) 18126 .data( "ui-tabs-destroy", true ); 18127 }, 18128 18129 _setOptionDisabled: function( disabled ) { 18130 var currentItem, li, i; 18131 18132 if ( Array.isArray( disabled ) ) { 18133 if ( !disabled.length ) { 18134 disabled = false;
vendor: 6,148 bytes, lines 18135-18363
18135 } else if ( disabled.length === this.anchors.length ) { 18136 disabled = true; 18137 } 18138 } 18139 18140 // Disable tabs 18141 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 18142 currentItem = $( li ); 18143 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 18144 currentItem.attr( "aria-disabled", "true" ); 18145 this._addClass( currentItem, null, "ui-state-disabled" ); 18146 } else { 18147 currentItem.removeAttr( "aria-disabled" ); 18148 this._removeClass( currentItem, null, "ui-state-disabled" ); 18149 } 18150 } 18151 18152 this.options.disabled = disabled; 18153 18154 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 18155 disabled === true ); 18156 }, 18157 18158 _setupEvents: function( event ) { 18159 var events = {}; 18160 if ( event ) { 18161 $.each( event.split( " " ), function( index, eventName ) { 18162 events[ eventName ] = "_eventHandler"; 18163 } ); 18164 } 18165 18166 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 18167 18168 // Always prevent the default action, even when disabled 18169 this._on( true, this.anchors, { 18170 click: function( event ) { 18171 event.preventDefault(); 18172 } 18173 } ); 18174 this._on( this.anchors, events ); 18175 this._on( this.tabs, { keydown: "_tabKeydown" } ); 18176 this._on( this.panels, { keydown: "_panelKeydown" } ); 18177 18178 this._focusable( this.tabs ); 18179 this._hoverable( this.tabs ); 18180 }, 18181 18182 _setupHeightStyle: function( heightStyle ) { 18183 var maxHeight, 18184 parent = this.element.parent(); 18185 18186 if ( heightStyle === "fill" ) { 18187 maxHeight = parent.height(); 18188 maxHeight -= this.element.outerHeight() - this.element.height(); 18189 18190 this.element.siblings( ":visible" ).each( function() { 18191 var elem = $( this ), 18192 position = elem.css( "position" ); 18193 18194 if ( position === "absolute" || position === "fixed" ) { 18195 return; 18196 } 18197 maxHeight -= elem.outerHeight( true ); 18198 } ); 18199 18200 this.element.children().not( this.panels ).each( function() { 18201 maxHeight -= $( this ).outerHeight( true ); 18202 } ); 18203 18204 this.panels.each( function() { 18205 $( this ).height( Math.max( 0, maxHeight - 18206 $( this ).innerHeight() + $( this ).height() ) ); 18207 } ) 18208 .css( "overflow", "auto" ); 18209 } else if ( heightStyle === "auto" ) { 18210 maxHeight = 0; 18211 this.panels.each( function() { 18212 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 18213 } ).height( maxHeight ); 18214 } 18215 }, 18216 18217 _eventHandler: function( event ) { 18218 var options = this.options, 18219 active = this.active, 18220 anchor = $( event.currentTarget ), 18221 tab = anchor.closest( "li" ), 18222 clickedIsActive = tab[ 0 ] === active[ 0 ], 18223 collapsing = clickedIsActive && options.collapsible, 18224 toShow = collapsing ? $() : this._getPanelForTab( tab ), 18225 toHide = !active.length ? $() : this._getPanelForTab( active ), 18226 eventData = { 18227 oldTab: active, 18228 oldPanel: toHide, 18229 newTab: collapsing ? $() : tab, 18230 newPanel: toShow 18231 }; 18232 18233 event.preventDefault(); 18234 18235 if ( tab.hasClass( "ui-state-disabled" ) || 18236 18237 // tab is already loading 18238 tab.hasClass( "ui-tabs-loading" ) || 18239 18240 // can't switch durning an animation 18241 this.running || 18242 18243 // click on active header, but not collapsible 18244 ( clickedIsActive && !options.collapsible ) || 18245 18246 // allow canceling activation 18247 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 18248 return; 18249 } 18250 18251 options.active = collapsing ? false : this.tabs.index( tab ); 18252 18253 this.active = clickedIsActive ? $() : tab; 18254 if ( this.xhr ) { 18255 this.xhr.abort(); 18256 } 18257 18258 if ( !toHide.length && !toShow.length ) { 18259 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 18260 } 18261 18262 if ( toShow.length ) { 18263 this.load( this.tabs.index( tab ), event ); 18264 } 18265 this._toggle( event, eventData ); 18266 }, 18267 18268 // Handles show/hide for selecting tabs 18269 _toggle: function( event, eventData ) { 18270 var that = this, 18271 toShow = eventData.newPanel, 18272 toHide = eventData.oldPanel; 18273 18274 this.running = true; 18275 18276 function complete() { 18277 that.running = false; 18278 that._trigger( "activate", event, eventData ); 18279 } 18280 18281 function show() { 18282 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 18283 18284 if ( toShow.length && that.options.show ) { 18285 that._show( toShow, that.options.show, complete ); 18286 } else { 18287 toShow.show(); 18288 complete(); 18289 } 18290 } 18291 18292 // Start out by hiding, then showing, then completing 18293 if ( toHide.length && this.options.hide ) { 18294 this._hide( toHide, this.options.hide, function() { 18295 that._removeClass( eventData.oldTab.closest( "li" ), 18296 "ui-tabs-active", "ui-state-active" ); 18297 show(); 18298 } ); 18299 } else { 18300 this._removeClass( eventData.oldTab.closest( "li" ), 18301 "ui-tabs-active", "ui-state-active" ); 18302 toHide.hide(); 18303 show(); 18304 } 18305 18306 toHide.attr( "aria-hidden", "true" ); 18307 eventData.oldTab.attr( { 18308 "aria-selected": "false", 18309 "aria-expanded": "false" 18310 } ); 18311 18312 // If we're switching tabs, remove the old tab from the tab order. 18313 // If we're opening from collapsed state, remove the previous tab from the tab order. 18314 // If we're collapsing, then keep the collapsing tab in the tab order. 18315 if ( toShow.length && toHide.length ) { 18316 eventData.oldTab.attr( "tabIndex", -1 ); 18317 } else if ( toShow.length ) { 18318 this.tabs.filter( function() { 18319 return $( this ).attr( "tabIndex" ) === 0; 18320 } ) 18321 .attr( "tabIndex", -1 ); 18322 } 18323 18324 toShow.attr( "aria-hidden", "false" ); 18325 eventData.newTab.attr( { 18326 "aria-selected": "true", 18327 "aria-expanded": "true", 18328 tabIndex: 0 18329 } ); 18330 }, 18331 18332 _activate: function( index ) { 18333 var anchor, 18334 active = this._findActive( index ); 18335 18336 // Trying to activate the already active panel 18337 if ( active[ 0 ] === this.active[ 0 ] ) { 18338 return; 18339 } 18340 18341 // Trying to collapse, simulate a click on the current active header 18342 if ( !active.length ) { 18343 active = this.active; 18344 } 18345 18346 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 18347 this._eventHandler( { 18348 target: anchor, 18349 currentTarget: anchor, 18350 preventDefault: $.noop 18351 } ); 18352 }, 18353 18354 _findActive: function( index ) { 18355 return index === false ? $() : this.tabs.eq( index ); 18356 }, 18357 18358 _getIndex: function( index ) { 18359 18360 // meta-function to give users option to provide a href string instead of a numerical index. 18361 if ( typeof index === "string" ) { 18362 index = this.anchors.index( this.anchors.filter( "[href$='" + 18363 $.
vendor: 4,911 bytes, lines 18363-18571
18363escapeSelector( index ) + "']" ) ); 18364 } 18365 18366 return index; 18367 }, 18368 18369 _destroy: function() { 18370 if ( this.xhr ) { 18371 this.xhr.abort(); 18372 } 18373 18374 this.tablist 18375 .removeAttr( "role" ) 18376 .off( this.eventNamespace ); 18377 18378 this.anchors 18379 .removeAttr( "role tabIndex" ) 18380 .removeUniqueId(); 18381 18382 this.tabs.add( this.panels ).each( function() { 18383 if ( $.data( this, "ui-tabs-destroy" ) ) { 18384 $( this ).remove(); 18385 } else { 18386 $( this ).removeAttr( "role tabIndex " + 18387 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 18388 } 18389 } ); 18390 18391 this.tabs.each( function() { 18392 var li = $( this ), 18393 prev = li.data( "ui-tabs-aria-controls" ); 18394 if ( prev ) { 18395 li 18396 .attr( "aria-controls", prev ) 18397 .removeData( "ui-tabs-aria-controls" ); 18398 } else { 18399 li.removeAttr( "aria-controls" ); 18400 } 18401 } ); 18402 18403 this.panels.show(); 18404 18405 if ( this.options.heightStyle !== "content" ) { 18406 this.panels.css( "height", "" ); 18407 } 18408 }, 18409 18410 enable: function( index ) { 18411 var disabled = this.options.disabled; 18412 if ( disabled === false ) { 18413 return; 18414 } 18415 18416 if ( index === undefined ) { 18417 disabled = false; 18418 } else { 18419 index = this._getIndex( index ); 18420 if ( Array.isArray( disabled ) ) { 18421 disabled = $.map( disabled, function( num ) { 18422 return num !== index ? num : null; 18423 } ); 18424 } else { 18425 disabled = $.map( this.tabs, function( li, num ) { 18426 return num !== index ? num : null; 18427 } ); 18428 } 18429 } 18430 this._setOptionDisabled( disabled ); 18431 }, 18432 18433 disable: function( index ) { 18434 var disabled = this.options.disabled; 18435 if ( disabled === true ) { 18436 return; 18437 } 18438 18439 if ( index === undefined ) { 18440 disabled = true; 18441 } else { 18442 index = this._getIndex( index ); 18443 if ( $.inArray( index, disabled ) !== -1 ) { 18444 return; 18445 } 18446 if ( Array.isArray( disabled ) ) { 18447 disabled = $.merge( [ index ], disabled ).sort(); 18448 } else { 18449 disabled = [ index ]; 18450 } 18451 } 18452 this._setOptionDisabled( disabled ); 18453 }, 18454 18455 load: function( index, event ) { 18456 index = this._getIndex( index ); 18457 var that = this, 18458 tab = this.tabs.eq( index ), 18459 anchor = tab.find( ".ui-tabs-anchor" ), 18460 panel = this._getPanelForTab( tab ), 18461 eventData = { 18462 tab: tab, 18463 panel: panel 18464 }, 18465 complete = function( jqXHR, status ) { 18466 if ( status === "abort" ) { 18467 that.panels.stop( false, true ); 18468 } 18469 18470 that._removeClass( tab, "ui-tabs-loading" ); 18471 panel.removeAttr( "aria-busy" ); 18472 18473 if ( jqXHR === that.xhr ) { 18474 delete that.xhr; 18475 } 18476 }; 18477 18478 // Not remote 18479 if ( this._isLocal( anchor[ 0 ] ) ) { 18480 return; 18481 } 18482 18483 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 18484 18485 // Support: jQuery <1.8 18486 // jQuery <1.8 returns false if the request is canceled in beforeSend, 18487 // but as of 1.8, $.ajax() always returns a jqXHR object. 18488 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 18489 this._addClass( tab, "ui-tabs-loading" ); 18490 panel.attr( "aria-busy", "true" ); 18491 18492 this.xhr 18493 .done( function( response, status, jqXHR ) { 18494 18495 // support: jQuery <1.8 18496 // http://bugs.jquery.com/ticket/11778 18497 setTimeout( function() { 18498 panel.html( response ); 18499 that._trigger( "load", event, eventData ); 18500 18501 complete( jqXHR, status ); 18502 }, 1 ); 18503 } ) 18504 .fail( function( jqXHR, status ) { 18505 18506 // support: jQuery <1.8 18507 // http://bugs.jquery.com/ticket/11778 18508 setTimeout( function() { 18509 complete( jqXHR, status ); 18510 }, 1 ); 18511 } ); 18512 } 18513 }, 18514 18515 _ajaxSettings: function( anchor, event, eventData ) { 18516 var that = this; 18517 return { 18518 18519 // Support: IE <11 only 18520 // Strip any hash that exists to prevent errors with the Ajax request 18521 url: anchor.attr( "href" ).replace( /#.*$/, "" ), 18522 beforeSend: function( jqXHR, settings ) { 18523 return that._trigger( "beforeLoad", event, 18524 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 18525 } 18526 }; 18527 }, 18528 18529 _getPanelForTab: function( tab ) { 18530 var id = $( tab ).attr( "aria-controls" ); 18531 return this.element.find( this._sanitizeSelector( "#" + id ) ); 18532 } 18533} ); 18534 18535// DEPRECATED 18536// TODO: Switch return back to widget declaration at top of file when this is removed 18537if ( $.uiBackCompat !== false ) { 18538 18539 // Backcompat for ui-tab class (now ui-tabs-tab) 18540 $.widget( "ui.tabs", $.ui.tabs, { 18541 _processTabs: function() { 18542 this._superApply( arguments ); 18543 this._addClass( this.tabs, "ui-tab" ); 18544 } 18545 } ); 18546} 18547 18548var widgetsTabs = $.ui.tabs; 18549 18550 18551/*! 18552 * jQuery UI Tooltip 1.13.2 18553 * http://jqueryui.com 18554 * 18555 * Copyright jQuery Foundation and other contributors 18556 * Released under the MIT license. 18557 * http://jquery.org/license 18558 */ 18559 18560//>>label: Tooltip 18561//>>group: Widgets 18562//>>description: Shows additional information for any element on hover or focus. 18563//>>docs: http://api.jqueryui.com/tooltip/ 18564//>>demos: http://jqueryui.com/tooltip/ 18565//>>css.structure: ../../themes/base/core.css 18566//>>css.structure: ../../themes/base/tooltip.css 18567//>>css.theme: ../../themes/base/theme.css 18568 18569 18570$.widget( "ui.tooltip", { 18571 version: "1.13.2
vendor: 13,567 bytes, lines 18571-19059
18571", 18572 options: { 18573 classes: { 18574 "ui-tooltip": "ui-corner-all ui-widget-shadow" 18575 }, 18576 content: function() { 18577 var title = $( this ).attr( "title" ); 18578 18579 // Escape title, since we're going from an attribute to raw HTML 18580 return $( "<a>" ).text( title ).html(); 18581 }, 18582 hide: true, 18583 18584 // Disabled elements have inconsistent behavior across browsers (#8661) 18585 items: "[title]:not([disabled])", 18586 position: { 18587 my: "left top+15", 18588 at: "left bottom", 18589 collision: "flipfit flip" 18590 }, 18591 show: true, 18592 track: false, 18593 18594 // Callbacks 18595 close: null, 18596 open: null 18597 }, 18598 18599 _addDescribedBy: function( elem, id ) { 18600 var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ); 18601 describedby.push( id ); 18602 elem 18603 .data( "ui-tooltip-id", id ) 18604 .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) ); 18605 }, 18606 18607 _removeDescribedBy: function( elem ) { 18608 var id = elem.data( "ui-tooltip-id" ), 18609 describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ), 18610 index = $.inArray( id, describedby ); 18611 18612 if ( index !== -1 ) { 18613 describedby.splice( index, 1 ); 18614 } 18615 18616 elem.removeData( "ui-tooltip-id" ); 18617 describedby = String.prototype.trim.call( describedby.join( " " ) ); 18618 if ( describedby ) { 18619 elem.attr( "aria-describedby", describedby ); 18620 } else { 18621 elem.removeAttr( "aria-describedby" ); 18622 } 18623 }, 18624 18625 _create: function() { 18626 this._on( { 18627 mouseover: "open", 18628 focusin: "open" 18629 } ); 18630 18631 // IDs of generated tooltips, needed for destroy 18632 this.tooltips = {}; 18633 18634 // IDs of parent tooltips where we removed the title attribute 18635 this.parents = {}; 18636 18637 // Append the aria-live region so tooltips announce correctly 18638 this.liveRegion = $( "<div>" ) 18639 .attr( { 18640 role: "log", 18641 "aria-live": "assertive", 18642 "aria-relevant": "additions" 18643 } ) 18644 .appendTo( this.document[ 0 ].body ); 18645 this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" ); 18646 18647 this.disabledTitles = $( [] ); 18648 }, 18649 18650 _setOption: function( key, value ) { 18651 var that = this; 18652 18653 this._super( key, value ); 18654 18655 if ( key === "content" ) { 18656 $.each( this.tooltips, function( id, tooltipData ) { 18657 that._updateContent( tooltipData.element ); 18658 } ); 18659 } 18660 }, 18661 18662 _setOptionDisabled: function( value ) { 18663 this[ value ? "_disable" : "_enable" ](); 18664 }, 18665 18666 _disable: function() { 18667 var that = this; 18668 18669 // Close open tooltips 18670 $.each( this.tooltips, function( id, tooltipData ) { 18671 var event = $.Event( "blur" ); 18672 event.target = event.currentTarget = tooltipData.element[ 0 ]; 18673 that.close( event, true ); 18674 } ); 18675 18676 // Remove title attributes to prevent native tooltips 18677 this.disabledTitles = this.disabledTitles.add( 18678 this.element.find( this.options.items ).addBack() 18679 .filter( function() { 18680 var element = $( this ); 18681 if ( element.is( "[title]" ) ) { 18682 return element 18683 .data( "ui-tooltip-title", element.attr( "title" ) ) 18684 .removeAttr( "title" ); 18685 } 18686 } ) 18687 ); 18688 }, 18689 18690 _enable: function() { 18691 18692 // restore title attributes 18693 this.disabledTitles.each( function() { 18694 var element = $( this ); 18695 if ( element.data( "ui-tooltip-title" ) ) { 18696 element.attr( "title", element.data( "ui-tooltip-title" ) ); 18697 } 18698 } ); 18699 this.disabledTitles = $( [] ); 18700 }, 18701 18702 open: function( event ) { 18703 var that = this, 18704 target = $( event ? event.target : this.element ) 18705 18706 // we need closest here due to mouseover bubbling, 18707 // but always pointing at the same event target 18708 .closest( this.options.items ); 18709 18710 // No element to show a tooltip for or the tooltip is already open 18711 if ( !target.length || target.data( "ui-tooltip-id" ) ) { 18712 return; 18713 } 18714 18715 if ( target.attr( "title" ) ) { 18716 target.data( "ui-tooltip-title", target.attr( "title" ) ); 18717 } 18718 18719 target.data( "ui-tooltip-open", true ); 18720 18721 // Kill parent tooltips, custom or native, for hover 18722 if ( event && event.type === "mouseover" ) { 18723 target.parents().each( function() { 18724 var parent = $( this ), 18725 blurEvent; 18726 if ( parent.data( "ui-tooltip-open" ) ) { 18727 blurEvent = $.Event( "blur" ); 18728 blurEvent.target = blurEvent.currentTarget = this; 18729 that.close( blurEvent, true ); 18730 } 18731 if ( parent.attr( "title" ) ) { 18732 parent.uniqueId(); 18733 that.parents[ this.id ] = { 18734 element: this, 18735 title: parent.attr( "title" ) 18736 }; 18737 parent.attr( "title", "" ); 18738 } 18739 } ); 18740 } 18741 18742 this._registerCloseHandlers( event, target ); 18743 this._updateContent( target, event ); 18744 }, 18745 18746 _updateContent: function( target, event ) { 18747 var content, 18748 contentOption = this.options.content, 18749 that = this, 18750 eventType = event ? event.type : null; 18751 18752 if ( typeof contentOption === "string" || contentOption.nodeType || 18753 contentOption.jquery ) { 18754 return this._open( event, target, contentOption ); 18755 } 18756 18757 content = contentOption.call( target[ 0 ], function( response ) { 18758 18759 // IE may instantly serve a cached response for ajax requests 18760 // delay this call to _open so the other call to _open runs first 18761 that._delay( function() { 18762 18763 // Ignore async response if tooltip was closed already 18764 if ( !target.data( "ui-tooltip-open" ) ) { 18765 return; 18766 } 18767 18768 // JQuery creates a special event for focusin when it doesn't 18769 // exist natively. To improve performance, the native event 18770 // object is reused and the type is changed. Therefore, we can't 18771 // rely on the type being correct after the event finished 18772 // bubbling, so we set it back to the previous value. (#8740) 18773 if ( event ) { 18774 event.type = eventType; 18775 } 18776 this._open( event, target, response ); 18777 } ); 18778 } ); 18779 if ( content ) { 18780 this._open( event, target, content ); 18781 } 18782 }, 18783 18784 _open: function( event, target, content ) { 18785 var tooltipData, tooltip, delayedShow, a11yContent, 18786 positionOption = $.extend( {}, this.options.position ); 18787 18788 if ( !content ) { 18789 return; 18790 } 18791 18792 // Content can be updated multiple times. If the tooltip already 18793 // exists, then just update the content and bail. 18794 tooltipData = this._find( target ); 18795 if ( tooltipData ) { 18796 tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content ); 18797 return; 18798 } 18799 18800 // If we have a title, clear it to prevent the native tooltip 18801 // we have to check first to avoid defining a title if none exists 18802 // (we don't want to cause an element to start matching [title]) 18803 // 18804 // We use removeAttr only for key events, to allow IE to export the correct 18805 // accessible attributes. For mouse events, set to empty string to avoid 18806 // native tooltip showing up (happens only when removing inside mouseover). 18807 if ( target.is( "[title]" ) ) { 18808 if ( event && event.type === "mouseover" ) { 18809 target.attr( "title", "" ); 18810 } else { 18811 target.removeAttr( "title" ); 18812 } 18813 } 18814 18815 tooltipData = this._tooltip( target ); 18816 tooltip = tooltipData.tooltip; 18817 this._addDescribedBy( target, tooltip.attr( "id" ) ); 18818 tooltip.find( ".ui-tooltip-content" ).html( content ); 18819 18820 // Support: Voiceover on OS X, JAWS on IE <= 9 18821 // JAWS announces deletions even when aria-relevant="additions" 18822 // Voiceover will sometimes re-read the entire log region's contents from the beginning 18823 this.liveRegion.children().hide(); 18824 a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() ); 18825 a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" ); 18826 a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); 18827 a11yContent.appendTo( this.liveRegion ); 18828 18829 function position( event ) { 18830 positionOption.of = event; 18831 if ( tooltip.is( ":hidden" ) ) { 18832 return; 18833 } 18834 tooltip.position( positionOption ); 18835 } 18836 if ( this.options.track && event && /^mouse/.test( event.type ) ) { 18837 this._on( this.document, { 18838 mousemove: position 18839 } ); 18840 18841 // trigger once to override element-relative positioning 18842 position( event ); 18843 } else { 18844 tooltip.position( $.extend( { 18845 of: target 18846 }, this.options.position ) ); 18847 } 18848 18849 tooltip.hide(); 18850 18851 this._show( tooltip, this.options.show ); 18852 18853 // Handle tracking tooltips that are shown with a delay (#8644). As soon 18854 // as the tooltip is visible, position the tooltip using the most recent 18855 // event. 18856 // Adds the check to add the timers only when both delay and track options are set (#14682) 18857 if ( this.options.track && this.options.show && this.options.show.delay ) { 18858 delayedShow = this.delayedShow = setInterval( function() { 18859 if ( tooltip.is( ":visible" ) ) { 18860 position( positionOption.of ); 18861 clearInterval( delayedShow ); 18862 } 18863 }, 13 ); 18864 } 18865 18866 this._trigger( "open", event, { tooltip: tooltip } ); 18867 }, 18868 18869 _registerCloseHandlers: function( event, target ) { 18870 var events = { 18871 keyup: function( event ) { 18872 if ( event.keyCode === $.ui.keyCode.ESCAPE ) { 18873 var fakeEvent = $.Event( event ); 18874 fakeEvent.currentTarget = target[ 0 ]; 18875 this.close( fakeEvent, true ); 18876 } 18877 } 18878 }; 18879 18880 // Only bind remove handler for delegated targets. Non-delegated 18881 // tooltips will handle this in destroy. 18882 if ( target[ 0 ] !== this.element[ 0 ] ) { 18883 events.remove = function() { 18884 var targetElement = this._find( target ); 18885 if ( targetElement ) { 18886 this._removeTooltip( targetElement.tooltip ); 18887 } 18888 }; 18889 } 18890 18891 if ( !event || event.type === "mouseover" ) { 18892 events.mouseleave = "close"; 18893 } 18894 if ( !event || event.type === "focusin" ) { 18895 events.focusout = "close"; 18896 } 18897 this._on( true, target, events ); 18898 }, 18899 18900 close: function( event ) { 18901 var tooltip, 18902 that = this, 18903 target = $( event ? event.currentTarget : this.element ), 18904 tooltipData = this._find( target ); 18905 18906 // The tooltip may already be closed 18907 if ( !tooltipData ) { 18908 18909 // We set ui-tooltip-open immediately upon open (in open()), but only set the 18910 // additional data once there's actually content to show (in _open()). So even if the 18911 // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in 18912 // the period between open() and _open(). 18913 target.removeData( "ui-tooltip-open" ); 18914 return; 18915 } 18916 18917 tooltip = tooltipData.tooltip; 18918 18919 // Disabling closes the tooltip, so we need to track when we're closing 18920 // to avoid an infinite loop in case the tooltip becomes disabled on close 18921 if ( tooltipData.closing ) { 18922 return; 18923 } 18924 18925 // Clear the interval for delayed tracking tooltips 18926 clearInterval( this.delayedShow ); 18927 18928 // Only set title if we had one before (see comment in _open()) 18929 // If the title attribute has changed since open(), don't restore 18930 if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { 18931 target.attr( "title", target.data( "ui-tooltip-title" ) ); 18932 } 18933 18934 this._removeDescribedBy( target ); 18935 18936 tooltipData.hiding = true; 18937 tooltip.stop( true ); 18938 this._hide( tooltip, this.options.hide, function() { 18939 that._removeTooltip( $( this ) ); 18940 } ); 18941 18942 target.removeData( "ui-tooltip-open" ); 18943 this._off( target, "mouseleave focusout keyup" ); 18944 18945 // Remove 'remove' binding only on delegated targets 18946 if ( target[ 0 ] !== this.element[ 0 ] ) { 18947 this._off( target, "remove" ); 18948 } 18949 this._off( this.document, "mousemove" ); 18950 18951 if ( event && event.type === "mouseleave" ) { 18952 $.each( this.parents, function( id, parent ) { 18953 $( parent.element ).attr( "title", parent.title ); 18954 delete that.parents[ id ]; 18955 } ); 18956 } 18957 18958 tooltipData.closing = true; 18959 this._trigger( "close", event, { tooltip: tooltip } ); 18960 if ( !tooltipData.hiding ) { 18961 tooltipData.closing = false; 18962 } 18963 }, 18964 18965 _tooltip: function( element ) { 18966 var tooltip = $( "<div>" ).attr( "role", "tooltip" ), 18967 content = $( "<div>" ).appendTo( tooltip ), 18968 id = tooltip.uniqueId().attr( "id" ); 18969 18970 this._addClass( content, "ui-tooltip-content" ); 18971 this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" ); 18972 18973 tooltip.appendTo( this._appendTo( element ) ); 18974 18975 return this.tooltips[ id ] = { 18976 element: element, 18977 tooltip: tooltip 18978 }; 18979 }, 18980 18981 _find: function( target ) { 18982 var id = target.data( "ui-tooltip-id" ); 18983 return id ? this.tooltips[ id ] : null; 18984 }, 18985 18986 _removeTooltip: function( tooltip ) { 18987 18988 // Clear the interval for delayed tracking tooltips 18989 clearInterval( this.delayedShow ); 18990 18991 tooltip.remove(); 18992 delete this.tooltips[ tooltip.attr( "id" ) ]; 18993 }, 18994 18995 _appendTo: function( target ) { 18996 var element = target.closest( ".ui-front, dialog" ); 18997 18998 if ( !element.length ) { 18999 element = this.document[ 0 ].body; 19000 } 19001 19002 return element; 19003 }, 19004 19005 _destroy: function() { 19006 var that = this; 19007 19008 // Close open tooltips 19009 $.each( this.tooltips, function( id, tooltipData ) { 19010 19011 // Delegate to close method to handle common cleanup 19012 var event = $.Event( "blur" ), 19013 element = tooltipData.element; 19014 event.target = event.currentTarget = element[ 0 ]; 19015 that.close( event, true ); 19016 19017 // Remove immediately; destroying an open tooltip doesn't use the 19018 // hide animation 19019 $( "#" + id ).remove(); 19020 19021 // Restore the title 19022 if ( element.data( "ui-tooltip-title" ) ) { 19023 19024 // If the title attribute has changed since open(), don't restore 19025 if ( !element.attr( "title" ) ) { 19026 element.attr( "title", element.data( "ui-tooltip-title" ) ); 19027 } 19028 element.removeData( "ui-tooltip-title" ); 19029 } 19030 } ); 19031 this.liveRegion.remove(); 19032 } 19033} ); 19034 19035// DEPRECATED 19036// TODO: Switch return back to widget declaration at top of file when this is removed 19037if ( $.uiBackCompat !== false ) { 19038 19039 // Backcompat for tooltipClass option 19040 $.widget( "ui.tooltip", $.ui.tooltip, { 19041 options: { 19042 tooltipClass: null 19043 }, 19044 _tooltip: function() { 19045 var tooltipData = this._superApply( arguments ); 19046 if ( this.options.tooltipClass ) { 19047 tooltipData.tooltip.addClass( this.options.tooltipClass ); 19048 } 19049 return tooltipData; 19050 } 19051 } ); 19052} 19053 19054var widgetsTooltip = $.ui.tooltip; 19055 19056 19057 19058 19059} );
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.