PageSourceSearch

https://pacedance.org/wp-content/themes/pacedancetheme/assets/js/index.js?ver=0.184

js pacedance.org collected 2026-09-29 21:44:02 UTC 13,820 bytes, 462 lines download raw bytes

1$(document).ready(function(){
2	var $ms = $('#main-slider');
3if ($ms.length) {
4  var itemsDesktop = parseInt($ms.data('items-desktop'), 10);
5  if (isNaN(itemsDesktop) || (itemsDesktop !== 1 && itemsDesktop !== 2)) {
6    itemsDesktop = 1; // по умолчанию 1 слайд
7  }
8
9  $ms.owlCarousel({
10    loop: true,
11    nav: false,
12    autoplay: true,
13    margin: 12,
14    responsive: {
15      0:   { items: 1, margin: 12 },
16      900: { items: itemsDesktop }
17    }
18  });
19}
20
21	$("#fluxSlider, #quickGamesSlider, #liveCasinoSlider").owlCarousel({
22    loop: true,
23    nav: true,
24    dots: false,
25    autoplay: true,
26    margin: 16,
27    responsive: {
28      300: {
29        margin: 8,
30      },
31      600: {
32        items: 3,
33      },
34      800: {
35        items: 4,
36      },
37      980: {
38        items: 5,
39      },
40      1000: {
41        items: 3,
42      },
43      1060: {
44        items: 4,
45      },
46      1200: {
47        items: 5,
48      },
49      1380: {
50        items: 6,
51      },
52    },
53  	});
54
55	$("#bonusReel, #providersSlider").owlCarousel({
56		loop:true,
57		nav:true,
58		dots:false,
59		autoplay: true,
60		margin: 16,
61		responsive:{
62			300:{
63				items:2,
64				margin:8
65			},
66			600:{
67				items:3
68			},
69			800:{
70				items:4
71			},
72			980:{
73				items:5
74			},
75			1000:{
76				items:3
77			},
78			1060:{
79				items:4
80			},
81			1230:{
82            	items:5
83            },
84            1430:{
85            	items:6
86            },
87        }
88	});
89	
90	$("#articleSlider").owlCarousel({
91		loop: true,
92		nav: true,
93		dots: false,
94		autoplay: false,
95		margin: 20,
96		responsive:{
97			300: {
98				items: 2
99			},
100			600: {
101				items: 3
102			},
103			1000: 	{
104				items: 4
105			}
106		}
107	});
108
109	$("#mobileMenuBtn").click(function () {
110    if ($("aside").hasClass("open")) {
111      $("aside").removeClass("open");
112      $(this).removeClass("active");
113      $("body").removeClass("non-scroll");
114    } else {
115      $("aside").addClass("open");
116      $(this).addClass("active");
117      $("body").addClass("non-scroll");
118    }
119  	});
120	//Custom Select START
121	const $container = $("#language-dropdown-container, #language-dropdown-aside");
122	const $optionsList = $("#language-options-list, #language-options-aside");
123	const $selectedText = $("#selected-language-text, #selected-language-aside");
124
125	$container.on("click", function (event) {
126		event.stopPropagation();
127		$optionsList.slideToggle(200);
128		$container.toggleClass("open");
129		$selectedText.toggleClass("open");
130	});
131	$(document).on("click", function () {
132		if ($container.hasClass("open")) {
133		$optionsList.slideUp(200);
134		$container.removeClass("open");
135		}
136	});
137
138	$optionsList.on("click", ".customSelectOption", function () {
139		const selectedLangName = $(this).text();
140		const selectedLangIcon = $(this).find("img").attr("src");
141		$selectedText.html('<img src="' + selectedLangIcon + '" alt="">' + selectedLangName);
142		$(this).addClass("selected").siblings().removeClass("selected");
143   	});
144
145	// TOC Section
146	function initTOC() {
147		// console.log("TOC Script: Starting to process headings...");
148		const headings = document.querySelectorAll(
149			".tocWrapper ~ h1, .tocWrapper ~ h2, .tocWrapper ~ h3, .tocWrapper ~ * h1, .tocWrapper ~ * h2, .tocWrapper ~ * h3"
150		);
151		// console.log("TOC Script: Found " + headings.length + " headings");
152
153		headings.forEach((heading, index) => {
154			const id = "toc-" + index;
155			if (!heading.hasAttribute("id")) {
156				heading.setAttribute("id", id);
157				// console.log(
158				// 	"TOC Script: Set ID " +
159				// 	id +
160				// 	" for heading: " +
161				// 	heading.textContent.trim()
162				// );
163			}
164			const tocLink = document.querySelector(
165				`.tocLink[data-temp-id="toc-${index}"]`
166			);
167			if (tocLink) {
168				tocLink.setAttribute("href", "#" + id);
169				// console.log("TOC Script: Updated TOC link for " + id);
170			}
171		});
172
173		function smoothScrollTo(targetY, duration) {
174			const startY = window.pageYOffset;
175			const offset = document.querySelector("header")?.offsetHeight || 80;
176			const adjustedY = targetY - offset;
177			const distance = adjustedY - startY;
178			let startTime = null;
179
180			function animation(currentTime) {
181				if (!startTime) startTime = currentTime;
182				const timeElapsed = currentTime - startTime;
183				const progress = Math.min(timeElapsed / duration, 1);
184				const ease = progress * (2 - progress);
185				window.scrollTo(0, startY + distance * ease);
186				if (progress < 1) {
187					requestAnimationFrame(animation);
188				}
189			}
190
191			requestAnimationFrame(animation);
192		}
193
194		document.querySelectorAll(".tocLink").forEach((link) => {
195			link.addEventListener("click", function (event) {
196				event.preventDefault();
197				const targetId = this.getAttribute("href").substring(1);
198				const targetElement = document.getElementById(targetId);
199				if (targetElement) {
200					// Перевіряємо, чи знаходиться елемент всередині скрольованого контейнера
201					const scrollableContainer = targetElement.closest('.scrollableInner');
202					
203					if (scrollableContainer) {
204						// Якщо елемент в скрольованому контейнері, скролимо контейнер
205						const containerRect = scrollableContainer.getBoundingClientRect();
206						const elementRect = targetElement.getBoundingClientRect();
207						const scrollTop = scrollableContainer.scrollTop;
208						
209						// Розраховуємо позицію елемента відносно контейнера
210						const elementTop = elementRect.top - containerRect.top + scrollTop;
211						
212						// Скролимо контейнер до елемента з відступом
213						scrollableContainer.scrollTo({
214							top: elementTop - 20, // 20px відступ зверху
215							behavior: 'smooth'
216						});
217						
218						// Додатково скролимо сторінку до контейнера
219						const containerPosition = scrollableContainer.getBoundingClientRect().top + window.pageYOffset;
220						window.scrollTo({
221							top: containerPosition - (document.querySelector("header")?.offsetHeight || 80),
222							behavior: "smooth",
223						});
224					} else {
225						// Звичайний скролінг для елементів поза скрольованими контейнерами
226						const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset;
227						try {
228							window.scrollTo({
229								top: targetPosition - (document.querySelector("header")?.offsetHeight || 80),
230							behavior: "smooth",
231						});
232					} catch (e) {
233						smoothScrollTo(targetPosition, 800);
234					}
235					}
236				}
237			});
238		});
239
240		const toc = document.querySelector("#toc-nav");
241		if (toc) {
242			toc.style.opacity = "0";
243			toc.style.transform = "translateY(20px)";
244			setTimeout(() => {
245				toc.style.transition = "opacity 0.5s ease, transform 0.5s ease";
246				toc.style.opacity = "1";
247				toc.style.transform = "translateY(0)";
248			}, 100);
249		}
250
251		const tocTitle = document.querySelector("#toc-title");
252		const tocContent = document.querySelector("#toc-content");
253		if (tocTitle && tocContent) {
254			// Set initial state
255			tocTitle.setAttribute("aria-expanded", "false");
256			tocContent.classList.remove("visible");
257
258			tocTitle.addEventListener("click", function () {
259				const isExpanded = this.getAttribute("aria-expanded") === "true";
260				this.setAttribute("aria-expanded", !isExpanded);
261				tocContent.classList.toggle("visible");
262			});
263		}
264	}
265
266	// Initialize TOC
267	initTOC();
268
269
270 $(".drop, .fold").on("click", function () {
271    // Получаем текущий блок
272    let dropSelect = $(this);
273    let dropContent = dropSelect.find(".options-holder");
274    dropSelect.toggleClass("active");
275
276    if (dropSelect.hasClass("active")) {
277      dropContent.stop().slideDown();
278    } else {
279      dropContent.stop().slideUp();
280    }
281  });
282
283// Функція для оновлення TOC посилань
284	function updateTOCLinks() {
285		const headings = document.querySelectorAll(
286			".tocWrapper ~ h1, .tocWrapper ~ h2, .tocWrapper ~ h3, .tocWrapper ~ * h1, .tocWrapper ~ * h2, .tocWrapper ~ * h3"
287		);
288		
289		headings.forEach((heading, index) => {
290			const currentId = heading.getAttribute('id');
291			const expectedId = "toc-" + index;
292			
293			// Якщо ID не відповідає очікуваному, оновлюємо його
294			if (currentId !== expectedId) {
295				heading.setAttribute('id', expectedId);
296				console.log(`Updated heading ID from "${currentId}" to "${expectedId}"`);
297			}
298			
299			// Оновлюємо відповідне посилання в TOC
300			const tocLink = document.querySelector(
301				`.tocLink[data-temp-id="toc-${index}"]`
302			);
303			if (tocLink) {
304				tocLink.setAttribute("href", "#" + expectedId);
305			}
306		});
307	}
308	
309	// Функція для обробки якірних посилань всередині скрольованих контейнерів
310	function handleAnchorScroll(targetId) {
311		const targetElement = document.getElementById(targetId);
312		
313		if (!targetElement) {
314			console.warn(`Element with ID "${targetId}" not found`);
315			return false;
316		}
317		
318		const scrollableContainer = targetElement.closest('.scrollableInner');
319		
320		if (scrollableContainer) {
321			// Якщо елемент в скрольованому контейнері, скролимо контейнер
322			const containerRect = scrollableContainer.getBoundingClientRect();
323			const elementRect = targetElement.getBoundingClientRect();
324			const scrollTop = scrollableContainer.scrollTop;
325			
326			// Розраховуємо позицію елемента відносно контейнера
327			const elementTop = elementRect.top - containerRect.top + scrollTop;
328			
329			// Скролимо контейнер до елемента з відступом
330			scrollableContainer.scrollTo({
331				top: elementTop - 20, // 20px відступ зверху
332				behavior: 'smooth'
333			});
334			
335			// Додатково скролимо сторінку до контейнера
336			const containerPosition = scrollableContainer.getBoundingClientRect().top + window.pageYOffset;
337			window.scrollTo({
338				top: containerPosition - (document.querySelector("header")?.offsetHeight || 80),
339				behavior: "smooth",
340			});
341			
342			console.log(`Scrolled to element "${targetId}" inside scrollable container`);
343			return true;
344		} else {
345			// Звичайний скролінг для елементів поза скрольованими контейнерами
346			const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset;
347			window.scrollTo({
348				top: targetPosition - (document.querySelector("header")?.offsetHeight || 80),
349				behavior: "smooth",
350			});
351			
352			console.log(`Scrolled to element "${targetId}" on main page`);
353			return true;
354		}
355	}
356	
357	// Обробка прямих якірних посилань
358	document.addEventListener('click', function(e) {
359		if (e.target.tagName === 'A' && e.target.getAttribute('href') && e.target.getAttribute('href').startsWith('#')) {
360			e.preventDefault();
361			const targetId = e.target.getAttribute('href').substring(1);
362			const success = handleAnchorScroll(targetId);
363			
364			if (!success) {
365				// Якщо елемент не знайдено, спробуємо знайти альтернативні варіанти
366				console.log(`Trying to find alternative for "${targetId}"...`);
367				const allElementsWithId = document.querySelectorAll("[id]");
368				const similarIds = Array.from(allElementsWithId)
369				.map((el) => el.id)
370				.filter((id) => id.includes(targetId) || targetId.includes(id))
371				.slice(0, 3); // Показуємо тільки перші 3 варіанти
372
373				if (similarIds.length > 0) {
374					console.log(`Similar IDs found: ${similarIds.join(", ")}`);
375				}
376				
377			}
378		}
379	});
380	
381	// Функція для перевірки всіх якірних посилань на сторінці
382	function validateAnchorLinks() {
383		const allLinks = document.querySelectorAll('a[href^="#"]');
384		const brokenLinks = [];
385		
386		allLinks.forEach(link => {
387			const targetId = link.getAttribute('href').substring(1);
388			const targetElement = document.getElementById(targetId);
389			
390			if (!targetElement) {
391				brokenLinks.push({
392					link: link,
393					targetId: targetId,
394					href: link.getAttribute('href')
395				});
396			}
397		});
398		
399		if (brokenLinks.length > 0) {
400			console.warn(`Found ${brokenLinks.length} broken anchor links:`, brokenLinks);
401		} else {
402			console.log('All anchor links are valid');
403		}
404		
405		return brokenLinks;
406	}
407	
408	// Перевіряємо посилання при завантаженні сторінки
409	setTimeout(() => {
410		validateAnchorLinks();
411	}, 1000);
412	
413	// Обробка хеш-зміни в URL (наприклад, при завантаженні сторінки з #toc-19)
414	if (window.location.hash) {
415		setTimeout(() => {
416		  const targetId = window.location.hash.substring(1);
417		  handleAnchorScroll(targetId);
418		}, 100);
419	  }
420	
421	// Обробка зміни хеша в URL
422	window.addEventListener('hashchange', function() {
423		if (window.location.hash) {
424			const targetId = window.location.hash.substring(1);
425			handleAnchorScroll(targetId);
426		}
427	});
428			
429	$('.menu-item.has-submenu').on('click', function(e) {
430	  var item = $(this);
431	  var clickX = e.pageX - item.offset().left;
432
433
434	  if (clickX > item.outerWidth() - 30) {
435		e.preventDefault();
436		item.toggleClass('open');
437	  }
438	});
439			
440			
441
442  var $banner = $('#promoBanner')[0];
443  var $footer = $('footer')[0]; 
444
445  var observer = new IntersectionObserver(function(entries) {
446    entries.forEach(function(entry) {
447      if (entry.isIntersecting) {
448        $($banner).addClass('hidden');
449      } else {
450        $($banner).removeClass('hidden');
451      }
452    });
453  }, { threshold: 0 });
454
455  observer.observe($footer);
456			
457			
458  $("#closesBanner").on("click", function() {
459    $("#promoBanner").addClass("hidden");
460  });
461
462})	

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.