PageSourceSearch

https://www.n-ergie-immobilien.de/public/remotemedien/media/_tech/…/webforms/javascript/jquery_ui_widget_js.js

js n-ergie-immobilien.de collected 2026-10-08 08:26:01 UTC 20,609 bytes, 773 lines download raw bytes

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

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.