1document.addEventListener("DOMContentLoaded", () => { 2 console.log("Ready"); 3 hideExternalSources(); 4}); 5document.addEventListener("load", () => { 6 console.log("Load"); 7 hideExternalSources(); 8}); 9document.addEventListener("readystatechange", (e) => { 10 console.log("Ready State Change: ", e); 11 hideExternalSources(); 12}); 13const hideExternalSources = () => { 14 const frames = document.getElementsByTagName("iframe"); 15 for (let i = 0; i < frames.length; i++) { 16 const frame = frames[i]; 17 if (frame) { 18 if (frame.dataset.processed === "true") { 19 continue; 20 } 21 if (frame.hidden === true) { 22 frame.dataset.processed = "true"; 23 const hash = crypto.getRandomValues(new Uint32Array(10)).toString(); 24 const url = frame.dataset.src; 25 console.log("Frame: ", frame); 26 console.log("Frame URL: ", url); 27 frame.dataset.hash = hash; 28 let host = "Unbekannter Anbieter"; 29 if (url !== "") { 30 const urlObj = new URL(url); 31 const parts = urlObj.hostname.split('.'); 32 // gets the main domain 33 host = parts.slice(-2).join('.'); 34 } 35 console.log("Host: ", host); 36 if ([ 37 "youtube.com", 38 "youtube-nocookie.com", 39 "www.google.com", 40 "google.com", 41 "facebook.com", 42 "player.vimeo.com", 43 "vimeo.com", 44 "twitter.com", 45 "x.com", 46 "facebook.com", 47 "delbrueck.tv", 48 "direct-book.com", 49 "zink-portal.de" 50 ].includes(host)) { 51 const parent = frame.parentElement; 52 const container = document.createElement("div"); 53 container.classList.add("frameConsentLayer"); 54 const titleSentence = document.createElement("p"); 55 titleSentence.innerText = `Hier können Sie sich Inhalte von ${host} anzeigen lassen.`; 56 titleSentence.style.fontWeight = "bold"; 57 container.appendChild(titleSentence); 58 const consentSentence = document.createElement("p"); 59 consentSentence.innerText = `Stimmen Sie zu, stellt Ihr Browser eine Verbindung mit ${host} her, dabei werden möglicherweise personenbezogene Daten in Drittländer übermittelt.`; 60 container.appendChild(consentSentence); 61 const privacyLink = document.createElement("a"); 62 if (privacyLink) { 63 privacyLink.href = "/datenschutz"; 64 privacyLink.innerHTML = "Erhalten Sie hier mehr Informationen zum Thema <b>Datenschutz</b>"; 65 container.appendChild(privacyLink); 66 } 67 const confirmButton = document.createElement("button"); 68 confirmButton.innerText = "Zustimmen"; 69 confirmButton.type = "button"; 70 confirmButton.onclick = (e) => { 71 e.preventDefault(); 72 const iFrame = parent.querySelector(`iframe[data-hash="${hash}"]`); 73 console.log("Found iFrame: ", iFrame); 74 iFrame.hidden = false; 75 iFrame.src = iFrame.dataset.src; 76 container.remove(); 77 }; 78 container.appendChild(confirmButton); 79 parent.appendChild(container); 80 } 81 else { 82 console.warn("Host found that is not in list: ", host); 83 const parent = frame.parentElement; 84 const iFrame = parent.querySelector(`iframe[data-hash="${hash}"]`); 85 iFrame.hidden = false; 86 iFrame.src = iFrame.dataset.src; 87 } 88 } 89 } 90 } 91 const forms = document.forms; 92 console.log("Found Forms: ", forms.length); 93 for (let i = 0; i < forms.length; i++) { 94 const form = forms[i]; 95 const recaptcha = form.getElementsByClassName("g-recaptcha")[0]; 96 if (recaptcha) { 97 if (recaptcha.dataset.processed === "true") { 98 continue; 99 } 100 if (recaptcha.hidden === true) { 101 const button = document.createElement("button"); 102 button.type = "button"; 103 button.classList.add("consentButton"); 104 button.innerText = "Ich stimme der Ãbertragung von personenbezogenen Daten in Drittländer zu."; 105 button.onclick = (e) => { 106 e.preventDefault(); 107 recaptcha.hidden = false;
108 button.remove(); 109 }; 110 recaptcha.dataset.processed = "true"; 111 recaptcha.insertAdjacentElement("beforebegin", button); 112 } 113 } 114 } 115 // option to enable / disable consent for specific containers 116 // if consent is only given one time, we don't have to save anything 117 // if consent is given for every option: Save chosen services via array in localStorage 118 // manager to change permanent consent every time? 119 // should there be a countdown when every option is getting reset? 120}; 121//# sourceMappingURL=iFrame.js.map
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.