Skip to content

Instantly share code, notes, and snippets.

@JamoDevNich
Created September 8, 2019 20:40
Show Gist options
  • Save JamoDevNich/c7b629bb77b4ea8bd100db3b1135fc4a to your computer and use it in GitHub Desktop.
Save JamoDevNich/c7b629bb77b4ea8bd100db3b1135fc4a to your computer and use it in GitHub Desktop.
// ==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