Monday, October 6, 2008

Ubiquity is awesome

So this new add-on for Firefox came out, btw one of my favorite next to gspace, anyways. it is very cool because it lets you do whatever the heck you want and I must say this is one of the reasons I use it and one of the reasons I use Linux as well.

Ubiquity (as they have called it) is very simple to use very nice user interface for all of you out there and I found it very easy to code for as well. I am not going to do a full review of Ubiquity for mainly three reasons one you can find all I am going to say about it in its wiki at https://wiki.mozilla.org/Labs/Ubiquity, two I am not a native english speaker so that makes it harder and three I just dont want to.

here are some of the Ubiquity sripts are wrote with the help of some simple tutorial found on the net somewhere credits to all them( I am not gonna list them all sorry guys, but thanks anyways )

Facebook Search

makeSearchCommand({

name: "Facebook",

url:"http://www.facebook.com/s.php?ref=search&init=q&q={QUERY}",
icon:"http://ads.ak.facebook.com/ads2/flyers/51/39/6002218418094_1_bc58a359.jpg",
description: "Searches Facebook for anything realated.",
preview: function(pBlock, directObj) {
if (!directObj.text || directObj.text.length < 1) {

pBlock.innerHTML = "Search Facebook.";
return;
}

pBlock.innerHTML = "Search Facebook for <code>" + directObj.text + "</code>";
var url = "http://www.facebook.com/";
var params = { facebook: directObj.text, mode: "suggest" };

jQuery.get(url, params, function(data) {
var preview = "Searched Facebook for <code>" + directObj.text + "</code>:";
var results = data[1];
for (var i = 0; i < results.length; i++) {
var name = results[i];
var url ="http://www.facebook.com/s.php?ref=search&init=q&q=" + escape(name);
preview += "<br
/><code><u><a
href=\""+url+"\">" + name +
"</a></u></code>";

}


pBlock.innerHTML = preview;

}, "rapsodia49");

}

});



Shoutcast Search

makeSearchCommand({

name: "Shoutcast",

url:"http://shoutcast.com/directory/search_results.jsp?searchCrit=simple&s={QUERY}",
icon: "http://classic.shoutcast.com/images/sc-logo.gif",
description: "Searches Shoutcast for song or artist.",
preview: function(pBlock, directObj) {
if (!directObj.text || directObj.text.length < 1) {
pBlock.innerHTML = "Search Shoutcast.";
return;
}

pBlock.innerHTML = "Search Shoutcast for <code>" + directObj.text + "</code>";
var url = "http://www.shoutcast.com/";
var params = { shoutcast:directObj.text, mode: "suggest" };
jQuery.get(url, params, function(data) {
var preview = "Searched Shoutcast for <code>" + directObj.text + "</code>:";
var results = data[1];
for (var i = 0; i < results.length; i++) {
var name = results[i];
var url = "http://shoutcast.com/directory/search_results.jsp?searchCrit=simple&s="
+ escape(name);

<!-- preview += "<br
/><code><u><a
href=\""+url+"\">" + name +
"</a></u></code>";

}
pBlock.innerHTML = preview;
}, "rapsodia49");
}
});










Now if you have installed the Ubiquity add-on already use your hot-key to bring the terminal usually ctrl+alt+space and type command-editor then simply copy and paste the sript you want to use and try it out for yourselves

steps to follow after script has been put in command-editor

bring out the ubiquity command line and type facebook then type w/e you wanna search for in facebook, it works whether you are logged in or not.

do the same for shoutcast

1 comment:

trentonknight said...

Hey this looks like a really cool Ubiquity Command. If you would like you are welcome to use my site to install the javascript and html link on my server. My friend and I are creating a Moodle based site for developers to use for cool hacks like this. The server is unfortunately down for today but should be up by tomorrow after dns re-populates. Its totally open source so you can use the site for whatever you want. I can elevate your privleges if you run into any problems. I put a tutorial on how to embed your Ubiquity script in a Moodle Course page. I was supprised how easy it was to create html blocks and play around with them. You can link this blog to your page too with an html block so you don't have to re-write this page. try our site sometime tonight or tommorrow morning and it should be back up. If you have any issues email me at trentonknight@gmail.com. The site is www.cipherhive.org. Hope to see you there!

V/r
Jason Mansfield