1window.ConsentHelpers = window.ConsentHelpers || {}; 2 3window.ConsentHelpers.vendors = { 4 "youtube": "c:youtube", 5 "soundcloud": "c:soundclou-NPBpAR4U" 6} 7 8window.ConsentHelpers.handleOverlay = function (overlay, hideOverlay) { 9 const iframe = overlay.querySelector("iframe[data-src]"); 10 if (!iframe || !overlay) return; 11 const src = iframe.getAttribute("data-src"); 12 hideOverlay ? iframe.setAttribute("src", src) : iframe.removeAttribute("src"); 13 overlay.querySelector(".embedded-content__overlay").style.display = hideOverlay ? "none" : "flex"; 14} 15 16window.ConsentHelpers.upateConsent = function (vendor, consentStatus) { 17 const elements = document.querySelectorAll(`[data-vendor="${vendor}"]`); 18 if (!elements) return undefined; 19 elements.forEach(x => ConsentHelpers.handleOverlay(x, consentStatus)); 20 return elements; 21} 22 23window.ConsentHelpers.acceptConsentForVendor = function (e) { 24 var targetEl = e.target.closest('.embedded-content__accept'); 25 if (!targetEl || !e.currentTarget.contains(targetEl)) return; 26 if (!Didomi) return; 27 const vendorId = ConsentHelpers.vendors[e.currentTarget.dataset?.vendor]; 28 if (!vendorId) return; 29 const { didomiId, purposeIds } = Didomi.getVendorById(vendorId); 30 if (!didomiId || !purposeIds) return; 31 const transaction = Didomi.openCurrentUserStatusTransaction(); 32 transaction.enableVendor(didomiId); 33 transaction.enablePurposes(purposeIds); 34 transaction.commit(); 35} 36 37window.ConsentHelpers.getUserConsentStatusForVendor = function(vendor) { 38 var vendorId = ConsentHelpers?.vendors?.youtube; 39 if (!vendorId) return null; 40 return Didomi.getUserConsentStatusForVendor(vendorId); 41} 42 43window.ConsentHelpers.setUserConsentAndPurposesForVendor = function (vendor) { 44 var vendorId = ConsentHelpers?.vendors?.youtube; 45 if (!vendorId) return null; 46 const { didomiId, purposeIds } = Didomi.getVendorById(vendorId); 47 if (!didomiId || !purposeIds) return; 48 const transaction = Didomi.openCurrentUserStatusTransaction(); 49 transaction.enableVendor(didomiId); 50 transaction.enablePurposes(purposeIds); 51 transaction.commit(); 52} 53 54window.didomiOnReady = window.didomiOnReady || []; 55window.didomiOnReady.push(function (Didomi) { 56 let elements = []; 57 if (Didomi.isConsentRequired()) { 58 Didomi.getObservableOnUserConsentStatusForVendor(ConsentHelpers.vendors.youtube).subscribe(function (consentStatus) { 59 const result = ConsentHelpers.upateConsent("youtube", consentStatus); 60 result.length && elements.push(...result); 61 }); 62 Didomi.getObservableOnUserConsentStatusForVendor(ConsentHelpers.vendors.soundcloud).subscribe(function (consentStatus) { 63 const result = ConsentHelpers.upateConsent("soundcloud", consentStatus); 64 result.length && elements.push(...result); 65 }); 66 } 67 elements.length && elements.forEach(e => { 68 e.addEventListener("click", ConsentHelpers.acceptConsentForVendor) 69 }) 70 elements = []; 71});
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.