Last active
November 30, 2020 20:57
-
-
Save tbrisbout/edab390109c36cd8299914245b0ca109 to your computer and use it in GitHub Desktop.
Leanpub word count
This file contains hidden or 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
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