PageSourceSearch

https://brbsoftware.com.br/js/jquery/jquery.ui.spinner.js

js brbsoftware.com.br collected 2026-10-02 01:17:35 UTC 23,444 bytes, 881 lines download raw bytes

1/*
2 * jQuery UI @VERSION
3 *
4 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
7 *
8 * http://docs.jquery.com/UI
9 */
10;(function($) {
11
12/** jQuery core modifications and additions **/
13
14var _remove = $.fn.remove;
15$.fn.remove = function() {
16	// Safari has a native remove event which actually removes DOM elements,
17	// so we have to use triggerHandler instead of trigger (#3037).
18	$("*", this).add(this).each(function() {
19		$(this).triggerHandler("remove");
20	});
21	return _remove.apply(this, arguments );
22};
23
24function isVisible(element) {
25	function checkStyles(element) {
26		var style = element.style;
27		return (style.display != 'none' && style.visibility != 'hidden');
28	}
29	
30	var visible = checkStyles(element);
31	
32	(visible && $.each($.dir(element, 'parentNode'), function() {
33		return (visible = checkStyles(this));
34	}));
35	
36	return visible;
37}
38
39$.extend($.expr[':'], {
40	data: function(a, i, m) {
41		return $.data(a, m[3]);
42	},
43	
44	// TODO: add support for object, area
45	tabbable: function(a, i, m) {
46		var nodeName = a.nodeName.toLowerCase();
47		
48		return (
49			// in tab order
50			a.tabIndex >= 0 &&
51			
52			( // filter node types that participate in the tab order
53				
54				// anchor tag
55				('a' == nodeName && a.href) ||
56				
57				// enabled form element
58				(/input|select|textarea|button/.test(nodeName) &&
59					'hidden' != a.type && !a.disabled)
60			) &&
61			
62			// visible on page
63			isVisible(a)
64		);
65	}
66});
67
68$.keyCode = {
69	BACKSPACE: 8,
70	CAPS_LOCK: 20,
71	COMMA: 188,
72	CONTROL: 17,
73	DELETE: 46,
74	DOWN: 40,
75	END: 35,
76	ENTER: 13,
77	ESCAPE: 27,
78	HOME: 36,
79	INSERT: 45,
80	LEFT: 37,
81	NUMPAD_ADD: 107,
82	NUMPAD_DECIMAL: 110,
83	NUMPAD_DIVIDE: 111,
84	NUMPAD_ENTER: 108,
85	NUMPAD_MULTIPLY: 106,
86	NUMPAD_SUBTRACT: 109,
87	PAGE_DOWN: 34,
88	PAGE_UP: 33,
89	PERIOD: 190,
90	RIGHT: 39,
91	SHIFT: 16,
92	SPACE: 32,
93	TAB: 9,
94	UP: 38
95};
96
97// WAI-ARIA Semantics
98var isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
99$.fn.extend({
100	ariaRole: function(role) {
101		return (role !== undefined
102			
103			// setter
104			? this.attr("role", isFF2 ? "wairole:" + role : role)
105			
106			// getter
107			: (this.attr("role") || "").replace(/^wairole:/, ""));
108	},
109	
110	ariaState: function(state, value) {
111		return (value !== undefined
112			
113			// setter
114			? this.each(function(i, el) {
115				(isFF2
116					? el.setAttributeNS("http://www.w3.org/2005/07/aaa",
117						"aaa:" + state, value)
118					: $(el).attr("aria-" + state, value));
119			})
120			
121			// getter
122			: this.attr(isFF2 ? "aaa:" + state : "aria-" + state));
123	}
124});
125
126// $.widget is a factory to create jQuery plugins
127// taking some boilerplate code out of the plugin code
128// created by Scott González and Jörn Zaefferer
129function getter(namespace, plugin, method, args) {
130	function getMethods(type) {
131		var methods = $[namespace][plugin][type] || [];
132		return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
133	}
134	
135	var methods = getMethods('getter');
136	if (args.length == 1 && typeof args[0] == 'string') {
137		methods = methods.concat(getMethods('getterSetter'));
138	}
139	return ($.inArray(method, methods) != -1);
140}
141
142$.widget = function(name, prototype) {
143	var namespace = name.split(".")[0];
144	name = name.split(".")[1];
145	
146	// create plugin method
147	$.fn[name] = function(options) {
148		var isMethodCall = (typeof options == 'string'),
149			args = Array.prototype.slice.call(arguments, 1);
150		
151		// prevent calls to internal methods
152		if (isMethodCall && options.substring(0, 1) == '_') {
153			return this;
154		}
155		
156		// handle getter methods
157		if (isMethodCall && getter(namespace, name, options, args)) {
158			var instance = $.data(this[0], name);
159			return (instance ? instance[options].apply(instance, args)
160				: undefined);
161		}
162		
163		// handle initialization and non-getter methods
164		return this.each(function() {
165			var instance = $.data(this, name);
166			
167			// constructor
168			(!instance && !isMethodCall &&
169				$.data(this, name, new $[namespace][name](this, options)));
170			
171			// method call
172			(instance && isMethodCall && $.isFunction(instance[options]) &&
173				instance[options].apply(instance, args));
174		});
175	};
176	
177	// create widget constructor
178	$[namespace] = $[namespace] || {};
179	$[namespace][name] = function(element, options) {
180		var self = this;
181		
182		this.widgetName = name;
183		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
184		this.widgetBaseClass = namespace + '-' + name;
185		
186		this.options = $.extend({},
187			$.widget.defaults,
188			$[namespace][name].defaults,
189			$.metadata && $.metadata.get(element)[name],
190			options);
191		
192		this.element = $(element)
193			.bind('setData.' + name, function(e, key, value) {
194				return self._setData(key, value);
195			})
196			.bind('getData.' + name, function(e, key) {
197				return self._getData(key);
198			})
199			.bind('remove', function() {
200				return self.destroy();
201			});
202		
203		this._init();
204	};
205	
206	// add widget prototype
207	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
208	
209	// TODO: merge getter and getterSetter properties from widget prototype
210	// and plugin prototype
211	$[namespace][name].getterSetter = 'option';
212};
213
214$.widget.prototype = {
215	_init: function() {},
216	destroy: function() {
217		this.element.removeData(this.widgetName);
218	},
219	
220	option: function(key, value) {
221		var options = key,
222			self = this;
223		
224		if (typeof key == "string") {
225			if (value === undefined) {
226				return this._getData(key);
227			}
228			options = {};
229			options[key] = value;
230		}
231		
232		$.each(options, function(key, value) {
233			self._setData(key, value);
234		});
235	},
236	_getData: function(key) {
237		return this.options[key];
238	},
239	_setData: function(key, value) {
240		this.options[key] = value;
241		
242		if (key == 'disabled') {
243			this.element[value ? 'addClass' : 'removeClass'](
244				this.widgetBaseClass + '-disabled');
245		}
246	},
247	
248	enable: function() {
249		this._setData('disabled', false);
250	},
251	disable: function() {
252		this._setData('disabled', true);
253	},
254	
255	_trigger: function(type, e, data) {
256		var eventName = (type == this.widgetEventPrefix
257			? type : this.widgetEventPrefix + type);
258		e = e  || $.event.fix({ type: eventName, target: this.element[0] });
259		return this.element.triggerHandler(eventName, [e, data], this.options[type]);
260	}
261};
262
263$.widget.defaults = {
264	disabled: false
265};
266
267
268/** jQuery UI core **/
269
270$.ui = {
271	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
272	plugin: {
273		add: function(module, option, set) {
274			var proto = $.ui[module].prototype;
275			for(var i in set) {
276				proto.plugins[i] = proto.plugins[i] || [];
277				proto.plugins[i].push([option, set[i]]);
278			}
279		},
280		call: function(instance, name, args) {
281			var set = instance.plugins[name];
282			if(!set) { return; }
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	cssCache: {},
292	css: function(name) {
293		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
294		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
295		
296		//if (!$.browser.safari)
297			//tmp.appendTo('body');
298		
299		//Opera and Safari set width and height to 0px instead of auto
300		//Safari returns rgba(0,0,0,0) when bgcolor is not set
301		$.ui.cssCache[name] = !!(
302			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || 
303			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
304		);
305		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
306		return $.ui.cssCache[name];
307	},
308	disableSelection: function(el) {
309		return $(el)
310			.attr('unselectable', 'on')
311			.css('MozUserSelect', 'none')
312			.bind('selectstart.ui', function() { return false; });
313	},
314	enableSelection: function(el) {
315		return $(el)
316			.attr('unselectable', 'off')
317			.css('MozUserSelect', '')
318			.unbind('selectstart.ui');
319	},
320	hasScroll: function(e, a) {
321		
322		//If overflow is hidden, the element might have extra content, but the user wants to hide it
323		if ($(e).css('overflow') == 'hidden') { return false; }
324		
325		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
326			has = false;
327		
328		if (e[scroll] > 0) { return true; }
329		
330		// TODO: determine which cases actually cause this to happen
331		// if the element doesn't have the scroll set, see if it's possible to
332		// set the scroll
333		e[scroll] = 1;
334		has = (e[scroll] > 0);
335		e[scroll] = 0;
336		return has;
337	}
338};
339
340
341/** Mouse Interaction Plugin **/
342
343$.ui.mouse = {
344	_mouseInit: function() {
345		var self = this;
346	
347		this.element.bind('mousedown.'+this.widgetName, function(e) {
348			return self._mouseDown(e);
349		});
350		
351		// Prevent text selection in IE
352		if ($.browser.msie) {
353			this._mouseUnselectable = this.element.attr('unselectable');
354			this.element.attr('unselectable', 'on');
355		}
356		
357		this.started = false;
358	},
359	
360	// TODO: make sure destroying one instance of mouse doesn't mess with
361	// other instances of mouse
362	_mouseDestroy: function() {
363		this.element.unbind('.'+this.widgetName);
364		
365		// Restore text selection in IE
366		($.browser.msie
367			&& this.element.attr('unselectable', this._mouseUnselectable));
368	},
369	
370	_mouseDown: function(e) {
371		// we may have missed mouseup (out of window)
372		(this._mouseStarted && this._mouseUp(e));
373		
374		this._mouseDownEvent = e;
375		
376		var self = this,
377			btnIsLeft = (e.which == 1),
378			elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
379		if (!btnIsLeft || elIsCancel || !this._mouseCapture(e)) {
380			return true;
381		}
382		
383		this.mouseDelayMet = !this.options.delay;
384		if (!this.mouseDelayMet) {
385			this._mouseDelayTimer = setTimeout(function() {
386				self.mouseDelayMet = true;
387			}, this.options.delay);
388		}
389		
390		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
391			this._mouseStarted = (this._mouseStart(e) !== false);
392			if (!this._mouseStarted) {
393				e.preventDefault();
394				return true;
395			}
396		}
397		
398		// these delegates are required to keep context
399		this._mouseMoveDelegate = function(e) {
400			return self._mouseMove(e);
401		};
402		this._mouseUpDelegate = function(e) {
403			return self._mouseUp(e);
404		};
405		$(document)
406			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
407			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
408		
409		return false;
410	},
411	
412	_mouseMove: function(e) {
413		// IE mouseup check - mouseup happened when mouse was out of window
414		if ($.browser.msie && !e.button) {
415			return this._mouseUp(e);
416		}
417		
418		if (this._mouseStarted) {
419			this._mouseDrag(e);
420			return false;
421		}
422		
423		if (this._mouseDistanceMet(e) && this._mouseDelayMet(e)) {
424			this._mouseStarted =
425				(this._mouseStart(this._mouseDownEvent, e) !== false);
426			(this._mouseStarted ? this._mouseDrag(e) : this._mouseUp(e));
427		}
428		
429		return !this._mouseStarted;
430	},
431	
432	_mouseUp: function(e) {
433		$(document)
434			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
435			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
436		
437		if (this._mouseStarted) {
438			this._mouseStarted = false;
439			this._mouseStop(e);
440		}
441		
442		return false;
443	},
444	
445	_mouseDistanceMet: function(e) {
446		return (Math.max(
447				Math.abs(this._mouseDownEvent.pageX - e.pageX),
448				Math.abs(this._mouseDownEvent.pageY - e.pageY)
449			) >= this.options.distance
450		);
451	},
452	
453	_mouseDelayMet: function(e) {
454		return this.mouseDelayMet;
455	},
456	
457	// These are placeholder methods, to be overriden by extending plugin
458	_mouseStart: function(e) {},
459	_mouseDrag: function(e) {},
460	_mouseStop: function(e) {},
461	_mouseCapture: function(e) { return true; }
462};
463
464$.ui.mouse.defaults = {
465	cancel: null,
466	distance: 1,
467	delay: 0
468};
469
470})(jQuery);
471
472
473/*
474 * jQuery UI Spinner @VERSION
475 *
476 * Copyright (c) 2008 jQuery
477 * Dual licensed under the MIT (MIT-LICENSE.txt)
478 * and GPL (GPL-LICENSE.txt) licenses.
479 *
480 * http://docs.jquery.com/UI/Spinner
481 *
482 * Depends:
483 *  ui.core.js
484 */
485(function($) {
486
487$.widget('ui.spinner', {
488	_init: function() {
489		this._trigger('init', null, this.ui(null));
490		
491		// perform data bind on generic objects
492		if (typeof this.options.items[0] == 'object' && !this.element.is('input')) {
493			var data = this.options.items;
494			for (var i=0; i<data.length; i++) {
495				this._addItem(data[i]);
496			}
497		}
498		
499		// check for decimals in steppinng and set _decimals as internal
500		this._decimals = parseInt(this.options.decimals, 10);
501		if (this.options.stepping.toString().indexOf('.') != -1) {
502			var s = this.options.stepping.toString();
503			this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
504		}
505		
506		//Initialize needed constants
507		var self = this;
508		this.element
509			.addClass('ui-spinner-box')
510			.attr('autocomplete', 'off'); // switch off autocomplete in opera
511		
512		this._setValue( isNaN(this._getValue()) ? this.options.start : this._getValue() );
513		
514		this.element
515		.wrap('<div>')
516		.parent()
517			.addClass('ui-spinner')
518			.append('<button class="ui-spinner-up" type="button">&#9650;</button>')
519			.find('.ui-spinner-up')
520				.bind('mousedown', function(e) {
521					$(this).addClass('ui-spinner-pressed');
522					if (!self.counter) {
523						self.counter = 1;
524					}
525					self._mousedown(100, '_up', e);
526				})
527				.bind('mouseup', function(e) {
528					$(this).removeClass('ui-spinner-pressed');
529					if (self.counter == 1) {
530						self._up(e);
531					}
532					self._mouseup(e);
533				})
534				.bind('mouseout', function(e) {
535					$(this).removeClass('ui-spinner-pressed');
536					if (self.timer) {
537						self._mouseup(e);
538					}
539				})
540				// mousedown/mouseup capture first click, now handle second click
541				.bind('dblclick', function(e) {
542					$(this).removeClass('ui-spinner-pressed');
543					self._up(e);
544					self._mouseup(e);
545				})
546				.bind('keydown.spinner', function(e) {
547					var KEYS = $.keyCode;
548					if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.ENTER) {
549						$(this).addClass('ui-spinner-pressed');
550						if (!self.counter) {
551							self.counter = 1;
552						}
553						self._up.call(self, e);
554					} else if (e.keyCode == KEYS.DOWN || e.keyCode == KEYS.RIGHT) {
555						self.element.siblings('.ui-spinner-down').focus();
556					} else if (e.keyCode == KEYS.LEFT) {
557						self.element.focus();
558					}
559				})
560				.bind('keyup.spinner', function(e) {
561					$(this).removeClass('ui-spinner-pressed');
562					self.counter = 0;
563					self._propagate('change', e);
564				})
565			.end()
566			.append('<button class="ui-spinner-down" type="button">&#9660;</button>')
567			.find('.ui-spinner-down')
568				.bind('mousedown', function(e) {
569					$(this).addClass('ui-spinner-pressed');
570					if (!self.counter) {
571						self.counter = 1;
572					}
573					self._mousedown(100, '_down', e);
574				})
575				.bind('mouseup', function(e) {
576					$(this).removeClass('ui-spinner-pressed');
577					if (self.counter == 1) {
578						self._down();
579					}
580					self._mouseup(e);
581				})
582				.bind('mouseout', function(e) {
583					$(this).removeClass('ui-spinner-pressed');
584					if (self.timer) {
585						self._mouseup(e);
586					}
587				})
588				// mousedown/mouseup capture first click, now handle second click
589				.bind('dblclick', function(e) {
590					$(this).removeClass('ui-spinner-pressed');
591					self._down(e);
592					self._mouseup(e);
593				})
594				.bind('keydown.spinner', function(e) {
595					var KEYS = $.keyCode;
596					if (e.keyCode == KEYS.SPACE || e.keyCode == KEYS.ENTER) {
597						$(this).addClass('ui-spinner-pressed');
598						if (!self.counter) {
599							self.counter = 1;
600						}
601						self._down.call(self, e);
602					} else if (e.keyCode == KEYS.UP || e.keyCode == KEYS.LEFT) {
603						self.element.siblings('.ui-spinner-up').focus();
604					}
605				})
606				.bind('keyup.spinner', function(e) {
607					$(this).removeClass('ui-spinner-pressed');
608					self.counter = 0;
609					self._propagate('change', e);
610				})
611			.end();
612		
613		// DataList: Set contraints for object length and step size. 
614		// Manipulate height of spinner.
615		this._items = this.element.children().length;
616		if (this._items > 1) {
617			var height = this.element.outerHeight()/this._items;
618			this.element
619			.addClass('ui-spinner-list')
620			.height(height)
621			.children()
622				.addClass('ui-spinner-listitem')
623				.height(height)
624				.css('overflow', 'hidden')
625			.end()
626			.parent()
627				.height(height)
628			.end();
629			this.options.stepping = 1;
630			this.options.min = 0;
631			this.options.max = this._items-1;
632		}
633		
634		this.element
635		.bind('keydown.spinner', function(e) {
636			if (!self.counter) {
637				self.counter = 1;
638			}
639			return self._keydown.call(self, e);
640		})
641		.bind('keyup.spinner', function(e) {
642			self.counter = 0;
643			self._propagate('change', e);
644		})
645		.bind('blur.spinner', function(e) {
646			self._cleanUp();
647		});
648		
649		if ($.fn.mousewheel) {
650			this.element.mousewheel(function(e, delta) {
651				self._mousewheel(e, delta);
652			});
653		}
654	},
655	
656	_constrain: function() {
657		if (this.options.min != undefined && this._getValue() < this.options.min) {
658			this._setValue(this.options.min);
659		}
660		if (this.options.max != undefined && this._getValue() > this.options.max) {
661			this._setValue(this.options.max);
662		}
663	},
664	_cleanUp: function() {
665		this._setValue(this._getValue());
666		this._constrain();
667	},
668	_spin: function(d, e) {
669		if (this.disabled) {
670			return;
671		}
672		
673		if (isNaN(this._getValue())) {
674			this._setValue(this.options.start);
675		}
676		this._setValue(this._getValue() + (d == 'up' ? 1:-1) * (this.options.incremental && this.counter > 100 ? (this.counter > 200 ? 100 : 10) : 1) * this.options.stepping);
677		this._animate(d);
678		this._constrain();
679		if (this.counter) {
680			this.counter++;
681		}
682		this._propagate('spin', e);
683	},
684	_down: function(e) {
685		this._spin('down', e);
686		this._propagate('down', e);
687	},
688	_up: function(e) {
689		this._spin('up', e);
690		this._propagate('up', e);
691	},
692	_mousedown: function(i, d, e) {
693		var self = this;
694		i = i || 100;
695		if (this.timer) {
696			window.clearInterval(this.timer);
697			this.timer = 0;
698		}
699		this.timer = window.setInterval(function() {
700			self[d](e);
701			if (self.counter > 20) {
702				self._mousedown(20, d, e);
703			}
704		}, i);
705	},
706	_mouseup: function(e) {
707		this.counter = 0;
708		if (this.timer) {
709			window.clearInterval(this.timer);
710			this.timer = 0;
711		}
712		this.element[0].focus();
713		this._propagate('change', e);
714	},
715	_keydown: function(e) {
716		var KEYS = $.keyCode;
717		
718		if (e.keyCode == KEYS.UP) {
719			this._up(e);
720		}
721		if (e.keyCode == KEYS.DOWN) {
722			this._down(e);
723		}
724		if (e.keyCode == KEYS.HOME) {
725			//Home key goes to min, if defined, else to start
726			this._setValue(this.options.min || this.options.start);
727		}
728		if (e.keyCode == KEYS.END && this.options.max != undefined) {
729			//End key goes to maximum
730			this._setValue(this.options.max);
731		}
732		return (e.keyCode == KEYS.TAB || e.keyCode == KEYS.BACKSPACE ||
733			e.keyCode == KEYS.LEFT || e.keyCode == KEYS.RIGHT || e.keyCode == KEYS.PERIOD || 
734			e.keyCode == KEYS.NUMPAD_DECIMAL || e.keyCode == KEYS.NUMPAD_SUBTRACT || 
735			(e.keyCode >= 96 && e.keyCode <= 105) || // add support for numeric keypad 0-9
736			(/[0-9\-\.]/).test(String.fromCharCode(e.keyCode))) ? true : false;
737	},
738	_mousewheel: function(e, delta) {
739		var self = this;
740		delta = ($.browser.opera ? -delta / Math.abs(delta) : delta);
741		(delta > 0 ? self._up(e) : self._down(e));
742		if (self.timeout) {
743			window.clearTimeout(self.timeout);
744			self.timeout = 0;
745		}
746		self.timeout = window.setTimeout(function(){self._propagate('change', e)}, 400);
747		e.preventDefault();
748	},
749	_getValue: function() {
750		return parseFloat(this.element.val().replace(/[^0-9\-\.]/g, ''));
751	},
752	_setValue: function(newVal) {
753		if (isNaN(newVal)) {
754			newVal = this.options.start;
755		}
756		this.element.val(
757			this.options.currency ? 
758				$.ui.spinner.format.currency(newVal, this.options.currency) : 
759				$.ui.spinner.format.number(newVal, this._decimals)
760		);
761	},
762	_animate: function(d) {
763		if (this.element.hasClass('ui-spinner-list') && ((d == 'up' && this._getValue() <= this.options.max) || (d == 'down' && this._getValue() >= this.options.min)) ) {
764			this.element.animate({marginTop: '-' + this._getValue() * this.element.parent().height() }, {
765				duration: 'fast',
766				queue: false
767			});
768		}
769	},
770	_addItem: function(obj, fmt) {
771		if (!this.element.is('input')) {
772			var wrapper = 'div';
773			if (this.element.is('ol') || this.element.is('ul')) {
774				wrapper = 'li';
775			}
776			var html = obj; // string or object set it to html first
777			
778			if (typeof obj == 'object') {
779				var format = (fmt !== undefined ? fmt : this.options.format);
780				
781				html = format.replace(/%(\(([^)]+)\))?/g, 
782					(function(data){
783						return function(match, a, lbl) { 
784							if (!lbl) {
785								for (var itm in data) {
786									return data[itm]; // return the first item only
787								}
788							} else {
789								return data[lbl];
790							}
791						};
792					})(obj)
793				);
794			}
795			this.element.append('<'+ wrapper +' class="ui-spinner-dyn">'+ html + '</'+ wrapper +'>');
796		}
797	},
798	
799	plugins: {},
800	ui: function(e) {
801		return {
802			options: this.options,
803			element: this.element,
804			value: this._getValue(),
805			add: this._addItem
806		};
807	},
808	_propagate: function(n,e) {
809		$.ui.plugin.call(this, n, [e, this.ui()]);
810		return this.element.triggerHandler(n == 'spin' ? n : 'spin'+n, [e, this.ui()], this.options[n]);
811	},
812	destroy: function() {
813		if (!$.data(this.element[0], 'spinner')) {
814			return;
815		}
816		if ($.fn.mousewheel) {
817			this.element.unmousewheel();
818		}
819		this.element
820			.removeClass('ui-spinner-box ui-spinner-list')
821			.removeAttr('disabled')
822			.removeAttr('autocomplete')
823			.removeData('spinner')
824			.unbind('.spinner')
825			.siblings()
826				.remove()
827			.end()
828			.children()
829				.removeClass('ui-spinner-listitem')
830				.remove('.ui-spinner-dyn')
831			.end()
832			.parent()
833				.removeClass('ui-spinner ui-spinner-disabled')
834				.before(this.element.clone())
835				.remove()
836			.end();
837	},
838	enable: function() {
839		this.element
840			.removeAttr('disabled')
841			.siblings()
842				.removeAttr('disabled')
843			.parent()
844				.removeClass('ui-spinner-disabled');
845		this.disabled = false;
846	},
847	disable: function() {
848		this.element
849			.attr('disabled', true)
850			.siblings()
851				.attr('disabled', true)
852			.parent()
853				.addClass('ui-spinner-disabled');
854		this.disabled = true;
855	}
856});
857
858$.extend($.ui.spinner, {
859	defaults: {
860		decimals: 0,
861		stepping: 1,
862		start: 0,
863		incremental: true,
864		currency: false,
865		format: '%',
866		items: []
867	},
868	format: {
869		currency: function(num, sym) {
870			num = isNaN(num) ? 0 : num;
871			return (num !== Math.abs(num) ? '-' : '') + sym + this.number(Math.abs(num), 2);
872		},
873		number: function(num, dec) {
874			var regex = /(\d+)(\d{3})/;
875			for (num = isNaN(num) ? 0 : parseFloat(num,10).toFixed(dec); regex.test(num); num=num.replace(regex, '$1,$2'));
876			return num;
877		}
878	}
879});
880
881})(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.