PageSourceSearch

https://www.klimaaktiv.at/_assets/2f2013a308e7fc7aad740142cd8b328e/Js/main.js?1790064841

js klimaaktiv.at collected 2026-09-24 09:25:25 UTC 35,241 bytes, 1,063 lines download raw bytes

1let compareList = [];
2
3$(document).ready(function () {
4  //quicklink.listen();
5  // AOS.init({
6  //   offset: 0,
7  //   once: true,
8  // });
9
10  //// accessible navigation
11
12  // set targetgroup cookie
13  if (readCookie("CookieConsent")) {
14    setTargetGroup();
15  } else {
16    window.addEventListener("CookiebotOnAccept", function (e) {
17      setTargetGroup();
18    });
19    window.addEventListener("CookiebotOnDecline", function (e) {
20      setTargetGroup();
21    });
22  }
23
24  // Select all dropdown elements with submenus
25  const dropdowns = document.querySelectorAll(".nav-item.has-submenu");
26
27  dropdowns.forEach((dropdown) => {
28    const link = dropdown.querySelector(".nav-link");
29    const submenu = dropdown.querySelector(".dropdown-menu");
30
31    // Open submenu on focus and Enter key
32    link.addEventListener("keydown", (event) => {
33      if (event.key === "Enter" || event.key === " ") {
34        // Check for Enter or Space key
35        event.preventDefault(); // Prevent default link behavior
36        submenu.classList.add("show");
37        link.setAttribute("aria-expanded", "true");
38        // Focus the first focusable item in the submenu
39        const firstFocusable = submenu.querySelector(
40          'a, button, input, [tabindex="0"]',
41        );
42        if (firstFocusable) {
43          firstFocusable.focus();
44        }
45      }
46    });
47
48    // Keep submenu open while navigating with Tab
49    submenu.addEventListener("focusin", () => {
50      submenu.classList.add("show");
51      link.setAttribute("aria-expanded", "true");
52    });
53
54    // Close submenu when focus leaves
55    submenu.addEventListener("focusout", () => {
56      setTimeout(() => {
57        if (!submenu.matches(":focus-within")) {
58          submenu.classList.remove("show");
59          link.setAttribute("aria-expanded", "false");
60        }
61      }, 100); // Small delay to handle focus transition
62    });
63
64    // Close submenu on Escape key
65    submenu.addEventListener("keydown", (event) => {
66      if (event.key === "Escape") {
67        submenu.classList.remove("show");
68        link.setAttribute("aria-expanded", "false");
69        link.focus(); // Return focus to the trigger element
70      }
71    });
72  });
73
74  //// accessible nav end
75
76  const tooltipTriggerList = document.querySelectorAll(
77    '[data-bs-toggle="tooltip"]',
78  );
79  const tooltipList = [...tooltipTriggerList].map(
80    (tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl),
81  );
82
83  const searchCollapsible = document.getElementById("collapseSearch");
84  searchCollapsible.addEventListener("shown.bs.collapse", (event) => {
85    const searchInput = document.getElementById("searchterm");
86    searchInput.focus();
87
88    //check if #collapsableNav is visible, if yes hide it
89    const navCollapsible = document.getElementById("collapsableNav");
90    if (navCollapsible.classList.contains("show")) {
91      var collapse = bootstrap.Collapse.getInstance(navCollapsible);
92      $('button[data-bs-target="#collapsableNav"]').toggleClass("is-active");
93      window.scrollTo(0, 0);
94      collapse.hide();
95      //scroll to top
96    }
97  });
98
99  /* touch support for nav */
100  $(".navbar li.dropdown").doubleTapToGo();
101
102  /* mobile nav */
103  $(".hamburger").click(function () {
104    $(this).toggleClass("is-active");
105
106    var search = bootstrap.Collapse.getInstance(
107      document.getElementById("collapseSearch"),
108    );
109    if (search) {
110      search.hide();
111    }
112  });
113
114  // $(".dropdown-toggle").click(function () {
115  //   $(this).next().toggleClass("show");
116  // });
117
118  $("#share-page").click(async function (e) {
119    e.preventDefault();
120    var shareUrl = $("#shareUrl").text().trim();
121    var title = $(document).find("title").text();
122    if (shareUrl === "") {
123      shareUrl = window.location.href;
124    }
125    const shareData = {
126      title: title,
127      url: shareUrl,
128    };
129    try {
130      await navigator.share(shareData);
131    } catch (err) {
132      //console.log(err);
133      let breadcrumbContainerHeight = $(".breadcrumb-container").height();
134      $(".share-dropdown").css("top", breadcrumbContainerHeight + "px");
135      $(".share-dropdown").addClass("active");
136    }
137  });
138
139  $("body").on("click", function (e) {
140    if (
141      !$(e.target).closest(".share-dropdown").length &&
142      !$(e.target).closest("#share-page").length
143    ) {
144      if ($(".share-dropdown").length > 0) {
145        if ($(".share-dropdown").hasClass("active")) {
146          $(".share-dropdown").removeClass("active");
147        }
148      }
149    }
150  });
151
152  /// NAVIGATION START
153
154  document.querySelectorAll(".btn-back").forEach(function (button) {
155    button.addEventListener("click", function () {
156      let trigger = button.closest(".dropdown-menu").previousElementSibling;
157      let dropdown = bootstrap.Dropdown.getOrCreateInstance(trigger);
158      dropdown.toggle();
159    });
160  });
161
162  function setSubmenu2ListHeight(submenu) {
163    if ($(submenu).hasClass("submenu-2")) {
164      $(submenu).find(">
164 ul").css("height", "100%");
165    }
166  }
167
168  function resetSubmenu2ListHeight(submenu) {
169    if ($(submenu).hasClass("submenu-2")) {
170      $(submenu).find("> ul").css("height", "");
171    }
172  }
173
174  document.querySelectorAll(".submenu-2").forEach(function (submenu) {
175    const observer = new MutationObserver(function () {
176      if (submenu.classList.contains("show")) {
177        setSubmenu2ListHeight(submenu);
178      } else {
179        resetSubmenu2ListHeight(submenu);
180      }
181    });
182
183    observer.observe(submenu, {
184      attributes: true,
185      attributeFilter: ["class"],
186    });
187
188    if (submenu.classList.contains("show")) {
189      setSubmenu2ListHeight(submenu);
190    } else {
191      resetSubmenu2ListHeight(submenu);
192    }
193  });
194
195  function adjustMenuHeight(submenu, menu, button, level4 = false) {
196    if (!level4) {
197      const topOffset = menu.position().top - button.position().top;
198
199      submenu.css("top", topOffset);
200      submenu.css("min-height", menu.outerHeight() + "px");
201    }
202  }
203
204  function resetMenuHeight(submenu, level4 = false) {
205    if (!level4) {
206      submenu.css("top", 0);
207      submenu.css("min-height", "");
208    }
209  }
210
211  breakPoint = 1199;
212
213  // desktop nav
214  document
215    .querySelectorAll(".navbar-nav .nav-item")
216    .forEach(function (everyitem) {
217      everyitem.addEventListener("mouseover", function (e) {
218        if (window.innerWidth > breakPoint) {
219          let el_link = this.querySelector(".nav-link");
220
221          if (el_link != null) {
222            el_link.classList.add("show");
223            el_link.setAttribute("aria-expanded", "true");
224          }
225        }
226      });
227
228      everyitem.addEventListener("mouseleave", function (e) {
229        if (window.innerWidth > breakPoint) {
230          let el_link = this.querySelector(".nav-link");
231
232          if (el_link != null) {
233            el_link.classList.remove("show");
234            el_link.setAttribute("aria-expanded", "false");
235          }
236        }
237      });
238    });
239
240  document
241    .querySelectorAll(".navbar-nav .nav-item")
242    .forEach(function (everyitem) {
243      everyitem.addEventListener("mouseover", function (e) {
244        if (window.innerWidth > breakPoint) {
245          let el_link = this.querySelector("[data-bs-toggle]");
246
247          if (el_link != null) {
248            let nextEl = el_link.nextElementSibling;
249            while (nextEl && !nextEl.classList.contains("dropdown-menu")) {
250              nextEl = nextEl.nextElementSibling;
251            }
252            if (nextEl) {
253              el_link.classList.add("show");
254              el_link.setAttribute("aria-expanded", "true");
255              nextEl.classList.add("show");
256            }
257          }
258        }
259      });
260      everyitem.addEventListener("mouseleave", function (e) {
261        if (window.innerWidth > breakPoint) {
262          let el_link = this.querySelector("[data-bs-toggle]");
263
264          if (el_link != null) {
265            let nextEl = el_link.nextElementSibling;
266            while (nextEl && !nextEl.classList.contains("dropdown-menu")) {
267              nextEl = nextEl.nextElementSibling;
268            }
269            if (nextEl) {
270              el_link.classList.remove("show");
271              el_link.ariaExpanded = "false";
272              nextEl.classList.remove("show");
273            }
274          }
275        }
276      });
277    });
278
279  function updateMenuPositions() {
280    let metanav = document.querySelector(".metanav");
281    let mainnav = document.querySelector(".page-header");
282    let topicmenus = document.querySelectorAll(
283      ".mask_mbit_topicmenu--variant2",
284    );
285    let navlinks = document.querySelectorAll(
286      ".navbar-nav > .nav-item > .nav-link",
287    );
288    let areaDropdown = document.querySelector(".area-dropdown");
289    let areaDropdownHeight = 0;
290    if (areaDropdown) {
291      areaDropdownHeight = areaDropdown.offsetHeight;
292    }
293    let metanavHeight = 0;
294    if (metanav) {
295      metanavHeight = metanav.offsetHeight;
296    }
297    let topicmenuHeight = 0;
298    if (topicmenus.length > 0) {
299      topicmenuHeight = topicmenus[0].offsetHeight;
300    }
301
302    let navbarHeight = document.querySelector(".navbar-nav").offsetHeight;
303    let mainnavHeight = document.querySelector(".page-header").offsetHeight;
304    let submenus = document.querySelectorAll(".submenu-2");
305
306    if (window.innerWidth > breakPoint) {
307      // position megamenu submenu-2
308      submenus.forEach(function (submenu) {
309        submenu.style.top = navbarHeight + areaDropdownHeight + "px";
310      });
311
312      // position topicmenu
313      topicmenus.forEach(function (topicmenu) {
314        topicmenu.style.top = mainnavHeight + metanavHeight + 20 + "px";
315      });
316    } else {
317      metanav.classList.remove("scrolled-up");
318      metanav.classList.remove("scrolled-down");
319      mainnav.style.top = "0px";
320      topicmenus.forEach(function (topicmenu) {
321        topicmenu.style.top = mainnavHeight + 15 + "px";
322      });
323      navlinks.forEach(function (navlink) {
324        navlink.removeAttribute("data-bs-toggle");
325        navlink.removeAttribute("data-bs-auto-close");
326        navlink.removeAttribute("aria-expanded");
327      });
328    }
329    var last_scroll_top = 0;
330    window.addEventListener("scroll", function () {
331      if (window.innerWidth > breakPoint) {
332        let scroll_top = window.scrollY;
333        let metanavHeight = metanav.offsetHeight;
334        let mainnavHeight = mainnav.offsetHeight;
335
336        if (scroll_top < last_scroll_top) {
337          metanav.classList.remove("scrolled-down");
338          metanav.classList.add("scrolled-up");
339          mainnav.style.top = metanavHeight + "px";
340          topicmenus.forEach(function (topicmenu) {
341            topicmenu.style.top = mainnavHeight + metanavHeight + 20 + "px";
342          });
343        } else {
344          metanav.classList.remove("scrolled-up");
345          metanav.classList.add("scrolled-down");
346          mainnav.style.top = "0px";
347          topicmenus.forEach(function (topicmenu) {
348            topicmenu.style.top = mainnavHeight + 20 + "px";
349          });
350        }
351        last_scroll_top = scroll_top;
352      }
353    });
354    // Update :target offset based on mainnavHeight and topicmenuHeight
355
356    // let topElement = document.getElementById("top");
357    // if (topElement) {
358    //   topElement.style.scrollPaddingTop = `${
359    //     mainnavHeight + topicmenuHeight + 20
360    //   }px`;
361    // }
362
363    document.documentElement.style.setProperty(
364      "--mainnav-height",
365      mainnavHeight,
366    );
367    document.documentElement.style.setProperty(
368      "--topicmenu-height",
369      topicmenuHeight,
370    );
371    // styleElement.style = `
372    //   :target {
373    //     margin-top: -${mainnavHeight + topicmenuHeight + 20}px;
374    //     padding-top: ${mainnavHeight + topicmenuHeight + 20}px;
375    //   }
376    // `;
377  }
378  // Initial call to set positions
379  updateMenuPositions();
380
381  // Update positions on window resize
382  window.addEventListener("resize", updateMenuPositions);
383  // desktop nav END
384
385  $(".nav-item-level-3.has-submenu").on({
386    mouseenter: function () {
387      //console.log("mouseenter nav-item-level-3");
388      adjustMenuHeight(
389        $(this).find(".submenu-3"),
390        $(this).closest("ul"),
391        $(this),
392      ); // Adjust the height when hover starts
393    },
394    mouseleave: function () {
395      //console.log("mouseleave nav-item-level-3)");
396      resetMenuHeight($(this).find(".submenu-3")); // Reset the height when hover ends
397    },
398  });
399
400  $(".nav-item-level-4.has-submenu").on({
401    mouseenter: function () {
402      //console.log("mouseenter nav-item-level-4");
403      adjustMenuHeight(
404        $(this).find(".submenu-4"),
405        $(this).closest("ul"),
406        $(this),
407        true,
408      ); // Adjust the height when hover starts
409    },
410    mouseleave: function () {
411      //console.log("mouseleave nav-item-level-4");
412      resetMenuHeight($(this).find(".submenu-4"), true); // Reset the height when hover ends
413    },
414  });
415
416  function bindLevel4Events() {
417    $(".nav-item-level-4.has-submenu button").on(
418      "click keydown",
419      function (event) {
420        const parent = $(this).parent();
421        const $submenu = $(parent).find(".submenu-4");
422        if (
423          event.type === "click" ||
424          (event.type === "keydown" &&
425            (event.key === "Enter" || event.key === " "))
426        ) {
427          event.preventDefault();
428
429          // Close other submenus on the same level
430          $(parent)
431            .siblings(".nav-item-level-4.has-submenu")
432            .find(".submenu-4:visible")
433            .each(function () {
434              resetMenuHeight($(this), true);
435              $(this).hide();
436            });
437
438          if ($submenu.is(":visible")) {
439            resetMenuHeight($submenu, true);
440            $submenu.hide(); // Close the menu
441          } else {
442            adjustMenuHeight(
443              $submenu,
444              $(parent).closest("ul"),
445              $(parent),
446              true,
447            );
448            $submenu.show(); // Open the menu
449          }
450        }
451      },
452    );
453  }
454
455  function bindLevel3Events() {
456    $(".nav-item-level-3.has-submenu button").on(
457      "click keydown",
458      function (event) {
459        const parent = $(this).parent();
460        const $submenu = $(parent).find(".submenu-3");
461        if (
462          event.type === "click" ||
463          (event.type === "keydown" &&
464            (event.key === "Enter" || event.key === " "))
465        ) {
466          event.preventDefault();
467
468          // Close other submenus on the same level
469          $(parent)
470            .siblings(".nav-item-level-3.has-submenu")
471            .find(".submenu-3:visible")
472            .each(function () {
473              resetMenuHeight($(this));
474              $(this).hide();
475            });
476
477          if ($submenu.is(":visible")) {
478            resetMenuHeight($submenu);
479            $submenu.hide(); // Close the menu
480          } else {
481            adjustMenuHeight($submenu, $(parent).closest("ul"), $(parent));
482            $submenu.show(); // Open the menu
483          }
484        }
485      },
486    );
487  }
488
489  function unbindEvents() {
490    $(".nav-item-level-4.has-submenu button").off("click keydown");
491    $(".nav-item-level-3.has-submenu button").off("click keydown");
492  }
493
494  function checkWindowSize() {
495    if ($(window).width() > breakPoint) {
496      // Re-bind events if not already bound
497      bindLevel4Events();
498      bindLevel3Events();
499    } else {
500      // Unbind events for smaller window sizes
501      unbindEvents();
502    }
503  }
504
505  checkWindowSize();
506
507  $(window).on("resize", checkWindowSize);
508
509  /// NAVIGATION END
510
511  /* to top button */
512  $(window).scroll(function () {
513    if ($(this).scrollTop()) $("#toTop").fadeIn();
514    else $("#toTop").fadeOut();
515  });
516
517  $("#toTop").click(function () {
518    $(window).scrollTop(0);
519  });
520  /* to top button END */
521
522  //Slider START
523  //
524  //SWIPER API - https://swiperjs.com/swiper-api
525  //
526  const logoswiper = new Swiper(".logoSlider", {
527    // Optional parameters
528    speed: 800,
529    direction: "horizontal",
530    loop: true,
531
532    autoplay: true,
533
534    // If we need pagination
535    pagination: {
536      el: ".swiper-pagination",
537      type: "bullets",
538      clickable: true,
539    },
540
541    // Navigation arrows
542    navigation: {
543      nextEl: ".swiper-button-next",
544      prevEl: ".swiper-button-prev",
545    },
546
547    slidesPerView: 1,
548
549    // Responsive breakpoints
550    breakpoints: {
551      // when window width is >= small (bootstrap)
552      576: {
553        slidesPerView: 2,
554        spaceBetween: 20,
555      },
556      // when window width is >= medium (bootstrap)
557      768: {
558        slidesPerView: 3,
559        spaceBetween: 30,
560      },
561      // when window width is >= large (bootstrap)
562      992: {
563        slidesPerView: 3,
564        spaceBetween: 40,
565      },
566    },
567  });
568  const mainswiper = new Swiper(".mainSlider", {
569    // Optional parameters
570    speed: 800,
571    direction: "horizontal",
572    loop: true,
573
574    autoplay: true,
575
576    // If we need pagination
577    pagination: {
578      el: ".swiper-pagination",
579      type: "bullets",
580      clickable: true,
581    },
582
583    // Navigation arrows
584    navigation: {
585      nextEl: ".swiper-button-next",
586      prevEl: ".swiper-button-prev",
587    },
588
589    slidesPerView: 1,
590  });
591
592  const galleryswiper = new Swiper(".mask_mbit_galerie .swiper", {
593    // Optional parameters
594    speed: 800,
595    direction: "horizontal",
596    loop: true,
597    centeredSlides: true,
598    spaceBetween: 17,
599    grabCursor: false,
600    a11y: true,
601
602    //autoplay: true,
603
604    // If we need pagination
605    pagination: {
606      el: ".swiper-pagination",
607      type: "bullets",
608      clickable: true,
609    },
610
611    // Navigation arrows
612    navigation: {
613      nextEl: ".swiper-button-next",
614      prevEl: ".swiper-button-prev",
615    },
616
617    slidesPerView: 1,
618
619    breakpoints: {
620      768: {
621        slidesPerView: "auto",
622      },
623    },
624  });
625
626  const teaserboxswiper = new Swiper(".teaserbox--hero .swiper", {
627    // Optional parameters
628    speed: 800,
629    direction: "horizontal",
630    spaceBetween: 17,
631    grabCursor: true,
632    a11y: true,
633
634    // Navigation arrows
635    navigation: {
636      nextEl: ".swiper-button-next",
637      prevEl: ".swiper-button-prev",
638    },
639
640    slidesPerView: "auto",
641
642    breakpoints: {
643      1200: {
644        spaceBetween: 40,
645      },
646    },
647  });
648
649  // Function to manage active classes
650  function updateActiveSlides(swiper) {
651    const activeIndex = swiper.activeIndex;
652    const slides = swiper.slides;
653
654    slides.forEach((slide, index) => {
655      // Determine active slides based on the activeIndex
656      const isActive =
657        activeIndex === 0
658          ? index === activeIndex || index === activeIndex + 1 // For the first slide, only two slides are active
659          : index === activeIndex ||
660            index === activeIndex + 1 ||
661            index === activeIndex + 2; // For other slides, three slides are active
662
663      if (isActive) {
664        slide.classList.add("active-slide");
665        slide.setAttribute("aria-hidden", "false");
666
667        // Enable focus for active slides
668        slide
669          .querySelectorAll("a, button, input, select, textarea")
670          .forEach((el) => {
671            el.setAttribute("tabindex", "0");
672          });
673      } else {
674        slide.classList.remove("active-slide");
675        slide.setAttribute("aria-hidden", "true");
676
677        // Disable focus for inactive slides
678        slide
679          .querySelectorAll("a, button, input, select, textarea")
680          .forEach((el) => {
681            el.setAttribute("tabindex", "-1");
682          });
683      }
684    });
685  }
686
687  // Apply the active class logic on init
688  teaserboxswiper.on("init", () => {
689    updateActiveSlides(teaserboxswiper);
690  });
691
692  // Apply the active class logic on slide change
693  teaserboxswiper.on("slideChange", () => {
694    updateActiveSlides(teaserboxswiper);
695  });
696
697  // Initialize Swiper and ensure classes are set immediately
698  teaserboxswiper.init();
699  updateActiveSlides(teaserboxswiper); // Ensure classes are set on page load
700
701  $(".image-wrapper").each(function () {
702    lightGallery(this, {
703      animateThumb: false,
704      zoomFromOrigin: false,
705      allowMediaOverlap: false,
706      download: false,
707      toggleThumb: true,
708      licenseKey: "3C40924D-9ADD480A-A4B7AC38-57A4A212",
709    });
710  });
711
712  // Appointment VOR A nach B
713  var address = $("#appointment-address").data("address");
714  var place = $("#appointment-place").data("place");
715  var destination = address || place;
716
717  var observer = new MutationObserver(function (mutationsList, observer) {
718    var widget = $("#HFS_ToContainer .hfs_suggestInputWrapper input");
719
720    if (widget.length) {
721      widget.val(destination);
722      observer.disconnect();
723    }
724  });
725
726  observer.observe(document.body, {
727    childList: true,
728    subtree: true,
729  });
730
731  $("input[data-autosuggest]").keyup(
732    $.debounce(300, false, function (e) {
733      //let spinner = $(this).siblings(".spinner-border");
734      if (e.key === "Enter") {
735        return;
736      }
737
738      let input = $(this).val();
739      let suggestId = $(this).attr("data-suggestid");
740      let searchWrapper = $(this).closest(".search-wrapper");
741      let suggestionSearch = searchWrapper.find(".suggestionsearch");
742      let spinner = searchWrapper.find(".loading");
743      let searchSubmit = searchWrapper.find(".searchsubmit-form");
744
745      searchSubmit.removeClass("d-none");
746      if (input.length >= 3) {
747        spinner.removeClass("d-none");
748
749        $.ajax({
750          url: "/?type=1991&=searchterm",
751          type: "POST",
752          data: {
753            searchterm: input,
754          },
755          success: function (data) {
756            suggestionSearch.empty();
757            $(suggestionSearch).removeClass("show");
758            spinner.addClass("d-none");
759            if (data.length > 0) {
760              $(suggestionSearch).addClass("show");
761              data.forEach((element) => {
762                suggestionSearch.append(
763                  '<div class="suggestitem" onclick="setsuggestion(\'' +
764                    suggestId +
765                    "','" +
766                    element +
767                    "')\">" +
768                    element +
769                    "</div>",
770                );
771              });
772            }
773          },
774          error: function (xhr, status, error) {
775            spinner.addClass("d-none");
776            console.error(xhr, status, error);
777            // Handle errors here
778          },
779        });
780      } else {
781        suggestionSearch.empty();
782        $(suggestionSearch).removeClass("show");
783      }
784    }),
785  );
786
787  if (
788    navigator.userAgent.search("Firefox") > -1 &&
789    $("div[data-hfs-widget='true']").length
790  ) {
791    waitForElm(".lyr_atomPrimaryBtn").then((elm) => {
792      $(".lyr_atomPrimaryBtn").click(function () {
793        window.history.pushState({}, "", window.location.href);
794      });
795    });
796  }
797});
798
799function waitForElm(selector) {
800  return new Promise((resolve) => {
801    if (document.querySelector(selector)) {
802      return resolve(document.querySelector(selector));
803    }
804
805    const observer = new MutationObserver((mutations) => {
806      if (document.querySelector(selector)) {
807        observer.disconnect();
808        resolve(document.querySelector(selector));
809      }
810    });
811
812    observer.observe(document.body, {
813      childList: true,
814      subtree: true,
815    });
816  });
817}
818
819function setTargetGroup() {
820  var targetGroupInfos = $("#targetGroupInfos").data("targetgroupinfos");
821  var targetGroupCookie = readCookie("targetGroup");
822
823  if (
824    targetGroupInfos != "0,1," &&
825    (!targetGroupCookie || targetGroupInfos != targetGroupCookie)
826  ) {
827    createCookie("targetGroup", targetGroupInfos, 365);
828  }
829}
830
831function setsuggestion(suggestId, element) {
832  $("input[data-suggestid=" + suggestId + "]").val(element);
833  $(".suggestionsearch").removeClass("show");
834}
835
836function toggleDownloadPrivacyCheckbox() {
837  let currentImage = $(".lg-container .lg-item.lg-current")
838    .find("img")
839    .attr("src");
840
841  if ($("#gallerydownload-privacy").is(":checked")) {
842    $("#gallerydownload-button").html(`
843      <a href="${currentImage}" rel="noopener" target="_blank" download class="btn btn-primary" id="gallerydownload-download" style="font-size: 17px;" disabled="disabled">Herunterladen</a>
844    `);
845  } else {
846    $("#gallerydownload-button").html(`
847      <button class="btn btn-primary" id="gallerydownload-download" style="font-size: 17px;" disabled="disabled">Herunterladen</button>
848    `);
849  }
850}
851
852//adds target blank to pdf links
853document.addEventListener("DOMContentLoaded", function () {
854  const links = document.querySelectorAll('a[href$=".pdf"]');
855
856  links.forEach((link) => {
857    if (!link.target || link.target !== "_blank") {
858      link.target = "_blank";
859    }
860  });
861});
862
863$("input[type=radio][name=targetgroup]").change(function () {
864  $("#targetgroup-select").text($(this).attr("data-title"));
865});
866$("#reset-targetgroup").click(function () {
867  $("input[type=radio][name=targetgroup]").prop("checked", false);
868  $("#targetgroup-select").text(
869    $("#targetgroup-select").attr("data-default-name"),
870  );
871});
872
873$("select[data-type=searchfilter]").change(function () {
874  if (
875    $(this).closest(".mbit_search").length > 0 ||
876    $(this).closest(".mbit_topprodukte").length > 0
877  ) {
878    $(".loading-spinner-container").addClass("active");
879    window.location.href = $(this).val();
880  }
881});
882$(".reset-search-category").click(function () {
883  if ($(this).closest(".mbit_search").length > 0) {
884    window.location.href = $(this).attr("data-reseturl");
885  }
886});
887
888$(document).on("click", function () {
889  if ($(".suggestionsearch").length > 0) {
890    $(".suggestionsearch").removeClass("show");
891  }
892});
893
894$(".searchsubmit-form").click(function (e) {
895  //console.log("submit");
896  let searchWrapper = $(this).closest(".search-wrapper");
897  let form = searchWrapper.find("form");
898  form.submit();
899});
900
901function switchToSimpleLanguage(link) {
902  let simpleLanguagePopup = `
903    <div class="simple-language-popup">
904      <div class="d-flex justify-content-center align-items-center h-100">
905        <div class="popup">
906          <div class="popup-header">
907            <div class="popupicon">
908              <svg xmlns="http://www.w3.org/2000/svg" width="77" height="68" viewBox="0 0 77 68" fill="none">
909                <path d="M39.5694 9.31016V60.7883C40.5587 60.3102 41.8554 59.7391 43.3927 59.168C47.0288 57.8 52.0953 56.4055 57.7233 56.3125C61.6802 56.2461 66.6932 57.0961 70.5967 57.9062C72.2276 58.2516 73.6981 58.5836 74.8611 58.8758V10.8109C74.7542 10.7578 74.6339 10.6914 74.5002 10.625C73.5644 10.1602 72.1741 9.53594 70.3962 8.89844C66.8269 7.63672 61.7337 6.375 55.6111 6.375C51.574 6.375 47.4833 7.13203 44.3686 7.90234C42.8179 8.2875 41.5212 8.67266 40.6255 8.96484C40.171 9.11094 39.8234 9.23047 39.5962 9.31016H39.5694ZM37.4306 60.7883V9.29688L37.3771 9.27031C37.1766 9.19063 36.8691 9.07109 36.4681 8.93828C35.666 8.65938 34.4896 8.27422 33.0191 7.88906C30.0648 7.13203 25.9741 6.375 21.3889 6.375C15.2663 6.375 10.1731 7.63672 6.60382 8.91172C4.82587 9.54922 3.43559 10.1734 2.49983 10.6383C2.37951 10.7047 2.2592 10.7578 2.13889 10.8242V58.8891C3.30191 58.5969 4.7724 58.2648 6.4033 57.9195C10.3068 57.1094 15.3198 56.2594 19.2767 56.3258C24.9047 56.4188 29.9712 57.8133 33.6073 59.1813C35.1446 59.7523 36.4413 60.3367 37.4306 60.8016V60.7883ZM55.6111 4.25C68.4444 4.25 77 9.5625 77 9.5625V59.4203V61.625C77 61.625 76.1845 61.3992 74.8611 61.0672C71.1047 60.1375 63.2175 58.3578 57.75 58.4375C47.1491 58.5969 38.5 63.75 38.5 63.75C38.5 63.75 29.8509 58.5969 19.25 58.4375C13.7825 58.3578 5.89531 60.1375 2.13889 61.0672C0.815451 61.3992 0 61.625 0 61.625V59.4203V9.5625C0 9.5625 8.55556 4.25 21.3889 4.25C31.0139 4.25 38.5 7.4375 38.5 7.4375C38.5 7.4375 47.0556 4.25 55.6111 4.25Z" fill="white"/>
910                <path d="M31.054 31.2906C31.8962 30.8523 32.4844 29.9758 32.4844 28.9531C32.4844 27.5055 31.2946 26.3234 29.8375 26.3234H21.9102C22.6589 25.0617 23.2069 23.6672 23.501 22.2063L23.6214 21.582C23.9021 20.1609 22.9797 18.7797 21.5493 18.4875C20.1189 18.1953 18.7286 19.125 18.4346 20.5461L18.3142 21.1703C17.9533 22.9898 16.9507 24.6234 15.4936 25.7789L15.0925 26.0977C14.7851 26.3367 14.5043 26.6156 14.2637 26.9211C13.9429 26.443 13.4082 26.1242 12.7932 26.1242H9.2507C8.27483 26.1242 7.48611 26.9078 7.48611 27.8773V40.1359C7.48611 41.1055 8.27483 41.8891 9.2507 41.8891H12.7799C13.7557 41.8891 14.5444 41.1055 14.5444 40.1359V39.8969C14.8118 40.1758 15.1193 40.4414 15.4535 40.6539L17.579 42.0617C18.4479 42.6328 19.4639 42.9383 20.52 42.9383H25.8939C27.351 42.9383 28.5408 41.7563 28.5408 40.3086C28.5408 40.1094 28.5141 39.9234 28.474 39.7375C29.53 39.3922 30.292 38.4094 30.292 37.2406C30.292 36.7492 30.1583 36.2711 29.9177 35.8727C31.1342 35.6469 32.0566 34.5711 32.0566 33.2961C32.0432 32.4992 31.6556 31.7688 31.054 31.2906Z" fill="white"/>
911                <path d="M44.3913 19.9643C43.9234 19.9643 43.4822 19.6854 43.2951 19.2338C43.0411 18.6229 43.3352 17.9455 43.9501 17.6932C47.9605 16.0596 52.626 15.3557 57.8128 15.5947C61.5291 15.7674 65.4326 16.4049 69.4029 17.5072C70.0312 17.6799 70.4055 18.3307 70.2317 18.9682C70.0579 19.5924 69.4029 19.9643 68.7612 19.7916C63.4808 18.3307 53.3746 16.4049 44.8324 
91119.8713C44.6854 19.9377 44.5383 19.9643 44.3913 19.9643Z" fill="white"/>
912                <path d="M44.8859 29.7791C44.418 29.7791 43.9768 29.5002 43.7897 29.0486C43.5357 28.4377 43.8298 27.7603 44.4447 27.508C48.4551 25.8744 53.1206 25.1705 58.3074 25.4096C62.0237 25.5822 65.9272 26.2197 69.8975 27.3221C70.5258 27.4947 70.9001 28.1455 70.7263 28.783C70.5525 29.4072 69.8975 29.7791 69.2558 29.6064C63.9888 28.1588 53.8959 26.233 45.3538 29.6994C45.1933 29.7525 45.0463 29.7791 44.8859 29.7791Z" fill="white"/>
913                <path d="M45.327 38.2658C44.8591 38.2658 44.418 37.9869 44.2308 37.5354C43.9768 36.9244 44.2709 36.2471 44.8859 35.9947C48.8963 34.3612 53.5617 33.6573 58.7486 33.8963C62.4649 34.069 66.3683 34.7065 70.3387 35.8088C70.967 35.9815 71.3413 36.6322 71.1675 37.2697C70.9937 37.894 70.3387 38.2658 69.697 38.0932C64.43 36.6455 54.3371 34.7197 45.7949 38.1862C45.6345 38.2393 45.4741 38.2658 45.327 38.2658Z" fill="white"/>
914                <path d="M45.7815 47.151C45.3137 47.151 44.8725 46.8721 44.6854 46.4205C44.4314 45.8096 44.7255 45.1322 45.3404 44.8799C49.3374 43.2463 54.0029 42.5424 59.1897 42.7814C62.906 42.9541 66.8095 43.5916 70.7798 44.6939C71.4081 44.8666 71.7824 45.5174 71.6086 46.1549C71.4348 46.7924 70.7798 47.151 70.1381 46.9783C64.8711 45.5174 54.7782 43.6049 46.236 47.0713C46.089 47.1244 45.9286 47.151 45.7815 47.151Z" fill="white"/>
915              </svg>
916            </div>
917            <div class="popuptitle">
918              Einfache Sprache
919            </div>
920            <div class="popupclose" onClick="closeSimpleLangModal();">
921              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Pro 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path fill="#FFFFFF" d="M345 137l17-17L328 86.1l-17 17-119 119L73 103l-17-17L22.1 120l17 17 119 119L39 375l-17 17L56 425.9l17-17 119-119L311 409l17 17L361.9 392l-17-17-119-119L345 137z"/></svg>
922            </div>
923          </div>
924          <div class="popup-content">
925            <div class="popuptitle">
926              Hinweis: Einfache Sprache
927            </div>
928            <div class="popuptext">
929              Hier finden Sie Artikel über die Arbeit von klimaaktiv in einfacher Sprache. Sie sind leicht zu lesen. Fremdwörter werden vermieden.
930            </div>
931            <div class="popupbutton">
932              <a href="${link}">Verstanden!</a>
933            </div>
934          </div>
935        </div>
936      </div>
937    </div>
938  `;
939
940  $("body").append(simpleLanguagePopup);
941  $("html").addClass("simple-language-popup-open");
942}
943
944function closeSimpleLangModal() {
945  $(".simple-language-popup").remove();
946  $("html").removeClass("simple-language-popup-open");
947}
948
949$(".filter-collapse").click(function () {
950  if ($(this).hasClass("active")) {
951    $(this).removeClass("active");
952    $(this).find(".collapse-text").text($(this).attr("data-unactivetext"));
953    $(this).find(".collapse-svg").css("transform", "");
954    $(".extended-filter-field").addClass("d-none");
955  } else {
956    $(this).addClass("active");
957    $(this).find(".collapse-text").text($(this).attr("data-activetext"));
958    $(this).find(".collapse-svg").css("transform", "rotate(180deg)");
959    $(".extended-filter-field").removeClass("d-none");
960  }
961});
962
963$(".topprodukte-select-filter").change(function () {
964  let field = $(this).attr("data-selectfields");
965
966  $("#" + field + "-selectfields").empty();
967  if (this.value !== "all") {
968    $("#" + field + "-selectfields").append(
969      `<input type="hidden" name="filter[${field}]" value="${this.value}" />`,
970    );
971  }
972});
973
974$(
975  ".gp-detail .container, .app-detail .container, .tool-detail, .podcasts-detail .container, .press-detail .container",
976).each(function () {
977  $(this).removeClass("container");
978});
979
980$("#backtoproductoverview").click(function () {
981  window.history.back();
982});
983
984// Klimakalender Load More
985$(document).on("click", ".klimakalender-load-more-button", function (e) {
986  e.preventDefault();
987  e.stopPropagation();
988
989  const $button = $(this);
990  const itemsToShow = 3;
991
992  // Find all hidden items
993  const $hiddenItems = $(".klimakalender-item.klimakalender-item-hidden");
994
995  if ($hiddenItems.length === 0) {
996    $button.closest(".klimakalender-load-more-section").hide();
997    return;
998  }
999
1000  // Show next 3 items
1001  $hiddenItems.slice(0, itemsToShow).removeClass("klimakalender-item-hidden");
1002
1003  // Hide button if no more hidden items
1004  const $remainingHidden = $(".klimakalender-item.klimakalender-item-hidden");
1005  if ($remainingHidden.length === 0) {
1006    $button.closest(".klimakalender-load-more-section").hide();
1007  }
1008});
1009
1010function number_format(number, decimals, dec_point, thousands_sep) {
1011  var n = !isFinite(+number) ? 0 : +number,
1012    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
1013    sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
1014    dec = typeof dec_point === "undefined" ? "." : dec_point,
1015    toFixedFix = function (n, prec) {
1016      // Fix for IE parseFloat(0.55).toFixed(0) = 0;
1017      var k = Math.pow(10, prec);
1018      return Math.round(n * k) / k;
1019    },
1020    s = (prec ? toFixedFix(n, prec) : Math.round(n)).toString().split(".");
1021  if (s[0].length > 3) {
1022    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
1023  }
1024  if ((s[1] || "").length < prec) {
1025    s[1] = s[1] || "";
1026    s[1] += new Array(prec - s[1].length + 1).join("0");
1027  }
1028  return s.join(dec);
1029}
1030
1031function createCookie(name, value, days) {
1032  var expires;
1033
1034  if (days) {
1035    var date = new Date();
1036    date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
1037    expires = "; expires=" + date.toGMTString();
1038  } else {
1039    expires = "";
1040  }
1041  document.cookie =
1042    encodeURIComponent(name) +
1043    "=" +
1044    encodeURIComponent(value) +
1045    expires +
1046    "; path=/";
1047}
1048
1049function readCookie(name) {
1050  var nameEQ = encodeURIComponent(name) + "=";
1051  var ca = document.cookie.split(";");
1052  for (var i = 0; i < ca.length; i++) {
1053    var c = ca[i];
1054    while (c.charAt(0) === " ") c = c.substring(1, c.length);
1055    if (c.indexOf(nameEQ) === 0)
1056      return decodeURIComponent(c.substring(nameEQ.length, c.length));
1057  }
1058  return null;
1059}
1060
1061function eraseCookie(name) {
1062  createCookie(name, "", -1);
1063}

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.