PageSourceSearch

https://www.urbanheroes.com/wp-content/themes/sylk-uh/js/scripts.js?ver=1.0.0-b-modified-1790848487

js urbanheroes.com collected 2026-10-01 16:24:29 UTC 12,873 bytes, 487 lines download raw bytes

1/* Offcanvas */
2
3document.getElementById('offcanvas-close').addEventListener('click', function() {
4  document.getElementById('offcanvas').classList.remove('visible');
5})
6
7document.getElementById('offcanvas-toggle').addEventListener('click', function() {
8  if (document.getElementById('offcanvas').classList.contains('visible')) {
9    document.getElementById('offcanvas').classList.remove('visible');
10  } else {
11    document.getElementById('offcanvas').classList.add('visible');
12  }
13})
14
15
16document.getElementById('offcanvas-toggle2').addEventListener('click', function() {
17  if (document.getElementById('offcanvas').classList.contains('visible')) {
18    document.getElementById('offcanvas').classList.remove('visible');
19  } else {
20    document.getElementById('offcanvas').classList.add('visible');
21  }
22})
23
24/* Navbar */
25
26function mastheadToggler() {
27  if (window.scrollY > 50) {
28    if (document.getElementById('masthead').classList.contains('scrolled') == false) {
29      document.getElementById('masthead').classList.add('scrolled')
30    }
31  } else {
32    if (document.getElementById('masthead').classList.contains('scrolled')) {
33      document.getElementById('masthead').classList.remove('scrolled')
34    }
35  }
36}
37
38mastheadToggler();
39window.addEventListener('scroll', function() {
40  mastheadToggler();
41});
42
43/* Testimonials carousel */
44
45if (document.querySelector('.testimonials .swiper-container')) {
46  var testimonials = new Swiper( '.testimonials .swiper-container', {
47    loop: true,
48    autoplay: {
49      delay: 7000,
50    },
51    pagination: {
52      el: '.testimonials .swiper-pagination',
53    },
54    navigation: {
55      nextEl: '.swiper-button-next',
56      prevEl: '.swiper-button-prev',
57    },
58    breakpoints: {
59      992: {
60        pagination: false,
61      }
62    }
63  });
64}
65
66/* Service carousel */
67
68if (document.querySelector('.service-uh .swiper')) {
69  var service = new Swiper('.service-uh .swiper', {
70    slidesPerView: 'auto',
71    autoplay: {
72      delay: 2500,
73    },
74    mousewheel: {
75      forceToAxis: true
76    },
77    pagination: {
78      el: '.service-uh .swiper-pagination',
79    },
80    breakpoints: {
81      992: {
82        autoplay: false,
83      }
84    }
85  })
86}
87
88/* Pricing tabs */
89
90const tab0switch = document.getElementById('tab0switch');
91const tab1switch = document.getElementById('tab1switch');
92const tab2switch = document.getElementById('tab2switch');
93const tab3switch = document.getElementById('tab3switch');
94const tab4switch = document.getElementById('tab4switch');
95
96if (tab0switch) {
97  tab0switch.checked = false;
98  let tab0parts = document.querySelectorAll('#newbie .tabs__content-part');
99  tab0switch.addEventListener('change', function() {
100    tab0parts.forEach(function(el) {
101      el.classList.toggle('show');
102    })
103  })
104}
105if (tab1switch) {
106  tab1switch.checked = false;
107  let tab1parts = document.querySelectorAll('#memberships .tabs__content-part');
108  tab1switch.addEventListener('change', function() {
109    tab1parts.forEach(function(el) {
110      el.classList.toggle('show');
111    })
112  })
113}
114if (tab2switch) {
115  tab2switch.checked = true;
116  let tab2parts = document.querySelectorAll('#commitmentfree .tabs__content-part');
117  tab2switch.addEventListener('change', function() {
118    tab2parts.forEach(function(el) {
119      el.classList.toggle('show');
120    })
121  })
122}
123if (tab3switch) {
124  tab3switch.checked = false;
125  let tab3parts = document.querySelectorAll('#deals .tabs__content-part');
126  tab3switch.addEventListener('change', function() {
127    tab3parts.forEach(function(el) {
128      el.classList.toggle('show');
129    })
130  })
131}
132if (tab4switch) {
133  tab4switch.checked = true;
134  let tab4parts = document.querySelectorAll('#newbie .tabs__content-part');
135  tab4switch.addEventListener('change', function() {
136    tab4parts.forEach(function(el) {
137      el.classList.toggle('show');
138    })
139  })
140}
141
142
143
144
145
146/* Pricing V3 tabs */
147
148const maintabswitch = document.getElementById('maintabswitch');
149/* const tab1switch = document.getElementById('tab1switch');
150const tab2switch = document.getElementById('tab2switch');
151const tab3switch = document.getElementById('tab3switch');
152
153if (maintabswitch) {
154  maintabswitch.checked = false;
155  let tab0parts = document.querySelectorAll('#newbie .tabs__content-part');
156  tab0switch.addEventListener('change', function() {
157    tab0parts.forEach(function(el) {
158      el.classList.toggle('show');
159    })
160  })
161}
162
163if (tab1switch) {
164  tab1switch.checked = false;
165  let tab1parts = document.querySelectorAll('#memberships .tabs__content-part');
166  tab1switch.addEventListener('change', function() {
167    tab1parts.forEach(function(el) {
168      el.classList.toggle('show');
169    })
170  })
171}
172if (tab2switch) {
173  tab2switch.checked = false;
174  let tab2parts = document.querySelectorAll('#commitmentfree .tabs__content-part');
175  tab2switch.addEventListener('change', function() {
176    tab2parts.forEach(function(el) {
177      el.classList.toggle('show');
178    })
179  })
180}
181if (tab3switch) {
182  tab3switch.checked = false;
183  let tab3parts = document.querySelectorAll('#deals .tabs__content-part');
184  tab3switch.addEventListener('change', function() {
185    tab3parts.forEach(function(el) {
186      el.classList.toggle('show');
187    })
188  })
189}
190
191
192
193*/
194
195
196
197
198/* Logos carousel */
199
200if (document.querySelector('.logos-uh .swiper')) {
201  var logos = new Swiper( '.logos-uh .swiper', {
202    loop: true,
203    autoplay: {
204      delay: 2500,
205    },
206    slidesPerView: 4,
207    spaceBetween: 20,
208    breakpoints: {
209      540: {
210        slidesPerView: 4
211      },
212      768: {
213        slidesPerView: 6
214      },
215      1280: {
216        slidesPerView: 7,
217        spaceBetween: 40
218      }
219    }
220  });
221}
222
223// Shakes carousel
224
225if (document.querySelector('.shakes-uh .swiper')) {
226  var shakes = new Swiper( '.shakes-uh .swiper', {
227    loop: true,
228    slidesPerView: 1,
229    spaceBetween: 20,
230    watchSlidesProgress: true,
231    navigation: {
232      nextEl: '.shakes-uh .swiper-button-next',
233      prevEl: '.shakes-uh .swiper-button-prev',
234    },
235    breakpoints: {
236      568: {
237        slidesPerView: 2,
238        centeredSlides: true,
239      },
240      992: {
241        slidesPerView: 3,
242        spaceBetween: 40,
243        centeredSlides: true,
244      }
245    }
246  });
247}
248
249/* Quotes carousel */
250
251if (document.querySelector('.quotes-uh .swiper')) {
252  var quotes = new Swiper( '.quotes-uh .swiper', {
253    loop: true,
254    autoplay: {
255      delay: 7000,
256    },
257    pagination: {
258      el: '.quotes-uh .swiper-pagination',
259    },
260    navigation: {
261      nextEl: '.quotes-uh .swiper-button-next',
262      prevEl: '.quotes-uh .swiper-button-prev',
263    },
264    breakpoints: {
265      992: {
266        pagination: false,
267      }
268    }
269  });
270}
271
272/* Features carousel */
273
274if (document.querySelector('.feat-crsl-uh .swiper')) {
275  var featCrsl = new Swiper( '.feat-crsl-uh .swiper', {
276    loop: true,
277    slidesPerView: 1,
278    spaceBetween: 40,
279    watchSlidesProgress: true,
280    observer: true,
281    observeParents: true,
282    autoplay: {
283      delay: 7000,
284    },
285    pagination: {
286      el: '.feat-crsl-uh .swiper-pagination',
287    },
288    navigation: {
289      nextEl: '.feat-crsl-uh .swiper-button-next',
290      prevEl: '.feat-crsl-uh .swiper-button-prev',
291    },
292    breakpoints: {
293      768: {
294        slidesPerView: 2
295      },
296      992: {
297        pagination: false,
298        slidesPerView: 3
299      },
300      1200: {
301        pagination: false,
302        slidesPerView: 4
303      }
304    }
305  });
306}
307
308/* Features carousel karriere */
309
310if (document.querySelector('.feat-crsl-uh-k .swiper')) {
311  var featCrsl = new Swiper( '.feat-crsl-uh-k .swiper', {
312    loop: true,
313    slidesPerView: 1,
314    spaceBetween: 40,
315    watchSlidesProgress: true,
316    observer: true,
317    observeParents: true,
318    autoplay: {
319      delay: 7000,
320    },
321    pagination: {
322      el: '.feat-crsl-uh-k .swiper-pagination',
323    },
324    navigation: {
325      nextEl: '.feat-crsl-uh-k .swiper-button-next',
326      prevEl: '.feat-crsl-uh-k .swiper-button-prev',
327    }
328  });
329}
330
331/* Reviews carousel */
332
333if (document.querySelector('.reviews-uh .swiper')) {
334  var testimonials = new Swiper( '.reviews-uh .swiper', {
335    loop: true,
336    pagination: {
337      el: '.reviews-uh .swiper-pagination',
338    },
339  });
340}
341
342/* Global Switch Block */
343
344const globalSwitchBlocks = document.querySelectorAll('.global-switch-uh');
345if (globalSwitchBlocks.length > 0) {
346  function updateGlobalVisibility(activeSide) {
347    const leftElements = document.querySelectorAll('.left');
348    const rightElements = document.querySelectorAll('.right');
349
350    // Sync all switches on the page
351    globalSwitchBlocks.forEach(function(block) {
352      const btnLeft = block.querySelector('.global-switch-uh__btn-left');
353      const btnRight = block.querySelector('.global-switch-uh__btn-right');
354      
355      if (activeSide === 'right') {
356        btnLeft.classList.remove('active', 'pulse');
357        btnLeft.setAttribute('aria-selected', 'false');
358        btnRight.classList.add('active', 'pulse');
359        btnRight.setAttribute('aria-selected', 'true');
360      } else {
361        btnRight.classList.remove('active', 'pulse');
362        btnRight.setAttribute('aria-selected', 'false');
363        btnLeft.classList.add('active', 'pulse');
364        btnLeft.setAttribute('aria-selected', 'true');
365      }
366    });
367
368    if (activeSide === 'right') {
369      // Right option selected
370      leftElements.forEach(el => el.classList.add('d-nonex'));
371      rightElements.forEach(el => el.classList.remove('d-nonex'));
372    } else {
373      // Left option selected
374      leftElements.forEach(el => el.classList.remove('d-nonex'));
375      rightElements.forEach(el => el.classList.add('d-nonex'));
376    }
377  }
378
379  globalSwitchBlocks.forEach(function(block) {
380    const btnLeft = block.querySelector('.global-switch-uh__btn-left');
381    const btnRight = block.querySelector('.global-switch-uh__btn-right');
382
383    if (btnLeft) {
384      btnLeft.addEventListener('click', function(e) {
385        e.preventDefault();
386        updateGlobalVisibility('left');
387      });
388    }
389
390    if (btnRight) {
391      btnRight.addEventListener('click', function(e) {
392        e.preventDefault();
393        updateGlobalVisibility('right');
394      });
395    }
396  });
397
398  // Initialize state on load based on the first block's active button
399  const firstBlock = globalSwitchBlocks[0];
400  const isRightActive = firstBlock.querySelector('.global-switch-uh__btn-right').classList.contains('active');
401  updateGlobalVisibility(isRightActive ? 'right' : 'left');
402}
403
404/* Social Posts Slider */
405
406if (document.querySelector('.social-posts-uh__slider')) {
407  var socialPosts = new Swiper('.social-posts-uh__slider', {
408    effect: 'creative',
409    creativeEffect: {
410      limitProgress: 3,
411      prev: {
412        translate: ['-60%', 0, -1],
413        scale: 0.85,
414      },
415      next: {
416        translate: ['60%', 0, -1],
417        scale: 0.85,
418      },
419    },
420    centeredSlides: true,
421    slidesPerView: 'auto',
422    slideToClickedSlide: true,
423    loop: true,
424    loopedSlides: 3,
425    speed: 500,
426    grabCursor: true,
427    autoplay: {
428      delay: 5000,
429      disableOnInteraction: false,
430    },
431  });
432}
433
434/* Press testimonials */
435
436if (document.querySelector('.press-uh .swiper')) {
437  var press = new Swiper( '.press-uh .swiper', {
438    loop: true,
439    spaceBetween: 40,
440    pagination: {
441      el: '.press-uh .swiper-pagination',
442    },
443    navigation: {
444      nextEl: '.press-uh .swiper-button-next',
445      prevEl: '.press-uh .swiper-button-prev',
446    }
447  });
448}
449
450/* Location Modal Logic 
451
452document.addEventListener('DOMContentLoaded', function() {
453  const locationModal = document.getElementById('locationModal');
454  if (!locationModal) return;
455
456  const btnFrankfurt = document.getElementById('modalBtnFrankfurt');
457  const btnHamburg = document.getElementById('modalBtnHamburg');
458
459  // Handle clicks on any link that points to #locationModal-...
460  document.addEventListener('click', function(e) {
461    const target = e.target.closest('a[href^="#locationModal-"]');
462    if (target) {
463      e.preventDefault();
464      
465      // Extract the type from the href (e.g., #locationModal-firstTime -> firstTime)
466      const href = target.getAttribute('href');
467      const type = href.split('-')[1];
468      
469      // Update modal links based on type
470      if (type === 'firstTime') {
471        btnFrankfurt.href = '/first-time-frankfurt'; // Update with actual URL later
472        btnHamburg.href = '/first-time-hamburg'; // Update with actual URL later
473      } else if (type === 'memberships') {
474        btnFrankfurt.href = '/memberships-frankfurt'; // Update with actual URL later
475        btnHamburg.href = '/memberships-hamburg'; // Update with actual URL later
476      } else if (type === 'pricing') {
477        btnFrankfurt.href = '/frankfurt/preise'; // Update with actual URL later
478        btnHamburg.href = '/hamburg/preise-hamburg'; // Update with actual URL later
479      }
480      
481      // Show the modal using Bootstrap 5 API
482      const bsModal = new bootstrap.Modal(locationModal);
483      bsModal.show();
484    }
485  });
486});
487*/

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.