PageSourceSearch

https://cdn.smgrussia.ru/static/ecdf7/common.js

js smgrussia.ru collected 2026-09-28 13:27:47 UTC 28,448 bytes, 968 lines download raw bytes

1function getURLVar(key) {
2	var value = [];
3
4	var query = String(document.location).split('?');
5
6	if (query[1]) {
7		var part = query[1].split('&');
8
9		for (i = 0; i < part.length; i++) {
10			var data = part[i].split('=');
11
12			if (data[0] && data[1]) {
13				value[data[0]] = data[1];
14			}
15		}
16
17		if (value[key]) {
18			return value[key];
19		} else {
20			return '';
21		}
22	}
23}
24
25function send_reserve2(el) {
26		var form = $(el).closest('form');
27	$.ajax('/index.php?route=product/reserve', {
28		data: form.serializeArray(),
29		type: "POST",
30		dataType: 'json'
31	}).done(function(data) {
32		if('error' in data) {
33			alert(data.error);
34		} else if('success' in data) {
35			form.html('Заказ оформлен! Сотрудник свяжется с вами в рабочее время для уточнения деталей');
36		}
37	});
38}
39
40$(document).ready(function () {
41	// Highlight any found errors
42  $('.text-danger').each(function() {
43		var element = $(this).parent().parent();
44
45		if (element.hasClass('form-group')) {
46			element.addClass('has-error');
47		}
48	});
49
50	// Currency
51	$('#form-currency .currency-select').on('click', function (e) {
52		e.preventDefault();
53
54		$('#form-currency input[name=\'code\']').val($(this).attr('name'));
55
56		$('#form-currency').submit();
57	});
58
59	// Language
60	$('#form-language .language-select').on('click', function (e) {
61		e.preventDefault();
62
63		$('#form-language input[name=\'code\']').val($(this).attr('name'));
64
65		$('#form-language').submit();
66	});
67
68	/* Search */
69	$('#search input[name=\'search\']').parent().find('button').on('click', function () {
70		var url = '//' + window.location.hostname + '/index.php?route=product/search';
71		var value = jQuery('#search input[name=\'search\']').val();
72
73		if (value) {
74			url += '&search=' + encodeURIComponent(value);
75		}
76
77		location = url;
78	});
79
80	$('#search input[name=\'search\']').on('keydown', function (e) {
81		if (e.keyCode == 13) {
82			$('header #search input[name=\'search\']').parent().find('button').trigger('click');
83		}
84	});
85
86	// Menu
87	$('#menu .dropdown-menu').each(function () {
88		var menu = $('#menu').offset();
89		var dropdown = $(this).parent().offset();
90
91		var i = (dropdown.left + $(this).outerWidth()) - (menu.left + $('#menu').outerWidth());
92
93		if (i > 0) {
94			$(this).css('margin-left', '-' + (i + 10) + 'px');
95		}
96	});
97
98	// Checkout
99	$(document).on('keydown', '#collapse-checkout-option input[name=\'email\'], #collapse-checkout-option input[name=\'password\']', function (e) {
100		if (e.keyCode == 13) {
101			$('#collapse-checkout-option #button-login').trigger('click');
102		}
103	});
104
105	$(document).on('click', 'a.follow-to-link', function(e){
106		e.preventDefault();
107		window.parent.location = $(this).attr('href');
108		return false;
109	});
110
111	// tooltips on hover
112	$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
113
114	// Makes tooltips work on ajax generated content
115	$(document).ajaxStop(function () {
116		$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
117	});
118
119	var ip_fields = $('#ip_fields');
120	$('#is_ip input').change(function(){
121		if($(this).val() === '1') {
122			ip_fields.show();
123			ip_fields.find('.form-group').addClass('required');
124		} else {
125			ip_fields.hide();
126			ip_fields.find('.form-group').removeClass('required');
127		}
128	});
129});
130
131// Cart add remove functions
132function sendYandexMark(mark){
133  if(typeof yandexMarks != 'undefined'){
134    yandexMarks.reachGoal(mark);
135  }
136}
137
138function goToCheckoutUrl() {
139  sendYandexMark('Kupit_korzina');
140  setTimeout(function () {
141    window.location = jQuery('.success .checkout-link').attr('href');
142  }, 300);
143  return false;
144}
145function goToCompareUrl() {
146  window.location.href = jQuery('.success .compare-link').attr('href');
147  return false;
148}
149
150var success_close_img = '/catalog/view/theme/default/image/close.png';
151
152var cart = {
153  'add': function (product_id, mark, quantity) {
154    $.ajax({
155      url: '/index.php?route=checkout/cart/add',
156      type: 'post',
157      data: 'product_id=' + product_id + '&quantity=' + (typeof (quantity) != 'undefined' ? quantity : 1),
158      dataType: 'json',
159      beforeSend: function () {
160        fadeOutSuccess(100);
161        //$('#cart > button').button('loading');
162      },
163      complete: function () {
164        //$('#cart > button').button('reset');
165      },
166      success: function (json){
167        $('.alert, .text-danger').remove();
168        if (json['redirect']){
169          location = json['redirect'];
170        }
171        if (json['success']){
172          sendYandexMark(mark);
173          cart.success(json);
174        }
175      }
176    });
177  },
178  'button_success': 'В корзину',
179  'button_continue': 'Продолжить покупки',
180  'success': function(json, button_cart){
181    $('body').prepend('<div class="success">' + json['success'] +
182      '<img src="'+success_close_img+'" alt="" class="close" onclick="js:fadeOutSuccess()"/>\
183        <div style="clear: both;"></div><br /><br />\
184        <div style="float:left;"><a onclick="js:fadeOutSuccess()" class="success_button">'+cart.button_continue+'</a></div>\
185        <div style="float:right;"><a onclick="js:goToCheckoutUrl()" class="success_button">'+cart.button_success+'</a></div>\
186      </div>');
187    $('.success').fadeIn('slow');
188    cart.upd_cart(json);
189    if (json['products']) {
190		ecommerce.yandex.send(json['products']);
191	}
192  },
193  'upd_cart': function(json){
194    $('#cart-total, span[id^=cart-total]').html(json['total']);
195  },
196  'update': function ($this) {
197    $.ajax({
198      url: '/index.php?route=checkout/cart/edit',
199      type: 'post',
200      data: jQuery($this).closest('form').serialize(),
201      dataType: 'json',
202      success: function (json) {
203        if (json['products']) {
204			ecommerce.yandex.send(json['products']);
205		}
206
207        cart.update_form();
208        cart.upd_update_remove(json);
209      }
210    });
211  },
212  'remove': function (key) {
213    $.ajax({
214      url: '/index.php?route=checkout/cart/remove',
215      type: 'post',
216      data: 'key=' + key,
217      dataType: 'json',
218      success: function (json) {
219        if (json['products']) {
220			ecommerce.yandex.send(json['products']);
221		}
222
223        cart.update_form();
224        cart.upd_update_remove(json);
225      }
226    });
227  },
228  'update_form': function(checked){
229	  var pathname = document.location.pathname;
230  	var pm = checked || 0;
231    if (getURLVar('route') === 'checkout/cart' || getURLVar('route') === 'checkout/buy' || getURLVar('route') === 'checkout/checkout' || pathname === '/cart' || pathname === '/checkout' || pathname === '/buy') {
232      var from = jQuery('#buy_form_container');
233      if(from.length > 0){
234        jQuery('.tooltip').hide();
235        from.load('/index.php?route=checkout/buy/getForm' + '&pm=' + pm, function(response, status, xhr){
236          if(response) {
237            getShippingMethods()
238          } else {
239            window.location.reload();
240          }
241        });
242      } else {
243        setTimeout(function () {
244          window.location.reload();
245        }, 100);
246      }
247    }
248  },
249  'upd_update_remove': function(json){
250    var cart = $('#cart');
251    if(cart.find('ul').length > 0){
252      cart.find('ul').load('/index.php?route=common/cart/info ul li');
253    } else {
254      cart.load('/index.php?route=common/cart/info');
255    }
256
257    setTimeout(function () {
258      $('#cart-total, span[id^=cart-total]').html(json['total']);
259    }, 100);
260  }
261};
262
263var voucher = {
264	'add': function () {
265
266	},
267	'remove': function (key) {
268		$.ajax({
269			url: '/index.php?route=checkout/cart/remove',
270			type: 'post',
271			data: 'key=' + key,
272			dataType: 'json',
273			beforeSend: function () {
274				$('#cart > button').button('loading');
275			},
276			complete: function () {
277				$('#cart > button').button('reset');
278			},
279			success: function (json) {
280				// Need to set timeout otherwise it wont update the total
281				setTimeout(function () {
282					$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
283				}, 100);
284
285				if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') {
286					location = '/index.php?route=checkout/cart';
287				} else {
288					$('#cart > ul').load('/index.php?route=common/cart/info ul li');
289				}
290			},
291			error: function (xhr, ajaxOptions, thrownError) {
292				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
293			}
294		});
295	}
296};
297
298var wishlist = {
299	'add': function (product_id) {
300		$.ajax({
301			url: '/index.php?route=account/wishlist/add',
302			type: 'post',
303			data: 'product_id=' + product_id,
304			dataType: 'json',
305			success: function (json) {
306				$('.alert').remove();
307				if (json['redirect']) {
308					location = json['redirect'];
309				}
310				if (json['success']) {
311					$('#content').parent().before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
312				}
313				$('#wishlist-total span').html(json['total']);
314				$('#wishlist-total').attr('title', json['total']);
315			},
316			error: function (xhr, ajaxOptions, thrownError) {
317				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
318			}
319		});
320	},
321	'remove': function () {
322
323	}
324};
325
326var compare = {
327	'add': function (product_id) {
328		$.ajax({
329			url: '/index.php?route=product/compare/add',
330			type: 'post',
331			data: 'product_id=' + product_id,
332			dataType: 'json',
333      beforeSend: function () {
334        fadeOutSuccess(100);
335      },
336      success: function (json) {
337				$('.alert').remove();
338
339				if (json['success']) {
340          parent.compare.success(json);
341				}
342			},
343			error: function (xhr, ajaxOptions, thrownError) {
344				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
345			}
346		});
347	},
348  'success': function(json, button_cart){
349    $('body').prepend('<div class="success">' + json['success'] +
350      '<img src="'+success_close_img+'" alt="" class="close" onclick="js:fadeOutSuccess()"/>\
351        <div style="clear: both;"></div><br /><br />\
352        <div style="float:left;"><a onclick="js:fadeOutSuccess()" class="success_button">Продолжить покупки</a></div>\
353        <div style="float:right;"><a onclick="js:goToCompareUrl()" class="success_button">В сравнение</a></div>\
354      </div>');
355    $('.success').fadeIn('slow');
356    compare.upd_compare(json);
357  },
358  'remove': function () {
359
360	},
361	'upd_compare': function(json){
362		$('#compare-total').html(json['total']);
363	}
364};
365
366//user callback about errors
367var errorMessage = {
368	'send': function () {
369		$.ajax({
370			url: '/index.php?route=error/user_error_redirect',
371			type: 'post',
372			data: $('#send-error-form').serialize(),
373			dataType: 'json',
374			success: function (json) {
375				$('#err_comment').remove();
376				$('#err_text').remove();
377				$('#err_from').remove();
378				if (json.success) {
379					$('#send-error-form').html('<p class="text-center">Спасибо за ваше сообщение!<br/>Мы исправим ошибку в ближайшее время!</p>');
380				}
381			}
382		});
383	},
384	'success': function (errorPageUrl, errorText) {
385		$('body').prepend('<div class="success send-error">' +
386			'<div class="close" onclick="js:fadeOutSuccess()">' +
387			'<svg viewBox="0 0 10 10" style="width:30px;height:30px;stroke: #000;stroke-width: 1px;">' +
388			'<path d="M2,8 L8,2" class="p1"/>' +
389			'<path d="M2,2 L8,8" class="p3"/>' +
390			'</svg>' +
391			'</div>' +
392			'<h2 class="text-center">Сообщить об ошибке</h2>' +
393			'<form id="send-error-form" method="post">' +
394			'<p class="text-center">Расскажите о найденной ошибке, и мы её исправим.<br/>Спасибо за помощь!</p>' +
395			'<div class="text-center">' +
396			'<textarea name="from" id="from" placeholder="Адрес" style="width: 100%;resize:none;">' + errorPageUrl + '</textarea>' +
397			'</div>' +
398			'<div id="err_from" class="validationError"></div>' +
399			'<div class="text-center">' +
400			'<textarea name="text" id="text" placeholder="Ошибка" style="width: 100%;resize:none;">' + errorText + '</textarea>' +
401			'</div>' +
402			'<div id="err_text" class="validationError"></div>' +
403			'<div class="text-center">' +
404			'<textarea name="comment" id="comment" placeholder="Комментарий" style="width: 100%;resize:none;"></textarea>' +
405			'</div>' +
406			'<input type="hidden" name="referrer" value="' + errorReferrer + '"/>' +
407			'<input type="hidden" name="user_agent" value="' + userAgent + '"/>' +
408			'<input type="hidden" name="user_plugins" value="' + userPlugins + '"/>' +
409			'<div id="err_comment" class="validationError"></div>' +
410			'<div class="text-center">' +
411			'<span id="send-user-error" class="btn btn-primary">Отправить</span>' +
412			'</div>' +
413			'<br/><div class="text-center">' +
414			'<p>Нажатие кнопки "Отправить" означает согласие <br> с настоящей <a href="/privacy_policy">Политикой конфиденциальности</a>.</p>' +
415			'</div></form>' +
416			'<style>' +
417			'#send-user-error{display:flex;width:150px;font-size:14px;text-transform:uppercase;align-items:center;justify-content:center;margin: 0 auto;}' +
418			'#send-error-form textarea{margin:5px 0;min-height:50px;padding:5px;}' +
419			'</style>' +
420			'</div>');
421		$('.send-error').fadeIn('slow');
422		$('#send-user-error').bind('click', function () {
423			if (errorMessage.check()) {
424				errorMessage.send();
425			}
426		});
427	},
428	'check' : function () {
429		var errmsg = 'Поле должно быть заполнено.';
430		if ($('#from').val().length === 0) {
431			$('#err_from').html('<p class="text-center text-danger">' + errmsg + '</p>');
432			return false;
433		} else {
434			$('#err_from').html('');
435		}
436		if ($('#text').val().length === 0) {
437			$('#err_text').html('<p class="text-center text-danger">' + errmsg + '</p>');
438			return false;
439		} else {
440			$('#err_text').html('');
441		}
442		if ($('#comment').val().length === 0) {
443			$('#err_comment').html('<p class="text-center text-danger">' + errmsg + '</p>');
444			return false;
445		} else {
446			$('#err_comment').html('');
447		}
448		return true;
449	},
450};
451$(document).ready(function () {
452	$('body').on('keypress', function (e) {
453		if (e.which === 13 && e.shiftKey) {
454
455			errorPageUrl = location.href;
456			errorText = window.getSelection().toString();
457			errorReferrer = document.referrer ? document.referrer : 'user navigated to the page directly';
458			userAgent = navigator.userAgent;
459
460			var x = navigator.plugins.length;
461			userPlugins = 'Total plugin installed: ' + x + '/';
462			userPlugins += 'Available plugins are->' + '/';
463			for (var i = 0; i < x; i++) {
464				userPlugins += navigator.plugins[i].name + '/';
465			}
466
467			errorMessage.success(errorPageUrl, errorText, errorReferrer, userAgent, userPlugins);
468		}
469	});
470});
471
472/* Agree to Terms */
473$(document).delegate('.agree', 'click', function (e) {
474	e.preventDefault();
475
476	$('#modal-agree').remove();
477
478	var element = this;
479
480	$.ajax({
481		url: $(element).attr('href'),
482		type: 'get',
483		dataType: 'html',
484		success: function (data) {
485			html = '<div id="modal-agree" class="modal">';
486			html += '  <div class="modal-dialog">';
487			html += '    <div class="modal-content">';
488			html += '      <div class="modal-header">';
489			html += '        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
490			html += '        <h4 class="modal-title">' + $(element).text() + '</h4>';
491			html += '      </div>';
492			html += '      <div class="modal-body">' + data + '</div>';
493			html += '    </div';
494			html += '  </div>';
495			html += '</div>';
496
497			$('body').append(html);
498
499			$('#modal-agree').modal('show');
500		}
501	});
502});
503
504// Autocomplete */
505(function ($) {
506	$.fn.autocomplete = function (option) {
507		return this.each(function () {
508			this.timer = null;
509			this.items = new Array();
510
511			$.extend(this, option);
512
513			$(this).attr('autocomplete', 'off');
514
515			// Focus
516			$(this).on('focus', function () {
517				this.request();
518			});
519
520			// Blur
521			$(this).on('blur', function () {
522				setTimeout(function (object) {
523					object.hide();
524				}, 200, this);
525			});
526
527			// Keydown
528			$(this).on('keydown', function (event) {
529				switch (event.keyCode) {
530					case 27: // escape
531						this.hide();
532						break;
533					default:
534						this.request();
535						break;
536				}
537			});
538
539			// Click
540			this.click = function (event) {
541				event.preventDefault();
542
543				value = $(event.target).parent().attr('data-value');
544
545				if (value && this.items[value]) {
546					this.select(this.items[value]);
547				}
548			};
549
550			// Show
551			this.show = function () {
552				var pos = $(this).position();
553
554				$(this).siblings('ul.dropdown-menu').css({
555					top: pos.top + $(this).outerHeight(),
556					left: pos.left
557				});
558
559				$(this).siblings('ul.dropdown-menu').show();
560			};
561
562			// Hide
563			this.hide = function () {
564				$(this).siblings('ul.dropdown-menu').hide();
565			};
566
567			// Request
568			this.request = function () {
569				clearTimeout(this.timer);
570
571				this.timer = setTimeout(function (object) {
572					object.source($(object).val(), $.proxy(object.response, object));
573				}, 200, this);
574			};
575
576			// Response
577			this.response = function (json) {
578				html = '';
579
580				if (json.length) {
581					for (i = 0; i < json.length; i++) {
582						this.items[json[i]['value']] = json[i];
583					}
584
585					for (i = 0; i < json.length; i++) {
586						if (!json[i]['category']) {
587							html += '<li data-value="' + json[i]['value'] + '"><a href="#">' + json[i]['label'] + '</a></li>';
588						}
589					}
590
591					// Get all the ones with a categories
592					var category = new Array();
593
594					for (i = 0; i < json.length; i++) {
595						if (json[i]['category']) {
596							if (!category[json[i]['category']]) {
597								category[json[i]['category']] = new Array();
598								category[json[i]['category']]['name'] = json[i]['category'];
599								category[json[i]['category']]['item'] = new Array();
600							}
601
602							category[json[i]['category']]['item'].push(json[i]);
603						}
604					}
605
606					for (i in category) {
607						html += '<li class="dropdown-header">' + category[i]['name'] + '</li>';
608
609						for (j = 0; j < category[i]['item'].length; j++) {
610							html += '<li data-value="' + category[i]['item'][j]['value'] + '"><a href="#">&nbsp;&nbsp;&nbsp;' + category[i]['item'][j]['label'] + '</a></li>';
611						}
612					}
613				}
614
615				if (html) {
616					this.show();
617				} else {
618					this.hide();
619				}
620
621				$(this).siblings('ul.dropdown-menu').html(html);
622			};
623
624			$(this).after('<ul class="dropdown-menu"></ul>');
625			$(this).siblings('ul.dropdown-menu').delegate('a', 'click', $.proxy(this.click, this));
626
627		});
628	}
629})(window.jQuery);
630
631function fadeOutSuccess(time) {
632	if (typeof (time) == 'undefined') {
633		time = 400;
634	}
635	jQuery('.success').fadeOut(
636			time,
637			function () {
638				$(this).remove();
639			}
640	);
641	return false;
642}
643
644function alignment_product_name(wrappers_class, title_class){
645  if(wrappers_class && title_class) {
646    jQuery.each(wrappers_class, function (index, value) {
647      var wrapper = jQuery(value);
648      if (!$.isEmptyObject(wrapper)) {
649        wrapper.each(function () {
650          if (jQuery(this).css('display') != 'none') {
651            var max_height = 0;
652            jQuery(this).find(title_class).each(function () {
653              var height = jQuery(this).height();
654              if (height > max_height) {				  
655                max_height = height;
656              }			  
657            }).height(max_height);
658          }
659        })
660      }
661    })
662  }
663}
664$.fn.hyphenate = function (ct){
665	ct = (typeof ct === 'undefined') ? 14 : ct;
666	var RusA = "[абвгдеёжзийклмнопрстуфхцчшщъыьэюя]";
667	var RusV = "[аеёиоуыэюя]";
668	var RusN = "[бвгджзклмнпрстфхцчшщ]";
669	var RusX = "[йъь]";
670	var Hyphen = "\xAD";
671	var re1 = new RegExp("(" + RusX + ")(" + RusA + RusA + ")", "ig");
672	var re2 = new RegExp("(" + RusV + ")(" + RusV + RusA + ")", "ig");
673	var re3 = new RegExp("(" + RusV + RusN + ")(" + RusN + RusV + ")", "ig");
674	var re4 = new RegExp("(" + RusN + RusV + ")(" + RusN + RusV + ")", "ig");
675	var re5 = new RegExp("(" + RusV + RusN + ")(" + RusN + RusN + RusV + ")", "ig");
676	var re6 = new RegExp("(" + RusV + RusN + RusN + ")(" + RusN + RusN + RusV + ")", "ig");
677	function hreplace(text)
678	{
679		text = text.replace(re1, "$1" + Hyphen + "$2");
680		text = text.replace(re2, "$1" + Hyphen + "$2");
681		text = text.replace(re3, "$1" + Hyphen + "$2");
682		text = text.replace(re4, "$1" + Hyphen + "$2");
683		text = text.replace(re5, "$1" + Hyphen + "$2");
684		text = text.replace(re6, "$1" + Hyphen + "$2");
685		return text;
686	}
687	this.each(function () {
688		var text = $(this).html();
689		var newtext = text.split(' ').reduce(function (nt, cur) {
690			cur = cur.toString();
691			if (cur.length >= ct)
692				cur = hreplace(cur);
693			return nt + ' ' + cur;
694		}, '');
695		$(this).html(newtext);
696	});		
697};
698
699function getFormData(data) {
700	if (typeof data == 'undefined') {
701		data = {};
702	}
703	$('#product').find('input, select').each(function () {
704		if($(this).val()) {
705			data[$(this).attr('name')] = $(this).val();
706		}
707	});
708	return $.param(data);
709}
710
711var coupon = {
712  check: function(){
713    $.ajax({
714      url: 'index.php?route=extension/total/coupon/coupon',
715      type: 'post',
716      data: 'coupon=' + encodeURIComponent($('input[name=\'coupon\']').val()),
717      dataType: 'json',
718      beforeSend: function() {
719        $('#button-coupon').button('loading');
720      },
721      complete: function() {
722        $('#button-coupon').button('reset');
723      },
724      success: function(json) {
725        $('.alert').remove();
726
727        if (json['error']) {
728          coupon.error(json);
729        }
730
731        if (json['success']) {
732          coupon.success(json);
733        }
734
735        cart.update_form();
736      }
737    });
738  },
739  success: function(json){
740    $('#button-coupon').closest('.panel-body').append('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
741  },
742  error: function(json){
743    $('#button-coupon').closest('.panel-body').append('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
744  }
745};
746
747jQuery(window).load(function(){
748  jQuery(document).on('show.bs.modal','#finded-low-cost-form', function () {
749    sendYandexMark('Deshevle');
750  });
751
752    IMask(document.getElementById('input-phone'), {
753		mask: '+{#} (000) 000-00-00',
754		definitions: {'#': /[7-8]/},
755		lazy: false
756	});
757
758  jQuery('#finded-low-cost-form form').on('submit', function(){
759    var form = jQuery(this);
760    form.find('.has-error').removeClass('has-error');
761    form.find('p.error').remove();
762
763  	form.append(
764		$('<input>', {type:'hidden', name:'product_name', value: $(document).find('h1').text()}),
765  		$('<input>', {type:'hidden', name:'product_art', value: $(document).find('meta[itemprop="sku"]').attr('content')}),
766  		$('<input>', {type:'hidden', name:'product_url', value: window.location.href})
767	);
768
769    jQuery.ajax({
770      url: form.attr('action'),
771      data: form.serialize(),
772      type: 'post',
773      dataType: 'json',
774      success: function(r){
775        if(r.error){
776          jQuery.each(r.error, function(field, v){
777            form.find('[name="'+field+'"]').parent().append('<p class="error">'+v+'</p>').closest('.form-group').addClass('has-error');
778          })
779        }
780
781        if(r.success){
782          form.remove();
783          jQuery('#finded-low-cost-form').find('.request').show();
784          sendYandexMark('Deshevle-otpravit');
785        }
786      }
787    });
788    return false;
789  });
790});
791
792function smartCaptchaStatus(btn, form, options) {
793    if (typeof smartCaptchaWidget !== 'undefined' && typeof btn !== 'undefined' && btn.length) {
794        if (smartCaptchaWidget.status && !smartCaptchaWidget.validateStatus) {
795            smartCaptchaWidget.actionParams.action = options.action;
796            smartCaptchaWidget.actionParams.data = options.data;
797            smartCaptchaWidget.actionParams.function = options.function;
798            smartCaptchaWidget.processing(btn, form);
799            return false;
800        } else {
801            smartCaptchaWidget.resetWidget();
802        }
803    }
804    return true;
805}
806
807function sendContactForm(btn) {
808	$('.request').find('.text-info').remove();
809	$('.request').find('.text-danger').remove();
810	
811	var form = btn.closest('form');
812
813	if (smartCaptchaStatus(btn, form, {action: 'click', data: '', function: ''})) {
814		jQuery.ajax({
815			url: '/index.php?route=information/contact/send_feedback_ajax',
816			data: form.serialize(),
817			type: 'post',
818			dataType: 'json',
819			success: function (r) {
820				var rConatainer = jQuery('.contact-form').find('.request');
821
822				if (r.error) {
823					jQuery.each(r.error, function (field, v) {
824						rConatainer.append(
825							$('<p>', {text: v, class: 'text-danger primary col-sm-12'})
826						);
827					})
828				}
829
830				if (r.success) {
831					form.slideToggle();
832					rConatainer.append(
833						$('<p>', {text: 'Ваше сообщение успешно отправлено!', class: 'text-info primary col-sm-12'})
834					);
835				}
836
837				rConatainer.show();
838			}
839		});
840	}
841
842	return false;
843}
844function sendDirectorForm(btn, url = '') {
845	var form = btn.closest('form'),
846		ajaxUrl = (url === '') ? form.attr('action') : url;
847			
848	if (smartCaptchaStatus(btn, form, {action: 'click', data: '', function: ''})) {
849		jQuery.ajax({
850			url: ajaxUrl,
851			type: 'POST',
852			dataType: 'JSON',
853			data: form.serialize(),
854			success: function (result) {
855				if (result.success) {
856					jQuery('.main-wrap').html('<div class="response-message">' + result.success + '</div>');
857				}
858
859				if (result.errors) {
860					jQuery.each(result.errors, function (el, err_text) {
861						jQuery('#input-' + el).parent().addClass('has-error').append('<div class="text-danger">' + err_text + '</div>')
862					});
863				}
864			}
865		});
866	}
867	
868	return false;
869}
870
871function getModal(modalName, data) {
872	if ($('#' + modalName).length == 0 || $('#' + modalName).find('form').length == 0) {
873		prepareOpenModal(modalName);
874		loadTplModal(modalName);
875	}
876
877	setTimeout(function() {
878		if (typeof data.product_id !== 'undefined') {
879			$('#' + modalName + ' #product_id').val(data.product_id);
880		}
881		if (typeof data.category_id !== 'undefined') {
882			$('#' + modalName + ' #category_id').val(data.category_id);
883		}
884		if (typeof data.child_category_id !== 'undefined') {
885			$('#' + modalName + ' #child_category_id').val(data.child_category_id);
886		}
887		if (typeof data.custom_cat_id !== 'undefined') {
888			$('#' + modalName + ' #custom_cat_id').val(data.custom_cat_id);
889		}
890		if (typeof data.p_q_id !== 'undefined') {
891			$('#' + modalName + ' #q_p_id').val(data.p_q_id);
892		}
893	}, 1000);
894
895	$('#' + modalName).modal();
896}
897function loadTplModal(modalName) {
898  const container = $('#' + modalName + ' .modal-content');
899  const url = '/index.php?route=common/modal&modal=' + encodeURIComponent(modalName);
900
901  fetch(url, { credentials: 'same-origin' })
902    .then(response => {
903      if (!response.ok) throw new Error('HTTP ' + response.status);
904      return response.text();
905    })
906    .then(html => {
907      container.html(html);
908	  actionAgreeModal(modalName);
909    })
910    .catch(err => {
911      console.error(err);
912      container.html('<div class="alert alert-danger">Не удалось загрузить форму.</div>');
913    });
914}
915function prepareOpenModal(modalName) {
916	$('body').prepend(
917		$('<div/>', {class:'modal_div modal fade', id:modalName, ariaHidden:'true'})
918			.append(
919				$('<div/>', {class:'modal-dialog'})
920					.append($('<div/>',{class:'modal-content'}))
921			)
922	);
923}
924function sendDataModal(form) {
925	$.ajax({
926		url: form.attr('action'),
927		type: form.attr('method'),
928		dataType: 'json',
929		data: form.serializeArray(),
930		success: function(response) {
931			if (response.error) {
932				alert(response.error);
933				return false;
934			}
935
936			form.find('fieldset').hide();
937			form.find('.request-answer').show();
938		}
939	});
940	
941	return false;
942}
943function closeModal(modalName) {
944	$('.modal-backdrop').trigger('click');
945    return false;
946}
947function actionAgreeModal(modalName) {
948	var agree = $('#' + modalName).find('#form_agree').is(':checked');
949	var btn = $('#' + modalName).find('.btn');
950	
951	if (!agree) {
952		btn.removeClass('active');
953		btn.prop('disabled',true);
954	} else {
955		btn.addClass('active');
956		btn.prop('disabled',false);
957	}
958}
959
960function declination(number, titles, full = false) {
961	let cases = [2, 0, 1, 1, 1, 2];
962	let title = titles[ (number%100>4 && number%100<20)? 2:cases[(number%10<5)?number%10:5] ];
963
964	if (full) {
965		return number + title;
966	}
967	return title;
968}

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.