Greasy Fork

Greasy Fork is available in English.

OP.GG 自动点击录制

自动点击 OP.GG 网站上的「录制」按钮

当前为 2024-09-14 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         OP.GG Auto Recorder
// @name:zh-TW   OP.GG 自動點擊錄製
// @name:zh-CN   OP.GG 自动点击录制
// @namespace    https://www.youtube.com/c/ScottDoha
// @version      1.3
// @description  Automatically clicks "Record" buttons on OP.GG website
// @description:zh-TW 自動點擊 OP.GG 網站上的「錄製」按鈕
// @description:zh-CN 自动点击 OP.GG 网站上的「录制」按钮
// @author       Scott
// @match        *://*.op.gg/summoners/*
// @grant        none
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    // 獲取腳本啟用狀態
    const isEnabled = JSON.parse(localStorage.getItem('autoRecorderEnabled') || 'true');

    // 如果腳本啟用
    if (isEnabled) {
        // 每60秒刷新頁面
        setInterval(function() {
            location.reload();
        }, 60000); // 60000ms = 60s

        // 頁面加載完成後檢查按鈕
        window.addEventListener('load', function() {
            clickButton(); // 頁面加載時檢查按鈕
        });

        // 檢查是否存在錄制按鈕,並點擊
        function clickButton() {
            const buttons = document.querySelectorAll('button'); // 查找所有按鈕
            buttons.forEach(button => {
                const buttonText = button.textContent.trim(); // 獲取按鈕的文本內容

                if (buttonText === "錄製") {
                    console.log("點擊錄製按鈕");
                    button.click();
                }
            });
        }
    }

    // 頁面上添加開關按鈕
    const toggleButton = document.createElement('button');
    toggleButton.textContent = isEnabled ? 'Disable Auto Recorder' : 'Enable Auto Recorder';
    toggleButton.style.position = 'fixed';
    toggleButton.style.top = '10px';
    toggleButton.style.right = '10px';
    toggleButton.style.zIndex = '9999';
    document.body.appendChild(toggleButton);

    toggleButton.addEventListener('click', function() {
        const currentState = JSON.parse(localStorage.getItem('autoRecorderEnabled') || 'true');
        const newState = !currentState;
        localStorage.setItem('autoRecorderEnabled', JSON.stringify(newState));
        toggleButton.textContent = newState ? 'Disable Auto Recorder' : 'Enable Auto Recorder';
    });
})();