PageSourceSearch

https://def.dk/js/cludo.js

js def.dk collected 2026-10-02 12:25:19 UTC 2,454 bytes, 54 lines download raw bytes

1/* eslint-disable @typescript-eslint/no-unused-vars */
2//? NOTE: Disabled eslint rules becuase it comes from a third-party script and we don't want to modify it.
3// <!-- ======================= -->
4// <!-- CLUDO SETTINGS TEMPLATE -->
5// <!-- vvvvvvvvvvvvvvvvvvvvvvv -->
6var cludo_searchUrl_Global = '/'; //Search URL - change this to reflect the global main search page URL
7var cludo_searchInputs_Global = ['#cludo-search-input', '#cludoNav'];
8var cludo_limitSearch = 'main'; //set the limitation on which pages to see from the engine. Must be either "main", "Tillidsportal" or "Medlemsportal"
9
10if (typeof window !== 'undefined') {
11	const { content } = window.__NEXT_DATA__.props.pageProps;
12	
13	if (content) {
14		const findSearchResultsSettings = content?.siteSettings?.find((element) => {
15			return element.documentType === 'searchResultsUrl';
16		});
17
18		cludo_searchUrl_Global = findSearchResultsSettings?.content?.properties?.searchResultsPageUrl?.url ?? '/';
19
20		if (cludo_searchUrl_Global.endsWith('/')) {
21			cludo_searchUrl_Global = cludo_searchUrl_Global.slice(0, -1);
22		}
23		cludo_limitSearch = findSearchResultsSettings?.content?.properties?.limitSearchVariable ?? 'main';
24	}
25
26	// Check if scripts are already loaded to avoid duplicate script tags
27	const existingSearchScript = document.querySelector('script[src="https://customer.cludo.com/scripts/bundles/search-script.js"]');
28	if (!existingSearchScript) {
29		
30		// First load the search script bundle
31		const searchScript = document.createElement('script');
32		searchScript.src = 'https://customer.cludo.com/scripts/bundles/search-script.js';
33		searchScript.async = true;
34		searchScript.onload = () => {
35			const existingHelperScript = document.querySelector('script[src="https://customer.cludo.com/assets/3101/13264/cludo-helper2024.js"]');
36			if (!existingHelperScript) {
37				// Then load the helper script
38				const helperScript = document.createElement('script');
39				helperScript.src = 'https://customer.cludo.com/assets/3101/13264/cludo-helper2024.js';
40				helperScript.async = true;
41				helperScript.onerror = () => {
42					console.error('Failed to load Cludo helper script');
43				};
44				document.body.appendChild(helperScript);
45			} 
46			
47		};
48		searchScript.onerror = () => {
49			console.error('Failed to load Cludo search script');
50		};
51		document.body.appendChild(searchScript);
52	}
53}
54/* eslint-enable @typescript-eslint/no-unused-vars */

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.