Created
June 19, 2009 13:02
-
-
Save teramako/132599 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jetpack.future.import("slideBar"); | |
const NAME = "wikipedia-ja", baseURL = "http://en.m.wikipedia.org"; | |
function getSlidebar(){ | |
return jetpack.tabs.focused.raw.ownerDocument.defaultView.slideBar; | |
} | |
function getSlideFeature(slidebar){ | |
return slidebar.features.filter(function(F) "name" in F.args && F.args.name == NAME)[0]; | |
} | |
jetpack.slideBar.append({ | |
name: NAME, | |
icon: baseURL + "/favicon.ico", | |
url: baseURL, | |
onSelect: function(slide){ | |
var sel = jetpack.tabs.focused.contentDocument.getSelection().toString(); | |
if (sel){ | |
slide.doc.location.href = baseURL + "/wiki?search=" + encodeURIComponent(sel); | |
} | |
slide({size: 300, persist: true}); | |
}, | |
}); | |
jetpack.statusBar.append({ | |
html: <> | |
<style><![CDATA[ | |
#w-icon { | |
width: 16; height:16; | |
} | |
]]></style> | |
<img src={baseURL + "/favicon.ico"} id="w-icon"/> | |
</>, | |
onReady: function(doc){ | |
statusDoc = doc; | |
$(doc).click(function(){ | |
var slidebar = getSlidebar(); | |
var feature = getSlideFeature(slidebar); | |
if(slidebar.shown && slidebar.shown === feature){ | |
slidebar.slide(0); | |
} else { | |
slidebar.selectFeature(feature); | |
} | |
}); | |
}, | |
width:20 | |
}); | |
// vim: sw=2 ts=2 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment