PageSourceSearch

https://tryamigo.com/assets/site-ui.js

js tryamigo.com collected 2026-10-01 23:56:18 UTC 3,306 bytes, 102 lines download raw bytes

1(function () {
2  "use strict";
3
4  function syncHeaderNavA11y() {
5    if (document.querySelector(".app-sidebar")) return;
6    var drawer = document.querySelector("details.nav-drawer");
7    var desktop = document.querySelector("nav.nav--desktop");
8    if (!drawer || !desktop) return;
9    var wide = window.matchMedia("(min-width: 901px)").matches;
10    if (wide) {
11      drawer.setAttribute("inert", "");
12      desktop.removeAttribute("inert");
13      desktop.removeAttribute("aria-hidden");
14    } else {
15      drawer.removeAttribute("inert");
16      desktop.setAttribute("inert", "");
17      desktop.setAttribute("aria-hidden", "true");
18    }
19  }
20
21  var resizeTimer;
22  function onResize() {
23    window.clearTimeout(resizeTimer);
24    resizeTimer = window.setTimeout(syncHeaderNavA11y, 120);
25  }
26
27  /** Cookie banner is injected by /js/cookie-banner.js — focus first action for keyboard/SR users. */
28  function primeCookieBannerA11y(bar) {
29    if (!bar || bar.getAttribute("data-dpdp-a11y-primed") === "1") return;
30    bar.setAttribute("data-dpdp-a11y-primed", "1");
31    bar.setAttribute("aria-live", "polite");
32    var first = bar.querySelector(".cookie-banner__btn");
33    if (first) {
34      window.requestAnimationFrame(function () {
35        first.focus();
36      });
37    }
38  }
39
40  function initCookieBannerA11y() {
41    var existing = document.getElementById("dpdp-cookie-banner");
42    if (existing) {
43      primeCookieBannerA11y(existing);
44      return;
45    }
46    if (typeof MutationObserver === "undefined") return;
47    var obs = new MutationObserver(function () {
48      var b = document.getElementById("dpdp-cookie-banner");
49      if (b) {
50        primeCookieBannerA11y(b);
51        cleanup();
52      }
53    });
54    var idleTimer = window.setTimeout(cleanup, 5000);
55    function cleanup() {
56      window.clearTimeout(idleTimer);
57      obs.disconnect();
58    }
59    if (document.body) {
60      obs.observe(document.body, { childList: true });
61    }
62  }
63
64  if (document.readyState === "loading") {
65    document.addEventListener("DOMContentLoaded", function () {
66      syncHeaderNavA11y();
67      initCookieBannerA11y();
68    });
69  } else {
70    syncHeaderNavA11y();
71    initCookieBannerA11y();
72  }
73  window.addEventListener("resize", onResize);
74  window.addEventListener("load", syncHeaderNavA11y);
75
76  document.addEventListener("keydown", function (e) {
77    if (e.key !== "Escape") return;
78    document.querySelectorAll("details.nav-drawer[open]").forEach(function (d) {
79      d.open = false;
80    });
81  });
82
83  /* Scroll-in sections (hub pages; home uses home-page.js + .page--home) */
84  if (!window.matchMedia("(prefers-reduced-motion: reduce)").matches && !document.querySelector(".page--home")) {
85    var io = new IntersectionObserver(
86      function (entries) {
87        entries.forEach(function (en) {
88          if (!en.isIntersecting) return;
89          en.target.classList.add("js-home-reveal--in");
90          io.unobserve(en.target);
91        });
92      },
93      { rootMargin: "0px 0px 12% 0px", threshold: 0 }
94    );
95
96    document.querySelectorAll("main section").forEach(function (el) {
97      if (el.closest(".ad-slot")) return;
98      el.classList.add("js-home-reveal");
99      io.observe(el);
100    });
101  }
102})();

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.