Skip to content

Instantly share code, notes, and snippets.

@1UPNuke
Last active February 20, 2021 02:04
Show Gist options
  • Select an option

  • Save 1UPNuke/742624e2945a59344326afd7b77efab6 to your computer and use it in GitHub Desktop.

Select an option

Save 1UPNuke/742624e2945a59344326afd7b77efab6 to your computer and use it in GitHub Desktop.
User script that replaces the twitter box denoting the image has ALT text with the real ALT text.
// ==UserScript==
// @name Twitter show ALT text
// @version 1.0.0
// @author 1-UP Nuke
// @icon https://abs.twimg.com/favicons/twitter.ico
// @description Replaces the twitter box denoting the image has ALT text with the real ALT text.
// @match https://*.twitter.com/*
// @grant none
// ==/UserScript==
window.addEventListener('load', function() {
setInterval(()=>{
for(let span of document.querySelectorAll('span'))
{
if(span.textContent == 'ALT')
{
let altBox = span.parentElement.parentElement;
altBox.style.maxWidth = '90%';
altBox.style.height = 'max-content';
span.textContent = 'ALT: ' + altBox.parentElement.querySelector('img').alt;
}
}
},
1000
)
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment