Ubiquity – coding something useful in less than 20 minutes

27 Aug

Ubiquity is the new experimental extension to Firefox that will (I’m sure it will) make enormous impact on the way we use the browser. It allows to remix various services and extend functionality of the browser in very easy way (if you don’t get the point of Ubiquity yet, I recommend watching the video that came with official announcement; I needed to see that – description didn’t tell me much about how powerful it can be).

I didn’t have much time to play with it yet, but in spare 20 minutes I attempted to code a command that would show me the image of a structure from PDB given its code and eventually take me to its homepage. Suprisingly it was very easy (and I’m not a JS coder). The source is pasted below.

  name: "pdb",
  description: "Goes to Protein Data Bank given PDB code.",
  icon: "",
  help: "You can specify the PDB code and pressing enter will take you to particular structure's homepage." +
    " If you type pdb code and press arrow down, you should see an image from PDB site.",

  takes: {"PDB code": noun_arb_text},

  execute: function( directObj) {
    var pdbcode = directObj.text;

  preview: function( pblock, directObj ) {
    var pdbcode = directObj.text;

    pblock.innerHTML = "Preview of the structure:<br/>";
    pblock.innerHTML += "<img src=\"" + pdbcode + "_bio_r_250.jpg\" />";


It of course could be improved by using also a selected text, or allowing to keyword search the PDB (or basically any other biological database), but its current functionality suits me just fine. Ubiquity is not yet such a stable platform as Greasemonkey (or Chickenfoot), but it’s worth to keep an eye on it. I’m sure we will read sooner or later an article in peer-reviewed journal describing Ubiquity commands for life sciences :).

Reblog this post [with Zemanta]
1 Comment

Posted by on August 27, 2008 in Software


Tags: , , , , ,

One response to “Ubiquity – coding something useful in less than 20 minutes

%d bloggers like this: