Hi Brent,

Thanks for your help. I was really more interested in 'internal' key
combos anyway (I'd hate it if the key became global when I did
something like CTRL+F).

I managed to get it to work - it truly is very simple - and the code
you had created was pretty much the only thing necessary.

Anyway, I've modified the Google search to include keyboard shortcuts
like those in the GoogleBar. Here's the code:

'// ========================================================

    function gg_keypressHook(keypressEvent)
    {
      switch(keypressEvent.keyCode){
        //CTRL+D doesn't work, I imagine it's tied by IE
        //case 4:  // CTRL+D : Definitions
        //  return gg(document.deff.q.value + " /define");
        case 6:  // CTRL+F : Froogle
          return gg(document.deff.q.value + " /froogle");
        case 9:  // CTRL+I : Images
          return gg(document.deff.q.value + " /images");
        case 12: // CTRL+L : I'm Feeling Lucky
          return gg(document.deff.q.value + " /ifl");
        //CTRL+N doesn't work, I imagine it's tied by IE
        //case 14: // CTRL+N : News
        //  return gg(document.deff.q.value + " /news");
        case 19: // CTRL+S : Stock Quotes
          return gg("stocks: " + document.deff.q.value);
        case 20: // CTRL+T : Thesaurus
          return gg(document.deff.q.value + " /glossary");
        case 21: // CTRL+U : Google Groups
          return gg(document.deff.q.value + " /groups");
        default:
          return false;
      }
    }

    function gg_keypressHook_okp()
    {
      if (okp() == false) {
        return false;
      } else {
        return (gg_keypressHook(window.event) == false) ? true : false;
      }
    }

  //register google hot-keys
    if (typeof registerKeypressHook == "function") {
      registerKeypressHook(gg_keypressHook);
    } else {
      document.onkeypress = gg_keypressHook_okp;
    }
'// ========================================================

It works fine on my system. This code appears at the end of the script
in my gg.xml file, outside of the functions, essentially creating and
tying the keyhook to the other hooks, which appear to be enumerated
from all keyhook handlers that have been registered using
registerKeypressHook(). Pretty cool, if you ask me.

The code above adds functional shortcut keys for:
  Ctrl + F      Search Froogle
  Ctrl + I      Google Images
  Ctrl + L      I'm Feeling Lucky
  Ctrl + S      Stock Quotes
  Ctrl + U      Google Groups

IOW, pressing CTRL+L in the search box after typing something in will
hit the "I'm Feeling Lucky" result - the same as having typed in "
/ifl", but with four less characters.

CTRL+T pulls up the Google Glossary instead:
  Ctrl + T      Thesaurus
(I couldn't find a Google 'Thesaurus')

The following one's simply don't work:
  Ctrl + D      Definitions
  Ctrl + N      Search News
I imagine this is because both CTRL+D and CTRL+N are handled by IE
internally (bookmark & new window, respectively), and using them in
this way simply thy are simply ignored.

If anyone has any recommendations on these two let me know. I'm
waiting to CVS it until I get them all working cleanly - especially
'News'. Again, any ideas would be great. I've considered changing it
to CTRL+SHIFT+[char] for these two, any thoughts?


I also think these should be individually disableable, particularly
for those of us that will be customizing the heck out of our DQSD
installs to make it do what we want it to. I made a 20kb search to do
(internal) "shtuff" on my own site yesterday (I can't believe I've
used it this long and have never done this before!). It has some 40
options/switches, and as of tonight, has keyboard shortcuts for the
three most-used options, too. If other people geek out as much as I
have on DQSD (unlikely, but possible ;) ), it's entirely possible that
the Google key combo's would conflict.

Regards,

Shawn K. Hall
http://ReliableAnswers.com/

'// ========================================================
   "Destiny is not a matter of chance; it is a matter of
    choice.  It is not a thing to be waited for; it is a
    thing to be achieved."
      -- William Jennings Bryan, US politician




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel

Reply via email to