vendor: 8,453 bytes, lines 1-266
1/*! jQuery UI - v1.12.1+CommonJS - 2018-02-10 2 * http://jqueryui.com 3 * Includes: widget.js 4 * Copyright 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 if ( typeof exports === "object" ) { 12 13 // Node/CommonJS 14 factory( require( "jquery" ) ); 15 } else { 16 17 // Browser globals 18 factory( jQuery ); 19 } 20}(function( $ ) { 21 22 $.ui = $.ui || {}; 23 24 var version = $.ui.version = "1.12.1"; 25 26 27 /*! 28 * jQuery UI Widget 1.12.1 29 * http://jqueryui.com 30 * 31 * Copyright jQuery Foundation and other contributors 32 * Released under the MIT license. 33 * http://jquery.org/license 34 */ 35 36 //>>label: Widget 37 //>>group: Core 38 //>>description: Provides a factory for creating stateful widgets with a common API. 39 //>>docs: http://api.jqueryui.com/jQuery.widget/ 40 //>>demos: http://jqueryui.com/widget/ 41 42 43 44 var widgetUuid = 0; 45 var widgetSlice = Array.prototype.slice; 46 47 $.cleanData = ( function( orig ) { 48 return function( elems ) { 49 var events, elem, i; 50 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 51 try { 52 53 // Only trigger remove when necessary to save time 54 events = $._data( elem, "events" ); 55 if ( events && events.remove ) { 56 $( elem ).triggerHandler( "remove" ); 57 } 58 59 // Http://bugs.jquery.com/ticket/8235 60 } catch ( e ) {} 61 } 62 orig( elems ); 63 }; 64 } )( $.cleanData ); 65 66 $.widget = function( name, base, prototype ) { 67 var existingConstructor, constructor, basePrototype; 68 69 // ProxiedPrototype allows the provided prototype to remain unmodified 70 // so that it can be used as a mixin for multiple widgets (#8876) 71 var proxiedPrototype = {}; 72 73 var namespace = name.split( "." )[ 0 ]; 74 name = name.split( "." )[ 1 ]; 75 var fullName = namespace + "-" + name; 76 77 if ( !prototype ) { 78 prototype = base; 79 base = $.Widget; 80 } 81 82 if ( $.isArray( prototype ) ) { 83 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 84 } 85 86 // Create selector for plugin 87 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 88 return !!$.data( elem, fullName ); 89 }; 90 91 $[ namespace ] = $[ namespace ] || {}; 92 existingConstructor = $[ namespace ][ name ]; 93 constructor = $[ namespace ][ name ] = function( options, element ) { 94 95 // Allow instantiation without "new" keyword 96 if ( !this._createWidget ) { 97 return new constructor( options, element ); 98 } 99 100 // Allow instantiation without initializing for simple inheritance 101 // must use "new" keyword (the code above always passes args) 102 if ( arguments.length ) { 103 this._createWidget( options, element ); 104 } 105 }; 106 107 // Extend with the existing constructor to carry over any static properties 108 $.extend( constructor, existingConstructor, { 109 version: prototype.version, 110 111 // Copy the object used to create the prototype in case we need to 112 // redefine the widget later 113 _proto: $.extend( {}, prototype ), 114 115 // Track widgets that inherit from this widget in case this widget is 116 // redefined after a widget inherits from it 117 _childConstructors: [] 118 } ); 119 120 basePrototype = new base(); 121 122 // We need to make the options hash a property directly on the new instance 123 // otherwise we'll modify the options hash on the prototype that we're 124 // inheriting from 125 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 126 $.each( prototype, function( prop, value ) { 127 if ( !$.isFunction( value ) ) { 128 proxiedPrototype[ prop ] = value; 129 return; 130 } 131 proxiedPrototype[ prop ] = ( function() { 132 function _super() { 133 return base.prototype[ prop ].apply( this, arguments ); 134 } 135 136 function _superApply( args ) { 137 return base.prototype[ prop ].apply( this, args ); 138 } 139 140 return function() { 141 var __super = this._super; 142 var __superApply = this._superApply; 143 var returnValue; 144 145 this._super = _super; 146 this._superApply = _superApply; 147 148 returnValue = value.apply( this, arguments ); 149 150 this._super = __super; 151 this._superApply = __superApply; 152 153 return returnValue; 154 }; 155 } )(); 156 } ); 157 constructor.prototype = $.widget.extend( basePrototype, { 158 159 // TODO: remove support for widgetEventPrefix 160 // always use the name + a colon as the prefix, e.g., draggable:start 161 // don't prefix for widgets that aren't DOM-based 162 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 163 }, proxiedPrototype, { 164 constructor: constructor, 165 namespace: namespace, 166 widgetName: name, 167 widgetFullName: fullName 168 } ); 169 170 // If this widget is being redefined then we need to find all widgets that 171 // are inheriting from it and redefine all of them so that they inherit from 172 // the new version of this widget. We're essentially trying to replace one 173 // level in the prototype chain. 174 if ( existingConstructor ) { 175 $.each( existingConstructor._childConstructors, function( i, child ) { 176 var childPrototype = child.prototype; 177 178 // Redefine the child widget using the same prototype that was 179 // originally used, but inherit from the new version of the base 180 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 181 child._proto ); 182 } ); 183 184 // Remove the list of existing child constructors from the old constructor 185 // so the old child constructors can be garbage collected 186 delete existingConstructor._childConstructors; 187 } else { 188 base._childConstructors.push( constructor ); 189 } 190 191 $.widget.bridge( name, constructor ); 192 193 return constructor; 194 }; 195 196 $.widget.extend = function( target ) { 197 var input = widgetSlice.call( arguments, 1 ); 198 var inputIndex = 0; 199 var inputLength = input.length; 200 var key; 201 var value; 202 203 for ( ; inputIndex < inputLength; inputIndex++ ) { 204 for ( key in input[ inputIndex ] ) { 205 value = input[ inputIndex ][ key ]; 206 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 207 208 // Clone objects 209 if ( $.isPlainObject( value ) ) { 210 target[ key ] = $.isPlainObject( target[ key ] ) ? 211 $.widget.extend( {}, target[ key ], value ) : 212 213 // Don't extend strings, arrays, etc. with objects 214 $.widget.extend( {}, value ); 215 216 // Copy everything else by reference 217 } else { 218 target[ key ] = value; 219 } 220 } 221 } 222 } 223 return target; 224 }; 225 226 $.widget.bridge = function( name, object ) { 227 var fullName = object.prototype.widgetFullName || name; 228 $.fn[ name ] = function( options ) { 229 var isMethodCall = typeof options === "string"; 230 var args = widgetSlice.call( arguments, 1 ); 231 var returnValue = this; 232 233 if ( isMethodCall ) { 234 235 // If this is an empty collection, we need to have the instance method 236 // return undefined instead of the jQuery instance 237 if ( !this.length && options === "instance" ) { 238 returnValue = undefined; 239 } else { 240 this.each( function() { 241 var methodValue; 242 var instance = $.data( this, fullName ); 243 244 if ( options === "instance" ) { 245 returnValue = instance; 246 return false; 247 } 248 249 if ( !instance ) { 250 return $.error( "cannot call methods on " + name + 251 " prior to initialization; " + 252 "attempted to call method '" + options + "'" ); 253 } 254 255 if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { 256 return $.error( "no such method '" + options + "' for " + name + 257 " widget instance" ); 258 } 259 260 methodValue = instance[ options ].apply( instance, args ); 261 262 if ( methodValue !== instance && methodValue !== undefined ) { 263 returnValue = methodValue && methodValue.jquery ? 264 returnValue.pushStack( methodValue.get() ) : 265 methodValue; 266 return false;
vendor: 5,158 bytes, lines 267-469
267 } 268 } ); 269 } 270 } else { 271 272 // Allow multiple hashes to be passed on init 273 if ( args.length ) { 274 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 275 } 276 277 this.each( function() { 278 var instance = $.data( this, fullName ); 279 if ( instance ) { 280 instance.option( options || {} ); 281 if ( instance._init ) { 282 instance._init(); 283 } 284 } else { 285 $.data( this, fullName, new object( options, this ) ); 286 } 287 } ); 288 } 289 290 return returnValue; 291 }; 292 }; 293 294 $.Widget = function( /* options, element */ ) {}; 295 $.Widget._childConstructors = []; 296 297 $.Widget.prototype = { 298 widgetName: "widget", 299 widgetEventPrefix: "", 300 defaultElement: "<div>", 301 302 options: { 303 classes: {}, 304 disabled: false, 305 306 // Callbacks 307 create: null 308 }, 309 310 _createWidget: function( options, element ) { 311 element = $( element || this.defaultElement || this )[ 0 ]; 312 this.element = $( element ); 313 this.uuid = widgetUuid++; 314 this.eventNamespace = "." + this.widgetName + this.uuid; 315 316 this.bindings = $(); 317 this.hoverable = $(); 318 this.focusable = $(); 319 this.classesElementLookup = {}; 320 321 if ( element !== this ) { 322 $.data( element, this.widgetFullName, this ); 323 this._on( true, this.element, { 324 remove: function( event ) { 325 if ( event.target === element ) { 326 this.destroy(); 327 } 328 } 329 } ); 330 this.document = $( element.style ? 331 332 // Element within the document 333 element.ownerDocument : 334 335 // Element is window or document 336 element.document || element ); 337 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 338 } 339 340 this.options = $.widget.extend( {}, 341 this.options, 342 this._getCreateOptions(), 343 options ); 344 345 this._create(); 346 347 if ( this.options.disabled ) { 348 this._setOptionDisabled( this.options.disabled ); 349 } 350 351 this._trigger( "create", null, this._getCreateEventData() ); 352 this._init(); 353 }, 354 355 _getCreateOptions: function() { 356 return {}; 357 }, 358 359 _getCreateEventData: $.noop, 360 361 _create: $.noop, 362 363 _init: $.noop, 364 365 destroy: function() { 366 var that = this; 367 368 this._destroy(); 369 $.each( this.classesElementLookup, function( key, value ) { 370 that._removeClass( value, key ); 371 } ); 372 373 // We can probably remove the unbind calls in 2.0 374 // all event bindings should go through this._on() 375 this.element 376 .off( this.eventNamespace ) 377 .removeData( this.widgetFullName ); 378 this.widget() 379 .off( this.eventNamespace ) 380 .removeAttr( "aria-disabled" ); 381 382 // Clean up events and states 383 this.bindings.off( this.eventNamespace ); 384 }, 385 386 _destroy: $.noop, 387 388 widget: function() { 389 return this.element; 390 }, 391 392 option: function( key, value ) { 393 var options = key; 394 var parts; 395 var curOption; 396 var i; 397 398 if ( arguments.length === 0 ) { 399 400 // Don't return a reference to the internal hash 401 return $.widget.extend( {}, this.options ); 402 } 403 404 if ( typeof key === "string" ) { 405 406 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 407 options = {}; 408 parts = key.split( "." ); 409 key = parts.shift(); 410 if ( parts.length ) { 411 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 412 for ( i = 0; i < parts.length - 1; i++ ) { 413 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 414 curOption = curOption[ parts[ i ] ]; 415 } 416 key = parts.pop(); 417 if ( arguments.length === 1 ) { 418 return curOption[ key ] === undefined ? null : curOption[ key ]; 419 } 420 curOption[ key ] = value; 421 } else { 422 if ( arguments.length === 1 ) { 423 return this.options[ key ] === undefined ? null : this.options[ key ]; 424 } 425 options[ key ] = value; 426 } 427 } 428 429 this._setOptions( options ); 430 431 return this; 432 }, 433 434 _setOptions: function( options ) { 435 var key; 436 437 for ( key in options ) { 438 this._setOption( key, options[ key ] ); 439 } 440 441 return this; 442 }, 443 444 _setOption: function( key, value ) { 445 if ( key === "classes" ) { 446 this._setOptionClasses( value ); 447 } 448 449 this.options[ key ] = value; 450 451 if ( key === "disabled" ) { 452 this._setOptionDisabled( value ); 453 } 454 455 return this; 456 }, 457 458 _setOptionClasses: function( value ) { 459 var classKey, elements, currentElements; 460 461 for ( classKey in value ) { 462 currentElements = this.classesElementLookup[ classKey ]; 463 if ( value[ classKey ] === this.options.classes[ classKey ] || 464 !currentElements || 465 !currentElements.length ) { 466 continue; 467 } 468 469 // We are doing this to create a new jQuery object because the _removeClass() call
vendor: 8,808 bytes, lines 470-733
470 // on the next line is going to destroy the reference to the current elements being 471 // tracked. We need to save a copy of this collection so that we can add the new classes 472 // below. 473 elements = $( currentElements.get() ); 474 this._removeClass( currentElements, classKey ); 475 476 // We don't use _addClass() here, because that uses this.options.classes 477 // for generating the string of classes. We want to use the value passed in from 478 // _setOption(), this is the new value of the classes option which was passed to 479 // _setOption(). We pass this value directly to _classes(). 480 elements.addClass( this._classes( { 481 element: elements, 482 keys: classKey, 483 classes: value, 484 add: true 485 } ) ); 486 } 487 }, 488 489 _setOptionDisabled: function( value ) { 490 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 491 492 // If the widget is becoming disabled, then nothing is interactive 493 if ( value ) { 494 this._removeClass( this.hoverable, null, "ui-state-hover" ); 495 this._removeClass( this.focusable, null, "ui-state-focus" ); 496 } 497 }, 498 499 enable: function() { 500 return this._setOptions( { disabled: false } ); 501 }, 502 503 disable: function() { 504 return this._setOptions( { disabled: true } ); 505 }, 506 507 _classes: function( options ) { 508 var full = []; 509 var that = this; 510 511 options = $.extend( { 512 element: this.element, 513 classes: this.options.classes || {} 514 }, options ); 515 516 function processClassString( classes, checkOption ) { 517 var current, i; 518 for ( i = 0; i < classes.length; i++ ) { 519 current = that.classesElementLookup[ classes[ i ] ] || $(); 520 if ( options.add ) { 521 current = $( $.unique( current.get().concat( options.element.get() ) ) ); 522 } else { 523 current = $( current.not( options.element ).get() ); 524 } 525 that.classesElementLookup[ classes[ i ] ] = current; 526 full.push( classes[ i ] ); 527 if ( checkOption && options.classes[ classes[ i ] ] ) { 528 full.push( options.classes[ classes[ i ] ] ); 529 } 530 } 531 } 532 533 this._on( options.element, { 534 "remove": "_untrackClassesElement" 535 } ); 536 537 if ( options.keys ) { 538 processClassString( options.keys.match( /\S+/g ) || [], true ); 539 } 540 if ( options.extra ) { 541 processClassString( options.extra.match( /\S+/g ) || [] ); 542 } 543 544 return full.join( " " ); 545 }, 546 547 _untrackClassesElement: function( event ) { 548 var that = this; 549 $.each( that.classesElementLookup, function( key, value ) { 550 if ( $.inArray( event.target, value ) !== -1 ) { 551 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 552 } 553 } ); 554 }, 555 556 _removeClass: function( element, keys, extra ) { 557 return this._toggleClass( element, keys, extra, false ); 558 }, 559 560 _addClass: function( element, keys, extra ) { 561 return this._toggleClass( element, keys, extra, true ); 562 }, 563 564 _toggleClass: function( element, keys, extra, add ) { 565 add = ( typeof add === "boolean" ) ? add : extra; 566 var shift = ( typeof element === "string" || element === null ), 567 options = { 568 extra: shift ? keys : extra, 569 keys: shift ? element : keys, 570 element: shift ? this.element : element, 571 add: add 572 }; 573 options.element.toggleClass( this._classes( options ), add ); 574 return this; 575 }, 576 577 _on: function( suppressDisabledCheck, element, handlers ) { 578 var delegateElement; 579 var instance = this; 580 581 // No suppressDisabledCheck flag, shuffle arguments 582 if ( typeof suppressDisabledCheck !== "boolean" ) { 583 handlers = element; 584 element = suppressDisabledCheck; 585 suppressDisabledCheck = false; 586 } 587 588 // No element argument, shuffle and use this.element 589 if ( !handlers ) { 590 handlers = element; 591 element = this.element; 592 delegateElement = this.widget(); 593 } else { 594 element = delegateElement = $( element ); 595 this.bindings = this.bindings.add( element ); 596 } 597 598 $.each( handlers, function( event, handler ) { 599 function handlerProxy() { 600 601 // Allow widgets to customize the disabled handling 602 // - disabled as an array instead of boolean 603 // - disabled class as method for disabling individual parts 604 if ( !suppressDisabledCheck && 605 ( instance.options.disabled === true || 606 $( this ).hasClass( "ui-state-disabled" ) ) ) { 607 return; 608 } 609 return ( typeof handler === "string" ? instance[ handler ] : handler ) 610 .apply( instance, arguments ); 611 } 612 613 // Copy the guid so direct unbinding works 614 if ( typeof handler !== "string" ) { 615 handlerProxy.guid = handler.guid = 616 handler.guid || handlerProxy.guid || $.guid++; 617 } 618 619 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 620 var eventName = match[ 1 ] + instance.eventNamespace; 621 var selector = match[ 2 ]; 622 623 if ( selector ) { 624 delegateElement.on( eventName, selector, handlerProxy ); 625 } else { 626 element.on( eventName, handlerProxy ); 627 } 628 } ); 629 }, 630 631 _off: function( element, eventName ) { 632 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 633 this.eventNamespace; 634 element.off( eventName ).off( eventName ); 635 636 // Clear the stack to avoid memory leaks (#10056) 637 this.bindings = $( this.bindings.not( element ).get() ); 638 this.focusable = $( this.focusable.not( element ).get() ); 639 this.hoverable = $( this.hoverable.not( element ).get() ); 640 }, 641 642 _delay: function( handler, delay ) { 643 function handlerProxy() { 644 return ( typeof handler === "string" ? instance[ handler ] : handler ) 645 .apply( instance, arguments ); 646 } 647 var instance = this; 648 return setTimeout( handlerProxy, delay || 0 ); 649 }, 650 651 _hoverable: function( element ) { 652 this.hoverable = this.hoverable.add( element ); 653 this._on( element, { 654 mouseenter: function( event ) { 655 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 656 }, 657 mouseleave: function( event ) { 658 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 659 } 660 } ); 661 }, 662 663 _focusable: function( element ) { 664 this.focusable = this.focusable.add( element ); 665 this._on( element, { 666 focusin: function( event ) { 667 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 668 }, 669 focusout: function( event ) { 670 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 671 } 672 } ); 673 }, 674 675 _trigger: function( type, event, data ) { 676 var prop, orig; 677 var callback = this.options[ type ]; 678 679 data = data || {}; 680 event = $.Event( event ); 681 event.type = ( type === this.widgetEventPrefix ? 682 type : 683 this.widgetEventPrefix + type ).toLowerCase(); 684 685 // The original event may come from any element 686 // so we need to reset the target on the new event 687 event.target = this.element[ 0 ]; 688 689 // Copy original event properties over to the new event 690 orig = event.originalEvent; 691 if ( orig ) { 692 for ( prop in orig ) { 693 if ( !( prop in event ) ) { 694 event[ prop ] = orig[ prop ]; 695 } 696 } 697 } 698 699 this.element.trigger( event, data ); 700 return !( $.isFunction( callback ) && 701 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 702 event.isDefaultPrevented() ); 703 } 704 }; 705 706 $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 707 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 708 if ( typeof options === "string" ) { 709 options = { effect: options }; 710 } 711 712 var hasOptions; 713 var effectName = !options ? 714 method : 715 options === true || typeof options === "number" ? 716 defaultEffect : 717 options.effect || defaultEffect; 718 719 options = options || {}; 720 if ( typeof options === "number" ) { 721 options = { duration: options }; 722 } 723 724 hasOptions = !$.isEmptyObject( options ); 725 options.complete = callback; 726 727 if ( options.delay ) { 728 element.delay( options.delay ); 729 } 730 731 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 732 element[ method ]( options ); 733 } else if ( effectName !== method && element[ effectName ] ) {
734 element[ effectName ]( options.duration, options.easing, callback ); 735 } else { 736 element.queue( function( next ) { 737 $( this )[ method ](); 738 if ( callback ) { 739 callback.call( element[ 0 ] ); 740 } 741 next(); 742 } ); 743 } 744 }; 745 } ); 746 747 var widget = $.widget; 748 749 750 751 752}));
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.