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.
CmdUtils.CreateCommand({ name: "pdb", description: "Goes to Protein Data Bank given PDB code.", icon: "http://www.rcsb.org/favicon.ico", 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; Utils.openUrlInBrowser("http://www.rcsb.org/pdb/explore/explore.do?structureId="+pdbcode); }, preview: function( pblock, directObj ) { var pdbcode = directObj.text; pblock.innerHTML = "Preview of the structure:<br/>"; pblock.innerHTML += "<img src=\"http://www.rcsb.org/pdb/images/" + 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 :).