Created
September 8, 2019 20:40
-
-
Save JamoDevNich/c7b629bb77b4ea8bd100db3b1135fc4a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Keyboard Page Switcher - Zoopla | |
// @namespace nextpage.zoopla | |
// @description Allows the use of keyboard navigation keys to switch between pages on Zoopla | |
// @include https://www.zoopla.co.uk/* | |
// @version 1.0.0 | |
// @grant none | |
// ==/UserScript== | |
"use strict"; | |
window.onkeyup = function(e) { | |
if (document.activeElement.type !== "text") { | |
var key = e.keyCode ? e.keyCode : e.which; | |
if (key == 37) { | |
document.location = document.getElementsByClassName("paginate")[0].children[1].href; | |
} | |
else if (key == 39) { | |
var paginateElementChildren = document.getElementsByClassName("paginate")[0].children; | |
document.location = paginateElementChildren[paginateElementChildren.length - 1].href; | |
} | |
} | |
} | |
console.log("Keyboard Page Switcher (Zoopla) active"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment