SS Arrow Key Next/Prev Chapter

Enable next / previous chapter on right / left arrow keys on Shinsori.

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

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

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!)

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.

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

// ==UserScript==
// @name         SS Arrow Key Next/Prev Chapter
// @namespace    ultrabenosaurus.Shinsori
// @version      0.2
// @description  Enable next / previous chapter on right / left arrow keys on Shinsori.
// @author       Ultrabenosaurus
// @license      GNU AGPLv3
// @source       https://greasyfork.org/en/users/437117-ultrabenosaurus?sort=name
// @match        https://www.shinsori.com/*
// @icon         https://www.google.com/s2/favicons?domain=shinsori.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    document.onkeyup = function(e){
        e = e || window.event;
        //console.log(e.keyCode);
        if( e.keyCode == '37' ) {
            // left arrow
            e.preventDefault();
            var pLink = document.querySelectorAll('p a.shortc-button.small.black');
            if( pLink.length == 0 ) {
                console.error("No links found for query selctor: 'p a.shortc-button.small.black'");
                return null;
            }
            if( pLink[0].textContent.search("Previous") >= 0 ) {
                console.info("Navigating to previous chapter:", pLink[0].href);
                pLink[0].click();
            } else {
                console.error("Link in position 0 did not contain text: 'Previous");
            }
            pLink = null;
        } else if( e.keyCode == '39' ) {
            // right arrow
            e.preventDefault();
            var nLink = document.querySelectorAll('p a.shortc-button.small.black');
            if( nLink.length == 0 ) {
                console.error("No links found for query selctor: 'p a.shortc-button.small.black'");
                return null;
            }
            if( nLink[1].textContent.search("Next") >= 0 ) {
                console.info("Navigating to next chapter:", nLink[1].href);
                nLink[1].click();
            } else {
                console.error("Link in position 1 did not contain text: 'Next");
            }
            nLink = null;
        }

    };
})();