PageSourceSearch

https://www.colgate.com/etc.clientlibs/astra/components/elasticsea…-513152c835ee140d30adda3cd2315baa-lc.min.js

js colgate.com collected 2026-10-01 08:34:20 UTC 2,483 bytes, 85 lines download raw bytes

1function elasticSearch() {
2    const url = "/bin/astra/search";
3    const pagePath = document.querySelector('.pagePath')?.value;
4
5	if(typeof pagePath !== 'undefined') {
6	    const headers = new Headers();
7	    headers.append("pagePath", pagePath);
8
9	    fetch(url, {
10	        method: "GET",
11	        headers: headers,
12	    })
13	    .then(response => response.json()) // Parse the response as JSON
14	    .then(responseObj => {
15	        if (responseObj && Object.keys(responseObj).length > 0) {
16	            for (const [key, value] of Object.entries(responseObj)) {
17	                sessionStorage.setItem(key, value);
18	            }
19	        }
20	    })
21	    .catch(error => {
22	        console.error("There was a problem with the fetch operation from elastic api:", error);
23	    });
24	}
25}
26
27function initializeSearch() {
28    const components = document.querySelectorAll('.elasticsearch');
29    elasticSearch();
30
31    components.forEach(component => {
32        const searchIcon = component.querySelector('.search-icon');
33        const overlay = component.querySelector('.elastic-search-overlay');
34        const searchInput = component.querySelector('.input-medium.search-query');
35        const closeBtn = component.querySelector('.elastic-search-close');
36
37        if (!searchIcon) {
38            return;
39        }
40
41        function openOverlay() {
42            if (!overlay) {
43                return;
44            }
45            overlay.style.display = 'block';
46            overlay.classList.add('elastic-modal-open');
47            searchInput?.focus();
48        }
49
50        function closeOverlay() {
51            if (!overlay) {
52                return;
53            }
54            overlay.style.display = 'none';
55            overlay.classList.remove('elastic-modal-open');
56        }
57
58        searchIcon.addEventListener('click', e => {
59            e.preventDefault();
60            openOverlay();
61        });
62
63        searchIcon.addEventListener('keydown', e => {
64            if (e.key === 'Enter' || e.key === ' ') {
65                e.preventDefault();
66                openOverlay();
67            }
68        });
69
70        closeBtn?.addEventListener('click', closeOverlay);
71
72        document.addEventListener('keydown', e => {
73            if (e.key === 'Escape') {
74                closeOverlay();
75            }
76        });
77    });
78}
79
80// Elastic Search Overlay Js.
81if (document.readyState === 'loading') {
82    document.addEventListener('DOMContentLoaded', initializeSearch);
83} else {
84    initializeSearch()
85}

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.