Slashdot Mirror


AJAX Inline Dictionary like WallStreetJournal.com

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. "

16 of 52 comments (clear)

  1. stop that! by acvh · · Score: 5, Insightful

    I want my right mouse button to do what it always does, not what YOU want it to do.

    1. Re:stop that! by red_dragon · · Score: 2, Informative

      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.

      --
      In Soviet Russia, Jesus asks: "What Would You Do?"
    2. Re:stop that! by Tx · · Score: 3, Insightful

      And you don't find that annoying? You want to use your contect menu e.g. to copy some text, and then you have to use an additional click to close the pop-up that had appeared behind it, obscuring the article. GPP is right, that's annoying. That's not to say that non-annoying uses couldn't be found for this technique though.

      --
      Oh no... it's the future.
    3. Re:stop that! by tomhudson · · Score: 3, Insightful

      Its also annoying because it redraws the cursor every mouse move ... too much flickering for my taste.

  2. an ajax article.. by kwoff · · Score: 3, Insightful

    Is this on slashdot because digg is down ?

  3. 2 things by giorgiofr · · Score: 4, Funny

    1. I can right-click or double-click any word on any page on the webs and I get a nice "Dictionary" item in my context menu. That's because I use a sensible browser, so I don't depend on your service.
    2. My right-click menu is *sacred*. Really, I kill kittens on its altar every morning. Thou shalt not dare to touch it. For he will not slay thee in thy turn, etc etc. Seriously, don't mess with people's interface. Luckily my fancy browser denies such requests as yours.
    Did I mention I use a cool browser?

    --
    Global warming is a cube.
  4. This is great by Ohreally_factor · · Score: 4, Funny

    This is great, if you define all words as "The remote server returned an error: (500) Internal Server Error."

    --
    It's not offtopic, dumbass. It's orthogonal.
    1. Re:This is great by alphafoo · · Score: 2, Funny

      I right-clicked on the word "Slashdotted" and thought, yep, that's about right.

      Even a stopped clock gives the right time twice a day.

  5. Re:I'm bored, so I checked.... by magores · · Score: 3, Informative

    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/ And, sorta like the firefox extension from http://www.asdotrans.com/.

    I could see myself using a modified version of this.

    --
    The negative tone of my parent post was unintentional

  6. browser compatibility by peesharp · · Score: 2, Informative

    It does not work with Opera (9).

    1. Re:browser compatibility by spectral · · Score: 2, Informative

      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.)

  7. Just like the website... by __aaclcg7560 · · Score: 3, Funny

    So like the Wall Street Jounal website, this inline dictionary has some free word definitions but you need a subscription to see the rest? Not a very useful dictionary...

  8. Great, but Wrong by 99BottlesOfBeerInMyF · · Score: 5, Insightful

    I'm sure a lot of us find this kind of crap annoying. A website developer just not have enough information to determine what my most common tasks are and thus properly define a right-click menu for me. I don't want them to have that information. My right-click menu already has a dictionary in it, as well as a handful of other functions. Now this site pops up a second context menu on the page that takes much, much longer to load and has fewer of the functions I want.

    To me this says, "screw you" to users of decent browsers in favor of working around IE + Windows failure to provide a good way to integrate this functionality in the proper location.

  9. what about word translation ? by arkaino · · Score: 4, Interesting

    More useful would be to right click and get a menu with different languages for translating the word I'm highlighting.

  10. Re:Open your mind by 99BottlesOfBeerInMyF · · Score: 2, Interesting

    Just because you're accessing it in a web browser does not make it a 'web site'.

    Umm, yes, it does. It is a page of markup and the very first line they send to my Web browser contains the Web standard they are employing.

    If I am using a web-based AJAX email client like OWA or RoundCube mail I not only *expect* the right click menu to behave like a native client ( With options like copy message, move message, flag, delete, etc), I *demand* it.

    Not me. If I'm using a Web browser, I demand it treat everything like the content it is. I don't want my controls of my software to be hijacked, or for it attempt to do so. I can already customize my right-click menu, by application and by Web site if I so desire. If a Web site wants to recommend additional functions for that site, that is fine, but things like a dictionary lookup are in no way something only my Web browser needs to access. I use the same dictionary in dozens of programs and I don't want to switch to their, half-assed, poorly configured one, just for their site. I also don't want to suddenly lose the other functionality of my contextual menu, like viewing the page's source, or blocking a particular ad server. No thanks.

    It pretty much excludes KHTML/Konqueror from ever running our application.

    Then you need to hire a competent UI designer. A contextual menu should never, and I mean never, ever contain functionality that cannot be accessed from another part of the program. A significant number of users don't know how to right click or will not think to try it to find some functionality. It is effectively hiding that function. Some users don't even have a right click button on their mouse and many users use some sort of alternative interface. Whether they are blind, have a palsy, are paralyzed, are working on a touch pad or stylus, or are using some other interface you've never dreamed of, the right-click menu is inconvenient or unavailable to a lot of users. If a user needs it to run your application you just violated a very basic UI design rule that is in pretty much any book you can pick up on the subject. Right-click menus should only be used as a shortcut for functionality that is also present elsewhere.

    Seriously, fire your UI guy and get a competent one.

  11. Dict Greasemonkey script by nitro322 · · Score: 3, Informative

    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

    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 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.