Last active
April 23, 2018 09:33
-
-
Save ubershmekel/2fb69d70e0a8a1ff4e823c2e5378533c to your computer and use it in GitHub Desktop.
See alt descriptions js console snippet
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
// Paste the following into your js console while viewing images, e.g. on your facebook feed. | |
// It will show the "alt" attributes that facebook assigned your images. | |
// It's an interesting peek into how facebook analyzes your images. | |
setInterval(function() { | |
var imgs = document.querySelectorAll("img"); | |
for (var i = 0; i < imgs.length; i++) { | |
var alt = imgs[i].alt; | |
if (alt && !imgs[i].getAttribute("alted")) { | |
var div = document.createElement("div"); | |
div.append(document.createTextNode(alt)); | |
div.setAttribute("style", "position: absolute; top: 0; left: 0; z-index: 100; text-shadow: 0 0 4px #000; color: #fff;font-weight: bold;"); | |
imgs[i].parentElement.prepend(div); | |
imgs[i].setAttribute("alted", "1"); | |
} | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment