PageSourceSearch

https://u-metprom.ru/menu/scripts.js

js u-metprom.ru collected 2026-10-05 00:35:39 UTC 11,134 bytes, 374 lines download raw bytes

1var n = navigator.userAgent.toLowerCase();
2$.browser.safari4 = $.browser.webkit && !!n.match('version\/4\.');
3$.browser.mobile = !!n.match('mobile');
4var count_tr = 0;
5
6initMainMenu();
7
8$(function(){
9	if ($.browser.opera) {
10		$('body').addClass('opera');
11		if (parseFloat($.browser.version) && parseFloat($.browser.version) < 10.50) {
12			$('body').addClass('operaOld');
13		}
14	}
15
16	if ($.browser.safari4) {
17		$('body').addClass('safari4');
18		$('.cf, .clearfix').after('<div class="clear">&nbsp;</div>');
19	}
20
21	var reviewAdd = $('.reviews .add');
22	if (reviewAdd.length) {
23		$('.blackButtons .i_add').hover(function(){
24			reviewAdd.toggleClass('addHover');
25		})
26		reviewAdd.hover(function(){
27			$('.blackButtons .i_add').toggleClass('i_add_hover');
28		})
29	}
30
31	var reviewsInterval = 0;
32/*	$('.reviews .item .t').click(function(){
33		document.location = $(this).parent().find('a:last').attr('href');
34	})
35	$('.reviews .item').hover(function(e){
36		var item = $(this);
37		if (e.type == 'mouseenter') {
38			reviewsInterval = setInterval(function(){
39				item.addClass('item_hover');
40			}, 300);
41		} else {
42			clearInterval(reviewsInterval);
43			reviewsInterval = 0;
44			item.removeClass('item_hover');
45		}
46		//
47		//$(this).toggleClass('item_hover');
48	})*/
49
50	var markDefText = '';
51	$('.mark .select a')
52		.hover(function(){
53			markDefText = $('.mark .select span').text();
54			$('.mark .select span').text($(this).attr('alt'));
55		}, function() {
56			$('.mark .select span').text(markDefText);
57		});
58
59	$('.smallSearch .i').focus(function(){
60		if ($(this).val() == 'ïîèñê ïî ðàçäåëó') $(this).val('');
61	});
62	$('.smallSearch :submit').bind('mousedown mouseup', function(){
63		$('.smallSearch :submit').toggleClass('pressed');
64	});
65
66	if($('.pager .s').length>0){
67		$('.pager .s').prevUntil('.prev').addClass('past');
68	}
69
70	$('.accordion .a').click(function() {
71		if (!$(this).hasClass('as')) {
72                        var strt  = '';
73                        var strt2 = '';
74                        var strt3 = '';
75                        //alert($(this).attr('id'));
76                       /* if ($('#average_ar').is(":hidden")) {
77                            $('#average_ar').show();
78                        }*/
79                        if($(this).attr('id')=='average'){
80                         //   strt = 'id="average_ar"';
81                           // strt2= 'id="average"';
82                            strt3 = 'id="average"';
83                            $('#average_ar').hide();
84                        }else{
85                            $('#average_ar').show();
86                        }
87
88                        if($('.accordion .as').attr('id')=='average'){
89                            strt  = 'id="average_ar"';
90                            strt2 = 'id="average"';
91                        }
92
93                        if($('.accordion .as').attr('id')=='average'){
94                            $('#average_ar').show();
95                        }
96
97                        $('.accordion .as').replaceWith("<a class='a' href='#' onclick='openAccordion(this); return false;' "+strt2+">" + $('.accordion .as').html() + "</a>");
98			//$('.accordion .as').removeClass('as');
99			$('.accordion .c').slideUp('fast');
100			$(this).addClass('as').next().slideDown('fast');
101                        $(this).replaceWith("<span class='a as' " + strt3 + ">" + $(this).html() + "</span>");
102			$('body').focus();
103		}
104		return false;
105	})
106
107	var files = $('form .files');
108	if (files.length) {
109		var tr = files.find('tr:first').clone();
110		tr.find('input').val('');
111		$('.add', files).click(function(){
112			if (files.find('tr').length < files.attr('max')) {
113				var index_file = files.find('tr').length +1;
114				count_tr++;
115				if(index_file>=3){
116					$('.add', files).empty();
117				}
118				var clone = '<tr><td><input type="file" name="attach_photo_' + index_file + '" size="65"/></td><td class="c2"><a href="#" class="del" onclick="filesDelClone(this); return false;">&nbsp;</a></td></tr>';
119				$(this).parents('.files:first').find('table').append(clone);
120			}
121			return false;
122		})
123
124		$('.del', files).click(function (){
125                    $(this).parents('tr:first').remove();
126                    count_tr--;
127                    if(count_tr<3){
128                        $('.add', files).html('Äîáàâèòü ôîòîãðàôèþ');
129                    }
130		});
131	}
132
133	$('.comments .item .q').click(function(){
134		pasteQ($(this).attr('title'), $(this).parent().find('div:first').html());
135    return false;
136	});
137
138	if ($.fn.lightBox) {
139		var max = 1200;
140		if (screen && screen.width && screen.width < 1200) max = 960;
141		$('#bigImage, .auto .img .cf a').lightBox({allwaysShowControls: true, maxImageWidth: max});
142
143    if($('.catalogImages').length>0){
144      $('.catalogImages').lightBox({allwaysShowControls: true, maxImageWidth: max});
145    }
146	}
147	$('.auto .img .cf a').unbind('click');
148})
149
150$('.auto .img .cf a').live('click', function(e){
151  if ($(this).attr('img') == $('#bigImage img').attr('src')) return false;
152
153  $('#bigImage img').fadeTo(1500, 0.1);
154  $('#bigImage').attr('href', $(this).attr('href'));
155
156		$('<img/>')
157			.one('load', function(){
158				$('#bigImage img').attr('src', this.src);
159				$('#bigImage img').stop(true, false).fadeTo('fast', 1);
160			})
161			.attr('src', $(this).attr('img'));
162  return false;
163}).live('dblclick', function(e){
164  $('#bigImage img').click();
165  return false;
166});
167
168/*function randomNumber (m,n)
169{
170  m = parseInt(m);
171  n = parseInt(n);
172  return Math.floor( Math.random() * (n - m + 1) ) + m;
173}*/
174
175/*
176function cvt(key, type, isA)
177{
178    if(isA){
179	our_common_ajax_processor(document.getElementById('ivote_comment'+key),true,{'mode':'ivote_comment','comment_id':key,'ivote_mark':type,'spec': Math.random()%500});
180    }else{
181        our_common_ajax_processor(document.getElementById('ivote_comment'+key),true,{'mode':'ivote_comment','comment_id':key,'ivote_mark':type});
182    }
183    return false;
184}
185*/
186function openAccordion(link){
187    if (!$(link).hasClass('as')) {
188            var strt = '';
189            var strt2= '';
190            var strt3= '';
191            /*if ($('#average_ar').is(":hidden")) {
192                $('#average_ar').show();
193            }*/
194
195            if($(link).attr('id')=='average'){
196                strt3 = 'id="average"';
197                $('#average_ar').hide();
198            }else{
199                $('#average_ar').show();
200            }
201
202            if($('.accordion .as').attr('id')=='average'){
203                strt = 'id="average_ar"';
204                strt2 = 'id="average"';
205            }
206            //alert($(link).attr('id'));
207            $('.accordion .as').replaceWith("<a class='a' href='#' onclick='openAccordion(this); return false;'  "+strt2+" >" + $('.accordion .as').html() + "</a>");
208            //$('.accordion .as').removeClass('as');
209            $('.accordion .c').slideUp('fast');
210            $(link).addClass('as').next().slideDown('fast');
211            $(link).replaceWith("<span class='a as' " + strt3 + ">" + $(link).html() + "</span>");
212            $('body').focus();
213    }
214}
215
216function filesDelClone(element){
217	count_tr--;
218	if(count_tr<3){
219		$('form .add').html('Äîáàâèòü ôîòîãðàôèþ');
220	}
221	$(element).parents('tr:first').remove();
222	return false;
223}
224
225
226function strip_tags( str ){
227	str = str.replace(/\s\s/gim, ' ');
228	return str.replace(/<\/?[^>]+>/gim, '');
229}
230
231
232
233function insertAtCaret (textObj, textFieldValue) {
234	if (document.all) {
235		if (textObj.createTextRange && textObj.caretPos && !window.opera) {
236			var caretPos = textObj.caretPos;
237			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?textFieldValue + ' ' : textFieldValue;
238		} else {
239			textObj.value += textFieldValue;
240		}
241	} else {
242		if (textObj.selectionStart) {
243			var rangeStart = textObj.selectionStart;
244			var rangeEnd = textObj.selectionEnd;
245			var tempStr1 = textObj.value.substring(0, rangeStart);
246			var tempStr2 = textObj.value.substring(rangeEnd, textObj.value.length);
247			textObj.value = tempStr1 + textFieldValue + tempStr2;
248			textObj.selectionStart = textObj.selectionEnd = rangeStart + textFieldValue.length;
249		} else {
250			textObj.value += textFieldValue;
251		}
252	}
253}
254
255function pasteQ(nick, temp_txt) {
256
257	var txt      = '';
258
259	/*var reg = /\s*?<div[^>]*?>\s*?<div[^>]*?>\s*?\S*?\s*?<\/div\s*?>\s*?<b>[\s*?\S*?\s*?]*?<\/b>[\s\S]*<\/div>/gim;
260
261	var reg1 = /\s*?<div[^>]*?>\s*?<div[^>]*?>\s*?\S*?\s*?<\/div\s*?>\s*?<b>[\s*?\S*?\s*?]*?<\/b>[\s\S]*?<\/div>/gim;*/
262
263    	var reg = /\s*?<div[^>]*?>\s*?<b>[\s*?\S*?\s*?]*?<\/b>[\s\S]*<\/div>/gim;
264
265	var reg1 = /\s*?<div[^>]*?>\s*?<b>[\s*?\S*?\s*?]*?<\/b>[\s\S]*?<\/div>/gim;
266
267	if (document.getSelection) {
268		txt = document.getSelection();
269		if(txt==''||txt==undefined||txt.length<=0){
270			txt = temp_txt;
271		}else{
272			if(temp_txt.toLowerCase().indexOf(txt.toLowerCase())==-1)
273				txt = temp_txt;
274		}
275	}else{
276		if (document.selection) {
277			txt = document.selection.createRange().text;
278			if(txt==''||txt==undefined||txt.length<=0){
279				txt = temp_txt;
280			}else{
281				if(temp_txt.toLowerCase().indexOf(txt.toLowerCase())==-1)
282					txt = temp_txt;
283			}
284		}else{
285			if (window.getSelection) {
286				txt = document.getSelection();
287				if(txt==''||txt==undefined||txt.length<=0){
288					txt = temp_txt;
289				}else{
290					if(temp_txt.toLowerCase().indexOf(txt.toLowerCase())==-1)
291						txt = temp_txt;
292				}
293			}
294		}
295	}
296
297        if(txt==''||txt==undefined||txt.length<=0){
298            txt = temp_txt;
299        }
300
301	found1 = txt.match(reg1);
302	while(found1!=null){
303		txt = txt.replace(reg1, "");
304		txt = txt.replace(/\s\s/gim, ' ');
305		found1 = txt.match(reg1);
306
307	}
308
309	found = txt.match(reg);
310	while(found!=null){
311		txt = txt.replace(reg, "");
312		txt = txt.replace(/\s\s/gim, ' ');
313		found = txt.match(reg);
314
315	}
316
317	txt = strip_tags(txt);
318	txt = '[quote=' + nick + ']' + txt + '[/quote]\n';
319	if (txt!='' && document.forms['comments_form']['comment_text']){
320		insertAtCaret(document.forms['comments_form']['comment_text'], txt);
321    $('#comment_text').focus();
322  }
323  return false;
324}
325
326
327function showHideVideoBlock(id_panel){
328    if ($("#"+id_panel).is(":hidden")) {
329        $("#"+id_panel).show();
330    } else {
331        $("#"+id_panel).hide();
332    }
333    return false;
334}
335
336/**
337 * "Âûïàäàíèå" ïóíêòîâ ãëàâíîãî ìåíþ
338 */
339function initMainMenu() {
340	// ñïåöèàëüíàÿ âåðñèÿ äëÿ iOS, â íåé íåò mouseover ñîáûòèÿ
341	if ($.browser.webkit && $.browser.mobile) {
342		$('.menushka td > div:has(.sub) > a').live('click', function(){
343			$(this).parents('td:first').find('.sub').toggle();
344			return false;
345		});
346
347		$(document).live('click', function(){
348			$('.menushka .sub').hide();
349		})
350	} else {
351		var menuInterval = 0;
352		$('.menushka td > div:not(.hov)').live('mouseenter mouseleave', function(ev) {
353			var td = $(this).parent();
354			if (ev.type == 'mouseover') {
355					menuInterval = setInterval(function(){
356						td.find('.sub').slideDown('fast');
357					}, 300);
358					td.addClass('hover');
359			} else {
360				if (menuInterval) {
361					clearInterval(menuInterval);
362					td.find('.sub').slideUp('fast');
363					menuInterval = 0;
364				}
365				td.removeClass('hover');
366			}
367		});
368
369		// ñêðûâàåì âûïàâøèå ïóíêòû ïðè ïåðåõîäå ïî ññûëêàì ÷òîáû bfcache â ff íå îòêðûâàë ìåíþ
370		$('.menushka a').live('click', function(){
371			$('.menushka td .sub').hide();
372		})
373	}
374}

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.