Rule34 JumpTo

fix rule34 button of jump to

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Rule34 JumpTo
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  fix rule34 button of jump to
// @author       You
// @match        https://rule34video.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=rule34video.com
// @grant        none
// @license      MIT
// ==/UserScript==


(function () {
    'use strict';

    // 循环检测
    load_page()

    function load_page() {
        setTimeout(() => {
            // 寻找JumpTo按钮
            let item_jump_to = document.getElementsByClassName("item jump_to")[0]
            // 检查按钮标签是否正常
            let jump_to_page_num = document.getElementById("jumpTo").value
            
            // 获取按钮子项
            let jump_to_button = item_jump_to.childNodes[5]
            // 获取跳转页码
            let jump_to_button_parameters = jump_to_button.getAttribute("data-parameters")

            // 跳转页码检查
            let parameters = jump_to_button_parameters.split(":")
            // 设置跳转页码
            parameters[parameters.length - 1] = jump_to_page_num
            parameters = parameters.join(":")
            jump_to_button.setAttribute("data-parameters", parameters)

            load_page()
        }, 200)
    }


})();