1// 2function __upGame_rx8(id) { 3 $.ajax({ 4 url: Ajaxrequest() + '?t=gameplayed', 5 type: 'POST', 6 data: "gid=" + id 7 }); 8} 9 10/* FULLSCREEN FUNC */ 11function initFullScreen(fscreenToThis) { 12 if (BigScreen.enabled) { 13 BigScreen.request($(fscreenToThis)[0]); 14 } else { 15 alert("This browser doesn't support full screen"); 16 } 17} 18 19function __sGame() { 20 $('.gmDisplay').show(); 21 $('._Ad-game').remove(); 22} 23 24var __AdRNum = 6; // seconds to remove ads 25function __AdRemoveCount() { 26 if (__AdRNum != 0) { 27 __AdRNum -= 1 28 $('.rAdNum').text(__AdRNum); 29 } else { 30 $('.__r-Ad-1').css('display', 'none'); 31 $('.__r-Ad-2').css('display', 'inherit'); 32 $('._removeAd').attr('onclick', '__sGame()'); 33 $('._removeAd').attr('disabled', false); 34 return false; 35 } 36 window.setTimeout(function () { __AdRemoveCount() }, 1000); 37} 38 39function __adCountD() { 40 if (__AdNum != 0) { 41 __AdNum -= 1 42 $('.Adnum').text(__AdNum); 43 } else { 44 __sGame(); 45 return false; 46 } 47 window.setTimeout(function () { __adCountD() }, 1000); 48} 49 50function __sendReport(gid) { 51 swal({ 52 title: "", 53 text: "¿Tell us, what is your problem?", 54 imageUrl: siteUrl + "/templates/modern/image/icon-color/worker.png", 55 type: "input", 56 showCancelButton: true, 57 closeOnConfirm: false, 58 animation: "slide-from-top", 59 inputPlaceholder: "Write the problem here in detail..." 60 }, function (inputValue) { 61 if (inputValue === false) return false; 62 if (inputValue === "") { 63 swal.showInputError("You need to write something!"); 64 return false 65 } 66 67 $.ajax({
68 url: Ajaxrequest() + '?t=send_report', 69 type: 'POST', 70 data: "gid=" + gid + "&report=" + inputValue, 71 success: function (data) { 72 if (data.status == 200) { 73 swal("", data.success_message, "success"); 74 } else { 75 swal("", data.error_message, "error"); 76 } 77 } 78 }); 79 }); 80 81} 82 83$(function () { 84 /* SEARCH AREA */ 85 $('#search-data-form').ajaxForm({ 86 url: Ajaxrequest() + '?t=search', 87 type: 'POST', 88 success: function (data) { 89 startLoadbar(); 90 Loadlink(data.redirect_url); 91 stopLoadbar(); 92 }, 93 error: function () { 94 console.log('Connection failed!'); 95 } 96 }); 97 98 /* FULLSCREEN BUTTON */ 99 $(document).on('click', '.initFullScreen', function () { 100 initFullScreen($(this).attr('data-fullscreen-item')); 101 }); 102 103 $(document).on('click', '#report-btn', function () { 104 var gid_sR2 = $(this).attr('data-report'); 105 __sendReport(gid_sR2); 106 }); 107 108 /* SHARE BUTTONS */ 109 $(document).on('click', '#share-btn', function (e) { 110 e.preventDefault(); 111 var Dragon__socialURl_r2 = $(this).attr('data-share-url'); 112 window.open( 113 '' + Dragon__socialURl_r2 + '', 114 'Share', 115 'toolbar=0, status=0, width=650, height=450' 116 ); 117 }); 118 119 /* OVERLAY TOGGLE */ 120 $(document).on('click', '.overlay-toggle', function (e) { 121 e.preventDefault(); 122 var data_target = $(this).attr('data-target'); 123 $(data_target).toggleClass('overlay-open'); 124 $('body').toggleClass('state-overlay-open'); 125 $(data_target).attr('data-status', function (_, attr) { 126 return attr == 'closed' ? 'opened' : 'closed'; 127 }); 128 }); 129 130 $(document).on('click', '.overlay-wrapper', function (e) { 131 if (e.target == this) { 132 $(this).toggleClass('overlay-open'); 133 $('body').toggleClass('state-overlay-open'); 134 $(this).attr('data-status', function (_, attr) { 135 return attr == 'closed' ? 'opened' : 'closed'; 136 }); 137 } 138 }); 139 140}); 141 142(function (i, s, o, g, r, a, m) { 143 i['GoogleAnalyticsObject'] = r; 144 i[r] = i[r] || function () { 145 (i[r].q = i[r].q || []).push(arguments) 146 }, i[r].l = 1 * new Date(); 147 a = s.createElement(o), m = s.getElementsByTagName(o)[0]; 148 a.async = 1; 149 a.src = g; 150 m.parentNode.insertBefore(a, m) 151})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 152(function () { 153 ga('create', 'UA-154497915-1', 'auto'); 154 ga('send', 'pageview'); 155})(); 156 157(function (a, b, c) { 158 var d = a.getElementsByTagName(b)[0]; 159 a.getElementById(c) || (a = a.createElement(b), a.id = c, a.src = "https://api.gamemonetize.com/cms_api.js?" + new Date().valueOf(), d.parentNode.insertBefore(a, d)) 160})(document, "script", "gamemonetize-cms"); 161 162 163document.addEventListener('DOMContentLoaded', function () { 164 const searchInput = document.getElementById('Search-InArea'); 165 const searchResults = document.getElementById('search-results'); 166 const sidebar = document.getElementById('sidebar'); 167 const clearSearch = document.getElementById('clear-search'); 168 169 const searchInputTablet = document.getElementById('Search-InArea-tablet'); 170 const searchResultsTablet = document.getElementById('search-results-tablet'); 171 172 const searchInputDesktop = document.getElementById('Search-InArea-desktop'); 173 const searchResultsDesktop = document.getElementById('search-results-desktop'); 174 175 function debounce(func, delay) { 176 let timeout; 177 return function (...args) { 178 clearTimeout(timeout); 179 timeout = setTimeout(() => func.apply(this, args), delay); 180 }; 181 } 182 183 function fetchSearchResults(query, resultsElement, clearElement) { 184 fetch(`/search-handler/${encodeURIComponent(query)}`) 185 .then(response => response.text()) 186 .then(data => { 187 const parser = new DOMParser(); 188 const doc = parser.parseFromString(data, 'text/html'); 189 190 const gameLinks = doc.querySelectorAll('a[href*="/game/"]'); 191 192 const gameList = Array.from(gameLinks) 193 .map(a => ` 194 <a href="${a.href}" class="flex items-center text-[15px] text-white w-full py-2 hover:bg-[#373952]"> 195 ${a.innerHTML} 196 </a> 197 `).join(''); 198 199 const viewAllResultsLink = ` 200 <a href='/search/${encodeURIComponent(query)}
200' class='block mx-4 mt-5 text-center text-[15px] text-white' aria-label='View all results'>View all results</a> 201 `; 202 203 resultsElement.innerHTML = gameList + viewAllResultsLink; 204 resultsElement.classList.remove('hidden'); 205 if (window.innerWidth >= 1024) document.getElementById('search-result-desktop-bg').classList.remove('hidden'); 206 clearElement.classList.remove('hidden'); 207 if (sidebar && window.innerWidth < 1024) sidebar.style.display = 'none'; 208 }) 209 .catch(error => console.error('Error fetching search results:', error)); 210 } 211 212 const debouncedSearch = debounce((query) => fetchSearchResults(query, searchResults, clearSearch), 300); 213 const debouncedSearchTablet = debounce((query) => fetchSearchResults(query, searchResultsTablet, clearSearch), 300); 214 const debouncedSearchDesktop = debounce((query) => fetchSearchResults(query, searchResultsDesktop, clearSearch), 300); 215 216 searchInput.addEventListener('input', function () { 217 const query = searchInput.value.trim(); 218 if (query.length > 2) { 219 debouncedSearch(query); 220 } else { 221 searchResults.classList.add('hidden'); 222 clearSearch.classList.add('hidden'); 223 searchResults.innerHTML = ''; 224 if (sidebar) sidebar.style.display = 'block'; 225 } 226 }); 227 228 searchInputTablet.addEventListener('input', function () { 229 const query = searchInputTablet.value.trim(); 230 if (query.length > 2) { 231 debouncedSearchTablet(query); 232 } else { 233 searchResultsTablet.classList.add('hidden'); 234 clearSearch.classList.add('hidden'); 235 searchResultsTablet.innerHTML = ''; 236 if (sidebar) sidebar.style.display = 'block'; 237 } 238 }); 239 240 searchInputDesktop.addEventListener('input', function () { 241 const query = searchInputDesktop.value.trim(); 242 if (query.length > 2) { 243 debouncedSearchDesktop(query); 244 } else { 245 searchResultsDesktop.classList.add('hidden'); 246 searchResultsDesktop.innerHTML = ''; 247 if (window.innerWidth >= 1024) document.getElementById('search-result-desktop-bg').classList.add('hidden'); 248 } 249 }); 250 251 clearSearch.addEventListener('click', function () { 252 searchInput.value = ''; 253 searchResults.classList.add('hidden'); 254 clearSearch.classList.add('hidden'); 255 searchResults.innerHTML = ''; 256 if (sidebar) sidebar.style.display = 'block'; 257 }); 258 259 clearSearch.addEventListener('click', function () { 260 searchInputTablet.value = ''; 261 searchResultsTablet.classList.add('hidden'); 262 clearSearch.classList.add('hidden'); 263 searchResultsTablet.innerHTML = ''; 264 if (sidebar) sidebar.style.display = 'block'; 265 }); 266 267 $('#back-button').click(function () { 268 if (window.innerWidth < 768) { 269 $('#sidebar-menu').addClass('hidden'); 270 $('#sidebar-menu').removeClass('flex'); 271 } else if (window.innerWidth < 1024) { 272 $('#sidebar-menu').addClass('md:-left-full'); 273 } 274 }) 275 276 $('#mobile-search-button').click(function () { 277 if (window.innerWidth < 768) { 278 $('#sidebar-menu').removeClass('hidden'); 279 $('#sidebar-menu').addClass('flex'); 280 $('#Search-InArea').focus(); 281 } 282 }) 283 284 $('#tablet-search-button').click(function () { 285 $('#sidebar-menu').removeClass('md:-left-full'); 286 }) 287 288 $('#desktop-menu-button').click(function () { 289 if ($('#sidebar-menu').hasClass('lg:left-0')) { 290 $('#sidebar-menu').removeClass('lg:left-0'); 291 document.querySelector('#desktop-menu-button svg').classList.add('scale-x-[-1]'); 292 document.querySelector('div.px-4.pt-20.pb-5').classList.remove('lg:pl-20') 293 } else { 294 $('#sidebar-menu').addClass('lg:left-0'); 295 document.querySelector('#desktop-menu-button svg').classList.remove('scale-x-[-1]'); 296 document.querySelector('div.px-4.pt-20.pb-5').classList.add('lg:pl-20'); 297 } 298 });
299 300 $(document).on('click', '.splide-arrow-right', function () { 301 const container = this.closest('.mb-6').querySelector('.splide-items-container'); 302 container.scrollBy({ left: 272, behavior: 'smooth' }); 303 }); 304 305 // Pastikan video hanya ditambahkan sekali 306 if (/Mobi|Android/i.test(navigator.userAgent) && window.location.pathname === '/') { 307 let activeCarouselIndex = 0; 308 let currentCarouselPlayer = null; 309 let newGamePlayers = {}; 310 311 function createVideoPlayer(container, videoUrl) { 312 if (!container || !videoUrl) return; 313 container.innerHTML = `<video src="${videoUrl}" class="absolute scale-[1.2] object-cover object-center w-full h-full" autoplay muted loop playsinline></video>`; 314 } 315 316 function observeNewGameVideos(entries) { 317 entries.forEach(entry => { 318 const element = entry.target; 319 const imgTag = element.querySelector('img'); 320 if (!imgTag) return; 321 322 const gameId = imgTag.src.split('/')[3]; 323 324 if (entry.isIntersecting) { 325 if (!newGamePlayers[gameId]) { 326 const videoUrl = element.getAttribute('data-wt-video'); 327 if (videoUrl.includes('/games-thumb')) { 328 const videoContainer = document.createElement('div'); 329 videoContainer.className = "absolute inset-0 z-10 object-cover object-center overflow-hidden video-container rounded-2xl"; 330 element.appendChild(videoContainer); 331 newGamePlayers[gameId] = createVideoPlayer(videoContainer, videoUrl); 332 } 333 } 334 } else { 335 if (newGamePlayers[gameId]) { 336 delete newGamePlayers[gameId]; 337 } 338 element.querySelector('.video-container')?.remove(); 339 } 340 }); 341 } 342 343 const newGameObserver = new IntersectionObserver(observeNewGameVideos, { 344 root: null, 345 rootMargin: "0px", 346 threshold: 0.5 347 }); 348 349 document.querySelectorAll('.new-games-list').forEach((element, index) => { 350 if (window.innerWidth < 768) { 351 if ((index + 1) % 5 === 0) { 352 newGameObserver.observe(element); 353 } 354 } else if (window.innerWidth < 1024) { 355 if ([5, 6, 11, 12, 17, 18, 23, 24].includes(index + 1)) { 356 newGameObserver.observe(element); 357 } 358 } 359 }); 360 361 function observeCarousel(entries) { 362 entries.forEach(entry => { 363 const carousel = entry.target; 364 if (!carousel) return; 365 const items = carousel.querySelectorAll('.home-top-games-list'); 366 367 if (entry.isIntersecting) { 368 restartCarouselVideo(items); 369 } else { 370 stopCarouselVideos(items); 371 } 372 }); 373 } 374 375 function restartCarouselVideo(items) { 376 const newIndex = Math.round(carousel.scrollLeft / items[0].offsetWidth); 377 activeCarouselIndex = newIndex; 378 updateCarouselVideos(items); 379 } 380 381 function updateCarouselVideos(items, dotsContainer) { 382 items.forEach((item, i) => { 383 const imgTag = item.querySelector('img'); 384 if (!imgTag) return; 385 const existingVideoContainer = item.querySelector('.video-container'); 386 387 if (!dotsContainer) return; 388 389 dotsContainer.children[i].classList.toggle('opacity-50', i !== activeCarouselIndex); 390 391 if (i === activeCarouselIndex) { 392 if (!existingVideoContainer) { 393 const videoUrl = item.getAttribute('data-wt-video'); 394 if (videoUrl.includes('/games-thumb')) { 395 const videoContainer = document.createElement('div'); 396 videoContainer.className = "absolute inset-0 z-10 object-cover object-center overflow-hidden video-container rounded-2xl"; 397 item.appendChild(videoContainer); 398 currentCarouselPlayer = createVideoPlayer(videoContainer, videoUrl); 399 } 400 } 401 } else { 402 item.querySelector('.video-container')?.remove(); 403 } 404 }); 405 } 406
407 function stopCarouselVideos(items) { 408 if (currentCarouselPlayer) { 409 currentCarouselPlayer = null; 410 } 411 items.forEach(item => item.querySelector('.video-container')?.remove()); 412 } 413 414 const carousel = document.querySelector('.home-top-games-list-carousel'); 415 if (carousel) { 416 const carouselObserver = new IntersectionObserver(observeCarousel, { 417 root: null, 418 rootMargin: "0px", 419 threshold: 0.5 420 }); 421 carouselObserver.observe(carousel); 422 423 const items = carousel.querySelectorAll('.home-top-games-list'); 424 const dotsContainer = document.createElement('div'); 425 dotsContainer.id = 'carousel-dots'; 426 dotsContainer.classList.add('flex', 'justify-center', 'mt-1'); 427 carousel.parentNode.insertBefore(dotsContainer, carousel.nextSibling); 428 429 items.forEach((_, index) => { 430 const dot = document.createElement('div'); 431 dot.classList.add('size-[7px]', 'rounded-full', 'opacity-50', 'bg-white', 'cursor-pointer', 'mx-2'); 432 if (index === 0) dot.classList.remove('opacity-50'); 433 dot.addEventListener('click', () => { 434 carousel.scrollTo({ left: index * items[0].offsetWidth, behavior: 'smooth' }); 435 }); 436 dotsContainer.appendChild(dot); 437 }); 438 439 window.addEventListener("load", () => { 440 const firstItem = items[0]; 441 const imgTag = firstItem.querySelector('img'); 442 if (imgTag) { 443 const videoUrl = firstItem.getAttribute('data-wt-video'); 444 if (videoUrl.includes('/games-thumb')) { 445 const videoContainer = document.createElement('div'); 446 videoContainer.className = "absolute inset-0 z-10 object-cover object-center overflow-hidden video-container rounded-2xl"; 447 firstItem.appendChild(videoContainer); 448 currentCarouselPlayer = createVideoPlayer(videoContainer, videoUrl); 449 } 450 } 451 }); 452 453 carousel.addEventListener('scroll', () => { 454 const newIndex = Math.round(carousel.scrollLeft / items[0].offsetWidth); 455 if (newIndex !== activeCarouselIndex) { 456 activeCarouselIndex = newIndex; 457 updateCarouselVideos(items, dotsContainer); 458 } 459 }); 460 461 window.addEventListener("scroll", () => { 462 const rect = carousel.getBoundingClientRect(); 463 if (rect.top >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)) { 464 restartCarouselVideo(items); 465 } 466 }); 467 } 468 } 469 470 // SHOW MORE BUTTON 471 $(document).on('click', '.show-more-button', function () { 472 const parentDiv = $(this).closest('.flex'); 473 const descriptionDiv = parentDiv.find('.truncated-description'); 474 475 if (descriptionDiv.hasClass('truncate')) { 476 descriptionDiv.removeClass('truncate w-8/12'); 477 parentDiv.removeClass('items-center'); 478 parentDiv.addClass('flex-col items-start'); 479 $(this).removeClass('ml-2'); 480 $(this).text('Show less'); 481 } else { 482 descriptionDiv.addClass('truncate w-8/12'); 483 parentDiv.addClass('items-center'); 484 parentDiv.removeClass('flex-col items-start'); 485 $(this).addClass('ml-2'); 486 $(this).text('Show more'); 487 } 488 }); 489 490 // Ensure "Show more" button is visible if the description is truncated 491 $('.truncated-description').each(function () { 492 if (this.scrollWidth > this.clientWidth) { 493 $(this).siblings('.show-more-button').removeClass('hidden'); 494 } else { 495 $(this).siblings('.show-more-button').addClass('hidden'); 496 } 497 });
498 499 if (window.location.pathname === '/' && window.innerWidth >= 1024) { 500 501 $(document).on('click', '.modal-footer-open', function () { 502 $('.modal-footer').removeClass('hidden').addClass('flex'); 503 }); 504 505 $(document).on('click', '.modal-close, .modal-footer', function (e) { 506 if ($(e.target).is('.modal-close, .modal-footer')) { 507 $('.modal-footer').removeClass('flex').addClass('hidden'); 508 } 509 }); 510 511 $(document).on('click', '.modal-close', function (e) { 512 $('.modal-footer').removeClass('flex').addClass('hidden'); 513 }); 514 515 const container = document.querySelector('.home-top-games-list-carousel'); 516 const gamelist = $('.home-top-games-list-carousel a'); 517 518 $(document).on('click', '#top-home-desktop-arrow-right', function () { 519 for (let index = 0; index < gamelist.length; index++) { 520 if (gamelist[index].getBoundingClientRect().x + gamelist[index].getBoundingClientRect().width > container.clientWidth) { 521 container.scrollTo({ left: gamelist[index].offsetLeft - 48, behavior: 'smooth' }); 522 break; 523 } 524 } 525 }); 526 527 $(document).on('click', '#top-home-desktop-arrow-left', function () { 528 let veryLeftGameListIndex = 0; 529 for (let index = gamelist.length - 1; index >= 0; index--) { 530 veryLeftGameListIndex = index; 531 if (gamelist[index].getBoundingClientRect().x < -container.clientWidth) { 532 break; 533 } 534 } 535 container.scrollTo({ left: veryLeftGameListIndex === 0 ? -container.clientWidth : gamelist[veryLeftGameListIndex].offsetLeft - 48, behavior: 'smooth' }); 536 }); 537 538 const updateArrowsVisibility = () => { 539 const container = document.querySelector('.home-top-games-list-carousel'); 540 const leftArrow = document.getElementById('top-home-desktop-arrow-left'); 541 const rightArrow = document.getElementById('top-home-desktop-arrow-right'); 542 543 if (container.scrollLeft === 0) { 544 leftArrow.classList.remove('group-hover:flex'); 545 } else { 546 leftArrow.classList.add('group-hover:flex'); 547 } 548 549 if (container.scrollLeft + container.clientWidth >= container.scrollWidth) { 550 rightArrow.classList.remove('group-hover:flex'); 551 } else { 552 rightArrow.classList.add('group-hover:flex'); 553 } 554 }; 555 556 document.querySelector('.home-top-games-list-carousel').addEventListener('scroll', updateArrowsVisibility); 557 window.addEventListener('resize', updateArrowsVisibility); 558 updateArrowsVisibility(); 559 560 561 $(document).on('click', '.splide-arrow-right', function () { 562 const container = $(this).parent().find('.splide-items-container')[0]; 563 const gamelist = $(this).parent().find('.splide-items-container a'); 564 for (let index = 0; index < gamelist.length; index++) { 565 if (gamelist[index].getBoundingClientRect().x + gamelist[index].getBoundingClientRect().width > container.clientWidth) { 566 container.scrollTo({ left: gamelist[index].offsetLeft - 48, behavior: 'smooth' }); 567 break; 568 } 569 } 570 }); 571 572 $(document).on('click', '.splide-arrow-left', function () { 573 const container = $(this).parent().find('.splide-items-container')[0]; 574 const gamelist = $(this).parent().find('.splide-items-container a'); 575 let veryLeftGameListIndex = 0; 576 for (let index = gamelist.length - 1; index >= 0; index--) { 577 veryLeftGameListIndex = index; 578 if (gamelist[index].getBoundingClientRect().x < -container.clientWidth) { 579 break; 580 } 581 } 582 container.scrollTo({ left: gamelist[veryLeftGameListIndex].getBoundingClientRect().offsetLeft - 48, behavior: 'smooth' });
583 }); 584 585 const updateArrowsSplideVisibility = () => { 586 const container = document.querySelectorAll('.splide-items-container'); 587 588 container.forEach((c) => { 589 const leftArrow = c.parentElement.querySelector('.splide-arrow-left'); 590 const rightArrow = c.parentElement.querySelector('.splide-arrow-right'); 591 592 if (c.scrollLeft === 0) { 593 leftArrow.classList.remove('group-hover:flex'); 594 } else { 595 leftArrow.classList.add('group-hover:flex'); 596 } 597 598 if (c.scrollLeft + c.clientWidth + 2 >= c.scrollWidth) { 599 rightArrow.classList.remove('group-hover:flex'); 600 } else { 601 rightArrow.classList.add('group-hover:flex'); 602 } 603 }); 604 }; 605 606 document.querySelectorAll('.splide-items-container').forEach((c) => { 607 c.addEventListener('scroll', updateArrowsSplideVisibility); 608 }); 609 window.addEventListener('resize', updateArrowsSplideVisibility); 610 updateArrowsSplideVisibility(); 611 612 $(document).on('click', '.categories-list-container-carousel-arrow-right', function () { 613 const container = $(this).parent().find('.categories-list-container-carousel')[0]; 614 const gamelist = $(this).parent().find('.categories-list-container-carousel div'); 615 for (let index = 0; index < gamelist.length; index++) { 616 if (gamelist[index].getBoundingClientRect().x - container.getBoundingClientRect().x + gamelist[index].clientWidth > container.clientWidth) { 617 console.log(gamelist[index]) 618 container.scrollTo({ left: gamelist[index].offsetLeft - 48, behavior: 'smooth' }); 619 break; 620 } 621 } 622 }); 623 624 $(document).on('click', '.categories-list-container-carousel-arrow-left', function () { 625 const container = $(this).parent().find('.categories-list-container-carousel')[0]; 626 const gamelist = $(this).parent().find('.categories-list-container-carousel div'); 627 let veryLeftGameListIndex = 0; 628 for (let index = gamelist.length - 1; index >= 0; index--) { 629 veryLeftGameListIndex = index; 630 if (gamelist[index].getBoundingClientRect().x < -container.clientWidth) { 631 break; 632 } 633 } 634 635 if (veryLeftGameListIndex === 0) { 636 container.scrollBy({ left: -container.scrollLeft, behavior: 'smooth' }); 637 return; 638 } 639 640 container.scrollTo({ left: gamelist[veryLeftGameListIndex].offsetLeft - 48, behavior: 'smooth' }); 641 }); 642 643 const updateArrowsCategoriesListVisibility = () => { 644 const container = document.querySelector('.categories-list-container-carousel'); 645 const leftArrow = document.querySelector('.categories-list-container-carousel-arrow-left'); 646 const rightArrow = document.querySelector('.categories-list-container-carousel-arrow-right'); 647 648 if (container.scrollLeft === 0) { 649 leftArrow.classList.remove('group-hover:flex'); 650 } else { 651 leftArrow.classList.add('group-hover:flex'); 652 } 653 654 if (container.scrollLeft + container.clientWidth >= container.scrollWidth) { 655 rightArrow.classList.remove('group-hover:flex'); 656 } else { 657 rightArrow.classList.add('group-hover:flex'); 658 } 659 }; 660 661 document.querySelector('.categories-list-container-carousel').addEventListener('scroll', updateArrowsCategoriesListVisibility); 662 window.addEventListener('resize', updateArrowsCategoriesListVisibility); 663 updateArrowsCategoriesListVisibility(); 664 } 665 666 $(document).on('mouseenter', '[data-wt-video]', function () { 667 const gameName = this.getAttribute('aria-label'); 668 if (gameName && window.innerWidth >= 1024) { 669 const nameDiv = document.createElement('div'); 670 nameDiv.className = "absolute ring-2 ring-violet-500 ring-inset rounded-lg name-div bottom-0 z-[11] w-full text-sm font-bold text-white truncate py-4 px-2 h-full flex items-end bg-gradient-name"; 671 if (!$(this).hasClass('w-16')) { 672 const nameParagraph = document.createElement('p'); 673 nameParagraph.className = "truncate"; 674 nameParagraph.textContent = gameName; 675 nameDiv.appendChild(nameParagraph); 676 } 677 this.appendChild(nameDiv); 678 } 679 680 if (this.querySelector('.video-container')) return; // Cegah duplikasi video 681 682 const videoUrl = this.getAttribute('data-wt-video'); 683 if (videoUrl.includes('/games-thumb')) { 684 const videoContainer = document.createElement('div'); 685 videoContainer.className = "absolute inset-0 z-10 object-cover object-center overflow-hidden video-container rounded-2xl"; 686 687 const videoElement = document.createElement('video'); 688 videoElement.src = videoUrl; 689 videoElement.className = "absolute scale-[1.2] object-cover object-center w-full h-full"; 690 videoElement.autoplay = true; 691 videoElement.muted = true; 692 videoElement.loop = true;
693 videoElement.playsInline = true; 694 videoElement.preload = "metadata"; // Hanya pre-load metadata, bukan seluruh video 695 videoElement.playbackRate = 2.0; 696 697 videoContainer.appendChild(videoElement); 698 this.appendChild(videoContainer); 699 } 700 }); 701 702 $(document).on('mouseleave', '[data-wt-video]', function () { 703 const videoContainer = this.querySelector('.video-container'); 704 if (videoContainer) { 705 videoContainer.remove(); 706 } 707 const nameDiv = this.querySelector('.name-div'); 708 if (nameDiv) { 709 nameDiv.remove(); 710 } 711 }); 712});
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.