« previous | next »
An alpha version of Ubiquity just came out of Mozilla Labs. It’s a Quicksilver-like add-on for Firefox that allows you to quickly launch favorite sites and chain together actions. Aza and gang have put together a powerful toolkit. I particularly like the idea of scripting together various actions and being able to modify content inside a page. (For example, see the TinyURL command).
As I was reading about Ubiquity, I couldn’t help but smile. I’ve been using a very rudimentary version of a similar setup for a few years now. A while ago, frustrated with having to load up individual pages and add-ons for common tasks, I pieced together quick launch system using bookmarklets and Firefox’s keywords support. I’ve been wanting to share these hacks and even though Ubiquity now captures all of these elements quite nicely, I figured now is a good time as any to do that.
Some basics
First off, any time you bookmark a URL in Firefox, it will give you the ability to attach a “keyword” to the bookmark. Once you’ve saved a bookmark, edit the entry using Bookmarks Manager (Bookmarks > Organize Bookmarks) and fill in the “keyword” field. I usually pick a short keyword such as “map” for Google Maps and “t” for Twitter and “g” for Google. The keyword can be used as a shortcut in the browser’s address bar. For instance, if you chose a keyword “home” for the bookmark to your homepage, you can type just “home” into your address bar and you’ll be redirected to your page. If you have a keyword “g” for Google, all you have to do is to type the letter “g” into the address bar to be taken to Google.
But what if you want to combine this keyword with a search term? This could be particularly useful in the Google example above. The second step is to get the bookmark URL to respond dynamically to any searches you might want to do. You can get Firefox to dynamically fill-in a URL with text of your choice by using the “%s” substitution token. For instance, let’s say I’d like to be able to quickly search for something on Google. I can use the keyword “g” followed by my search text in the address bar to search Google for that term. To do this, I’d bookmark the URL “http://www.google.com/search?q=%s“. When used alongside the keyword, Firefox will automatically substitute “%s” with my search text and will show Google’s search results for that term.
Examples
These are some of the most-used shortcuts I’ve put together, along with the keywords I use:
Action: Find something on Google
Keyword: g
URL: http://www.google.com/search?q=%s
Action: Find something on Yelp
Keyword: y
URL: http://www.yelp.com/search?find_desc=%s&find_loc=New+York%2C+NY
Action: Map an address on Google Maps
Keyword: l
URL: http://maps.google.com/maps?q=%s
Action: Find something on Hype Machine
Keyword: h
URL: http://hypem.com/search/%s/1/
Action: Quickly add current page to del.icio.us
Keyword: da
URL: javascript:(function(){l=location.href;t=document.title;if(!t) t = prompt('title:');tags=prompt('tags:');location.href='https://api.del.icio.us/v1/posts/add?url='+escape(l)+'&description='+escape(t)+'&tags='+escape(tags);})()
Notes: This will prompt you for tags (space-separated).
Action: Quickly add current page to del.icio.us (with notes)
Keyword: das
URL: javascript:(function(){l=location.href;t=document.title;if(!t) t = prompt('title:');s=prompt('notes:');tags=prompt('tags:');location.href='https://api.del.icio.us/v1/posts/add?url='+escape(l)+'&description='+escape(t)+'&extended='+escape(s)+'&tags='+escape(tags);})()
Notes: This will prompt you for tags and will ask you to fill in the notes field.
Action: Twitter something
Keyword: t
URL: [links to script on my system that automatically authenticates and posts to Twitter. see below for more]
Some notes
I started using these hacks mainly because I was tired of using heavier bookmarklets and popups to perform simple tasks. For instance, the del.icio.us posting bookmarklet is very lightweight in that you don’t have to download meta-data (tags, etc) from del.icio.us before you post a URL. It’s also easy to use these same bookmarklets in other browsers – I use the del.icio.us hints on my iPhone to quickly save things when on the go. As you can tell, this is a very simple system. One of the major drawbacks (which Ubiquity improves upon) is that bookmarklets/keywords only allow you to perform “GET” requests (“POST” is not allowed). This is the reason I had to write up a separate script to provide the ability to post to Twitter. Ubiquity allows you to perform all sorts of network connections using jQuery (including AJAX calls). On the other hand, one of the issues with Ubiquity (which is easily configurable in my keyword-based setup) is the use of custom keywords. For example, I might prefer using “f” for FriendFeed updates. Someone else may want to use “f” for Facebook. From a command development standpoint, who will get first choice on a keyword like “ebay”? It will be interesting to see how this namespace issue is handled.
Porting keywords to Ubiquity
I took a few minutes to create the Ubiquity del.icio.us “quick add” bookmarklet – it’s essentially a straight port of my simple keyword-based bookmarklet from above. I’m going to start moving a few other browser hacks into Ubiquity as well in the coming days.
Feel free to browse and subscribe to my collection of Ubiquity commands.
-
http://blog.andrewparker.net/ andrewparker
-
http://naveenium.com naveen