FSM快进投票

FSM快进到下一页投票

คุณจะต้องติดตั้งส่วนขยาย เช่น 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         FSM快进投票
// @namespace    http://tampermonkey.net/
// @version      1.01
// @description  FSM快进到下一页投票
// @author       Hema
// @match        https://fsm.name/Votes/details?voteId=*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 确保页面完全加载
    window.addEventListener('load', function() {
        // 创建按钮
        var button = document.createElement("button");
        button.innerHTML = "投下一个";
        // 设置按钮样式(可根据需要自行调整)
        button.style.position = "fixed";
        button.style.top = "80%";
        button.style.right = "60%";
        button.style.zIndex = "1000";
        button.style.padding = "10px";
        button.style.fontSize = "16px";
        button.style.backgroundColor = "#FFFF00"; // 增加背景颜色以提高可见性


        // 鼠标悬停时变红
        button.onmouseover = function() {
            this.style.backgroundColor = "#f44336"; // 红色
        };

        // 鼠标移开时恢复原色
        button.onmouseout = function() {
            this.style.backgroundColor = "#FFFF00"; // 原始颜色
        };


        // 添加按钮点击事件
        button.onclick = function() {
            // 获取当前URL的voteId值
            var currentUrl = window.location.href;
            var voteIdMatch = currentUrl.match(/voteId=(\d+)/);
            if (voteIdMatch && voteIdMatch[1]) {
                var currentVoteId = parseInt(voteIdMatch[1], 10);
                // 生成新的voteId
                var newVoteId = currentVoteId + 1;
                // 生成新的URL
                var newUrl = currentUrl.replace(/voteId=\d+/, "voteId=" + newVoteId);
                // 跳转到新的URL
                window.location.href = newUrl;
            }
        };

        // 将按钮添加到页面上
        document.body.appendChild(button);
    });
})();