Last active
August 22, 2020 04:06
-
-
Save hkamran80/c522d3285557070619af9ce5d7df3442 to your computer and use it in GitHub Desktop.
Google Search - Keystrokes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Search - Keystrokes | |
// @namespace https://hkamran.com | |
// @version 1.0.1 | |
// @description Keystrokes for Google Search | |
// @author H. Kamran | |
// @downloadUrl https://gist.github.com/hkamran80/c522d3285557070619af9ce5d7df3442/raw/google_search.user.js | |
// @updateUrl https://gist.github.com/hkamran80/c522d3285557070619af9ce5d7df3442/raw/google_search.user.js | |
// @match https://*.google.tld/search | |
// @grant none | |
// ==/UserScript== | |
function pagination(e) { | |
var evtobj = window.event? event : e | |
if (evtobj.keyCode == 78 && evtobj.shiftKey) { | |
// Next Page Keystroke (Shift + N) | |
const next_button_element = document.getElementById("pnnext"); | |
window.location.href = next_button_element.href; | |
} else if (evtobj.keyCode == 80 && evtobj.shiftKey) { | |
// Previous Page Keystroke (Shift + P) | |
const prev_button_element = document.getElementById("pnprev"); | |
window.location.href = prev_button_element.href; | |
} | |
} | |
document.onkeydown = pagination; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment