PageSourceSearch

https://ritualpiter.ru/wp-content/themes/ritualpiter/assets/script.js?ver=1775107956

js ritualpiter.ru collected 2026-10-07 20:56:32 UTC 11,235 bytes, 336 lines download raw bytes

1$(document).ready(function () {
2
3	if ($("#gallery").length) {
4		$("#gallery").owlCarousel({
5			items: 4,
6			loop: false,
7			margin: 10,
8			nav: true,
9			navText: ['', '']
10		})
11	}
12
13	let view_product = window.localStorage.getItem("view_product");
14	if (view_product) {
15		$(".view_table").removeClass("active");
16		$(".view_line").addClass("active");
17		$(".all_products").addClass("line_products");
18	}
19
20	$(document).on("click", ".view_table, .view_line", function (e) {
21		$(".type_view a").removeClass("active");
22		let type_view = e.target.className;
23		$(this).addClass("active");
24		if (type_view == "view_line") {
25			window.localStorage.setItem("view_product", "line");
26			$(".all_products").addClass("line_products");
27		} else {
28			$(".line_products").removeClass("line_products");
29			window.localStorage.clear("line_products");
30		}
31		return false;
32	})
33
34	$(document).on("click", "#gallery img", function () {
35		let imgSrc = $(this).attr("src");
36		$(".poster").html(`<a href="` + imgSrc.replace('/thumbs', '') + `" data-fancybox="1"><img src="` + imgSrc + `" alt=""></a>`);
37		return false;
38	})
39
40	$(document).on("click", "#quick_show .gallery img", function () {
41		let imgSrc = $(this).attr("src");
42		$("#quick_show .poster").html(`<a href="` + imgSrc.replace('/thumbs', '') + `" data-fancybox="1"><img src="` + imgSrc + `" alt=""></a>`);
43		return false;
44	})
45
46	let firstOpen = true;
47	$(document).on("click", ".menu_side > ul > li > a", function () {
48		let submenu = $(this).next(".submenu");
49		if ($(document).width() <= 1000 && submenu.length) {
50			if (firstOpen) submenu.slideDown(300);
51			else submenu.slideToggle(300);
52			firstOpen = false;
53			return false;
54		}
55	})
56
57	if ($(".multipleSelect").length) $('.multipleSelect').select2();
58
59});
60
61// requestAnimationFrame
62var requestAnimationFrame = (function () {
63	return window.requestAnimationFrame ||
64		window.webkitRequestAnimationFrame ||
65		window.mozRequestAnimationFrame ||
66		window.oRequestAnimationFrame ||
67		window.msRequestAnimationFrame ||
68		function (callback, element) {
69			window.setTimeout(callback, 1000 / 60);
70		};
71})();
72
73// Smooth Scroll
74if (/^(\/morgues\/|\/graveyards\/)(#|$)/.test(location.pathname)) {
75	document.documentElement.style.scrollBehavior = 'auto';
76
77	const container = document.querySelector('#sitebar-anchors'),
78		scrollDuration = 500;
79
80	container.addEventListener('click', (event) => {
81		const target = event.target;
82		if (target.tagName === 'A' && target.getAttribute('href').startsWith('#')) {
83			event.preventDefault();
84			const targetElement = document.querySelector(target.getAttribute('href'));
85			if (targetElement) {
86				smoothScroll(targetElement.offsetTop, scrollDuration);
87			}
88		}
89	});
90
91	function smoothScroll(targetTop, duration) {
92		const startTop = window.pageYOffset;
93		const distance = targetTop - startTop;
94		let startTime = null;
95
96		const step = (currentTime) => {
97			if (!startTime)
98				startTime = currentTime;
99			const progress = currentTime - startTime;
100			const scrollPosition = easeInOutQuad(progress, startTop, distance, duration);
101			window.scrollTo(0, scrollPosition);
102			if (progress < duration)
103				window.requestAnimationFrame(step);
104		};
105
106		window.requestAnimationFrame(step);
107	}
108	function easeInOutQuad(t, b, c, d) {
109		t /= d / 2;
110		if (t < 1)
111			return (c / 2) * t * t + b;
112		t--;
113		return (-c / 2) * (t * (t - 2) - 1) + b;
114	}
115}
116
117// Spoilers
118const nodes = document.querySelectorAll('.js_spoiler, .js_spoiler_under h3');
119for (const node of nodes) {
120	node.addEventListener('click', function () {
121		let content = this.nextElementSibling,
122		c = content.parentNode.closest('.unfolded');
123
124		requestAnimationFrame(() => {
125			if (content && content.tagName !== 'H3') {
126				this.classList.toggle('active');
127				content.classList.toggle('unfolded');
128				if (content.style.maxHeight) {
129					content.removeAttribute('style');
130					if (c) {
131						c.style.maxHeight = (c.scrollHeight - content.scrollHeight) + 'px';
132					}
133				} else {
134					let sh = content.scrollHeight;
135					content.style.cssText = 'max-height: ' + sh + 'px;';
136					if (c) {
137						c.style.maxHeight = (c.scrollHeight + content.scrollHeight) + 'px';
138					}
139				}
140			}
141		});
142	});
143}
144
145(function () {
146	'use strict';
147
148	if (location.pathname.includes('/p/')) {
149		// Product Variation Slider
150		var in_shop = document.querySelectorAll('.prod, .prod_content');
151		if (in_shop.length > 0) {
152			in_shop[0].closest('section').addEventListener('click', function (e) {
153				let target = e.target;
154				switch (true) {
155					case target.tagName === 'use' || target.tagName === 'svg':
156					case target.tagName === 'IMG' && target.parentNode.dataset !== undefined:
157						target = target.closest('a');
158						break;
159				}
160				if (target.dataset.prodInfo && target.getElementsByTagName('img').length > 0) {
161					e.preventDefault();
162					let img_old = target.closest('.prod').querySelector('.poster img'),
163						img_old_src = img_old.src,
164						img_new_src = target.getElementsByTagName('img')[0].src;
165					img_old.src = img_new_src;
166					setTimeout(() => {
167						img_old.src = img_old_src;
168					}, 3000);
169				} else if (target.dataset.pvs) {
170					e.preventDefault();
171					let pv_box = target.closest('.picture_variants_box'),
172						pv_ul = pv_box.getElementsByTagName('ul')[0],
173						pv_ul_top = parseFloat(pv_ul.style.top),
174						pv_li = pv_box.getElementsByTagName('li'),
175						pv_li_step_height = pv_ul.scrollHeight / pv_li.length,
176						pv_dot = pv_box.getElementsByClassName('dot')[0],
177						pv_dot_step_height = Math.ceil(pv_dot.parentNode.scrollHeight / pv_li.length),
178						pv_dot_top,
179						slideIndex = 0;
180
181					if (isNaN(pv_ul_top)) {
182						pv_ul_top = 0;
183					}
184
185					for (let i = 0; i < pv_li.length; i++) {
186						if (pv_li[i].classList.contains('active')) {
187							pv_li[i].removeAttribute('class');
188							slideIndex = i;
189							break;
190						}
191					}
192
193					switch (true) {
194						case target.dataset.pvs === 'up':
195							if (slideIndex > 0) {
196								slideIndex -= 1;
197							}
198							if (slideIndex === 0) {
199								pv_ul_top = 0;
200								pv_dot_top = 4;
201							} else {
202								pv_ul_top = pv_li_step_height + pv_ul_top;
203								pv_dot_top = pv_dot_step_height * slideIndex + 5;
204							}
205							break;
206						case target.dataset.pvs === 'down':
207							if (slideIndex < (pv_li.length - 1)) {
208								slideIndex += 1;
209							}
210							if (slideIndex === (pv_li.length - 1)) {
211								pv_ul_top = '-' + (pv_ul.scrollHeight - pv_li_step_height);
212								pv_dot_top = pv_dot.parentNode.scrollHeight - 12;
213							} else {
214								pv_ul_top = '-' + (pv_li_step_height - pv_ul_top);
215								pv_dot_top = pv_dot_step_height * slideIndex + 5;
216							}
217							break;
218					}
219					pv_li[slideIndex].classList.add('active');
220					pv_ul.style.top = pv_ul_top + "px";
221					pv_dot.style.top = pv_dot_top + "px";
222				}
223			})
224		}
225
226		// Product Variation Select Defaults
227		const arr = document.querySelectorAll('ul[data-shop-option]');
228		arr.forEach(el => {
229			el.firstChild.getElementsByTagName('a')[0].className = 'variant_active';
230		});
231	}
232})();
233
234// Menu
235document.addEventListener('DOMContentLoaded', function () {
236	const button = document.querySelector('.h_btn');
237
238	button.addEventListener('click', function (e) {
239		e.preventDefault();
240
241		const isOpen = button.classList.toggle('open');
242		document.documentElement.classList.toggle('menubtn_open', isOpen);
243	});
244});
245
246(function ($, root, undefined) {
247
248	$(function () {
249		if(  !window.ym ) return false;
250		var counter = '85860604';
251		$( document.body ).on( 'added_to_cart', function(){
252			ym(counter, 'reachGoal', 'ADD_CART');
253		});
254
255		$( document.body ).on( 'removed_from_cart', function(){
256			ym(counter,'reachGoal', 'remove_from_cart');
257		});
258
259		$( '.cart_totals  a.button-offer' ).on( 'click', function(){
260			ym(counter, 'reachGoal', 'buy_one_click');
261		});
262
263		$( '.cart_totals  a.button-basket' ).on( 'click', function(){
264			ym(counter, 'reachGoal', 'checkout_order');
265		});
266
267		$( '#place_order' ).on( 'click', function(){
268			//ym(counter, 'reachGoal', 'ORDER_CART'); see thankyou
269		});
270
271		$( '.yith-wcwl-add-to-wishlist-button' ).on( 'click', function(){
272			ym(counter, 'reachGoal', 'add_to_favorites');
273		});
274
275		$( '[name=apply_coupon]' ).on( 'click', function(){
276			ym(counter, 'reachGoal', 'send_promo_code');
277		});
278
279
280
281		var form = $('form.checkout.woocommerce-checkout');
282		if (form.length > 0) {
283			$( form ).on( 'checkout_place_order_success', function(){
284				ym(counter,'reachGoal','place_order');
285			});
286		}
287
288		if ( typeof wc_checkout_params !== 'undefined' ) {
289			if ( wc_checkout_params.is_checkout === '1' ) {
290				roiEvent( 'checkout_init_roi' );
291				ym(counter,'reachGoal','checkout_init');
292			}
293		}
294	 
295		$('.woocommerce-loop-product__link').on('click', function(){
296			ym(counter,'reachGoal','product_card_click');
297		});
298
299	});
300
301	$('form.checkout.woocommerce-checkout').on( 'submit', function(e) {
302		let valid = true;
303		const regex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
304		const digitsOnly = $('#billing_phone').val().replace(/\D/g, '');
305		if( digitsOnly.length !== 11 ) { $('#billing_phone').focus(); valid = false; }
306		if( $('#billing_email').val() && !regex.test($('#billing_email').val()) ) { $('#billing_email').focus(); valid = false; }
307		if( ! valid ) e.preventDefault();
308	});
309	
310})(jQuery, this);
311
312function flyOrder(id, catId) {
313	$('.modal_price_bg:visible').hide();
314	$('body').append( '<div class="modal_price_bg order2" style="background:#0005;height:100vh"><section class="modal_price '+ (catId==139?'yellow':'blue')  +'">'
315		+'<label class="modal-close-button" onclick="closeMyModal(this)"><svg><use xlink:href="#cancel-button"></use></svg></label>'
316		+'<h3>ОФОРМИТЬ<br>ЗАЯВКУ</h3><form class="feedback form" action="https://hacker.house/"><input name="phone" type="tel" value="" required placeholder="Номер телефона">'
317		+'<small>*Обязательное для заполнения поле</small><input name="name" type="text" value="" placeholder="Имя">'
318		+'<input type="hidden" name="form2w" value="оформить заявку"><input type="hidden" name="id" value="'+id+'"><button>
318оформить</button><div class="agr">'+$('.ovyfdv .agreement').html()+'</div></form></section></div>' );
319	$('.order2 [type=tel]').mask('+7 (999) 999-99-99').closest('form').on( 'submit', function(e) {
320		e.preventDefault();
321		$.ajax({ url:ajurl, data:$(this).serialize()+'&action=order_plan_root', type:'post'}).done( function(r) { 
322			$('.order2 h3').html('ВАШ ЗАКАЗ ПРИНЯТ.<br>БЛАГОДАРИМ ВАС.').next().remove();
323			ym(85860604, 'reachGoal', 'send_form');
324		});
325
326		if( window.ct ) { //https://www.calltouch.ru/support/kak-podklyuchit-zayavki-s-sayta-k-otslezhivaniyu-calltouch/
327		var ct_data = { fio:$(this).find('[name=name]').val(), phoneNumber:$(this).find('[name=phone]').val(), subject: 'Заявка с главной', requestUrl: location.href, sessionId: window.ct('calltracking_params','tf85dqml').sessionId };
328			jQuery.ajax({ url: 'https://api.calltouch.ru/calls-service/RestAPI/requests/79872/register/', dataType:'json', type:'POST', data: ct_data });
329		}
330
331	});
332	
333}
334function closeMyModal(oj) {
335	$(oj).closest('.modal_price_bg').remove();
336}

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.