PageSourceSearch

https://masto.host/js/functions.js

js masto.host collected 2026-09-24 17:19:12 UTC 913 bytes, 39 lines download raw bytes

1// Open Details from ID
2function openDetails() {
3  var hash = location.hash.substring(1);
4  if (hash) {
5    var details = document.getElementById(hash); 
6  }
7  if (details && details.tagName.toLowerCase() === 'details') {
8    details.open = true;
9
10    // Scroll up a bit to prevent the details title getting clipped by nav
11    document.body.scrollBy({
12      top: -100
13    });
14  }
15}
16
17// Open only one detail at a time
18function closeDetails() {
19  const details = document.querySelectorAll('details');
20
21  details.forEach((target) => {
22    target.addEventListener("click", () => {
23      details.forEach((detail) => {
24        if (detail !== target) {
25          if (detail.open) {
26            detail.open = false;
27          }
28        }
29      });
30    });
31  });
32}
33
34// Load Functions
35window.addEventListener('load', function() {
36  window.addEventListener('hashchange', openDetails);
37  closeDetails();
38  openDetails();
39});

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.