Using this basic structure it would be pretty easy to add a more complex set of conditions to make the same shortcut do many more things, such as looking up a book and working out if the text you put in was an ISBN or a title.
Here's my example formatted so you can read it:
javascript:(
function(){
if("%s".length==0){
// Default
window.location="http://en.wikipedia.org/wiki/Special:Watchlist"
}else{
// Wikipedia lookup
window.location="http://en.wikipedia.org/wiki/%s"
}
}
)()
function(){
if("%s".length==0){
// Default
window.location="http://en.wikipedia.org/wiki/Special:Watchlist"
}else{
// Wikipedia lookup
window.location="http://en.wikipedia.org/wiki/%s"
}
}
)()
And here it is formatted as a link you can drop into your bookmarks, don't forget to edit it so that it has "w" as a keyword/shortcut:
Wikipedia lookup
No comments:
Post a Comment