vendor: 6,599 bytes, lines 1-202
1/*! 2 * jQuery UI Widget 1.10.4+amd 3 * https://github.com/blueimp/jQuery-File-Upload 4 * 5 * Copyright 2014 jQuery Foundation and other contributors 6 * Released under the MIT license. 7 * http://jquery.org/license 8 * 9 * http://api.jqueryui.com/jQuery.widget/ 10 */ 11 12(function (factory) { 13 if (typeof define === "function" && define.amd) { 14 // Register as an anonymous AMD module: 15 define(["jquery"], factory); 16 } else { 17 // Browser globals: 18 factory(jQuery); 19 } 20}(function( $, undefined ) { 21 22var uuid = 0, 23 slice = Array.prototype.slice, 24 _cleanData = $.cleanData; 25$.cleanData = function( elems ) { 26 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 27 try { 28 $( elem ).triggerHandler( "remove" ); 29 // http://bugs.jquery.com/ticket/8235 30 } catch( e ) {} 31 } 32 _cleanData( elems ); 33}; 34 35$.widget = function( name, base, prototype ) { 36 var fullName, existingConstructor, constructor, basePrototype, 37 // proxiedPrototype allows the provided prototype to remain unmodified 38 // so that it can be used as a mixin for multiple widgets (#8876) 39 proxiedPrototype = {}, 40 namespace = name.split( "." )[ 0 ]; 41 42 name = name.split( "." )[ 1 ]; 43 fullName = namespace + "-" + name; 44 45 if ( !prototype ) { 46 prototype = base; 47 base = $.Widget; 48 } 49 50 // create selector for plugin 51 $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { 52 return !!$.data( elem, fullName ); 53 }; 54 55 $[ namespace ] = $[ namespace ] || {}; 56 existingConstructor = $[ namespace ][ name ]; 57 constructor = $[ namespace ][ name ] = function( options, element ) { 58 // allow instantiation without "new" keyword 59 if ( !this._createWidget ) { 60 return new constructor( options, element ); 61 } 62 63 // allow instantiation without initializing for simple inheritance 64 // must use "new" keyword (the code above always passes args) 65 if ( arguments.length ) { 66 this._createWidget( options, element ); 67 } 68 }; 69 // extend with the existing constructor to carry over any static properties 70 $.extend( constructor, existingConstructor, { 71 version: prototype.version, 72 // copy the object used to create the prototype in case we need to 73 // redefine the widget later 74 _proto: $.extend( {}, prototype ), 75 // track widgets that inherit from this widget in case this widget is 76 // redefined after a widget inherits from it 77 _childConstructors: [] 78 }); 79 80 basePrototype = new base(); 81 // we need to make the options hash a property directly on the new instance 82 // otherwise we'll modify the options hash on the prototype that we're 83 // inheriting from 84 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 85 $.each( prototype, function( prop, value ) { 86 if ( !$.isFunction( value ) ) { 87 proxiedPrototype[ prop ] = value; 88 return; 89 } 90 proxiedPrototype[ prop ] = (function() { 91 var _super = function() { 92 return base.prototype[ prop ].apply( this, arguments ); 93 }, 94 _superApply = function( args ) { 95 return base.prototype[ prop ].apply( this, args ); 96 }; 97 return function() { 98 var __super = this._super, 99 __superApply = this._superApply, 100 returnValue; 101 102 this._super = _super; 103 this._superApply = _superApply; 104 105 returnValue = value.apply( this, arguments ); 106 107 this._super = __super; 108 this._superApply = __superApply; 109 110 return returnValue; 111 }; 112 })(); 113 }); 114 constructor.prototype = $.widget.extend( basePrototype, { 115 // TODO: remove support for widgetEventPrefix 116 // always use the name + a colon as the prefix, e.g., draggable:start 117 // don't prefix for widgets that aren't DOM-based 118 widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name 119 }, proxiedPrototype, { 120 constructor: constructor, 121 namespace: namespace, 122 widgetName: name, 123 widgetFullName: fullName 124 }); 125 126 // If this widget is being redefined then we need to find all widgets that 127 // are inheriting from it and redefine all of them so that they inherit from 128 // the new version of this widget. We're essentially trying to replace one 129 // level in the prototype chain. 130 if ( existingConstructor ) { 131 $.each( existingConstructor._childConstructors, function( i, child ) { 132 var childPrototype = child.prototype; 133 134 // redefine the child widget using the same prototype that was 135 // originally used, but inherit from the new version of the base 136 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); 137 }); 138 // remove the list of existing child constructors from the old constructor 139 // so the old child constructors can be garbage collected 140 delete existingConstructor._childConstructors; 141 } else { 142 base._childConstructors.push( constructor ); 143 } 144 145 $.widget.bridge( name, constructor ); 146}; 147 148$.widget.extend = function( target ) { 149 var input = slice.call( arguments, 1 ), 150 inputIndex = 0, 151 inputLength = input.length, 152 key, 153 value; 154 for ( ; inputIndex < inputLength; inputIndex++ ) { 155 for ( key in input[ inputIndex ] ) { 156 value = input[ inputIndex ][ key ]; 157 if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { 158 // Clone objects 159 if ( $.isPlainObject( value ) ) { 160 target[ key ] = $.isPlainObject( target[ key ] ) ? 161 $.widget.extend( {}, target[ key ], value ) : 162 // Don't extend strings, arrays, etc. with objects 163 $.widget.extend( {}, value ); 164 // Copy everything else by reference 165 } else { 166 target[ key ] = value; 167 } 168 } 169 } 170 } 171 return target; 172}; 173 174$.widget.bridge = function( name, object ) { 175 var fullName = object.prototype.widgetFullName || name; 176 $.fn[ name ] = function( options ) { 177 var isMethodCall = typeof options === "string", 178 args = slice.call( arguments, 1 ), 179 returnValue = this; 180 181 // allow multiple hashes to be passed on init 182 options = !isMethodCall && args.length ? 183 $.widget.extend.apply( null, [ options ].concat(args) ) : 184 options; 185 186 if ( isMethodCall ) { 187 this.each(function() { 188 var methodValue, 189 instance = $.data( this, fullName ); 190 if ( !instance ) { 191 return $.error( "cannot call methods on " + name + " prior to initialization; " + 192 "attempted to call method '" + options + "'" ); 193 } 194 if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { 195 return $.error( "no such method '" + options + "' for " + name + " widget instance" ); 196 } 197 methodValue = instance[ options ].apply( instance, args ); 198 if ( methodValue !== instance && methodValue !== undefined ) { 199 returnValue = methodValue && methodValue.jquery ? 200 returnValue.pushStack( methodValue.get() ) : 201 methodValue; 202 return false;
vendor: 8,027 bytes, lines 203-502
203 } 204 }); 205 } else { 206 this.each(function() { 207 var instance = $.data( this, fullName ); 208 if ( instance ) { 209 instance.option( options || {} )._init(); 210 } else { 211 $.data( this, fullName, new object( options, this ) ); 212 } 213 }); 214 } 215 216 return returnValue; 217 }; 218}; 219 220$.Widget = function( /* options, element */ ) {}; 221$.Widget._childConstructors = []; 222 223$.Widget.prototype = { 224 widgetName: "widget", 225 widgetEventPrefix: "", 226 defaultElement: "<div>", 227 options: { 228 disabled: false, 229 230 // callbacks 231 create: null 232 }, 233 _createWidget: function( options, element ) { 234 element = $( element || this.defaultElement || this )[ 0 ]; 235 this.element = $( element ); 236 this.uuid = uuid++; 237 this.eventNamespace = "." + this.widgetName + this.uuid; 238 this.options = $.widget.extend( {}, 239 this.options, 240 this._getCreateOptions(), 241 options ); 242 243 this.bindings = $(); 244 this.hoverable = $(); 245 this.focusable = $(); 246 247 if ( element !== this ) { 248 $.data( element, this.widgetFullName, this ); 249 this._on( true, this.element, { 250 remove: function( event ) { 251 if ( event.target === element ) { 252 this.destroy(); 253 } 254 } 255 }); 256 this.document = $( element.style ? 257 // element within the document 258 element.ownerDocument : 259 // element is window or document 260 element.document || element ); 261 this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); 262 } 263 264 this._create(); 265 this._trigger( "create", null, this._getCreateEventData() ); 266 this._init(); 267 }, 268 _getCreateOptions: $.noop, 269 _getCreateEventData: $.noop, 270 _create: $.noop, 271 _init: $.noop, 272 273 destroy: function() { 274 this.element 275 .unbind( "." + this.widgetName ) 276 .removeData( this.widgetName ); 277 this.widget() 278 .unbind( "." + this.widgetName ) 279 .removeAttr( "aria-disabled" ) 280 .removeClass( 281 this.widgetBaseClass + "-disabled " + 282 "ui-state-disabled" ); 283 }, 284 widget: function() { 285 return this.element; 286 }, 287 288 option: function( key, value ) { 289 var options = key, 290 parts, 291 curOption, 292 i; 293 294 if ( arguments.length === 0 ) { 295 // don't return a reference to the internal hash 296 return $.widget.extend( {}, this.options ); 297 } 298 299 if ( typeof key === "string" ) { 300 // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 301 options = {}; 302 parts = key.split( "." ); 303 key = parts.shift(); 304 if ( parts.length ) { 305 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 306 for ( i = 0; i < parts.length - 1; i++ ) { 307 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 308 curOption = curOption[ parts[ i ] ]; 309 } 310 key = parts.pop(); 311 if ( arguments.length === 1 ) { 312 return curOption[ key ] === undefined ? null : curOption[ key ]; 313 } 314 curOption[ key ] = value; 315 } else { 316 if ( arguments.length === 1 ) { 317 return this.options[ key ] === undefined ? null : this.options[ key ]; 318 } 319 options[ key ] = value; 320 } 321 } 322 323 this._setOptions( options ); 324 325 return this; 326 }, 327 _setOptions: function( options ) { 328 var key; 329 330 for ( key in options ) { 331 this._setOption( key, options[ key ] ); 332 } 333 334 return this; 335 }, 336 _setOption: function( key, value ) { 337 this.options[ key ] = value; 338 339 if ( key === "disabled" ) { 340 this.widget() 341 .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) 342 .attr("aria-disabled", value); 343 if (this.hoverable) 344 this.hoverable.removeClass("ui-state-hover"); 345 if (this.focusable) 346 this.focusable.removeClass( "ui-state-focus" ); 347 } 348 349 return this; 350 }, 351 352 enable: function() { 353 return this._setOption( "disabled", false ); 354 }, 355 disable: function() { 356 return this._setOption( "disabled", true ); 357 }, 358 359 _on: function( suppressDisabledCheck, element, handlers ) { 360 var delegateElement, 361 instance = this; 362 363 // no suppressDisabledCheck flag, shuffle arguments 364 if ( typeof suppressDisabledCheck !== "boolean" ) { 365 handlers = element; 366 element = suppressDisabledCheck; 367 suppressDisabledCheck = false; 368 } 369 370 // no element argument, shuffle and use this.element 371 if ( !handlers ) { 372 handlers = element; 373 element = this.element; 374 delegateElement = this.widget(); 375 } else { 376 // accept selectors, DOM elements 377 element = delegateElement = $( element ); 378 this.bindings = this.bindings.add( element ); 379 } 380 381 $.each( handlers, function( event, handler ) { 382 function handlerProxy() { 383 // allow widgets to customize the disabled handling 384 // - disabled as an array instead of boolean 385 // - disabled class as method for disabling individual parts 386 if ( !suppressDisabledCheck && 387 ( instance.options.disabled === true || 388 $( this ).hasClass( "ui-state-disabled" ) ) ) { 389 return; 390 } 391 return ( typeof handler === "string" ? instance[ handler ] : handler ) 392 .apply( instance, arguments ); 393 } 394 395 // copy the guid so direct unbinding works 396 if ( typeof handler !== "string" ) { 397 handlerProxy.guid = handler.guid = 398 handler.guid || handlerProxy.guid || $.guid++; 399 } 400 401 var match = event.match( /^(\w+)\s*(.*)$/ ), 402 eventName = match[1] + instance.eventNamespace, 403 selector = match[2]; 404 if ( selector ) { 405 delegateElement.delegate( selector, eventName, handlerProxy ); 406 } else { 407 element.bind( eventName, handlerProxy ); 408 } 409 }); 410 }, 411 412 _off: function( element, eventName ) { 413 eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; 414 element.unbind( eventName ).undelegate( eventName ); 415 }, 416 417 _delay: function( handler, delay ) { 418 function handlerProxy() { 419 return ( typeof handler === "string" ? instance[ handler ] : handler ) 420 .apply( instance, arguments ); 421 } 422 var instance = this; 423 return setTimeout( handlerProxy, delay || 0 ); 424 }, 425 426 _hoverable: function( element ) { 427 this.hoverable = this.hoverable.add( element ); 428 this._on( element, { 429 mouseenter: function( event ) { 430 $( event.currentTarget ).addClass( "ui-state-hover" ); 431 }, 432 mouseleave: function( event ) { 433 $( event.currentTarget ).removeClass( "ui-state-hover" ); 434 } 435 }); 436 }, 437 438 _focusable: function( element ) { 439 this.focusable = this.focusable.add( element ); 440 this._on( element, { 441 focusin: function( event ) { 442 $( event.currentTarget ).addClass( "ui-state-focus" ); 443 }, 444 focusout: function( event ) { 445 $( event.currentTarget ).removeClass( "ui-state-focus" ); 446 } 447 }); 448 }, 449 450 _trigger: function( type, event, data ) { 451 var prop, orig, 452 callback = this.options[ type ]; 453 454 data = data || {}; 455 event = $.Event( event ); 456 event.type = ( type === this.widgetEventPrefix ? 457 type : 458 this.widgetEventPrefix + type ).toLowerCase(); 459 // the original event may come from any element 460 // so we need to reset the target on the new event 461 event.target = this.element[ 0 ]; 462 463 // copy original event properties over to the new event 464 orig = event.originalEvent; 465 if ( orig ) { 466 for ( prop in orig ) { 467 if ( !( prop in event ) ) { 468 event[ prop ] = orig[ prop ]; 469 } 470 } 471 } 472 473 this.element.trigger( event, data ); 474 return !( $.isFunction( callback ) && 475 callback.apply( this.element[0], [ event ].concat( data ) ) === false || 476 event.isDefaultPrevented() ); 477 } 478}; 479 480$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 481 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 482 if ( typeof options === "string" ) { 483 options = { effect: options }; 484 } 485 var hasOptions, 486 effectName = !options ? 487 method : 488 options === true || typeof options === "number" ? 489 defaultEffect : 490 options.effect || defaultEffect; 491 options = options || {}; 492 if ( typeof options === "number" ) { 493 options = { duration: options }; 494 } 495 hasOptions = !$.isEmptyObject( options ); 496 options.complete = callback; 497 if ( options.delay ) { 498 element.delay( options.delay ); 499 } 500 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 501 element[ method ]( options ); 502 } else if ( effectName !== method && element[ effectName ] ) {
503 element[ effectName ]( options.duration, options.easing, callback ); 504 } else { 505 element.queue(function( next ) { 506 $( this )[ method ](); 507 if ( callback ) { 508 callback.call( element[ 0 ] ); 509 } 510 next(); 511 }); 512 } 513 }; 514}); 515 516}));
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.