Greasy Fork

Greasy Fork is available in English.

[MWI]Marketplace Order Book Button Disabler

Disable and gray out buttons in MarketplacePanel_orderBook containers using pure CSS

当前为 2025-05-11 提交的版本,查看 最新版本

// ==UserScript==
// @name         [MWI]Marketplace Order Book Button Disabler
// @name:zh-CN   [银河奶牛]市场订单簿按钮禁用器
// @namespace    https://cnb.cool/shenhuanjie/skyner-cn/tamper-monkey-script/mwi-orderbook-button-disabler
// @version      2.0.0
// @description  Disable and gray out buttons in MarketplacePanel_orderBook containers using pure CSS
// @description:zh-CN  使用纯CSS禁用并灰化市场订单簿面板中的按钮
// @author       shenhuanjie
// @license      MIT
// @match        https://www.milkywayidle.com/game*
// @icon         https://www.milkywayidle.com/favicon.svg
// @grant        none
// @homepage     https://cnb.cool/shenhuanjie/skyner-cn/tamper-monkey-script/mwi-orderbook-button-disabler
// @supportURL   https://cnb.cool/shenhuanjie/skyner-cn/tamper-monkey-script/mwi-orderbook-button-disabler
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // 添加纯CSS实现
    const style = document.createElement('style');
    style.textContent = `
        /* 选择市场订单簿面板中的所有按钮 */
        div[class*="MarketplacePanel_orderBook"] button {
            opacity: 0.5 !important;
            cursor: not-allowed !important;
            pointer-events: none !important;
            background-color: #e0e0e0 !important;
            color: #888 !important;
            border-color: #ccc !important;
            filter: grayscale(100%) !important;
            transition: all 0.3s ease !important;
        }

        /* 确保禁用状态不会被其他样式覆盖 */
        div[class*="MarketplacePanel_orderBook"] button:hover,
        div[class*="MarketplacePanel_orderBook"] button:active,
        div[class*="MarketplacePanel_orderBook"] button:focus {
            opacity: 0.5 !important;
            cursor: not-allowed !important;
            pointer-events: none !important;
            background-color: #e0e0e0 !important;
            color: #888 !important;
            border-color: #ccc !important;
            filter: grayscale(100%) !important;
            box-shadow: none !important;
            transform: none !important;
        }
    `;
    document.head.appendChild(style);

    console.log('[OrderBookDisabler] 已应用纯CSS禁用规则,市场订单簿按钮已被禁用');
})();