// ==UserScript== // @name 炼金状态提示器 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 根据页面标题显示炼金状态提示 // @author 小r // @match https://www.milkywayidle.com/* // @match https://test.milkywayidle.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 创建状态提示元素 const statusIndicator = document.createElement('div'); Object.assign(statusIndicator.style, { position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', fontSize: '120px', fontWeight: 'bold', color: 'rgba(255, 0, 0, 0.5)', textShadow: '2px 2px 4px rgba(0,0,0,0.3)', zIndex: 9999, pointerEvents: 'none', display: 'none' }); document.body.appendChild(statusIndicator); // 标题变化检测器 const titleObserver = new MutationObserver(() => { const match = document.title.match(/炼金 - (\S+)/); console.log(document.title) if (match) { statusIndicator.textContent = match[1].substr(0,2); statusIndicator.style.display = 'block'; } else { statusIndicator.style.display = 'none'; } }); // 开始观察标题变化 titleObserver.observe(document.querySelector('title'), { childList: true, subtree: true, characterData: true }); // 初始检测 titleObserver.takeRecords(); })();