PageSourceSearch

https://ariamarble.github.io/assets/js/nav-scroll.js

js ariamarble.github.io collected 2026-10-03 08:39:19 UTC 721 bytes, 27 lines download raw bytes

1let siteNav = document.querySelector('.site-nav');
2const key = 'scroll';
3
4document.addEventListener('DOMContentLoaded', () => {
5    const scroll = JSON.parse(sessionStorage.getItem(key));
6
7    const currentDate = new Date();
8    
9    if (scroll !== null && currentDate.getTime() < scroll.expiry) {
10      siteNav.scrollTop = parseInt(scroll.value);
11    }
12    else {
13      sessionStorage.removeItem(key);
14    }
15});
16
17window.addEventListener('beforeunload', () => {
18  const currentDate = new Date();
19
20  // add the scroll value that expires after one day
21  const scroll = {
22    value: siteNav.scrollTop,
23    expiry: currentDate.getTime() + 24 * 60 * 60 * 1000,
24  }
25  
26  sessionStorage.setItem(key, JSON.stringify(scroll));
27});

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.