1// document.addEventListener('iframeConfirm', function() { 2// var iframeId = 'iframemaengel'; 3// var wdwDomain = 'https://buergeranliegen.dachau.de'; 4// 5// function getParameterByName(name) { 6// name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 7// var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 8// results = regex.exec(location.search); 9// return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 10// } 11// 12// iFrameResize(); 13// var frame = document.getElementById(iframeId); 14// 15// if(frame) { 16// var uri = getParameterByName("uri"); 17// if (uri != '' && uri.indexOf("http://") == -1 && uri.indexOf("https://") 18// == -1) { 19// if ( wdwDomain.substr(wdwDomain.length - 1) == '/' ) { 20// wdwDomain = wdwDomain.slice(0, -1); 21// } 22// frame.src = wdwDomain + uri; 23// } 24// frame.onload = function () { 25// window.scrollTop = window.scrollTo(0,0); 26// }; 27// } else { 28// console.warn("[WDW]: Element '#"+iframeId+"' nicht gefunden"); 29// } 30// }); 31// Set the Imfo size to actual Iframe Size 32document.querySelectorAll('.external-iframe-security').forEach((item) => { 33 if(item.dataset.width) { 34 item.style.width = item.dataset.width + 'px'; 35 } 36 if(item.dataset.height) { 37 item.style.height = item.dataset.height + 'px'; 38 } 39}); 40 41document.addEventListener("DOMContentLoaded", function (event) { 42 43 // Find all iframe security blocks 44 var frames = document.querySelectorAll('.external-iframe-security'); 45 for (var i = 0; i < frames.length; i++) { 46 47 // get the attributes and content data from iframe 48 var attributes = frames[i].attributes['data-attributes']; 49 var content = frames[i].attributes['data-content']; 50 51 // parse attributes from json to object 52 var attr = JSON.parse(atob(attributes.value)); 53 54 // create iframe element 55 const iframe = document.createElement('iframe'); 56 57 // register on iframe confirm event 58 const onIframeConfirm = document.createEvent('HTMLEvents'); 59 onIframeConfirm.initEvent('iframeConfirm', true, true); 60 onIframeConfirm.eventName = 'iframeConfirm'; 61 62 // set attributes to iframe 63 for (var key in attr) { 64 if (attr.hasOwnProperty(key)) { 65 iframe.setAttribute(key, attr[key]); 66 } 67 } 68 69 // parse iframe content 70 const index = i; 71 iframe.innerHTML = atob(content.value); 72 73 // Check if consent manager exists... 74 if (window.cm) { 75 window.cm.registerHandler('iframes', function (enabled) { 76 if (enabled) { 77 // ... and render iframe, if consent for iframes is enabled 78 if(frames[index]){ 79 frames[index].parentNode.replaceChild(iframe, frames[index]); 80 81 // create event when the iframe is done getting replaced 82 // this hook can be used for resizing iframes for example 83 const iframeReplaceCompleteEvent = document.createEvent('HTMLEvents'); 84 iframeReplaceCompleteEvent.initEvent('iframeReplaceComplete', true, true); 85 document.dispatchEvent(iframeReplaceCompleteEvent); 86 } 87 } 88 }); 89 } 90 91 let inputfield = frames[i].querySelector('input[type="submit"], a.submit-iframe'); 92 // check if input field is set ... 93 if(inputfield){ 94 // ... and register click event for confirmation button 95 inputfield.addEventListener("click", function () { 96 97 // replace iframe security block with iframe 98 frames[index].parentNode.replaceChild(iframe, frames[index]); 99 100 // call iframe confirm event 101 iframe.onload = function () {
102 iframe.dispatchEvent(onIframeConfirm); 103 } 104 }); 105 } 106 107 // Button to directly consent to the iframes 108 let allowAllButton = frames[i].querySelector('input[type="submit"], a.submit-all-iframe'); 109 // check if input field is set ... 110 if(allowAllButton){ 111 // ... and register click event for confirmation button 112 allowAllButton.addEventListener("click", function () { 113 console.log(allowAllButton); 114 window.cm.changeConsent('iframes',true); 115 }); 116 } 117 } 118 } 119);
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.