PageSourceSearch

https://logistcompany.ru/wp-content/themes/pixel/js/common.js?ver=1788515975

js logistcompany.ru collected 2026-10-08 14:14:38 UTC 18,266 bytes, 830 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3	$('.new-navigation').wrapAll("<div class='new-navigation__container container'/>");
4
5	$('.phone').mask('+7 (999) 999 - 99 - 99', {
6		autoclear: false,
7	})
8	
9	$('.phone').on('blur', function() {
10		var value = $(this).val();
11		if (value && value.indexOf('_') !== -1) {
12			$(this).addClass('phone-error');
13		} else {
14			$(this).removeClass('phone-error');
15		}
16	});
17	
18	$('.phone').on('focus', function() {
19		$(this).removeClass('phone-error');
20	});
21	
22	
23	$('.popupOpen').on('click', function () {
24		$('.popup').fadeIn()
25	})
26
27	$('#popupClose').on('click', function () {
28		$('.popup').fadeOut()
29	})
30
31
32	$('ul.menu li').each(function () {
33		if ($(this).hasClass('menu-item-has-children')) {
34			$(this).append('<div class="dropdown">▼</div>');
35		}
36	})
37
38
39	// Мобильное меню
40	$(document).each(function () {
41		let width = $(window).width();
42		if (width <= 1280) {
43			$('body').on('click', '.dropdown', function () {
44				let menu = $(this).siblings('.sub-menu');
45				$(menu).slideToggle(500);
46				$(this).toggleClass('active');
47				$(this).siblings('a').toggleClass('active');
48			})
49		}
50	})
51
52
53	$('.header__bar').on('click', function () {
54		$(this).toggleClass('active');
55		$('.header__menu-block').toggleClass('active');
56	})
57
58	$('.header__close, .header__menu-block .close').on('click', function () {
59		$('.header__bar').removeClass('active');
60		$('.header__menu-block').removeClass('active');
61	})
62
63
64	$('.historyTab').on('click', function () {
65		let block = $(this).data('block');
66		$('.historyTab').removeClass('active');
67		$('.historyBlock').removeClass('active');
68		$('#' + block).addClass('active');
69		$(this).addClass('active');
70	})
71
72	function initBannerSlider() {
73		const bannerElement = $('.new-banner');
74		if (!bannerElement.length) return;
75
76		let startNextSlide;
77		const slides = bannerElement.find('.new-banner__slide');
78		const dots = bannerElement.find('.new-banner__pagination-dot');
79		const prevBtn = bannerElement.find('.new-banner__arrow--left');
80		const nextBtn = bannerElement.find('.new-banner__arrow--right');
81
82		if (slides.length <= 1) return;
83
84		let currentSlide = 0;
85		let isTransitioning = false;
86
87		function showSlide(index) {
88			if (isTransitioning) return;
89			isTransitioning = true;
90
91			slides.removeClass('active');
92			dots.removeClass('active');
93
94			slides.eq(index).addClass('active');
95			dots.eq(index).addClass('active');
96
97			currentSlide = index;
98
99			setTimeout(() => {
100				isTransitioning = false;
101			}, 500);
102		}
103
104		function nextSlide() {
105			const next = (currentSlide + 1) % slides.length;
106			showSlide(next);
107		}
108
109		function prevSlide() {
110			const prev = (currentSlide - 1 + slides.length) % slides.length;
111			showSlide(prev);
112		}
113
114
115		nextBtn.on('click', nextSlide);
116		prevBtn.on('click', prevSlide);
117
118		dots.on('click', function () {
119			const index = $(this).index();
120			showSlide(index);
121		});
122
123		
124		if (slides.length > 1) {
125			startNextSlide = setInterval(nextSlide, 15000);
126		}
127
128		let startX = 0;
129		let endX = 0;
130
131		bannerElement.on('touchstart', function (e) {
132			startX = e.touches[0].clientX;
133			clearInterval(startNextSlide);
134		});
135
136		bannerElement.on('touchend', function (e) {
137			endX = e.changedTouches[0].clientX;
138			const diff = startX - endX;
139
140			if (Math.abs(diff) > 50) {
141				if (diff > 0) {
142					nextSlide();
143				} else {
144					prevSlide();
145				}
146			}
147			startNextSlide = setInterval(nextSlide, 15000);
148		});
149	}
150
151	
152	initBannerSlider();
153
154
155
156	function initCasesSlider() {
157		const casesElement = $('.new-cases');
158		if (!casesElement.length) return;
159
160		const slides = casesElement.find('.new-cases__item');
161		const prevBtn = casesElement.find('.new-cases__arrow--left');
162		const nextBtn = casesElement.find('.new-cases__arrow--right');
163		const slidesList = casesElement.find('.new-cases__list');
164
165		let currentSlide = 0;
166		let isTransitioning = false;
167		let visibleSlides = 2;
168		let slideWidth = 684 + 30;
169
170
171		function updateVisibleSlides() {
172			const windowWidth = $(window).width();
173			if (windowWidth <= 740) {
174
175				visibleSlides = 1;
176				slideWidth = 325 + 40;
177			} else if (windowWidth <= 1080) {
178
179				visibleSlides = 1;
180				slideWidth = 640 + 40;
181			} else {
182
183				visibleSlides = 2;
184				slideWidth = 684 + 30;
185			}
186		}
187
188
189		function createPagination() {
190			updateVisibleSlides();
191			const maxSlide = slides.length - visibleSlides;
192			const paginationContainer = casesElement.find('.new-cases__pagination');
193
194			if (paginationContainer.length === 0) {
195				casesElement.append('<div class="new-cases__pagination"></div>');
196			}
197
198			const pagination = casesElement.find('.new-cases__pagination');
199			pagination.empty();
200
201
202			for (let i = 0; i <= maxSlide; i++) {
203				pagination.append('<span class="new-cases__pagination-dot"></span>');
204			}
205
206
207			pagination.find('.new-cases__pagination-dot').on('click', function () {
208				const index = $(this).index();
209				showSlide(index);
210			});
211		}
212
213
214		function checkSliderNeed() {
215			updateVisibleSlides();
216			const maxSlide = slides.length - visibleSlides;
217
218			if (slides.length <= visibleSlides) {
219				casesElement.find('.new-cases__arrows').hide();
220				casesElement.find('.new-cases__pagination').hide();
221				return false;
222			} else {
223				casesElement.find('.new-cases__arrows').show();
224				casesElement.find('.new-cases__pagination').show();
225				createPagination();
226				return true;
227			}
228		}
229
230		function showSlide(index) {
231			if (isTransitioning) return;
232
233			updateVisibleSlides();
234			const maxSlide = slides.length - visibleSlides;
235
236			if (index < 0) index = 0;
237			if (index > maxSlide) index = maxSlide;
238
239			isTransitioning = true;
240			currentSlide = index;
241
242			const translateX = -currentSlide * slideWidth;
243			slidesList.css('transform', `translateX(${translateX}px)`);
244
245
246			prevBtn.prop('disabled', currentSlide === 0);
247			nextBtn.prop('disabled', currentSlide === maxSlide);
248
249
250			const dots = casesElement.find('.new-cases__pagination-dot');
251			dots.removeClass('active');
252			dots.eq(currentSlide).addClass('active');
253
254			setTimeout(() => {
255				isTransitioning = false;
256			}, 500);
257		}
258
259		function nextSlide() {
260			showSlide(currentSlide + 1);
261		}
262
263		function prevSlide() {
264			showSlide(currentSlide - 1);
265		}
266
267
268		nextBtn.on('click', nextSlide);
269		prevBtn.on('click', prevSlide);
270
271
272		$(window).on('resize', function () {
273			if (checkSliderNeed()) {
274				showSlide(0);
275			}
276		});
277
278
279		if (checkSliderNeed()) {
280			showSlide(0);
281		}
282
283
284		let startX = 0;
285		let endX = 0;
286
287		casesElement.on('touchstart', function (e) {
288			startX = e.touches[0].clientX;
289		});
290
291		casesElement.on('touchend', function (e) {
292			endX = e.changedTouches[0].clientX;
293			const diff = startX - endX;
294
295			if (Math.abs(diff) > 50) {
296				if (diff > 0) {
297					nextSlide();
298				} else {
299					prevSlide();
300				}
301			}
302		});
303	}
304
305
306	//initCasesSlider();
307
308
309	function initArticlesSlider() {
310		const articlesElement = $('.new-articles');
311		if (!articlesElement.length) return;
312
313		const slides = articlesElement.find('.new-articles__item');
314		const prevBtn = articlesElement.find('.new-articles__arrow--left');
315		const nextBtn = articlesElement.find('.new-articles__arrow--right');
316		const slidesList = articlesElement.find('.new-articles__list');
317
318		let currentSlide = 0;
319		let isTransitioning = false;
320		let visibleSlides = 3;
321		let slideWidth = 453 + 20;
322
323
324		function updateVisibleSlides() {
325			const windowWidth = $(window).width();
326			if (windowWidth <= 740) {
327
328				visibleSlides = 1;
329				slideWidth = 325 + 40;
330				return true;
331			} else if (windowWidth <= 1080) {
332
333				visibleSlides = slides.length;
334				slideWidth = 0;
335				return false;
336			} else {
337
338				visibleSlides = 3;
339				slideWidth = 453 + 20;
340				return true;
341			}
342		}
343
344
345		function createPagination() {
346			updateVisibleSlides();
347			const maxSlide = slides.length - visibleSlides;
348			const paginationContainer = articlesElement.find('.new-articles__pagination');
349
350			if (paginationContainer.length === 0) {
351				articlesElement.append('<div class="new-articles__pagination"></div>');
352			}
353
354			const pagination = articlesElement.find('.new-articles__pagination');
355			pagination.empty();
356
357
358			for (let i = 0; i <= maxSlide; i++) {
359				pagination.append('<span class="new-articles__pagination-dot"></span>');
360			}
361
362
363			pagination.find('.new-articles__pagination-dot').on('click', function () {
364				const index = $(this).index();
365				showSlide(index);
366			});
367		}
368
369
370		function checkSliderNeed() {
371			const needSlider = updateVisibleSlides();
372			const maxSlide = slides.length - visibleSlides;
373
374			if (!needSlider || slides.length <= visibleSlides) {
375				articlesElement.find('.new-articles__arrows').hide();
376				articlesElement.find('.new-articles__pagination').hide();
377				// Сбрасываем трансформацию
378				slidesList.css('transform', 'translateX(0px)');
379				return false;
380			} else {
381				articlesElement.find('.new-articles__arrows').show();
382				articlesElement.find('.new-articles__pagination').show();
383				createPagination();
384				return true;
385			}
386		}
387
388		function showSlide(index) {
389			if (isTransitioning) return;
390
391			const needSlider = updateVisibleSlides();
392			if (!needSlider) return;
393
394			const maxSlide = slides.length - visibleSlides;
395
396			if (index < 0) index = 0;
397			if (index > maxSlide) index = maxSlide;
398
399			isTransitioning = true;
400			currentSlide = index;
401
402			const translateX = -currentSlide * slideWidth;
403			slidesList.css('transform', `translateX(${translateX}px)`);
404
405
406			prevBtn.prop('disabled', currentSlide === 0);
407			nextBtn.prop('disabled', currentSlide === maxSlide);
408
409
410			const dots = articlesElement.find('.new-articles__pagination-dot');
411			dots.removeClass('active');
412			dots.eq(currentSlide).addClass('active');
413
414			setTimeout(() => {
415				isTransitioning = false;
416			}, 500);
417		}
418
419		function nextSlide() {
420			showSlide(currentSlide + 1);
421		}
422
423		function prevSlide() {
424			showSlide(currentSlide - 1);
425		}
426
427
428		nextBtn.on('click', nextSlide);
429		prevBtn.on('click', prevSlide);
430
431
432		$(window).on('resize', function () {
433			if (checkSliderNeed()) {
434				showSlide(0);
435			}
436		});
437
438
439		if (checkSliderNeed()) {
440			showSlide(0);
441		}
442
443
444		let startX = 0;
445		let endX = 0;
446
447		articlesElement.on('touchstart', function (e) {
448			const windowWidth = $(window).width();
449			if (windowWidth <= 740) {
450				startX = e.touches[0].clientX;
451			}
452		});
453
454		articlesElement.on('touchend', function (e) {
455			const windowWidth = $(window).width();
456			if (windowWidth <= 740) {
457				endX = e.changedTouches[0].clientX;
458				const diff = startX - endX;
459
460				if (Math.abs(diff) > 50) {
461					if (diff > 0) {
462						nextSlide();
463					} else {
464						prevSlide();
465					}
466				}
467			}
468		});
469	}
470
471	$(window).scroll(function () {
472		if ($(this).scrollTop() >= 100) {
473			$('.header').addClass('sticky');
474		} else {
475			$('.header').removeClass('sticky');
476		}
477	});
478
479
480	//initArticlesSlider();
481
482	var swiperClients = new Swiper(".new-clients__logos", {
483		slidesPerView: 5,
484		spaceBetween: 30,
485		pagination: {
486			el: ".new-clients__pagination",
487			clickable: true,
488		},
489		navigation: {
490			nextEl: '.new-clients__arrow--right',
491			prevEl: '.new-clients__arrow--left',
492		},
493		breakpoints: {
494			300: {
495				slidesPerView: 1,
496				spaceBetween: 20,
497			},
498			768: {
499				slidesPerView: 2,
500				spaceBetween: 20,
501			},
502			1024: {
503				slidesPerView: 2,
504				spaceBetween: 30,
505			},
506			1200: {
507				slidesPerView: 2,
508				spaceBetween: 30,
509			},
510			1201: {
511				slidesPerView: 5,
512				spaceBetween: 30,
513			},
514		},
515	});
516	var swiperCases = new Swiper(".new-cases__list", {
517		slidesPerView: 2,
518		spaceBetween: 30,
519		pagination: {
520			el: ".new-cases__pagination",
521			clickable: true,
522		},
523		navigation: {
524			nextEl: '.new-cases__arrow--right',
525			prevEl: '.new-cases__arrow--left',
526		},
527		breakpoints: {
528			300: {
529				slidesPerView: 1,
530				spaceBetween: 20,
531			},
532			768: {
533				slidesPerView: 1,
534				spaceBetween: 20,
535			},
536			1024: {
537				slidesPerView: 1,
538				spaceBetween: 30,
539			},
540			1200: {
541				slidesPerView: 1,
542				spaceBetween: 30,
543			},
544			1201: {
545				slidesPerView: 2,
546				spaceBetween: 30,
547			},
548		},
549	});
550	var swiperTeam = new Swiper(".new-team__list", {
551		slidesPerView: 2,
552		spaceBetween: 30,
553		pagination: {
554			el: ".new-team__pagination",
555			clickable: true,
556		},
557		navigation: {
558			nextEl: '.new-team__arrow--right',
559			prevEl: '.new-team__arrow--left',
560		},
561		breakpoints: {
562			300: {
563				slidesPerView: 1,
564				spaceBetween: 20,
565			},
566			500: {
567				slidesPerView: 1,
568				spaceBetween: 20,
569			},
570			768: {
571				slidesPerView: 2,
572				spaceBetween: 20,
573			},
574			1024: {
575				slidesPerView: 2,
576				spaceBetween: 30,
577			},
578			1200: {
579				slidesPerView: 2,
580				spaceBetween: 30,
581			},
582			1201: {
583				slidesPerView: 4,
584				spaceBetween: 30,
585			},
586		},
587	});
588	var swiperArticles = new Swiper(".new-articles__list", {
589		slidesPerView: 3,
590		spaceBetween: 30,
591		pagination: {
592			el: ".new-articles__pagination",
593			clickable: true,
594		},
595		navigation: {
596			nextEl: '.new-articles__arrow--right',
597			prevEl: '.new-articles__arrow--left',
598		},
599		breakpoints: {
600			300: {
601				slidesPerView: 1,
602				spaceBetween: 20,
603			},
604			600: {
605				slidesPerView: 1,
606				spaceBetween: 20,
607			},
608			768: {
609				slidesPerView: 2,
610				spaceBetween: 20,
611			},
612			1024: {
613				slidesPerView: 2,
614				spaceBetween: 30,
615			},
616			1200: {
617				slidesPerView: 3,
618				spaceBetween: 30,
619			},
620		},
621	});
622	let swiperAdvantages = null;
623	let swiperShema = null;
624
625	function initSwiper() {
626		var screenWidth = $(window).width();
627
628		if (screenWidth <= 1200 && !swiperAdvantages) {
629			swiperAdvantages = new Swiper(".new-advantages__row", {
630				slidesPerView: 2,
631				spaceBetween: 20,
632				pagination: {
633					el: ".new-advantages__pagination",
634					clickable: true,
635				},
636				breakpoints: {
637					300: {
638						slidesPerView: 1,
639						spaceBetween: 20,
640					},
641					600: {
642						slidesPerView: 1,
643						spaceBetween: 20,
644					},
645					768: {
646						slidesPerView: 2,
647						spaceBetween: 20,
648					},
649					1024: {
650						slidesPerView: 2,
651						spaceBetween: 20,
652					},
653					1200: {
654						slidesPerView: 2,
655						spaceBetween: 20,
656					},
657				},
658			});
659			swiperShema = new Swiper(".new-scheme__steps", {
660				slidesPerView: 2,
661				spaceBetween: 20,
662				pagination: {
663					el: ".new-scheme__pagination",
664					clickable: true,
665				},
666				breakpoints: {
667					300: {
668						slidesPerView: 1,
669						spaceBetween: 20,
670					},
671					600: {
672						slidesPerView: 1,
673						spaceBetween: 20,
674					},
675					768: {
676						slidesPerView: 2,
677						spaceBetween: 20,
678					},
679					1024: {
680						slidesPerView: 2,
681						spaceBetween: 20,
682					},
683					1200: {
684						slidesPerView: 2,
685						spaceBetween: 20,
686					},
687				},
688			});
689		} else if (screenWidth > 1200 && swiperAdvantages) {
690			if (swiperShema) {
691				swiperShema.destroy(true, true);
692				swiperShema = null;
693			}
694			if (swiperAdvantages) {
695				swiperAdvantages.destroy(true, true);
696				swiperAdvantages = null;
697			}
698		}
699	}
700
701	initSwiper();
702	$(window).on('resize', function () {
703		initSwiper();
704	});
705
706});
707
708//-- Города в шапке
709jQuery(document).ready(function ($) {
710    const $citiesWrapper = $('.header__cities');
711    const $cityBlock = $('.header__city-block');
712    const $citiesList = $('.header__cities-list');
713    const $citySpan = $cityBlock.find('span');
714
715    if (!$citiesList.length) return;
716
717    // Открытие/закрытие списка по клику
718    $cityBlock.on('click', function (e) {
719        e.stopPropagation();
720        $citiesWrapper.toggleClass('active');
721    });
722
723    // Выбор города и редирект
724    $citiesList.on('click', '.city-item', function (e) {
725        e.stopPropagation();
726        const city = $(this).data('city');
727        const link = $(this).data('link');
728
729        // Сохраняем выбор в куки на 30 дней
730        document.cookie = `selected_city=${encodeURIComponent(city)}; path=/; max-age=${30 * 24 * 60 * 60}`;
731        
732        $citySpan.text(city);
733        $citiesWrapper.removeClass('active');
734
735        // Редирект на страницу города, если ссылка указана
736        if (link && link !== '#') {
737            window.location.href = link;
738        }
739    });
740
741    // Закрытие при клике вне области
742    $(document).on('click', function (e) {
743        if (!$(e.target).closest('.header__cities').length) {
744            $citiesWrapper.removeClass('active');
745        }
746    });
747});
748
749jQuery(document).ready(function($) {
750	if ($(window).width() > 1280) {
751		$('.services-dropdown > li.menu-item-has-children').each(function() {
752			const $parentItem = $(this);
753			const $subMenu = $parentItem.find('> .sub-menu');
754			
755			$parentItem.on('mouseenter', function() {
756				$parentItem.siblings().removeClass('active');
757				$parentItem.addClass('active');
758			});
759			
760			$parentItem.on('mouseleave', function(e) {
761				const $relatedTarget = $(e.relatedTarget);
762				if (!$relatedTarget.closest($subMenu).length) {
763					$parentItem.removeClass('active');
764				}
765			});
766		});
767		
768		$('.services-dropdown').on('mouseleave', function() {
769			$(this).find('> li').removeClass('active');
770		});
771	}
772});
773
774jQuery(document).ready(function($) {
775	var $modal = $('#success-success-modal');
776	var $closeBtn = $('.success-modal-close');
777	
778	$closeBtn.on('click', function() {
779		$modal.hide();
780	});
781	
782	$modal.on('click', function(e) {
783		if (e.target === this) {
784			$modal.hide();
785		}
786	});
787	
788	$(document).on('keydown', function(e) {
789		if (e.key === 'Escape' && $modal.is(':visible')) {
790			$modal.hide();
791		}
792	});
793	
794	$(document).on('wpcf7mailsent', function() {
795		$modal.css('display', 'flex');
796	});
797});
798
799jQuery(document).ready(function ($) {
800	$('.stories-video').on('click', function (e) {
801		e.stopPropagation();
802
803		$(this).toggleClass('is-active');
804		let isActive = $(this).hasClass('is-active');
805
806		let video = $('.stories-video video').get(0);
807
808		video.muted = !isActive;
809		video.loop = !isActive;
810
811		if (isActive) {
812			video.currentTime = 0;
813		} else {
814			$(this).find('.stories-video__button').removeClass('is-active');
815		}
816	});
817});
818
819document.addEventListener('DOMContentLoaded', function () {
820	const btnScrollAnchor = document.querySelector('.scroll-anchor span');
821	if (btnScrollAnchor) {
822		btnScrollAnchor.addEventListener('click', function (e) {
823			e.preventDefault();
824			const target = document.querySelector(this.dataset.scrollAnchor);
825			if (target) {
826				target.scrollIntoView({ behavior: 'smooth' });
827			}
828		});
829	}
830});

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.