Next/Prev Page

Allows you to press ,/. in order to navigate pages.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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.

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

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

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         Next/Prev Page
// @version      1
// @description  Allows you to press ,/. in order to navigate pages.
// @author       Yoboies
// @match        https://rule34.xxx/index.php?page=post&s=list*
// @match        https://rule34.xxx/index.php?page=favorites&s=view*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=rule34.xxx
// @license      MIT
// @namespace https://greasyfork.org/users/1345312
// ==/UserScript==

(function() {
    'use strict';

    var searchStringNext = ">";
    var searchStringPrev = "<";
    var hotkeyNext = "Period";
    var hotkeyPrev = "Comma";
    var found ="";

    document.addEventListener('keydown', logKey);

    function logKey(e) {
        if(e.code==hotkeyNext){
            var tagNames = Array.from(document.getElementsByTagName('a'))
            for (var i = 0; i < tagNames.length; i++) {
                if (tagNames[i].textContent == (searchStringNext)) {
                    found = tagNames[i];
                    found.click();
                    break;
                }
            }
        }else if (e.code==hotkeyPrev){
            var tagNames = Array.from(document.getElementsByTagName('a'))
            for (var i = 0; i < tagNames.length; i++) {
                if (tagNames[i].textContent == (searchStringPrev)) {
                    found = tagNames[i];
                    found.click();
                    break;
                }
            }
        }
    }
})();