PageSourceSearch

https://www.loggly.com/wp-content/themes/sw-global/dev/scripts/sw19s-confirmation-modal.js?ver=1754550757

js loggly.com collected 2026-09-24 08:29:07 UTC 1,817 bytes, 66 lines download raw bytes

1(function () {
2  const countryPicker = document.querySelector(".country-picker");
3  if (!countryPicker) {
4    return;
5  }
6
7  const modal = document.querySelector(".sw19s-confirmation-modal-background");
8  if (!modal) {
9    return;
10  }
11  const checkbox = document.querySelector(
12    'input[type="checkbox"]#sw19-promotions'
13  );
14  const dachCountries = checkbox.dataset.dachCountries;
15
16  const removeListeners = (buttonArray) => {
17    buttonArray.forEach((button) => {
18      button.removeEventListener("click", checkCheckbox);
19      button.removeEventListener("click", uncheckCheckbox);
20    });
21  };
22
23  const buttons = modal?.querySelectorAll("button");
24  function checkCheckbox() {
25    checkbox.checked = true;
26    removeListeners(buttons);
27    toggleDisplayClass();
28  }
29  function uncheckCheckbox() {
30    checkbox.checked = false;
31    removeListeners(buttons);
32    toggleDisplayClass();
33    modal.classList.toggle("modal-display-initial");
34  }
35
36  const toggleDisplayClass = () => {
37    if (
38      !dachCountries ||
39      dachCountries.split(" ").includes(countryPicker.value)
40    ) {
41      if (checkbox.checked) {
42        modal.classList.toggle("modal-display-initial");
43      }
44
45      buttons.forEach((button) => {
46        if (button.classList.contains("btn-confirm")) {
47          button.addEventListener("click", checkCheckbox);
48        } else {
49          button.addEventListener("click", uncheckCheckbox);
50        }
51      });
52    }
53  };
54
55  const openConfirmationModal = () => {
56    if (!checkbox) return;
57    if (checkbox.checked) toggleDisplayClass();
58    checkbox.removeEventListener("click", toggleDisplayClass);
59    checkbox.addEventListener("click", toggleDisplayClass);
60  };
61
62  if (countryPicker) {
63    countryPicker.addEventListener("change", openConfirmationModal);
64    openConfirmationModal();
65  }
66})();

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.