PageSourceSearch

https://adventure-hq.fun/js/main.js

js adventure-hq.fun collected 2026-10-06 22:36:41 UTC 11,065 bytes, 343 lines download raw bytes

1"use strict";
2document.addEventListener("DOMContentLoaded", function () {
3
4  $(function ($) {
5
6    // preloader
7    $(".preloader").delay(300).animate({
8      "opacity": "0"
9    }, 500, function () {
10      $(".preloader").css("display", "none");
11    });
12
13    // Sticky Header
14    var fixed_top = $(".header-section");
15    $(window).on("scroll", function () {
16      if ($(window).scrollTop() > 50) {
17        fixed_top.addClass("animated fadeInDown header-fixed");
18      }
19      else {
20        fixed_top.removeClass("animated fadeInDown header-fixed");
21      }
22    });
23
24    // Scroll Top
25    var ScrollTop = $(".scrollToTop");
26    $(window).on('scroll', function () {
27      if ($(this).scrollTop() < 600) {
28        ScrollTop.removeClass("active");
29      } else {
30        ScrollTop.addClass("active");
31      }
32    });
33    $('.scrollToTop').on('click', function () {
34      $('html, body').animate({
35        scrollTop: 0
36      }, 600);
37      return false;
38    });
39
40    // Header Dropdown Menu
41    const mobileSize = window.matchMedia("(max-width: 1199px)");
42    function handleMediaScreen(e) {
43      if (e.matches) {
44        $(".navbar-nav .sub").addClass("dropdown-menu");
45        $(".navbar-nav .dropdown").removeClass("show-dropdown");
46        $(".navbar-nav .sub").removeClass("sub-menu");
47
48        $(".navbar-nav .dropdown-menu").parent("li").on('click', function (e) {
49          if (e.target.className !== "dropdown-item") {
50            $(this).find(">.dropdown-menu").toggle(300);
51            e.stopPropagation();
52          }
53        });
54      } else {
55        $(".navbar-nav .dropdown-menu").parent("li").off("click");
56        $("sub-dropdown").off("click");
57
58        $(".navbar-nav .dropdown-menu").show();
59        $(".navbar-nav .dropdown").addClass("show-dropdown");
60        $(".navbar-nav .sub").addClass("sub-menu");
61        $(".navbar-nav .sub").removeClass("dropdown-menu");
62      }
63    }
64    handleMediaScreen(mobileSize);
65    mobileSize.addEventListener("change", handleMediaScreen);
66
67    // Custom Tabs
68    $(".tablinks button").each(function () {
69      var targetTab = $(this).closest(".singletab");
70      targetTab.find(".tablinks button").each(function () {
71        var navBtn = targetTab.find(".tablinks button");
72        navBtn.on('click', function () {
73          navBtn.removeClass('active');
74          $(this).addClass('active');
75          var indexNum = $(this).closest("li").index();
76          var tabcontent = targetTab.find(".tabcontents .tabitem");
77          $(tabcontent).removeClass('active');
78          $(tabcontent).eq(indexNum).addClass('active');
79        });
80      });
81    });
82
83    // Box Style 
84    const targetBtn = document.querySelectorAll('.box-style')
85    if (targetBtn) {
86      targetBtn.forEach((element) => {
87        element.addEventListener('mousemove', (e) => {
88          const x = e.offsetX + 'px';
89          const y = e.offsetY + 'px';
90          element.style.setProperty('--x', x);
91          element.style.setProperty('--y', y);
92        })
93      })
94    }
95
96    // Btn Movement
97    $(".box-style").each(function () {
98      var btn_wrapper = $(this).closest(".btn-movement");
99      btn_wrapper.find(".box-style").each(function () {
100        $(btn_wrapper).on('mousemove', function (event) {
101          var mouseX = event.pageX;
102          var mouseY = event.pageY;
103          var divX = $(btn_wrapper).offset().left + $(btn_wrapper).width() / 2;
104          var divY = $(btn_wrapper).offset().top + $(btn_wrapper).height() / 2;
105          var distanceX = mouseX - divX;
106          var distanceY = mouseY - divY;
107          $(btn_wrapper).css({
108            transform: 'translate(' + distanceX / 5 + 'px, ' + distanceY / 5 + 'px)',
109            transition: 'all 0.8s'
110          });
111        });
112      });
113    });
114
115    // Mouse Follower
116    const follower = document.querySelector(".mouse-follower .cursor-outline");
117    const dot = document.querySelector(".mouse-follower .cursor-dot");
118    if (follower, dot) {
119      window.addEventListener("mousemove", (e) => {
120        follower.animate(
121          [
122            {
123              opacity: 1,
124              left: `${e.clientX}px`,
125              top: `${e.clientY}px`,
126              easing: "ease-in-out"
127            }
128          ],
129          {
130            duration: 3000,
131            fill: "forwards"
132          }
133        );
134        dot.animate(
135          [
136            {
137              opacity: 1,
138              left: `${e.clientX}px`,
139              top: `${e.clientY}px`,
140              easing: "ease-in-out"
141            }
142          ],
143          {
144            duration: 1500,
145            fill: "forwards"
146          }
147        );
148      });
149    }
150
151    // Mouse Follower Hide Function
152    $("a, button").on('mouseenter mouseleave', function () {
153      $('.mouse-follower').toggleClass('hide-cursor');
154    });
155    $(window).on('resize', function () {
156      if ($(window).width() < 1199) {
157        $('.mouse-follower').addClass('hide-cursor');
158      } else {
159        $('.mouse-follower').removeClass('hide-cursor');
160      }
161    });
162    if ($(window).width() < 1199) {
163      $('.mouse-follower').addClass('hide-cursor');
164    } else {
165      $('.mouse-follower').removeClass('hide-cursor');
166    }
167
168    // Circle Text
169    const text = document.querySelector(".text p");
170    if (text) {
171      text.innerHTML = text.innerText.split('').map(
172        (char, i) =>
173          `<span style="transform:rotate(${i * 10}deg)">${char}</span>`
174      ).join('');
175    }
176
177    // counter Item Active Class
178    var counterItem = $('.counter-section .single-box');
179    $(counterItem).on('mouseenter mouseleave', function () {
180      $(counterItem).removeClass('active-area');
181      $(this).addClass('active-area');
182    });
183
184    // Sidebar Menu Active
185    var sidebarBtn = $('.sidebar-wrapper .sidebar-close');
186    var changeBtn = $('.sidebar-wrapper .sidebar-close i');
187    var sidebarWrapper = $('.sidebar-wrapper');
188    $(sidebarBtn).on('click', function () {
189      $('.sidebar-wrapper').toggleClass('sidebar-active');
190      if (sidebarWrapper.hasClass("sidebar-active")) {
191        changeBtn.html("close");
192      } else {
193        changeBtn.html("menu_open");
194      }
195    });
196
197    // Sidebar menu mobile active
198    $('.mobile-menu').on('click', function () {
199      $('.sidebar-wrapper').toggleClass('active-mobile sidebar-active');
200      $('.mobile-menu i').toggleClass('menu-active');
201      if ($('.mobile-menu i').hasClass("menu-active")) {
202        $('.mobile-menu i').html("close");
203      } else {
204        $('.mobile-menu i').html("menu_open");
205      }
206    });
207
208    // Header Active
209    $('.single-item .cmn-head').on('click', function () {
210      $(this).parents('.single-item').toggleClass('active');
211      $(this).parents('.single-item').siblings().removeClass('active');
212    });
213
214    // Cart Item Remove
215    $('.nav-items-wrapper .single-box .end-area').on('click', function () {
216      $(this).parents('.single-box').slideToggle();
217    });
218
219    // comments-area
220    $('.comments-area .reply-btn').on('click', function () {
221      $(this).siblings('.comment-form').slideToggle();
222    });
223
224    // Social Item Remove
225    $('.social-hide-btn').on('click', function () {
226      $(this).parents(".single-box").toggleClass('active');
227      if ($('.single-box').hasClass("active")) {
228        $('.active .social-hide-btn i').html("remove");
229      } else {
230        $('.social-hide-btn i').html("add");
231      }
232    });
233
234    // Password Show Hide
235    $('.show-hide-pass').on('click', function () {
236      var passwordInput = $($(this).siblings(".pass-box input"));
237      var icon = $(this);
238      if (passwordInput.attr("type") == "password") {
239        passwordInput.attr("type", "text");
240        icon.html("visibility");
241      } else {
242        passwordInput.attr("type", "password");
243        icon.html("visibility_off");
244      }
245    });
246
247    // Dropdown Active Remove
248    $("section, .close-btn").on('click', function () {
249      $('.single-item').removeClass('active');
250    });
251
252    // Navbar Active Class 
253    // var curUrl = $(location).attr('href');
254    // var terSegments = curUrl.split("/");
255    // var desired_segment = terSegments[terSegments.length - 1];
256    // var checkLink = $('.navbar-nav a[href="' + desired_segment + '"]');
257    // var targetClass = checkLink.addClass('active');
258    // targetClass.parents(".sub-dropdown").find("button").first().addClass('active');
259    // targetClass.parents(".show-dropdown").find("button").first().addClass('active');
260
261    // var checkLink = $('.sidebar-content .navbar-nav a[href="' + desired_segment + '"]');
262    // var targetClass = checkLink.addClass('active');
263    // targetClass.parents(".sub-dropdown").find("button").first().addClass('active');
264    // targetClass.parents(".show-dropdown").find("button").first().addClass('active');
265
266    // Input Increase
267    var minVal = 1, maxVal = 20;
268    $(".increaseQty").on('click', function () {
269      var $parentElm = $(this).parents(".qtySelector");
270      $(this).addClass("clicked");
271      setTimeout(function () {
272        $(".clicked").removeClass("clicked");
273      }, 100);
274      var value = $parentElm.find(".qtyValue").val();
275      if (value < maxVal) {
276        value++;
277      }
278      $parentElm.find(".qtyValue").val(value);
279    });
280    $(".decreaseQty").on('click', function () {
281      var $parentElm = $(this).parents(".qtySelector");
282      $(this).addClass("clicked");
283      setTimeout(function () {
284        $(".clicked").removeClass("clicked");
285      }, 100);
286      var value = $parentElm.find(".qtyValue").val();
287      if (value > 1) {
288        value--;
289      }
290      $parentElm.find(".qtyValue").val(value);
291    });
292
293    /* ==================================================
294        Texto para o alerta
295    ================================================== */
296    $.post(window.preurl + "remote/", { op: 'getJStrans' }, function (msg) {
297        window.i18n = msg;
298    }, 'json');
299    
300  });
301
302});
303
304
305// document.addEventListener('DOMContentLoaded', function () {
306//   const modal = document.getElementById('custom-modal');
307//   const closeBtn = document.getElementById('close-modal-btn');
308  
309//   closeBtn.addEventListener('click', () => {
310//     modal.style.display = 'none';
311//     sessionStorage.setItem('modalShown', 'true');
312//   });
313
314//   // Só mostra se ainda não foi visto
315//   if (!sessionStorage.getItem('modalShown')) {
316//     modal.style.display = 'flex';
317//   }
318// });
319
320
321    /* Alteracoes AN 20-06-2025: Modal */
322
323document.addEventListener('DOMContentLoaded', function () {
324  const modal   = document.getElementById('custom-modal');
325  const closeBtn = document.getElementById('close-modal-btn');
326  const closeX  = document.querySelector('.close-x');
327
328  function closeModal() {
329    if (modal) {
330      modal.style.display = 'none';
331      sessionStorage.setItem('modalShown', 'true');
332    }
333  }
334
335  // só adiciona se existir no DOM
336  if (closeBtn) closeBtn.addEventListener('click', closeModal);
337  if (closeX)   closeX.addEventListener('click', closeModal);
338
339  // abrir apenas se ainda não foi mostrado
340  if (modal && !sessionStorage.getItem('modalShown')) {
341    modal.style.display = 'flex';
342  }
343});

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.