Word count in Kinopio (bookmarklet)

· Ben’s Blog


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.

 1let wordCountWrapper = document.createElement("div")
 2wordCountWrapper.className = "button-wrap"
 3let wordCountButton = document.createElement("button")
 4wordCountButton.id = "word-count"
 5wordCountWrapper.appendChild(wordCountButton)
 6document.querySelector(".top-buttons-wrap").appendChild(wordCountWrapper)
 7let intervalID = setInterval(
 8  () =>
 9    (document.querySelector("#word-count").innerHTML = document
10      .querySelector("#app")
11      .__vue__.$store.state.currentSpace.cards.reduce(
12        (acc, current) => acc + current.name.split(/\s+/).length,
13        0
14      )),
15  1000
16)

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:

word count

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:

screenshot of Kinopio with word count