Skip to content

Instantly share code, notes, and snippets.

@tbrisbout
Last active November 30, 2020 20:57
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 tbrisbout/edab390109c36cd8299914245b0ca109 to your computer and use it in GitHub Desktop.
Save tbrisbout/edab390109c36cd8299914245b0ca109 to your computer and use it in GitHub Desktop.
Leanpub word count
const wc = () => Array.from(document.querySelectorAll('.view-lines div span span')).map(e => e.innerText.split(/\s/)).flat().filter(x => /\w+/.test(x)).length
setInterval(() => { document.querySelector('.save-text.in-page').innerText = wc() + ' words' }, 5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment