PageSourceSearch

https://www.laudate.ee/en/_static/insipid.js

js laudate.ee collected 2026-10-03 01:48:09 UTC 5,269 bytes, 149 lines download raw bytes

1(dom_loaded => {
2    if (document.readyState === 'loading') {
3        document.addEventListener('DOMContentLoaded', dom_loaded);
4    } else {
5        dom_loaded();
6    }
7})(() => {
8    'use strict';
9
10    // make sure all scripts are re-executed when navigating to cached page
11    window.onunload = () => {};
12
13    const topbar = document.getElementById('topbar');
14    const topbar_placeholder = document.getElementById('topbar-placeholder');
15
16    const threshold = 10;
17
18    // auto-hide topbar
19    function scroll_callback(scroller) {
20        let ignore_scroll = true;
21        let initial;
22        let scroll_timeout;
23        return event => {
24            window.clearTimeout(scroll_timeout);
25            const current = scroller.scrollTop;
26            if (current <= topbar.offsetHeight || (scroller.scrollHeight - current - scroller.clientHeight) < (scroller.clientHeight / 3)) {
27                document.body.classList.remove('topbar-folded');
28                ignore_scroll = true;
29                return;
30            } else if (ignore_scroll) {
31                // We ignore single jumps
32                ignore_scroll = false;
33                initial = current;
34            } else if (current - initial > threshold) {
35                document.body.classList.add('topbar-folded');
36                ignore_scroll = true;
37                return;
38            } else if (current - initial < -threshold) {
39                document.body.classList.remove('topbar-folded');
40                ignore_scroll = true;
41                return;
42            }
43            scroll_timeout = setTimeout(() => { ignore_scroll = true; }, 66);
44        };
45    }
46
47    document.addEventListener('scroll', scroll_callback(document.scrollingElement));
48
49    const sidebar_scroller = document.querySelector('.sphinxsidebar');
50    if (sidebar_scroller) {
51        sidebar_scroller.addEventListener('scroll', scroll_callback(sidebar_scroller));
52    }
53
54    const div_body = document.querySelector('div.body');
55    const first_section = document.querySelector('div.body .section, div.body section');
56    if (first_section) {
57        document.addEventListener('scroll', event => {
58            if (window.pageYOffset >= div_body.offsetTop + first_section.offsetTop) {
59                document.body.classList.add('scrolled');
60            } else {
61                document.body.classList.remove('scrolled');
62            }
63        });
64        document.dispatchEvent(new Event('scroll'));
65    }
66
67    topbar.querySelector('.top').addEventListener('click', event => {
68        window.scroll({ top: 0, behavior: 'smooth' });
69        event.preventDefault();
70    });
71
72    const search_button = document.getElementById('search-button');
73    if (search_button) {
74        const search_form = document.getElementById('search-form');
75        const search_field = search_form.querySelector('input');
76
77        function show_search() {
78            try {
79                // https://readthedocs-sphinx-search.readthedocs.io/
80                showSearchModal();
81                return;
82            } catch(e) {}
83            search_form.style.display = 'flex';
84            search_button.setAttribute('aria-expanded', 'true');
85            search_field.focus();
86            document.body.classList.remove('topbar-folded');
87        }
88
89        function hide_search() {
90            search_form.style.display = 'none';
91            search_button.setAttribute('aria-expanded', 'false');
92            search_button.blur();
93        }
94
95        function toggle_search() {
96            if (window.getComputedStyle(search_form).display === 'none') {
97                show_search();
98            } else {
99                hide_search();
100            }
101        }
102
103        search_button.addEventListener('click', toggle_search);
104        if (Documentation.focusSearchBar) {
105            // Monkey-patch function provided by Sphinx:
106            Documentation.focusSearchBar = show_search;
107        }
108
109        search_field.addEventListener('keydown', event => {
110            if (event.code === 'Escape') {
111                hide_search();
112                search_field.blur();
113            }
114        });
115    }
116
117    const fullscreen_button = document.getElementById('fullscreen-button');
118    if (document.fullscreenEnabled) {
119        fullscreen_button.addEventListener('click', event => {
120            if (!document.fullscreenElement) {
121                document.documentElement.requestFullscreen();
122            } else {
123                document.exitFullscreen();
124            }
125            fullscreen_button.blur();
126            topbar_placeholder.classList.remove('fake-hover');
127        });
128    } else {
129        fullscreen_button.remove();
130    }
131
132    topbar_placeholder.addEventListener('mouseenter', event => {
133        topbar_placeholder.classList.add('fake-hover');
134    });
135
136    topbar_placeholder.addEventListener('mouseleave', event => {
137        topbar_placeholder.classList.remove('fake-hover');
138    });
139
140    document.addEventListener('touchend', event => {
141        if (event.touches.length > 1) { return; }
142        const touch = event.touches[0];
143        if (touch.clientY < topbar.offsetHeight) {
144            topbar_placeholder.classList.add('fake-hover');
145        } else {
146            topbar_placeholder.classList.remove('fake-hover');
147        }
148    });
149});

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.