';
// Add textoverlay inside reddit emded div
jQuery('.wp-block-embed-reddit').each(function(index,element) {
if (element.closest(".wp-block-embed-reddit")?.querySelectorAll('.external-embed-wrapper')?.length === 0) {
jQuery(element).prepend(redditTextOverlay);
}
});
}
setTimeout(redditDisplayTextoverlay, 0);
}
});
jQuery(document).on("click",".consent-button",function() {
var buttonElement = event.target;
var embedType = jQuery(buttonElement).data('type');
if(embedType === 'reddit') {
/*
* Find all reddit iframes and
* add a src attribute with the value from data-src
*/
jQuery('.wp-block-embed-reddit iframe').each(function(index,element) {
jQuery(element).attr('src', jQuery(element).attr('data-src'));
jQuery(element).css({'z-index': 'initial', 'display': 'initial'});
});
}
/*
* Now the embedded content should be loading
* so we can hide all text-overlays with this data-type
*/
jQuery('.embed-consent-notice[data-type="'+ embedType +'"]').hide();
});