Created
May 15, 2019 15:54
-
-
Save threepointone/e456be2706e44d003dfeb4d88cd15b31 to your computer and use it in GitHub Desktop.
count the number of images with alts on a twitter.com/USERNAME/media page
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
function count(){ | |
const images = [...$('.stream-item img')].filter(x => { | |
let classList = [...x.classList] | |
return !(classList.includes('avatar') || classList.includes('avatar--circular') || classList.includes('Emoji')) | |
}) | |
const alts = images.map(x => x.alt).filter(x => !!x) | |
return Math.ceil(alts.length/images.length*100) + '% coverage' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment