Changes

Jump to: navigation, search

Labs/Ubiquity/Ubiquity Source Tip Author Tutorial

17 bytes added, 06:20, 22 June 2009
Interacting with Other Extensions
http://img363.imageshack.us/img363/1906/picture7cm5.png
There isn't much to say here besides that it's easy. For example, here's a command (thanks to [http://foyrek.com/lyrics.html Abimanyu Raja] for writing this code) that finds the lyrics for a song. You can simply Ubiq something like "get-lyrics for wild international" but the command will also interface with the FoxyTunes extension (if it is installed) and add the currently playing song to the suggestion list. Interfacing with other extensions, too, is easy because you can view the source code for every Firefox extension.
<pre>
CmdUtils.CreateCommand({
namenames: ["get-lyrics"], takesarguments: {songmodifier: noun_type_song}, preview: function(pblock, directObjectarguments) {
searchText = jQuery.trim(directObjectarguments.modifier.text);
if(searchText.length < 1) {
pblock.innerHTML = "Searches for lyrics of the song";
},
execute: function(directObjectarguments) {
var url = "http://www.google.com/search?q={QUERY}"
var query = directObjectarguments.object.text + " lyrics";
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
});
</pre>
 
 
== Implementing Asynchronous Noun Suggestions ==
1,007
edits

Navigation menu