Fix accumulation of ad <style> tags
This commit is contained in:
parent
8303856a06
commit
c66f597f09
1 changed files with 10 additions and 0 deletions
|
@ -99,6 +99,16 @@ function Ads(props: Props) {
|
||||||
delete window.__VIDCRUNCH_CONFIG_618bb4d28aac298191eec411__;
|
delete window.__VIDCRUNCH_CONFIG_618bb4d28aac298191eec411__;
|
||||||
delete window.__player_618bb4d28aac298191eec411__;
|
delete window.__player_618bb4d28aac298191eec411__;
|
||||||
|
|
||||||
|
const styles = document.querySelectorAll('body > style');
|
||||||
|
styles.forEach((s) => {
|
||||||
|
// We are asking Adnimation to supply us with a specific ID or
|
||||||
|
// pattern so that our query wouldn't break when they change their
|
||||||
|
// script. For now, this is the "best effort".
|
||||||
|
if (s.innerText && s.innerText.startsWith('#outbrain')) {
|
||||||
|
s.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// clean DOM elements from ad related elements
|
// clean DOM elements from ad related elements
|
||||||
removeIfExists('[src^="https://player.avplayer.com"]');
|
removeIfExists('[src^="https://player.avplayer.com"]');
|
||||||
removeIfExists('[src^="https://gum.criteo.com"]');
|
removeIfExists('[src^="https://gum.criteo.com"]');
|
||||||
|
|
Loading…
Reference in a new issue