1/*! jQuery UI - v1.11.4 - 2016-04-25 2* http://jqueryui.com 3* Includes: core.js, widget.js, position.js, accordion.js, autocomplete.js, menu.js, tabs.js 4* Copyright
vendor: 23,323 bytes, lines 4-860
4 jQuery Foundation and other contributors; Licensed MIT */ 5 6(function( factory ) { 7 if ( typeof define === "function" && define.amd ) { 8 9 // AMD. Register as an anonymous module. 10 define([ "jquery" ], factory ); 11 } else { 12 13 // Browser globals 14 factory( jQuery ); 15 } 16}(function( $ ) { 17/*! 18 * jQuery UI Core 1.11.4 19 * http://jqueryui.com 20 * 21 * Copyright jQuery Foundation and other contributors 22 * Released under the MIT license. 23 * http://jquery.org/license 24 * 25 * http://api.jqueryui.com/category/ui-core/ 26 */ 27 28 29// $.ui might exist from components with no dependencies, e.g., $.ui.position 30$.ui = $.ui || {}; 31 32$.extend( $.ui, { 33 version: "1.11.4", 34 35 keyCode: { 36 BACKSPACE: 8, 37 COMMA: 188, 38 DELETE: 46, 39 DOWN: 40, 40 END: 35, 41 ENTER: 13, 42 ESCAPE: 27, 43 HOME: 36, 44 LEFT: 37, 45 PAGE_DOWN: 34, 46 PAGE_UP: 33, 47 PERIOD: 190, 48 RIGHT: 39, 49 SPACE: 32, 50 TAB: 9, 51 UP: 38 52 } 53}); 54 55// plugins 56$.fn.extend({ 57 scrollParent: function( includeHidden ) { 58 var position = this.css( "position" ), 59 excludeStaticParent = position === "absolute", 60 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 61 scrollParent = this.parents().filter( function() { 62 var parent = $( this ); 63 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 64 return false; 65 } 66 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); 67 }).eq( 0 ); 68 69 return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; 70 }, 71 72 uniqueId: (function() { 73 var uuid = 0; 74 75 return function() { 76 return this.each(function() { 77 if ( !this.id ) { 78 this.id = "ui-id-" + ( ++uuid ); 79 } 80 }); 81 }; 82 })(), 83 84 removeUniqueId: function() { 85 return this.each(function() { 86 if ( /^ui-id-\d+$/.test( this.id ) ) { 87 $( this ).removeAttr( "id" ); 88 } 89 }); 90 } 91}); 92 93// selectors 94function focusable( element, isTabIndexNotNaN ) { 95 var map, mapName, img, 96 nodeName = element.nodeName.toLowerCase(); 97 if ( "area" === nodeName ) { 98 map = element.parentNode; 99 mapName = map.name; 100 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 101 return false; 102 } 103 img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; 104 return !!img && visible( img ); 105 } 106 return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ? 107 !element.disabled : 108 "a" === nodeName ? 109 element.href || isTabIndexNotNaN : 110 isTabIndexNotNaN) && 111 // the element and all of its ancestors must be visible 112 visible( element ); 113} 114 115function visible( element ) { 116 return $.expr.filters.visible( element ) && 117 !$( element ).parents().addBack().filter(function() { 118 return $.css( this, "visibility" ) === "hidden"; 119 }).length; 120} 121 122$.extend( $.expr[ ":" ], { 123 data: $.expr.createPseudo ? 124 $.expr.createPseudo(function( dataName ) { 125 return function( elem ) { 126 return !!$.data( elem, dataName ); 127 }; 128 }) : 129 // support: jQuery <1.8 130 function( elem, i, match ) { 131 return !!$.data( elem, match[ 3 ] ); 132 }, 133 134 focusable: function( element ) { 135 return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); 136 }, 137 138 tabbable: function( element ) { 139 var tabIndex = $.attr( element, "tabindex" ), 140 isTabIndexNaN = isNaN( tabIndex ); 141 return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); 142 } 143}); 144 145// support: jQuery <1.8 146if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { 147 $.each( [ "Width", "Height" ], function( i, name ) { 148 var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], 149 type = name.toLowerCase(), 150 orig = { 151 innerWidth: $.fn.innerWidth, 152 innerHeight: $.fn.innerHeight, 153 outerWidth: $.fn.outerWidth, 154 outerHeight: $.fn.outerHeight 155 }; 156 157 function reduce( elem, size, border, margin ) { 158 $.each( side, function() { 159 size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; 160 if ( border ) { 161 size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; 162 } 163 if ( margin ) { 164 size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; 165 } 166 }); 167 return size; 168 } 169 170 $.fn[ "inner" + name ] = function( size ) { 171 if ( size === undefined ) { 172 return orig[ "inner" + name ].call( this ); 173 } 174 175 return this.each(function() { 176 $( this ).css( type, reduce( this, size ) + "px" ); 177 }); 178 }; 179 180 $.fn[ "outer" + name] = function( size, margin ) { 181 if ( typeof size !== "number" ) { 182 return orig[ "outer" + name ].call( this, size ); 183 } 184 185 return this.each(function() { 186 $( this).css( type, reduce( this, size, true, margin ) + "px" ); 187 }); 188 }; 189 }); 190} 191 192// support: jQuery <1.8 193if ( !$.fn.addBack ) { 194 $.fn.addBack = function( selector ) { 195 return this.add( selector == null ? 196 this.prevObject : this.prevObject.filter( selector ) 197 ); 198 }; 199} 200 201// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) 202if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { 203 $.fn.removeData = (function( removeData ) { 204 return function( key ) { 205 if ( arguments.length ) { 206 return removeData.call( this, $.camelCase( key ) ); 207 } else { 208 return removeData.call( this ); 209 } 210 }; 211 })( $.fn.removeData ); 212} 213 214// deprecated 215$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); 216 217$.fn.extend({ 218 focus: (function( orig ) { 219 return function( delay, fn ) { 220 return typeof delay === "number" ? 221 this.each(function() { 222 var elem = this; 223 setTimeout(function() { 224 $( elem ).focus(); 225 if ( fn ) { 226 fn.call( elem ); 227 } 228 }, delay ); 229 }) : 230 orig.apply( this, arguments ); 231 }; 232 })( $.fn.focus ), 233 234 disableSelection: (function() { 235 var eventType = "onselectstart" in document.createElement( "div" ) ? 236 "selectstart" : 237 "mousedown"; 238 239 return function() { 240 return this.bind( eventType + ".ui-disableSelection", function( event ) { 241 event.preventDefault(); 242 }); 243 }; 244 })(), 245 246 enableSelection: function() { 247 return this.unbind( ".ui-disableSelection" ); 248 }, 249 250 zIndex: function( zIndex ) { 251 if ( zIndex !== undefined ) { 252 return this.css( "zIndex", zIndex ); 253 } 254 255 if ( this.length ) { 256 var elem = $( this[ 0 ] ), position, value; 257 while ( elem.length && elem[ 0 ] !== document ) { 258 // Ignore z-index if position is set to a value where z-index is ignored by the browser 259 // This makes behavior of this function consistent across browsers 260 // WebKit always returns auto if the element is positioned 261 position = elem.css( "position" ); 262 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 263 // IE returns 0 when zIndex is not specified 264 // other browsers return a string 265 // we ignore the case of nested elements with an explicit value of 0 266 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 267 value = parseInt( elem.css( "zIndex" ), 10 ); 268 if ( !isNaN( value ) && value !== 0 ) { 269 return value; 270 } 271 } 272 elem = elem.parent(); 273 } 274 } 275 276 return 0; 277 } 278}); 279 280// $.ui.plugin is deprecated. Use $.widget() extensions instead. 281$.ui.plugin = { 282 add: function( module, option, set ) { 283 var i, 284 proto = $.ui[ module ].prototype; 285 for ( i in set ) { 286 proto.plugins[ i ] = proto.plugins[ i ] || []; 287 proto.plugins[ i ].push( [ option, set[ i ] ] ); 288 } 289 }, 290 call: function( instance, name, args, allowDisconnected ) { 291 var i, 292 set = instance.plugins[ name ]; 293 294 if ( !set ) { 295 return; 296 } 297 298 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 299 return; 300 } 301 302 for ( i = 0; i < set.length; i++ ) { 303 if ( instance.options[ set[ i ][ 0 ] ] ) { 304 set[ i ][ 1 ].apply( instance.element, args ); 305 } 306 } 307 } 308}; 309 310 311/*! 312 * jQuery UI Widget 1.11.4 313 * http://jqueryui.com 314 * 315 * Copyright jQuery Foundation and other contributors 316 * Released under the MIT license. 317 * http://jquery.org/license 318 * 319 * http://api.jqueryui.com/jQuery.widget/ 320 */ 321 322 323var widget_uuid = 0, 324 widget_slice = Array.prototype.slice; 325 326$.cleanData = (function( orig ) { 327 return function( elems ) { 328 var events, elem, i; 329 for ( i = 0; (elem = elems[i]) != null; i++ ) { 330 try { 331 332 // Only trigger remove when necessary to save time 333 events = $._data( elem, "events" ); 334 if ( events && events.remove ) { 335 $( elem ).triggerHandler( "remove" ); 336 } 337 338 // http://bugs.jquery.com/ticket/8235 339 } catch ( e ) {} 340 } 341 orig( elems ); 342 }; 343})( $.cleanData ); 344 345$.widget = function( name, base, prototype ) { 346 var fullName, existingConstructor, constructor, basePrototype, 347 // proxiedPrototype allows the provided prototype to remain unmodified 348 // so that it can be used as a mixin for multiple widgets (#8876) 349 proxiedPrototype = {}, 350 namespace = name.split( "." )[ 0 ]; 351 352 name = name.split( "." )[ 1 ]; 353 fullName = namespace + "-" + name; 354 355 if ( !prototype ) { 356 prototype = base; 357 base = $.Widget; 358 } 359 360 // create selector for plugin 361 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 362 return !!$.data( elem, fullName ); 363 }; 364 365 $[ namespace ] = $[ namespace ] || {}; 366 existingConstructor = $[ namespace ][ name ]; 367 constructor = $[ namespace ][ name ] = function( options, element ) { 368 // allow instantiation without "new" keyword 369 if ( !this._createWidget ) { 370 return new constructor( options, element ); 371 } 372 373 // allow instantiation without initializing for simple inheritance 374 // must use "new" keyword (the code above always passes args) 375 if ( arguments.length ) { 376 this._createWidget( options, element ); 377 } 378 }; 379 // extend with the existing constructor to carry over any static properties 380 $.extend( constructor, existingConstructor, { 381 version: prototype.version, 382 // copy the object used to create the prototype in case we need to 383 // redefine the widget later 384 _proto: $.extend( {}, prototype ), 385 // track widgets that inherit from this widget in case this widget is 386 // redefined after a widget inherits from it 387 _childConstructors: [] 388 }); 389 390 basePrototype = new base(); 391 // we need to make the options hash a property directly on the new instance 392 // otherwise we'll modify the options hash on the prototype that we're 393 // inheriting from 394 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 395 $.each( prototype, function( prop, value ) { 396 if ( !$.isFunction( value ) ) { 397 proxiedPrototype[ prop ] = value; 398 return; 399 } 400 proxiedPrototype[ prop ] = (function() { 401 var _super = function() { 402 return base.prototype[ prop ].apply( this, arguments ); 403 }, 404 _superApply = function( args ) { 405 return base.prototype[ prop ].apply( this, args ); 406 }; 407 return function() { 408 var __super = this._super, 409 __superApply = this._superApply, 410 returnValue; 411 412 this._super = _super; 413 this._superApply = _superApply; 414 415 returnValue = value.apply( this, arguments ); 416 417 this._super = __super; 418 this._superApply = __superApply; 419 420 return returnValue; 421 }; 422 })(); 423 }); 424 constructor.prototype = $.widget.extend( basePrototype, { 425 // TODO: remove support for widgetEventPrefix 426 // always use the name + a colon as the prefix, e.g., draggable:start 427 // don't prefix for widgets that aren't DOM-based 428 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 429 }, proxiedPrototype, { 430 constructor: constructor, 431 namespace: namespace, 432 widgetName: name, 433 widgetFullName: fullName 434 }); 435 436 // If this widget is being redefined then we need to find all widgets that 437 // are inheriting from it and redefine all of them so that they inherit from 438 // the new version of this widget. We're essentially trying to replace one 439 // level in the prototype chain. 440 if ( existingConstructor ) { 441 $.each( existingConstructor._childConstructors, function( i, child ) { 442 var childPrototype = child.prototype; 443 444 // redefine the child widget using the same prototype that was 445 // originally used, but inherit from the new version of the base 446 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 447 }); 448 // remove the list of existing child constructors from the old constructor 449 // so the old child constructors can be garbage collected 450 delete existingConstructor._childConstructors; 451 } else { 452 base._childConstructors.push( constructor ); 453 } 454 455 $.widget.bridge( name, constructor ); 456 457 return constructor; 458}; 459 460$.widget.extend = function( target ) { 461 var input = widget_slice.call( arguments, 1 ), 462 inputIndex = 0, 463 inputLength = input.length, 464 key, 465 value; 466 for ( ; inputIndex < inputLength; inputIndex++ ) { 467 for ( key in input[ inputIndex ] ) { 468 value = input[ inputIndex ][ key ]; 469 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 470 // Clone objects 471 if ( $.isPlainObject( value ) ) { 472 target[ key ] = $.isPlainObject( target[ key ] ) ? 473 $.widget.extend( {}, target[ key ], value ) : 474 // Don't extend strings, arrays, etc. with objects 475 $.widget.extend( {}, value ); 476 // Copy everything else by reference 477 } else { 478 target[ key ] = value; 479 } 480 } 481 } 482 } 483 return target; 484}; 485 486$.widget.bridge = function( name, object ) { 487 var fullName = object.prototype.widgetFullName || name; 488 $.fn[ name ] = function( options ) { 489 var isMethodCall = typeof options === "string", 490 args = widget_slice.call( arguments, 1 ), 491 returnValue = this; 492 493 if ( isMethodCall ) { 494 this.each(function() { 495 var methodValue, 496 instance = $.data( this, fullName ); 497 if ( options === "instance" ) { 498 returnValue = instance; 499 return false; 500 } 501 if ( !instance ) { 502 return $.error( "cannot call methods on " + name + " prior to initialization; " + 503 "attempted to call method '" + options + "'" ); 504 } 505 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 506 return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 507 } 508 methodValue = instance[ options ].apply( instance, args ); 509 if ( methodValue !== instance && methodValue !== undefined ) { 510 returnValue = methodValue && methodValue.jquery ? 511 returnValue.pushStack( methodValue.get() ) : 512 methodValue; 513 return false; 514 } 515 }); 516 } else { 517 518 // Allow multiple hashes to be passed on init 519 if ( args.length ) { 520 options = $.widget.extend.apply( null, [ options ].concat(args) ); 521 } 522 523 this.each(function() { 524 var instance = $.data( this, fullName ); 525 if ( instance ) { 526 instance.option( options || {} ); 527 if ( instance._init ) { 528 instance._init(); 529 } 530 } else { 531 $.data( this, fullName, new object( options, this ) ); 532 } 533 }); 534 } 535 536 return returnValue; 537 }; 538}; 539 540$.Widget = function( /* options, element */ ) {}; 541$.Widget._childConstructors = []; 542 543$.Widget.prototype = { 544 widgetName: "widget", 545 widgetEventPrefix: "", 546 defaultElement: "<div>", 547 options: { 548 disabled: false, 549 550 // callbacks 551 create: null 552 }, 553 _createWidget: function( options, element ) { 554 element = $( element || this.defaultElement || this )[ 0 ]; 555 this.element = $( element ); 556 this.uuid = widget_uuid++; 557 this.eventNamespace = "." + this.widgetName + this.uuid; 558 559 this.bindings = $(); 560 this.hoverable = $(); 561 this.focusable = $(); 562 563 if ( element !== this ) { 564 $.data( element, this.widgetFullName, this ); 565 this._on( true, this.element, { 566 remove: function( event ) { 567 if ( event.target === element ) { 568 this.destroy(); 569 } 570 } 571 }); 572 this.document = $( element.style ? 573 // element within the document 574 element.ownerDocument : 575 // element is window or document 576 element.document || element ); 577 this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 578 } 579 580 this.options = $.widget.extend( {}, 581 this.options, 582 this._getCreateOptions(), 583 options ); 584 585 this._create(); 586 this._trigger( "create", null, this._getCreateEventData() ); 587 this._init(); 588 }, 589 _getCreateOptions: $.noop, 590 _getCreateEventData: $.noop, 591 _create: $.noop, 592 _init: $.noop, 593 594 destroy: function() { 595 this._destroy(); 596 // we can probably remove the unbind calls in 2.0 597 // all event bindings should go through this._on() 598 this.element 599 .unbind( this.eventNamespace ) 600 .removeData( this.widgetFullName ) 601 // support: jquery <1.6.3 602 // http://bugs.jquery.com/ticket/9413 603 .removeData( $.camelCase( this.widgetFullName ) ); 604 this.widget() 605 .unbind( this.eventNamespace ) 606 .removeAttr( "aria-disabled" ) 607 .removeClass( 608 this.widgetFullName + "-disabled " + 609 "ui-state-disabled" ); 610 611 // clean up events and states 612 this.bindings.unbind( this.eventNamespace ); 613 this.hoverable.removeClass( "ui-state-hover" ); 614 this.focusable.removeClass( "ui-state-focus" ); 615 }, 616 _destroy: $.noop, 617 618 widget: function() { 619 return this.element; 620 }, 621 622 option: function( key, value ) { 623 var options = key, 624 parts, 625 curOption, 626 i; 627 628 if ( arguments.length === 0 ) { 629 // don't return a reference to the internal hash 630 return $.widget.extend( {}, this.options ); 631 } 632 633 if ( typeof key === "string" ) { 634 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 635 options = {}; 636 parts = key.split( "." ); 637 key = parts.shift(); 638 if ( parts.length ) { 639 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 640 for ( i = 0; i < parts.length - 1; i++ ) { 641 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 642 curOption = curOption[ parts[ i ] ]; 643 } 644 key = parts.pop(); 645 if ( arguments.length === 1 ) { 646 return curOption[ key ] === undefined ? null : curOption[ key ]; 647 } 648 curOption[ key ] = value; 649 } else { 650 if ( arguments.length === 1 ) { 651 return this.options[ key ] === undefined ? null : this.options[ key ]; 652 } 653 options[ key ] = value; 654 } 655 } 656 657 this._setOptions( options ); 658 659 return this; 660 }, 661 _setOptions: function( options ) { 662 var key; 663 664 for ( key in options ) { 665 this._setOption( key, options[ key ] ); 666 } 667 668 return this; 669 }, 670 _setOption: function( key, value ) { 671 this.options[ key ] = value; 672 673 if ( key === "disabled" ) { 674 this.widget() 675 .toggleClass( this.widgetFullName + "-disabled", !!value ); 676 677 // If the widget is becoming disabled, then nothing is interactive 678 if ( value ) { 679 this.hoverable.removeClass( "ui-state-hover" ); 680 this.focusable.removeClass( "ui-state-focus" ); 681 } 682 } 683 684 return this; 685 }, 686 687 enable: function() { 688 return this._setOptions({ disabled: false }); 689 }, 690 disable: function() { 691 return this._setOptions({ disabled: true }); 692 }, 693 694 _on: function( suppressDisabledCheck, element, handlers ) { 695 var delegateElement, 696 instance = this; 697 698 // no suppressDisabledCheck flag, shuffle arguments 699 if ( typeof suppressDisabledCheck !== "boolean" ) { 700 handlers = element; 701 element = suppressDisabledCheck; 702 suppressDisabledCheck = false; 703 } 704 705 // no element argument, shuffle and use this.element 706 if ( !handlers ) { 707 handlers = element; 708 element = this.element; 709 delegateElement = this.widget(); 710 } else { 711 element = delegateElement = $( element ); 712 this.bindings = this.bindings.add( element ); 713 } 714 715 $.each( handlers, function( event, handler ) { 716 function handlerProxy() { 717 // allow widgets to customize the disabled handling 718 // - disabled as an array instead of boolean 719 // - disabled class as method for disabling individual parts 720 if ( !suppressDisabledCheck && 721 ( instance.options.disabled === true || 722 $( this ).hasClass( "ui-state-disabled" ) ) ) { 723 return; 724 } 725 return ( typeof handler === "string" ? instance[ handler ] : handler ) 726 .apply( instance, arguments ); 727 } 728 729 // copy the guid so direct unbinding works 730 if ( typeof handler !== "string" ) { 731 handlerProxy.guid = handler.guid = 732 handler.guid || handlerProxy.guid || $.guid++; 733 } 734 735 var match = event.match( /^([\w:-]*)\s*(.*)$/ ), 736 eventName = match[1] + instance.eventNamespace, 737 selector = match[2]; 738 if ( selector ) { 739 delegateElement.delegate( selector, eventName, handlerProxy ); 740 } else { 741 element.bind( eventName, handlerProxy ); 742 } 743 }); 744 }, 745 746 _off: function( element, eventName ) { 747 eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + 748 this.eventNamespace; 749 element.unbind( eventName ).undelegate( eventName ); 750 751 // Clear the stack to avoid memory leaks (#10056) 752 this.bindings = $( this.bindings.not( element ).get() ); 753 this.focusable = $( this.focusable.not( element ).get() ); 754 this.hoverable = $( this.hoverable.not( element ).get() ); 755 }, 756 757 _delay: function( handler, delay ) { 758 function handlerProxy() { 759 return ( typeof handler === "string" ? instance[ handler ] : handler ) 760 .apply( instance, arguments ); 761 } 762 var instance = this; 763 return setTimeout( handlerProxy, delay || 0 ); 764 }, 765 766 _hoverable: function( element ) { 767 this.hoverable = this.hoverable.add( element ); 768 this._on( element, { 769 mouseenter: function( event ) { 770 $( event.currentTarget ).addClass( "ui-state-hover" ); 771 }, 772 mouseleave: function( event ) { 773 $( event.currentTarget ).removeClass( "ui-state-hover" ); 774 } 775 }); 776 }, 777 778 _focusable: function( element ) { 779 this.focusable = this.focusable.add( element ); 780 this._on( element, { 781 focusin: function( event ) { 782 $( event.currentTarget ).addClass( "ui-state-focus" ); 783 }, 784 focusout: function( event ) { 785 $( event.currentTarget ).removeClass( "ui-state-focus" ); 786 } 787 }); 788 }, 789 790 _trigger: function( type, event, data ) { 791 var prop, orig, 792 callback = this.options[ type ]; 793 794 data = data || {}; 795 event = $.Event( event ); 796 event.type = ( type === this.widgetEventPrefix ? 797 type : 798 this.widgetEventPrefix + type ).toLowerCase(); 799 // the original event may come from any element 800 // so we need to reset the target on the new event 801 event.target = this.element[ 0 ]; 802 803 // copy original event properties over to the new event 804 orig = event.originalEvent; 805 if ( orig ) { 806 for ( prop in orig ) { 807 if ( !( prop in event ) ) { 808 event[ prop ] = orig[ prop ]; 809 } 810 } 811 } 812 813 this.element.trigger( event, data ); 814 return !( $.isFunction( callback ) && 815 callback.apply( this.element[0], [ event ].concat( data ) ) === false || 816 event.isDefaultPrevented() ); 817 } 818}; 819 820$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 821 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 822 if ( typeof options === "string" ) { 823 options = { effect: options }; 824 } 825 var hasOptions, 826 effectName = !options ? 827 method : 828 options === true || typeof options === "number" ? 829 defaultEffect : 830 options.effect || defaultEffect; 831 options = options || {}; 832 if ( typeof options === "number" ) { 833 options = { duration: options }; 834 } 835 hasOptions = !$.isEmptyObject( options ); 836 options.complete = callback; 837 if ( options.delay ) { 838 element.delay( options.delay ); 839 } 840 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 841 element[ method ]( options ); 842 } else if ( effectName !== method && element[ effectName ] ) { 843 element[ effectName ]( options.duration, options.easing, callback ); 844 } else { 845 element.queue(function( next ) { 846 $( this )[ method ](); 847 if ( callback ) { 848 callback.call( element[ 0 ] ); 849 } 850 next(); 851 }); 852 } 853 }; 854}); 855 856var widget = $.widget; 857 858 859/*! 860 * jQuery UI
860Position 1.11.4 861 * http://jqueryui.com 862 * 863 * Copyright
vendor: 9,249 bytes, lines 863-1173
863 jQuery Foundation and other contributors 864 * Released under the MIT license. 865 * http://jquery.org/license 866 * 867 * http://api.jqueryui.com/position/ 868 */ 869 870(function() { 871 872$.ui = $.ui || {}; 873 874var cachedScrollbarWidth, supportsOffsetFractions, 875 max = Math.max, 876 abs = Math.abs, 877 round = Math.round, 878 rhorizontal = /left|center|right/, 879 rvertical = /top|center|bottom/, 880 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 881 rposition = /^\w+/, 882 rpercent = /%$/, 883 _position = $.fn.position; 884 885function getOffsets( offsets, width, height ) { 886 return [ 887 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 888 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 889 ]; 890} 891 892function parseCss( element, property ) { 893 return parseInt( $.css( element, property ), 10 ) || 0; 894} 895 896function getDimensions( elem ) { 897 var raw = elem[0]; 898 if ( raw.nodeType === 9 ) { 899 return { 900 width: elem.width(), 901 height: elem.height(), 902 offset: { top: 0, left: 0 } 903 }; 904 } 905 if ( $.isWindow( raw ) ) { 906 return { 907 width: elem.width(), 908 height: elem.height(), 909 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 910 }; 911 } 912 if ( raw.preventDefault ) { 913 return { 914 width: 0, 915 height: 0, 916 offset: { top: raw.pageY, left: raw.pageX } 917 }; 918 } 919 return { 920 width: elem.outerWidth(), 921 height: elem.outerHeight(), 922 offset: elem.offset() 923 }; 924} 925 926$.position = { 927 scrollbarWidth: function() { 928 if ( cachedScrollbarWidth !== undefined ) { 929 return cachedScrollbarWidth; 930 } 931 var w1, w2, 932 div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), 933 innerDiv = div.children()[0]; 934 935 $( "body" ).append( div ); 936 w1 = innerDiv.offsetWidth; 937 div.css( "overflow", "scroll" ); 938 939 w2 = innerDiv.offsetWidth; 940 941 if ( w1 === w2 ) { 942 w2 = div[0].clientWidth; 943 } 944 945 div.remove(); 946 947 return (cachedScrollbarWidth = w1 - w2); 948 }, 949 getScrollInfo: function( within ) { 950 var overflowX = within.isWindow || within.isDocument ? "" : 951 within.element.css( "overflow-x" ), 952 overflowY = within.isWindow || within.isDocument ? "" : 953 within.element.css( "overflow-y" ), 954 hasOverflowX = overflowX === "scroll" || 955 ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), 956 hasOverflowY = overflowY === "scroll" || 957 ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); 958 return { 959 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 960 height: hasOverflowX ? $.position.scrollbarWidth() : 0 961 }; 962 }, 963 getWithinInfo: function( element ) { 964 var withinElement = $( element || window ), 965 isWindow = $.isWindow( withinElement[0] ), 966 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; 967 return { 968 element: withinElement, 969 isWindow: isWindow, 970 isDocument: isDocument, 971 offset: withinElement.offset() || { left: 0, top: 0 }, 972 scrollLeft: withinElement.scrollLeft(), 973 scrollTop: withinElement.scrollTop(), 974 975 // support: jQuery 1.6.x 976 // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows 977 width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), 978 height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() 979 }; 980 } 981}; 982 983$.fn.position = function( options ) { 984 if ( !options || !options.of ) { 985 return _position.apply( this, arguments ); 986 } 987 988 // make a copy, we don't want to modify arguments 989 options = $.extend( {}, options ); 990 991 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 992 target = $( options.of ), 993 within = $.position.getWithinInfo( options.within ), 994 scrollInfo = $.position.getScrollInfo( within ), 995 collision = ( options.collision || "flip" ).split( " " ), 996 offsets = {}; 997 998 dimensions = getDimensions( target ); 999 if ( target[0].preventDefault ) { 1000 // force left top to allow flipping 1001 options.at = "left top"; 1002 } 1003 targetWidth = dimensions.width; 1004 targetHeight = dimensions.height; 1005 targetOffset = dimensions.offset; 1006 // clone to reuse original targetOffset later 1007 basePosition = $.extend( {}, targetOffset ); 1008 1009 // force my and at to have valid horizontal and vertical positions 1010 // if a value is missing or invalid, it will be converted to center 1011 $.each( [ "my", "at" ], function() { 1012 var pos = ( options[ this ] || "" ).split( " " ), 1013 horizontalOffset, 1014 verticalOffset; 1015 1016 if ( pos.length === 1) { 1017 pos = rhorizontal.test( pos[ 0 ] ) ? 1018 pos.concat( [ "center" ] ) : 1019 rvertical.test( pos[ 0 ] ) ? 1020 [ "center" ].concat( pos ) : 1021 [ "center", "center" ]; 1022 } 1023 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 1024 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 1025 1026 // calculate offsets 1027 horizontalOffset = roffset.exec( pos[ 0 ] ); 1028 verticalOffset = roffset.exec( pos[ 1 ] ); 1029 offsets[ this ] = [ 1030 horizontalOffset ? horizontalOffset[ 0 ] : 0, 1031 verticalOffset ? verticalOffset[ 0 ] : 0 1032 ]; 1033 1034 // reduce to just the positions without the offsets 1035 options[ this ] = [ 1036 rposition.exec( pos[ 0 ] )[ 0 ], 1037 rposition.exec( pos[ 1 ] )[ 0 ] 1038 ]; 1039 }); 1040 1041 // normalize collision option 1042 if ( collision.length === 1 ) { 1043 collision[ 1 ] = collision[ 0 ]; 1044 } 1045 1046 if ( options.at[ 0 ] === "right" ) { 1047 basePosition.left += targetWidth; 1048 } else if ( options.at[ 0 ] === "center" ) { 1049 basePosition.left += targetWidth / 2; 1050 } 1051 1052 if ( options.at[ 1 ] === "bottom" ) { 1053 basePosition.top += targetHeight; 1054 } else if ( options.at[ 1 ] === "center" ) { 1055 basePosition.top += targetHeight / 2; 1056 } 1057 1058 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 1059 basePosition.left += atOffset[ 0 ]; 1060 basePosition.top += atOffset[ 1 ]; 1061 1062 return this.each(function() { 1063 var collisionPosition, using, 1064 elem = $( this ), 1065 elemWidth = elem.outerWidth(), 1066 elemHeight = elem.outerHeight(), 1067 marginLeft = parseCss( this, "marginLeft" ), 1068 marginTop = parseCss( this, "marginTop" ), 1069 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, 1070 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, 1071 position = $.extend( {}, basePosition ), 1072 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 1073 1074 if ( options.my[ 0 ] === "right" ) { 1075 position.left -= elemWidth; 1076 } else if ( options.my[ 0 ] === "center" ) { 1077 position.left -= elemWidth / 2; 1078 } 1079 1080 if ( options.my[ 1 ] === "bottom" ) { 1081 position.top -= elemHeight; 1082 } else if ( options.my[ 1 ] === "center" ) { 1083 position.top -= elemHeight / 2; 1084 } 1085 1086 position.left += myOffset[ 0 ]; 1087 position.top += myOffset[ 1 ]; 1088 1089 // if the browser doesn't support fractions, then round for consistent results 1090 if ( !supportsOffsetFractions ) { 1091 position.left = round( position.left ); 1092 position.top = round( position.top ); 1093 } 1094 1095 collisionPosition = { 1096 marginLeft: marginLeft, 1097 marginTop: marginTop 1098 }; 1099 1100 $.each( [ "left", "top" ], function( i, dir ) { 1101 if ( $.ui.position[ collision[ i ] ] ) { 1102 $.ui.position[ collision[ i ] ][ dir ]( position, { 1103 targetWidth: targetWidth, 1104 targetHeight: targetHeight, 1105 elemWidth: elemWidth, 1106 elemHeight: elemHeight, 1107 collisionPosition: collisionPosition, 1108 collisionWidth: collisionWidth, 1109 collisionHeight: collisionHeight, 1110 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 1111 my: options.my, 1112 at: options.at, 1113 within: within, 1114 elem: elem 1115 }); 1116 } 1117 }); 1118 1119 if ( options.using ) { 1120 // adds feedback as second argument to using callback, if present 1121 using = function( props ) { 1122 var left = targetOffset.left - position.left, 1123 right = left + targetWidth - elemWidth, 1124 top = targetOffset.top - position.top, 1125 bottom = top + targetHeight - elemHeight, 1126 feedback = { 1127 target: { 1128 element: target, 1129 left: targetOffset.left, 1130 top: targetOffset.top, 1131 width: targetWidth, 1132 height: targetHeight 1133 }, 1134 element: { 1135 element: elem, 1136 left: position.left, 1137 top: position.top, 1138 width: elemWidth, 1139 height: elemHeight 1140 }, 1141 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 1142 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 1143 }; 1144 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 1145 feedback.horizontal = "center"; 1146 } 1147 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 1148 feedback.vertical = "middle"; 1149 } 1150 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 1151 feedback.important = "horizontal"; 1152 } else { 1153 feedback.important = "vertical"; 1154 } 1155 options.using.call( this, props, feedback ); 1156 }; 1157 } 1158 1159 elem.offset( $.extend( position, { using: using } ) ); 1160 }); 1161}; 1162 1163$.ui.position = { 1164 fit: { 1165 left: function( position, data ) { 1166 var within = data.within, 1167 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 1168 outerWidth = within.width, 1169 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1170 overLeft = withinOffset - collisionPosLeft, 1171 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 1172 newOverRight; 1173
vendor: 7,320 bytes, lines 1174-1406
1174 // element is wider than within 1175 if ( data.collisionWidth > outerWidth ) { 1176 // element is initially over the left side of within 1177 if ( overLeft > 0 && overRight <= 0 ) { 1178 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; 1179 position.left += overLeft - newOverRight; 1180 // element is initially over right side of within 1181 } else if ( overRight > 0 && overLeft <= 0 ) { 1182 position.left = withinOffset; 1183 // element is initially over both left and right sides of within 1184 } else { 1185 if ( overLeft > overRight ) { 1186 position.left = withinOffset + outerWidth - data.collisionWidth; 1187 } else { 1188 position.left = withinOffset; 1189 } 1190 } 1191 // too far left -> align with left edge 1192 } else if ( overLeft > 0 ) { 1193 position.left += overLeft; 1194 // too far right -> align with right edge 1195 } else if ( overRight > 0 ) { 1196 position.left -= overRight; 1197 // adjust based on position and margin 1198 } else { 1199 position.left = max( position.left - collisionPosLeft, position.left ); 1200 } 1201 }, 1202 top: function( position, data ) { 1203 var within = data.within, 1204 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 1205 outerHeight = data.within.height, 1206 collisionPosTop = position.top - data.collisionPosition.marginTop, 1207 overTop = withinOffset - collisionPosTop, 1208 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 1209 newOverBottom; 1210 1211 // element is taller than within 1212 if ( data.collisionHeight > outerHeight ) { 1213 // element is initially over the top of within 1214 if ( overTop > 0 && overBottom <= 0 ) { 1215 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; 1216 position.top += overTop - newOverBottom; 1217 // element is initially over bottom of within 1218 } else if ( overBottom > 0 && overTop <= 0 ) { 1219 position.top = withinOffset; 1220 // element is initially over both top and bottom of within 1221 } else { 1222 if ( overTop > overBottom ) { 1223 position.top = withinOffset + outerHeight - data.collisionHeight; 1224 } else { 1225 position.top = withinOffset; 1226 } 1227 } 1228 // too far up -> align with top 1229 } else if ( overTop > 0 ) { 1230 position.top += overTop; 1231 // too far down -> align with bottom edge 1232 } else if ( overBottom > 0 ) { 1233 position.top -= overBottom; 1234 // adjust based on position and margin 1235 } else { 1236 position.top = max( position.top - collisionPosTop, position.top ); 1237 } 1238 } 1239 }, 1240 flip: { 1241 left: function( position, data ) { 1242 var within = data.within, 1243 withinOffset = within.offset.left + within.scrollLeft, 1244 outerWidth = within.width, 1245 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 1246 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 1247 overLeft = collisionPosLeft - offsetLeft, 1248 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 1249 myOffset = data.my[ 0 ] === "left" ? 1250 -data.elemWidth : 1251 data.my[ 0 ] === "right" ? 1252 data.elemWidth : 1253 0, 1254 atOffset = data.at[ 0 ] === "left" ? 1255 data.targetWidth : 1256 data.at[ 0 ] === "right" ? 1257 -data.targetWidth : 1258 0, 1259 offset = -2 * data.offset[ 0 ], 1260 newOverRight, 1261 newOverLeft; 1262 1263 if ( overLeft < 0 ) { 1264 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; 1265 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 1266 position.left += myOffset + atOffset + offset; 1267 } 1268 } else if ( overRight > 0 ) { 1269 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; 1270 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 1271 position.left += myOffset + atOffset + offset; 1272 } 1273 } 1274 }, 1275 top: function( position, data ) { 1276 var within = data.within, 1277 withinOffset = within.offset.top + within.scrollTop, 1278 outerHeight = within.height, 1279 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 1280 collisionPosTop = position.top - data.collisionPosition.marginTop, 1281 overTop = collisionPosTop - offsetTop, 1282 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 1283 top = data.my[ 1 ] === "top", 1284 myOffset = top ? 1285 -data.elemHeight : 1286 data.my[ 1 ] === "bottom" ? 1287 data.elemHeight : 1288 0, 1289 atOffset = data.at[ 1 ] === "top" ? 1290 data.targetHeight : 1291 data.at[ 1 ] === "bottom" ? 1292 -data.targetHeight : 1293 0, 1294 offset = -2 * data.offset[ 1 ], 1295 newOverTop, 1296 newOverBottom; 1297 if ( overTop < 0 ) { 1298 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; 1299 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 1300 position.top += myOffset + atOffset + offset; 1301 } 1302 } else if ( overBottom > 0 ) { 1303 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; 1304 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 1305 position.top += myOffset + atOffset + offset; 1306 } 1307 } 1308 } 1309 }, 1310 flipfit: { 1311 left: function() { 1312 $.ui.position.flip.left.apply( this, arguments ); 1313 $.ui.position.fit.left.apply( this, arguments ); 1314 }, 1315 top: function() { 1316 $.ui.position.flip.top.apply( this, arguments ); 1317 $.ui.position.fit.top.apply( this, arguments ); 1318 } 1319 } 1320}; 1321 1322// fraction support test 1323(function() { 1324 var testElement, testElementParent, testElementStyle, offsetLeft, i, 1325 body = document.getElementsByTagName( "body" )[ 0 ], 1326 div = document.createElement( "div" ); 1327 1328 //Create a "fake body" for testing based on method used in jQuery.support 1329 testElement = document.createElement( body ? "div" : "body" ); 1330 testElementStyle = { 1331 visibility: "hidden", 1332 width: 0, 1333 height: 0, 1334 border: 0, 1335 margin: 0, 1336 background: "none" 1337 }; 1338 if ( body ) { 1339 $.extend( testElementStyle, { 1340 position: "absolute", 1341 left: "-1000px", 1342 top: "-1000px" 1343 }); 1344 } 1345 for ( i in testElementStyle ) { 1346 testElement.style[ i ] = testElementStyle[ i ]; 1347 } 1348 testElement.appendChild( div ); 1349 testElementParent = body || document.documentElement; 1350 testElementParent.insertBefore( testElement, testElementParent.firstChild ); 1351 1352 div.style.cssText = "position: absolute; left: 10.7432222px;"; 1353 1354 offsetLeft = $( div ).offset().left; 1355 supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; 1356 1357 testElement.innerHTML = ""; 1358 testElementParent.removeChild( testElement ); 1359})(); 1360 1361})(); 1362 1363var position = $.ui.position; 1364 1365 1366/*! 1367 * jQuery UI Accordion 1.11.4 1368 * http://jqueryui.com 1369 * 1370 * Copyright jQuery Foundation and other contributors 1371 * Released under the MIT license. 1372 * http://jquery.org/license 1373 * 1374 * http://api.jqueryui.com/accordion/ 1375 */ 1376 1377 1378var accordion = $.widget( "ui.accordion", { 1379 version: "1.11.4", 1380 options: { 1381 active: 0, 1382 animate: {}, 1383 collapsible: false, 1384 event: "click", 1385 header: "> li > :first-child,> :not(li):even", 1386 heightStyle: "auto", 1387 icons: { 1388 activeHeader: "ui-icon-triangle-1-s", 1389 header: "ui-icon-triangle-1-e" 1390 }, 1391 1392 // callbacks 1393 activate: null, 1394 beforeActivate: null 1395 }, 1396 1397 hideProps: { 1398 borderTopWidth: "hide", 1399 borderBottomWidth: "hide", 1400 paddingTop: "hide", 1401 paddingBottom: "hide", 1402 height: "hide" 1403 }, 1404 1405 showProps: { 1406 borderTopWidth: "show",
vendor: 4,428 bytes, lines 1407-1583
1407 borderBottomWidth: "show", 1408 paddingTop: "show", 1409 paddingBottom: "show", 1410 height: "show" 1411 }, 1412 1413 _create: function() { 1414 var options = this.options; 1415 this.prevShow = this.prevHide = $(); 1416 this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) 1417 // ARIA 1418 .attr( "role", "tablist" ); 1419 1420 // don't allow collapsible: false and active: false / null 1421 if ( !options.collapsible && (options.active === false || options.active == null) ) { 1422 options.active = 0; 1423 } 1424 1425 this._processPanels(); 1426 // handle negative values 1427 if ( options.active < 0 ) { 1428 options.active += this.headers.length; 1429 } 1430 this._refresh(); 1431 }, 1432 1433 _getCreateEventData: function() { 1434 return { 1435 header: this.active, 1436 panel: !this.active.length ? $() : this.active.next() 1437 }; 1438 }, 1439 1440 _createIcons: function() { 1441 var icons = this.options.icons; 1442 if ( icons ) { 1443 $( "<span>" ) 1444 .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) 1445 .prependTo( this.headers ); 1446 this.active.children( ".ui-accordion-header-icon" ) 1447 .removeClass( icons.header ) 1448 .addClass( icons.activeHeader ); 1449 this.headers.addClass( "ui-accordion-icons" ); 1450 } 1451 }, 1452 1453 _destroyIcons: function() { 1454 this.headers 1455 .removeClass( "ui-accordion-icons" ) 1456 .children( ".ui-accordion-header-icon" ) 1457 .remove(); 1458 }, 1459 1460 _destroy: function() { 1461 var contents; 1462 1463 // clean up main element 1464 this.element 1465 .removeClass( "ui-accordion ui-widget ui-helper-reset" ) 1466 .removeAttr( "role" ); 1467 1468 // clean up headers 1469 this.headers 1470 .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + 1471 "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) 1472 .removeAttr( "role" ) 1473 .removeAttr( "aria-expanded" ) 1474 .removeAttr( "aria-selected" ) 1475 .removeAttr( "aria-controls" ) 1476 .removeAttr( "tabIndex" ) 1477 .removeUniqueId(); 1478 1479 this._destroyIcons(); 1480 1481 // clean up content panels 1482 contents = this.headers.next() 1483 .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + 1484 "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) 1485 .css( "display", "" ) 1486 .removeAttr( "role" ) 1487 .removeAttr( "aria-hidden" ) 1488 .removeAttr( "aria-labelledby" ) 1489 .removeUniqueId(); 1490 1491 if ( this.options.heightStyle !== "content" ) { 1492 contents.css( "height", "" ); 1493 } 1494 }, 1495 1496 _setOption: function( key, value ) { 1497 if ( key === "active" ) { 1498 // _activate() will handle invalid values and update this.options 1499 this._activate( value ); 1500 return; 1501 } 1502 1503 if ( key === "event" ) { 1504 if ( this.options.event ) { 1505 this._off( this.headers, this.options.event ); 1506 } 1507 this._setupEvents( value ); 1508 } 1509 1510 this._super( key, value ); 1511 1512 // setting collapsible: false while collapsed; open first panel 1513 if ( key === "collapsible" && !value && this.options.active === false ) { 1514 this._activate( 0 ); 1515 } 1516 1517 if ( key === "icons" ) { 1518 this._destroyIcons(); 1519 if ( value ) { 1520 this._createIcons(); 1521 } 1522 } 1523 1524 // #5332 - opacity doesn't cascade to positioned elements in IE 1525 // so we need to add the disabled class to the headers and panels 1526 if ( key === "disabled" ) { 1527 this.element 1528 .toggleClass( "ui-state-disabled", !!value ) 1529 .attr( "aria-disabled", value ); 1530 this.headers.add( this.headers.next() ) 1531 .toggleClass( "ui-state-disabled", !!value ); 1532 } 1533 }, 1534 1535 _keydown: function( event ) { 1536 if ( event.altKey || event.ctrlKey ) { 1537 return; 1538 } 1539 1540 var keyCode = $.ui.keyCode, 1541 length = this.headers.length, 1542 currentIndex = this.headers.index( event.target ), 1543 toFocus = false; 1544 1545 switch ( event.keyCode ) { 1546 case keyCode.RIGHT: 1547 case keyCode.DOWN: 1548 toFocus = this.headers[ ( currentIndex + 1 ) % length ]; 1549 break; 1550 case keyCode.LEFT: 1551 case keyCode.UP: 1552 toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; 1553 break; 1554 case keyCode.SPACE: 1555 case keyCode.ENTER: 1556 this._eventHandler( event ); 1557 break; 1558 case keyCode.HOME: 1559 toFocus = this.headers[ 0 ]; 1560 break; 1561 case keyCode.END: 1562 toFocus = this.headers[ length - 1 ]; 1563 break; 1564 } 1565 1566 if ( toFocus ) { 1567 $( event.target ).attr( "tabIndex", -1 ); 1568 $( toFocus ).attr( "tabIndex", 0 ); 1569 toFocus.focus(); 1570 event.preventDefault(); 1571 } 1572 }, 1573 1574 _panelKeyDown: function( event ) { 1575 if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { 1576 $( event.currentTarget ).prev().focus(); 1577 } 1578 }, 1579 1580 refresh: function() { 1581 var options = this.options; 1582 this._processPanels(); 1583
vendor: 17,411 bytes, lines 1584-2236
1584 // was collapsed or no panel 1585 if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { 1586 options.active = false; 1587 this.active = $(); 1588 // active false only when collapsible is true 1589 } else if ( options.active === false ) { 1590 this._activate( 0 ); 1591 // was active, but active panel is gone 1592 } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 1593 // all remaining panel are disabled 1594 if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { 1595 options.active = false; 1596 this.active = $(); 1597 // activate previous panel 1598 } else { 1599 this._activate( Math.max( 0, options.active - 1 ) ); 1600 } 1601 // was active, active panel still exists 1602 } else { 1603 // make sure active index is correct 1604 options.active = this.headers.index( this.active ); 1605 } 1606 1607 this._destroyIcons(); 1608 1609 this._refresh(); 1610 }, 1611 1612 _processPanels: function() { 1613 var prevHeaders = this.headers, 1614 prevPanels = this.panels; 1615 1616 this.headers = this.element.find( this.options.header ) 1617 .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); 1618 1619 this.panels = this.headers.next() 1620 .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) 1621 .filter( ":not(.ui-accordion-content-active)" ) 1622 .hide(); 1623 1624 // Avoid memory leaks (#10056) 1625 if ( prevPanels ) { 1626 this._off( prevHeaders.not( this.headers ) ); 1627 this._off( prevPanels.not( this.panels ) ); 1628 } 1629 }, 1630 1631 _refresh: function() { 1632 var maxHeight, 1633 options = this.options, 1634 heightStyle = options.heightStyle, 1635 parent = this.element.parent(); 1636 1637 this.active = this._findActive( options.active ) 1638 .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) 1639 .removeClass( "ui-corner-all" ); 1640 this.active.next() 1641 .addClass( "ui-accordion-content-active" ) 1642 .show(); 1643 1644 this.headers 1645 .attr( "role", "tab" ) 1646 .each(function() { 1647 var header = $( this ), 1648 headerId = header.uniqueId().attr( "id" ), 1649 panel = header.next(), 1650 panelId = panel.uniqueId().attr( "id" ); 1651 header.attr( "aria-controls", panelId ); 1652 panel.attr( "aria-labelledby", headerId ); 1653 }) 1654 .next() 1655 .attr( "role", "tabpanel" ); 1656 1657 this.headers 1658 .not( this.active ) 1659 .attr({ 1660 "aria-selected": "false", 1661 "aria-expanded": "false", 1662 tabIndex: -1 1663 }) 1664 .next() 1665 .attr({ 1666 "aria-hidden": "true" 1667 }) 1668 .hide(); 1669 1670 // make sure at least one header is in the tab order 1671 if ( !this.active.length ) { 1672 this.headers.eq( 0 ).attr( "tabIndex", 0 ); 1673 } else { 1674 this.active.attr({ 1675 "aria-selected": "true", 1676 "aria-expanded": "true", 1677 tabIndex: 0 1678 }) 1679 .next() 1680 .attr({ 1681 "aria-hidden": "false" 1682 }); 1683 } 1684 1685 this._createIcons(); 1686 1687 this._setupEvents( options.event ); 1688 1689 if ( heightStyle === "fill" ) { 1690 maxHeight = parent.height(); 1691 this.element.siblings( ":visible" ).each(function() { 1692 var elem = $( this ), 1693 position = elem.css( "position" ); 1694 1695 if ( position === "absolute" || position === "fixed" ) { 1696 return; 1697 } 1698 maxHeight -= elem.outerHeight( true ); 1699 }); 1700 1701 this.headers.each(function() { 1702 maxHeight -= $( this ).outerHeight( true ); 1703 }); 1704 1705 this.headers.next() 1706 .each(function() { 1707 $( this ).height( Math.max( 0, maxHeight - 1708 $( this ).innerHeight() + $( this ).height() ) ); 1709 }) 1710 .css( "overflow", "auto" ); 1711 } else if ( heightStyle === "auto" ) { 1712 maxHeight = 0; 1713 this.headers.next() 1714 .each(function() { 1715 maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); 1716 }) 1717 .height( maxHeight ); 1718 } 1719 }, 1720 1721 _activate: function( index ) { 1722 var active = this._findActive( index )[ 0 ]; 1723 1724 // trying to activate the already active panel 1725 if ( active === this.active[ 0 ] ) { 1726 return; 1727 } 1728 1729 // trying to collapse, simulate a click on the currently active header 1730 active = active || this.active[ 0 ]; 1731 1732 this._eventHandler({ 1733 target: active, 1734 currentTarget: active, 1735 preventDefault: $.noop 1736 }); 1737 }, 1738 1739 _findActive: function( selector ) { 1740 return typeof selector === "number" ? this.headers.eq( selector ) : $(); 1741 }, 1742 1743 _setupEvents: function( event ) { 1744 var events = { 1745 keydown: "_keydown" 1746 }; 1747 if ( event ) { 1748 $.each( event.split( " " ), function( index, eventName ) { 1749 events[ eventName ] = "_eventHandler"; 1750 }); 1751 } 1752 1753 this._off( this.headers.add( this.headers.next() ) ); 1754 this._on( this.headers, events ); 1755 this._on( this.headers.next(), { keydown: "_panelKeyDown" }); 1756 this._hoverable( this.headers ); 1757 this._focusable( this.headers ); 1758 }, 1759 1760 _eventHandler: function( event ) { 1761 var options = this.options, 1762 active = this.active, 1763 clicked = $( event.currentTarget ), 1764 clickedIsActive = clicked[ 0 ] === active[ 0 ], 1765 collapsing = clickedIsActive && options.collapsible, 1766 toShow = collapsing ? $() : clicked.next(), 1767 toHide = active.next(), 1768 eventData = { 1769 oldHeader: active, 1770 oldPanel: toHide, 1771 newHeader: collapsing ? $() : clicked, 1772 newPanel: toShow 1773 }; 1774 1775 event.preventDefault(); 1776 1777 if ( 1778 // click on active header, but not collapsible 1779 ( clickedIsActive && !options.collapsible ) || 1780 // allow canceling activation 1781 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 1782 return; 1783 } 1784 1785 options.active = collapsing ? false : this.headers.index( clicked ); 1786 1787 // when the call to ._toggle() comes after the class changes 1788 // it causes a very odd bug in IE 8 (see #6720) 1789 this.active = clickedIsActive ? $() : clicked; 1790 this._toggle( eventData ); 1791 1792 // switch classes 1793 // corner classes on the previously active header stay after the animation 1794 active.removeClass( "ui-accordion-header-active ui-state-active" ); 1795 if ( options.icons ) { 1796 active.children( ".ui-accordion-header-icon" ) 1797 .removeClass( options.icons.activeHeader ) 1798 .addClass( options.icons.header ); 1799 } 1800 1801 if ( !clickedIsActive ) { 1802 clicked 1803 .removeClass( "ui-corner-all" ) 1804 .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); 1805 if ( options.icons ) { 1806 clicked.children( ".ui-accordion-header-icon" ) 1807 .removeClass( options.icons.header ) 1808 .addClass( options.icons.activeHeader ); 1809 } 1810 1811 clicked 1812 .next() 1813 .addClass( "ui-accordion-content-active" ); 1814 } 1815 }, 1816 1817 _toggle: function( data ) { 1818 var toShow = data.newPanel, 1819 toHide = this.prevShow.length ? this.prevShow : data.oldPanel; 1820 1821 // handle activating a panel during the animation for another activation 1822 this.prevShow.add( this.prevHide ).stop( true, true ); 1823 this.prevShow = toShow; 1824 this.prevHide = toHide; 1825 1826 if ( this.options.animate ) { 1827 this._animate( toShow, toHide, data ); 1828 } else { 1829 toHide.hide(); 1830 toShow.show(); 1831 this._toggleComplete( data ); 1832 } 1833 1834 toHide.attr({ 1835 "aria-hidden": "true" 1836 }); 1837 toHide.prev().attr({ 1838 "aria-selected": "false", 1839 "aria-expanded": "false" 1840 }); 1841 // if we're switching panels, remove the old header from the tab order 1842 // if we're opening from collapsed state, remove the previous header from the tab order 1843 // if we're collapsing, then keep the collapsing header in the tab order 1844 if ( toShow.length && toHide.length ) { 1845 toHide.prev().attr({ 1846 "tabIndex": -1, 1847 "aria-expanded": "false" 1848 }); 1849 } else if ( toShow.length ) { 1850 this.headers.filter(function() { 1851 return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; 1852 }) 1853 .attr( "tabIndex", -1 ); 1854 } 1855 1856 toShow 1857 .attr( "aria-hidden", "false" ) 1858 .prev() 1859 .attr({ 1860 "aria-selected": "true", 1861 "aria-expanded": "true", 1862 tabIndex: 0 1863 }); 1864 }, 1865 1866 _animate: function( toShow, toHide, data ) { 1867 var total, easing, duration, 1868 that = this, 1869 adjust = 0, 1870 boxSizing = toShow.css( "box-sizing" ), 1871 down = toShow.length && 1872 ( !toHide.length || ( toShow.index() < toHide.index() ) ), 1873 animate = this.options.animate || {}, 1874 options = down && animate.down || animate, 1875 complete = function() { 1876 that._toggleComplete( data ); 1877 }; 1878 1879 if ( typeof options === "number" ) { 1880 duration = options; 1881 } 1882 if ( typeof options === "string" ) { 1883 easing = options; 1884 } 1885 // fall back from options to animation in case of partial down settings 1886 easing = easing || options.easing || animate.easing; 1887 duration = duration || options.duration || animate.duration; 1888 1889 if ( !toHide.length ) { 1890 return toShow.animate( this.showProps, duration, easing, complete ); 1891 } 1892 if ( !toShow.length ) { 1893 return toHide.animate( this.hideProps, duration, easing, complete ); 1894 } 1895 1896 total = toShow.show().outerHeight(); 1897 toHide.animate( this.hideProps, { 1898 duration: duration, 1899 easing: easing, 1900 step: function( now, fx ) { 1901 fx.now = Math.round( now ); 1902 } 1903 }); 1904 toShow 1905 .hide() 1906 .animate( this.showProps, { 1907 duration: duration, 1908 easing: easing, 1909 complete: complete, 1910 step: function( now, fx ) { 1911 fx.now = Math.round( now ); 1912 if ( fx.prop !== "height" ) { 1913 if ( boxSizing === "content-box" ) { 1914 adjust += fx.now; 1915 } 1916 } else if ( that.options.heightStyle !== "content" ) { 1917 fx.now = Math.round( total - toHide.outerHeight() - adjust ); 1918 adjust = 0; 1919 } 1920 } 1921 }); 1922 }, 1923 1924 _toggleComplete: function( data ) { 1925 var toHide = data.oldPanel; 1926 1927 toHide 1928 .removeClass( "ui-accordion-content-active" ) 1929 .prev() 1930 .removeClass( "ui-corner-top" ) 1931 .addClass( "ui-corner-all" ); 1932 1933 // Work around for rendering bug in IE (#5421) 1934 if ( toHide.length ) { 1935 toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; 1936 } 1937 this._trigger( "activate", null, data ); 1938 } 1939}); 1940 1941 1942/*! 1943 * jQuery UI Menu 1.11.4 1944 * http://jqueryui.com 1945 * 1946 * Copyright jQuery Foundation and other contributors 1947 * Released under the MIT license. 1948 * http://jquery.org/license 1949 * 1950 * http://api.jqueryui.com/menu/ 1951 */ 1952 1953 1954var menu = $.widget( "ui.menu", { 1955 version: "1.11.4", 1956 defaultElement: "<ul>", 1957 delay: 300, 1958 options: { 1959 icons: { 1960 submenu: "ui-icon-carat-1-e" 1961 }, 1962 items: "> *", 1963 menus: "ul", 1964 position: { 1965 my: "left-1 top", 1966 at: "right top" 1967 }, 1968 role: "menu", 1969 1970 // callbacks 1971 blur: null, 1972 focus: null, 1973 select: null 1974 }, 1975 1976 _create: function() { 1977 this.activeMenu = this.element; 1978 1979 // Flag used to prevent firing of the click handler 1980 // as the event bubbles up through nested menus 1981 this.mouseHandled = false; 1982 this.element 1983 .uniqueId() 1984 .addClass( "ui-menu ui-widget ui-widget-content" ) 1985 .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) 1986 .attr({ 1987 role: this.options.role, 1988 tabIndex: 0 1989 }); 1990 1991 if ( this.options.disabled ) { 1992 this.element 1993 .addClass( "ui-state-disabled" ) 1994 .attr( "aria-disabled", "true" ); 1995 } 1996 1997 this._on({ 1998 // Prevent focus from sticking to links inside menu after clicking 1999 // them (focus should always stay on UL during navigation). 2000 "mousedown .ui-menu-item": function( event ) { 2001 event.preventDefault(); 2002 }, 2003 "click .ui-menu-item": function( event ) { 2004 var target = $( event.target ); 2005 if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { 2006 this.select( event ); 2007 2008 // Only set the mouseHandled flag if the event will bubble, see #9469. 2009 if ( !event.isPropagationStopped() ) { 2010 this.mouseHandled = true; 2011 } 2012 2013 // Open submenu on click 2014 if ( target.has( ".ui-menu" ).length ) { 2015 this.expand( event ); 2016 } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { 2017 2018 // Redirect focus to the menu 2019 this.element.trigger( "focus", [ true ] ); 2020 2021 // If the active item is on the top level, let it stay active. 2022 // Otherwise, blur the active item since it is no longer visible. 2023 if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { 2024 clearTimeout( this.timer ); 2025 } 2026 } 2027 } 2028 }, 2029 "mouseenter .ui-menu-item": function( event ) { 2030 // Ignore mouse events while typeahead is active, see #10458. 2031 // Prevents focusing the wrong item when typeahead causes a scroll while the mouse 2032 // is over an item in the menu 2033 if ( this.previousFilter ) { 2034 return; 2035 } 2036 var target = $( event.currentTarget ); 2037 // Remove ui-state-active class from siblings of the newly focused menu item 2038 // to avoid a jump caused by adjacent elements both having a class with a border 2039 target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" ); 2040 this.focus( event, target ); 2041 }, 2042 mouseleave: "collapseAll", 2043 "mouseleave .ui-menu": "collapseAll", 2044 focus: function( event, keepActiveItem ) { 2045 // If there's already an active item, keep it active 2046 // If not, activate the first item 2047 var item = this.active || this.element.find( this.options.items ).eq( 0 ); 2048 2049 if ( !keepActiveItem ) { 2050 this.focus( event, item ); 2051 } 2052 }, 2053 blur: function( event ) { 2054 this._delay(function() { 2055 if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { 2056 this.collapseAll( event ); 2057 } 2058 }); 2059 }, 2060 keydown: "_keydown" 2061 }); 2062 2063 this.refresh(); 2064 2065 // Clicks outside of a menu collapse any open menus 2066 this._on( this.document, { 2067 click: function( event ) { 2068 if ( this._closeOnDocumentClick( event ) ) { 2069 this.collapseAll( event ); 2070 } 2071 2072 // Reset the mouseHandled flag 2073 this.mouseHandled = false; 2074 } 2075 }); 2076 }, 2077 2078 _destroy: function() { 2079 // Destroy (sub)menus 2080 this.element 2081 .removeAttr( "aria-activedescendant" ) 2082 .find( ".ui-menu" ).addBack() 2083 .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" ) 2084 .removeAttr( "role" ) 2085 .removeAttr( "tabIndex" ) 2086 .removeAttr( "aria-labelledby" ) 2087 .removeAttr( "aria-expanded" ) 2088 .removeAttr( "aria-hidden" ) 2089 .removeAttr( "aria-disabled" ) 2090 .removeUniqueId() 2091 .show(); 2092 2093 // Destroy menu items 2094 this.element.find( ".ui-menu-item" ) 2095 .removeClass( "ui-menu-item" ) 2096 .removeAttr( "role" ) 2097 .removeAttr( "aria-disabled" ) 2098 .removeUniqueId() 2099 .removeClass( "ui-state-hover" ) 2100 .removeAttr( "tabIndex" ) 2101 .removeAttr( "role" ) 2102 .removeAttr( "aria-haspopup" ) 2103 .children().each( function() { 2104 var elem = $( this ); 2105 if ( elem.data( "ui-menu-submenu-carat" ) ) { 2106 elem.remove(); 2107 } 2108 }); 2109 2110 // Destroy menu dividers 2111 this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); 2112 }, 2113 2114 _keydown: function( event ) { 2115 var match, prev, character, skip, 2116 preventDefault = true; 2117 2118 switch ( event.keyCode ) { 2119 case $.ui.keyCode.PAGE_UP: 2120 this.previousPage( event ); 2121 break; 2122 case $.ui.keyCode.PAGE_DOWN: 2123 this.nextPage( event ); 2124 break; 2125 case $.ui.keyCode.HOME: 2126 this._move( "first", "first", event ); 2127 break; 2128 case $.ui.keyCode.END: 2129 this._move( "last", "last", event ); 2130 break; 2131 case $.ui.keyCode.UP: 2132 this.previous( event ); 2133 break; 2134 case $.ui.keyCode.DOWN: 2135 this.next( event ); 2136 break; 2137 case $.ui.keyCode.LEFT: 2138 this.collapse( event ); 2139 break; 2140 case $.ui.keyCode.RIGHT: 2141 if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { 2142 this.expand( event ); 2143 } 2144 break; 2145 case $.ui.keyCode.ENTER: 2146 case $.ui.keyCode.SPACE: 2147 this._activate( event ); 2148 break; 2149 case $.ui.keyCode.ESCAPE: 2150 this.collapse( event ); 2151 break; 2152 default: 2153 preventDefault = false; 2154 prev = this.previousFilter || ""; 2155 character = String.fromCharCode( event.keyCode ); 2156 skip = false; 2157 2158 clearTimeout( this.filterTimer ); 2159 2160 if ( character === prev ) { 2161 skip = true; 2162 } else { 2163 character = prev + character; 2164 } 2165 2166 match = this._filterMenuItems( character ); 2167 match = skip && match.index( this.active.next() ) !== -1 ? 2168 this.active.nextAll( ".ui-menu-item" ) : 2169 match; 2170 2171 // If no matches on the current filter, reset to the last character pressed 2172 // to move down the menu to the first item that starts with that character 2173 if ( !match.length ) { 2174 character = String.fromCharCode( event.keyCode ); 2175 match = this._filterMenuItems( character ); 2176 } 2177 2178 if ( match.length ) { 2179 this.focus( event, match ); 2180 this.previousFilter = character; 2181 this.filterTimer = this._delay(function() { 2182 delete this.previousFilter; 2183 }, 1000 ); 2184 } else { 2185 delete this.previousFilter; 2186 } 2187 } 2188 2189 if ( preventDefault ) { 2190 event.preventDefault(); 2191 } 2192 }, 2193 2194 _activate: function( event ) { 2195 if ( !this.active.is( ".ui-state-disabled" ) ) { 2196 if ( this.active.is( "[aria-haspopup='true']" ) ) { 2197 this.expand( event ); 2198 } else { 2199 this.select( event ); 2200 } 2201 } 2202 }, 2203 2204 refresh: function() { 2205 var menus, items, 2206 that = this, 2207 icon = this.options.icons.submenu, 2208 submenus = this.element.find( this.options.menus ); 2209 2210 this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); 2211 2212 // Initialize nested menus 2213 submenus.filter( ":not(.ui-menu)" ) 2214 .addClass( "ui-menu ui-widget ui-widget-content ui-front" ) 2215 .hide() 2216 .attr({ 2217 role: this.options.role, 2218 "aria-hidden": "true", 2219 "aria-expanded": "false" 2220 }) 2221 .each(function() { 2222 var menu = $( this ), 2223 item = menu.parent(), 2224 submenuCarat = $( "<span>" ) 2225 .addClass( "ui-menu-icon ui-icon " + icon ) 2226 .data( "ui-menu-submenu-carat", true ); 2227 2228 item 2229 .attr( "aria-haspopup", "true" ) 2230 .prepend( submenuCarat ); 2231 menu.attr( "aria-labelledby", item.attr( "id" ) ); 2232 }); 2233 2234 menus = submenus.add( this.element ); 2235 items = menus.find( this.options.items ); 2236
vendor: 4,109 bytes, lines 2237-2388
2237 // Initialize menu-items containing spaces and/or dashes only as dividers 2238 items.not( ".ui-menu-item" ).each(function() { 2239 var item = $( this ); 2240 if ( that._isDivider( item ) ) { 2241 item.addClass( "ui-widget-content ui-menu-divider" ); 2242 } 2243 }); 2244 2245 // Don't refresh list items that are already adapted 2246 items.not( ".ui-menu-item, .ui-menu-divider" ) 2247 .addClass( "ui-menu-item" ) 2248 .uniqueId() 2249 .attr({ 2250 tabIndex: -1, 2251 role: this._itemRole() 2252 }); 2253 2254 // Add aria-disabled attribute to any disabled menu item 2255 items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); 2256 2257 // If the active item has been removed, blur the menu 2258 if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { 2259 this.blur(); 2260 } 2261 }, 2262 2263 _itemRole: function() { 2264 return { 2265 menu: "menuitem", 2266 listbox: "option" 2267 }[ this.options.role ]; 2268 }, 2269 2270 _setOption: function( key, value ) { 2271 if ( key === "icons" ) { 2272 this.element.find( ".ui-menu-icon" ) 2273 .removeClass( this.options.icons.submenu ) 2274 .addClass( value.submenu ); 2275 } 2276 if ( key === "disabled" ) { 2277 this.element 2278 .toggleClass( "ui-state-disabled", !!value ) 2279 .attr( "aria-disabled", value ); 2280 } 2281 this._super( key, value ); 2282 }, 2283 2284 focus: function( event, item ) { 2285 var nested, focused; 2286 this.blur( event, event && event.type === "focus" ); 2287 2288 this._scrollIntoView( item ); 2289 2290 this.active = item.first(); 2291 focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" ); 2292 // Only update aria-activedescendant if there's a role 2293 // otherwise we assume focus is managed elsewhere 2294 if ( this.options.role ) { 2295 this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); 2296 } 2297 2298 // Highlight active parent menu item, if any 2299 this.active 2300 .parent() 2301 .closest( ".ui-menu-item" ) 2302 .addClass( "ui-state-active" ); 2303 2304 if ( event && event.type === "keydown" ) { 2305 this._close(); 2306 } else { 2307 this.timer = this._delay(function() { 2308 this._close(); 2309 }, this.delay ); 2310 } 2311 2312 nested = item.children( ".ui-menu" ); 2313 if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { 2314 this._startOpening(nested); 2315 } 2316 this.activeMenu = item.parent(); 2317 2318 this._trigger( "focus", event, { item: item } ); 2319 }, 2320 2321 _scrollIntoView: function( item ) { 2322 var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; 2323 if ( this._hasScroll() ) { 2324 borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; 2325 paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; 2326 offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; 2327 scroll = this.activeMenu.scrollTop(); 2328 elementHeight = this.activeMenu.height(); 2329 itemHeight = item.outerHeight(); 2330 2331 if ( offset < 0 ) { 2332 this.activeMenu.scrollTop( scroll + offset ); 2333 } else if ( offset + itemHeight > elementHeight ) { 2334 this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); 2335 } 2336 } 2337 }, 2338 2339 blur: function( event, fromFocus ) { 2340 if ( !fromFocus ) { 2341 clearTimeout( this.timer ); 2342 } 2343 2344 if ( !this.active ) { 2345 return; 2346 } 2347 2348 this.active.removeClass( "ui-state-focus" ); 2349 this.active = null; 2350 2351 this._trigger( "blur", event, { item: this.active } ); 2352 }, 2353 2354 _startOpening: function( submenu ) { 2355 clearTimeout( this.timer ); 2356 2357 // Don't open if already open fixes a Firefox bug that caused a .5 pixel 2358 // shift in the submenu position when mousing over the carat icon 2359 if ( submenu.attr( "aria-hidden" ) !== "true" ) { 2360 return; 2361 } 2362 2363 this.timer = this._delay(function() { 2364 this._close(); 2365 this._open( submenu ); 2366 }, this.delay ); 2367 }, 2368 2369 _open: function( submenu ) { 2370 var position = $.extend({ 2371 of: this.active 2372 }, this.options.position ); 2373 2374 clearTimeout( this.timer ); 2375 this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) 2376 .hide() 2377 .attr( "aria-hidden", "true" ); 2378 2379 submenu 2380 .show() 2381 .removeAttr( "aria-hidden" ) 2382 .attr( "aria-expanded", "true" ) 2383 .position( position ); 2384 }, 2385 2386 collapseAll: function( event, all ) { 2387 clearTimeout( this.timer ); 2388 this.timer = this._delay(function() {
vendor: 11,138 bytes, lines 2389-2805
2389 // If we were passed an event, look for the submenu that contains the event 2390 var currentMenu = all ? this.element : 2391 $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); 2392 2393 // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway 2394 if ( !currentMenu.length ) { 2395 currentMenu = this.element; 2396 } 2397 2398 this._close( currentMenu ); 2399 2400 this.blur( event ); 2401 this.activeMenu = currentMenu; 2402 }, this.delay ); 2403 }, 2404 2405 // With no arguments, closes the currently active menu - if nothing is active 2406 // it closes all menus. If passed an argument, it will search for menus BELOW 2407 _close: function( startMenu ) { 2408 if ( !startMenu ) { 2409 startMenu = this.active ? this.active.parent() : this.element; 2410 } 2411 2412 startMenu 2413 .find( ".ui-menu" ) 2414 .hide() 2415 .attr( "aria-hidden", "true" ) 2416 .attr( "aria-expanded", "false" ) 2417 .end() 2418 .find( ".ui-state-active" ).not( ".ui-state-focus" ) 2419 .removeClass( "ui-state-active" ); 2420 }, 2421 2422 _closeOnDocumentClick: function( event ) { 2423 return !$( event.target ).closest( ".ui-menu" ).length; 2424 }, 2425 2426 _isDivider: function( item ) { 2427 2428 // Match hyphen, em dash, en dash 2429 return !/[^\-\u2014\u2013\s]/.test( item.text() ); 2430 }, 2431 2432 collapse: function( event ) { 2433 var newItem = this.active && 2434 this.active.parent().closest( ".ui-menu-item", this.element ); 2435 if ( newItem && newItem.length ) { 2436 this._close(); 2437 this.focus( event, newItem ); 2438 } 2439 }, 2440 2441 expand: function( event ) { 2442 var newItem = this.active && 2443 this.active 2444 .children( ".ui-menu " ) 2445 .find( this.options.items ) 2446 .first(); 2447 2448 if ( newItem && newItem.length ) { 2449 this._open( newItem.parent() ); 2450 2451 // Delay so Firefox will not hide activedescendant change in expanding submenu from AT 2452 this._delay(function() { 2453 this.focus( event, newItem ); 2454 }); 2455 } 2456 }, 2457 2458 next: function( event ) { 2459 this._move( "next", "first", event ); 2460 }, 2461 2462 previous: function( event ) { 2463 this._move( "prev", "last", event ); 2464 }, 2465 2466 isFirstItem: function() { 2467 return this.active && !this.active.prevAll( ".ui-menu-item" ).length; 2468 }, 2469 2470 isLastItem: function() { 2471 return this.active && !this.active.nextAll( ".ui-menu-item" ).length; 2472 }, 2473 2474 _move: function( direction, filter, event ) { 2475 var next; 2476 if ( this.active ) { 2477 if ( direction === "first" || direction === "last" ) { 2478 next = this.active 2479 [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) 2480 .eq( -1 ); 2481 } else { 2482 next = this.active 2483 [ direction + "All" ]( ".ui-menu-item" ) 2484 .eq( 0 ); 2485 } 2486 } 2487 if ( !next || !next.length || !this.active ) { 2488 next = this.activeMenu.find( this.options.items )[ filter ](); 2489 } 2490 2491 this.focus( event, next ); 2492 }, 2493 2494 nextPage: function( event ) { 2495 var item, base, height; 2496 2497 if ( !this.active ) { 2498 this.next( event ); 2499 return; 2500 } 2501 if ( this.isLastItem() ) { 2502 return; 2503 } 2504 if ( this._hasScroll() ) { 2505 base = this.active.offset().top; 2506 height = this.element.height(); 2507 this.active.nextAll( ".ui-menu-item" ).each(function() { 2508 item = $( this ); 2509 return item.offset().top - base - height < 0; 2510 }); 2511 2512 this.focus( event, item ); 2513 } else { 2514 this.focus( event, this.activeMenu.find( this.options.items ) 2515 [ !this.active ? "first" : "last" ]() ); 2516 } 2517 }, 2518 2519 previousPage: function( event ) { 2520 var item, base, height; 2521 if ( !this.active ) { 2522 this.next( event ); 2523 return; 2524 } 2525 if ( this.isFirstItem() ) { 2526 return; 2527 } 2528 if ( this._hasScroll() ) { 2529 base = this.active.offset().top; 2530 height = this.element.height(); 2531 this.active.prevAll( ".ui-menu-item" ).each(function() { 2532 item = $( this ); 2533 return item.offset().top - base + height > 0; 2534 }); 2535 2536 this.focus( event, item ); 2537 } else { 2538 this.focus( event, this.activeMenu.find( this.options.items ).first() ); 2539 } 2540 }, 2541 2542 _hasScroll: function() { 2543 return this.element.outerHeight() < this.element.prop( "scrollHeight" ); 2544 }, 2545 2546 select: function( event ) { 2547 // TODO: It should never be possible to not have an active item at this 2548 // point, but the tests don't trigger mouseenter before click. 2549 this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); 2550 var ui = { item: this.active }; 2551 if ( !this.active.has( ".ui-menu" ).length ) { 2552 this.collapseAll( event, true ); 2553 } 2554 this._trigger( "select", event, ui ); 2555 }, 2556 2557 _filterMenuItems: function(character) { 2558 var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ), 2559 regex = new RegExp( "^" + escapedCharacter, "i" ); 2560 2561 return this.activeMenu 2562 .find( this.options.items ) 2563 2564 // Only match on items, not dividers or other content (#10571) 2565 .filter( ".ui-menu-item" ) 2566 .filter(function() { 2567 return regex.test( $.trim( $( this ).text() ) ); 2568 }); 2569 } 2570}); 2571 2572 2573/*! 2574 * jQuery UI Autocomplete 1.11.4 2575 * http://jqueryui.com 2576 * 2577 * Copyright jQuery Foundation and other contributors 2578 * Released under the MIT license. 2579 * http://jquery.org/license 2580 * 2581 * http://api.jqueryui.com/autocomplete/ 2582 */ 2583 2584 2585$.widget( "ui.autocomplete", { 2586 version: "1.11.4", 2587 defaultElement: "<input>", 2588 options: { 2589 appendTo: null, 2590 autoFocus: false, 2591 delay: 300, 2592 minLength: 1, 2593 position: { 2594 my: "left top", 2595 at: "left bottom", 2596 collision: "none" 2597 }, 2598 source: null, 2599 2600 // callbacks 2601 change: null, 2602 close: null, 2603 focus: null, 2604 open: null, 2605 response: null, 2606 search: null, 2607 select: null 2608 }, 2609 2610 requestIndex: 0, 2611 pending: 0, 2612 2613 _create: function() { 2614 // Some browsers only repeat keydown events, not keypress events, 2615 // so we use the suppressKeyPress flag to determine if we've already 2616 // handled the keydown event. #7269 2617 // Unfortunately the code for & in keypress is the same as the up arrow, 2618 // so we use the suppressKeyPressRepeat flag to avoid handling keypress 2619 // events when we know the keydown event was used to modify the 2620 // search term. #7799 2621 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, 2622 nodeName = this.element[ 0 ].nodeName.toLowerCase(), 2623 isTextarea = nodeName === "textarea", 2624 isInput = nodeName === "input"; 2625 2626 this.isMultiLine = 2627 // Textareas are always multi-line 2628 isTextarea ? true : 2629 // Inputs are always single-line, even if inside a contentEditable element 2630 // IE also treats inputs as contentEditable 2631 isInput ? false : 2632 // All other element types are determined by whether or not they're contentEditable 2633 this.element.prop( "isContentEditable" ); 2634 2635 this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; 2636 this.isNewMenu = true; 2637 2638 this.element 2639 .addClass( "ui-autocomplete-input" ) 2640 .attr( "autocomplete", "off" ); 2641 2642 this._on( this.element, { 2643 keydown: function( event ) { 2644 if ( this.element.prop( "readOnly" ) ) { 2645 suppressKeyPress = true; 2646 suppressInput = true; 2647 suppressKeyPressRepeat = true; 2648 return; 2649 } 2650 2651 suppressKeyPress = false; 2652 suppressInput = false; 2653 suppressKeyPressRepeat = false; 2654 var keyCode = $.ui.keyCode; 2655 switch ( event.keyCode ) { 2656 case keyCode.PAGE_UP: 2657 suppressKeyPress = true; 2658 this._move( "previousPage", event ); 2659 break; 2660 case keyCode.PAGE_DOWN: 2661 suppressKeyPress = true; 2662 this._move( "nextPage", event ); 2663 break; 2664 case keyCode.UP: 2665 suppressKeyPress = true; 2666 this._keyEvent( "previous", event ); 2667 break; 2668 case keyCode.DOWN: 2669 suppressKeyPress = true; 2670 this._keyEvent( "next", event ); 2671 break; 2672 case keyCode.ENTER: 2673 // when menu is open and has focus 2674 if ( this.menu.active ) { 2675 // #6055 - Opera still allows the keypress to occur 2676 // which causes forms to submit 2677 suppressKeyPress = true; 2678 event.preventDefault(); 2679 this.menu.select( event ); 2680 } 2681 break; 2682 case keyCode.TAB: 2683 if ( this.menu.active ) { 2684 this.menu.select( event ); 2685 } 2686 break; 2687 case keyCode.ESCAPE: 2688 if ( this.menu.element.is( ":visible" ) ) { 2689 if ( !this.isMultiLine ) { 2690 this._value( this.term ); 2691 } 2692 this.close( event ); 2693 // Different browsers have different default behavior for escape 2694 // Single press can mean undo or clear 2695 // Double press in IE means clear the whole form 2696 event.preventDefault(); 2697 } 2698 break; 2699 default: 2700 suppressKeyPressRepeat = true; 2701 // search timeout should be triggered before the input value is changed 2702 this._searchTimeout( event ); 2703 break; 2704 } 2705 }, 2706 keypress: function( event ) { 2707 if ( suppressKeyPress ) { 2708 suppressKeyPress = false; 2709 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 2710 event.preventDefault(); 2711 } 2712 return; 2713 } 2714 if ( suppressKeyPressRepeat ) { 2715 return; 2716 } 2717 2718 // replicate some key handlers to allow them to repeat in Firefox and Opera 2719 var keyCode = $.ui.keyCode; 2720 switch ( event.keyCode ) { 2721 case keyCode.PAGE_UP: 2722 this._move( "previousPage", event ); 2723 break; 2724 case keyCode.PAGE_DOWN: 2725 this._move( "nextPage", event ); 2726 break; 2727 case keyCode.UP: 2728 this._keyEvent( "previous", event ); 2729 break; 2730 case keyCode.DOWN: 2731 this._keyEvent( "next", event ); 2732 break; 2733 } 2734 }, 2735 input: function( event ) { 2736 if ( suppressInput ) { 2737 suppressInput = false; 2738 event.preventDefault(); 2739 return; 2740 } 2741 this._searchTimeout( event ); 2742 }, 2743 focus: function() { 2744 this.selectedItem = null; 2745 this.previous = this._value(); 2746 }, 2747 blur: function( event ) { 2748 if ( this.cancelBlur ) { 2749 delete this.cancelBlur; 2750 return; 2751 } 2752 2753 clearTimeout( this.searching ); 2754 this.close( event ); 2755 this._change( event ); 2756 } 2757 }); 2758 2759 this._initSource(); 2760 this.menu = $( "<ul>" ) 2761 .addClass( "ui-autocomplete ui-front" ) 2762 .appendTo( this._appendTo() ) 2763 .menu({ 2764 // disable ARIA support, the live region takes care of that 2765 role: null 2766 }) 2767 .hide() 2768 .menu( "instance" ); 2769 2770 this._on( this.menu.element, { 2771 mousedown: function( event ) { 2772 // prevent moving focus out of the text field 2773 event.preventDefault(); 2774 2775 // IE doesn't prevent moving focus even with event.preventDefault() 2776 // so we set a flag to know when we should ignore the blur event 2777 this.cancelBlur = true; 2778 this._delay(function() { 2779 delete this.cancelBlur; 2780 }); 2781 2782 // clicking on the scrollbar causes focus to shift to the body 2783 // but we can't detect a mouseup or a click immediately afterward 2784 // so we have to track the next mousedown and close the menu if 2785 // the user clicks somewhere outside of the autocomplete 2786 var menuElement = this.menu.element[ 0 ]; 2787 if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { 2788 this._delay(function() { 2789 var that = this; 2790 this.document.one( "mousedown", function( event ) { 2791 if ( event.target !== that.element[ 0 ] && 2792 event.target !== menuElement && 2793 !$.contains( menuElement, event.target ) ) { 2794 that.close(); 2795 } 2796 }); 2797 }); 2798 } 2799 }, 2800 menufocus: function( event, ui ) { 2801 var label, item; 2802 // support: Firefox 2803 // Prevent accidental activation of menu items in Firefox (#7024 #9118) 2804 if ( this.isNewMenu ) { 2805 this.isNewMenu = false;
vendor: 9,732 bytes, lines 2806-3186
2806 if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { 2807 this.menu.blur(); 2808 2809 this.document.one( "mousemove", function() { 2810 $( event.target ).trigger( event.originalEvent ); 2811 }); 2812 2813 return; 2814 } 2815 } 2816 2817 item = ui.item.data( "ui-autocomplete-item" ); 2818 if ( false !== this._trigger( "focus", event, { item: item } ) ) { 2819 // use value to match what will end up in the input, if it was a key event 2820 if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { 2821 this._value( item.value ); 2822 } 2823 } 2824 2825 // Announce the value in the liveRegion 2826 label = ui.item.attr( "aria-label" ) || item.value; 2827 if ( label && $.trim( label ).length ) { 2828 this.liveRegion.children().hide(); 2829 $( "<div>" ).text( label ).appendTo( this.liveRegion ); 2830 } 2831 }, 2832 menuselect: function( event, ui ) { 2833 var item = ui.item.data( "ui-autocomplete-item" ), 2834 previous = this.previous; 2835 2836 // only trigger when focus was lost (click on menu) 2837 if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { 2838 this.element.focus(); 2839 this.previous = previous; 2840 // #6109 - IE triggers two focus events and the second 2841 // is asynchronous, so we need to reset the previous 2842 // term synchronously and asynchronously :-( 2843 this._delay(function() { 2844 this.previous = previous; 2845 this.selectedItem = item; 2846 }); 2847 } 2848 2849 if ( false !== this._trigger( "select", event, { item: item } ) ) { 2850 this._value( item.value ); 2851 } 2852 // reset the term after the select event 2853 // this allows custom select handling to work properly 2854 this.term = this._value(); 2855 2856 this.close( event ); 2857 this.selectedItem = item; 2858 } 2859 }); 2860 2861 this.liveRegion = $( "<span>", { 2862 role: "status", 2863 "aria-live": "assertive", 2864 "aria-relevant": "additions" 2865 }) 2866 .addClass( "ui-helper-hidden-accessible" ) 2867 .appendTo( this.document[ 0 ].body ); 2868 2869 // turning off autocomplete prevents the browser from remembering the 2870 // value when navigating through history, so we re-enable autocomplete 2871 // if the page is unloaded before the widget is destroyed. #7790 2872 this._on( this.window, { 2873 beforeunload: function() { 2874 this.element.removeAttr( "autocomplete" ); 2875 } 2876 }); 2877 }, 2878 2879 _destroy: function() { 2880 clearTimeout( this.searching ); 2881 this.element 2882 .removeClass( "ui-autocomplete-input" ) 2883 .removeAttr( "autocomplete" ); 2884 this.menu.element.remove(); 2885 this.liveRegion.remove(); 2886 }, 2887 2888 _setOption: function( key, value ) { 2889 this._super( key, value ); 2890 if ( key === "source" ) { 2891 this._initSource(); 2892 } 2893 if ( key === "appendTo" ) { 2894 this.menu.element.appendTo( this._appendTo() ); 2895 } 2896 if ( key === "disabled" && value && this.xhr ) { 2897 this.xhr.abort(); 2898 } 2899 }, 2900 2901 _appendTo: function() { 2902 var element = this.options.appendTo; 2903 2904 if ( element ) { 2905 element = element.jquery || element.nodeType ? 2906 $( element ) : 2907 this.document.find( element ).eq( 0 ); 2908 } 2909 2910 if ( !element || !element[ 0 ] ) { 2911 element = this.element.closest( ".ui-front" ); 2912 } 2913 2914 if ( !element.length ) { 2915 element = this.document[ 0 ].body; 2916 } 2917 2918 return element; 2919 }, 2920 2921 _initSource: function() { 2922 var array, url, 2923 that = this; 2924 if ( $.isArray( this.options.source ) ) { 2925 array = this.options.source; 2926 this.source = function( request, response ) { 2927 response( $.ui.autocomplete.filter( array, request.term ) ); 2928 }; 2929 } else if ( typeof this.options.source === "string" ) { 2930 url = this.options.source; 2931 this.source = function( request, response ) { 2932 if ( that.xhr ) { 2933 that.xhr.abort(); 2934 } 2935 that.xhr = $.ajax({ 2936 url: url, 2937 data: request, 2938 dataType: "json", 2939 success: function( data ) { 2940 response( data ); 2941 }, 2942 error: function() { 2943 response([]); 2944 } 2945 }); 2946 }; 2947 } else { 2948 this.source = this.options.source; 2949 } 2950 }, 2951 2952 _searchTimeout: function( event ) { 2953 clearTimeout( this.searching ); 2954 this.searching = this._delay(function() { 2955 2956 // Search if the value has changed, or if the user retypes the same value (see #7434) 2957 var equalValues = this.term === this._value(), 2958 menuVisible = this.menu.element.is( ":visible" ), 2959 modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; 2960 2961 if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { 2962 this.selectedItem = null; 2963 this.search( null, event ); 2964 } 2965 }, this.options.delay ); 2966 }, 2967 2968 search: function( value, event ) { 2969 value = value != null ? value : this._value(); 2970 2971 // always save the actual value, not the one passed as an argument 2972 this.term = this._value(); 2973 2974 if ( value.length < this.options.minLength ) { 2975 return this.close( event ); 2976 } 2977 2978 if ( this._trigger( "search", event ) === false ) { 2979 return; 2980 } 2981 2982 return this._search( value ); 2983 }, 2984 2985 _search: function( value ) { 2986 this.pending++; 2987 this.element.addClass( "ui-autocomplete-loading" ); 2988 this.cancelSearch = false; 2989 2990 this.source( { term: value }, this._response() ); 2991 }, 2992 2993 _response: function() { 2994 var index = ++this.requestIndex; 2995 2996 return $.proxy(function( content ) { 2997 if ( index === this.requestIndex ) { 2998 this.__response( content ); 2999 } 3000 3001 this.pending--; 3002 if ( !this.pending ) { 3003 this.element.removeClass( "ui-autocomplete-loading" ); 3004 } 3005 }, this ); 3006 }, 3007 3008 __response: function( content ) { 3009 if ( content ) { 3010 content = this._normalize( content ); 3011 } 3012 this._trigger( "response", null, { content: content } ); 3013 if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { 3014 this._suggest( content ); 3015 this._trigger( "open" ); 3016 } else { 3017 // use ._close() instead of .close() so we don't cancel future searches 3018 this._close(); 3019 } 3020 }, 3021 3022 close: function( event ) { 3023 this.cancelSearch = true; 3024 this._close( event ); 3025 }, 3026 3027 _close: function( event ) { 3028 if ( this.menu.element.is( ":visible" ) ) { 3029 this.menu.element.hide(); 3030 this.menu.blur(); 3031 this.isNewMenu = true; 3032 this._trigger( "close", event ); 3033 } 3034 }, 3035 3036 _change: function( event ) { 3037 if ( this.previous !== this._value() ) { 3038 this._trigger( "change", event, { item: this.selectedItem } ); 3039 } 3040 }, 3041 3042 _normalize: function( items ) { 3043 // assume all items have the right format when the first item is complete 3044 if ( items.length && items[ 0 ].label && items[ 0 ].value ) { 3045 return items; 3046 } 3047 return $.map( items, function( item ) { 3048 if ( typeof item === "string" ) { 3049 return { 3050 label: item, 3051 value: item 3052 }; 3053 } 3054 return $.extend( {}, item, { 3055 label: item.label || item.value, 3056 value: item.value || item.label 3057 }); 3058 }); 3059 }, 3060 3061 _suggest: function( items ) { 3062 var ul = this.menu.element.empty(); 3063 this._renderMenu( ul, items ); 3064 this.isNewMenu = true; 3065 this.menu.refresh(); 3066 3067 // size and position menu 3068 ul.show(); 3069 this._resizeMenu(); 3070 ul.position( $.extend({ 3071 of: this.element 3072 }, this.options.position ) ); 3073 3074 if ( this.options.autoFocus ) { 3075 this.menu.next(); 3076 } 3077 }, 3078 3079 _resizeMenu: function() { 3080 var ul = this.menu.element; 3081 ul.outerWidth( Math.max( 3082 // Firefox wraps long text (possibly a rounding bug) 3083 // so we add 1px to avoid the wrapping (#7513) 3084 ul.width( "" ).outerWidth() + 1, 3085 this.element.outerWidth() 3086 ) ); 3087 }, 3088 3089 _renderMenu: function( ul, items ) { 3090 var that = this; 3091 $.each( items, function( index, item ) { 3092 that._renderItemData( ul, item ); 3093 }); 3094 }, 3095 3096 _renderItemData: function( ul, item ) { 3097 return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); 3098 }, 3099 3100 _renderItem: function( ul, item ) { 3101 return $( "<li>" ).text( item.label ).appendTo( ul ); 3102 }, 3103 3104 _move: function( direction, event ) { 3105 if ( !this.menu.element.is( ":visible" ) ) { 3106 this.search( null, event ); 3107 return; 3108 } 3109 if ( this.menu.isFirstItem() && /^previous/.test( direction ) || 3110 this.menu.isLastItem() && /^next/.test( direction ) ) { 3111 3112 if ( !this.isMultiLine ) { 3113 this._value( this.term ); 3114 } 3115 3116 this.menu.blur(); 3117 return; 3118 } 3119 this.menu[ direction ]( event ); 3120 }, 3121 3122 widget: function() { 3123 return this.menu.element; 3124 }, 3125 3126 _value: function() { 3127 return this.valueMethod.apply( this.element, arguments ); 3128 }, 3129 3130 _keyEvent: function( keyEvent, event ) { 3131 if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { 3132 this._move( keyEvent, event ); 3133 3134 // prevents moving cursor to beginning/end of the text field in some browsers 3135 event.preventDefault(); 3136 } 3137 } 3138}); 3139 3140$.extend( $.ui.autocomplete, { 3141 escapeRegex: function( value ) { 3142 return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); 3143 }, 3144 filter: function( array, term ) { 3145 var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); 3146 return $.grep( array, function( value ) { 3147 return matcher.test( value.label || value.value || value ); 3148 }); 3149 } 3150}); 3151 3152// live region extension, adding a `messages` option 3153// NOTE: This is an experimental API. We are still investigating 3154// a full solution for string manipulation and internationalization. 3155$.widget( "ui.autocomplete", $.ui.autocomplete, { 3156 options: { 3157 messages: { 3158 noResults: "No search results.", 3159 results: function( amount ) { 3160 return amount + ( amount > 1 ? " results are" : " result is" ) + 3161 " available, use up and down arrow keys to navigate."; 3162 } 3163 } 3164 }, 3165 3166 __response: function( content ) { 3167 var message; 3168 this._superApply( arguments ); 3169 if ( this.options.disabled || this.cancelSearch ) { 3170 return; 3171 } 3172 if ( content && content.length ) { 3173 message = this.options.messages.results( content.length ); 3174 } else { 3175 message = this.options.messages.noResults; 3176 } 3177 this.liveRegion.children().hide(); 3178 $( "<div>" ).text( message ).appendTo( this.liveRegion ); 3179 } 3180}); 3181 3182var autocomplete = $.ui.autocomplete; 3183 3184 3185/*! 3186 * jQuery UI
vendor: 12,563 bytes, lines 3186-3657
3186Tabs 1.11.4 3187 * http://jqueryui.com 3188 * 3189 * Copyright jQuery Foundation and other contributors 3190 * Released under the MIT license. 3191 * http://jquery.org/license 3192 * 3193 * http://api.jqueryui.com/tabs/ 3194 */ 3195 3196 3197var tabs = $.widget( "ui.tabs", { 3198 version: "1.11.4", 3199 delay: 300, 3200 options: { 3201 active: null, 3202 collapsible: false, 3203 event: "click", 3204 heightStyle: "content", 3205 hide: null, 3206 show: null, 3207 3208 // callbacks 3209 activate: null, 3210 beforeActivate: null, 3211 beforeLoad: null, 3212 load: null 3213 }, 3214 3215 _isLocal: (function() { 3216 var rhash = /#.*$/; 3217 3218 return function( anchor ) { 3219 var anchorUrl, locationUrl; 3220 3221 // support: IE7 3222 // IE7 doesn't normalize the href property when set via script (#9317) 3223 anchor = anchor.cloneNode( false ); 3224 3225 anchorUrl = anchor.href.replace( rhash, "" ); 3226 locationUrl = location.href.replace( rhash, "" ); 3227 3228 // decoding may throw an error if the URL isn't UTF-8 (#9518) 3229 try { 3230 anchorUrl = decodeURIComponent( anchorUrl ); 3231 } catch ( error ) {} 3232 try { 3233 locationUrl = decodeURIComponent( locationUrl ); 3234 } catch ( error ) {} 3235 3236 return anchor.hash.length > 1 && anchorUrl === locationUrl; 3237 }; 3238 })(), 3239 3240 _create: function() { 3241 var that = this, 3242 options = this.options; 3243 3244 this.running = false; 3245 3246 this.element 3247 .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) 3248 .toggleClass( "ui-tabs-collapsible", options.collapsible ); 3249 3250 this._processTabs(); 3251 options.active = this._initialActive(); 3252 3253 // Take disabling tabs via class attribute from HTML 3254 // into account and update option properly. 3255 if ( $.isArray( options.disabled ) ) { 3256 options.disabled = $.unique( options.disabled.concat( 3257 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 3258 return that.tabs.index( li ); 3259 }) 3260 ) ).sort(); 3261 } 3262 3263 // check for length avoids error when initializing empty list 3264 if ( this.options.active !== false && this.anchors.length ) { 3265 this.active = this._findActive( options.active ); 3266 } else { 3267 this.active = $(); 3268 } 3269 3270 this._refresh(); 3271 3272 if ( this.active.length ) { 3273 this.load( options.active ); 3274 } 3275 }, 3276 3277 _initialActive: function() { 3278 var active = this.options.active, 3279 collapsible = this.options.collapsible, 3280 locationHash = location.hash.substring( 1 ); 3281 3282 if ( active === null ) { 3283 // check the fragment identifier in the URL 3284 if ( locationHash ) { 3285 this.tabs.each(function( i, tab ) { 3286 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 3287 active = i; 3288 return false; 3289 } 3290 }); 3291 } 3292 3293 // check for a tab marked active via a class 3294 if ( active === null ) { 3295 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 3296 } 3297 3298 // no active tab, set to false 3299 if ( active === null || active === -1 ) { 3300 active = this.tabs.length ? 0 : false; 3301 } 3302 } 3303 3304 // handle numbers: negative, out of range 3305 if ( active !== false ) { 3306 active = this.tabs.index( this.tabs.eq( active ) ); 3307 if ( active === -1 ) { 3308 active = collapsible ? false : 0; 3309 } 3310 } 3311 3312 // don't allow collapsible: false and active: false 3313 if ( !collapsible && active === false && this.anchors.length ) { 3314 active = 0; 3315 } 3316 3317 return active; 3318 }, 3319 3320 _getCreateEventData: function() { 3321 return { 3322 tab: this.active, 3323 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 3324 }; 3325 }, 3326 3327 _tabKeydown: function( event ) { 3328 var focusedTab = $( this.document[0].activeElement ).closest( "li" ), 3329 selectedIndex = this.tabs.index( focusedTab ), 3330 goingForward = true; 3331 3332 if ( this._handlePageNav( event ) ) { 3333 return; 3334 } 3335 3336 switch ( event.keyCode ) { 3337 case $.ui.keyCode.RIGHT: 3338 case $.ui.keyCode.DOWN: 3339 selectedIndex++; 3340 break; 3341 case $.ui.keyCode.UP: 3342 case $.ui.keyCode.LEFT: 3343 goingForward = false; 3344 selectedIndex--; 3345 break; 3346 case $.ui.keyCode.END: 3347 selectedIndex = this.anchors.length - 1; 3348 break; 3349 case $.ui.keyCode.HOME: 3350 selectedIndex = 0; 3351 break; 3352 case $.ui.keyCode.SPACE: 3353 // Activate only, no collapsing 3354 event.preventDefault(); 3355 clearTimeout( this.activating ); 3356 this._activate( selectedIndex ); 3357 return; 3358 case $.ui.keyCode.ENTER: 3359 // Toggle (cancel delayed activation, allow collapsing) 3360 event.preventDefault(); 3361 clearTimeout( this.activating ); 3362 // Determine if we should collapse or activate 3363 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 3364 return; 3365 default: 3366 return; 3367 } 3368 3369 // Focus the appropriate tab, based on which key was pressed 3370 event.preventDefault(); 3371 clearTimeout( this.activating ); 3372 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 3373 3374 // Navigating with control/command key will prevent automatic activation 3375 if ( !event.ctrlKey && !event.metaKey ) { 3376 3377 // Update aria-selected immediately so that AT think the tab is already selected. 3378 // Otherwise AT may confuse the user by stating that they need to activate the tab, 3379 // but the tab will already be activated by the time the announcement finishes. 3380 focusedTab.attr( "aria-selected", "false" ); 3381 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 3382 3383 this.activating = this._delay(function() { 3384 this.option( "active", selectedIndex ); 3385 }, this.delay ); 3386 } 3387 }, 3388 3389 _panelKeydown: function( event ) { 3390 if ( this._handlePageNav( event ) ) { 3391 return; 3392 } 3393 3394 // Ctrl+up moves focus to the current tab 3395 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 3396 event.preventDefault(); 3397 this.active.focus(); 3398 } 3399 }, 3400 3401 // Alt+page up/down moves focus to the previous/next tab (and activates) 3402 _handlePageNav: function( event ) { 3403 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 3404 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 3405 return true; 3406 } 3407 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 3408 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 3409 return true; 3410 } 3411 }, 3412 3413 _findNextTab: function( index, goingForward ) { 3414 var lastTabIndex = this.tabs.length - 1; 3415 3416 function constrain() { 3417 if ( index > lastTabIndex ) { 3418 index = 0; 3419 } 3420 if ( index < 0 ) { 3421 index = lastTabIndex; 3422 } 3423 return index; 3424 } 3425 3426 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 3427 index = goingForward ? index + 1 : index - 1; 3428 } 3429 3430 return index; 3431 }, 3432 3433 _focusNextTab: function( index, goingForward ) { 3434 index = this._findNextTab( index, goingForward ); 3435 this.tabs.eq( index ).focus(); 3436 return index; 3437 }, 3438 3439 _setOption: function( key, value ) { 3440 if ( key === "active" ) { 3441 // _activate() will handle invalid values and update this.options 3442 this._activate( value ); 3443 return; 3444 } 3445 3446 if ( key === "disabled" ) { 3447 // don't use the widget factory's disabled handling 3448 this._setupDisabled( value ); 3449 return; 3450 } 3451 3452 this._super( key, value); 3453 3454 if ( key === "collapsible" ) { 3455 this.element.toggleClass( "ui-tabs-collapsible", value ); 3456 // Setting collapsible: false while collapsed; open first panel 3457 if ( !value && this.options.active === false ) { 3458 this._activate( 0 ); 3459 } 3460 } 3461 3462 if ( key === "event" ) { 3463 this._setupEvents( value ); 3464 } 3465 3466 if ( key === "heightStyle" ) { 3467 this._setupHeightStyle( value ); 3468 } 3469 }, 3470 3471 _sanitizeSelector: function( hash ) { 3472 return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; 3473 }, 3474 3475 refresh: function() { 3476 var options = this.options, 3477 lis = this.tablist.children( ":has(a[href])" ); 3478 3479 // get disabled tabs from class attribute from HTML 3480 // this will get converted to a boolean if needed in _refresh() 3481 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 3482 return lis.index( tab ); 3483 }); 3484 3485 this._processTabs(); 3486 3487 // was collapsed or no tabs 3488 if ( options.active === false || !this.anchors.length ) { 3489 options.active = false; 3490 this.active = $(); 3491 // was active, but active tab is gone 3492 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 3493 // all remaining tabs are disabled 3494 if ( this.tabs.length === options.disabled.length ) { 3495 options.active = false; 3496 this.active = $(); 3497 // activate previous tab 3498 } else { 3499 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 3500 } 3501 // was active, active tab still exists 3502 } else { 3503 // make sure active index is correct 3504 options.active = this.tabs.index( this.active ); 3505 } 3506 3507 this._refresh(); 3508 }, 3509 3510 _refresh: function() { 3511 this._setupDisabled( this.options.disabled ); 3512 this._setupEvents( this.options.event ); 3513 this._setupHeightStyle( this.options.heightStyle ); 3514 3515 this.tabs.not( this.active ).attr({ 3516 "aria-selected": "false", 3517 "aria-expanded": "false", 3518 tabIndex: -1 3519 }); 3520 this.panels.not( this._getPanelForTab( this.active ) ) 3521 .hide() 3522 .attr({ 3523 "aria-hidden": "true" 3524 }); 3525 3526 // Make sure one tab is in the tab order 3527 if ( !this.active.length ) { 3528 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 3529 } else { 3530 this.active 3531 .addClass( "ui-tabs-active ui-state-active" ) 3532 .attr({ 3533 "aria-selected": "true", 3534 "aria-expanded": "true", 3535 tabIndex: 0 3536 }); 3537 this._getPanelForTab( this.active ) 3538 .show() 3539 .attr({ 3540 "aria-hidden": "false" 3541 }); 3542 } 3543 }, 3544 3545 _processTabs: function() { 3546 var that = this, 3547 prevTabs = this.tabs, 3548 prevAnchors = this.anchors, 3549 prevPanels = this.panels; 3550 3551 this.tablist = this._getList() 3552 .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) 3553 .attr( "role", "tablist" ) 3554 3555 // Prevent users from focusing disabled tabs via click 3556 .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) { 3557 if ( $( this ).is( ".ui-state-disabled" ) ) { 3558 event.preventDefault(); 3559 } 3560 }) 3561 3562 // support: IE <9 3563 // Preventing the default action in mousedown doesn't prevent IE 3564 // from focusing the element, so if the anchor gets focused, blur. 3565 // We don't have to worry about focusing the previously focused 3566 // element since clicking on a non-focusable element should focus 3567 // the body anyway. 3568 .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { 3569 if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { 3570 this.blur(); 3571 } 3572 }); 3573 3574 this.tabs = this.tablist.find( "> li:has(a[href])" ) 3575 .addClass( "ui-state-default ui-corner-top" ) 3576 .attr({ 3577 role: "tab", 3578 tabIndex: -1 3579 }); 3580 3581 this.anchors = this.tabs.map(function() { 3582 return $( "a", this )[ 0 ]; 3583 }) 3584 .addClass( "ui-tabs-anchor" ) 3585 .attr({ 3586 role: "presentation", 3587 tabIndex: -1 3588 }); 3589 3590 this.panels = $(); 3591 3592 this.anchors.each(function( i, anchor ) { 3593 var selector, panel, panelId, 3594 anchorId = $( anchor ).uniqueId().attr( "id" ), 3595 tab = $( anchor ).closest( "li" ), 3596 originalAriaControls = tab.attr( "aria-controls" ); 3597 3598 // inline tab 3599 if ( that._isLocal( anchor ) ) { 3600 selector = anchor.hash; 3601 panelId = selector.substring( 1 ); 3602 panel = that.element.find( that._sanitizeSelector( selector ) ); 3603 // remote tab 3604 } else { 3605 // If the tab doesn't already have aria-controls, 3606 // generate an id by using a throw-away element 3607 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 3608 selector = "#" + panelId; 3609 panel = that.element.find( selector ); 3610 if ( !panel.length ) { 3611 panel = that._createPanel( panelId ); 3612 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 3613 } 3614 panel.attr( "aria-live", "polite" ); 3615 } 3616 3617 if ( panel.length) { 3618 that.panels = that.panels.add( panel ); 3619 } 3620 if ( originalAriaControls ) { 3621 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 3622 } 3623 tab.attr({ 3624 "aria-controls": panelId, 3625 "aria-labelledby": anchorId 3626 }); 3627 panel.attr( "aria-labelledby", anchorId ); 3628 }); 3629 3630 this.panels 3631 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 3632 .attr( "role", "tabpanel" ); 3633 3634 // Avoid memory leaks (#10056) 3635 if ( prevTabs ) { 3636 this._off( prevTabs.not( this.tabs ) ); 3637 this._off( prevAnchors.not( this.anchors ) ); 3638 this._off( prevPanels.not( this.panels ) ); 3639 } 3640 }, 3641 3642 // allow overriding how to find the list for rare usage scenarios (#7715) 3643 _getList: function() { 3644 return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); 3645 }, 3646 3647 _createPanel: function( id ) { 3648 return $( "<div>" ) 3649 .attr( "id", id ) 3650 .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) 3651 .data( "ui-tabs-destroy", true ); 3652 }, 3653 3654 _setupDisabled: function( disabled ) { 3655 if ( $.isArray( disabled ) ) { 3656 if ( !disabled.length ) { 3657 disabled = false;
vendor: 8,633 bytes, lines 3658-3990
3658 } else if ( disabled.length === this.anchors.length ) { 3659 disabled = true; 3660 } 3661 } 3662 3663 // disable tabs 3664 for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { 3665 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 3666 $( li ) 3667 .addClass( "ui-state-disabled" ) 3668 .attr( "aria-disabled", "true" ); 3669 } else { 3670 $( li ) 3671 .removeClass( "ui-state-disabled" ) 3672 .removeAttr( "aria-disabled" ); 3673 } 3674 } 3675 3676 this.options.disabled = disabled; 3677 }, 3678 3679 _setupEvents: function( event ) { 3680 var events = {}; 3681 if ( event ) { 3682 $.each( event.split(" "), function( index, eventName ) { 3683 events[ eventName ] = "_eventHandler"; 3684 }); 3685 } 3686 3687 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 3688 // Always prevent the default action, even when disabled 3689 this._on( true, this.anchors, { 3690 click: function( event ) { 3691 event.preventDefault(); 3692 } 3693 }); 3694 this._on( this.anchors, events ); 3695 this._on( this.tabs, { keydown: "_tabKeydown" } ); 3696 this._on( this.panels, { keydown: "_panelKeydown" } ); 3697 3698 this._focusable( this.tabs ); 3699 this._hoverable( this.tabs ); 3700 }, 3701 3702 _setupHeightStyle: function( heightStyle ) { 3703 var maxHeight, 3704 parent = this.element.parent(); 3705 3706 if ( heightStyle === "fill" ) { 3707 maxHeight = parent.height(); 3708 maxHeight -= this.element.outerHeight() - this.element.height(); 3709 3710 this.element.siblings( ":visible" ).each(function() { 3711 var elem = $( this ), 3712 position = elem.css( "position" ); 3713 3714 if ( position === "absolute" || position === "fixed" ) { 3715 return; 3716 } 3717 maxHeight -= elem.outerHeight( true ); 3718 }); 3719 3720 this.element.children().not( this.panels ).each(function() { 3721 maxHeight -= $( this ).outerHeight( true ); 3722 }); 3723 3724 this.panels.each(function() { 3725 $( this ).height( Math.max( 0, maxHeight - 3726 $( this ).innerHeight() + $( this ).height() ) ); 3727 }) 3728 .css( "overflow", "auto" ); 3729 } else if ( heightStyle === "auto" ) { 3730 maxHeight = 0; 3731 this.panels.each(function() { 3732 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 3733 }).height( maxHeight ); 3734 } 3735 }, 3736 3737 _eventHandler: function( event ) { 3738 var options = this.options, 3739 active = this.active, 3740 anchor = $( event.currentTarget ), 3741 tab = anchor.closest( "li" ), 3742 clickedIsActive = tab[ 0 ] === active[ 0 ], 3743 collapsing = clickedIsActive && options.collapsible, 3744 toShow = collapsing ? $() : this._getPanelForTab( tab ), 3745 toHide = !active.length ? $() : this._getPanelForTab( active ), 3746 eventData = { 3747 oldTab: active, 3748 oldPanel: toHide, 3749 newTab: collapsing ? $() : tab, 3750 newPanel: toShow 3751 }; 3752 3753 event.preventDefault(); 3754 3755 if ( tab.hasClass( "ui-state-disabled" ) || 3756 // tab is already loading 3757 tab.hasClass( "ui-tabs-loading" ) || 3758 // can't switch durning an animation 3759 this.running || 3760 // click on active header, but not collapsible 3761 ( clickedIsActive && !options.collapsible ) || 3762 // allow canceling activation 3763 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 3764 return; 3765 } 3766 3767 options.active = collapsing ? false : this.tabs.index( tab ); 3768 3769 this.active = clickedIsActive ? $() : tab; 3770 if ( this.xhr ) { 3771 this.xhr.abort(); 3772 } 3773 3774 if ( !toHide.length && !toShow.length ) { 3775 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 3776 } 3777 3778 if ( toShow.length ) { 3779 this.load( this.tabs.index( tab ), event ); 3780 } 3781 this._toggle( event, eventData ); 3782 }, 3783 3784 // handles show/hide for selecting tabs 3785 _toggle: function( event, eventData ) { 3786 var that = this, 3787 toShow = eventData.newPanel, 3788 toHide = eventData.oldPanel; 3789 3790 this.running = true; 3791 3792 function complete() { 3793 that.running = false; 3794 that._trigger( "activate", event, eventData ); 3795 } 3796 3797 function show() { 3798 eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); 3799 3800 if ( toShow.length && that.options.show ) { 3801 that._show( toShow, that.options.show, complete ); 3802 } else { 3803 toShow.show(); 3804 complete(); 3805 } 3806 } 3807 3808 // start out by hiding, then showing, then completing 3809 if ( toHide.length && this.options.hide ) { 3810 this._hide( toHide, this.options.hide, function() { 3811 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); 3812 show(); 3813 }); 3814 } else { 3815 eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); 3816 toHide.hide(); 3817 show(); 3818 } 3819 3820 toHide.attr( "aria-hidden", "true" ); 3821 eventData.oldTab.attr({ 3822 "aria-selected": "false", 3823 "aria-expanded": "false" 3824 }); 3825 // If we're switching tabs, remove the old tab from the tab order. 3826 // If we're opening from collapsed state, remove the previous tab from the tab order. 3827 // If we're collapsing, then keep the collapsing tab in the tab order. 3828 if ( toShow.length && toHide.length ) { 3829 eventData.oldTab.attr( "tabIndex", -1 ); 3830 } else if ( toShow.length ) { 3831 this.tabs.filter(function() { 3832 return $( this ).attr( "tabIndex" ) === 0; 3833 }) 3834 .attr( "tabIndex", -1 ); 3835 } 3836 3837 toShow.attr( "aria-hidden", "false" ); 3838 eventData.newTab.attr({ 3839 "aria-selected": "true", 3840 "aria-expanded": "true", 3841 tabIndex: 0 3842 }); 3843 }, 3844 3845 _activate: function( index ) { 3846 var anchor, 3847 active = this._findActive( index ); 3848 3849 // trying to activate the already active panel 3850 if ( active[ 0 ] === this.active[ 0 ] ) { 3851 return; 3852 } 3853 3854 // trying to collapse, simulate a click on the current active header 3855 if ( !active.length ) { 3856 active = this.active; 3857 } 3858 3859 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 3860 this._eventHandler({ 3861 target: anchor, 3862 currentTarget: anchor, 3863 preventDefault: $.noop 3864 }); 3865 }, 3866 3867 _findActive: function( index ) { 3868 return index === false ? $() : this.tabs.eq( index ); 3869 }, 3870 3871 _getIndex: function( index ) { 3872 // meta-function to give users option to provide a href string instead of a numerical index. 3873 if ( typeof index === "string" ) { 3874 index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); 3875 } 3876 3877 return index; 3878 }, 3879 3880 _destroy: function() { 3881 if ( this.xhr ) { 3882 this.xhr.abort(); 3883 } 3884 3885 this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); 3886 3887 this.tablist 3888 .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) 3889 .removeAttr( "role" ); 3890 3891 this.anchors 3892 .removeClass( "ui-tabs-anchor" ) 3893 .removeAttr( "role" ) 3894 .removeAttr( "tabIndex" ) 3895 .removeUniqueId(); 3896 3897 this.tablist.unbind( this.eventNamespace ); 3898 3899 this.tabs.add( this.panels ).each(function() { 3900 if ( $.data( this, "ui-tabs-destroy" ) ) { 3901 $( this ).remove(); 3902 } else { 3903 $( this ) 3904 .removeClass( "ui-state-default ui-state-active ui-state-disabled " + 3905 "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) 3906 .removeAttr( "tabIndex" ) 3907 .removeAttr( "aria-live" ) 3908 .removeAttr( "aria-busy" ) 3909 .removeAttr( "aria-selected" ) 3910 .removeAttr( "aria-labelledby" ) 3911 .removeAttr( "aria-hidden" ) 3912 .removeAttr( "aria-expanded" ) 3913 .removeAttr( "role" ); 3914 } 3915 }); 3916 3917 this.tabs.each(function() { 3918 var li = $( this ), 3919 prev = li.data( "ui-tabs-aria-controls" ); 3920 if ( prev ) { 3921 li 3922 .attr( "aria-controls", prev ) 3923 .removeData( "ui-tabs-aria-controls" ); 3924 } else { 3925 li.removeAttr( "aria-controls" ); 3926 } 3927 }); 3928 3929 this.panels.show(); 3930 3931 if ( this.options.heightStyle !== "content" ) { 3932 this.panels.css( "height", "" ); 3933 } 3934 }, 3935 3936 enable: function( index ) { 3937 var disabled = this.options.disabled; 3938 if ( disabled === false ) { 3939 return; 3940 } 3941 3942 if ( index === undefined ) { 3943 disabled = false; 3944 } else { 3945 index = this._getIndex( index ); 3946 if ( $.isArray( disabled ) ) { 3947 disabled = $.map( disabled, function( num ) { 3948 return num !== index ? num : null; 3949 }); 3950 } else { 3951 disabled = $.map( this.tabs, function( li, num ) { 3952 return num !== index ? num : null; 3953 }); 3954 } 3955 } 3956 this._setupDisabled( disabled ); 3957 }, 3958 3959 disable: function( index ) { 3960 var disabled = this.options.disabled; 3961 if ( disabled === true ) { 3962 return; 3963 } 3964 3965 if ( index === undefined ) { 3966 disabled = true; 3967 } else { 3968 index = this._getIndex( index ); 3969 if ( $.inArray( index, disabled ) !== -1 ) { 3970 return; 3971 } 3972 if ( $.isArray( disabled ) ) { 3973 disabled = $.merge( [ index ], disabled ).sort(); 3974 } else { 3975 disabled = [ index ]; 3976 } 3977 } 3978 this._setupDisabled( disabled ); 3979 }, 3980 3981 load: function( index, event ) { 3982 index = this._getIndex( index ); 3983 var that = this, 3984 tab = this.tabs.eq( index ), 3985 anchor = tab.find( ".ui-tabs-anchor" ), 3986 panel = this._getPanelForTab( tab ), 3987 eventData = { 3988 tab: tab, 3989 panel: panel 3990 }
vendor: 1,660 bytes, lines 3990-4058
3990, 3991 complete = function( jqXHR, status ) { 3992 if ( status === "abort" ) { 3993 that.panels.stop( false, true ); 3994 } 3995 3996 tab.removeClass( "ui-tabs-loading" ); 3997 panel.removeAttr( "aria-busy" ); 3998 3999 if ( jqXHR === that.xhr ) { 4000 delete that.xhr; 4001 } 4002 }; 4003 4004 // not remote 4005 if ( this._isLocal( anchor[ 0 ] ) ) { 4006 return; 4007 } 4008 4009 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 4010 4011 // support: jQuery <1.8 4012 // jQuery <1.8 returns false if the request is canceled in beforeSend, 4013 // but as of 1.8, $.ajax() always returns a jqXHR object. 4014 if ( this.xhr && this.xhr.statusText !== "canceled" ) { 4015 tab.addClass( "ui-tabs-loading" ); 4016 panel.attr( "aria-busy", "true" ); 4017 4018 this.xhr 4019 .done(function( response, status, jqXHR ) { 4020 // support: jQuery <1.8 4021 // http://bugs.jquery.com/ticket/11778 4022 setTimeout(function() { 4023 panel.html( response ); 4024 that._trigger( "load", event, eventData ); 4025 4026 complete( jqXHR, status ); 4027 }, 1 ); 4028 }) 4029 .fail(function( jqXHR, status ) { 4030 // support: jQuery <1.8 4031 // http://bugs.jquery.com/ticket/11778 4032 setTimeout(function() { 4033 complete( jqXHR, status ); 4034 }, 1 ); 4035 }); 4036 } 4037 }, 4038 4039 _ajaxSettings: function( anchor, event, eventData ) { 4040 var that = this; 4041 return { 4042 url: anchor.attr( "href" ), 4043 beforeSend: function( jqXHR, settings ) { 4044 return that._trigger( "beforeLoad", event, 4045 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 4046 } 4047 }; 4048 }, 4049 4050 _getPanelForTab: function( tab ) { 4051 var id = $( tab ).attr( "aria-controls" ); 4052 return this.element.find( this._sanitizeSelector( "#" + id ) ); 4053 } 4054}); 4055 4056 4057 4058}));
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.