PageSourceSearch

https://www.knoll.com/js/jquery/jquery.ui.core.js

js knoll.com collected 2026-09-24 08:39:12 UTC 8,861 bytes, 334 lines download raw bytes

1/*!
2 * jQuery UI 1.8.23
3 *
4 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://jquery.org/license
7 *
8 * http://docs.jquery.com/UI
9 */
10(function( $, undefined ) {
11
12// prevent duplicate loading
13// this is only a problem because we proxy existing functions
14// and we don't want to double proxy them
15$.ui = $.ui || {};
16if ( $.ui.version ) {
17	return;
18}
19
20$.extend( $.ui, {
21	version: "1.8.23",
22
23	keyCode: {
24		ALT: 18,
25		BACKSPACE: 8,
26		CAPS_LOCK: 20,
27		COMMA: 188,
28		COMMAND: 91,
29		COMMAND_LEFT: 91, // COMMAND
30		COMMAND_RIGHT: 93,
31		CONTROL: 17,
32		DELETE: 46,
33		DOWN: 40,
34		END: 35,
35		ENTER: 13,
36		ESCAPE: 27,
37		HOME: 36,
38		INSERT: 45,
39		LEFT: 37,
40		MENU: 93, // COMMAND_RIGHT
41		NUMPAD_ADD: 107,
42		NUMPAD_DECIMAL: 110,
43		NUMPAD_DIVIDE: 111,
44		NUMPAD_ENTER: 108,
45		NUMPAD_MULTIPLY: 106,
46		NUMPAD_SUBTRACT: 109,
47		PAGE_DOWN: 34,
48		PAGE_UP: 33,
49		PERIOD: 190,
50		RIGHT: 39,
51		SHIFT: 16,
52		SPACE: 32,
53		TAB: 9,
54		UP: 38,
55		WINDOWS: 91 // COMMAND
56	}
57});
58
59// plugins
60$.fn.extend({
61	propAttr: $.fn.prop || $.fn.attr,
62
63	_focus: $.fn.focus,
64	focus: function( delay, fn ) {
65		return typeof delay === "number" ?
66			this.each(function() {
67				var elem = this;
68				setTimeout(function() {
69					$( elem ).focus();
70					if ( fn ) {
71						fn.call( elem );
72					}
73				}, delay );
74			}) :
75			this._focus.apply( this, arguments );
76	},
77
78	scrollParent: function() {
79		var scrollParent;
80		if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
81			scrollParent = this.parents().filter(function() {
82				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
83			}).eq(0);
84		} else {
85			scrollParent = this.parents().filter(function() {
86				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
87			}).eq(0);
88		}
89
90		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
91	},
92
93	zIndex: function( zIndex ) {
94		if ( zIndex !== undefined ) {
95			return this.css( "zIndex", zIndex );
96		}
97
98		if ( this.length ) {
99			var elem = $( this[ 0 ] ), position, value;
100			while ( elem.length && elem[ 0 ] !== document ) {
101				// Ignore z-index if position is set to a value where z-index is ignored by the browser
102				// This makes behavior of this function consistent across browsers
103				// WebKit always returns auto if the element is positioned
104				position = elem.css( "position" );
105				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
106					// IE returns 0 when zIndex is not specified
107					// other browsers return a string
108					// we ignore the case of nested elements with an explicit value of 0
109					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
110					value = parseInt( elem.css( "zIndex" ), 10 );
111					if ( !isNaN( value ) && value !== 0 ) {
112						return value;
113					}
114				}
115				elem = elem.parent();
116			}
117		}
118
119		return 0;
120	},
121
122	disableSelection: function() {
123		return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
124			".ui-disableSelection", function( event ) {
125				event.preventDefault();
126			});
127	},
128
129	enableSelection: function() {
130		return this.unbind( ".ui-disableSelection" );
131	}
132});
133
134// support: jQuery <1.8
135if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
136	$.each( [ "Width", "Height" ], function( i, name ) {
137		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
138			type = name.toLowerCase(),
139			orig = {
140				innerWidth: $.fn.innerWidth,
141				innerHeight: $.fn.innerHeight,
142				outerWidth: $.fn.outerWidth,
143				outerHeight: $.fn.outerHeight
144			};
145
146		function reduce( elem, size, border, margin ) {
147			$.each( side, function() {
148				size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
149				if ( border ) {
150					size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
151				}
152				if ( margin ) {
153					size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
154				}
155			});
156			return size;
157		}
158
159		$.fn[ "inner" + name ] = function( size ) {
160			if ( size === undefined ) {
161				return orig[ "inner" + name ].call( this );
162			}
163
164			return this.each(function() {
165				$( this ).css( type, reduce( this, size ) + "px" );
166			});
167		};
168
169		$.fn[ "outer" + name] = function( size, margin ) {
170			if ( typeof size !== "number" ) {
171				return orig[ "outer" + name ].call( this, size );
172			}
173
174			return this.each(function() {
175				$( this).css( type, reduce( this, size, true, margin ) + "px" );
176			});
177		};
178	});
179}
180
181// selectors
182function focusable( element, isTabIndexNotNaN ) {
183	var nodeName = element.nodeName.toLowerCase();
184	if ( "area" === nodeName ) {
185		var map = element.parentNode,
186			mapName = map.name,
187			img;
188		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
189			return false;
190		}
191		img = $( "img[usemap=#" + mapName + "]" )[0];
192		return !!img && visible( img );
193	}
194	return ( /input|select|textarea|button|object/.test( nodeName )
195		? !element.disabled
196		: "a" == nodeName
197			? element.href || isTabIndexNotNaN
198			: isTabIndexNotNaN)
199		// the element and all of its ancestors must be visible
200		&& visible( element );
201}
202
203function visible( element ) {
204	return !$( element ).parents().andSelf().filter(function() {
205		return $.curCSS( this, "visibility" ) === "hidden" ||
206			$.expr.filters.hidden( this );
207	}).length;
208}
209
210$.extend( $.expr[ ":" ], {
211	data: $.expr.createPseudo ?
212		$.expr.createPseudo(function( dataName ) {
213			return function( elem ) {
214				return !!$.data( elem, dataName );
215			};
216		}) :
217		// support: jQuery <1.8
218		function( elem, i, match ) {
219			return !!$.data( elem, match[ 3 ] );
220		},
221
222	focusable: function( element ) {
223		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
224	},
225
226	tabbable: function( element ) {
227		var tabIndex = $.attr( element, "tabindex" ),
228			isTabIndexNaN = isNaN( tabIndex );
229		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
230	}
231});
232
233// support
234$(function() {
235	var body = document.body,
236		div = body.appendChild( div = document.createElement( "div" ) );
237
238	// access offsetHeight before setting the style to prevent a layout bug
239	// in IE 9 which causes the elemnt to continue to take up space even
240	// after it is removed from the DOM (#8026)
241	div.offsetHeight;
242
243	$.extend( div.style, {
244		minHeight: "100px",
245		height: "auto",
246		padding: 0,
247		borderWidth: 0
248	});
249
250	$.support.minHeight = div.offsetHeight === 100;
251	$.support.selectstart = "onselectstart" in div;
252
253	// set display to none to avoid a layout bug in IE
254	// http://dev.jquery.com/ticket/4014
255	body.removeChild( div ).style.display = "none";
256});
257
258// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css
259if ( !$.curCSS ) {
260	$.curCSS = $.css;
261}
262
263
264
265
266
267// deprecated
268$.extend( $.ui, {
269	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
270	plugin: {
271		add: function( module, option, set ) {
272			var proto = $.ui[ module ].prototype;
273			for ( var i in set ) {
274				proto.plugins[ i ] = proto.plugins[ i ] || [];
275				proto.plugins[ i ].push( [ option, set[ i ] ] );
276			}
277		},
278		call: function( instance, name, args ) {
279			var set = instance.plugins[ name ];
280			if ( !set || !instance.element[ 0 ].parentNode ) {
281				return;
282			}
283	
284			for ( var i = 0; i < set.length; i++ ) {
285				if ( instance.options[ set[ i ][ 0 ] ] ) {
286					set[ i ][ 1 ].apply( instance.element, args );
287				}
288			}
289		}
290	},
291	
292	// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
293	contains: function( a, b ) {
294		return document.compareDocumentPosition ?
295			a.compareDocumentPosition( b ) & 16 :
296			a !== b && a.contains( b );
297	},
298	
299	// only used by resizable
300	hasScroll: function( el, a ) {
301	
302		//If overflow is hidden, the element might have extra content, but the user wants to hide it
303		if ( $( el ).css( "overflow" ) === "hidden") {
304			return false;
305		}
306	
307		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
308			has = false;
309	
310		if ( el[ scroll ] > 0 ) {
311			return true;
312		}
313	
314		// TODO: determine which cases actually cause this to happen
315		// if the element doesn't have the scroll set, see if it's possible to
316		// set the scroll
317		el[ scroll ] = 1;
318		has = ( el[ scroll ] > 0 );
319		el[ scroll ] = 0;
320		return has;
321	},
322	
323	// these are odd functions, fix the API or move into individual plugins
324	isOverAxis: function( x, reference, size ) {
325		//Determines when x coordinate is over "b" element axis
326		return ( x > reference ) && ( x < ( reference + size ) );
327	},
328	isOver: function( y, x, top, left, height, width ) {
329		//Determines when x, y coordinates is over "b" element
330		return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
331	}
332});
333
334})( jQuery );

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.