PageSourceSearch

https://globalis.se/dist/js/app.min.js?v=1790724538

js globalis.se collected 2026-10-02 11:52:57 UTC 51,529 bytes, 1,434 lines download raw bytes

1"use strict";
2
3document.addEventListener("DOMContentLoaded", function () {
4  var accordionBlocks = document.querySelectorAll('.accordion-block');
5  accordionBlocks.forEach(function (accordionBlock) {
6    var numbers = accordionBlock.querySelectorAll('.accordion-block__number');
7    if (numbers.length) {
8      numbers.forEach(function (number, index) {
9        // Add the accordion number
10        number.innerHTML = index + 1;
11      });
12    }
13  });
14});
15"use strict";
16
17document.addEventListener("DOMContentLoaded", function () {
18  // Add click event listener to all buttons with class "article-info__copy"
19  var copyButtons = document.querySelectorAll('.article-info__copy');
20  copyButtons.forEach(function (button) {
21    button.addEventListener('click', function (event) {
22      // Copy the URL to clipboard
23      var urlToCopy = window.location.href;
24      navigator.clipboard.writeText(urlToCopy).then(function () {
25        // URL copied successfully
26        // Add the "active" class to the feedback element
27        var feedback = button.querySelector('.article-info__copy-feedback');
28        feedback.classList.add('active');
29
30        // Remove the "active" class after 2 seconds
31        setTimeout(function () {
32          feedback.classList.remove('active');
33        }, 1800);
34      });
35    });
36  });
37});
38"use strict";
39
40window.onload = function () {
41  var compareCountries = document.querySelectorAll('.compare__countries');
42  function setEqualHeight(figures) {
43    var maxHeight = 0;
44    figures.forEach(function (figure) {
45      figure.style.height = 'auto'; // Reset the height to auto to recalculate
46      var figureHeight = figure.clientHeight;
47      maxHeight = Math.max(maxHeight, figureHeight); // compare the heights and get the highest
48    });
49
50    // Set the height
51    figures.forEach(function (figure) {
52      figure.style.height = "".concat(maxHeight, "px");
53    });
54  }
55  compareCountries.forEach(function (element) {
56    var figures = element.querySelectorAll('.compare__figure');
57    setEqualHeight(figures);
58  });
59
60  // Add a resize event listener to recalculate heights when the screen resizes
61  window.addEventListener("resize", function () {
62    compareCountries.forEach(function (element) {
63      var figures = element.querySelectorAll('.compare__figure');
64      setEqualHeight(figures);
65    });
66  });
67};
68"use strict";
69
70function mapDropdownChange(countryIso, rgba, mapNumber) {
71  var baseMapPath = 'https://code.highcharts.com/mapdata/';
72  var mapKey = 'countries/' + countryIso + '/' + countryIso + '-all';
73  var javascriptPath = baseMapPath + mapKey + '.js';
74  function mapReady() {
75    var mapGeoJSON = Highcharts.maps[mapKey];
76    var data = [];
77    $.each(mapGeoJSON.features, function (index, feature) {
78      data.push({
79        key: feature.properties['hc-key'],
80        value: index
81      });
82    });
83    $('#country_map_' + mapNumber).highcharts('Map', {
84      chart: {
85        backgroundColor: 'transparent'
86      },
87      title: {
88        text: null
89      },
90      mapNavigation: {
91        enabled: false
92      },
93      credits: {
94        enabled: false
95      },
96      colorAxis: {
97        minColor: rgba,
98        maxColor: rgba,
99        labels: {
100          enabled: false
101        }
102      },
103      legend: {
104        enabled: false
105      },
106      tooltip: {
107        enabled: false
108      },
109      series: [{
110        data: data,
111        mapData: mapGeoJSON,
112        joinBy: ['hc-key', 'key'],
113        borderColor: rgba,
114        borderWidth: 0,
115        borderShadow: 0,
116        name: '',
117        states: {
118          hover: {
119            enabled: false,
120            halo: false
121          }
122        },
123        dataLabels: {
124          enabled: false
125        }
126      }]
127    });
128  }
129  if (mapKey != 'custom/world') {
130    if (Highcharts.maps[mapKey]) {
131      mapReady();
132    } else {
133      $.getScript(javascriptPath, mapReady);
134    }
135  } else {
136    switch (mapNumber) {
137      case 1:
138        $('.country-colors li.red').hide();
139        $('#countrymap_notfound_1').show();
140        break;
141      case 2:
142        $('.country-colors li.blue').hide();
143        $('#countrymap_notfound_2').show();
144        break;
145    }
146  }
147}
148"use strict";
149
150document.querySelectorAll('.rich-text').forEach(function (richText) {
151  var next = richText.nextElementSibling;
152  if (next && next.classList.contains('cta-section__card--btn-only')) {
153    richText.classList.add('rich-text--adjacent-cta');
154  }
155});
156"use strict";
157
158document.addEventListener("DOMContentLoaded", function () {
159  // Function to handle the radio input change event
160  function handleRadioChange() {
161    var statisticsByLetter = document.querySelector(".countries-statistics--letter");
162    var statisticsByGoal = document.querySelector(".countries-statistics--goals");
163    if (statisticsByLetter != null && statisticsByGoal != null) {
164      if (document.getElementById("sortLetter").checked) {
165        // Show .countries-statistics--letter and hide .countries-statistics--goals
166        statisticsByLetter.classList.remove("d-none");
167        statisticsByGoal.classList.add("d-none");
168      } else if (document.getElementById("sortGoals").checked) {
169        // Show .countries-statistics--goals and hide .countries-statistics--letter
170        statisticsByGoal.classList.remove("d-none");
171        statisticsByLetter.classList.add("d-none");
172      }
173    }
174  }
175
176  // Add change event listeners to the radio inputs
177  var sortLetterInput = document.getElementById("sortLetter");
178  if (sortLetterInput != null) {
179    sortLetterInput.addEventListener("change", handleRadioChange);
180  }
181  var sortGoalsInput = document.getElementById("sortGoals");
182  if (sortGoalsInput != null) {
183    sortGoalsInput.addEventListener("change", handleRadioChange);
184  }
185
186  // Initialize the visibility based on the initially checked radio input
187  handleRadioChange();
188});
189"use strict";
190
191function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
192function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
193function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string");
193 return _typeof(key) === "symbol" ? key : String(key); }
194function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
195document.addEventListener("DOMContentLoaded", function () {
196  ctaSectionCarousel();
197
198  // Add event listener to the window object
199  window.addEventListener("resize", debounce(ctaSectionCarousel, 300));
200  function ctaSectionCarousel() {
201    var ctaSections = document.querySelectorAll('.cta-section.glide');
202    var mobileWidth = 959;
203    if (ctaSections != null && ctaSections.length > 0) {
204      ctaSections.forEach(function (ctaSection, i) {
205        var slides = ctaSection.querySelectorAll('.cta-section__card');
206        if (ctaSection.classList.contains('cta-section--image')) {
207          // With image
208          var glide = new Glide(ctaSection, {
209            type: 'carousel',
210            gap: 24,
211            perView: 1
212          });
213          if (slides.length > 1) {
214            glide.mount();
215          }
216        } else {
217          // Without image
218          var glide = new Glide(ctaSection, {
219            type: 'carousel',
220            gap: 24,
221            perView: 2,
222            breakpoints: _defineProperty({}, mobileWidth, {
223              perView: 1
224            })
225          });
226          // Desktop
227          if (screen.width > mobileWidth) {
228            // Desktop
229            // Initialize glidejs if there are more than 2 slides
230            if (slides.length > 2) {
231              glide.mount();
232            }
233          } else {
234            // Mobile
235            // Initialize glidejs if there are more than 1 slide
236            if (slides.length > 1) {
237              glide.mount();
238            }
239          }
240        }
241      });
242    }
243  }
244});
245"use strict";
246"use strict";
247
248document.addEventListener("DOMContentLoaded", function () {
249  var filterAlphabet = document.querySelectorAll('.filter-select--alphabet');
250  filterAlphabet.forEach(function (filter) {
251    var letters = filter.querySelectorAll('.filter-select__list li input');
252    letters.forEach(function (letter) {
253      letter.addEventListener('change', function (event) {
254        // Uncheck all checkboxes except the one that was clicked
255        letters.forEach(function (el) {
256          if (el !== event.target) {
257            el.checked = false;
258          }
259        });
260      });
261    });
262  });
263});
264"use strict";
265
266document.addEventListener("DOMContentLoaded", function () {
267  var filterDropdown = document.querySelectorAll('.filter-dropdown__dropdown');
268  filterDropdown.forEach(function (dropdown) {
269    var toggleButton = dropdown.querySelector('.filter-dropdown__button');
270    var buttonText = toggleButton.innerText;
271    var clearButton = dropdown.querySelector('.filter-dropdown__clear');
272    var checkboxes = dropdown.querySelectorAll('.custom-checkbox');
273    var checkedItems = 0;
274
275    // check if there is any checked checkbox and change button style
276    for (var i = 0; i < checkboxes.length; i++) {
277      if (checkboxes[i].checked) {
278        checkedItems += 1;
279      }
280      if (checkedItems > 0) {
281        toggleButton.classList.add('filter-dropdown__button--active');
282        toggleButton.innerText = "".concat(buttonText, " (").concat(checkedItems, ")");
283      }
284    }
285    checkboxes.forEach(function (thisCheckbox) {
286      // watch checkbox "change" event
287      thisCheckbox.addEventListener('change', function (event) {
288        if (event.currentTarget.checked) {
289          // is checked
290          checkedItems += 1;
291        } else {
292          // is not checked
293          checkedItems -= 1;
294        }
295
296        // if there is any checked checkbox, style the button and change the button text
297        for (var _i = 0; _i < checkboxes.length; _i++) {
298          if (checkboxes[_i].checked) {
299            toggleButton.classList.add('filter-dropdown__button--active');
300            toggleButton.innerText = "".concat(buttonText, " (").concat(checkedItems, ")");
301            return;
302          } else {
303            toggleButton.classList.remove('filter-dropdown__button--active');
304            toggleButton.innerText = "".concat(buttonText);
305          }
306        }
307      });
308    });
309
310    // Uncheck all checkboxes on click
311    clearButton.onclick = function () {
312      checkboxes.forEach(function (checkbox) {
313        checkbox.checked = false;
314      });
315
316      // Reset 'checkedItems' count and remove the "active" button style
317      checkedItems = 0;
318      toggleButton.innerText = "".concat(buttonText);
319      toggleButton.classList.remove('filter-dropdown__button--active');
320    };
321  });
322});
323"use strict";
324
325document.addEventListener("DOMContentLoaded", function () {
326  var supportOurWorkPage = document.querySelector('.form-support-our-work');
327  if (supportOurWorkPage) {
328    var amount = supportOurWorkPage.querySelector('.form-support-our-work__amount');
329    var radios = amount.querySelectorAll('.input-group input');
330    var anyAmount = supportOurWorkPage.querySelector('.form-support-our-work__any-amount input');
331
332    // when a predefined amount is selected, clear the custom amount input
333    radios.forEach(function (radio) {
334      radio.addEventListener('change', function (event) {
335        if (event.target.checked) {
336          anyAmount.value = '';
337        }
338      });
339    });
340
341    // when user types in custom amount, deselect all predefined amounts
342    anyAmount.addEventListener('input', function () {
343      if (anyAmount.value) {
344        radios.forEach(function (radio) {
345          radio.checked = false;
346        });
347      }
348    });
349
350    // customize vipps button as soon as shadow button is ready
351    var vippsButton = supportOurWorkPage.querySelector('vipps-mobilepay-button');
352    if (vippsButton) {
353      var applyVippsStyles = function applyVippsStyles() {
354        var shadowRoot = vippsButton.shadowRoot;
355        var btn = shadowRoot && shadowRoot.querySelector('button');
356        if (!btn) return false;
357        btn.style.width = '100%';
358        btn.style.padding = '24px';
359        btn.style.borderRadius = '12px';
360        btn.style.height = '100%';
361        return true;
362      };
363      if (!applyVippsStyles()) {
364        var attempts = 0;
365        var maxAttempts = 180;
366        var retryApplyVippsStyles = function retryApplyVippsStyles() {
367          if (applyVippsStyles()) return;
368          attempts += 1;
369          if (attempts >= maxAttempts) return;
370          requestAnimationFrame(retryApplyVippsStyles);
371        };
372        requestAnimationFrame(retryApplyVippsStyles);
373      }
374    }
375  }
376});
377"use strict";
378
379// Use this JS to run global functions only
380function debounce(func, delay) {
381  var timeoutId;
382  return function () {
383    var _this = this;
384    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
385      args[_key] = arguments[_key];
386    }
387    clearTimeout(timeoutId);
388    timeoutId = setTimeout(function () {
389      func.apply(_this, args);
390    }, delay);
391  };
392}
393"use strict";
394
395document.addEventListener("DOMContentLoaded", function () {
396  var goalSelectors = document.querySelectorAll('.goal-selector');
397  goalSelectors.forEach(function (goalSelector) {
398    var goalItems = goalSelector.querySelectorAll('.goal-selector__item button');
399    if (goalItems.length) {
400      goalItems.forEach(function (item) {
401        item.onclick = function () {
402          // Unselect all items
403          unselectAllItems(goalItems);
404
405          // Mark the "goal-selector__cards" div as active
406          goalSelector.querySelector('.goal-selector__cards').classList.add('goal-selector__cards--active');
407
408          // Check if is the "See all" button
409          if (item.closest('.goal-selector__item').classList.contains('goal-selector__item--all')) {
410            // Show all items
411            var cards = item.closest('.goal-selector').querySelectorAll('.goal-selector__card');
412            cards.forEach(function (card, index) {
413              card.classList.add('goal-selector__card--active');
414              // Scroll to the first card
415              if (index == 0) {
416                cards[0].scrollIntoView({
417                  behavior: 'smooth'
418                });
419              }
420            });
421            item.setAttribute('aria-expanded', true);
422          } else {
423            // select the clicked item
424            selectItem(item);
425          }
426        };
427      });
428    }
429  });
430
431  // Unselect all items
432  function unselectAllItems(goalItems) {
433    goalItems.forEach(function (item) {
434      item.setAttribute('aria-expanded', 'false');
435      var cards = item.closest('.goal-selector').querySelectorAll('.goal-selector__card');
436      cards.forEach(function (targetCard) {
437        targetCard.classList.remove('goal-selector__card--active');
438        targetCard.setAttribute('tabindex', '-1');
439      });
440    });
441  }
442
443  // Select item
444  function selectItem(item) {
445    item.setAttribute('aria-expanded', 'true');
446    var targetCard = document.getElementById(item.getAttribute('aria-controls'));
447    targetCard.classList.add('goal-selector__card--active');
448    targetCard.scrollIntoView({
449      behavior: 'smooth'
450    });
451    targetCard.setAttribute('tabindex', '0');
452    targetCard.focus();
453  }
454});
455"use strict";
456
457window.addEventListener('load', function () {
458  var mainHeader = document.querySelector('.main-header');
459  var headerHeight = mainHeader.clientHeight;
460
461  // Fixed header functionality
462  window.onscroll = function (e) {
463    if (!mainHeader.classList.contains('main-header--multiple')) {
464      if (this.oldScroll < this.scrollY) {
465        // Downscroll code
466        if (window.scrollY > headerHeight) {
467          // Fix the header
468          mainHeader.classList.add('main-header--fixed');
469          mainHeader.style.top = "-".concat(headerHeight, "px");
470          document.body.style.paddingTop = "".concat(headerHeight, "px");
471        }
472      } else {
473        // Upscroll code
474        if (mainHeader.classList.contains('main-header--fixed') && window.scrollY > headerHeight) {
475          mainHeader.style.top = "0px";
476        }
477        if (mainHeader.classList.contains('main-header--fixed') && window.scrollY <= headerHeight) {
478          // Make header relative again
479          mainHeader.classList.remove('main-header--fixed');
480          mainHeader.style.top = "";
481          document.body.style.paddingTop = "";
482        }
483      }
484      this.oldScroll = this.scrollY;
485    }
486  };
487
488  // Header Search
489  // The search drawer do not use Bootstrap functions to open, because its auto-focus functionality conflicts with an iOS setting
490
491  // Show header search drawer on click
492  var headerSearchButtons = document.querySelectorAll("[aria-controls=\"searchDrawer\"]");
493  headerSearchButtons.forEach(function (btn) {
494    btn.onclick = function () {
495      showSearchDrawer();
496    };
497  });
498
499  // Close search drawer by clicking the close button or backdrop
500  var closeearchDrawerBtn = document.querySelectorAll(".close-search-drawer");
501  closeearchDrawerBtn.forEach(function (btn) {
502    btn.onclick = function () {
503      closeSearchDrawer();
504    };
505  });
506
507  // Close search drawer by pressing esc
508  document.addEventListener('keydown', function (event) {
509    if (event.key === 'Escape') {
510      //if esc key was not pressed in combination with ctrl or alt or shift
511      var isNotCombinedKey = !(event.ctrlKey || event.altKey || event.shiftKey);
512      if (isNotCombinedKey) {
513        closeSearchDrawer();
514      }
515    }
516  });
517
518  // Function to show the search drawer
519  function showSearchDrawer() {
520    // hide menu
521    var menu = document.getElementById('mobileMenu');
522    if (menu.classList.contains('show')) {
523      menu.classList.remove('show');
524      menu.nextSibling.remove();
525    }
526
527    // show search drawer
528    var searchDrawer = document.getElementById('searchDrawer');
529    searchDrawer.classList.add('show');
530
531    // Focus on input
532    var searchDrawerInput = document.querySelector('#searchDrawerInput');
533    searchDrawerInput.focus();
534  }
535
536  // Function do close the search drawer
537  function closeSearchDrawer() {
538    // Close menu
539    var menuOffCanvas = new bootstrap.Offcanvas('#mobileMenu');
540    menuOffCanvas.hide();
541
542    // Close search drawer
543    var searchDrawer = document.getElementById('searchDrawer');
544    searchDrawer.classList.remove('show');
545
546    // Remove body inline styles
547    document.body.style.overflow = '';
548    document.body.style.paddingRight = '';
549  }
550  initActiveMenuStates();
551});
552
553// This script retrieves the 'q' query parameter from the URL and populates 
554// the search input field with its value. It replaces the backend implementation 
555// in the Twig template to prevent potential issues with cached pages.
556document.addEventListener('DOMContentLoaded', function () {
557  var searchInput = document.getElementById('searchDrawerInput');
558  if (searchInput) {
559    var urlParams = new URLSearchParams(window.location.search);
560    var searchValue = urlParams.get('q') || '';
561    searchInput.value = searchValue;
562  }
563});
564
565/**
566 * Sets active classes on menu items based on the current URL
567 */
568function initActiveMenuStates() {
569  var currentUrl = window.location.href;
570
571  // Function to check if a URL matches the current page
572  function isCurrentUrl(menuUrl) {
573    // Simple exact match comparison
574    return currentUrl === menuUrl;
575  }
576
577  // Process desktop menu items
578  document.querySelectorAll('.main-header__menu-button[data-url]').forEach(function (menuItem) {
579    var menuUrl = menuItem.getAttribute('data-url');
580    if (isCurrentUrl(menuUrl)) {
581      menuItem.classList.add('main-header__menu-button--active');
582    }
583  });
584
585  // Process mobile menu items
586  document.querySelectorAll('.menu-accordion__button[data-url]').forEach(function (menuItem) {
587    var menuUrl = menuItem.getAttribute('data-url');
588    if (isCurrentUrl(menuUrl)) {
589      menuItem.classList.add('active');
590    }
591  });
592
593  // Process dropdown items and set active states
594  var activeMenuIds = new Set();
595  document.querySelectorAll('.dropdown-item[data-url], .accordion-body a[data-url]').forEach(function (subMenuItem) {
596    var menuUrl = subMenuItem.getAttribute('data-url');
597    var itemId = subMenuItem.getAttribute('data-item-id');
598    var parentMenuId = subMenuItem.getAttribute('data-parent-menu-id');
599    if (isCurrentUrl(menuUrl)) {
600      // Mark this dropdown item as active
601      subMenuItem.classList.add('dropdown-item--active');
602
603      // If we have a parent menu ID, collect it for parent menu activation
604      if (parentMenuId) {
605        activeMenuIds.add(parentMenuId);
606
607        // Find parent accordion item and expand it (mobile view)
608        var parentCollapse = subMenuItem.closest('.accordion-collapse');
609        if (parentCollapse) {
610          parentCollapse.classList.add('show');
611
612          // Find and update the associated button
613          var accordionButton = document.querySelector("[data-bs-target=\"#".concat(parentCollapse.id, "\"]"));
614          if (accordionButton) {
615            accordionButton.classList.add('active');
616            accordionButton.setAttribute('aria-expanded', 'true');
617          }
618        }
619      }
620    }
621  });
622
623  // Set active state on parent dropdown buttons if they contain active items
624  if (activeMenuIds.size > 0) {
625    activeMenuIds.forEach(function (id) {
626      // For desktop dropdown menus
627      var dropdownButton = document.querySelector(".main-header__menu-button[data-menu-id=\"".concat(id, "\"]"));
628      if (dropdownButton) {
629        dropdownButton.classList.add('main-header__menu-button--active');
630      }
631
632      // For mobile accordion menus
633      var accordionButton = document.querySelector(".menu-accordion__button[data-menu-id=\"".concat(id, "\"]"));
634      if (accordionButton) {
635        accordionButton.classList.add('active');
636      }
637    });
638  }
639}
640"use strict";
641
642function handleIndexComponent() {
643  var indexComponents = document.querySelectorAll('.index-component');
644
645  // Anchor ids end up in URLs people share, so they must be URL safe and must not
646  // move when content is added above them. Norwegian letters are folded the same way
647  // Craft slugifies them server-side: æ -> ae, ø -> o, å -> a.
648  function slugifyHeading(text) {
649    return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/æ/gi, 'ae').replace(/ø/gi, 'o').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
650  }
651  indexComponents.forEach(function (indexComponent, index) {
652    if (indexComponent != null && indexComponents.length > 0) {
653      // Change "index-component" to position "fixed" on mobile
654      var checkIndexPosition = function checkIndexPosition() {
655        var bounding = indexComponent.getBoundingClientRect();
656
657        // Check if the component touched the page top
658        if (bounding.top <= 0) {
659          indexComponent.classList.add('index-component--fixed');
660          document.documentElement.classList.add('spt-200');
661        } else {
662          indexComponent.classList.remove('index-component--fixed');
663          document.documentElement.classList.remove('spt-200');
664        }
665      };
666      var updateLinkArrow = function updateLinkArrow() {
667        articleHeadings.forEach(function (heading) {
668          var headingID = heading.getAttribute('id');
669          var indexLink = indexLinkList.querySelector("[href='#".concat(headingID, "']"));
670          if (indexLink != null) {
671            // Check if the heading is bellow the link
672            if (compareScrollPosition(heading, indexLinkList, 140)) {
673              indexLink.classList.add('index-component__link--down');
674            } else {
675              indexLink.classList.remove('index-component__link--down');
676            }
677          }
678        });
679        var indexLinks = indexLinkList.querySelectorAll('.index-component__link');
680        var downLinks = indexLinkList.querySelectorAll('.index-component__link--down');
681        var currentLinkIndex = indexLinks.length - downLinks.length;
682
683        // Style the active index link
684        indexLinks.forEach(function (link, index) {
685          if (currentLinkIndex == index) {
686            link.classList.add('index-component__link--current');
687          } else {
688            link.classList.remove('index-component__link--current');
689          }
690        });
691      };
692      var compareScrollPosition = function compareScrollPosition(elementA, elementB, offset) {
693        var rectA = elementA.getBoundingClientRect();
694        var rectB = elementB.getBoundingClientRect();
695        return rectA.y + offset > rectB.y;
696      };
697      indexComponent.setAttribute('data-index', index);
698
699      // main-header reference
700      var mainHeader = document.querySelector('.main-header');
701
702      // Watch for any change in the main-header "style" attribute
703      var headerObserver = new MutationObserver(function (mutations) {
704        mutations.forEach(function (mutation) {
705          if (mutation.type === "attributes") {
706            // Check if the main-header is fixed
707            if (mainHeader.getAttribute('style').includes('top: 0')) {
708              // Is fixed
709              indexComponent.classList.add('index-component--offset');
710            } else {
711              // Not fixed
712              indexComponent.classList.remove('index-component--offset');
713            }
714          }
715        });
716      });
717      headerObserver.observe(mainHeader, {
718        attributeFilter: ["style"]
719      });
720      window.addEventListener('scroll', checkIndexPosition);
721
722      // index-component Accordion reference (mobile)
723      var indexAccordion = new bootstrap.Collapse('#indexCollapse', {
724        toggle: false
725      });
726
727      // Get all h2 from all article-text blocks
728      var articleTextElements = document.querySelectorAll('.article-text');
729      var articleHeadings = [];
730      articleTextElements.forEach(function (articleText) {
731        // Check if article-text is visible
732        if (!articleText.classList.contains('d-none')) {
733          var headings = articleText.querySelectorAll('h2');
734          headings.forEach(function (heading) {
735            articleHeadings.push(heading);
736          });
737        }
738      });
739
740      // Get the all heading references and create the links
741      var indexLinkList = indexComponent.querySelector('.index-component__link-list');
742
743      // Clear indexList
744      indexLinkList.innerHTML = '';
745
746      // Two headings can share the same text, so keep a count to keep ids unique
747      var usedHeadingIDs = {};
748      articleHeadings.forEach(function (heading, index) {
749        // Create heading id. textContent, not innerHTML, or nested tags leak into the id
750        var headingID = slugifyHeading(heading.textContent) || "section-".concat(index + 1);
751        if (usedHeadingIDs[headingID]) {
752          usedHeadingIDs[headingID] += 1;
753          headingID = "".concat(headingID, "-").concat(usedHeadingIDs[headingID]);
754        } else {
755          usedHeadingIDs[headingID] = 1;
756        }
757        heading.setAttribute('id', headingID);
758
759        // Create link and add href
760        var li = document.createElement('li');
761        li.innerHTML = "<a class=\"index-component__link\" href='#".concat(headingID, "'>").concat(heading.innerHTML, "</a>");
762        indexLinkList.appendChild(li);
763
764        // Close the accordion when clicking in a link (mobile)
765        li.querySelector('a').onclick = function () {
766          indexAccordion.hide();
767        };
768      });
769
770      // Change index-component link style based on heading position
771      updateLinkArrow();
772
773      // Update on scroll
774      window.addEventListener('scroll', function () {
775        updateLinkArrow();
776      });
777    }
778  });
779}
780document.addEventListener("DOMContentLoaded", function () {
781  handleIndexComponent();
782});
783"use strict";
784
785document.addEventListener("DOMContentLoaded", function () {
786  var infoCards = document.querySelectorAll('.info-card--toggle');
787  if (infoCards != null && infoCards.length > 0) {
788    infoCards.forEach(function (infoCard) {
789      var toggleButton = infoCard.querySelector('.info-card__toggle-button .btn');
790
791      // Toggle functionality
792      toggleButton.onclick = function () {
793        if (infoCard.classList.contains('isExpanded')) {
794          // Shrink
795          infoCard.classList.remove('isExpanded');
796          toggleButton.setAttribute('aria-expanded', false);
797          infoCard.scrollIntoView();
798        } else {
799          // Expand
800          infoCard.classList.add('isExpanded');
801          toggleButton.setAttribute('aria-expanded', true);
802        }
803      };
804    });
805  }
806});
807"use strict";
808
809var Globalis = window.Globalis || {};
810Globalis.Map = function () {
811  var map, config;
812  var storageFolderPath = '/var/storage/';
813  function fn(domId, mapConfig) {
814    config = mapConfig || {};
815    L.Icon.Default.imagePath = 'http://cdn.leafletjs.com/leaflet-0.6.4/images'; // TODO
816
817    var crs = L.CRS.EPSG3857;
818    if (config.type === 'choropleth' || config.type === 'categorical') {
819      //crs.scale = function(zoom) { return 190 * Math.pow(2, zoom); };
820
821      // World Mollweide: http://spatialreference.org/ref/esri/54009/
822      crs = new L.Proj.CRS('ESRI:54009', '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs', {
823        resolutions: [100000, 50000, 25000, 12500, 6250, 3125, 1562.5, 781.25]
824      });
825    }
826    var options = {
827      crs: crs,
828      minZoom: 1,
829      maxZoom: 6
830    };
831    if (config["static"]) {
832      L.extend(options, {
833        zoomControl: false,
834        dragging: false,
835        touchZoom: false,
836        scrollWheelZoom: false,
837        doubleClickZoom: false,
838        boxZoom: false,
839        keyboard: false
840      });
841    }
842    map = L.map(domId, options);
843    map.attributionControl.setPrefix();
844    switch (config.type) {
845      case 'choropleth':
846      case 'categorical':
847        L.graticule({
848          sphere: true,
849          style: {
850            color: '#777',
851            weight: 1,
852            opacity: 1,
853            fillColor: config.fillColor || '#E0EEF8',
854            fillOpacity: 1
855          }
856        }).addTo(map);
857        L.graticule({
858          style: {
859            color: '#000',
860            opacity: 0.1,
861            weight: 1
862          }
863        }).addTo(map);
864        break;
865      case 'choroplethAlternative':
866        var southWest = L.latLng(-90, -180);
867        var northEast = L.latLng(90, 180);
868        // L.setMaxBounds(L.latLngBounds(southWest, northEast)).addTo(map)
869        map.setMaxBounds(L.latLngBounds(southWest, northEast));
870        break;
871      default:
872        map.on({
873          layeradd: layerAdd,
874          layerremove: layerRemove
875        });
876        break;
877    }
878    if (config.layers) {
879      for (var i = 0; i < config.layers.length; ++i) {
880        Globalis.Map.createTileLayer(config.layers[i], map).addTo(map);
881      }
882    }
883    if (config.bounds) {
884      var bounds = config.bounds;
885      map.fitBounds([[bounds[1], bounds[0]], [bounds[3], bounds[2]]]); // left, bottom, right, top
886    } else {
887      if (config.type === 'choropleth' || config.type === 'categorical') {
888        map.setView([0, 0], 0);
889      } else if (config.type === 'embed' && config.zoomfix === 'oneup') {
890        map.setView([0, 0], 2);
891      } else if (config.marker) {
892        map.setView(config.marker, config.zoom || 3);
893      } else {
894        map.fitBounds([[-40, -120], [60, 140]]);
895      }
896    }
897    switch (config.type) {
898      case 'choroplethAlternative':
899        choroplethMap();
900        break;
901      case 'choropleth':
902        choroplethMap();
903        break;
904      case 'categorical':
905        categoricalMap();
906        break;
907      case 'cluster':
908        clusterMap();
909        break;
910      case 'selected':
911        selectedMap();
912        break;
913      case 'embed':
914        embeddedMap();
915        break;
916    }
917    if (config.country) {
918      addCountryBorder();
919    }
920    if (config.marker) {
921      L.marker(config.marker).addTo(map);
922    }
923    if (config.click) {
924      map.on({
925        click: function click(evt) {
926          window.location.href = config.click;
927        }
928      });
929    }
930    map.scrollWheelZoom.disable();
931  }
932
933  // TODO: Avoid listening to each GeoJSON feature
934  function layerAdd(evt) {
935    if (evt.layer.options && evt.layer.options.legend && evt.layer.options.legend.length !== 0) {
936      addLegend(evt.layer);
937    }
938  }
939  function layerRemove(evt) {
940    if (evt.layer.legendControl) {
941      evt.layer.legendControl.removeFrom(map);
942    }
943  }
944  function addCountryBorder() {
945    var resolutions = ['110m', '110m', '50m', '50m', '50m', '10m', '10m', '10m'],
946      borders = {};
947    function fetchCountryBorder(zoom, callback) {
948      var resolution = resolutions[zoom];
949      if (!borders[resolution]) {
950        // $.ez( 'map::fetchCountryBorder', {object_id: config.country, resolution: resolution}, function( data ) {
951        //     borders[resolution] = JSON.parse(data.content);
952        //     callback(borders[resolution]);
953        // });
954        $.get('/api/getMapData/fetchCountryBorder?object_id=' + config.country + '&resolution=' + resolution, function (data) {
955          borders[resolution] = JSON.parse(data.content);
956          callback(borders[resolution]);
957        });
958      } else {
959        callback(borders[resolution]);
960      }
961    }
962    L.geoJsonZoom(fetchCountryBorder, {
963      style: {
964        fill: false,
965        color: '#000',
966        opacity: 0.8,
967        weight: 2
968      }
969    }).addTo(map);
970  }
971  function choroplethMap() {
972    function createMap(geojson) {
973      var choropleth = L.choropleth(geojson, config).addTo(map);
974      if (!config.removeLegend && choropleth.options && choropleth.options.legend && choropleth.options.legend.length !== 0) {
975        addLegend(choropleth);
976      }
977    }
978    if (Globalis.geojson_countries_110m) {
979      createMap(Globalis.geojson_countries_110m);
980    } else if (typeof config.geojson === 'string') {
981      $.getJSON(config.geojson, function (geojson) {
982        Globalis.geojson_countries_110m = geojson;
983        createMap(geojson);
984      });
985    }
986  }
987  function categoricalMap() {
988    var features = {};
989    function getGeoJson(zoom, callback) {
990      var resolution = '110m';
991      if (!features[resolution]) {
992        $.getJSON(config.featuresUrl, function (data) {
993          features[resolution] = data;
994          callback(data);
995        });
996      } else {
997        callback(features[resolution]);
998      }
999    }
1000
1001    // $.ez( config.dataUrl, config.dataParams, function( data ) {
1002    //     var options = JSON.parse(data.content);
1003    //
1004    //     options._onClick = function(evt) {
1005    //         var props = evt.target.feature.properties;
1006    //         if (props && props.path){
1007    //             window.top.location.href = config.baseUrl + '/' + props.path;
1008    //         }
1009    //     };
1010    //
1011    //     var categorical = L.categorical(getGeoJson, options).addTo(map);
1012    //
1013    //     if (categorical.options && categorical.options.legend && categorical.options.legend.length !== 0){
1014    //         addLegend(categorical);
1015    //     }
1016    //
1017    // });
1018
1019    $.get(config.dataUrl, config.dataParams, function (data) {
1020      var options = data;
1021      options._onClick = function (evt) {
1022        var props = evt.target.feature.properties;
1023        if (props && props.path) {
1024          window.top.location.href = config.baseUrl + props.path;
1025        }
1026      };
1027      var categorical = L.categorical(getGeoJson, options).addTo(map);
1028      if (categorical.options && categorical.options.legend && categorical.options.legend.length !== 0) {
1029        addLegend(categorical);
1030      }
1031    }, 'json');
1032  }
1033  function clusterMap() {
1034    // $.ez( config.dataUrl, config.dataParams, function( data ) {
1035    //     var items = JSON.parse(data.content);
1036    //
1037    //     var cluster = new L.MarkerClusterGroup({
1038    //         showCoverageOnHover: false,
1039    //         maxClusterRadius: 55
1040    //     });
1041    //
1042    //     cluster.on('click', function (e) {
1043    //         window.location.href = config.baseUrl + '/' + e.layer.options.url;
1044    //     });
1045    //
1046    //     cluster.addLayers(arrayToMarkers(items));
1047    //     map.addLayer(cluster);
1048    // });
1049  }
1050  function selectedMap() {
1051    var layerControl = L.control.layersDropdown({}, {}, {});
1052
1053    // $.ez( 'map::fetchSelectedLayers', {}, function( data ) {
1054    //     var layers 	 = JSON.parse(data.content),
1055    //         basemaps = layers.basemaps,
1056    //         overlays = layers.overlays;
1057    //
1058    //     for (var i = 0; i < basemaps.length; ++i) {
1059    //         var basemap = basemaps[i];
1060    //         var layer = Globalis.Map.createTileLayer(basemap, map);
1061    //         if (basemap.id === config.activeLayer) layer.addTo(map);
1062    //         layerControl.addBaseLayer(layer, basemap.name);
1063    //     }
1064    //
1065    //     for (var i = 0; i < overlays.length; ++i) {
1066    //         var overlay = overlays[i];
1067    //         var layer = Globalis.Map.createTileLayer(overlay, map);
1068    //         //if (overlay.visible) layer.addTo(map);
1069    //         layer.addTo(map);
1070    //         layerControl.addOverlay(layer, overlay.name);
1071    //     }
1072    //
1073    //     layerControl.addTo(map);
1074    // });
1075
1076    $.get('/api/getMapData/fetchSelectedLayers', function (data) {
1077      var layers = JSON.parse(data.content),
1078        basemaps = layers.basemaps,
1079        overlays = layers.overlays;
1080      for (var i = 0; i < basemaps.length; ++i) {
1081        var basemap = basemaps[i];
1082        var layer = Globalis.Map.createTileLayer(basemap, map);
1083        if (basemap.id == config.activeLayer) layer.addTo(map);
1084        layerControl.addBaseLayer(layer, basemap.name);
1085      }
1086      for (var i = 0; i < overlays.length; ++i) {
1087        var overlay = overlays[i];
1088        var layer = Globalis.Map.createTileLayer(overlay, map);
1089        //if (overlay.visible) layer.addTo(map);
1090        layer.addTo(map);
1091        layerControl.addOverlay(layer, overlay.name);
1092      }
1093      layerControl.addTo(map);
1094    });
1095  }
1096  function embeddedMap() {
1097    var layerControl = L.control.layers({}, {}, {});
1098
1099    // $.ez( 'map::fetchEmbedLayer', {object_id: config.layer}, function( data ) {
1100    //     var layers 	 = JSON.parse(data.content),
1101    //         basemap  = layers.basemap,
1102    //         overlays = layers.overlays;
1103    //
1104    //     basemap.legend = null; // Not enough room
1105    //
1106    //     var layer = Globalis.Map.createTileLayer(basemap, map);
1107    //     layer.addTo(map);
1108    //     layerControl.addBaseLayer(layer, basemap.name);
1109    //
1110    //     for (var i = 0; i < overlays.length; ++i) {
1111    //         var overlay = overlays[i];
1112    //         layer = Globalis.Map.createTileLayer(overlay, map);
1113    //         if (overlay.visible) layer.addTo(map);
1114    //         layerControl.addOverlay(layer, overlay.name);
1115    //     }
1116    //
1117    //     layerControl.addTo(map);
1118    // });
1119
1120    $.get('/api/getMapData/fetchEmbedLayer', {
1121      object_id: config.layer
1122    }, function (data) {
1123      var layers = JSON.parse(data.content),
1124        basemap = layers.basemap,
1125        overlays = layers.overlays;
1126      basemap.legend = null; // Not enough room
1127
1128      var layer = Globalis.Map.createTileLayer(basemap, map);
1129      layer.addTo(map);
1130      layerControl.addBaseLayer(layer, basemap.name);
1131      for (var i = 0; i < overlays.length; ++i) {
1132        var overlay = overlays[i];
1133        layer = Globalis.Map.createTileLayer(overlay, map);
1134        if (overlay.visible) layer.addTo(map);
1135        layerControl.addOverlay(layer, overlay.name);
1136      }
1137      layerControl.addTo(map);
1138    });
1139  }
1140  function addLegend(layer) {
1141    if (layer.legendControl) {
1142      layer.legendControl.addTo(map);
1143    } else if (layer.options.legend) {
1144      var options = layer.options;
1145      layer.legendControl = L.control({
1146        position: layer.options.legendPosition || 'bottomright'
1147      });
1148      if (options.tinyLegend) {
1149        layer.legendControl.onAdd = function (map) {
1150          var div = L.DomUtil.create('div', 'leaflet-control-legend leaflet-control-legend-tiny leaflet-control-legend-' + layer.options.id);
1151          var html = '';
1152          if (options.unit || options.name) {
1153            html += '<h4>' + (options.unit ? options.unit : options.name) + '</h4>';
1154            html += '<span class="leaflet-control-legend-first">' + options.classBreaks[0] + '</span>';
1155          }
1156          for (var i = 0; i < options.legend.length; i++) {
1157            var item = options.legend[i];
1158            if (item.color || item.style.charAt(0) === '#') {
1159              html += '<i class="globalis-legend-color" style="background:' + (item.color || item.style) + '" title="' + item.name + '"></i>';
1160            } else {
1161              html += '<i class="globalis-legend-' + item.style + '" title="' + item.name + '"></i>';
1162            }
1163          }
1164          html += '<span class="leaflet-control-legend-last">' + options.classBreaks[options.classBreaks.length - 1] + '</span>';
1165          div.innerHTML = html;
1166          return div;
1167        };
1168      } else {
1169        layer.legendControl.onAdd = function (map) {
1170          var div = L.DomUtil.create('div', 'leaflet-control-legend leaflet-control-legend-' + layer.options.id);
1171          var html = '';
1172          if (options.unit || options.name) {
1173            html += '<h4>' + (options.unit ? options.unit : options.name) + '</h4>';
1174          }
1175          for (var i = 0; i < options.legend.length; i++) {
1176            var item = options.legend[i];
1177            if (item.color || item.style.charAt(0) === '#') {
1178              html += '<i class="globalis-legend-color" style="background:' + (item.color || item.style) + '"></i><span>' + item.name + '</span><div class="clear"></div>';
1179            } else {
1180              html += '<i class="globalis-legend-' + item.style + '"></i><span>' + item.name + '</span><div class="clear"></div>';
1181            }
1182          }
1183          if (!options.panel && options.introduction) {
1184            html += '<p>' + options.introduction + '</p>';
1185          }
1186          div.innerHTML = html;
1187          return div;
1188        };
1189      }
1190      layer.legendControl.addTo(map);
1191    }
1192  }
1193  function arrayToMarkers(arr) {
1194    var l = [];
1195    for (var i = 0; i < arr.length; ++i) {
1196      var item = arr[i];
1197      l.push(new L.Marker([item.lat, item.lng], {
1198        title: item.name,
1199        url: item.url
1200      }));
1201    }
1202    return l;
1203  }
1204  return {
1205    init: function init(domId, config) {
1206      fn(domId, config);
1207      return this;
1208    },
1209    getMap: function getMap() {
1210      return map;
1211    },
1212    remove: function remove() {
1213      if (map) map.remove();
1214    }
1215  };
1216};
1217Globalis.Map.createTileLayer = function (config, map) {
1218  if (config.service === '0') {
1219    // S3/TMS
1220    config.tms = true;
1221  }
1222  if (config.service === '2') {
1223    // MapBox
1224    return Globalis.Map.createInteractiveLayer(config, map);
1225  } else {
1226    return L.tileLayer('//globalis.s3.amazonaws.com/maptiles/3785/{id}/{z}/{x}/{y}.png', config);
1227  }
1228};
1229Globalis.Map.createInteractiveLayer = function (config, map) {
1230  var layerGroup = L.layerGroup();
1231  config.sid = config.sid || config.id;
1232  layerGroup.addLayer(L.tileLayer('//{s}.tiles.mapbox.com/v3/globalis.{sid}/{z}/{x}/{y}.png', config));
1233  L.Util.ajax('//api.tiles.mapbox.com/v3/globalis.' + config.sid + '.json', function (tilejson) {
1234    if (tilejson.grids) {
1235      var utfGrid = new L.UtfGrid('//{s}.tiles.mapbox.com/v3/globalis.world-religions/{z}/{x}/{y}.grid.json?callback={cb}');
1236      layerGroup.addLayer(utfGrid);
1237      var template = '{HighRelig}: {ReligCatP}';
1238      var label = new L.Label({
1239        direction: 'auto'
1240      });
1241      utfGrid.on('mouseover', function (e) {
1242        label.setLatLng(e.latlng).setContent(Globalis.Map.translation(config.translation, config.template, e.data));
1243        map.addLayer(label);
1244      });
1245      utfGrid.on('mouseout', function (e) {
1246        map.removeLayer(label);
1247      });
1248      utfGrid.on('mousemove', function (e) {
1249        label.setLatLng(e.latlng);
1250      });
1251      map.on('baselayerchange', function (e) {
1252        map.removeLayer(label);
1253      });
1254    }
1255  });
1256  return layerGroup;
1257};
1258Globalis.Map.translation = function (lang, str, data) {
1259  return str.replace(/\{ *([\w_]+) *\}/g, function (str, key) {
1260    return lang[data[key]] || data[key];
1261  });
1262};
1263"use strict";
1264
1265function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1266function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1267function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
1268function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1269document.addEventListener("DOMContentLoaded", function () {
1270  newsCarousel();
1271  window.addEventListener("resize", debounce(newsCarousel, 300));
1272  function newsCarousel() {
1273    var news = document.querySelectorAll('.news');
1274    var tabletWidth = 959;
1275    var mobileWidth = 599;
1276    if (news != null && news.length > 0) {
1277      news.forEach(function (ctaSection, i) {
1278        var _breakpoints;
1279        var slides = ctaSection.querySelectorAll('.news__card');
1280        var glide = new Glide(ctaSection, {
1281          type: 'carousel',
1282          gap: 24,
1283          perView: 3,
1284          startAt: 0,
1285          breakpoints: (_breakpoints = {}, _defineProperty(_breakpoints, tabletWidth, {
1286            perView: 2
1287          }), _defineProperty(_breakpoints, mobileWidth, {
1288            perView: 1
1289          }), _breakpoints)
1290        });
1291        if (screen.width > tabletWidth) {
1292          // Desktop
1293          // Initialize glidejs if there are more than 2 slides
1294          if (slides.length > 3) {
1295            glide.mount();
1296          }
1297        } else if (screen.width > mobileWidth) {
1298          // Tablet
1299          // Initialize glidejs if there are more than 2 slides
1300          if (slides.length > 2) {
1301            glide.mount();
1302          }
1303        } else {
1304          // Mobile
1305          // Initialize glidejs if there are more than 1 slide
1306          if (slides.length > 1) {
1307            glide.mount();
1308          }
1309        }
1310      });
1311    }
1312  }
1313});
1314"use strict";
1315
1316document.addEventListener("DOMContentLoaded", function () {
1317  var timelines = document.querySelectorAll('.timeline');
1318
1319  // Loop through each timeline element
1320  timelines.forEach(function (timeline) {
1321    var timelineItems = timeline.querySelectorAll('.timeline__item');
1322
1323    // Loop through each timeline item
1324    timelineItems.forEach(function (item) {
1325      var collapse = item.querySelector('.timeline__collapse');
1326      var date = item.querySelector('.timeline__date');
1327      var dateMin = date.getAttribute('data-min');
1328      var dateMax = date.getAttribute('data-max');
1329
1330      // Check if the collapse element has the "show" class
1331      if (collapse.classList.contains('show')) {
1332        // Modify the date element based on the presence of "dateMin" and "dateMax"
1333        if (dateMin != dateMax) {
1334          if (dateMin && dateMax) {
1335            date.innerHTML = "".concat(dateMin, "<span class=\"dash\">-</span>").concat(dateMax);
1336          } else if (dateMin) {
1337            date.innerHTML = "".concat(dateMin);
1338          } else {
1339            date.innerHTML = "".concat(dateMax);
1340          }
1341        } else {
1342          date.innerHTML = dateMin;
1343        }
1344      } else {
1345        // Modify the date element based on the presence of "dateMin" and "dateMax"
1346        if (dateMin) {
1347          date.innerHTML = dateMin;
1348        } else {
1349          date.innerHTML = dateMax;
1350        }
1351      }
1352
1353      // Set up an event listener for the "show.bs.collapse" event
1354      collapse.addEventListener('show.bs.collapse', function (event) {
1355        // Modify the date element based on the presence of "dateMin" and "dateMax" when the accordion is shown
1356        if (dateMin != dateMax) {
1357          if (dateMin && dateMax) {
1358            date.innerHTML = "".concat(dateMin, "<span class=\"dash\">-</span>").concat(dateMax);
1359          } else if (dateMin) {
1360            date.innerHTML = "".concat(dateMin);
1361          } else {
1362            date.innerHTML = "".concat(dateMax);
1363          }
1364        } else {
1365          date.innerHTML = dateMin;
1366        }
1367      });
1368
1369      // Set up an event listener for the "hide.bs.collapse" event
1370      collapse.addEventListener('hide.bs.collapse', function (event) {
1371        // Modify the date element based on the presence of "dateMin" and "dateMax" when the accordion is hidden
1372        if (dateMin) {
1373          date.innerHTML = dateMin;
1374        } else {
1375          date.innerHTML = dateMax;
1376        }
1377      });
1378    });
1379  });
1380});
1381"use strict";
1382
1383// Function to handle visibility based on checked input
1384function toggleElement() {
1385  var allTogglers = document.querySelectorAll(".toggler [aria-controls]");
1386  allTogglers.forEach(function (togglerInput) {
1387    var togglerTarget = togglerInput.getAttribute('aria-controls');
1388    var isChecked = togglerInput.checked;
1389    var element = document.getElementById(togglerTarget);
1390    if (element) {
1391      if (isChecked) {
1392        // Show the element
1393        element.classList.remove('d-none');
1394        togglerInput.setAttribute('aria-expanded', 'true');
1395
1396        // Check if the element is an "article-text" block
1397        if (element.classList.contains('article-text')) {
1398          setTimeout(function () {
1399            handleIndexComponent();
1400            element.querySelector('.index-component').classList.add('index-component--current');
1401          }, "150");
1402        }
1403      } else {
1404        // Hide the element
1405        element.classList.add('d-none');
1406        togglerInput.setAttribute('aria-expanded', 'false');
1407
1408        // Check if the element is an "article-text" block
1409        if (element.classList.contains('article-text')) {
1410          setTimeout(function () {
1411            element.querySelector('.index-component').classList.remove('index-component--current');
1412          }, "150");
1413        }
1414      }
1415    }
1416  });
1417}
1418
1419// Function to initialize visibility based on checked inputs
1420function initializeVisibility() {
1421  var togglerGroups = document.querySelectorAll('.toggler [aria-controls]');
1422  togglerGroups.forEach(function (input) {
1423    input.addEventListener('change', function () {
1424      toggleElement();
1425    });
1426
1427    // Initial check for visibility
1428    toggleElement();
1429  });
1430}
1431
1432// Run the initialization after the page has loaded
1433window.addEventListener('load', initializeVisibility);
1434//# sourceMappingURL=app.min.js.map

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.