PageSourceSearch

https://aopanet.org/wp-content/themes/mg-starter/src/js/utils/scroll-to-anchor.js

js aopanet.org collected 2026-10-03 23:48:29 UTC 1,068 bytes, 36 lines download raw bytes

1export function scrollToAnchor(resultsAnchor) {
2    const headerHeight =
3        document.documentElement.style.getPropertyValue("--mg-header-height");
4    const htmlMargin =
5        document.documentElement.style.getPropertyValue("--mg-html-margin");
6    const header = document.querySelector("#site-header .header-inner");
7    let headerCSSposition;
8
9    if (!resultsAnchor instanceof HTMLElement) return false;
10
11    if (header) {
12        headerCSSposition = window.getComputedStyle(header).position;
13    }
14
15    const resultsTopPosition =
16        window.scrollY + resultsAnchor.getBoundingClientRect().top;
17    const extraOffset = 30;
18
19    if (headerHeight || htmlMargin) {
20        let scrollToValue = resultsTopPosition;
21
22        if (headerHeight) {
23            scrollToValue -= parseInt(headerHeight);
24        }
25
26        if (htmlMargin) {
27            scrollToValue -= parseInt(htmlMargin);
28        }
29
30        scrollToValue -= extraOffset;
31
32        window.scrollTo(null, scrollToValue);
33    } else {
34        window.scrollTo(null, resultsTopPosition - 260);
35    }
36}

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.