PageSourceSearch

https://kartridgesale.ru/bitrix/templates/elektro_flat/js/main.js?17800673059068

js kartridgesale.ru collected 2026-10-05 03:14:57 UTC 9,068 bytes, 285 lines download raw bytes

1$(function() {
2	/* Цели */
3	$('.add2basket_form .btn_buy.detail').on('click', function() {
4		ym(66326269, 'reachGoal', 'dobavit-v-korzinu');
5	});
6	$('#addItemInCart form button[name="order"]').on('click', function() {
7		ym(66326269, 'reachGoal', 'oformit-zakaz');
8	});
9	$('.cart-buttons #basketOrderButton2').on('click', function() {
10		ym(66326269, 'reachGoal', 'klik-kupit');
11	});
12	$('.cart-buttons #boc_anch_cart').on('click', function() {
13		ym(66326269, 'reachGoal', 'kupit-1-klik');
14	});
15	$('.gos_zakaz_form-btn').on('click', function() {
16		ym(66326269, 'reachGoal', 'klik-zapros-oferty');
17	});
18	$('.wrapper_podrobnee .link_podrobnee').on('click', function() {
19		ym(66326269, 'reachGoal', 'klik-reestr-kontaktov');
20	});
21
22	$(".sv-images > a").fancybox({
23		'titleShow'     : false
24	});
25	
26	/**/
27
28	/* Ленивая загрузка */
29	const imageObserver = new IntersectionObserver((entries, imgObserver) => {
30		entries.forEach((entry) => {
31			if (entry.isIntersecting) {
32				const lazyImage = entry.target
33				console.log("lazy loading ", lazyImage)
34				let image_url = lazyImage.dataset.background
35				lazyImage.style.setProperty('background-image', 'url('+image_url+')');
36				console.log(image_url);
37				imgObserver.unobserve(lazyImage);
38			}
39		})
40	});
41	const arr = document.querySelectorAll('a.sv-slider__item-link')
42	arr.forEach((v) => {
43		imageObserver.observe(v);
44	});
45	/**/
46
47	/***To_top***/
48    $.scrollUp();
49	
50	/***Callback***/
51	$('.callback_anch').click(function(e){
52		e.preventDefault();
53		$(window).resize(function () {
54			modalHeight = ($(window).height() - $(".callback").height()) / 2;
55			$(".callback").css({
56				'top': modalHeight + 'px'
57			});
58		});
59		$(window).resize();
60		$('.callback_body').css({'display':'block'});
61		$('.callback').css({'display':'block'});
62	});
63	$('.callback_close, .callback_body').click(function(e){
64		e.preventDefault();
65		$('.callback_body').css({'display':'none'});
66		$('.callback').css({'display':'none'});
67	});
68	
69	/***Top_panel_contacts***/
70	$('.showcontacts').click(function() {
71		var clickitem = $(this);
72		if(clickitem.parent('li').hasClass('')) {
73			clickitem.parent('li').addClass('active');
74		} else {
75			clickitem.parent('li').removeClass('active');
76		}
77		if($('.showsection').parent('li').hasClass('active')) {
78			$('.showsection').parent('li').removeClass('active');
79			$('.showsection').parent('li').find('.catalog-section-list').css({'display':'none'});
80		}
81		if($('.showsubmenu').parent('li').hasClass('active')) {
82			$('.showsubmenu').parent('li').removeClass('active');
83			$('.showsubmenu').parent('li').find('ul.submenu').css({'display':'none'});
84		}
85		if($('.showsearch').parent('li').hasClass('active')) {
86			$('.showsearch').parent('li').removeClass('active');
87			$('.header_2').css({'display':'none'});
88			$('.title-search-result').css({'display':'none'});
89		}
90		$('.header_4').slideToggle();
91	});
92	
93	/***Top_panel_search***/
94	$('.showsearch').click(function() {
95		var clickitem = $(this);
96		if(clickitem.parent('li').hasClass('')) {
97			clickitem.parent('li').addClass('active');
98		} else {
99			clickitem.parent('li').removeClass('active');
100			$(".title-search-result").css({"display":"none"});
101		}
102		if($('.showsection').parent('li').hasClass('active')) {
103			$('.showsection').parent('li').removeClass('active');
104			$('.showsection').parent('li').find('.catalog-section-list').css({'display':'none'});
105		}
106		if($('.showsubmenu').parent('li').hasClass('active')) {
107			$('.showsubmenu').parent('li').removeClass('active');
108			$('.showsubmenu').parent('li').find('ul.submenu').css({'display':'none'});
109		}
110		if($('.showcontacts').parent('li').hasClass('active')) {
111			$('.showcontacts').parent('li').removeClass('active');
112			$('.header_4').css({'display':'none'});
113		}
114		$('.header_2').slideToggle();
115	});
116	
117	/***Tabs***/
118	if($(".ndl_tabs .box div").is(".new_empty") && $(".ndl_tabs .box div").is(".hit_empty") && $(".ndl_tabs .box div").is(".discount_empty"))
119		$('.ndl_tabs').remove();
120	if($(".ndl_tabs .box div").is(".new_empty")) $('.ndl_tabs .tabs li.new, .ndl_tabs .new.box').remove();
121	if($(".ndl_tabs .box div").is(".hit_empty")) $('.ndl_tabs .tabs li.hit, .ndl_tabs .hit.box').remove();
122	if($(".ndl_tabs .box div").is(".discount_empty")) $('.ndl_tabs .tabs li.discount, .ndl_tabs .discount.box').remove();
123	$(".ndl_tabs .tabs li").first().addClass("current");
124	$(".ndl_tabs .box").first().addClass("visible");	
125
126	$(window).resize(function () {		
127		var elem = $(".section .box:visible .catalog-item-card");
128			elemFirst = $(".section .box:visible .catalog-item-card").first();
129		if(!!elemFirst && 0 < elemFirst.length) {
130			elem.css({"height": ""});
131			elem.css({"height": elemFirst.height() + "px"});
132		}		
133	});
134	$(window).resize();	
135	
136	$('ul.tabs').on('click', 'li:not(.current)', function() {
137		$(this).addClass('current').siblings().removeClass('current')
138			.parents('div.section').find('div.box').eq($(this).index()).fadeIn(150).siblings('div.box').hide();
139		$(window).resize();
140	})	
141	
142	var tabIndex = window.location.hash.replace('#tab','')-1;
143	if (tabIndex != -1) $('ul.tabs li').eq(tabIndex).click();
144	$('ul.tabs li a[href*="#tab"]').click(function() {
145		var tabIndex = $(this).attr('href').replace(/(.*)#tab/, '')-1;
146		$('ul.tabs li').eq(tabIndex).click();
147	});
148	
149	/***Show_delay***/
150	var currPage = window.location.pathname;
151	var delayIndex = window.location.search;
152	if((currPage == '/personal/cart/') && (document.getElementById('id-shelve-list')) && (delayIndex == '?delay=Y')) {
153		$('#id-shelve-list').show();
154		$('#id-cart-list').hide();
155	} else {
156		$('#id-shelve-list').hide();
157		$('#id-cart-list').show();
158	}
159	
160	/***Custom_forms***/
161	$('.custom-forms').customForms({});
162
163
164
165
166
167	// Формы
168	if (/^\/personal\/cart\//.test(location.pathname)) {
169		$('form.new_boc_form_cart .btn_buy').click(function() {
170			var $positions = $('#cart_equipment .tr');
171
172			var m = $(this).closest('form');
173		    var name = m.find('input[name="boc_name_cart"]').val();
174		    var phone = m.find('[name="boc_tel_cart"]').val();
175		    var email = m.find('[name="boc_email_cart"]').val();
176		    var comment = m.find('[name="boc_message_cart"]').val();
177
178		    var data = {
179		    	action: 'cart',
180		    	oneClick: 1,
181		        ORDER_PROP_1: name,
182		        ORDER_PROP_3: phone,
183				ORDER_PROP_2: email,
184				comment: comment,
185		    };
186
187		    var positions = []
188			$positions.each(function() {
189				var $_this = $(this);
190				var pos = {};
191
192				pos.name = $('.cart-item-name', $_this).text().trim();
193				pos.price = parseFloat($('.cart-item-price .price', $_this).text().replace(/\s/g, ''));
194				pos.quantity = $('.cart-item-quantity :input', $_this).val();
195
196				$.each(pos, function(name, v) {
197					positions.push('position['+$_this.index()+']['+name+']='+encodeURI(v));
198					data['position['+$_this.index()+']['+name+']'] = v;
199				});
200			});
201
202			var invalid = !name || !phone || !email;
203		    if (!invalid) {
204				$.post('/bitrix/templates/elektro_flat/mp_form_deal.php', data, function(d) {
205					// console.log(d);
206				}, {
207					dataType: 'json',
208				});
209		    }
210		});
211	}
212
213	if (/^\/personal\/order\/make/.test(location.pathname)) {
214		BX.addCustomEvent(BX('ORDER_FORM'), 'onAjaxSuccess', function() {
215			var $this = $(this);
216			var $positions = $('.cart-items .tr', $this);
217
218			if (BXFormPosting) {
219				var data = $this.serialize();
220				var positions = []
221
222				$positions.each(function() {
223					var $_this = $(this);
224					var pos = {};
225
226					pos.name = $('.cart-item-name', $_this).text().trim();
227					pos.price = parseFloat($('.cart-item-price .price', $_this).text().replace(/\s/g, ''));
228					pos.quantity = parseInt($('.cart-item-quantity', $_this).text().replace(/\D/, ''));
229
230					$.each(pos, function(name, v) {
231						positions.push('position['+$_this.index()+']['+name+']='+encodeURI(v));
232					});
233				});
234
235				data += '&' + positions.join('&');
236
237				data += '&action=cart';
238
239				$.post('/bitrix/templates/elektro_flat/mp_form_deal.php', data, function(d) {
240					// console.log(d);
241				}, {
242					dataType: 'json',
243				});
244			}
245		});
246	}
247
248
249	$('#new_callback_form button[type="button"]').on('click', function(e) {
250		var m = $(this).closest('form');
251	    var name = m.find('input[name="callback_name"]').val();
252	    var phone = m.find('[name="callback_tel"]').val();
253	    var time = m.find('[name="callback_time"]').val();
254	    var comment = m.find('[name="callback_message"]').val();
255	    var consent = m.find('[name="callback_pdn_agree"]');
256	    var consentOk = !consent.length || consent.prop('checked');
257	    if (!consentOk) {
258	    	m.find('#callback_pdn_error').show();
259	    }
260
261		var action = 'requestCall';
262
263	    var data = {
264	    	action: action,
265	        name: name,
266	        phone: phone,
267	        time: time,
268			comment: comment,
269	    };
270
271		var invalid = !name || !phone || !time || !consentOk;
272	    if (!invalid){
273			$.post('/bitrix/templates/elektro_flat/mp_form_deal.php', data, function(d) {
274				// console.log(d);
275			}, {
276				dataType: 'json',
277			});
278	    }
279	});
280	// Конец формы
281
282	$(".question").on("click", function() {
283		$(this).siblings(".answer").slideToggle();
284	});
285});

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.