Last active
June 16, 2021 15:55
-
-
Save JAffleck/b75b156b3c70725a952f66fa5f927a6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var CLASS = 'hide-images'; | |
var STYLE = 'html body,html body *,html body *::before,html body *::after { background-image: none !important; } html body img, html body svg, html body video, html body iframe { opacity: 0.02 !important; }'; | |
var block = document.querySelector('.' + CLASS); | |
// add/remove style block to override images | |
if (block) block.remove(); | |
else { | |
block = document.createElement('style'); | |
block.className = CLASS; | |
block.innerHTML = STYLE; | |
document.head.appendChild(block); | |
} | |
})(); | |
///////////////////////// | |
// Unfortunately you have to let these load before it will hide them | |
javascript:(function(){var a="hide-images",b="html body,html body *,html body *::before,html body *::after { background-image: none !important; } html body img, html body video, html body svg, html body iframe { opacity: 0.02 !important; }",c=document.querySelector("."+a);c?c.remove():(c=document.createElement("style"),c.className=a,c.innerHTML=b,document.head.appendChild(c))})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This might be an approach to remove iframes/images
http://dyn-web.com/tutorials/iframes/hidden/
And another approach: (mess with opacity, won't save laptop battery though.)
https://medium.com/@zachcaceres/dont-use-display-none-to-hide-iframes-in-safari-b51715eb22c4
https://blog.logrocket.com/the-ultimate-guide-to-iframes/
// This would remove all img elements (could do same with iframes, maybe do something similar with adding hidden to the element)
https://codepen.io/anthonyLukes/pen/DaGtF