File size: 1,799 Bytes
187ef74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(() => {
  "use strict";
  const dialog = document.querySelector("[data-filter-dialog]");
  const openButton = document.querySelector("[data-filter-dialog-open]");
  const closeButton = document.querySelector("[data-filter-dialog-close]");
  if (!dialog || !openButton || !closeButton) return;
  const mobile = globalThis.matchMedia("(max-width: 700px)");

  const sync = () => {
    if (mobile.matches && dialog.open) dialog.close();
    if (!mobile.matches && !dialog.open) dialog.show();
  };
  openButton.addEventListener("click", () => {
    if (!dialog.open) dialog.showModal();
  });
  closeButton.addEventListener("click", () => dialog.close());
  dialog.addEventListener("click", (event) => {
    if (event.target === dialog) dialog.close();
  });
  mobile.addEventListener("change", sync);
  sync();
})();

// Expand the local map preview in place, matching Eventbrite's map-toggle
// interaction without loading a third-party map, telemetry, or remote assets.
(function () {
  "use strict";

  var map = document.querySelector("[data-directory-map]");
  if (!map) return;
  var toggle = map.querySelector("[data-map-toggle]");
  if (!toggle) return;

  function setExpanded(expanded) {
    map.classList.toggle("is-expanded", expanded);
    toggle.setAttribute("aria-expanded", expanded ? "true" : "false");
    toggle.textContent = expanded ? "Hide map" : "View map";
    document.body.classList.toggle("has-directory-map-open", expanded);
    if (expanded) map.focus();
  }

  toggle.addEventListener("click", function () {
    setExpanded(!map.classList.contains("is-expanded"));
  });
  document.addEventListener("keydown", function (event) {
    if (event.key === "Escape" && map.classList.contains("is-expanded")) {
      setExpanded(false);
      toggle.focus();
    }
  });
})();