Wednesday, January 21, 2009

Ubiquity Commands I've "created"

If you're not using Firefox 3 and Ubiquity, this post may not be all that useful to you, but go check them out and then come back here and this might make more sense.

If you are using Ubiquity, you may have noticed that a nice feature is that you can create your own commands from right within the browser. There is a nice tutorial on how to get started on this on the Mozilla site.

The absolute easiest way to create a new Ubiquity command is to make a command from an existing bookmarklet. There is a video here that explains this. Basically, you just copy and paste some code snippets and bam, there's your nifty new command.

Commands I've made using this method are:

The 'page2rss' command:

name: "Add to Page2RSS",

I've gotten so used to clicking the RSS icon in Firefox to subscribe to sites I like, that when I come to a site with no RSS feed I feel really frustrated. So I use this bookmarklet/command that sends the page through which in turn monitors the page for changes and creates a feed for it. Then I subscribe. :)

The 'HuffDuff it' command:

name: "HuffDuff It",

This allows me to submit things to my queue. For more on how I use, see my last post.

Similarly, one for the 'easylistener player':

name: "easylistener",
url: "javascript:void(,%22easylistener%22,%22menubar=no,location=no,resizable=yes,scrollbars=no,status=yes%22));"

I used to use Google Notebook heavily until I heard it was being pseudo-discontinued. Now I use Evernote, and thus an Evernote command:

name: "evernote this",
url: "javascript:(function(){EN_CLIP_HOST='';try{var%20x=document.createElement('SCRIPT');x.type='text/javascript';x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+(new%20Date().getTime()/100000);document.getElementsByTagName('head')[0].appendChild(x);}catch(e){location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);}})();"

This last one is one that I actually "wrote". I gradually figured out how the commands are normally written, and made this one mostly from scratch. It let's you type in a song name and it returns a list of songs from the service. I find it extremely useful when I want to hear a particular song. This makes it really easy to go from thinking about a song directly to listening to that song. Much less cumbersome than opening a new tab, browsing to the site, and typing it in there. The command could use a few improvements, but I'm still pretty happy with it.

name: "tinysong",
takes: {"song to find": noun_arb_text},
preview: function( pblock, songToFind ) {
pblock.innerHTML = "song results...";
var baseUrl = '';
var params = {s: songToFind.text, limit: 5 };
jQuery.get( baseUrl,
function ( response ){
var results = eval( '(' + response + ')' );
pblock.innerHTML = results.Custom;
execute: function( songToFind ) {
var doc = Application.activeWindow.activeTab.document;
var url_dest = ''+songToFind.text+'&limit=10';;

It should be possible to copy and paste these directly into your Ubiquity command editor and they should work right away. Let me know if you try them out.