May 23, 2005
CLiki Grease

photo from positive negative
Photo by Frank Kolodziej

Since Greasemonkey is so cool and is revolutionizing the web (get in line), I figured I should play with it a little bit. Anything to help me when the Dashboard, Ajax and Greasemonkey people all gang up and force us into Javascript reeducation camps.

sane-cliki.user.js attempts to fix CLiki's handling of HTML entities when editing pages (see my previous rant). Due to the ways browsers try to correct for mangled HTML in <TEXTAREA> tags, it wasn't possible to just grab the source via DOM and encode it properly; I had to make an additional request to the CLiki server to get the unadulterated page source. This does mean that every time you hit the “Edit” link at the bottom of a CLiki page, two requests will be sent to the CLiki server and you have to wait for both of them to complete. And yes, it means this single script uses both Greasemonkey and XMLHttpRequest, which is like a double hip web takedown.

rendered cliki page
A page as it appears rendered by CLiki.

broken HTML corrected HTML
Left: Mangled HTML in the unfixed CLiki. Right: Fixed courtesy of Greasemonkey.

This is a hacky way of fixing the problem, but it works until CLiki is updated. And when I say it “works,” I mean that I tried it at least twice and it crashed at most once. The script requires, of course, Firefox and Greasemonkey. One could probably do something similar with PithHelmet for Safari.

Mark Pilgrim's Dive Into Greasemonkey was very helpful.

Posted by jjwiseman at May 23, 2005 02:46 PM
Comments

that pic is awesome

Posted by: hj on May 23, 2005 04:18 PM

not that it matters much, but you don't need to use "._content"

supposedly it breaks scripts in some firefox 1.0.3 builds

Posted by: timb on May 23, 2005 10:37 PM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?