Pages

Tuesday, July 14, 2009

Bible Gateway Search for Ubiquity 0.5

When I upgraded the Ubiquity extension in Firefox this morning to version 0.5, the Bible Gateway search command that I created died.  Apparently, it used a deprecated version of the API -- and so did the other Bible search command that I had, rendering both useless.  If you are completely unfamiliar with Ubiquity, it's an awesome extension available for Firefox that allows you to quickly carry out common tasks (similar to something like Spotlight or Quicksilver).  For more information on the extension, you can go here.

So, if you're interested in updating your commands to reflect the new API, you should probably start at the new command authoring tutorial.  There are some great examples in there on how to get started.

For anyone interested, I updated my Bible Gateway Search command to the following:
CmdUtils.CreateCommand({
  names: ["bible-gateway"],
  icon: "http://www.biblegateway.com/favicon.ico",
  author: { name: "Matt Augustine", email: "sokkerstud_11@hotmail.com"},
  license: "GPL",
  description: "Launches a passage look up on BibleGateway.com",
  help: "bible-gateway (passage query)",
  arguments: [{role: "object",
               nountype: noun_arb_text,
               label: "passage"}],
  preview: function( pblock, arguments) {
    var template = _("Searches BibleGateway.com for ") + arguments.object.text;
    pblock.innerHTML = CmdUtils.renderTemplate(template);
  },
  execute: function(arguments) {
    var url = "http://www.biblegateway.com/passage/?search={QUERY}"
    var query = arguments.object.text;
    var urlString = url.replace("{QUERY}", query);
    Utils.openUrlInBrowser(urlString);
  }
});

Basically, it just does a very simple passage lookup and opens it up.  So, for example, valid queries would be things like:
bible-gateway John 1-3
bible-gateway Matthew 1:4-5

If you would like to install this command in your browser, feel free to copy the code above, or you can install it by going here.  If you have any questions about my command, feel free to leave a comment below!

1 comment:

Max White said...

www.HolyBibleVerse.com is a powerful advanced online (no software of apps needed) Bible search tool (also read, listen, compare and/or visualize the Bible verse by verse or chapter by chapter). Some fun stuff thrown in too!