Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

AJAX Inline Dictionary like WallStreetJournal.com 52

chevoldavis writes "Highlight any text on this site then right click. A tooltip containing the definition of the selected word should show up. This tutorial will show you how to accomplish this, step by step. You can modify it to call any function or webservice. This is similar to the WallStreetJournal.com except they show search results in their tooltip window and they leave the functionality of the context menu while I have chosen to supress it. "
This discussion has been archived. No new comments can be posted.

AJAX Inline Dictionary like WallStreetJournal.com

Comments Filter:
  • Re:stop that! (Score:3, Informative)

    by red_dragon ( 1761 ) on Monday June 26, 2006 @08:21AM (#15604627) Homepage

    So you're still using Internet Explorer, then?

    I've just tried it with Firefox, which can optionally prevent JavaScript code from disabling context menus, and the usual right-click menu appeared with the AJAX-generated tooltip beneath it.

  • by magores ( 208594 ) on Monday June 26, 2006 @08:51AM (#15604781) Journal
    Sorry for replying to myself, but I forgot to mention, that I DO like this idea.

    It's kinda like what they do at http://newsinchinese.com/ [newsinchinese.com] And, sorta like the firefox extension from http://www.asdotrans.com/ [asdotrans.com].

    I could see myself using a modified version of this.

    --
    The negative tone of my parent post was unintentional
  • by peesharp ( 985023 ) on Monday June 26, 2006 @08:58AM (#15604831)
    It does not work with Opera (9).
  • by spectral ( 158121 ) on Monday June 26, 2006 @09:25AM (#15604995)
    I don't think that it's because Opera is better or nicer (though I'm sure I could disable it if it did work), I think it's because, for some reason, people are STILL doing browser detection like idiots. Not that I mind, I can't stand the idea of this (leave right click alone!)

    The problem?
    // -- Browser Detection --
    var ie = document.all&&document.getElementById
    var ff = document.getElementById&&!document.all // If the browser is compatible on right-click call the function to get the highlighted text
    if (ie||ff)
    {
    document.oncontextmenu = getselection;
    }


    opera supports "document.all" AND "getElementById". (hell, firefox does too, it just refuses to let you check for document.all so as to NOT break stupidities like this.)

  • by nitro322 ( 615518 ) on Monday June 26, 2006 @11:56AM (#15606005) Homepage
    Any Firefox/Greasemonkey users out there that are interested in this may also want to check out the Dict script: http://userscripts.org/scripts/show/1467 [userscripts.org]

    It adds a similar, but much less intrusive capability. Simply double-click on any word to highlight it, and the definition is shown in a small window. Once you're done, just click the X (or use my own slgihtly-modified version [legroom.net] and click anywhere on the page) to close it.

    Of course, this has both it's pros and cons as compared to the original idea discussed in the story. Since it's a client-side solution, this isn't something that will be available to your visitors. However, the good news is that it doesn't hijack your browser's context menu, which, as mnay other people have commented, is something I personally despise.

Top Ten Things Overheard At The ANSI C Draft Committee Meetings: (5) All right, who's the wiseguy who stuck this trigraph stuff in here?

Working...