PageSourceSearch

https://www.arama.com/js/intelli/intelli.js

js arama.com collected 2026-10-04 07:47:06 UTC 9,000 bytes, 419 lines download raw bytes

1/**
2 * Main class
3 * @class
4 */
5intelli = function()
6{
7	return {
8		plugins: new Object(),
9		/**
10		 * Language array
11		 */
12		lang: new Object(),
13		/**
14		 * Clipboard object
15		 */
16		clipboard: null,
17		/**
18		 * Configuration array
19		 */
20		css: new Array(),
21		/**
22		 *  Exist value in the array
23		 *  @param {Array} arr array
24		 *  @param {String} value
25		 *  @return {Boolean}
26		 */
27		inArray: function(val, arr)
28		{
29			if(typeof arr == 'object' && arr)
30			{
31				for(var i = 0; i < arr.length; i++) 
32				{
33					if(arr[i] == val) 
34					{
35						return true;
36					}
37				}
38
39				return false;
40			}
41
42			return false;
43		},
44		/**
45		 * Remove one item in the array
46		 * @param {Array} arr array
47		 * @param {String} val value
48		 * @return {Array}
49		 */
50		remove: function(arr, val)
51		{
52			if(typeof arr == 'object')
53			{
54				for(var i = 0; i < arr.length; i++) 
55				{
56					if(arr[i] == val)
57					{
58						arr.splice(i, 1);
59					}
60				}
61			}
62
63			return arr;
64		},
65		/**
66		 *  Load configuration or language phrases
67		 *  @param {Array} array of parametrs lang|conf
68		 *  TODO: store variables in the session. Use sessvars lib.
69		 */
70		loader: function(params)
71		{
72			var out = '';
73			var url = '';
74
75			url += (typeof params.conf != 'undefined') ? 'conf=' + params.conf : '';
76			url += (typeof params.lang != 'undefined') ? '&lang=' + params.lang : '';
77
78			$.ajax({
79				type: 'POST', 
80				url: 'loader.php?load=vars', 
81				data: url,
82				async: false,
83				success: function(p)
84				{
85					out = eval('(' + p + ')');
86				}
87			});
88			
89			if(typeof out.conf != 'undefined')
90			{
91				if(null == intelli.conf)
92				{
93					intelli.conf = out.conf;
94				}
95				else
96				{
97					var keys = params.conf.split(',');
98					
99					for(var i = 0; i <= keys.length; i++)
100					{
101						intelli.conf[keys[i]] = out.conf[keys[i]];
102					}
103				}
104			}
105
106			if(typeof out.lang != 'undefined')
107			{
108				if(null == intelli.lang)
109				{
110					intelli.lang = out.lang;
111				}
112				else
113				{
114					var keys = params.lang.split(',');
115					
116					for(var i = 0; i <= keys.length; i++)
117					{
118						intelli.lang[keys[i]] = out.lang[keys[i]];
119					}
120				}
121			}
122		},
123		/**
124		 *  Hidding or showing some element
125		 *  @param {String} obj Can be passed with # symbol
126		 *  @param {String} action  show|hide|auto
127		 */
128		display: function(obj, action)
129		{
130			var obj = (typeof obj == 'object') ? obj : (-1 != obj.indexOf('#')) ? $(obj) : $('#' + obj);
131			
132			action = action ? action : 'auto';
133
134			if ('auto' == action)
135			{
136				action = ('none' == obj.css('display')) ? 'show' : 'hide';
137			}
138			
139			if ('hide' == action)
140			{
141				obj.hide();
142			}
143
144			if ('show' == action)
145			{
146				obj.show();
147			}
148		},
149		/**
150		 * Return random letter
151		 * TODO: get several letters. get letter in upper case.
152		 */
153		getRandomLetter: function()
154		{
155			return String.fromCharCode(97 + Math.round(Math.random() * 25));
156
157			/* For upper case */
158			//return String.fromCharCode(65 + Math.round(Math.random() * 25));
159		},
160		/**
161		 * Show error message
162		 */
163		error: function(error)
164		{
165			alert(error);
166		},
167		/**
168		 * Create new cookie
169		 * @param {String} name The name of cookie
170		 * @param {String} value The value of cookie
171		 * @param {Integer} days The expire time of cookie
172		 */
173		createCookie: function(name, value, days)
174		{
175			if (days)
176			{
177				var date = new Date();
178				date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
179				var expires = "; expires=" + date.toGMTString();
180			}
181			else 
182			{
183				var expires = "";
184			}
185			
186			document.cookie = name + "=" + value + expires + "; path=/";
187		},
188		/**
189		 * Return the value of cookie
190		 * @param {String} name The name of cookie
191		 * @return {String}
192		 */
193		readCookie: function(name)
194		{
195			var nameEQ = name + "=";
196			var ca = document.cookie.split(';');
197			for(var i = 0; i < ca.length; i++)
198			{
199				var c = ca[i];
200				while (c.charAt(0)==' ') c = c.substring(1, c.length);
201				if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
202			}
203			return null;
204		},
205		/**
206		 * Clear cookie value
207		 * @param {String} name The name of cookie
208		 */
209		eraseCookie: function(name)
210		{
211			this.createCookie(name, "", -1);
212		},
213		cssCapture: function(attr, val)
214		{
215			this.css.push(attr + ':' + val);
216		},
217		cssClear: function()
218		{
219			this.css = [];
220		},
221		cssExtract: function()
222		{
223			return this.css.join('; ') + ';';
224		},
225		urlVal: function( name )
226		{
227			name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
228			
229			var regexS = "[\\?&]"+name+"=([^&#]*)";
230			var regex = new RegExp( regexS );
231			var results = regex.exec(window.location.href);
232			
233			if(results == null)
234			{
235				return null;
236			}
237			else
238			{
239				return results[1];
240			}
241		},
242		notifBox: function(o)
243		{
244			var obj = $("#" + o.id);
245			var html = '';
246
247			if (!obj.length)
248			{
249				this.error("Can't find element with ID: " + o.id);
250
251				return false;
252			}
253
254			html += '<ul class="unstyled">';
255			for(var i = 0; i < o.msg.length; i++)
256			{
257				html += '<li>' + o.msg[i] + '</li>';
258			}
259			html += '</ul>';
260
261			obj.addClass(o.type).html(html).show();
262
263			$('html, body').animate({scrollTop: obj.offset().top}, 'slow');
264		},
265		is_int: function(input)
266		{
267			return !isNaN(input) && parseInt(input) == input;
268		},
269		is_email: function(email)
270		{
271			var result = email.search(/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,3})+$/);
272			
273			if(result > -1)
274			{
275				return true;
276			}
277			else
278			{
279				return false;
280			}
281		},
282		ckeditor: function(name, o)
283		{
284			var opts = {
285				baseHref: intelli.config.esyn_url,
286				filebrowserImageUploadUrl: intelli.config.esyn_url + 'ck_upload.php?Type=Image'
287			};
288
289			if(o)
290			{
291				$.each(o, function(i, p)
292				{
293					opts[i] = p;
294				});
295			}
296
297			CKEDITOR.replace(name, opts);
298		},
299		trim: function(str)
300		{
301			return str.replace(/^\s+|\s+$/g,"");
302		},
303		// http://kevin.vanzonneveld.net
304		// +   original by: Mirek Slugen
305		// +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
306		// +   bugfixed by: Nathan
307		// +   bugfixed by: Arno
308		// +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
309		// +    bugfixed by: Brett Zamir (http://brett-zamir.me)
310		// +      input by: Ratheous
311		// +      input by: Mailfaker (http://www.weedem.fr/)
312		// +      reimplemented by: Brett Zamir (http://brett-zamir.me)
313		// +      input by: felix
314		// +    bugfixed by: Brett Zamir (http://brett-zamir.me)
315		// %        note 1: charset argument not supported
316		// *     example 1: htmlspecialchars("<a href='test'>Test</a>", 'ENT_QUOTES');
317		// *     returns 1: '&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;'
318		// *     example 2: htmlspecialchars("ab\"c'd", ['ENT_NOQUOTES', 'ENT_QUOTES']);
319		// *     returns 2: 'ab"c&#039;d'
320		// *     example 3: htmlspecialchars("my "&entity;" is still here", null, null, false);
321		// *     returns 3: 'my &quot;&entity;&quot; is still here'
322		htmlspecialchars: function(string, quote_style, charset, double_encode)
323		{
324			var optTemp = 0,
325			i = 0,
326			noquotes = false;
327			if (typeof quote_style === 'undefined' || quote_style === null) {
328				quote_style = 2;
329			}
330			string = string.toString();
331			if (double_encode !== false) { // Put this first to avoid double-encoding
332				string = string.replace(/&/g, '&amp;');
333			}
334			string = string.replace(/</g, '&lt;').replace(/>/g, '&gt;');
335
336			var OPTS = {
337				'ENT_NOQUOTES': 0,
338				'ENT_HTML_QUOTE_SINGLE': 1,
339				'ENT_HTML_QUOTE_DOUBLE': 2,
340				'ENT_COMPAT': 2,
341				'ENT_QUOTES': 3,
342				'ENT_IGNORE': 4
343			};
344			if (quote_style === 0) {
345				noquotes = true;
346			}
347			if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags
348				quote_style = [].concat(quote_style);
349				for (i = 0; i < quote_style.length; i++) {
350					// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
351					if (OPTS[quote_style[i]] === 0) {
352						noquotes = true;
353					} else if (OPTS[quote_style[i]]) {
354						optTemp = optTemp | OPTS[quote_style[i]];
355					}
356				}
357				quote_style = optTemp;
358			}
359			if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
360				string = string.replace(/'/g, '&#039;');
361			}
362			if (!noquotes) {
363				string = string.replace(/"/g, '&quot;');
364			}
365
366			return string;
367		}
368	};
369}();
370
371function f1()
372{
373	var s = '';
374
375	$('#htaccess_code textarea').each(function()
376	{
377		s += $(this).val();
378		s += "\r\n\r\n";
379	});
380
381	if (window.clipboardData)
382	{
383		window.clipboardData.setData('text', s);
384	}
385	else
386	{
387		return (s);
388	}
389}
390
391if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment)
392{
393	Range.prototype.createContextualFragment = function(html)
394	{
395		var frag = document.createDocumentFragment(), 
396		div = document.createElement("div");
397		frag.appendChild(div);
398		div.outerHTML = html;
399		return frag;
400	};
401}
402
403function _t(key, def)
404{
405	if (intelli.admin.lang[key])
406	{
407		return intelli.admin.lang[key];
408	}
409	else
410	{
411		return (def ? (def === true ? key : def) : '{'+key+'}');
412	}
413}
414
415function _f(key, def)
416{
417	if(intelli.lang[key]) return intelli.lang[key];
418	else return (def ? (def === true ? key : def) : '{'+key+'}');
419}

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.