PageSourceSearch

https://www.gipuzkoa.eus/documents/20945/84420371/google-bilatzail…d36a-3e23-77bf-5fb47f1e0923?t=1751009243970

js gipuzkoa.eus collected 2026-09-24 17:33:50 UTC 7,394 bytes, 159 lines download raw bytes

1
2var observer = null;
3
4if (themeDisplay.getLanguageId() == 'eu_ES') {
5	// Si la página está en euskera, hay que cambiar los textos
6    var resultInfoProgrammaticallyChanged = false;
7    var webResultTextProgrammaticallyChanged = false;
8    observer = new MutationObserver(function (mutationsList) {
9        for (const mutation of mutationsList) {
10            var target = mutation.target;
11            // Número de resultados
12            if (target.classList.contains('gsc-result-info') && mutation.addedNodes.length > 0) {
13                if (!resultInfoProgrammaticallyChanged) {
14                    var text = mutation.addedNodes[0].nodeValue;
15                    // TODO Extraer el número de resultados y el tiempo y crear el texto en euskera
16                    text = text.replace('Aproximadamente', 'Gutxi gorabehera');
17                    text = text.replace('resultados', 'emaitza');
18                    text = text.replace('segundos', 'segundo');
19                    target.innerHTML = text;
20                    resultInfoProgrammaticallyChanged = true;
21                } else {
22                    resultInfoProgrammaticallyChanged = false;
23                }
24
25            } else if (target.classList.contains('gsc-webResult')) {
26                if (!webResultTextProgrammaticallyChanged) {
27                    // No hay resultados
28                    var noResultsNode = target.getElementsByClassName('gs-no-results-result')[0];
29                    if (noResultsNode != null) {
30                        noResultsNode.childNodes[0].innerHTML = "Ez da emaitzarik aurkitu"
31                    }
32                    // Quizás quisiste decir
33                    var spellingNodes = target.getElementsByClassName('gs-spelling');
34                    if (spellingNodes != null) {
35                        for (const spellingNode of spellingNodes) {
36                            spellingNode.childNodes[0].data = spellingNode.childNodes[0].data
37                                .replace('Quizás quisiste decir', 'Agian hau bilatu nahi duzu')
38                                .replace('Resultados de', 'Bilaketa honen emaitzak:')
39                                .replace('Ver resultados de', 'Bilaketa honen emaitzak ikusi:');
40                        }
41                    }
42					
43					// Buscar en Google
44					const findMoreInGoogle = target.getElementsByClassName('gcsc-find-more-on-google')[0];
45					findMoreInGoogle.getElementsByClassName('gcsc-find-more-on-google-text').forEach(function (element) {
46						element.innerHTML = element.innerHTML
47												.replaceAll('Buscar','Bilatu')
48												.replaceAll('en Google','Google-n');
49					});
50					
51					// Imagen de branding
52					const brandingImg = target.getElementsByClassName('gcsc-branding-img-noclear')[0];
53					brandingImg.src = '/documents/20945/84420371/branding_eu.png/482007ba-83d4-10e1-16ce-0ab68f473003';
54					brandingImg.srcset = '/documents/20945/84420371/branding_eu.png/482007ba-83d4-10e1-16ce-0ab68f473003';
55
56                    webResultTextProgrammaticallyChanged = true;
57                } else {
58                    webResultTextProgrammaticallyChanged = false;
59                }
60            } else if (target.classList.contains('gsc-input-box')) {
61				var searchText = "Bilatu";
62				var clearSearchText = "Bilaketa garbitu";
63				
64                var searchInput = target.getElementsByTagName('input')[0];
65                searchInput.title = searchText;
66                searchInput.ariaLabel = searchText;
67				replaceInputBoxBackgroundImage(searchInput);
68				searchInput.onblur = function searchInputOnBlur(params) {
69					replaceInputBoxBackgroundImage(params.target);
70				};
71                //searchInput.placeholder = 'Bilaketa...';
72                var clearSearch = target.getElementsByTagName('a')[0];
73				clearSearch.removeAttribute('title');
74                var searchButton = document.getElementsByClassName('gsc-search-button-v2')[0];
75                var searchButtonTitle = searchButton.getElementsByTagName('title')[0];
76				searchButtonTitle.remove();
77				
78				addTooltip(clearSearch,'clearSearchTooltip',clearSearchText);
79				addTooltip(searchButton,'searchTooltip',searchText);
80				
81            }
82        }
83    });
84} else if (themeDisplay.getLanguageId() == 'es_ES') {
85	observer = new MutationObserver(function (mutationsList) {
86        for (const mutation of mutationsList) {
87            var target = mutation.target;
88			if (target.classList.contains('gsc-input-box')) {
89				var searchText = "Buscar";
90				var clearSearchText = "Limpiar búsqueda";
91				
92                var searchInput = target.getElementsByTagName('input')[0];
93                searchInput.title = searchText;
94                searchInput.ariaLabel = searchText;
95                //searchInput.placeholder = 'Búsqueda...';
96				
97                var clearSearch = target.getElementsByTagName('a')[0];
98				clearSearch.removeAttribute('title');
99                var searchButton = document.getElementsByClassName('gsc-search-button-v2')[0];
100                var searchButtonTitle = searchButton.getElementsByTagName('title')[0];
101				searchButtonTitle.remove();
102				
103				addTooltip(clearSearch,'clearSearchTooltip',clearSearchText);
104				addTooltip(searchButton,'searchTooltip',searchText);
105            }
106        }
107    });
108} else if (themeDisplay.getLanguageId() == 'en_US') {
109	observer = new MutationObserver(function (mutationsList) {
110        for (const mutation of mutationsList) {
111            var target = mutation.target;
112			if (target.classList.contains('gsc-input-box')) {
113				var searchText = "Search";
114				var clearSearchText = "Clean search";
115				
116                var searchInput = target.getElementsByTagName('input')[0];
117                searchInput.title = searchText;
118                searchInput.ariaLabel = searchText;
119                //searchInput.placeholder = 'Search...';
120				
121                var clearSearch = target.getElementsByTagName('a')[0];
122				clearSearch.removeAttribute('title');
123                var searchButton = document.getElementsByClassName('gsc-search-button-v2')[0];
124                var searchButtonTitle = searchButton.getElementsByTagName('title')[0];
125				searchButtonTitle.remove();
126				
127				addTooltip(clearSearch,'clearSearchTooltip',clearSearchText);
128				addTooltip(searchButton,'searchTooltip',searchText);
129            }
130        }
131    });
132}
133
134if (observer != null) {
135	var gsContainer = $(".google-search-container")[0];
136	observer.observe(gsContainer, {
137		childList: true,
138		subtree: true
139	});
140}
141
142function addTooltip (domElement, tooltipId, tooltipString) {
143	if (domElement.parentElement != null) {
144		var tooltipEl = document.createElement('span');
145		tooltipEl.setAttribute('role','tooltip');
146		tooltipEl.setAttribute('id',tooltipId);
147		tooltipEl.innerHTML = tooltipString;
148		domElement.parentElement.appendChild(tooltipEl);
149
150		domElement.setAttribute('aria-label',tooltipString);
151		domElement.setAttribute('data-tooltiped','true');
152		domElement.setAttribute('aria-describedby',tooltipId);
153	}
154}
155
156function replaceInputBoxBackgroundImage (searchInput) {
157	if (searchInput.style.backgroundImage.indexOf('branding') > -1) 
158		searchInput.style.backgroundImage='url("/documents/20945/84420371/branding_eu.png/482007ba-83d4-10e1-16ce-0ab68f473003")';
159}

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.