PageSourceSearch

https://www.icelscpa.it/flex/cm/js.7.9.13/jq/FlexJS.js

js icelscpa.it collected 2026-09-26 16:45:32 UTC 21,429 bytes, 947 lines download raw bytes

1
2	// console wrapper for older browser
3
4if (! window.console) window.console = { log: function() {} };
5
6	//
7	// definizione del NS FlexJS
8	//
9
10window.FlexJS = window.FlexJS || {};
11window.gAppConfigure = window.gAppConfigure || {};
12
13	// alias
14
15window.fjs = FlexJS;
16
17	// browser test (jq ha deprecato $.browser che non esiste più dalla 1.9)
18
19(function(jQuery) {
20
21	var matched, browser;
22
23	const uaMatch = function(ua) {
24
25		ua = ua.toLowerCase();
26
27		var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
28			/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
29			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
30			/(msie) ([\w.]+)/.exec( ua ) ||
31			ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
32			[];
33
34		return {
35			browser: match[ 1 ] || "",
36			version: match[ 2 ] || "0"
37		};
38	};
39
40	matched = uaMatch(navigator.userAgent);
41	browser = {};
42
43	if ( matched.browser ) {
44
45		browser[ matched.browser ] = true;
46		browser.version = matched.version;
47	}
48
49		// Chrome is Webkit, but Webkit is also Safari.
50
51	if ( browser.chrome ) {
52
53		browser.webkit = true;
54
55	} else if ( browser.webkit )
56		browser.safari = true;
57
58	jQuery.browser = browser;
59
60})(jQuery);
61
62fjs.isIE = jQuery.browser.msie;
63fjs.isGecko = jQuery.browser.mozilla;
64
65	//
66	// accesso alle variabili di configurazione di flex
67	//
68
69fjs.AppConfigure = window.FlexJS.AppConfigure || {};
70
71fjs.AppConfigure.Get = function(pName) { return gAppConfigure[pName]; };
72fjs.AppConfigure.Set = function(pName, v) { gAppConfigure[pName] = v; };
73
74	// proxy per closure
75
76fjs.proxy = function(fn, proxy) { return function() { return fn.apply(
76proxy, arguments); }; };
77fjs.falsy = function() { return false; };
78
79	// ctx è tipicamente un oggetto, mtdh un suo metodo
80
81fjs.bind = function(ctx, mtdh) { return function() { return ctx[mtdh].apply(ctx, arguments); }; };
82
83	//
84	// loader dinamico
85	//
86
87/*
88
89	FlexJS.Loader.LoadJS('path/to/file.js', function () { use JS });
90
91*/
92
93FlexJS.Loader = window.FlexJS.Loader || {};
94
95FlexJS.Loader.sCache = [];
96FlexJS.Loader.sImageCache = [];
97
98	// carica un JS esterno
99
100FlexJS.Loader.LoadJS = function(path, cb, useUniqueID) {
101
102	path = path instanceof Array ? path : [path];
103	useUniqueID = useUniqueID || false;
104
105		// se ho già caricato l'include mi limito ad eseguire la CB
106
107	/*jslint loopfunc: true */
108	for (var i = 0, m = path.length; i < m; i++) {
109
110		var fName = path[i];
111
112		if (FlexJS.Loader.sCache[ fName ]) {
113
114				// se siamo all'ultimo elemento
115
116			if (i == m - 1) {
117
118				if (cb) cb();
119
120				return;
121			}
122		}
123
124		var script = document.createElement('script');
125
126			// aggiunge al nome del file un identificativo numerico univoco
127			// per forzare il caricamento (no cache) per il debug
128
129		script.type = 'text/javascript';
130		script.src = FlexJS.AppConfigure.Get('kBaseURL') + fName + (useUniqueID ? ('?v=' + FlexJS.Utils.Random(1, 9999)) : '');
131
132			// metto la callback solamente sull'ultimo elemento
133
134		var f;
135		if (i === m - 1) {
136
137			f = function() {
138
139				FlexJS.Loader.sCache[ fName ] = true;
140				if (cb) cb();
141			};
142
143		} else {
144
145			f = function() {
146
147				FlexJS.Loader.sCache[ fName ] = true;
148			};
149		}
150
151		if (FlexJS.isIE)
152			script.onreadystatechange = function () {
153				if (! script.p && (script.readyState === 'loaded' || script.readyState === 'complete')) {
154					f();
155					script.p = true;
156				}
157			};
158		else
159			$(script).on('load', f /* cb */ );
160
161		document.getElementsByTagName('head')[0].appendChild(script);
162	}
163};
164
165FlexJS.Loader.LoadCSS = function (path) {
166
167	if (FlexJS.Loader.sCache[path])
168		return;
169
170	var css = document.createElement('link');
171
172	css.type = 'text/css';
173	css.rel = 'stylesheet';
174	css.href = FlexJS.AppConfigure.Get('kBaseURL') + path; //'js/jq/jDialog/jDialog.css';
175	css.media = 'screen';
176
177	document.getElementsByTagName('head')[0].appendChild(css);
178
179	FlexJS.Loader.sCache[ path ] = true;
180};
181
182	//
183	// Funzionalità ajax
184	//
185
186fjs.Ajax = window.FlexJS.Ajax || {};
187fjs.ajax = fjs.Ajax;
188
189	// installa un gestore globale per gli errori ajax
190
191fjs.ajax.sUnloading = false;
192$(window).bind('beforeunload', function() { fjs.ajax.sUnloading = true; });
193
194$(document).ajaxError(function(e, xhr, settings, exception) {
195
196	fjs.ajax.errorCB(e, xhr, settings, exception);
197});
198
199	// default implementation
200
201fjs.ajax.errorCB = function(e, xhr, settings, exception) {
202
203	if (! fjs.ajax.sUnloading && xhr.statusText !== 'abort' && fjs.AppConfigure.Get('isDevel')) {
204
205		fjs.ajax.msgbox(
206			fjs.ajax.msgbox.serverError,
207			'Status: [' + xhr.status + '] Exception: [' + exception + ']<hr />' + xhr.responseText
208		);
209	}
210};
211
212fjs.ajax.setErrorCallback = function(f) { fjs.ajax.errorCB = f; };
213
214fjs.ajax.urlFromPath = function(path) { return fjs.AppConfigure.Get('kBaseURL') + 'modules/ajax/ajax.php/' + ($.isArray(path) ? path.join('/') : path) };
215
216	// effettua una chiamata all'ajax server con il path specificato
217	// path può essere una stringa o un array:
218	//
219	//     .get('tree/load', ...)
220	//     .get(['tree', 'load'], ...)
221	//
222	// la callback, se presente, deve accettare un parametro: il risultato
223
224fjs.ajax.get = function(path, cb) {
225
226	// var url = fjs.AppConfigure.Get('kBaseURL') + 'modules/ajax/ajax.php/' + ($.isArray(path) ? path.join('/') : path);
227	$.get(fjs.ajax.urlFromPath(path), {
228		u: new Date().valueOf()
229	}, function(data) {
230
231		if (data && data.__flexjs__) {
232
233			if (data.__flexjs__.dbg && fjs.AppConfigure.Get('isDevel'))
234				fjs.ajax.msgbox(fjs.ajax.msgbox.debug, data.__flexjs__.dbg);
235
236			if (data.__flexjs__.assets) {
237
238				// TBD: temporaneo
239				$.each(data.__flexjs__.assets, function(k, v) {
240
241					for (var i = 0; i < v.length; i++) {
242
243						switch (k) {
244
245							case '__pgassetcssfromurl':
246									$('head').append('<link rel="stylesheet" href="' + v + '" type="text/css" />');
247								break;
248
249							default: alert('Unrecognized [' + k + '] in ajax __assets for value ' + v); //NOSONAR
250						}
251					}
252				});
253			}
254		}
255
256			// se si è verificato un errore nel processing
257			// della richiesta ajax lato server
258			// sono valorizzati:
259			// - .error
260			// - .errormsg
261
262		if (data.error && fjs.AppConfigure.Get('isDevel')) {
263
264			fjs.ajax.msgbox(fjs.ajax.msgbox.error, data.errormsg);
265
266		} else if (cb)
267			cb(data);
268
269	}, 'json');
270};
271
272fjs.ajax.post = function(path, p, cb) {
273
274	p = p || {};
275	p.u = new Date().valueOf();
276
277	// var url = fjs.AppConfigure.Get('kBaseURL') + 'modules/ajax/ajax.php/' + ($.isArray(path) ? path.join('/') : path);
278
279	return $.post(fjs.ajax.urlFromPath(path), p, function(data) {
280
281		if (data.__flexjs__) {
282
283			if (data.__flexjs__.dbg && fjs.AppConfigure.Get('isDevel'))
284				fjs.ajax.msgbox(fjs.ajax.msgbox.debug, data.__flexjs__.dbg);
285		}
286
287			// se si è verificato un errore nel processing
288			// della richiesta ajax lato server
289			// sono valorizzati:
290			// - .error
291			// - .errormsg
292
293		if (data.error && fjs.AppConfigure.Get('isDevel')) {
294
295			fjs.ajax.msgbox(fjs.ajax.msgbox.error, data.errormsg);
296
297		} else if (cb)
298			cb(data);
299
300	}, 'json');
301};
302
303	// un semplice gestore per la visualizzazione di un messaggio
304	// di errore nel caso in cui la chiamata ajax fallisca lato server
305	// oppure di messaggi di debug
306
307fjs.ajax.msgbox = function(k, m) {
308
309	var
310		wnd = $(window),
311
312		date = new Date(),
313
314		ss = date.getSeconds(),
315		mm = date.getMinutes(),
316
317		t = [
318			'Debug',
319			'Error in ajax call',
320			'Server Error in ajax call'
321		][ k ],
322
323		h = $('<div><div class="title">[' + fjs.ajax.msgbox.instance + ' - ' + (mm < 10 ? '0' : '') + mm + ':' + (ss < 10 ? '0' : '') + ss + '] ' + t + '<div class="dbg-close" style="float: right">X</div></div><div class="content"/></div>')
324			.appendTo(document.body)
325			.css({
326				position: 'absolute',
327				zIndex: 1001,
328
329				width: 600,
330				height: 400,
331				overflowY: 'scroll',
332
333				border: '1px solid ' + (FlexJS.Ajax.msgbox.debug ? 'red' : '#0095CD'),
334				backgroundColor: 'white',
335
336				fontFamily: 'tahoma, verdana, arial, sans-serif',
337
338				cursor: 'pointer'
339			})
340	;
341
342	h.css({
343			top: /* doc.scrollTop() + */ (wnd.height() - h.height()) / 5 + fjs.ajax.msgbox.instance * 10,
344			left: (wnd.width() - h.width()) / 2 + fjs.ajax.msgbox.instance * 10
345		})
346		.addClass('dbg-drag-container')
347	;
348
349	fjs.ajax.msgbox.instance++;
350
351	$('div.title', h)
352		.css({
353			color: 'white',
354			background: FlexJS.Ajax.msgbox.debug ? 'red' : '#0095CD',
355
356			fontWeight: 'bold',
357			fontSize: '1.1em',
358
359			padding: '6px 20px'
360		})
361	;
362
363	$('div.dbg-close', h).click(function() { h.fadeOut(); });
364
365	$('div.content', h)
366		.css({
367			fontSize: '0.9em',
368			padding: '5px 20px',
369			backgroundColor: 'white'
370		})
371		.html(m)
372	;
373
374		// init only when needed
375
376	if (fjs.Ajax.msgbox.dragging === 1337) {
377
378		$(document.body).on('mousedown', '.dbg-drag-container', function (e) {
379
380			var parentOffset = $(this).offset();
381			//or $(this).offset(); if you really just want the current element's offset
382
383			fjs.Ajax.msgbox.dragging = {
384				ox: e.pageX - parentOffset.left,
385				oy: e.pageY - parentOffset.top,
386				e: $(this),
387			};
388		});
389
390		$(document.body).on('mouseup', function (e) {
391
392			fjs.Ajax.msgbox.dragging = false;
393		});
394
395		$(document.body).on('mousemove', function(e) {
396
397			if (fjs.Ajax.msgbox.dragging !== false)
398
399				fjs.Ajax.msgbox.dragging.e.offset({
400					top: e.pageY - fjs.Ajax.msgbox.dragging.oy,
401					left: e.pageX - fjs.Ajax.msgbox.dragging.ox
402				});
403		});
404
405		fjs.Ajax.msgbox.dragging = false;
406	}
407//	h.click(function() { $(this).fadeOut(); });
408};
409
410fjs.ajax.msgbox.instance = 0;
411fjs.Ajax.msgbox.dragging = 1337;
412fjs.Ajax.msgbox.debug = 0;
413fjs.Ajax.msgbox.error = 1;
414fjs.Ajax.msgbox.serverError = 2;
415
416	// gestione Cookie GDPR
417
418fjs.euCookie = {
419
420	_data: fjs.AppConfigure.Get('eucookie') || { settings: 1 },
421	_map: { necessary: 1, preferences: 2, statistics: 4, marketing: 8 },
422
423	handler: null,
424
425	getSettings: function() { return fjs.euCookie._data.settings; },
426	setSettings: function(s) { fjs.euCookie._data.settings = s; },
427
428	isTypeEnabled: function(t) { return (fjs.euCookie._data.settings & fjs.euCookie._map[t]) !== 0; },
429
430	activateScriptsOfType: function(type) {
431
432		const els = document.querySelectorAll('script');
433		for (var i = 0; i < els.length; i++) {
434
435			const el = els[i];
436			if (el.tagName === 'SCRIPT') { // TBD: per altri tipi
437
438				if (el.dataset['cookieconsent'] !== undefined) {
439
440					if (fjs.euCookie._map[ el.dataset['cookieconsent'] ] != type)
441						continue;
442
443				} else
444					continue;
445
446				const nel = document.createElement('script');
447
448					// nota: IE 11 non supporta k of
449
450				for (var k in Object.keys(el.dataset))
451					nel.dataset[k] = el.dataset[k];
452
453				nel.type = 'text/javascript';
454				nel.innerText = el.innerText;
455				nel.text = el.text;
456				nel.class = el.class;
457				nel.style.cssText = el.style;
458				nel.id = el.id;
459				nel.name = el.name;
460				nel.defer = el.defer;
461				nel.async = el.async;
462
463				if (el.src)
464					nel.src = el.src;
465
466				const parent = el.parentElement;
467
468				parent.insertBefore(nel, el);
469				parent.removeChild(el);
470			}
471		}
472	}
473};
474
475(function() {
476
477	const settings = fjs.euCookie.getSettings();
478	[2, 4, 8].forEach(function(v) {
479
480		if ((v & settings) > 0) {
481
482			console.log('initial activating type', v);
483			fjs.euCookie.activateScriptsOfType(v);
484		}
485	});
486
487})();
488
489	//
490	// utility generiche
491	//
492
493FlexJS.Utils = window.FlexJS.Utils || {};
494
495FlexJS.Utils.InArray = function(needle, haystack) {
496
497	for (var i = 0, m = haystack.length; i < m; i++) {
498
499		if (haystack[i] === needle)
500			return true;
501	}
502
503	return false;
504};
505
506FlexJS.Utils.Random = function(min, max) {
507
508	if (! min) min = 0;
509	if (! max) max = 1e10;
510
511	return Math.round(max * Math.random() + min);
512};
513
514	// conversione da e verso JSON
515
516FlexJS.Utils.toJSON = function(o) {
517
518	if (typeof(JSON) == 'object' && JSON.stringify)
519		return JSON.stringify(o);
520
521	var type = typeof(o);
522
523	if (o === null)
524		return 'null';
525
526	if (type == 'undefined')
527		return undefined;
528
529	if (type == 'number' || type == 'boolean')
530		return o + '';
531
532	if (type == 'string')
533		return FlexJS.Utils.q(o);
534
535	if (type == 'object') {
536
537			// caso speciale per la codifica delle date
538
539		if (o.constructor === Date) {
540
541			var month = o.getUTCMonth() + 1;
542			if (month < 10) month = '0' + month;
543
544			var day = o.getUTCDate();
545			if (day < 10) day = '0' + day;
546
547			var year = o.getUTCFullYear();
548
549			var hours = o.getUTCHours();
550			if (hours < 10) hours = '0' + hours;
551
552			var minutes = o.getUTCMinutes();
553			if (minutes < 10) minutes = '0' + minutes;
554
555			var seconds = o.getUTCSeconds();
556			if (seconds < 10) seconds = '0' + seconds;
557
558			var milli = o.getUTCMilliseconds();
559			if (milli < 100) milli = '0' + milli;
560			if (milli < 10) milli = '0' + milli;
561
562			return '"' + year + '-' + month + '-' + day + 'T' +
563				hours + ':' + minutes + ':' + seconds +
564				'.' + milli + 'Z"'
565			;
566		}
567
568		if (o.constructor === Array) {
569
570			var ret = [];
571			for (var i = 0, m = o.length; i < m; i++)
572				ret.push( FlexJS.Utils.toJSON(o[i]) || 'null' );
573
574			return '[' + ret.join(',') + ']';
575		}
576
577		var pairs = [];
578		for (var k in o) {
579
580			var name;
581			type = typeof k;
582
583			if (type === 'number')
584				name = '"' + k + '"';
585			else if (type === 'string')
586				name = FlexJS.Utils.q(k);
587			else
588				continue;  // salta chiavi che non siano stringhe o numeri
589
590			if (typeof o[k] == 'function')
591				continue;  // salta elementi funzione
592
593			var val = FlexJS.Utils.toJSON(o[k]);
594
595			pairs.push(name + ':' + val);
596		}
597
598		return '{' + pairs.join(', ') + '}';
599	}
600};
601
602FlexJS.Utils.fromJSON = function(src) {
603
604	if (typeof(JSON) == 'object' && JSON.parse)
605		return JSON.parse(src);
606
607	var filtered = src;
608	filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@');
609	filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']');
610	filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, '');
611
612	if (/^[\],:{}\s]*$/.test(filtered))
613		return eval('(' + src + ')'); //NOSONAR
614	else
615		throw new SyntaxError('Error parsing JSON, source is not valid.');
616};
617
618FlexJS.Utils._escapable = /["\\\x00-\x1f\x7f-\x9f]/g;
619
620FlexJS.Utils._meta = {
621	'\b': '\\b',
622	'\t': '\\t',
623	'\n': '\\n',
624	'\f': '\\f',
625	'\r': '\\r',
626	'"' : '\\"',
627	'\\': '\\\\'
628};
629
630FlexJS.Utils.q = function(s) {
631
632	if (s.match(FlexJS.Utils._escapable)) {
633
634		return '"' + s.replace(FlexJS.Utils._escapable, function (a) {
635
636				var c = FlexJS.Utils._meta[a];
637				if (typeof c === 'string') return c;
638
639				c = a.charCodeAt();
640				return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
641			}) + '"'
642		;
643	}
644
645	return '"' + s + '"';
646};
647
648	//
649	// apertura in una nuova finestra dei link
650	//
651
652FlexJS.TBHack = window.FlexJS.TBHack || {};
653
654FlexJS.TBHack.sKeyCode = [13, 32];
655
656FlexJS.TBHack.Init = function() {
657
658	var blm = FlexJS.AppConfigure.Get('kBlankLinkMessage');
659
660	$('a.target_blank').each(function() {
661
662		this.title += blm;
663		this.setAttribute('target', '_blank');
664		this.setAttribute('rel', 'noopener noreferrer'); // nofollow
665	})
666};
667
668FlexJS.TBHack.Open = function(url) {
669
670		// apre in una finestra nuova
671
672	window.open(url, 'TBH' + FlexJS.Utils.Random(), 'noopener,noreferrer');
673};
674
675	// funzione usata per replicare il comportamento del click nel keypress
676
677FlexJS.TBHack.InitKeypress = function() {
678
679	$('.InputIMG').keypress(function(e) {
680
681		if (FlexJS.Utils.InArray(e.keyCode, FlexJS.TBHack.sKeyCode)) {
682
683			this.click();
684
685			return false;
686		}
687	});
688};
689
690	// estrae gli attributi meta dalla classe dell'oggetto
691	// se è specificato un nome, restituisce solo quel valore
692	//
693	// la struttura del nome della classe è:
694	//		snMeta-<name>-<value>
695	//
696	// TBD: duplicata in sn.js
697
698FlexJS.Utils.MetaFromEl = function(el, n) {
699
700	var
701		c = $(el).attr('class').split(' '),
702		mt = {},
703		e
704	;
705
706	for (var i = 0, m = c.length; i < m; i++) {
707
708		if ((e = c[i].match(/^snMeta\-(.*)\-(.*)$/)))
709			mt[ e[1] ] = e[2].replace(/_/g, '/');
710	}
711
712	return n ? mt[n] : mt;
713};
714
715	//
716	// inizializzazioni
717	//
718
719FlexJS.jq = $.fn.jquery;
720$().ready(function() {
721
722		// evita doppie inclusioni di versioni diverse
723
724	if (FlexJS.jq !== $.fn.jquery)
725		$('body').html('<h1>jquery version conflict</h1>');
726
727	setTimeout(function() {
728
729		FlexJS.TBHack.Init();
730		FlexJS.TBHack.InitKeypress();
731
732	}, 500);
733});
734
735	//
736	// JS inheritance
737	//
738	// cfr: http://ejohn.org/blog/simple-javascript-inheritance/
739	//
740
741(function() {
742
743	/*jslint expr: true */
744	var
745		initializing = false,
746		fnTest = /xyz/.test(function() { xyz; }) ? (/\b_super\b/) : /.*/	//NOSONAR
747	;
748
749		// The base Class implementation (does nothing)
750
751	this.Class = function() {};
752
753		// Create a new Class that inherits from this class
754
755	Class.extend = function(prop) {
756
757		var _super = this.prototype;
758
759			// Instantiate a base class (but only create the instance,
760			// don't run the init constructor)
761
762		initializing = true;
763		var prototype = new this();
764		initializing = false;
765
766			// Copy the properties over onto the new prototype
767
768		/*jslint loopfunc: true */
769		for (var name in prop) {
770
771				// Check if we're overwriting an existing function
772
773			prototype[name] = typeof prop[name] == 'function' &&
774				typeof _super[name] == 'function' && fnTest.test(prop[name]) ?
775					(function(name, fn) {
776						return function() {
777							var tmp = this._super;
778
779								// Add a new ._super() method that is the same method
780								// but on the super-class
781
782							this._super = _super[name];
783
784								// The method only need to be bound temporarily, so we
785								// remove it when we're done executing
786
787							var ret = fn.apply(this, arguments);
788							this._super = tmp;
789
790							return ret;
791						};
792					})(name, prop[name]) :
793					prop[name];
794		}
795
796			// The dummy class constructor
797
798		function Class() {
799
800			// All construction is actually done in the init method
801
802			if ( !initializing && this.init )
803				this.init.apply(this, arguments);
804		}
805
806			// Populate our constructed prototype object
807
808		Class.prototype = prototype;
809
810			// Enforce the constructor to be what we expect
811
812		Class.constructor = Class;
813
814			// And make this class extendable
815
816		Class.extend = arguments.callee;
817
818		return Class;
819	};
820
821})();
822
823fjs.sprintf = (function() {
824
825	/*jslint boss: true */
826
827	var
828		r = function(c, n) { for (var o = []; n > 0; o[--n] = c); return o.join(''); },
829		re1 = /^[^\x25]+/, // tutto fino al primo '%'
830		re2 = /^\x25{2}/, // escape di '%%'
831		re3 = /^\x25(?:(\d+)\$)?(\d+)?(?:\.(\d+))?([dfs])/
832	;
833
834	return function(/*s, a1, ...*/) {
835
836		var i = 0, a, f = arguments[i++], o = [], s = '', m, p;
837		while (f) {
838
839			if (m = re1.exec(f))
840				o.push(m[0]);
841			else if (m = re2.exec(f))
842				o.push('%');
843			else if (m = re3.exec(f)) {
844
845				if (((a = arguments[m[1] || i++]) === null) || (a === undefined))
846					throw('fjs.sprintf(): too few arguments');
847
848				switch (m[4]) {
849					case 'd': a = parseInt(a, 10); break;
850					case 'f': a = m[3] ? parseFloat(a).toFixed(m[3]) : parseFloat(a); break;
851					case 's': a = ((a = String(a)) && m[3] ? a.substring(0, m[3]) : a); break;
852				}
853
854				p = m[2] ? r('0', m[2] - String(a).length) : s;
855
856				o.push(s + p + a);
857			}
858
859			f = f.substring(m[0].length);
860		}
861
862		return o.join('');
863	};
864
865}());
866
867/*
868console.log(fjs.sprintf('this is a %s of %s -- %% --', 'test', 'sprintf'));
869console.log(fjs.sprintf('this is a %2$s of %1$s', 'test', 'sprintf'));
870console.log(fjs.sprintf('-- %10d --', 100));
871console.log(fjs.sprintf('-- %2.5f --', Math.PI));
872*/
873
874window.__st = {};
875window.__d = function(g, v) { __st[g] = v; };
876window.__ = function(tag) {
877
878	var
879		t = [].shift.call(arguments),
880		a = t.split('.')
881	;
882
883	if (arguments.length === 0)
884		return __st[ a[0] ][ a[1] ];
885
886	[].unshift.call(arguments, __st[ a[0] ][ a[1] ]);
887	return fjs.sprintf.apply(null, arguments);
888};
889
890/*
891__d('test', { uno: 'Simple Message % % %', due: 'Interpolated message [%s]' });
892console.log(__('test.uno'));
893console.log(__('test.due', 'this is interpolated'));
894*/
895
896	// funzione da eseguire allo scadere del tempo impostato (eg: 500 ms),
897	// tempo che può essere rinnovato (debounce) oppure annullato
898	//
899	// var a = new fjs.delayedFunction(500, function() { alert 'now'; });
900	//
901	// a.activate();	// schedulazione dell'esecuzione
902	// a.suspend();		// sospende l'esecuzione
903	// a.fire();		// esegue immediatamente
904
905fjs.delayedFunction = function(timeout, fn) {
906
907	this.tm = timeout;
908	this.fn = fn;
909
910	this.t = null; // timer
911};
912
913fjs.delayedFunction.prototype.activate = function() {
914
915	if (this.t !== null)
916		clearTimeout(this.t);
917
918	var me = this;
919	this.t = setTimeout(function() {
920
921		this.t = null;
922		me.fn();
923
924	}, this.tm);
925};
926
927fjs.delayedFunction.prototype.fire = function() {
928
929	this.cancel();
930	this.fn();
931};
932
933fjs.delayedFunction.prototype.suspend = function() {
934
935	clearTimeout(this.t);
936	this.t = null;
937};
938
939fjs.delayedFunction.prototype.cancel = function() {
940
941	if (this.t !== null) {
942
943		clearTimeout(this.t);
944
945		this.t = null;
946	}
947};

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.