Open a Random Page in VoodooPad

I recently fell in love with a little tool called VoodooPad by Flying Meat. VoodooPad is a personal wiki or desktop wiki; the perfect place to develop and structure ideas. However, as far as I know, it misses an essential feature for any wiki system: the random page button!

Luckily, VoodooPad is very scriptable, so I came up with this JSTalk plugin. Installation instructions are included in the README for those of you who are new to scripting VoodooPad.

I also created a Downloads page where you will permanently find a pointer to this and, in the future, other stuff I publish here and elsewhere.

For those interested in the programming aspect of the plugin: Yes, it seems rather long and convoluted for such a small purpose, I’ll admit that, but hear my excuses:

  1. Javascript actually allows for some pretty succinct code, but unfortunately using a bridge like JSTalk/JSCocoa destroys this possibility in this case mainly due to the mixing of object systems and “primitive” types like strings. Bridges generally suck because of this and other things, but we knew that already.
  2. I am a perfectionist and wanted to make every page equally probable. You can draw up a list of pages and pick a random one in one line of code, but VoodooPad includes aliases in this list, making those pages with lots of aliases pointing to them more likely to appear with this approach. I then used this “opportunity” to also filter out the files you might have stored in your VoodooPad document.
  3. This is actually the first “significant” block of JavaScript code I ever wrote.