Skip to content

Instantly share code, notes, and snippets.

@hkamran80
Last active August 22, 2020 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkamran80/c522d3285557070619af9ce5d7df3442 to your computer and use it in GitHub Desktop.
Save hkamran80/c522d3285557070619af9ce5d7df3442 to your computer and use it in GitHub Desktop.
Google Search - Keystrokes
// ==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