Search Appropedia with one click: handy bookmarklets

If you can add to or improve these instructions, or want to see the most up to date version, go to Search bookmarklets on the Appropedia wiki.

Highlight text on a web page, click a button on your bookmarks toolbar, and perform a search for that term on Appropedia. Sound handy? Here’s how you make the button (I’m using Firefox, but I think it will work similarly on other browsers):

  1. Copy the following code to your clipboard (i.e. highlight and press ctrl c):
    javascript:(function(){q=document.getSelection();%20if(!q){void(q=prompt('Appropedia%20keywords:',''))};%20if(q)location.href='http://www.appropedia.org/Special:Search?search='+escape(q)})()
  2. Right click on an empty space on your bookmark. (If there is no empty space, there should be a “>>” symbol at the right end of the bar. Rightclick this.)
  3. Choose “New Bookmark” and enter a name such as “Appropedia”. (I use “Ap” so it uses less space.)
  4. Paste the code from clipboard (ctrl v) into the “Location” field.
  5. Click the “Add” button. This will create the button – if you wish, you can drag and drop to a different place on the toolbar.

I’d rather just give a links to drag and drop, but creating javascript links in WordPress or in MediaWiki is beyond me. If you know how, please help us out, so we could add this to the front page of the wiki, and put them in blog posts.

You can do the same thing with other wikis, e.g. this is the code for the French language Ekopedia:

javascript:(function(){q=document.getSelection();%20if(!q){void(q=prompt('Ekopedia%20keywords:',''))};%20if(q)location.href='http://fr.ekopedia.org/Special:Search?search='+escape(q)})()

And this is for Wikipedia:

javascript:(function(){q=document.getSelection();%20if(!q){void(q=prompt('Wikipedia%20keywords:',''))};%20if(q)location.href='http://en.wikipedia.org/w/wiki.phtml?search='+escape(q)})()

Making your own bookmarklet

Or do you want another wiki or website? Easy – the following method has worked for any MediaWiki site I’ve tried. (It should work for most other sites as well, though you may have to adjust it a little.) Let’s take [Greenlivingpedia:|Greenlivingpedia] as an example. Just go to the site and search for something that you isn’t a page title in the wiki, such as qwerty. Then look at the url:

http://www.greenlivingpedia.org/Special:Search?search=qwerty&go=Go

Just delete the search term (qwerty), and anything after it, giving you:

http://www.greenlivingpedia.org/Special:Search?search=

Now, in the original code for Appropedia, at the beginning of the post, replace the appropedia.org search term in the code (“http://www.appropedia.org/Special:Search?search=“) which is inside single quote marks, with the new site’s search url. Leave the single quote marks there, so you replace ‘http://www.appropedia.org/Special:Search?search=’ with ‘http://www.greenlivingpedia.org/Special:Search?search=’ – then just replace the “prompt” term in the code with something appropriate (e.g. just change Appropedia to Greenlivingpedia, so 'Appropedia%20keywords:' becomes 'Greenlivingpedia%20keywords:' ).

So, putting the changes in italics, you now have:

javascript:(function(){q=document.getSelection();%20if(!q){void(q=prompt('Greenlivingpedia%20keywords:',''))};%20if(q)location.href='http://www.greenlivingpedia.org/Special:Search?search='+escape(q)})()

Hat tip: Geek to Live: Ten Must-Have Bookmarklets, by Gina Trapani, Oct 5 2005. This gave the code for the Wikipedia lookup bookmarklet.