PageSourceSearch

https://bastianlb.github.io/assets/news.js

js bastianlb.github.io collected 2026-10-03 08:41:34 UTC 800 bytes, 20 lines download raw bytes

1// Homepage "Show all of YYYY" news toggle — progressive enhancement.
2// The extra entries and the button are rendered [hidden]; if this script never
3// runs, the latest entries and the "All news" link still show.
4(function () {
5  "use strict";
6  document.addEventListener("DOMContentLoaded", function () {
7    var btn = document.querySelector(".news-toggle");
8    if (!btn) return;
9    var extra = document.getElementById(btn.getAttribute("aria-controls"));
10    if (!extra) return;
11    btn.hidden = false;
12
13    btn.addEventListener("click", function () {
14      var open = btn.getAttribute("aria-expanded") !== "true";
15      btn.setAttribute("aria-expanded", String(open));
16      extra.hidden = !open;
17      btn.textContent = btn.getAttribute(open ? "data-less" : "data-more");
18    });
19  });
20})();

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.