PeeGee's Script

From Librivox wiki
Jump to navigationJump to search

PeeGee's script

LibriVox member peegee has written a script for web browsers which may make the BC's job of compiling word counts for the Magic Window a little easier.

How it Works

The script runs against the HTML ebooks on Project Gutenberg.

  1. you click the paragraph where you want to start the count,
  2. it asks you the target number of words,
  3. it quickly goes through every paragraph from that point onwards and counts the words and the running total
  4. it stops when it reaches the target, or the end of the chapter if before
  5. the page is temporarily changed to display the word counts right there at the end of each paragraph
  6. you can repeat this as many times as you like, each time you click a paragraph the temporary page changes are removed


Here are a few screenshots to illustrate the process:

Installing the Script

The method of installation depends on the browser (Firefox and Chrome may need to be re-started after installation, Opera does not):


  1. Greasemonkey You will first need the GreaseMonkey add-on for Firefox which is available from this link.
  2. Firefox Install Once you have GreaseMonkey installed, go here and click on the Install button

Google Chrome

  1. TamperMonkey First you'll need to install TamperMonkey from the Chrome store.
  2. WordCount Then, you'll be able to install the word count extension from here.


  1. To enable User JavaScript, use Tools > Preferences > Advanced > Content > JavaScript options, and select the directory where you will put your User JavaScript files (probably best if its a new folder with nothing else in it).
  2. the script then go to the script
  3. click the Install button to get the script in a new tab in Opera.
  4. from the Opera menu click File > Save As to save it into the folder you chose in the first step (probably best to just keep the suggested file-name - whatever name you choose it MUST end in .user.js )


The script only works on the Gutenberg online HTML books, not the text or zipped HTML, or other formats.


If you have any problems installing or using this script you can either post a message in this forum thread or send a Private Message to peegee.