PageSourceSearch

https://hdvart.com/wp-content/themes/hdvarttheme/assets/js/main.js?ver=4.34

js hdvart.com collected 2026-09-29 14:52:50 UTC 10,515 bytes, 384 lines download raw bytes

1let flagNeedArrowTop = false;
2$(document).ready(function() {
3	$(window).on("scroll", function() {
4		if ($(document).scrollTop() >= 100) {
5			if (!flagNeedArrowTop) {
6				flagNeedArrowTop = true;
7				$("#goUp").stop().fadeIn();
8				$("#goUp").addClass("active");
9				$("#main-bar").addClass("active");
10			}
11		} else {
12			if (flagNeedArrowTop) {
13				flagNeedArrowTop = false;
14				$("#goUp").stop().fadeOut();
15				$("#goUp").removeClass("active");
16				$("#main-bar").removeClass("active");
17			}
18		}
19	});
20	$("#option-choice").on("click", function() {
21		$(this).parent(".languages").toggleClass("active");
22	});
23
24	$(document).click(function(e) {
25		if ($(e.target).closest("#option-choice").length || $(e.target).closest(".ml-auto").length) {
26			return;
27		}
28
29		if ($(e.target).closest(".overlap").length || $(e.target).closest("#hamburger").length) {
30			return;
31		}
32		$(".languages").removeClass("active");
33		$(".overlap").removeClass("open");
34		$('#best-toggle').removeClass('active open');
35	});
36
37	$(".toc-default").on("click", function() {
38		let dropSelect = $(this).parents(".drop");
39		let dropContent = $(this).next(".options-holder");
40		dropSelect.toggleClass("active");
41		if (dropSelect.hasClass("active")) {
42			dropContent.stop().slideDown();
43		} else {
44			dropContent.stop().slideUp();
45		}
46	});
47	
48	 $('.drop#openCont').each(function() {
49        const $drop = $(this);
50        $drop.addClass('active');
51        $drop.find('.options-holder').stop(true, true).slideDown(0);
52    });
53
54	$(".ancor").on("click", function (e) {
55  e.preventDefault();
56
57  var href = $(this).attr("href");
58  var headerH = $("#main-bar").outerHeight();
59  var extra = $(window).width() < 1023 ? 5 : 0;
60
61  var offsetTop = href === "#" ? 0 : $(href).offset().top - headerH - extra;
62
63  $("html, body").stop().animate({ scrollTop: offsetTop }, 400);
64});
65
66
67	$("#goUp").on("click", function() {
68		$("html, body").stop().animate({ scrollTop: 0 }, 500, "swing");
69	});
70
71const $header = $('#main-bar');
72  const $mainWrapper = $('#page-content-haeder');
73
74  function updatePadding() {
75    const headerHeight = $header.outerHeight();
76    $mainWrapper.css('padding-top', headerHeight + 'px');
77  }
78
79  updatePadding();
80
81  $(window).on('resize', function () {
82    updatePadding();
83  });
84
85	/*menu*/
86	$("#best-toggle").on("click", function() {
87		$(this).toggleClass("active open");
88		$("#hamburger").toggleClass("active open");
89		$(".overlap").toggleClass("open");
90		$("body").toggleClass("non-scroll");
91	});
92	$('#menu-main a').on("click", function() {
93		$(".overlap").removeClass("open");
94		$("#hamburger").removeClass("active open");
95		$('#best-toggle').removeClass('active open');
96		$("body").removeClass("non-scroll");
97	});
98	/*menu end*/
99
100
101$('[data-has-submenu="true"]').on("click", function(event) {
102    if (window.innerWidth <= 1023) {
103        $("#menu-main").toggleClass("active");
104        $(this).toggleClass("active");
105        
106        var $submenu = $(this).closest("[id='submenu-has']").find("[id='menu-div']").first();
107
108        $("#menu-main [id='submenu-has'] [id='menu-div']").not($submenu).slideUp();
109
110        $submenu.stop(true, true).slideToggle();
111    }
112});
113	
114	// блок с казино
115	
116// 	const section = document.querySelector('#casinoSection1');
117
118// if (section) {
119//   const buttons = section.querySelectorAll('[id][data-tab]');
120//   const grids = section.querySelectorAll('[id]');
121
122//   buttons.forEach(btn => {
123//     btn.addEventListener('click', () => {
124//       const tabId = btn.getAttribute('data-tab');
125//       if (!tabId) return;
126
127//       const targetGrid = section.querySelector(`#${CSS.escape(tabId)}`);
128//       if (!targetGrid) return;
129
130//       buttons.forEach(b => b.classList.remove('active'));
131//       grids.forEach(g => g.classList.remove('active'));
132
133//       btn.classList.add('active');
134//       targetGrid.classList.add('active');
135//     });
136//   });
137// }
138document.querySelectorAll('.oQxHzuuKgCEOU').forEach(section => {
139
140  const buttons = section.querySelectorAll('.casinoTab');
141  const grids = section.querySelectorAll('.casinoGrid');
142
143  buttons.forEach((button, index) => {
144
145    button.addEventListener('click', () => {
146
147      buttons.forEach(btn => btn.classList.remove('active'));
148      grids.forEach(grid => grid.classList.remove('active'));
149
150      button.classList.add('active');
151
152      if (grids[index]) {
153        grids[index].classList.add('active');
154      }
155
156    });
157
158  });
159
160});
161	
162// (function ($) {
163//   const speed = 120; // px/s
164
165//   $('.mirrorMarquee').each(function () {
166//     const $root = $(this);
167//     const $viewport = $root.find('#marqueeViewp').first();
168//     const $track = $root.find('#marqueeTr').first();
169//     const $group = $root.find('#marqueeGr').first();
170
171//     if (!$viewport.length || !$track.length || !$group.length) return;
172
173//     let offset = 0;
174//     let lastTime = null;
175//     let baseWidth = 0;
176//     let lastViewportWidth = 0;
177//     let rafResize = null;
178
179//     function build() {
180//       $track.find('.marqueeGroup').not($group).remove();
181
182//       const $clone = $group.clone(true).removeAttr('id');
183//       $track.append($clone);
184
185//       baseWidth = $group.outerWidth(true) || 0;
186
187//       if (!baseWidth) {
188//         requestAnimationFrame(build);
189//         return;
190//       }
191
192//       lastViewportWidth = $viewport.outerWidth() || 0;
193
194//       offset = offset % baseWidth;
195//       $track.css('transform', `translateX(${offset}px)`);
196//     }
197
198//     requestAnimationFrame(build);
199//     $(window).on('load', build);
200//     $(window).on('orientationchange', build);
201
202//     $(window).on('resize', function () {
203//       if (rafResize) cancelAnimationFrame(rafResize);
204
205//       rafResize = requestAnimationFrame(function () {
206//         const w = $viewport.outerWidth() || 0;
207
208//         if (Math.abs(w - lastViewportWidth) >= 2) {
209//           build();
210//         }
211//       });
212//     });
213
214//     function animate(time) {
215//       if (!lastTime) lastTime = time;
216//       const delta = (time - lastTime) / 1000;
217//       lastTime = time;
218
219//       if (baseWidth) {
220//         offset -= speed * delta;
221
222//         if (offset <= -baseWidth) offset += baseWidth;
223
224//         $track.css('transform', `translateX(${offset}px)`);
225//       }
226
227//       requestAnimationFrame(animate);
228//     }
229
230//     requestAnimationFrame(animate);
231//   });
232// })(jQuery);
233
234
235// marquee
236(function () {
237  const speed = 120; // px/s
238
239  document.querySelectorAll('.mirrorMarquee').forEach(root => {
240    const viewport = root.querySelector('#marqueeViewp');
241    const track = root.querySelector('#marqueeTr');
242    const group = root.querySelector('#marqueeGr');
243
244    if (!viewport || !track || !group) return;
245
246    let offset = 0;
247    let lastTime = null;
248    let baseWidth = 0;
249    let lastViewportWidth = 0;
250    let rafResize = null;
251
252    const outerWidth = (el) => {
253      const style = getComputedStyle(el);
254      return el.offsetWidth
255        + (parseFloat(style.marginLeft) || 0)
256        + (parseFloat(style.marginRight) || 0);
257    };
258
259    function build() {
260      // удалить старые клоны
261      track.querySelectorAll('.marqueeClone').forEach(n => n.remove());
262
263      baseWidth = outerWidth(group) || 0;
264      if (!baseWidth) {
265        requestAnimationFrame(build);
266        return;
267      }
268
269      const viewportWidth = viewport.offsetWidth || 0;
270      lastViewportWidth = viewportWidth;
271
272      // добавляем клоны пока не перекроем viewport с запасом
273      let totalWidth = baseWidth;
274      while (totalWidth < viewportWidth + baseWidth) {
275        const clone = group.cloneNode(true);
276        clone.classList.add('marqueeClone');
277        clone.removeAttribute('id'); // чтобы не плодить одинаковые id
278        track.appendChild(clone);
279        totalWidth += baseWidth;
280      }
281
282      offset = offset % baseWidth;
283      track.style.transform = `translateX(${offset}px)`;
284    }
285
286    function animate(time) {
287      if (!lastTime) lastTime = time;
288      const delta = (time - lastTime) / 1000;
289      lastTime = time;
290
291      if (baseWidth) {
292        offset -= speed * delta;
293        if (offset <= -baseWidth) offset += baseWidth;
294
295        track.style.transform = `translateX(${offset}px)`;
296      }
297
298      requestAnimationFrame(animate);
299    }
300
301    // первый запуск (и после загрузки всего, включая картинки)
302    requestAnimationFrame(build);
303    window.addEventListener('load', build);
304    window.addEventListener('orientationchange', build);
305
306    window.addEventListener('resize', () => {
307      if (rafResize) cancelAnimationFrame(rafResize);
308
309      rafResize = requestAnimationFrame(() => {
310        const w = viewport.offsetWidth || 0;
311        if (Math.abs(w - lastViewportWidth) >= 2) build();
312      });
313    });
314
315    requestAnimationFrame(animate);
316  });
317})();
318
319
320/*Swiper Slider START*/
321const swiper = new Swiper('.swiper', {
322	loop: true,
323	speed: 500,
324	slidesPerView: 1,
325	spaceBetween: 20,
326	pagination: {
327		el: '.swiper-pagination',
328	},
329	navigation: {
330		nextEl: '.swiper-button-next',
331		prevEl: '.swiper-button-prev',
332	},
333});
334	
335/*Swiper Slider END*/
336	
337	
338	
339document.querySelectorAll('#homeAppPromoCopy').forEach((btn) => {
340  btn.addEventListener('click', async () => {
341    const targetId = btn.getAttribute('data-copy-target');
342    const target = targetId ? document.getElementById(targetId) : null;
343    if (!target) return;
344
345    const textToCopy = (target.textContent || '').trim();
346    if (!textToCopy) return;
347
348    const setCopiedState = () => {
349      const originalHtml = btn.dataset.originalHtml || btn.innerHTML;
350      const copiedText = btn.getAttribute('data-copy-success-text') || 'Скопировано';
351
352      btn.dataset.originalHtml = originalHtml;
353      btn.textContent = copiedText;
354
355      setTimeout(() => {
356        btn.innerHTML = originalHtml;
357      }, 1200);
358    };
359
360    try {
361      if (navigator.clipboard && window.isSecureContext) {
362        await navigator.clipboard.writeText(textToCopy);
363        setCopiedState();
364        return;
365      }
366
367      const textarea = document.createElement('textarea');
368      textarea.value = textToCopy;
369      textarea.setAttribute('readonly', '');
370      textarea.style.position = 'absolute';
371      textarea.style.left = '-9999px';
372      document.body.appendChild(textarea);
373      textarea.select();
374      document.execCommand('copy');
375      document.body.removeChild(textarea);
376      setCopiedState();
377    } catch (error) {
378      console.error('Copy failed:', error);
379    }
380  });
381});
382	
383
384});

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.