20seven

Devigner blog about development and design

DoubleClick and Define Using Apple Dictionary

A fantastic prototype script for Mac dictionary lookups.


var selection;
if(window.getSelection)
  selection = window.getSelection();
else if(document.selection)
  selection = document.selection.createRange();

document.observe('dblclick', function() {
  if(navigator.userAgent.include('Macintosh')) {
      location.href = 'dict://' + selection;
    }
});

A quick (and probably dirty) Prototype-based hack allowing Mac users to get the definition of any word by double clicking it.

[Via AlternateIdea – Home.]