I had trouble putting it as a link in wordpress, so go to this link and copy-paste the code as a bookmark.
The script first checks if you have highlighted a word in the current page and, if there is, searches for that word. Otherwise, it shows a pop up where you can enter a word to search.
This searches the Urban Dictionary, but you can change it to search any site you want by simply replacing the URL. Some examples are: