PageSourceSearch

https://bakulev.ru/local/templates/renovatech_old/js/app_new.js?1790274081

js bakulev.ru collected 2026-09-24 18:21:40 UTC 13,930 bytes, 479 lines download raw bytes

1$(document).ready(function () {
2	let ww = $(window).width();
3	menu_mob_check(ww);
4	
5	const swiper = new Swiper('.slider-top .swiper', {
6	  speed: 600,
7	  spaceBetween: 0,
8	  loop: true,
9
10	  // If we need pagination
11	  pagination: {
12		el: '.swiper-pagination',
13		clickable: true,
14	  },
15	  // Navigation arrows
16	  navigation: {
17		nextEl: '.sbn1',
18		prevEl: '.sbp1',
19	  },
20	});
21	
22	const swiper_sl1 = new Swiper('.swiper-sl1', {
23	  speed: 400,
24	  spaceBetween: 20,
25	  slidesPerView: 5,
26
27	  // Navigation arrows
28	  navigation: {
29		nextEl: '.sbn2',
30		prevEl: '.sbp2',
31	  },
32	  
33	  breakpoints: {
34		// mobile + tablet - 320-990
35		200: {
36		  slidesPerView: 1
37		},
38		// desktop >= 991
39		992: {
40		  slidesPerView: 5
41		}
42	  }
43	});
44	
45	const swiper_sl2 = new Swiper('.swiper-sl2', {
46	  speed: 400,
47	  spaceBetween: 20,
48	  loop: true,
49	  slidesPerView: 4,
50
51	  // Navigation arrows
52	  navigation: {
53		nextEl: '.sbn3',
54		prevEl: '.sbp3',
55	  },
56	  breakpoints: {
57		// mobile + tablet - 320-990
58		200: {
59		  slidesPerView: 1
60		},
61		// desktop >= 991
62		992: {
63		  slidesPerView: 4
64		}
65	  }
66	});
67	
68	const swiper_sl4 = new Swiper('.swiper-sl4', {
69	  speed: 400,
70	  spaceBetween: 20,
71	  slidesPerView: 2,
72
73	  // Navigation arrows
74	  navigation: {
75		nextEl: '.sbn4',
76		prevEl: '.sbp4',
77	  },
78	  breakpoints: {
79		// mobile + tablet - 320-990
80		200: {
81		  slidesPerView: 1
82		},
83		// desktop >= 991
84		992: {
85		  slidesPerView: 2
86		}
87	  }
88	});
89
90	const swiper_sl5 = new Swiper('.swiper-footer-news', {
91	  speed: 400,
92	  spaceBetween: 20,
93	  slidesPerView: 5,
94
95	  // Navigation arrows
96	  navigation: {
97		nextEl: '.swiper-footer-news-next',
98		prevEl: '.swiper-footer-news-prev',
99	  },
100	  breakpoints: {
101		// mobile + tablet - 320-990
102		200: {
103		  slidesPerView: 1
104		},
105		// desktop >= 991
106		992: {
107		  slidesPerView: 3
108		},
109		1200: {
110		  slidesPerView: 5
111		}
112	  }
113	});
114	
115	$( window ).on( "resize", function() {
116		menu_mob_check(ww);
117	} );
118	
119	$('.sidenav-wrap').click(function(event) {
120		if (event.target === this) {
121			closeNav();
122		}
123	});
124	
125	$(window).on('scroll resize', function() {
126			navbar_fixed();
127	})
128	navbar_fixed();
129	
130	//Разворачивание 3 уровня меню в мобиле
131	$('.with-sub-nav a.dropdown-item').click(function() {
132		let ww = $(window).width();
133		if (ww <= 992) {
134			$(this).parent().find('ul.dropdown-menu').toggleClass( "show" );
135			return false;
136		}
137	});
138	
139	$('.poisk-open').click(function(event) {
140		openSearch(this);
141	});
142	
143	initVisuallyImpaired();
144});
145function navbar_fixed(){
146	let ww = $(window).width();
147	if (ww >= 992) {
148		let wt = $(window).scrollTop();
149		//console.log(wt);
150		if (wt > 200) {
151			$('.head-fix').removeClass('d-none');
152			menu_fix();
153		} else {
154			$( ".head-fix" ).addClass( "d-none" );
155		}
156	} else {
157		$( ".head-fix" ).addClass( "d-none" );
158	}
159}
160
161function menu_mob_check(){
162	let ww = $(window).width();
163	//console.log(ww);
164
165	if (ww >= 991) {
166		closeNav();
167	} else {
168		menu_mob();
169	}
170}
171
172function menu_mob(){
173	$( "#mySidenav .sidenav-menu" ).empty();
174	$( ".row.head nav.navbar" ).clone().appendTo( "#mySidenav .sidenav-menu" );
175	$( "#mySidenav .collapse.navbar-collapse" ).addClass( "show" );
176}
177function menu_fix(){
178	$( ".head-fix .header-fix_menu_wrap" ).empty();
179	$( ".row.head nav.navbar" ).clone().appendTo( ".head-fix .header-fix_menu_wrap" );
180}
181
182function openNav() {
183	$("#mySidenav").css('width', "100%");
184	$( "body" ).addClass( "overflow-h" );
185}
186
187/* Set the width of the side navigation to 0 */
188function closeNav() {
189	$("#mySidenav").css('width', "0");
190	$( "body" ).removeClass( "overflow-h" );
191}
192// Функция открытия поля поиска
193function openSearch(e) {
194	var $form = $('<form action="/search/" class="search-top"><input class="form-control" type="text" name="q" placeholder="Поиск" autofocus><div class="input-group-append"><button class="btn btn-link"><i class="bg-poisk-black"></i></button></div></form>');
195	$(e).parent().append($form);
196	$(e).parent().find('.search-top input').focus();
197	var $input = $form.find('input');
198    $input.on('blur', function() {
199        setTimeout(function() {
200            if (!$form.find('button').is(':focus')) {
201                $form.remove();
202            }
203        }, 200);
204    });
205	return false;
206}
207// Функция по функционалу для слабовидящих
208function initVisuallyImpaired() {
209    if (!$('.js-visually-impaired').length) return false;
210
211    $('.js-visually-impaired').on('click', 'button', function(e) {
212        var $button = $(e.currentTarget);
213        var $parent = $button.parent();
214
215        $button.toggleClass('active');
216        $parent.find('button').not($button).removeClass('active');
217
218        if ($(e.delegateTarget).find('.cs-outer button').hasClass('active')) {
219            var $cssParent = $(e.delegateTarget).find('.cs-outer');
220            var link = $cssParent.data('link');
221            var $cssButton = $cssParent.find('button.active');
222
223            if (!$('#invn-style').length) {
224                $('head').append('<link id="invn-style" rel="stylesheet" href="' + link + '">');
225            }
226
227            if ($cssButton.hasClass('cs-gray')) {
228                $('body').addClass('gray');
229                localStorage.setItem('cs-outer', 'gray');
230                $('body').removeClass('negativ blue');
231            } else if ($cssButton.hasClass('cs-negativ')) {
232                $('body').addClass('negativ');
233                localStorage.setItem('cs-outer', 'negativ');
234                $('body').removeClass('gray blue');
235            } else if ($cssButton.hasClass('cs-blue')) {
236                $('body').addClass('blue');
237                localStorage.setItem('cs-outer', 'blue');
238                $('body').removeClass('gray negativ');
239            }
240        } else {
241            $('#invn-style').remove();
242            localStorage.removeItem('cs-outer');
243            $('body').removeClass('gray negativ blue');
244        }
245
246        if ($(e.delegateTarget).find('.fs-outer button').hasClass('active')) {
247            var $fsParent = $(e.delegateTarget).find('.fs-outer');
248            var $fsButton = $fsParent.find('button.active');
249
250            if ($fsButton.hasClass('fs-m')) {
251                localStorage.setItem('fs-outer', 'font1');
252				$('body').addClass('font1');
253				$('body').removeClass('font2');
254            } else if ($fsButton.hasClass('fs-l')) {
255                localStorage.setItem('fs-outer', 'font2');
256				$('body').addClass('font2');
257				$('body').removeClass('font1');
258            }
259        } else {
260            $('html').removeAttr('style');
261            localStorage.removeItem('fs-outer');
262        }
263
264        $(window).trigger('resize');
265    });
266
267    $('#visually-impaired .modal-footer .btn-def').on('click', function() {
268        $('#invn-style').remove();
269        localStorage.removeItem('cs-outer');
270        $('.js-visually-impaired button').removeClass('active');
271        $('body').removeClass('gray negativ blue font1 font2');
272        localStorage.removeItem('fs-outer');
273        $(window).trigger('resize');
274    });
275
276    $(document).ready(function() {
277        var csOuter = localStorage.getItem('cs-outer');
278        var fsOuter = localStorage.getItem('fs-outer');
279
280        if (csOuter !== null) {
281            $('head').append('<link id="invn-style" rel="stylesheet" href="' + $('.js-visually-impaired .cs-outer').data('link') + '">');
282
283            if (csOuter === "gray") {
284                $('body').addClass('gray');
285                $('.cs-gray').addClass('active');
286            } else if (csOuter === "negativ") {
287                $('body').addClass('negativ');
288                $('.cs-negativ').addClass('active');
289            } else if (csOuter === "blue") {
290                $('body').addClass('blue');
291                $('.cs-blue').addClass('active');
292            }
293        }
294
295        if (fsOuter !== null) {
296			 $('body').addClass(fsOuter);
297
298            if (fsOuter === "font1") {
299                $('.fs-m').addClass('active');
300            } else if (fsOuter === "font2") {
301                $('.fs-l').addClass('active');
302            }
303        }
304    });
305}
306
307// Функция изменения длины хвоста стрелки
308$(document).ready(function() {
309    const startX = 8;
310    const shortEndX = 8;
311    const longEndX = 0;
312    
313    // Для каждого элемента своя анимация
314    $(".cubs-item").each(function() {
315        const $item = $(this);
316        const $tail = $item.find('#arrowTail'); // Ищем хвост внутри этого элемента
317        
318        let animationFrame = null;
319        let currentEndX = shortEndX;
320        let targetEndX = shortEndX;
321        
322        function setTailLength(endX) {
323            $tail.attr('x1', Math.round(endX));
324        }
325        
326        function animateTail() {
327            if (Math.abs(currentEndX - targetEndX) > 0.5) {
328                currentEndX += (targetEndX - currentEndX) * 0.2;
329                setTailLength(currentEndX);
330                
331                animationFrame = requestAnimationFrame(animateTail);
332            } else {
333                setTailLength(targetEndX);
334                currentEndX = targetEndX;
335                
336                if (animationFrame) {
337                    cancelAnimationFrame(animationFrame);
338                    animationFrame = null;
339                }
340            }
341        }
342        
343        // Обработчики для этого элемента
344        $item.on('mouseenter', function() {
345            targetEndX = longEndX;
346            if (!animationFrame) {
347                animateTail();
348            }
349        });
350        
351        $item.on('mouseleave', function() {
352            targetEndX = shortEndX;
353            if (!animationFrame) {
354                animateTail();
355            }
356        });
357        
358        // Начальное состояние
359        setTailLength(shortEndX);
360    });
361});
362
363/*
364
365// Функция чата
366$(document).ready(function() {
367    var idMess=1;
368	if (localStorage.getItem('chat-new')) {
369		idMess=localStorage.getItem('chat-new');
370	}
371	getChat(idMess);
372	$('.chat-new-body').on('click', '.chat-new-message-nav-item', function(e) {
373		idMess = $( this ).attr('data-id-mes');
374		if(idMess=='link'){
375			window.location.href = $( this ).attr('data-link');
376			return false;
377		}
378		localStorage.setItem('chat-new', idMess);
379		console.log( localStorage.getItem('chat-new')  );
380		
381		getChat(idMess);
382		
383    });
384});
385function getChat(id) {
386	$.ajax({
387			url: 'https://bakulev.ru/local/templates/renovatech_old/chat/chat.php',
388			type: 'POST',
389			contentType: 'application/json',
390			data: JSON.stringify({
391				id: id
392			}),
393			dataType: 'json',
394			success: function(response) {
395				console.log('Отправлено успешно:', response);
396				$('.chat-new-body').html(response.html);
397			},
398			error: function(xhr, status, error) {
399				console.error('Ошибка отправки:', error);
400			}
401		});
402	return false;
403}
404*/
405// функция засовывает video в div
406$.fn.videoResponsive = function(options) {
407    // Настройки по умолчанию
408    const settings = $.extend({
409        defaultWidth: 1170,
410        defaultHeight: 300,
411        ratio: '16by9', // 16by9, 4by3, 21by9 и т.д.
412        ignoreClass: 'no-embed',
413		swiperSelector: '.swiper-slide' 
414    }, options);
415
416    // Если коллекция пуста — возвращаем this для цепочки вызовов
417    if (!this.length) return this;
418
419    return this.each(function() {
420        const $video = $(this);
421        
422        // Проверка на класс ignore
423        if ($video.hasClass(settings.ignoreClass)) return;
424        if ($video.parent().hasClass(settings.ignoreClass)) return;
425        if ($video.parent().parent().hasClass(settings.ignoreClass)) return;
426
427        // Проверка на атрибут data-not
428        if ($video.data('not') === 'not') return;
429
430        // Получаем ширину
431        let width = $video[0].style.width;
432        width = (width === undefined) ? settings.defaultWidth : parseInt(width, 10);
433		
434        // Получаем высоту
435        let height = $video[0].style.height;
436        height = (height === undefined) ? settings.defaultHeight : parseInt(height, 10);
437
438        // Если уже есть родитель с embed-responsive — просто обновляем max-width
439        if ($video.parent().hasClass('embed-responsive')) {
440            $video.addClass('embed-responsive-item')
441                   .parent()
442                   .css('max-width', width + 'px');
443        } else {
444            // Иначе оборачиваем в новый контейнер
445            $video.addClass('embed-responsive-item').wrap(`<div class="embed-responsive embed-responsive-${settings.ratio}" style="max-width: ${width}px; height:${height}px"></div>`);
446			swiperNeedUpdate = true;
447        }
448		
449		 if (swiperNeedUpdate) {
450			setTimeout(() => {
451				const $swiperSlide = $video.closest(settings.swiperSelector);
452        
453				if ($swiperSlide.length) {
454					// Если нашли .swiper-slide — перезаписываем его style.width
455					$swiperSlide.css('width', width + 'px');
456					// Также можно перезаписать max-width для консистентности
457					//$swiperSlide.css('max-width', width + 'px');
458				}
459			}, 100); // небольшая дополнительная задержка для обновления
460		}
461
462    });
463};
464
465// Использование (вызов для разных селекторов)
466$(function() {
467    /*$('.paget video').videoResponsive();
468    $('.paget iframe').videoResponsive();
469    $('.paget embed').videoResponsive();
470    $('.paget object').videoResponsive();
471	*/
472    
473    // Или одной строкой через запятую
474    $('.paget video, .paget iframe, .paget embed, .paget object').not('.no-embed')
475        .videoResponsive({
476            defaultWidth: 1200,
477            ratio: '21by9'
478        });
479});

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.