PageSourceSearch

https://hitblast.github.io/js/script.js?h=3d13bde5d6e521b92bcb

js hitblast.github.io collected 2026-10-03 09:17:51 UTC 2,729 bytes, 102 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2  // ---- Icon loader ----
3  document.querySelectorAll(".icon").forEach((el) => {
4    fetch(el.dataset.src)
5      .then((r) => r.text())
6      .then((svg) => (el.innerHTML = svg));
7  });
8
9  // ---- Copy button ----
10  document.querySelectorAll("#copy-btn").forEach((el) => {
11    el.addEventListener("click", () => {
12      let attr = el.getAttribute("data-copyable");
13      el.setAttribute(
14        "data-tooltip",
15        el.getAttribute("data-copynotif") || "copied!",
16      );
17      navigator.clipboard.writeText(attr);
18
19      setTimeout(() => {
20        el.removeAttribute("data-tooltip");
21      }, 4000);
22    });
23  });
24
25  // ---- Random Message for Blep Section ----
26  (function () {
27    const messages = [
28      "snaccs? :3",
29      "mie ^w^",
30      "mieeeee :3",
31      "agomeoww ^w^",
32      "pats? :<",
33      "*scratches* :D",
34      "*mlem mlem*",
35      "*^w^*",
36      ":D",
37    ];
38
39    const randomMsgElem = document.getElementById("random-message");
40    if (randomMsgElem) {
41      randomMsgElem.textContent =
42        messages[Math.floor(Math.random() * messages.length)];
43    }
44  })();
45
46  // ---- Blep Image Toggle Code ----
47  (function () {
48    const img = document.getElementById("blep");
49    if (!img) return;
50
51    let clickable = true;
52    const happySrc = img.getAttribute("data-happy-src");
53    img.addEventListener("click", function () {
54      if (!clickable) return;
55      clickable = false;
56      const originalSrc = img.src;
57      if (happySrc) img.src = happySrc;
58      setTimeout(function () {
59        img.src = originalSrc;
60        clickable = true;
61      }, 2000);
62    });
63  })();
64
65  // ---- Equalize Project Card Heights ----
66  (function () {
67    function debounce(fn, wait = 120) {
68      let t;
69      return (...a) => {
70        clearTimeout(t);
71        t = setTimeout(() => fn(...a), wait);
72      };
73    }
74
75    function equalizeProjectCards() {
76      const cards = document.querySelectorAll(".project-card");
77      if (!cards.length) return;
78
79      cards.forEach((c) => (c.style.minHeight = ""));
80      let max = 0;
81      cards.forEach((c) => {
82        max = Math.max(max, c.getBoundingClientRect().height);
83      });
84      cards.forEach((c) => (c.style.minHeight = `${Math.ceil(max)}px`));
85    }
86
87    function whenImagesLoaded(cb) {
88      const imgs = Array.from(document.images);
89      if (!imgs.length) return cb();
90      Promise.all(
91        imgs.map((img) =>
92          img.complete
93            ? Promise.resolve()
94            : new Promise((r) => (img.onload = img.onerror = r)),
95        ),
96      ).then(cb);
97    }
98
99    whenImagesLoaded(equalizeProjectCards);
100    window.addEventListener("resize", debounce(equalizeProjectCards));
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.