PageSourceSearch

https://pressthink.org/j/rosen-archive/frontend/services/bodyScrollLock.js?v=3.8.36

js pressthink.org collected 2026-10-02 04:27:20 UTC 695 bytes, 25 lines download raw bytes

1// One owner for every modal that prevents background scrolling. Ref counting
2// keeps nested dialogs locked regardless of which one closes first.
3let activeLocks = 0;
4let originalOverflow = '';
5
6export const acquireBodyScrollLock = () => {
7  if (typeof document === 'undefined' || !document.body) return () => {};
8
9  const body = document.body;
10  if (activeLocks === 0) originalOverflow = body.style.overflow;
11  activeLocks += 1;
12  body.style.overflow = 'hidden';
13
14  let released = false;
15  return () => {
16    if (released) return;
17    released = true;
18    activeLocks -= 1;
19
20    if (activeLocks === 0) {
21      body.style.overflow = originalOverflow;
22      originalOverflow = '';
23    }
24  };
25};

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.