PageSourceSearch

https://www.ph-limos.de/assets/js/main.js

js ph-limos.de collected 2026-10-06 03:43:07 UTC 5,166 bytes, 183 lines download raw bytes

1(function() {
2  "use strict";
3
4  /**
5   * Apply .scrolled class to the body as the page is scrolled down
6   */
7  function toggleScrolled() {
8    const selectBody = document.querySelector('body');
9    const selectHeader = document.querySelector('#header');
10    if (!selectHeader.classList.contains('scroll-up-sticky') && !selectHeader.classList.contains('sticky-top') && !selectHeader.classList.contains('fixed-top')) return;
11    window.scrollY > 100 ? selectBody.classList.add('scrolled') : selectBody.classList.remove('scrolled');
12  }
13
14  document.addEventListener('scroll', toggleScrolled);
15  window.addEventListener('load', toggleScrolled);
16
17  /**
18   * Mobile nav toggle
19   */
20  const mobileNavToggleBtn = document.querySelector('.mobile-nav-toggle');
21
22  function mobileNavToogle() {
23    document.querySelector('body').classList.toggle('mobile-nav-active');
24    mobileNavToggleBtn.classList.toggle('bi-list');
25    mobileNavToggleBtn.classList.toggle('bi-x');
26  }
27  if (mobileNavToggleBtn) {
28    mobileNavToggleBtn.addEventListener('click', mobileNavToogle);
29  }
30
31  /**
32   * Hide mobile nav on same-page/hash links
33   */
34  document.querySelectorAll('#navmenu a').forEach(navmenu => {
35    navmenu.addEventListener('click', () => {
36      if (document.querySelector('.mobile-nav-active')) {
37        mobileNavToogle();
38      }
39    });
40
41  });
42
43  /**
44   * Toggle mobile nav dropdowns
45   */
46  document.querySelectorAll('.navmenu .toggle-dropdown').forEach(navmenu => {
47    navmenu.addEventListener('click', function(e) {
48      e.preventDefault();
49      this.parentNode.classList.toggle('active');
50      this.parentNode.nextElementSibling.classList.toggle('dropdown-active');
51      e.stopImmediatePropagation();
52    });
53  });
54
55  /**
56   * Preloader
57   */
58  const preloader = document.querySelector('#preloader');
59  if (preloader) {
60    window.addEventListener('load', () => {
61      preloader.remove();
62    });
63  }
64
65  /**
66   * Scroll top button
67   */
68  let scrollTop = document.querySelector('.scroll-top');
69
70  function toggleScrollTop() {
71    if (scrollTop) {
72      window.scrollY > 100 ? scrollTop.classList.add('active') : scrollTop.classList.remove('active');
73    }
74  }
75  scrollTop.addEventListener('click', (e) => {
76    e.preventDefault();
77    window.scrollTo({
78      top: 0,
79      behavior: 'smooth'
80    });
81  });
82
83  window.addEventListener('load', toggleScrollTop);
84  document.addEventListener('scroll', toggleScrollTop);
85
86  /**
87   * Animation on scroll function and init
88   */
89  function aosInit() {
90    AOS.init({
91      duration: 600,
92      easing: 'ease-in-out',
93      once: true,
94      mirror: false
95    });
96  }
97  window.addEventListener('load', aosInit);
98
99  /**
100   * Init typed.js
101   */
102  const selectTyped = document.querySelector('.typed');
103  if (selectTyped) {
104    let typed_strings = selectTyped.getAttribute('data-typed-items');
105    typed_strings = typed_strings.split(',');
106    new Typed('.typed', {
107      strings: typed_strings,
108      loop: true,
109      typeSpeed: 150,
110      backSpeed: 50,
111      backDelay: 2000
112    });
113  }
114
115  /**
116   * Init swiper sliders
117   */
118  function initSwiper() {
119    document.querySelectorAll(".init-swiper").forEach(function(swiperElement) {
120      let config = JSON.parse(
121        swiperElement.querySelector(".swiper-config").innerHTML.trim()
122      );
123
124      if (swiperElement.classList.contains("swiper-tab")) {
125        initSwiperWithCustomPagination(swiperElement, config);
126      } else {
127        new Swiper(swiperElement, config);
128      }
129    });
130  }
131
132  window.addEventListener("load", initSwiper);
133
134  /**
135   * Frequently Asked Questions Toggle
136   */
137  document.querySelectorAll('.faq-item h3, .faq-item .faq-toggle').forEach((faqItem) => {
138    faqItem.addEventListener('click', () => {
139      faqItem.parentNode.classList.toggle('faq-active');
140    });
141  });
142
143  /**
144   * Correct scrolling position upon page load for URLs containing hash links.
145   */
146  window.addEventListener('load', function(e) {
147    if (window.location.hash) {
148      if (document.querySelector(window.location.hash)) {
149        setTimeout(() => {
150          let section = document.querySelector(window.location.hash);
151          let scrollMarginTop = getComputedStyle(section).scrollMarginTop;
152          window.scrollTo({
153            top: section.offsetTop - parseInt(scrollMarginTop),
154            behavior: 'smooth'
155          });
156        }, 100);
157      }
158    }
159  });
160
161  /**
162   * Navmenu Scrollspy
163   */
164  let navmenulinks = document.querySelectorAll('.navmenu a');
165
166  function navmenuScrollspy() {
167    navmenulinks.forEach(navmenulink => {
168      if (!navmenulink.hash) return;
169      let section = document.querySelector(navmenulink.hash);
170      if (!section) return;
171      let position = window.scrollY + 200;
172      if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) {
173        document.querySelectorAll('.navmenu a.active').forEach(link => link.classList.remove('active'));
174        navmenulink.classList.add('active');
175      } else {
176        navmenulink.classList.remove('active');
177      }
178    })
179  }
180  window.addEventListener('load', navmenuScrollspy);
181  document.addEventListener('scroll', navmenuScrollspy);
182
183})();

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.