javascript:void(function(){setInterval(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})},100)}()); |
Why show "random" number and remove all form body?
<html><head></head><body>1229</body></html>
Nothing in this code does that. All this does is delete all the iframe elements from the page every 100ms.
So my Firefox 71 RC4 is broken...
Even if a page has an iframe, it still unloads all the content from the page (change into "random" number).
@krystian3w I just fixed it for Firefox. Firefox apparently likes to display the return value of the bookmarklet code. The random number was the timer ID. Happy iframe killing.
I made it also remove script elements, so now news sites are actually pleasant to visit :)
javascript:void(function(){setInterval(function(){document.querySelectorAll('iframe,script').forEach(function(element){element.parentNode.removeChild(element)})},100)}());
May no functional, scripts may need HTML filtering before parse site or fast abort action:
https://github.com/gorhill/uBlock/wiki/Resources-Library / https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#scriptlets
Cool info! Thanks for sharing.
Rod @rodmcnew or James @JAffleck how about just to engage one time when activating the bookmarklet instead of spawning every 100ms. ?
Can you make simpler script?
What about UserScript version,this way some websites can be excluded with @grant GM_getResourceURL
and @exclude .....
?
Great work though,keep it up
@dnmTX
Here is a version that runs once only when clicked:
javascript:void(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})}());
UserScript and website excludes: Could be interesting. Good luck if someone tries. Similar things may already exist somewhere.
Rod @rodmcnew,with a slight delay i'm back to thank you. The truth is i ended up using your first creation due to stubborn websites like
amazon.com,imdb.com and whatnot respawning those f*ckers all the time
The UserScript actually is coming up nicely,i'm in the final stages but banging my head here how to implement to check first if the page has any iframes at all and if not to quit altogether. For example,this is telling me if there are any or there aren't:
(function() { if (document.querySelector('iframe') == null) console.log("no iframes"); else console.log("iframes exist");}
You mind providing some assistance,anything will be greatly appreciated. If you want i can paste here what i got so far.
Either way,big THANK YOU
Why show "random" number and remove all form body?