PageSourceSearch

http://mobilese.ru/hostcmsfiles/main.js

js mobilese.ru collected 2026-10-04 09:38:18 UTC 17,391 bytes, 657 lines download raw bytes

1(function($) {
2	// Предварительная загрузка изображений
3	var cache = [];
4
5	$.extend({
6	preLoadImages: function()
7	{
8		var args_len = arguments.length;
9
10		for (var i = args_len; i--;)
11		{
12			var cacheImage = document.createElement('img');
13			cacheImage.src = arguments[i];
14			cache.push(cacheImage);
15		}
16	}
17	});
18
19	/*$.preLoadImages("/hostcmsfiles/images/shadow-b.png",
20	"/hostcmsfiles/images/shadow-l.png",
21	"/hostcmsfiles/images/shadow-lb.png",
22	"/hostcmsfiles/images/shadow-lt.png",
23	"/hostcmsfiles/images/shadow-r.png",
24	"/hostcmsfiles/images/shadow-rb.png",
25	"/hostcmsfiles/images/shadow-rt.png",
26	"/hostcmsfiles/images/shadow-t.png",
27	"/hostcmsfiles/images/ajax_loader.gif");*/
28
29	$(document).keydown(function(event) {
30
31		if (event.ctrlKey && !$(document.activeElement).is(":input"))
32		{
33			switch (event.which)
34			{
35				case 0x25: // Назад
36					if ($('#id_prev').length)
37					{
38						window.location = $('#id_prev').attr('href');
39					}
40				break;
41				case 0x27: // Вперед
42					if ($('#id_next').length)
43					{
44						window.location = $('#id_next').attr('href');
45					}
46				break;
47			}
48		}
49	});
50
51	// Тень для окна
52	$.fn.extend({
53		// http://upshots.org/javascript/jquery-copy-style-copycss
54		getStyleObject: function() {
55			var dom = this.get(0);
56			var style;
57			var returns = {};
58			if (window.getComputedStyle){
59							var camelize = function(a,b){
60											return b.toUpperCase();
61							};
62							style = window.getComputedStyle(dom, null);
63							for(var i = 0, l = style.length; i < l; i++){
64											var prop = style[i];
65											var camel = prop.replace(/\-([a-z])/g, camelize);
66											var val = style.getPropertyValue(prop);
67											returns[camel] = val;
68							};
69							return returns;
70			};
71			if (style = dom.currentStyle){
72							for(var prop in style){
73											returns[prop] = style[prop];
74							};
75							return returns;
76			};
77			if (style = dom.style){
78					for(var prop in style){
79							if(typeof style[prop] != 'function'){
80									returns[prop] = style[prop];
81							};
82					};
83					return returns;
84			};
85			return returns;
86		},
87		applyShadow: function()
88		{
89			return this.each(function(index, object){
90				var obj = $(object);
91
92				$('<div>').attr("class", 'tl').appendTo(obj);
93		    	$('<div>').attr("class", 't')
94		    	.height(15)
95		    	.appendTo(obj);
96
97		    	$('<div>').attr("class", 'tr').appendTo(obj);
98		    	$('<div>').attr("class", 'l')
99		    	.width(17)
100		    	.appendTo(obj);
101
102		    	$('<div>').attr("class", 'r')
103		    	.width(17)
104		    	.appendTo(obj);
105
106		    	$('<div>').attr("class", 'bl').appendTo(obj);
107
108		    	$('<div>').attr("class", 'b')
109		    	.height(21)
110		    	.appendTo(obj);
111
112		    	$('<div>').attr("class", 'br').appendTo(obj);
113			});
114		},
115		updateCaptcha: function(captchaKey, captchaHeight) {
116			return this.each(function(index, object) {
117				jQuery(object).prop('src', "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + Math.floor(Math.random()*100000));
118			});
119		},
120		clearSelect: function()
121		{
122			return this.each(function(index, object){
123				jQuery(object).empty().append(jQuery('<option>').attr('value', 0).text('…'));
124			});
125		}
126	});
127
128	var methods = {
129		show : function() {
130			$('body').css('cursor', 'wait');
131			var fade_div = $('#ajaxLoader'), jWindow = $(window);
132			if (fade_div.length === 0)
133			{
134				fade_div = $('<div></div>')
135					.appendTo(document.body)
136					.hide()
137					.prop('id', 'ajaxLoader')
138					.css('z-index', '1500')
139					.css('position', 'absolute')
140					.append($('<img>').prop('src', '/hostcmsfiles/images/ajax_loader.gif'));
141			}
142
143			fade_div.show()
144				.css('top', (jWindow.height() - fade_div.outerHeight(true)) / 2 + jWindow.scrollTop())
145				.css('left', (jWindow.width() - fade_div.outerWidth(true)) / 2 + jWindow.scrollLeft());
146		},
147		hide : function( ) {
148			$('#ajaxLoader').hide().css('left', -1000);
149			$('body').css('cursor', 'auto');
150		}
151	};
152
153	// Функции без создания коллекции
154	jQuery.extend({
155		loadingScreen: function(method) {
156			// Method calling logic
157			if (methods[method] ) {
158			  return methods[method].apply(this, Array.prototype.slice.call( arguments, 1 ));
159			} else {
160			  $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
161			}
162		},
163		clientSelectOptionsCallback: function(data, status, jqXHR) {
164			$.loadingScreen('hide');
165
166			jQuery(this).empty();
167			for (var key in data)
168			{
169				jQuery(this).append(jQuery('<option>').attr('value', key.substr(1)).text(data[key]));
170			}
171		},
172		clientRequest: function(settings) {
173			if (typeof settings.callBack == 'undefined')
174			{
175				alert('Callback function is undefined');
176			}
177
178			$.loadingScreen('show');
179
180			var path = settings.path, data = {};
181			data['_'] = Math.round(new Date().getTime());
182
183			jQuery.ajax({
184				context: settings.context,
185				url: path,
186				type: 'POST',
187				data: data,
188				dataType: 'json',
189				success: settings.callBack
190			});
191			return false;
192		},
193		loadLocations: function(path, shop_country_id)
194		{
195			$('#shop_country_location_city_id').clearSelect();
196			$('#shop_country_location_city_area_id').clearSelect();
197			$.clientRequest({path: path + '?ajaxLoad&shop_country_id=' + shop_country_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_id')});
198		},
199		loadCities: function(path, shop_country_location_id)
200		{
201			$('#shop_country_location_city_area_id').clearSelect();
202			$.clientRequest({path: path + '?ajaxLoad&shop_country_location_id=' + shop_country_location_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_city_id')});
203		},
204		loadCityAreas: function(path, shop_country_location_city_id)
205		{
206			$.clientRequest({path: path + '?ajaxLoad&shop_country_location_city_id=' + shop_country_location_city_id, 'callBack': $.clientSelectOptionsCallback, context: $('#shop_country_location_city_area_id')});
207		},
208		friendOperations: function(data, status, jqXHR) {
209			$.loadingScreen('hide');
210			var $this = jQuery(this);
211
212			switch (data)
213			{
214				case 'Added':
215					$this.text('Запрос на добавление в друзья отправлен.').prop("onclick", null);
216				break;
217				case 'Removed':
218					$this.text('Пользователь убран из друзей.').prop("onclick", null);
219				break;
220			}
221		}
222	});
223
224})(jQuery);
225
226function set_count_mod(input_id, step)
227{
228	var oCountMod = document.getElementById(input_id);
229
230	if (!(iCurrCount = parseInt(oCountMod.value))) {
231		iCurrCount = 0;
232	}
233
234	if (!(iCurrCount <= 0 && step < 0)) {
235			oCountMod.value = iCurrCount + step;
236	}
237}
238
239// Отображает/скрывает окно
240function SlideWindow(windowId)
241{
242	var windowDiv = document.getElementById(windowId);
243
244	if (windowDiv == undefined)
245	{
246		return false;
247	}
248
249	if (windowDiv.style.display == "block")
250	{
251		HideWindow(windowId);
252	}
253	else
254	{
255		ShowWindow(windowId);
256	}
257}
258
259// Удаляет дочерние элементы элемента с ID, равным node_id
260function deleteChildNodes(node_id)
261{
262	var node = document.getElementById(node_id);
263
264	if (node !== undefined)
265	{
266		if (node.hasChildNodes())
267		{
268			while (node.firstChild)
269			{
270				node.removeChild(node.firstChild);
271			}
272		}
273	}
274}
275
276// Магазин
277function doSetLocation(shop_country_id, path)
278{
279	var req = new JsHttpRequest();
280
281	// Отображаем экран загрузки
282	$.loadingScreen('show');
283
284	req.onreadystatechange = function()
285	{
286		if (req.readyState == 4)
287		{
288			// Убираем затемнение.
289			$.loadingScreen('hide');
290
291			if (req.responseJS != undefined)
292			{
293				// Данные.
294				if (req.responseJS.result != undefined)
295				{
296					oSelect = document.getElementById(location_select_id);
297
298					// Очищаем select
299					oSelect.options.length = 0;
300
301					// Добавляем значение " ... "
302					oSelect.options[oSelect.options.length] = new Option(" ... ", 0);
303
304					for (var key in req.responseJS.result)
305					{
306						oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1));
307					}
308
309					// Устанавливаем города
310					//doSetCity(oSelect.options[oSelect.selectedIndex].value);
311					oCity = document.getElementById(city_select_id);
312					oCity.options.length = 0;
313					oCity.options[oCity.options.length] = new Option(" ... ", 0);
314
315					oCityarea = document.getElementById(cityarea_select_id);
316					oCityarea.options.length = 0;
317					oCityarea.options[oCityarea.options.length] = new Option(" ... ", 0);
318				}
319			}
320			return true;
321		}
322	}
323
324	req.open('get', path + "?action=get_location&shop_country_id="+shop_country_id, true);
325
326	// Отсылаем данные в обработчик.
327	req.send(null);
328}
329
330function doSetCity(shop_location_id, path)
331{
332	var req = new JsHttpRequest();
333
334	// Отображаем экран загрузки
335	$.loadingScreen('show');
336
337	req.onreadystatechange = function()
338	{
339		if (req.readyState == 4)
340		{
341			// Убираем затемнение.
342			$.loadingScreen('hide');
343
344			if (req.responseJS != undefined)
345			{
346				// Данные.
347				if (req.responseJS.result != undefined)
348				{
349					oSelect = document.getElementById(city_select_id);
350
351					// Очищаем select
352					oSelect.options.length = 0;
353
354					// Добавляем значение " ... "
355					oSelect.options[oSelect.options.length] = new Option(" ... ", 0);
356
357					for (var key in req.responseJS.result)
358					{
359						oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1));
360					}
361
362					// Устанавливаем районы
363					//doSetCityArea(oSelect.options[oSelect.selectedIndex].value);
364
365					oCityarea = document.getElementById(cityarea_select_id);
366					oCityarea.options.length = 0;
367					oCityarea.options[oCityarea.options.length] = new Option(" ... ", 0);
368				}
369			}
370			return true;
371		}
372	}
373
374	req.open('get', path + "?action=get_city&shop_location_id="+shop_location_id, true);
375
376	// Отсылаем данные в обработчик.
377	req.send(null);
378}
379
380function doSetCityArea(shop_city_id, path)
381{
382	var req = new JsHttpRequest();
383
384	// Отображаем экран загрузки
385	$.loadingScreen('show');
386
387	req.onreadystatechange = function()
388	{
389		if (req.readyState == 4)
390		{
391			// Убираем затемнение.
392			$.loadingScreen('hide');
393
394			if (req.responseJS != undefined)
395			{
396				// Данные.
397				if (req.responseJS.result != undefined)
398				{
399					oSelect = document.getElementById(cityarea_select_id);
400
401					// Очищаем select
402					oSelect.options.length = 0;
403
404					// Добавляем значение " ... "
405					oSelect.options[oSelect.options.length] = new Option(" ... ", 0);
406
407					for (var key in req.responseJS.result)
408					{
409						oSelect.options[oSelect.options.length] = new Option(req.responseJS.result[key], key.substr(1));
410					}
411				}
412			}
413			return true;
414		}
415	}
416
417	req.open('get', path + "?action=get_cityarea&shop_city_id="+shop_city_id, true);
418
419	// Отсылаем данные в обработчик.
420	req.send(null);
421}
422
423// Плавающие блоки
424// получаем исходную позицию плавающего блока
425function GetStyle(drag_object, axis)
426{
427	var str_value = "";
428
429	if(document.defaultView && document.defaultView.getComputedStyle)
430	{
431		var css = document.defaultView.getComputedStyle(drag_object, null);
432		str_value = css ? css.getPropertyValue(axis) : null;
433	}
434	else if(drag_object.currentStyle)
435	{
436		str_value = drag_object.currentStyle[axis];
437
438		if (str_value == 'auto')
439		{
440			if (axis == 'top')
441			{
442				str_value = drag_object.offsetTop;
443			}
444			else
445			{
446				str_value = drag_object.offsetLeft;
447			}
448		}
449	}
450
451	return str_value;
452}
453
454function SetGradeMessage(message_id, grade_val)
455{
456	// Запрос backend-у
457	var req = new JsHttpRequest();
458
459	// Отображаем экран загрузки
460	$.loadingScreen('show');
461
462	req.onreadystatechange = function()
463	{
464		if (req.readyState == 4)
465		{
466			// Убираем затемнение.
467			$.loadingScreen('hide');
468
469			return true;
470		}
471	}
472
473	req.open('get', "./?action=set_message_grade&helpdesk_message_id="+message_id+"&grade="+grade_val, true);
474
475	// Отсылаем данные в обработчик.
476	req.send(null);
477}
478
479/**
480 * Обновление картинки CAPTCHA
481 * captchaKey - идентификатор CAPTCHA
482 * captchaHeight - высота картинки с CAPTCHA
483 */
484function ReNewCaptcha(captchaKey, captchaHeight)
485{
486	if (document.images['captcha'] != undefined)
487	{
488		var antiCache = Math.floor(Math.random()*100000);
489		document.images['captcha'].src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache;
490	}
491}
492
493/**
494 * Обновление картинки CAPTCHA для картинки по ее ID
495 * captchaKey - идентификатор CAPTCHA
496 * captchaHeight - высота картинки с CAPTCHA
497 */
498function ReNewCaptchaById(imageId, captchaKey, captchaHeight)
499{
500	$('#'+imageId).updateCaptcha(captchaKey, captchaHeight);
501}
502
503// Отображает/скрывает блок
504function ShowHide(divId)
505{
506	var windowDiv = document.getElementById(divId);
507
508	if (windowDiv == undefined)
509	{
510		return false;
511	}
512
513	if (windowDiv.style.display == "block")
514	{
515		windowDiv.style.display = 'none';
516	}
517	else
518	{
519		windowDiv.style.display = 'block';
520	}
521}
522
523//Функция обратного вызова при загрузке формы добавления на доску объявлений
524function callbackfunction_showFormAddItem(responseJS)
525{
526	if (typeof responseJS != 'undefined')
527	{
528		$.loadingScreen('hide');
529
530		// Данные.
531		if (typeof responseJS.result != 'undefined')
532		{
533			html = responseJS.result;
534
535			document.getElementById('AddItemForm').innerHTML = html;
536
537			// Выполняем скрипты из полученного с сервера HTML-а
538			runScripts(document.getElementById('AddItemForm').getElementsByTagName('SCRIPT'));
539
540			// Очищаем поле сообщений
541			var div_id_message = document.getElementById('AddItemMessage');
542
543			if (div_id_message)
544			{
545				div_id_message.innerHTML = '';
546			}
547
548			//cr('AddItemForm');
549		}
550	}
551}
552
553//Функция обратного вызова при отправке добавления на доску объявлений
554function callbackfunction_SendFormItem(responseJS)
555{
556	if (typeof responseJS != 'undefined')
557	{
558		if (responseJS.message != 'undefined')
559		{
560			var div_id_message = document.getElementById('AddItemMessage');
561
562			if (div_id_message)
563			{
564				div_id_message.innerHTML = responseJS.message;
565
566				// Выполняем скрипты из полученного с сервера HTML-а
567				runScripts(div_id_message.getElementsByTagName('SCRIPT'));
568
569				// Переходим к сообщению
570				window.location.href = (window.location.href.indexOf('#') >= 0 ? window.location.href : window.location.href + '#FocusAddItemMessage');
571			}
572		}
573	}
574}
575
576function ShowImgWindow(title, src, width, height)
577{
578	obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0");
579	obj.document.write("<html>");
580	obj.document.write("<head>");
581	obj.document.write("<title>"+title+"</title>");
582	obj.document.write("</head>");
583	obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
584	obj.document.write("<img src=\""+src+"\" width=\""+width+"\" height=\""+height+"\" />");
585	obj.document.write("</body>");
586	obj.document.write("</html>");
587	obj.document.close();
588}
589
590function getElementsByName_iefix(tag, name)
591{
592	var elem = document.getElementsByTagName(tag);
593	var arr = new Array();
594
595	var iarr = 0;
596
597	for(i = 0; i < elem.length; i++)
598	{
599		att = elem[i].getAttribute("name");
600
601		if(att == name)
602		{
603			arr[iarr] = elem[i];
604			iarr++;
605		}
606	}
607	return arr;
608}
609
610// Изменение высоты блока
611function changeHeightFloatBlockBorder (oBorder, iHeightAttribute, iStyleTop)
612{
613	var iElementHeight = 0;
614
615	for (i = 0; i < oBorder.length; i++)
616	{
617		iElementHeight = oBorder[i].parentNode.offsetHeight + iHeightAttribute;
618
619		if (iElementHeight > 0)
620		{
621			oBorder[i].style.height = iElementHeight + 'px';
622			oBorder[i].style.top = iStyleTop + 'px';
623		}
624	}
625}
626
627// -- Forum --
628function HideShow(id, id1)
629{
630	$("#"+id).css('display', 'none');
631	$("#"+id1).css('display', 'block');
632}
633
634// Скрипт открывает/скрывает форумы текущей группы
635function ShowForums(up,id,count)
636{
637	var down,up;
638	if (up == 0)
639	{
640		down = "none";
641		up = "";
642	}
643	else
644	{
645		down = "";
646		up = "none";
647	}
648
649	$("#down_"+id).css('display', down);
650	$("#up_"+id).css('display', up);
651
652	for(var i=1; i <= count; i++)
653	{
654		$("#"+id+"_"+i).css('display', up);
655	}
656}
657// --/ Forum --

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.