PageSourceSearch

https://yaro.com.pl/wp-content/themes/yaro.comtheme/assets/js/main.js?ver=4.29

js yaro.com.pl collected 2026-09-27 07:17:15 UTC 8,290 bytes, 306 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	 const $section = $('#casinoSection1'); 
116  const $buttons = $section.find('[id][data-tab]');
117  const $grids = $section.find('[id]'); 
118
119  $buttons.on('click', function() {
120    const tabId = $(this).data('tab'); 
121    const $targetGrid = $('#' + tabId); 
122
123    $buttons.removeClass('active');
124    $grids.removeClass('active');
125
126    $(this).addClass('active');
127    $targetGrid.addClass('active');
128  });
129
130	
131// (function ($) {
132//   const speed = 120; // px/s
133
134//   $('.mirrorMarquee').each(function () {
135//     const $root = $(this);
136//     const $viewport = $root.find('#marqueeViewp').first();
137//     const $track = $root.find('#marqueeTr').first();
138//     const $group = $root.find('#marqueeGr').first();
139
140//     if (!$viewport.length || !$track.length || !$group.length) return;
141
142//     let offset = 0;
143//     let lastTime = null;
144//     let baseWidth = 0;
145//     let lastViewportWidth = 0;
146//     let rafResize = null;
147
148//     function build() {
149//       $track.find('.marqueeGroup').not($group).remove();
150
151//       const $clone = $group.clone(true).removeAttr('id');
152//       $track.append($clone);
153
154//       baseWidth = $group.outerWidth(true) || 0;
155
156//       if (!baseWidth) {
157//         requestAnimationFrame(build);
158//         return;
159//       }
160
161//       lastViewportWidth = $viewport.outerWidth() || 0;
162
163//       offset = offset % baseWidth;
164//       $track.css('transform', `translateX(${offset}px)`);
165//     }
166
167//     requestAnimationFrame(build);
168//     $(window).on('load', build);
169//     $(window).on('orientationchange', build);
170
171//     $(window).on('resize', function () {
172//       if (rafResize) cancelAnimationFrame(rafResize);
173
174//       rafResize = requestAnimationFrame(function () {
175//         const w = $viewport.outerWidth() || 0;
176
177//         if (Math.abs(w - lastViewportWidth) >= 2) {
178//           build();
179//         }
180//       });
181//     });
182
183//     function animate(time) {
184//       if (!lastTime) lastTime = time;
185//       const delta = (time - lastTime) / 1000;
186//       lastTime = time;
187
188//       if (baseWidth) {
189//         offset -= speed * delta;
190
191//         if (offset <= -baseWidth) offset += baseWidth;
192
193//         $track.css('transform', `translateX(${offset}px)`);
194//       }
195
196//       requestAnimationFrame(animate);
197//     }
198
199//     requestAnimationFrame(animate);
200//   });
201// })(jQuery);
202
203
204// marquee
205(function () {
206  const speed = 120; // px/s
207
208  document.querySelectorAll('.mirrorMarquee').forEach(root => {
209    const viewport = root.querySelector('#marqueeViewp');
210    const track = root.querySelector('#marqueeTr');
211    const group = root.querySelector('#marqueeGr');
212
213    if (!viewport || !track || !group) return;
214
215    let offset = 0;
216    let lastTime = null;
217    let baseWidth = 0;
218    let lastViewportWidth = 0;
219    let rafResize = null;
220
221    const outerWidth = (el) => {
222      const style = getComputedStyle(el);
223      return el.offsetWidth
224        + (parseFloat(style.marginLeft) || 0)
225        + (parseFloat(style.marginRight) || 0);
226    };
227
228    function build() {
229      // удалить старые клоны
230      track.querySelectorAll('.marqueeClone').forEach(n => n.remove());
231
232      baseWidth = outerWidth(group) || 0;
233      if (!baseWidth) {
234        requestAnimationFrame(build);
235        return;
236      }
237
238      const viewportWidth = viewport.offsetWidth || 0;
239      lastViewportWidth = viewportWidth;
240
241      // добавляем клоны пока не перекроем viewport с запасом
242      let totalWidth = baseWidth;
243      while (totalWidth < viewportWidth + baseWidth) {
244        const clone = group.cloneNode(true);
245        clone.classList.add('marqueeClone');
246        clone.removeAttribute('id'); // чтобы не плодить одинаковые id
247        track.appendChild(clone);
248        totalWidth += baseWidth;
249      }
250
251      offset = offset % baseWidth;
252      track.style.transform = `translateX(${offset}px)`;
253    }
254
255    function animate(time) {
256      if (!lastTime) lastTime = time;
257      const delta = (time - lastTime) / 1000;
258      lastTime = time;
259
260      if (baseWidth) {
261        offset -= speed * delta;
262        if (offset <= -baseWidth) offset += baseWidth;
263
264        track.style.transform = `translateX(${offset}px)`;
265      }
266
267      requestAnimationFrame(animate);
268    }
269
270    // первый запуск (и после загрузки всего, включая картинки)
271    requestAnimationFrame(build);
272    window.addEventListener('load', build);
273    window.addEventListener('orientationchange', build);
274
275    window.addEventListener('resize', () => {
276      if (rafResize) cancelAnimationFrame(rafResize);
277
278      rafResize = requestAnimationFrame(() => {
279        const w = viewport.offsetWidth || 0;
280        if (Math.abs(w - lastViewportWidth) >= 2) build();
281      });
282    });
283
284    requestAnimationFrame(animate);
285  });
286})();
287
288
289/*Swiper Slider START*/
290const swiper = new Swiper('.swiper', {
291	loop: true,
292	speed: 500,
293	slidesPerView: 1,
294	spaceBetween: 20,
295	pagination: {
296		el: '.swiper-pagination',
297	},
298	navigation: {
299		nextEl: '.swiper-button-next',
300		prevEl: '.swiper-button-prev',
301	},
302});
303	
304/*Swiper Slider END*/
305
306});

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.