Finally something useful15 Apr 2008
A couple days ago, I was asking around to learn if there was a blogclient for Blogger/blogspot. I've been looking for one because I want to extend it with some kind of macro system, so I can easily integrate pictures from my own webspace.
When someone suggested "firefox", I was of course assuming he was kidding (and he actually was). But that gave me an idea I hadn't considered before.
Firefox has the ability to load add-ons for extra functionality. Now I'm not a great fan of firefox (in fact, the only time I use it is when I need to view some crappy flash blob and only installed the flash plugin in firefox, on purpose. It gives me pleasure to see firefox and flash crash together), but the ability to extend the browser with user-scripts is something I miss in other browsers.
I use Opera, and Opera can load Greasemonkey scripts. I've written a Greasemonkey script before (Warning: dutch content), and this was a good excuse to do it again.
After some coding, I finally have it working in firefox and Opera. The main idea is to "hijack" the submit() function of the textarea, and do some encoding magic there before submitting the data to blogger.com.
I keep the original data in the post, but completely commented out and between 2 distinct tags. The plugin detects those tags, extracts the data between it and places that data in the textarea.
On submit, the data in the textarea is processed and all "[ IMG: xxx ]" tags are replaced with suitable HTML code. the original data is then placed between tags and inside a comment block, and then the expanded HTML code follows.
It's not that difficult, but very very handy.
(look at the sourcecode of this post and spot the commented section)
The thumbnails are generated on my data repository, in the "thumb" thread. Sourcecode of the thumbnail generation script can be found here
It's worth noting that the greasemonkey script breaks some blogger functionality, like the "preview" and "Compose" view. But I don't care too much :)