Show me the code! – By Davanum Srinivas

August 27, 2008

A simple ubiquity “go” script

Filed under: Uncategorized — Davanum Srinivas @ 1:10 pm

Amazingly simple! opens another tab with the specified url.

Here’s a screen shot


Here’s the code

CmdUtils.CreateCommand({
  name: "go",
  takes: {status: noun_arb_text},
  homepage: "http://davanum.wordpress.com/",
  author: { name: "Davanum Srinivas", email: "davanum AT gmail.com"},
  description: "open browser to specified url",
  preview: function( pblock, statusText) {
    jQuery.ajax({
      async: false,
      type: "GET",
      url: statusText.text,
      success: function() {
         var msg = "<iframe src='" + statusText.text + "' width=500 height=400/>";
         pblock.innerHTML = msg;
      }
    });
  },
  execute: function(statusText) {
    Utils.openUrlInBrowser(statusText.text);
  }
})

UPDATED: 4:56 EST Aug 27 – Added a Preview option to display the site in an iframe.

3 Comments »

  1. I’d love to have this be able to parse a selection for the link and open that link. That way I could double click a sentence with an address in it and it would find the address and go to the page. I don’t know Javascript yet (I’m learning because of Ubiquity) but is this possible? If so please e-mail me at temp(dot)roger (at) gmail.com

    Comment by Roger — August 28, 2008 @ 6:36 pm

  2. Wow, very cool!
    But i have a question, when I try to view a site and write the URL without “http://” nothing happend.
    How can I get the preview without write “http://”?
    Thanks a lot and greetings

    Comment by **Juanito** — September 4, 2008 @ 4:28 pm

  3. [...] Filed under: Uncategorized — Davanum Srinivas @ 12:06 pm The previous script here just displayed the preview of a specified URL. Based on suggestions from the ubiquity-firefox from [...]

    Pingback by [Ubiquity] Go 2.0 script - displays suggestions from the firefox awesome bar « Show me the code! - By Davanum Srinivas — September 5, 2008 @ 12:06 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.