Siguiente capitulo

Cambiar de capitulos en TMO con las flechas del teclado

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Siguiente capitulo
// @namespace    http://tampermonkey.net/
// @license      GNU GPLv3
// @version      0.1
// @description  Cambiar de capitulos en TMO con las flechas del teclado
// @author       MarKazu
// @match        https://*.com/*/*/cascade
// @match        https://*.com/*/*/paginated/*
// @match        https://lectortmo.com/viewer/*/paginated
// @match        https://lectortmo.com/viewer/*/cascade
// @icon         https://www.google.com/s2/favicons?domain=lectortmo.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    //Verificamos si nos encontramos, en el capitulo, de forma pagina
    if(window.location.href.includes("paginated")){
        /*
        En caso afirmativo, reemplazamos el "paginated" por "cascade" para ver
        todas las imagenes del capitulo
        */
        window.location = window.location.href.replace("paginated", "cascade");
    }
    //ponemos un evento 'Keydown' para verificar que letra se presiono
    document.addEventListener('keydown', logKey);
    function logKey(e) {
        //si la tecla que presionamos es la flecha derecha
        if(e.code == "ArrowRight"){
            /*
            Declaramos la variable siguiente, que contiene el div con el elemento a
            que contiene el enlace al siguiente capitulo.
            */
            let siguiente = document.querySelector(".chapter-next");
            /*
            Utilizamos el window.location para poder redireccionar al capitulo siguiente
            */
            window.location = siguiente.querySelector("a").href;
        }
        if(e.code == "ArrowLeft"){
            /*
            Declaramos la variable anterior, que contiene el div con el elemento a
            que contiene el enlace al capitulo anterior.
            */
            let anterior = document.querySelector(".chapter-prev");
            /*
            Utilizamos el window.location para poder redireccionar al capitulo anterior
            */
            window.location = anterior.querySelector("a").href;
        }
    }
})();