PageSourceSearch

https://willnorris.com/js/script.8c97d2b77f8c0adf702721c49869f236f795a42e3fd9466560eeec9bbeefc0b9.js

js willnorris.com collected 2026-09-24 17:10:42 UTC 3,656 bytes, 118 lines download raw bytes

1// set scrollbar width CSS variable
2document.documentElement.style.setProperty(
3  "--scrollbar-width",
4  window.innerWidth - document.documentElement.clientWidth + "px",
5);
6
7// loadCSS dynamically loads a stylesheet.
8function loadCSS(url) {
9  var el = document.createElement("link");
10  el.href = url;
11  el.rel = "stylesheet";
12  el.type = "text/css";
13  document.head.appendChild(el);
14  return el;
15}
16
17// load fragmention if URL fragment is present
18(async () => {
19  if (window.location.hash !== "") {
20    await import(
21      '/js/fragmention.7ad173ab4750a97f1c0ec0645d19f2bae98b9983e9f67ca0b3a567ec642e7df8.js'
22    );
23  }
24})();
25
26// run off-site links through unrot to detect dead links
27/*
28(async () => {
29  const links = document.querySelectorAll("a[href^=http]");
30  if (links.length) {
31    await import(
32      '/js/unrot.cae862d6d719fa5e81ba90df11437040395fa96a313ea8f40d573ecee23c180b.js'
33    );
34  }
35})();
36*/
37
38// display popover for linked images
39// https://caniuse.com/popover
40(async () => {
41  if (!HTMLElement.prototype.hasOwnProperty("popover")) {
42    return;
43  }
44  const imageAnchors = Array.from(document.querySelectorAll(".e-content a"))
45    .filter((a) => a.href.match(/.(jpg|jpeg|png|webp)$/))
46    .filter((a) => a.querySelector("img"));
47  if (imageAnchors.length) {
48    await import(
49      '/js/popover.164e43e78bf8a9e3ab7387c8865bb632cf3bf9c57bb84fd99699febe3001293b.js'
50    );
51  }
52})();
53
54// display galleries in masonry grid
55// https://caniuse.com/mdn-css_properties_grid-template-rows_masonry
56(async () => {
57  const galleries = document.querySelectorAll(".gallery");
58  if (galleries.length && !CSS.supports("grid-template-rows", "masonry")) {
59    // fallback to masonry polyfill
60    await import(
61      '/js/masonry.16086dbdad4589de228a19e47d0dc358912cd678e07ceb42a3e36b240d5914e4.js'
62    );
63  }
64})();
65
66// load asciinema player if needed
67(async () => {
68  const asciicasts = document.querySelectorAll("object[type='application/x-asciicast']");
69  if (asciicasts.length) {
70    loadCSS('/css/asciinema-player.6ada3b87024e4c43032505418c1d4ff6790a76feb9b569877a1758975ac16528.css');
71    // AsciinemaPlayer relies on the files:
72    // - /js/asciinema-player/core-BpMsaxjJ.js
73    // - /js/asciinema-player/index.js
74    // - /js/asciinema-player/logging-Bg1womcE.js
75    // - /js/asciinema-player/opts-BxeD04BP.js
76    const AsciinemaPlayer = (await import(
77      '/js/asciinema-player/index.a696712b6f1bebdb7e7d88cea80874b450fef04a09a5a4048e6c760b2c1c75ec.js'
78    ));
79    asciicasts.forEach((cast) => {
80      // options at https://docs.asciinema.org/manual/player/options/
81      AsciinemaPlayer.create(cast.data, cast, {
82        startAt: cast.dataset.startAt,
83        idleTimeLimit: cast.dataset.idleTimeLimit,
84        poster: cast.dataset.poster,
85      });
86    })
87  }
88})();
89
90// webmention form handler
91(async () => {
92  const form = document.getElementById("webmention-form");
93  if (form) {
94    const result = form.querySelector("[result]");
95
96    form.addEventListener("submit", async (e) => {
97      e.preventDefault();
98
99      const params = new URLSearchParams();
100      params.set("source", form.querySelector("[name=source]").value);
101      params.set("target", form.querySelector("[name=target]").value);
102
103      console.log("submitted form with params", params);
104      const response = await fetch(form.action, {
105        method: "post",
106        body: params,
107      });
108      if (response.ok) {
109        const data = await response.json();
110        result.className = "success";
111        result.innerText = data.summary;
112      } else {
113        result.className = "error";
114        result.innerText = "Error: " + response.statusText;
115      }
116    });
117  }
118})();

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.