茶水监控提示

监控茶水数量并提示

// ==UserScript==
// @name         茶水监控提示
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  监控茶水数量并提示
// @author       YourName
// @match        https://www.milkywayidle.com/*
// @match        https://test.milkywayidle.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 创建提示容器(基于原有样式调整位置)
    const alertContainer = document.createElement('div');
    Object.assign(alertContainer.style, {
        position: 'fixed',
        top: '20%',  // 调整到屏幕偏上位置
        left: '50%',
        transform: 'translate(-50%, -50%)',
        fontSize: '48px',
        fontWeight: 'bold',
        color: 'rgba(255, 0, 0, 0.7)',
        textShadow: '2px 2px 4px rgba(0,0,0,0.5)',
        zIndex: 9999,
        pointerEvents: 'none',
        display: 'none'
    });
    alertContainer.textContent = '茶快喝完了!';
    document.body.appendChild(alertContainer);

    // 检测消耗品数量
    function checkConsumables() {
        const slots = document.querySelectorAll('.ConsumableSlot_consumableSlotContainer__2DwgD');
        let hasEmpty = false;

        slots.forEach(slot => {
            const countElement = slot.querySelector('.Item_count__1HVvv');
            if (countElement && parseInt(countElement.textContent) <= 20) {
                hasEmpty = true;
            }
        });

        alertContainer.style.display = hasEmpty ? 'block' : 'none';
    }

    // 每2秒检测一次
    setInterval(checkConsumables, 2000);
    checkConsumables(); // 初始检测

})();

QingJ © 2025

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