`;
function showPrivacyMessage() {
document.querySelectorAll('iframe[data-source="codesnippet"], script[data-src], script[data-cmp-src]').forEach(el => {
if (el.tagName === 'IFRAME') {
const doc = el.contentDocument || el.contentWindow.document;
// Inject external stylesheet into the iframe's
const link = doc.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://www.cbsnews.com/fly/fly/bundles/cbsnewscontent/css/cmp-banner.min.css?v=d28384e2f39682c9d0b59d8b1005bcce';
doc.head.appendChild(link);
doc.body.innerHTML = CONSENT_MESSAGE;
} else {
el.insertAdjacentHTML('afterend', CONSENT_MESSAGE);
}
});
}
function hidePrivacyMessage() {
// Remove from the main document
document.querySelectorAll(`.${CONSENT_MESSAGE_CLASS}`).forEach(el => el.remove());
// Remove from inside any iframes
document.querySelectorAll('iframe').forEach(iframe => {
const doc = iframe.contentDocument || iframe.contentWindow.document;
doc.querySelectorAll(`.${CONSENT_MESSAGE_CLASS}`).forEach(el => el.remove());
});
}
function activateGatedScripts() {
// Handle both new format (cmp-gated-script) and old OneTrust/Ketch format (optanon-category-4)
const gatedScripts = Array.from(document.querySelectorAll('script.cmp-gated-script, script.optanon-category-4'));
// Activate scripts sequentially with a small delay to avoid timing issues
let delay = 0;
gatedScripts.forEach(function(placeholder, index) {
setTimeout(function() {
// Skip if already processed
if (placeholder.hasAttribute('data-cmp-processed')) {
return;
}
placeholder.setAttribute('data-cmp-processed', 'true');
const newScript = document.createElement('script');
newScript.type = 'text/javascript';
// Try new format first (data-cmp-src), then fall back to old format (data-src)
const src = placeholder.getAttribute('data-cmp-src') || placeholder.getAttribute('data-src');
if (src) {
newScript.src = src;
} else if (placeholder.textContent) {
// Inline script - just copy the content
newScript.textContent = placeholder.textContent;
}
// Handle new format attributes (data-cmp-attrs) - for both inline and external scripts
const attrs = placeholder.getAttribute('data-cmp-attrs');
if (attrs) {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = '
';
const tempAttrs = tempDiv.firstChild.attributes;
for (let i = 0; i