PageSourceSearch

https://lund.se/download/18.2b762f8e1818001d87938a18/1773393522024/ankare.js

js lund.se collected 2026-10-02 18:17:41 UTC 2,598 bytes, 84 lines download raw bytes

1svDocReady(function () {
2    setTimeout(() => {
3        checkAnkare();
4    }, 1);
5});
6
7function checkAnkare() {
8    const offset = -125; // to scroll past header
9    const scrollY = -(window.outerHeight / 2) - offset;
10    window.scrollBy(0, scrollY);
11
12    if (window.location.hash) {
13        const hashValue = window.location.hash.trim().substring(1);
14        const cleanedHashValue = hashValue.replace("svid", "");
15        if (!cleanedHashValue.startsWith("?cludoquery")) {
16            let hashes = [
17                $svjq("#h-" + cleanedHashValue),
18                $svjq("#h-" + hashValue),
19                $svjq("#" + cleanedHashValue),
20                $svjq("#" + hashValue),
21                $svjq(window.location.hash),
22            ];
23            let hashElement = hashes.find((x) => x.length > 0);
24
25            if (hashElement) {
26                handleAccordion(hashElement);
27            }
28        }
29    }
30}
31
32function handleAccordion(element) {
33    let result = findAccordion(element);
34    let accordion = result.accordion;
35    let shouldScrollToElement = result.scrollToElement;
36
37    if (accordion) {
38        if (accordion.attr("aria-expanded") == "false") {
39            accordion.click();
40        }
41        scrollToElement(shouldScrollToElement ? element : accordion);
42    }
43}
44
45function findAccordion(element) {
46    if (element.hasClass("consid-accordion-title")) {
47        return {
48            accordion: $svjq("#" + element.attr("id") + " a"),
49            scrollToElement: false,
50        };
51    } else if (
52        element.parent().children().length == 2 &&
53        $svjq(element.parent().children()[1]).find(".consid-accordion-title")
54            .length > 0
55    ) {
56        return {
57            accordion: $svjq(
58                $svjq(element.parent().children()[1]).find("a")[0],
59            ),
60            scrollToElement: false,
61        };
62    } else {
63        let listElements = element
64            .closest(".consid-accordion__content")
65            .parent()
66            .find(".consid-accordion-title a");
67        if (listElements.length) {
68            return { accordion: $svjq(listElements[0]), scrollToElement: true };
69        } else {
70            return { accordion: null, scrollToElement: false };
71        }
72    }
73}
74
75function scrollToElement(element) {
76    let header = document.querySelector(".lnd-header");
77    let headerHeight = header.offsetHeight;
78    $svjq("html,body").animate(
79        {
80            scrollTop: element.offset().top - headerHeight,
81        },
82        "slow",
83    );
84}

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.