A Jetpack...Definer - V0.1 (5.29.2009)
Adds a box to the current tab with the definition of a selected word.
Install
Install the
Jetpack addon for Firefox first.
Then click "Install..." to add the
Definer Jetpack Feature
Uninstall
Navigate to
about:jetpack and choose Installed Features. From there you can uninstall any Jetpack.
Features
Defines the currently selected word using an AJAX GET request to http://google.com/search?q=define:
Ability to close the definition box.
Examples
view source
//Dictionary Jetpack
jetpack.statusBar.append({
html: "define",
width:55,
onReady: function(doc) {
$(doc).click(function(){
var rnd = Math.floor(Math.random()*1000);
var wrd = jetpack.tabs.focused.contentDocument.getSelection();
$.get("http://google.com/search",{q: "define:"+wrd}, function(data){
var cTab=jetpack.tabs.focused;
var handle=cTab.contentDocument.createElement("img");
handle.setAttribute("onclick","document.body.removeChild(document.getElementById('dfjtpck"+rnd+"'))");
handle.setAttribute("style","background-color:black;position:fixed;bottom:386px;right:1px;");
handle.setAttribute("src","http://ericburling/jetpacks/close-icon.gif");
var div=cTab.contentDocument.createElement("div");
div.setAttribute("style","border:1px solid;position:fixed;width:450px;bottom:0px;height:400px;right:0px;background-color:white;overflow:auto;");
var def=cTab.contentDocument.createElement("div");
def.setAttribute("style","width:400px");
def.innerHTML=data.substr(data.indexOf("Definitions of"),data.indexOf("")-data.indexOf("Definitions of"));
div.appendChild(handle);
div.appendChild(def);
div.setAttribute("id","dfjtpck"+rnd);
cTab.contentDocument.body.appendChild(div);
delete cTab;
delete handle;
delete div;
delete def;
delete wrd;
delete rnd;
});
});
}});