// ==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.2 // @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 // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 創建一個觀察者實例來監視 DOM 變化 const observer = new MutationObserver((mutationsList) => { for (const mutation of mutationsList) { if (mutation.type === 'childList') { clickButton(); // 發現 DOM 變化後,調用點擊函數 } } }); // 配置觀察選項 const config = { childList: true, subtree: true // 觀察子節點的變化 }; // 觀察整個 document.body observer.observe(document.body, config); // 定期檢查頁面內容 setInterval(clickButton, 2000); // 檢查是否存在錄制按鈕,並點擊 function clickButton() { const buttons = document.querySelectorAll('button'); // 查找所有按鈕 buttons.forEach(button => { const buttonText = button.textContent.trim(); // 獲取按鈕的文本內容 if (buttonText === "錄製") { console.log("點擊錄製按鈕"); button.click(); } }); } // 初始運行一次 clickButton(); })();