PageSourceSearch

https://www.cvz.ru/local/templates/main/js/custom.js?v=1.02

js cvz.ru collected 2026-10-02 06:44:23 UTC 6,565 bytes, 270 lines download raw bytes

1$(function () {
2  advantagesSliderInit();
3  init_text_more();
4
5	$(window).resize(function() {
6		init_text_more();
7	});
8});
9
10function advantagesSliderInit() {
11  $('.content-slider.advantages-slider__slider').each(function () {
12    window.advantagesSlider = new Swiper(this, {
13      autoplay: {
14        delay: 2000,
15      },
16      spaceBetween: 0,
17      slidesPerView: 4,
18      navigation: {
19        nextEl: $(this).closest(".container").find('.content-slider__arrow-right')[0],
20        prevEl: $(this).closest(".container").find('.content-slider__arrow-left')[0],
21      },
22      breakpoints: {
23        0: {
24          slidesPerView: 1
25        },
26        720: {
27          slidesPerView: 2
28        },
29        1050: {
30          slidesPerView: 3
31        }
32      },
33      observer: true,
34      observeParents: true,
35      watchOverflow: true,
36  
37    });
38  });
39}
40
41function init_text_more() {
42	if(window.matchMedia("(max-width: 800px)").matches) {
43		let text_more = $('.text-more-wrap');
44		if (text_more.length > 0 && text_more.text().length > 0) {
45			text_more.clone().css({
46				'position': 'absolute',
47				'left': '-1000px',
48				'width': text_more.width()
49			}).addClass('clone_text_more').appendTo(text_more.parent());
50
51			let max_height = $('.clone_text_more').outerHeight();
52			$('.clone_text_more').remove();
53			text_more.attr('data-maxheight', max_height + "px");
54
55			let min_height = parseInt(text_more.data("minheight"));
56			let trigger_check = $('#trigger-more:checked').length > 0;
57			if (trigger_check) {
58				text_more.css('max-height', max_height + "px");
59			} else {
60				text_more.css('max-height', min_height + "px");
61			}
62
63			let switch_more = text_more.parent().find('.switch-more');
64			if (max_height <= min_height) {
65				if (switch_more.length > 0) {
66					switch_more.hide();
67				}
68			} else {
69				if (switch_more.length > 0) {
70					switch_more.show();
71				}
72				switch_more.on('click', function() {
73					let text_m = $(this).parent().find('.text-more-wrap');
74					let trigger_check = $('#trigger-more:checked').length > 0;
75					if (text_m.length > 0) {
76						if (trigger_check) {
77							text_m.css('max-height', text_m.attr('data-minheight'));
78						} else {
79							text_m.css('max-height', text_m.attr('data-maxheight'));
80						}
81					}
82				});
83			}
84		};
85	}
86}
87
88document.addEventListener('DOMContentLoaded', function() {
89    const container = document.querySelector('.about-center__btn-container--mob');
90
91    function updateMobileBtn() {
92        // удаляем старую кнопку, если есть
93        container.innerHTML = '';
94
95        if (window.innerWidth <= 768) { // мобильная версия
96            const span = document.createElement('span');
97            span.className = 'btn--lines';
98
99            const btn = document.createElement('a');
100            btn.href = '/about/advantage/';
101            btn.className = 'btn btn--blue';
102            btn.textContent = 'Посмотреть';
103
104            span.appendChild(btn);
105            container.appendChild(span);
106        }
107    }
108
109    // запуск при загрузке
110    updateMobileBtn();
111    // запуск при изменении размера окна
112    window.addEventListener('resize', updateMobileBtn);
113});
114
115
116document.addEventListener("DOMContentLoaded", function() {
117    const banner = document.querySelector(".warning");
118    const btn = document.querySelector(".warning__btn");
119
120    if (!banner || !btn) return;
121    
122    const hasConsent = document.cookie.includes("cookie_consent=accepted");
123
124    if (!hasConsent) {
125        banner.classList.add("warning--active");
126    }
127
128    btn.addEventListener("click", function() {
129        banner.classList.remove("warning--active");
130        const date = new Date();
131        date.setDate(date.getDate() + 365);
132        document.cookie = `cookie_consent=accepted; path=/; expires=${date.toUTCString()}; samesite=lax`;
133    });
134});
135
136function initMarquiz(config) {
137	if (!config || !config.id || !config.buttonText) {
138		console.error('Не переданы id или buttonText для Marquiz');
139		return;
140	}
141
142	marquizConfig.id = config.id;
143	marquizConfig.buttonText = config.buttonText;
144
145	waitForMarquiz(start, 10000);
146}
147
148function waitForMarquiz(callback, timeout) {
149	const startTime = Date.now();
150
151	(function check() {
152		if (window.Marquiz && typeof window.Marquiz.add === 'function') {
153			callback();
154			return;
155		}
156
157		if (Date.now() - startTime > timeout) {
158			console.error('Marquiz не загрузился');
159			return;
160		}
161
162		setTimeout(check, 100);
163	})();
164}
165
166function clearMarquiz() {
167	const container = document.querySelector('[data-marquiz-id="' + marquizConfig.id + '"]');
168	if (container) {
169		container.innerHTML = '';
170	}
171
172	document.querySelectorAll('[class*="marquiz"], [id*="marquiz"], [data-marquiz-root]').forEach(function (el) {
173		if (el.tagName !== 'SCRIPT' && !el.hasAttribute('data-marquiz-id')) {
174			el.remove();
175		}
176	});
177}
178
179function addDesktopButton() {
180	window.Marquiz.add([
181		'Button',
182		{
183			id: marquizConfig.id,
184			buttonText: marquizConfig.buttonText,
185			bgColor: '#e6007c',
186			textColor: '#ffffff',
187			rounded: true,
188			blicked: true,
189			fixed: 'right'
190		}
191	]);
192}
193
194function addMobileButton() {
195	window.Marquiz.add([
196		'Button',
197		{
198			id: marquizConfig.id,
199			buttonText: marquizConfig.buttonText,
200			bgColor: '#e6007c',
201			textColor: '#ffffff',
202			rounded: true,
203			blicked: true,
204			fixed: 'left'
205		}
206	]);
207}
208
209function addMobilePop() {
210	console.log('init mobile pop');
211
212	window.Marquiz.add([
213		'Pop',
214		{
215			id: marquizConfig.id,
216			title: '',
217			text: marquizConfig.buttonText,
218			delay: 10,
219			textColor: '#ffffff',
220			bgColor: '#e6007c',
221			svgColor: '#ffffff',
222			closeColor: '#ffffff',
223			bonusCount: 0,
224			bonusText: false,
225			type: 'full',
226			position: 'position_top',
227			rounded: false,
228			shadow: false,
229			blicked: true,
230			pulse: false,
231			disableOnMobile: false
232		}
233	]);
234}
235
236function render(force) {
237	const mode = media.matches ? 'mobile' : 'desktop';
238
239	if (!force && mode === currentMode) return;
240	if (!window.Marquiz || typeof window.Marquiz.add !== 'function') return;
241
242	clearMarquiz();
243
244	if (mode === 'mobile') {
245		addMobileButton();
246		addMobilePop();
247	} else {
248		addDesktopButton();
249	}
250
251	currentMode = mode;
252	console.log('Marquiz init:', mode);
253}
254
255function start() {
256	if (initialized) return;
257	initialized = true;
258
259	render(true);
260
261	if (typeof media.addEventListener === 'function') {
262		media.addEventListener('change', function () {
263			render(true);
264		});
265	} else if (typeof media.addListener === 'function') {
266		media.addListener(function () {
267			render(true);
268		});
269	}
270}

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.