1/** 2 * add listener to load map 3 */ 4document.addEventListener('DOMContentLoaded', () => { 5 const links = document.querySelectorAll('.js-gme-show'); 6 const previews = document.querySelectorAll('.js-gme-preview'); 7 const mapContainers = document.querySelectorAll('.js-gme-container'); 8 const useCookies = previews[0] && previews[0].dataset.cookie === '1'; 9 10 if (useCookies && getCookie('tx_gomapsext_show_map')) { 11 showMap(); 12 } else { 13 mapContainers.forEach(mapContainer => { 14 mapContainer.style.display = 'none'; 15 }); 16 17 links.forEach(link => { 18 link.addEventListener('click', e => { 19 e.preventDefault(); 20 showMap(); 21 if (useCookies) { 22 setCookie('tx_gomapsext_show_map', 1, '/'); 23 } 24 }); 25 }); 26 } 27 28 function showMap() { 29 if (typeof google === 'undefined' || typeof google.maps === 'undefined') { 30 const script = document.createElement('script'); 31 script.src = links[0].dataset.library; 32 document.body.appendChild(script); 33 mapContainers.forEach(mapContainer => { 34 mapContainer.style.display = 'block'; 35 }); 36 } 37 38 previews.forEach(preview => { 39 preview.remove(); 40 }); 41 } 42 43 function getCookie(name) { 44 const value = `; ${document.cookie}`; 45 const parts = value.split(`; ${name}=`); 46 if (parts.length === 2) { 47 return parts.pop().split(';').shift(); 48 } 49 } 50 51 function setCookie(name, value, path) { 52 document.cookie = `${name}=${value}; path=${path}`; 53 } 54});
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.