Skip to content

Instantly share code, notes, and snippets.

@threepointone
Created May 15, 2019 15:54
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 threepointone/e456be2706e44d003dfeb4d88cd15b31 to your computer and use it in GitHub Desktop.
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
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