1 2function selectAllCookieTypes() { 3 document.getElementById('cookieSettingsEssential').checked = true; 4 document.getElementById('cookieSettingsStatistics').checked = true; 5 document.getElementById('cookieSettingsThirdparty').checked = true; 6} 7 8function dispatchCookieSettingsEvent() { 9 var event; 10 if (typeof (Event) === 'function') { 11 event = new Event('CookieSettingsChanged'); 12 } else { 13 // do not crash the IE 14 event = document.createEvent('Event'); 15 event.initEvent('CookieSettingsChanged', true, true); 16 } 17 window.dispatchEvent(event); 18} 19 20function setCookieSettings(_cookieSettings) { 21 var cookieSettings = { 22 // dont save unused keys 23 essential: _cookieSettings.essential || true, 24 statistics: _cookieSettings.statistics || false, 25 thirdparty: _cookieSettings.thirdparty || false, 26 cookiesAccepted: _cookieSettings.cookiesAccepted || false, 27 }; 28 if (cookieSettings) { 29 localStorage.setItem('cookieSettings', JSON.stringify(cookieSettings)); 30 } else { 31 localStorage.removeItem('cookieSettings'); 32 } 33 dispatchCookieSettingsEvent(); 34} 35 36function getCookieSettings() { 37 var thisScript = document.getElementById('cookieSettingsScript'); 38 var enabled = thisScript.dataset.cookieSettingsEnabled === 'true'; 39 var tracking = thisScript.dataset.tracking === 'true'; 40 41 if (!enabled) { 42 return { 43 essential: true, 44 statistics: true, 45 thirdparty: true, 46 cookiesAccepted: true, 47 enabled: false, 48 tracking: false 49 }; 50 } 51 52 var defaultCookieSettings = { 53 essential: true, 54 statistics: false, 55 thirdparty: false, 56 cookiesAccepted: false, 57 }; 58 59 var cookieSettings = null; 60 61 try { 62 cookieSettings = JSON.parse(localStorage.getItem('cookieSettings')); 63 } catch(e) { 64 console.log(e); 65 } 66 67 if (!cookieSettings) { 68 cookieSettings = defaultCookieSettings; 69 // setCookieSettings(cookieSettings); 70 } 71 72 cookieSettings.enabled = enabled; 73 cookieSettings.tracking = tracking; 74 return cookieSettings; 75} 76 77function initCookieSettingsDialog() { 78 var cookieSettings = getCookieSettings(); 79 document.getElementById('cookieSettingsStatistics').checked = cookieSettings.statistics === true; 80 document.getElementById('cookieSettingsThirdparty').checked = cookieSettings.thirdparty === true; 81} 82 83function openCookieSettings() { 84 initCookieSettingsDialog(); 85 document.getElementById('cookieSettingsDialog').classList.add('visible'); 86} 87 88function closeCookieSettings() { 89 document.getElementById('cookieSettingsDialog').classList.remove('visible'); 90} 91 92function saveCookieSettings() { 93 var cookieSettings = getCookieSettings(); 94 var statistics = document.getElementById('cookieSettingsStatistics').checked === true; 95 var thirdparty = document.getElementById('cookieSettingsThirdparty').checked === true; 96 var reboot = cookieSettings.statistics && !statistics || cookieSettings.thirdparty && !thirdparty; 97 cookieSettings.cookiesAccepted = true; 98 cookieSettings.statistics = statistics; 99 cookieSettings.thirdparty = thirdparty; 100 setCookieSettings(cookieSettings); 101 closeCookieSettings(); 102 if (reboot) { 103 document.location.reload(); 104 } 105} 106 107function resetCookieSettings() { 108 setCookieSettings(null); 109} 110 111(function() { 112 var cookieSettings = getCookieSettings(); 113 if (cookieSettings.enabled) { 114 window.addEventListener('CookieSettingsChanged', initCookieSettingsDialog); 115 // changed outside this document 116 window.addEventListener('storage', dispatchCookieSettingsEvent); 117 if (!cookieSettings.cookiesAccepted) { 118 openCookieSettings(); 119 } 120 } 121})(); 122 123 124// neu 125 126document.addEventListener('DOMContentLoaded', function() { 127 // set popup to display none if the close btn was clicked 128 var closeBtn = document.querySelector('.cm-cookie-header__close-button'); 129 if (closeBtn) { 130 closeBtn.addEventListener('click', closeCookieSettings); 131 } 132 133 // open the expansion panels and rotating the icon 134 var expandBtn = document.querySelectorAll('.cm-cookie-expand-wrapper'); 135 for(var i = 0; i < expandBtn.length; i++ ) { 136 expandBtn[i].addEventListener('click', function() { 137 this.children[1].classList.toggle('cm-cookie-content-expansion-button--rotate'); 138 this.parentNode.nextElementSibling.classList.toggle('cm-cookie-content-expansion-text--open'); 139 }); 140 } 141});
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.