Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name altChecker
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *
// @icon https://www.google.com/s2/favicons?domain=wordpress.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addCssRule(rule) {
var head, style;
head = document.querySelector('head');
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = rule;
head.appendChild(style);
}
addCssRule("img[alt=''] { filter: blur(10px) !important; outline: 10px solid !important; }");
})();
@cogdog

This comment has been minimized.

Copy link

@cogdog cogdog commented Nov 4, 2021

Thanks Brian! I'm not getting any action, seeing in my console on every site I try:

Uncaught SyntaxError: missing ) after argument list

Sorry!

@bennettscience

This comment has been minimized.

Copy link
Owner Author

@bennettscience bennettscience commented Nov 4, 2021

Not sure why that's happening - this was copied and pasted right from the script running on my machine. Do you have other scripts running through Tampermonkey? Could be a conflict somewhere...

@cogdog

This comment has been minimized.

Copy link

@cogdog cogdog commented Nov 4, 2021

No monkey scripts here, but I just re-installed script and it works.

Also this might catch both empty alt and missing alt

 img[alt=””], img:not([alt]) {
    ….
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment