Skip to content

Instantly share code, notes, and snippets.

@eusonlito
Last active July 11, 2019 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eusonlito/93a06c410bad8c65f62a583cd5a28c2b to your computer and use it in GitHub Desktop.
Save eusonlito/93a06c410bad8c65f62a583cd5a28c2b to your computer and use it in GitHub Desktop.
Show Facebook alt titles generated to images
setInterval(function () {
document.querySelectorAll('div.img-title').forEach(function (title) {
title.parentNode.removeChild(title);
});
document.querySelectorAll('img.img').forEach(function (img) {
if (!img.alt) {
return;
}
var title = document.createElement('div');
title.innerHTML = img.alt;
title.className = 'img-title';
title.style = 'padding: 5px; background: black; color: white; font-weight: bold; opacity: 0.9; position: absolute; top: 0;';
img.parentNode.insertBefore(title, img.nextSlibing);
});
}, 2000);
setInterval(function () {
document.querySelectorAll('div.img-title').forEach(function (title) {
title.parentNode.removeChild(title);
});
document.querySelectorAll('img.FFVAD').forEach(function (img) {
if (!img.alt) {
return;
}
var title = document.createElement('div');
title.innerHTML = img.alt;
title.className = 'img-title';
title.style = 'padding: 5px; background: black; color: white; font-weight: bold; opacity: 0.9';
img.parentNode.insertBefore(title, img);
});
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment