PageSourceSearch

https://extreme-tel.ru/wa-apps/shop/plugins/chats/js/scripts.js?v=2.1.1

js extreme-tel.ru collected 2026-10-08 08:41:04 UTC 7,919 bytes, 216 lines download raw bytes

1jQuery(document).ready(function($) {
2	$('.messanger').not('.messanger_no-fixed').appendTo('body');
3
4	$('.messanger__item > a').each(function(i, e) {
5		if ($(e).attr('href') == 'javascript:void(0);') {
6			$(e).removeAttr('target');
7		}
8	});
9
10	$('.messanger').each(function(i, e) {
11		var $items = $(e).find('.messanger__item');
12		$items.sort(function(a, b) {
13			return $(a).data("sort") - $(b).data("sort")
14		});
15		$(e).find('.messanger__items').append($items);
16	});
17
18	$('.messanger__close_widget').click(function() {
19	    $(this).closest('.messanger').hide();
20	});
21	$('.messanger__close_modal').click(function() {
22	    $(this).closest('.messanger').find('.messanger__popup').hide();
23	});
24
25	$('.messanger__item_max').click(function() {
26		var isVisible = $(this).closest('.messanger').find('.messanger__popup_max').is(":visible");
27		$('.messanger__popup').hide();
28		if (!isVisible) {
29			$(this).closest('.messanger').find('.messanger__popup_max').show();
30		}
31	});
32	$('.messanger__item_vb').click(function() {
33		var isVisible = $(this).closest('.messanger').find('.messanger__popup_vb').is(":visible");
34		$('.messanger__popup').hide();
35		if (!isVisible) {
36			$(this).closest('.messanger').find('.messanger__popup_vb').show();
37		}
38	});
39	$('.messanger__item_wa').click(function() {
40		var isVisible = $(this).closest('.messanger').find('.messanger__popup_wa').is(":visible");
41		$('.messanger__popup').hide();
42		if (!isVisible) {
43			$(this).closest('.messanger').find('.messanger__popup_wa').show();
44		}
45	});
46	$('.messanger__item_tg').click(function() {
47		var isVisible = $(this).closest('.messanger').find('.messanger__popup_tg').is(":visible");
48		$('.messanger__popup').hide();
49		if (!isVisible) {
50			$(this).closest('.messanger').find('.messanger__popup_tg').show();
51		}
52	});
53	$('.messanger__item_sk').click(function() {
54		var isVisible = $(this).closest('.messanger').find('.messanger__popup_sk').is(":visible");
55		$('.messanger__popup').hide();
56		if (!isVisible) {
57			$(this).closest('.messanger').find('.messanger__popup_sk').show();
58		}
59	});
60	$('.messanger__item_ap').click(function() {
61		var isVisible = $(this).closest('.messanger').find('.messanger__popup_ap').is(":visible");
62		$('.messanger__popup').hide();
63		if (!isVisible) {
64			$(this).closest('.messanger').find('.messanger__popup_ap').show();
65		}
66	});
67
68	$('.messanger-icon-wrap_all').click(function() {
69		let messanger = $(this).closest('.messanger');
70
71		if (messanger.hasClass('messanger_active')) {
72			//document.cookie = "chats_mini=0; path=/; max-age=604800";
73			messanger.removeClass('messanger_active');
74			messanger.find('.messanger__items').removeClass('is_active');
75		} else {
76			//document.cookie = "chats_mini=1; path=/; max-age=604800";
77			if (messanger.find('.messanger__items').hasClass('is_active')) {
78				messanger.find('.messanger__items').addClass('messanger_active');
79			} else {
80				messanger.find('.messanger__items').removeClass('messanger_active');
81			}
82			messanger.addClass('messanger_active');
83		}
84	    //messanger.find('.messanger__items').toggleClass('is_active');
85	    //messanger.toggleClass('messanger_active');
86	    messanger.find('.messanger__popup').hide();
87	});
88	
89
90    // Находим все контейнеры для QR-кодов
91    const qrContainers = document.querySelectorAll('.messanger__popup--primium');
92    qrContainers.forEach(container => {
93        // Находим ссылку с атрибутом data-qr-href внутри контейнера
94        const qrLink = container.querySelector('.messanger__qr-href');
95        // Берем URL из href атрибута ссылки
96        const qrHref = qrLink ? qrLink.getAttribute('href') : null;
97        if (qrHref) {
98            const qrCodeDiv = container.querySelector('.messanger__qr');
99            if (qrCodeDiv) {
100                // Получаем все параметры из data-атрибутов
101                const dataColor = qrCodeDiv.getAttribute('data-color') || '#000000';
102                const dataWidth = parseInt(qrCodeDiv.getAttribute('data-width')) || 150;
103                const dataHeight = parseInt(qrCodeDiv.getAttribute('data-height')) || 150;
104                const dataLightColor = qrCodeDiv.getAttribute('data-light-color') || '#ffffff';
105                // Очищаем существующее содержимое
106                qrCodeDiv.innerHTML = '';
107                // Создаем новый QR-код с кастомными настройками
108                try {
109                    const qrcode = new QRCode(qrCodeDiv, {
110                        width: dataWidth,
111                        height: dataHeight,
112                        colorDark: dataColor,
113                        colorLight: dataLightColor,
114                        correctLevel: QRCode.CorrectLevel.H, // Уровень коррекции ошибок
115                        text: qrHref
116                    });
117                    // Для отладки
118                    console.log(`QR-код создан для: ${qrHref}`, {
119                        color: dataColor,
120                        width: dataWidth,
121                        height: dataHeight
122                    });
123                } catch (error) {
124                    console.error('Ошибка при создании QR-кода для', qrHref, ':', error);
125                }
126            } else {
127                console.warn('Не найден элемент .qrcode в контейнере:', container);
128            }
129        } else {
130            console.warn('Не найдена ссылка с data-qr-href в контейнере:', container);
131        }
132    });
133
134
135	// Анимация иконок
136	$(function() {
137		const $messenger = $('.messanger_animation-icons');
138		if (!$messenger.length) return;
139
140		const $iconsWrap = $messenger.find('.messanger-icon-wrap_all');
141		if (!$iconsWrap.length) return;
142		
143		// Собираем иконки для ротации
144		const $icons = $messenger.find('.messanger__items .messanger-icon-wrap').not('.messanger-icon-wrap_all');
145		if (!$icons.length) return; // минимум 2 иконки для запуска ротации
146		
147		let currentIndex = 0;
148		let isActive = false;
149		let rotationTimer = null;
150		
151		// Управление состоянием блока
152		function setActiveState(active) {
153			isActive = active;
154			$messenger.toggleClass('messanger_animation-icons--is-active', active);
155			$iconsWrap.toggleClass('messanger-icon-wrap_all--active', active);
156		}
157		
158		// Показать иконку по индексу
159		function showIcon(index) {
160			$iconsWrap.html($icons.eq(index).clone());
161		}
162		
163		// Переключить на следующую иконку
164		function nextIcon() {
165			if (!isActive) return;
166			
167			currentIndex = (currentIndex + 1) % $icons.length;
168			
169			$iconsWrap.fadeOut(300, () => {
170				showIcon(currentIndex);
171				$iconsWrap.fadeIn(300);
172			});
173		}
174		
175		// Запуск ротации
176		function startRotation() {
177			if (isActive) return;
178			
179			setActiveState(true);
180			showIcon(0);
181			
182			rotationTimer = setInterval(nextIcon, 4000);
183		}
184		
185		// Остановка ротации
186		function stopRotation() {
187			if (!isActive) return;
188			
189			setActiveState(false);
190			clearInterval(rotationTimer);
191			rotationTimer = null;
192			
193			$iconsWrap.empty();
194		}
195		
196		// Переключение режима
197		function toggleRotation(e) {
198			e.preventDefault();
199			e.stopPropagation();
200			
201			isActive ? stopRotation() : startRotation();
202		}
203		
204		// Инициализация по классу messanger_active
205		$messenger.hasClass('messanger_active') ? startRotation() : stopRotation();
206		
207		// Обработчики событий
208		$iconsWrap.on('click', toggleRotation);
209		
210		// Очистка таймера при закрытии страницы
211		$(window).on('beforeunload', () => {
212			if (rotationTimer) clearInterval(rotationTimer);
213		});
214	});
215	
216});

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.