Ubiquity Tutorial: How to Write a Simple BSE Sensex Tracker

Written by Amit Agarwal on Oct 4, 2008

Ubiquity is a new Firefox plugin that can be used as a command line for creating simple Web mashups. What follows is a simple tutorial on how to write a new Ubiquity command (let’s call our command ‘sensex’) that displays the current BSE Sensex chart inside any website in Firefox.

To get started, install Ubiquity, press CTRL+Space, and enter the command "command-editor".

ubiquity-command

Then copy and paste this code in the text editor – the command is automatically saved as you type and you may start using the command with restarting Firefox.

<code>CmdUtils.CreateCommand({
  <strong>// The name of the Ubiquity command - this is what you would type to invoke the command.</strong>
  name: &quot;sensex&quot;,

  <strong>// The description of the command.</strong>
  description: &quot;BSE Sensex charts.&quot;,

  <strong>// The preview display - since we only need to view the graph (and nothing else).</strong>
  preview: function (html) {
    <strong>// Take the graph from the bseindia.com site, and insert it into the Ubiquity preview window.</strong>
    html.innerHTML = '&lt;img style=&quot;width: 490px; height: 240px;&quot; src=&quot;http://www.bseindia.com/images/line_graphs_zoom.png&quot;/&gt;';
  }
});
</code>

Press Ctrl+Space again and type "sensex" – There you have the live sensex chart accessible from just about any other website.

bbc command

Document Studio

Generate beautiful and pixel-perfect documents in PDF, Word, Excel or PowerPoint.

Download New
Mail Merge

Send personalized emails from Gmail, include unique attachments, track opens and more.

Download Popular
Save Emails

Download email messages and file attachments from Gmail to your Google Drive.

Download Popular

Subscribe to our Email Newsletter