Siguiente capitulo

Cambiar de capitulos en TMO con las flechas del teclado

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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;
        }
    }
})();