PageSourceSearch

https://centr.one/local/templates/centr/js/custom.js

js centr.one collected 2026-10-09 23:27:56 UTC 11,790 bytes, 385 lines download raw bytes

1$(document).ready(function () {
2
3	$('select').styler();
4
5	$('input.phone-input').inputmask({
6		mask: '9 (999) 999-99-99',
7		showMaskOnHover: false,
8		inputmode: 'tel',
9		onincomplete: function () {
10			checkValue($(this));
11		},
12		oncomplete: function () {
13			checkValue($(this));
14		}
15	});
16
17
18
19	//Функция валидации номера телефона
20	var checkValue = function (input) {
21		var $th = $(input);
22		var phone = $th.val();	//Введенное значение
23		var isValid = Inputmask.isValid(phone, {
24			mask: '9 (999) 999-99-99',
25		});	//Проверяем на валидность
26		//var $btn = $th.closest('.form').find('.button');	//Ищем кнопку отправки формы
27		var $error = $th.closest('.form__row').find('.warning-mess');	//Ищем ошибку
28		var $label = $th.closest('.form__row').find('.form__label');
29		if (!isValid) {
30			//Если не валидно, то:
31			//$btn.prop('disabled', true); //Меняем атрибут disabled в значение true (делаем кнопку неактивной)
32			//$btn.addClass('disabled');
33			$label.addClass('active');
34			$error.slideDown(200);
35		} else {
36			//$btn.prop('disabled', false); //Меняем атрибут disabled в значение false (делаем кнопку активной)
37			//$btn.removeClass('disabled');
38			$label.addClass('active');
39			$error.slideUp(200);
40		}
41	}
42
43	var cardHeight = $('.minimise-block').find('.card-0').outerHeight();
44	//console.log(cardHeight);
45	$('.minimise-block').attr('data-max-height', cardHeight);
46
47
48});
49
50$(window).resize(function () {
51	var cardHeight = $('.minimise-block').find('.card-0').outerHeight();
52	//console.log(cardHeight);
53	$('.minimise-block').attr('data-max-height', cardHeight);
54});
55
56//phone mask after ajax
57$.ajaxSetup({
58	complete: function () {
59		$('input.phone-input').inputmask({
60			mask: '9 (999) 999-99-99',
61			showMaskOnHover: false,
62			inputmode: 'tel',
63			onincomplete: function () {
64				checkValue($(this));
65			},
66			oncomplete: function () {
67				checkValue($(this));
68			}
69		});
70
71		//Функция валидации номера телефона
72		var checkValue = function (input) {
73			var $th = $(input);
74			var phone = $th.val();	//Введенное значение
75			var isValid = Inputmask.isValid(phone, {
76				mask: '9 (999) 999-99-99',
77			});	//Проверяем на валидность
78			//var $btn = $th.closest('.form').find('.button');	//Ищем кнопку отправки формы
79			var $error = $th.closest('.form__row').find('.warning-mess');	//Ищем ошибку
80			var $label = $th.closest('.form__row').find('.form__label');
81			if (!isValid) {
82				//Если не валидно, то:
83				//$btn.prop('disabled', true); //Меняем атрибут disabled в значение true (делаем кнопку неактивной)
84				//$btn.addClass('disabled');
85				$label.addClass('active');
86				$error.slideDown(200);
87			} else {
88				//$btn.prop('disabled', false); //Меняем атрибут disabled в значение false (делаем кнопку активной)
89				//$btn.removeClass('disabled');
90				$label.addClass('active');
91				$error.slideUp(200);
92			}
93		}
94	}
95});
96
97
98
99
100
101$(document).ready(function () {
102
103	function setCalcPrice() {
104		var priceCount1 = $('.price-count-1').val();
105		var priceCount2 = $('.price-count-2').val();
106		var priceValue1 = $('.price-count-1').attr('data-price');
107		var priceValue2 = $('.price-count-2').attr('data-price');
108
109		var priceRes1 = priceCount1 * priceValue1;
110		var priceRes2 = priceCount2 * priceValue2;
111
112		$('.price-value-1').text(Intl.NumberFormat('ru-ru').format(priceRes1));
113		$('.price-value-2').text(Intl.NumberFormat('ru-ru').format(priceRes2));
114	}
115
116	$('.price-count-1').on('change', function () {
117		setCalcPrice();
118	});
119	$('.price-count-2').on('change', function () {
120		setCalcPrice();
121	});
122	$('select[name="TARIFS-PRICE"]').on('change', function () {
123
124		$('.price-count-1').attr('data-price', $(this).find("option:selected").attr("data-price-1"));
125		$('.price-count-2').attr('data-price', $(this).find("option:selected").attr("data-price-2"));
126
127		setCalcPrice();
128
129	});
130});
131
132
133
134
135
136$(document).ready(function () {
137
138	$('.filter-form__block .block-title').on('click', function () {
139		$(this).closest('.filter-form').find('.block-list').removeClass('_show');
140		$(this).closest('.filter-form__block').find('.block-list').addClass('_show');
141	});
142
143
144	$('.configurator-count-input').on('change', function () {
145		updatePrice();
146	});
147	$('#switchats').on('change', function () {
148		updatePrice();
149	});
150
151	function updatePrice() {
152
153		var config1start = $('.configurator-table').find('.configurator-button-order[data-config="1"]').data("price");
154		var config2start = $('.configurator-table').find('.configurator-button-order[data-config="2"]').data("price");
155
156		var config1total = $('.configurator-table').find('.configurator-button-order[data-config="1"]');
157		var config2total = $('.configurator-table').find('.configurator-button-order[data-config="2"]');
158
159		var config1totalFront = $('.configurator-table').find('.totalPrice[data-config="1"]');
160		var config2totalFront = $('.configurator-table').find('.totalPrice[data-config="2"]');
161
162		var atsPrice = $('#switchats').data("price");
163
164		var sum1 = 0;
165		var sum2 = 0;
166		$('.configurator-table').find('.configurator-count-input').each(function (el) {
167			const price1 = $(this).data("config1price");
168			const price2 = $(this).data("config2price");
169			const val = $(this).val();
170
171			const total1 = price1 * val;
172			const total2 = price2 * val;
173
174			sum1 += total1;
175			sum2 += total2;
176		});
177
178
179		if ($('#switchats').is(':checked')) {
180			sum1 += atsPrice;
181			sum2 += atsPrice;
182		}
183
184		//console.log(sum1);
185		//console.log(sum2);
186
187		var totalCost1 = config1start + sum1;
188		var totalCost2 = config2start + sum2;
189
190		config1totalFront.text(Intl.NumberFormat('ru-ru').format(totalCost1));
191		config2totalFront.text(Intl.NumberFormat('ru-ru').format(totalCost2));
192		config1total.attr("data-total", totalCost1);
193		config2total.attr("data-total", totalCost2);
194	}
195
196	updatePrice();
197});
198
199
200
201$(document).ready(function () {
202	var text = window.location.href;// Берем ссылку
203	var regex = /#(\w+)/gi;
204	match = regex.exec(text.replace("tab-", ""));// Находим в ней все, что находится после знака #
205	//console.log(match);
206	if (match)// Если нашел
207	{
208		$('.tabs-switch').removeClass('_active');// Удаляем все активные табы
209		$('.tabs-switch[data-tab="' + match[1] + '"]').addClass('_active');
210		$('.tab-item').removeClass('_active');
211		$('.tab-item[data-tab="' + match[1] + '"]').addClass('_active');// Добавляем класс 'in active' к ид у которого название с ссылки совпадает с ид у таба
212	}
213
214	$('.toBlock').on('click', function (e) {
215		var el = $(this);
216		var dest = el.data('target'); // получаем направление
217		if (dest !== undefined && dest !== '') { // проверяем существование
218			$('html').animate({ scrollTop: $(dest).offset().top }, 300);
219		}
220	});
221
222
223	$('.count-block__toggle-plus').on('click', function () {
224		var impVal = $(this).closest('.count-block').find('.need-request').val();
225		var maxVal = $(this).closest('.count-block').find('.need-request').data("max");
226		if (impVal == maxVal) {
227			$('.open-need-request').click();
228		}
229	});
230	$('.need-request').on('change', function () {
231		var impVal = $(this).val();
232		var maxVal = $(this).data("max");
233		if (impVal > maxVal) {
234			$('.open-need-request').click();
235		}
236	});
237
238
239});
240
241
242
243$(document).ready(function () {
244	if ($('.cookie-notice').length) {
245		$('.cookie-notice--set').on('click', function () {
246			cookieSave();
247			$('.cookie-notice').remove();
248		});
249
250		$('.cookie-notice-block-tab--switch').on('click', function () {
251			var cookieBlockTab = $(this).data("tab");
252			//console.log(cookieBlockTab);
253			$(this).closest('.cookie-notice').find('.cookie-notice-block__content .content-tab').removeClass('_active');
254			$(this).closest('.cookie-notice').find('.cookie-notice-block__content .content-tab[data-tab="' + cookieBlockTab + '"]').addClass('_active');
255		});
256
257		$('.cookie-notice__close').on('click', function () {
258			$('.cookie-notice').remove();
259		});
260
261		$('.cookies-all-accept').on('click', function () {
262			$(".cookie-swithers").find('input.checkbox-cookie').prop("checked", true);
263		});
264		$('.cookies-all-decline').on('click', function () {
265			$(".cookie-swithers").find('input.checkbox-cookie').prop("checked", false);
266		});
267
268
269
270		function cookieSave() {
271			const cookieBlock = $(".cookie-swithers");
272			const cookies = {
273				functionalCookies: cookieBlock.find("input[name='cookie-functional']").prop('checked'),
274				analyticalCookies: cookieBlock.find("input[name='cookie-analytic']").prop('checked'),
275				marketingCookies: cookieBlock.find("input[name='cookie-marketing']").prop('checked')
276			};
277			$.cookie('cookieAccept', 'true', { expires: 7, path: '/' });
278			$.cookie.raw = true;
279			$.cookie('cookieSettings', JSON.stringify(cookies), { expires: 7, path: '/', json: 'cookieSettings' });
280		}
281
282	}
283});
284
285$(document).ready(function () {
286	var sliderPopa = $('.popular-slider');
287
288	if ($(window).outerWidth() >= 600) {
289		sliderPopa.removeClass('owl-carousel owl-loaded');
290		sliderPopa.owlCarousel('destroy');
291		sliderPopa.find('.owl-stage-outer').children().unwrap();
292		sliderPopa.removeData();
293	} else {
294		sliderPopa.addClass('owl-carousel');
295		sliderPopa.owlCarousel({
296			items: 1,
297			margin: 20,
298			loop: true,
299			nav: false,
300			dots: false,
301			autoplay: false,
302			navText: ["<span class='_icon icon-arrow-light-left'></span>", "<span class='_icon icon-arrow-light-right'></span>"],
303			animateIn: false,
304			animateOut: false,
305			mouseDrag: true,
306		});
307
308		$('.popular-slider__arrows--prev').click(function () {
309			sliderPopa.trigger('prev.owl.carousel');
310		});
311		$('.popular-slider__arrows--next').click(function () {
312			sliderPopa.trigger('next.owl.carousel');
313		});
314	}
315
316
317
318	$(".table-view-switch").on("click", function () {
319		var bid = $(this).data("id");
320		//console.log(bid);
321		$(this).closest(".table").find(".comparsion-footer .comparsion-footer__item").removeClass("_active");
322		$(this).closest(".table").find('.comparsion-footer .comparsion-footer__item[data-id="' + bid + '"]').addClass("_active")
323	})
324	
325	$(".owl-slider-hero").owlCarousel({
326    	loop:true,
327        items:1,
328        margin:38,
329        autoplay:true,
330        autoplayTimeout:7000,
331	});
332
333
334});
335
336
337/*$(window).resize(function () {
338
339	var sliderPopa = $('.popular-slider');
340
341	if ($(window).outerWidth() >= 600) {
342		sliderPopa.removeClass('owl-carousel owl-loaded');
343		sliderPopa.owlCarousel('destroy');
344		sliderPopa.find('.owl-stage-outer').children().unwrap();
345		sliderPopa.removeData();
346	} else {
347		sliderPopa.addClass('owl-carousel');
348		sliderPopa.owlCarousel({
349			items: 1,
350			margin: 0,
351			loop: true,
352			nav: false,
353			dots: false,
354			autoplay: false,
355			navText: ["<span class='_icon icon-arrow-light-left'></span>", "<span class='_icon icon-arrow-light-right'></span>"],
356			animateIn: false,
357			animateOut: false,
358			mouseDrag: true,
359		});
360
361		$('.popular-slider__arrows--prev').click(function () {
362			sliderPopa.trigger('prev.owl.carousel');
363		});
364		$('.popular-slider__arrows--next').click(function () {
365			sliderPopa.trigger('next.owl.carousel');
366		});
367
368	}
369
370});*/
371
372
373BX.addCustomEvent('onAjaxSuccess', function() {
374    var successBlock = document.querySelector('.form-message-container__sussess._show');
375    
376    if (successBlock) {
377        setTimeout(function() {
378            if (window.Fancybox) {
379                Fancybox.close();
380            } else if (window.jQuery && jQuery.fancybox) {
381                jQuery.fancybox.close();
382            }
383        }, 5000);
384    }
385});

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.