A Jetpack...Wikify - V0.2 (5.29.2009)
Adds a box to the current tab with the Wikipedia article for a selected word.
Install
Install the
Jetpack addon for Firefox first.
Then click "Install..." to add the
Wikify Jetpack Feature
Uninstall
Navigate to
about:jetpack and choose Installed Features. From there you can uninstall any Jetpack.
Features
v0.2: Loads up the actual Wikipedia page in an iframe.
v0.1:Pulls up the Wikipedia page of the currently selected word using an AJAX GET request to http://en.wikipedia.org/wiki/
Ability to close the definition box.
Examples
Notes
v0.2:Using an iframe to display the entire page instead of parsing info with an AJAX request.
v0.1:This isn't the most sophisticated way to do this, but it works. All hrefs are removed so the links in the wiki box aren't functional. However, highlight them and click
wikify again to load up that wiki article.
To Do
Clean up the display
Make boxes draggable, and resizable
Enable the links
view source
//Wikipedia Jetpack
jetpack.statusBar.append({
html: "wikify",
width:55,
onReady: function(doc) {
$(doc).click(function(){
var rnd = Math.floor(Math.random()*1000);
var wrd = jetpack.tabs.focused.contentDocument.getSelection();
if(wrd!=""){
$.get("http://en.wikipedia.org/wiki/"+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.org/jetpacks/close-icon.gif");
var div=cTab.contentDocument.createElement("div");
div.setAttribute("style","text-align:left;border:1px solid;position:fixed;width:650px;bottom:0px;height:400px;right:0px;background-color:white;overflow:auto;");
var def=cTab.contentDocument.createElement("div");
def.setAttribute("style","width:600px");
var temp=data.substr(data.indexOf(""),data.indexOf("
"));
def.innerHTML=temp.replace(/href/g,"");
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;
});
}
});
}});
burling.eric@gmail.com