Tuesday, September 9, 2008

Ubiquity = AWESOME

I must say, I am very impressed with this extension on FireFox. It's like the perfect tool for lazy people like me. Surfing the net is literally at the tips of my fingers now. I know it might sound ridiculous to some of you, but....I've made commands to go directly to the OSD Weekly schedule page, the Planet blog page, my blog page, opening ChatZilla connected to moznet, and linking to printable version of any wiki page you're currently on. Ok....the last one sounds useful, but the rest sounds pretty lazy to you, right? But not to me. I'm lazy enough to not want to go through my bookmarks and clicking the link to those pages, instead, I'm just going to type a few letters and get to those pages.

Install Ubiquity: extension
Ubiquity Tutorial: Read

Here is the code for the commands I mentioned above:

CmdUtils.CreateCommand({
name: "irc",
author: {name: "Patrick Lam"},
icon: "https://addons.mozilla.org/en-US/firefox/images/addon_icon/16",
preview: "Starts ChatZilla 0.9.83 and connects to irc://moznet/",
execute: function() {
Utils.openUrlInBrowser( "irc://moznet/" );
}
})

CmdUtils.CreateCommand({
name: "blog",
author: {name: "Patrick Lam"},
takes: {"user": noun_arb_text},
icon: "http://pplam3.blogspot.com/favicon.ico",
preview: "Goes to Blogspot by default or to the specified user's blog",
execute: function( directObj ) {
var preText = "www";
if (directObj.text != "") {
preText = directObj.text;
}
Utils.openUrlInBrowser( "http://" + preText + ".blogspot.com" );
}
})

CmdUtils.CreateCommand({
name: "osd",
author: {name: "Patrick Lam"},
takes: {"blog": noun_arb_text},
preview: "Goes to OSD600 Weekly Schedule. By typing 'blog' after, it goes to the Planet's Blog",
execute: function( directObj ) {
if( directObj.text == "") {
Utils.openUrlInBrowser( "http://zenit.senecac.on.ca/wiki/index.php/DPS909_and_OSD600_Fall_2008_Weekly_Schedule" );
}
else {
Utils.openUrlInBrowser( "http://zenit.senecac.on.ca/~chris.tyler/planet/" );
}
}
})

CmdUtils.CreateCommand({
name: "print",
author: {name: "Patrick Lam"},
preview: "Takes the current wiki page and make it printable",
execute: function() {
var currentPath = CmdUtils.getDocumentInsecure().location.href;

var wikiHome = currentPath.substring(0, currentPath.lastIndexOf("/"));

/* Gets the title of the document in wiki */
var wikiTitle = currentPath.substring(currentPath.lastIndexOf("/") + 1);

/* Makes the printable version url */
var printURL = wikiHome + "?title=" + wikiTitle + "&printable=yes";

Utils.openUrlInBrowser( printURL );
}
})

2 comments:

Scott said...

Hmmm... I never thought of using Ubiquity as a search/bookmark tool. That could be useful when I need to search through other student's posts to make replies in the future :P

Thanks for the code snippets. I'm probably going to make use of them and possibly expand upon them.

- Scott Lunel

Tony Lai said...

Yes, Ubiquity really does have a tendency to allow lazy people to do a ton of bookmarking without having to flood the actual bookmarks :D
I love it!

Its a pain that school computers don't have it installed.

Let's start persuading Dave to get Ubiquity installed on all school computers.

Its for the good of man(students)kind!