Empornium GlobalArrowKeyNavigation

Companion script to NoShitEmpornium, adds arrow key navigation to all paginated content on the site

Versión del día 25/04/2022. Echa un vistazo a la versión más reciente.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         Empornium GlobalArrowKeyNavigation
// @namespace    http://www.empornium.me/
// @version      0.2
// @description  Companion script to NoShitEmpornium, adds arrow key navigation to all paginated content on the site
// @supportURL   https://github.com/ceodoe/noshitempornium/issues
// @homepageURL  https://github.com/ceodoe/noshitempornium/
// @author       ceodoe
// @include      /^https?://www\.empornium\.(me|sx|is)/*/
// @run-at       document-end
// ==/UserScript==
//
// Copyright © 2015-2021 ceodoe
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

document.onkeydown = function(event) {
    if(event.target.nodeName !== "TEXTAREA" && event.target.nodeName !== "INPUT") {
        if (event.code == "ArrowLeft") {
            let prevLink = document.getElementsByClassName("pager_prev")[0];
            if(prevLink) {
                event.preventDefault();
                prevLink.click();
            } else {
                let firstLink = document.getElementsByClassName("pager_first")[0];
                if(firstLink) {
                    event.preventDefault();
                    firstLink.click();
                }
            }
        } else if (event.code == "ArrowRight") {
            let nextLink = document.getElementsByClassName("pager_next")[0];
            if(nextLink) {
                event.preventDefault();
                nextLink.click();
            } else {
                let lastLink = document.getElementsByClassName("pager_last")[0];
                if(lastLink) {
                    event.preventDefault();
                    lastLink.click();
                }
            }
        }
    }
};