PageSourceSearch

https://www.pompa.ru/local/templates/pompa_2025/js/script.js?17836795519195

js pompa.ru collected 2026-10-04 00:02:39 UTC 9,195 bytes, 334 lines download raw bytes

1function findAndClickButton(selector, timeout = 5000) {
2	const startTime = Date.now();
3	const delay = 2000; // Задержка 2 секунды
4	let intervalId = null;
5	let timeoutId = null;
6	
7	// Функция для поиска и клика
8	const tryFindAndClick = () => {
9		// Проверяем, прошло ли 2 секунды с момента запуска
10		if (Date.now() - startTime < delay) {
11			return false; // Ещё не прошло 2 секунды - ничего не делаем
12		}
13
14		const button = document.querySelector(selector);
15		
16		if (button) {
17			// Кнопка найдена - кликаем
18//			console.log('✅ Кнопка найдена, выполняем клик');
19			button.click();
20			
21			// Очищаем таймеры
22			clearInterval(intervalId);
23			clearTimeout(timeoutId);
24			return true;
25		}
26		return false;
27	};
28	// Проверяем сразу (вдруг кнопка уже есть на момент запуска)
29	if (tryFindAndClick()) {
30		return;
31	}
32	
33	// Запускаем периодическую проверку каждые 100мс
34	intervalId = setInterval(tryFindAndClick, 100);
35	
36	// Устанавливаем таймаут на 5 секунд
37	timeoutId = setTimeout(() => {
38		clearInterval(intervalId);
39//		console.log('❌ Кнопка не найдена за 5 секунд');
40	}, timeout);
41}
42$(document).on('click', '[data-ya-target]', function () {
43	const target = $(this).data('ya-target');
44	
45	if (typeof ym === 'function') {
46		ym(16297954, 'reachGoal', target);
47		console.log('✅ Цель отправлена:', target);
48		if(target=="OrderGetDeliveryList"){
49			ym(16297954, 'reachGoal', "OrderDeliverySelect");
50			console.log('✅ Цель отправлена:', "OrderDeliverySelect");			
51		}
52		if(target=="OrderGetPaymentList"){
53			ym(16297954, 'reachGoal', "OrderPaymentSelect");
54			console.log('✅ Цель отправлена:', "OrderPaymentSelect");			
55		}
56
57
58//		console.log("Button class: "+$(this).attr('class'));
59//		console.log($(this).children(".orderDeliveryMethod").attr("value"));
60	}
61});
62
63
64var toast=$("#liveToast");
65function setToastText($text=""){
66	hideToast();
67	toast.find(".toast-body").html($text);
68}
69function showToast($type=""){
70	hideToast();
71	if($type=="error"){$class="toast--red";}else{$class=""};
72	toast.addClass("show "+ $class);
73
74	setTimeout(function () {
75		hideToast();
76	}, 4000);
77
78}
79function hideToast(){
80	toast.removeClass("show").removeClass("toast--red");
81}
82
83$(document).on("click", ".scroll_link", function() {  
84	var id = $(this).data('target');
85	var top = $(id).offset().top - 100;  // получаем координаты блока  
86	$('body, html').animate({scrollTop: top}, 400);  // плавно переходим к блоку  
87});  
88
89document.addEventListener('DOMContentLoaded', function () {
90    const chatButton = document.getElementById('customJivoChat');
91
92    if (chatButton) {
93        chatButton.addEventListener('click', function (e) {
94            if (typeof jivo_api === 'undefined') {
95                return;
96            }
97
98            jivo_api.open();
99        });
100    }
101
102    function jivo_onOpen() {
103        const chatButton = document.getElementById('customJivoChat');
104        if (chatButton) {
105            chatButton.classList.add('d-none');
106        }
107    }
108
109    function jivo_onClose() {
110        const chatButton = document.getElementById('customJivoChat');
111        if (chatButton) {
112            chatButton.classList.remove('d-none');
113        }
114    }
115
116    function jivoSetCallBack() {
117        window.jivo_onOpen();
118        window.jivo_onClose();
119    }
120
121    window.jivo_onOpen = jivo_onOpen;
122    window.jivo_onClose = jivo_onClose;
123    window.jivoSetCallBack = jivoSetCallBack;
124});
125
126function waitForJivoOnOpen() {
127    if (typeof window.jivo_onOpen === 'function') {
128        jivoSetCallBack();
129        return;
130    }
131
132    const observer = new MutationObserver(() => {
133        if (typeof window.jivo_onOpen === 'function') {
134            jivoSetCallBack();
135            observer.disconnect();
136        }
137    });
138
139    observer.observe(document.head, { childList: true });
140    observer.observe(document.body, { childList: true });
141}
142
143document.addEventListener('DOMContentLoaded', () => {
144    waitForJivoOnOpen();
145});
146
147$(document).on("click", ".scroll_link", function() {  
148	var id = $(this).data('target');
149	var top = $(id).offset().top - 100;  // получаем координаты блока  
150	$('body, html').animate({scrollTop: top}, 400);  // плавно переходим к блоку  
151});  
152
153/*$(document).on('click','.modal .close',function(){
154	$(this).closest(".modal").removeClass("show");
155	$(".modal-backdrop").remove();
156	$(".modal").attr("style","");
157	$("body").removeClass("modal-open").attr("style","");
158
159});*/
160
161$(document).on('click','.modal .close',function(){
162/*
163	$(this).closest(".modal").removeClass("show");
164	$(".modal-backdrop").remove();
165	$(".modal").attr("style","");
166	$("body").removeClass("modal-open").attr("style","");
167*/
168
169    $(this).closest('.modal').modal('hide');
170});
171
172$(document).on('click', '.open_auth_modal', function () {
173	$('.modal').modal('hide');
174	$('#enter_form').modal("show");
175	$('.modal').off('hidden.bs.modal.enterForm');
176});
177
178$(document).on('click', '.open_reg_modal', function () {
179	$('.modal').modal('hide');
180	$('#rega_form').modal("show");
181	$('.modal').off('hidden.bs.modal.regaForm');
182});
183
184$.each($(".load_img_js"),function () {
185	$(this).attr('src',$(this).data('src'));
186});
187
188$(document).on('click', '.link-to-data-href', function() {
189	let url = $(this).data('href');
190	location.href = url;
191});
192
193
194$(document).on('click', '[data-href]', function(e) {
195	e.preventDefault();
196	const url = $(this).data('href');
197	if (url) {
198		window.location.href = url;
199	}
200});
201
202$(document).on('click', '.link-to-data-href--blank', function() {
203	let url = $(this).data('href');
204	window.open(url, '_blank');
205});
206
207function indexTopHoverOn(){
208	$('.body--index .banner').addClass("hovered");
209	$('.body--index .header__main').addClass("hovered");
210}
211function indexTopHoverOff(){
212	$('.body--index .banner').removeClass("hovered");
213	$('.body--index .header__main').removeClass("hovered");
214}
215
216function initBsHover() {
217	if (!('ontouchstart' in window)) {
218		$('[data-toggle="tooltip"]').tooltip();
219	}
220}
221function getWindowWidth() {
222	return $(window).width();
223}
224function adaptiveImg(){
225//	console.log(getWindowWidth());
226	$.each($(".adaptive_img"),function () {
227//		console.log($(this));
228		if (getWindowWidth() > 1024) {
229			$(this).attr('src', $(this).data('pc'));
230//			console.log("set pc");
231		} else if (getWindowWidth() > 590) {
232			$(this).attr('src', $(this).data('tablet'));
233//			console.log("set tablet");
234		} else {
235			$(this).attr('src', $(this).data('mobile'));
236//			console.log("set mobile");
237		}
238	});
239}
240
241$(window).resize(function () {
242	adaptiveImg();
243});
244
245$(document).ready(function () {
246	function isMobileDevice() {
247		return getWindowWidth() < 992;
248	}
249	adaptiveImg();
250
251	$('.body--index .banner').hover(
252		function() {
253			if( $(this).hasClass("hovered")){
254				indexTopHoverOff();
255			}else{
256				indexTopHoverOn();				
257			}
258		}
259	);
260	$('.body--index .header__main').hover(
261		function() {
262			if( $(this).hasClass("hovered")){
263				indexTopHoverOff();
264			}else{
265				indexTopHoverOn();				
266			}
267		}
268	);
269	
270	
271	
272	$.each($(".load_background_js"),function () {
273		$(this).css('background-image', 'url("' + $(this).data('src') + '")');
274	});
275
276	$('.masked').on('keydown',  function( event )
277	{
278		var inputPhoneValue = $(this).inputmask('unmaskedvalue');
279		if(inputPhoneValue.length !== 10) return;
280		if( event.which < 48) return;
281		if( event.which > 57) return;
282		var lastNum = event.which - 48;
283		if(inputPhoneValue[0] != '8') return;
284		var trueInputPhoneValue = inputPhoneValue.substring(1) + lastNum;
285		$(this).val(trueInputPhoneValue);
286	
287	});
288	
289	var im = new Inputmask({"mask": "+7 (999) 999-99-99", "showMaskOnHover": false, "onBeforePaste":  function (pastedValue, opts) 
290		{
291			if(pastedValue.length < 11) return;
292			var processedValue = pastedValue;
293			if(pastedValue[0] == '8') processedValue = pastedValue.substring(1);
294			return processedValue;
295		}
296	});
297	
298	im.mask($(".masked"));
299});
300
301function watchForSmartBanner() {
302    const menu = document.querySelector('.header__top.header__only-sm-desktop');
303
304    const observer = new MutationObserver((mutations) => {
305        for (const mutation of mutations) {
306            for (const node of mutation.addedNodes) {
307                if (node.nodeType === Node.ELEMENT_NODE) {
308                    const smartbanner = node.classList?.contains('smartbanner')
309                        ? node
310                        : node.querySelector('.smartbanner');
311
312                    if (smartbanner) {
313                        menu.style.top = 'unset';
314                        observer.disconnect();
315                        return;
316                    }
317                }
318            }
319        }
320    });
321
322    observer.observe(document.body, {
323        childList: true,
324        subtree: true
325    });
326}
327
328document.addEventListener('DOMContentLoaded', () => {
329    const menu = document.querySelector('.header__top.header__only-sm-desktop');
330
331    if (menu) {
332        watchForSmartBanner();
333    }
334});

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.