Way to Create Keyboard Shortcuts for Google Search Results? -


i wondering if knows way create keyboard shortcuts google search results. instance, i'm looking way open first google search result number 1, on keyboard, , each successive entry opened next number.

i've searched high , low ways this, haven't gotten closer. ways/extensions/languages can use carry out feature?

at least, wondering if can point me in direction of resources or ways program this. have tampermonkey extension downloaded chrome extension, haven't been able create or find appropriate js code want. example of i'm looking can found here: http://googlesystem.blogspot.com/2007/02/keyboard-shortcuts-for-google-search.html. unfortunately, scripts , links found there dead , incredibly old (from 2007).

this idea got me interested, here's basic implementation tampermonkey works on google domains via special .tld domain available userscripts.

// ==userscript== // @name         google digits // @include      https://www.google.tld/* // @run-at       document-start // ==/userscript==  // work on search pages #q= &q= ?q=  if (location.href.match(/[#&?]q=/)) {     window.addeventlistener('keydown', function(e) {         var digit = e.keycode - 48;         // 48 code '0'         if (digit >= 1 && digit <= 9 &&             // don't intercept if modifier key held             !e.altkey && !e.ctrlkey && !e.shiftkey && !e.metakey &&             // don't intercept 1-9 in search input             e.target.localname != 'input')         {             // results in array             var links = document.queryselectorall('h3.r a');             // arrays 0-based             var link = links[digit - 1];             if (link) {                 // go linked url                 location.href = link.href;                 // prevent site seeing keyboard event                 e.preventdefault();                 e.stoppropagation();                 e.stopimmediatepropagation();             }         }     }, true); // true means capture event before it's "bubbled" down } 

the challenge process events before page does, i've used capturing listener on top of bubble chain, window object, , used @run-at: document-start metakey register handler before page registered own.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -