Tuesday, May 26, 2009

KDE's kdict, dict.org and Firefox

I haven't used the KDE desktop since the release of KDE4, instead relying on IceWM. and while I may go back to it, I miss one of the desktop applets, kdict. Using it to check a definition, spelling, synonyms, etc. was very handy.

Since I use Fierfox as my primary browser, it made sense to consider using a bookmarklet. Bookmarklets are small pieces of javascript code that can be treated as a bookmark. When clicking the bookmark, the code will be executed. I modified a bookmarklet for Dictionary.com to use the dict.org dictionary like kdict did.

To make one for yourself, right-click on the Firefox Bookmarks toolbar, then select "New Bookmark", then fill in the following information. The javascript is all on one line.

Name: Dict.org
Location: javascript:void(q=prompt('Dict.org%20Search:',getSelection()));if(q)%20void(location.href='http://www.dict.org/bin/Dict?Form=Dict2&Database=*&Query='%20+%20escape(q))

The Database=* value mimics that used by kdict and checks the word with all the available dictionaries at dict.org.

To avoid replacing the current tab, right-click on the bookmarklet to open it in another tab. If someone knows javascript well enough to make it open that way automatically, I'd appreciate it. Ideally, one should just highlight the word and send it to dict.org, but I don't know how to do that yet.

No comments: