PageSourceSearch

https://www.healthdatasummit.ca/wp-content/themes/charlotte-theme/assets/js/quicklinks.js

js healthdatasummit.ca collected 2026-10-08 03:54:12 UTC 2,255 bytes, 59 lines download raw bytes

1(function () {
2    function scrollToHash(hash) {
3        const target = document.getElementById(hash) || document.querySelector(`[name="${hash}"]`);
4        if (target) {
5            const targetPosition = target.getBoundingClientRect().top + window.pageYOffset - 100;
6            window.scrollTo({
7                top: targetPosition,
8                behavior: 'smooth'
9            });
10            setTimeout(() => {
11                if (!target.hasAttribute('tabindex')) {
12                    target.setAttribute('tabindex', '-1');
13                }
14                target.focus();
15            }, 1000);
16        }
17    }
18
19    function initQuickLinks() {
20        const quickLinks = document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"])');
21        const pageLinks = document.querySelectorAll('.page-links--inner a');
22        pageLinks.forEach(link => {
23            if (link.href === window.location.href) {
24                link.classList.add('active');
25            }
26        });
27        quickLinks.forEach(link => {
28            link.addEventListener('click', (e) => {
29                e.preventDefault();
30                const href = link.getAttribute('href');
31                const hash = href.includes('#') ? href.split('#').pop() : '';
32                const linkPathname = link.pathname.replace(/\/$/, '').replace(/^\//, '');
33                const currentPathname = location.pathname.replace(/\/$/, '').replace(/^\//, '');
34                if (location.hostname === link.hostname || link.hostname === '') {
35                    if (currentPathname === linkPathname || href.startsWith('#')) {
36                        if (hash) {
37                            history.pushState({}, document.title, href);
38                            scrollToHash(hash);
39                        }
40                    } else {
41                        window.location.href = href;
42                    }
43                } else {
44                    window.location.href = href;
45                }
46            });
47        });
48        if (window.location.hash) {
49            const initialHash = window.location.hash.slice(1);
50            scrollToHash(initialHash);
51        }
52    }
53
54    function initialize() {
55        initQuickLinks();
56    }
57
58    initialize();
59})();

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.