PageSourceSearch

https://standard.no/Scripts/search-clear.js

js standard.no collected 2026-10-01 11:26:17 UTC 1,016 bytes, 31 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    const clearButtons = document.querySelectorAll('.sd-text-input__clear-input-button');
3
4    clearButtons.forEach(function (button) {
5        const wrapper = button.closest('.sd-text-input__input-wrapper');
6        if (!wrapper) return;
7
8        const input = wrapper.querySelector('.sd-text-input__input');
9        if (!input) return;
10
11        function updateClearButton() {
12            if (input.value.length > 0) {
13                button.removeAttribute('tabindex');
14                button.setAttribute('aria-hidden', 'false');
15            } else {
16                button.setAttribute('tabindex', '-1');
17                button.setAttribute('aria-hidden', 'true');
18            }
19        }
20
21        updateClearButton();
22
23        button.addEventListener('click', function () {
24            input.value = '';
25            input.focus();
26            updateClearButton();
27        });
28
29        input.addEventListener('input', updateClearButton);
30    });
31});

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.