1document.addEventListener('DOMContentLoaded', function () { 2 3 if (checkCookieExists('klaro')) { 4 createTooltip(); 5 } 6 7 setTimeout(function () { 8 const klaroDiv = document.getElementById('klaro'); 9 const buttons = klaroDiv.querySelectorAll('button'); 10 11 function handleClick(event) { 12 createTooltip(); 13 if (document.querySelector('#klaro .cookie-notice') == null && document.querySelector('#klaro .cookie-modal') == null) { 14 } 15 } 16 17 buttons.forEach(button => { 18 button.addEventListener('click', handleClick); 19 }); 20 }); 21 22 setTimeout(function () { 23 if (document.querySelector('.cm-link')) { 24 document.querySelector('.cm-link').addEventListener('click', function () { 25 if (document.querySelector('.cm-btn-success')) { 26 document.querySelector('.cm-btn-success').addEventListener('click', function () { 27 createTooltip(); 28 }); 29 } 30 31 if (document.querySelector('.cn-decline')) { 32 document.querySelector('.cn-decline').addEventListener('click', function () { 33 createTooltip(); 34 }); 35 } 36 37 if (document.querySelector('.cm-btn-accept-all')) { 38 document.querySelector('.cm-btn-accept-all').addEventListener('click', function () { 39 createTooltip(); 40 }); 41 } 42 }); 43 } 44 }, 1000); 45}); 46 47function checkCookieExists(cookieName) { 48 let cookies = document.cookie.split(';'); 49 50 for (let i = 0; i < cookies.length; i++) { 51 let cookie = cookies[i]; 52 // Remove leading spaces (if any) 53 while (cookie.charAt(0) == ' ') { 54 cookie = cookie.substring(1); 55 } 56 // Check if the cookie name matches 57 if (cookie.indexOf(cookieName + '=') == 0) { 58 return true; 59 } 60 } 61 return false; 62} 63 64function createTooltip() { 65 if (cookieIconPermanentlyAvailable === '1') { 66 let iconTooltip = document.createElement('div'); 67 let iconImgTag = document.createElement('img'); 68 let iconBtn = document.createElement('button'); 69 let iconContainer = document.createElement('div'); 70 71 // Button 72 iconBtn.type = 'button'; 73 iconBtn.className = 'consent-trigger js-showConsentModal'; 74 iconBtn.setAttribute('aria-label', translatedButtonTextCookieSettings); 75 iconBtn.setAttribute('aria-haspopup', 'dialog'); 76 77 // Image 78 iconImgTag.src = cookieSettingsImgPathDefault; 79 iconImgTag.alt = ''; 80 iconImgTag.setAttribute('aria-hidden', 'true'); 81 iconImgTag.width = 85; iconImgTag.height = 85; 82 iconImgTag.style.cssText = 'margin-right:0px;width:85px;height:85px;'; 83 84 // Hover/Fokus (Image & Tooltip) 85 function showTip(){ iconTooltip.style.display = 'block'; iconImgTag.src = cookieSettingsImgPathHover; } 86 function hideTip(){ iconTooltip.style.display = 'none'; iconImgTag.src = cookieSettingsImgPathDefault; } 87 88 iconBtn.addEventListener('mouseover', showTip); 89 iconBtn.addEventListener('mouseout', hideTip); 90 iconBtn.addEventListener('focusin', showTip); 91 iconBtn.addEventListener('focusout', hideTip); 92 93 // Tooltip 94 iconTooltip.textContent = translatedButtonTextCookieSettings; 95 iconTooltip.classList.add('consent-cookie-text'); 96 iconTooltip.style.cssText = 'display:none;'; 97 // (optional ARIA) 98 // tooltip.id = 'consent-tooltip'; 99 // tooltip.setAttribute('role', 'tooltip'); 100 // btn.setAttribute('aria-describedby', 'consent-tooltip'); 101 102 // Container 103 iconContainer.classList.add('consent-cookie'); 104 iconContainer.style.cssText = 'display:flex;'; 105 106 // DOM 107 iconBtn.appendChild(iconImgTag); 108 iconContainer.appendChild(iconBtn); 109 iconContainer.appendChild(iconTooltip); 110 document.body.appendChild(iconContainer); 111 } 112}
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.