OP.GG 自动点击录制

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

目前为 2024-09-14 提交的版本。查看 最新版本

// ==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';
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址