by schiffern · 2y ago · 0 comments
I should have mentioned this is paired with uBlock Origin to block Youtube iframes (and indeed all iframes) globally. At the time I was writing it to unbreak embedded videos.
https://github.com/gorhill/uBlock/wiki/Dynamic-filtering:-qu...
https://github.com/gorhill/uBlock/wiki/Blocking-mode
https://github.com/gorhill/uBlock/wiki/Blocking-mode:-medium...
From uBO My Rules tab:
* youtube-nocookie.com * block
* youtube.com * block
* ytimg.com * block
youtube.com youtube.com * noop
youtube.com ytimg.com * noop
To block all iframes (except sites you whitelist, see links above): * * 3p-frame blockI do have the 3rd party iframes blocked globally in uBo Firefox and works great with your script to replace the placeholder elements but Safari lacks an alternative sadly afaik
// improve styling
img.className = frame.className;
img.id = frame.id;
img.style.width = frame.width +"px";
That last line is a hack (eg resizing), but it's required to make the test website work since annoyingly their CSS uses :is(frame).