Skip to content

Instantly share code, notes, and snippets.

@ubershmekel
Last active April 23, 2018 09:33

Revisions

  1. ubershmekel revised this gist Apr 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion show-alts.js
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ setInterval(function() {
    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: 1px 1px #000; color: #fff;font-weight: bold;");
    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");
    }
  2. ubershmekel revised this gist Apr 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion show-alts.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    // It's an interesting peek into how facebook analyzes your images.

    setInterval(function() {
    var imgs = document.querySelectorAll("img")
    var imgs = document.querySelectorAll("img");
    for (var i = 0; i < imgs.length; i++) {
    var alt = imgs[i].alt;
    if (alt && !imgs[i].getAttribute("alted")) {
  3. ubershmekel created this gist Apr 23, 2018.
    17 changes: 17 additions & 0 deletions show-alts.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // 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: 1px 1px #000; color: #fff;font-weight: bold;");
    imgs[i].parentElement.prepend(div);
    imgs[i].setAttribute("alted", "1");
    }
    }
    }, 1000);