Platypus and user scripts for Bonsai

Asa pointed me to a new Firefox extension called Platypus. Platypus lets you remove or isolate parts of a page a similar manner to Aardvark and lets you save sequences of page-modifying actions as Greasemonkey scripts. Platypus tries to identify elements by IDs in the scripts it generates and falls back on using XPath expressions such as /HTML[1]/BODY[1]/FORM[1].

I used Platypus on Bonsai CVS query form to remove useless parts of the page. I modified the script it generated to move Bonsai's menu to the bottom of the page instead of removing it from the page entirely. The resulting script is Bonsai Isolate Form. To use the script, you must have both Greasemonkey and Platypus installed.

Inspired, I made two other Greasemonkey scripts for the Bonsai form. Bonsai Date Option makes the "date" radio group selection change when you click a textbox associated with one of the radio buttons, and Bonsai Nightly Range makes the "date" section default to the range between the previous two nightly builds rather than the last two hours.

3 Responses to “Platypus and user scripts for Bonsai”

  1. Jed Says:

    That’s wierd.

    Why would you need platyus installed for using the greasemonkey user script?
    You would think platypus should generate a user script that works just for greasemonkey.

  2. Jesse Ruderman Says:

    I agree, that would be better. And then Platypus wouldn’t have to inject a function into every page you load.

  3. Scott Turner Says:

    First of all, Jesse, thanks for using Platypus and giving it a work out. Kind of you not to mention the bugs you found :-).

    Second, it’s interesting to see you distributing Platypus-generated scripts. I hadn’t thought about that, but it’s logical.

    Finally, as to why you need Platypus & Greasemonkey installed: You have to have Greasemonkey because it provides the basic scripting capability. You have to have Platypus installed because it provides a bunch of functions (like “apply this regular expression to every URL on the page”) that are used in the Platypus-generated scripts. Platypus *could* inject all the code needed into every script it generated (so that you wouldn’t have to have Platypus installed) but it would make every script something like 40K long and even worse would offend my sense of coding elegance :-).

    Feel free to promote this comment up to the top of your blog if you think there’s general interest in this answer.

    — Scott Turner