Word count in Kinopio (bookmarklet)
Prompted by humdrum’s post in Futureland about not using Kinopio for his morning pages because it lacked word count, I hacked together this code to add word count via a bookmarklet.
let wordCountWrapper = document.createElement("div")
wordCountWrapper.className = "button-wrap"
let wordCountButton = document.createElement("button")
wordCountButton.id = "word-count"
wordCountWrapper.appendChild(wordCountButton)
document.querySelector(".top-buttons-wrap").appendChild(wordCountWrapper)
let intervalID = setInterval(
() =>
(document.querySelector("#word-count").innerHTML = document
.querySelector("#app")
.__vue__.$store.state.currentSpace.cards.reduce(
(acc, current) => acc + current.name.split(/\s+/).length,
0
)),
1000
)
And again, I used https://caiorss.github.io/bookmarklet-maker/ to generate the bookmarklet. For good hygiene, you should probably generate it yourself. But here’s also one you can use by dragging to your bookmarks:
In order to get this working in iOS, the easiest way is to add this bookmarklet to Safari on Mac, and then let iCloud sync it over.
I put the word count in a button in the upper-right corner like so:
Thursday, September 9, 2021