Greasy Fork

NoCheapskates

[12:34:09 AM] TheMainLogic: someone make a script where i cant see bid offers of 1 and 2 coins please

目前为 2022-08-18 提交的版本。查看 最新版本

// ==UserScript==
// @name         NoCheapskates
// @namespace    SobieskiCodes
// @version      0.1
// @description  [12:34:09 AM] TheMainLogic: someone make a script where i cant see bid offers of 1 and 2 coins please
// @author       probsjustin
// @match        *://*www.milkywayidle.com/*
// @match        *://*test.milkywayidle.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==
(function () {
    "use strict";

    function onGameReady(callback) {
        const gameContainer = document.getElementsByClassName("App_app__3-YeL")[0];
        if (!gameContainer) {
            setTimeout(function () {
                onGameReady(callback);
            }, 250);
        } else {
            callback();
        }
    }
    onGameReady(() => {console.log('Ready to go.')});
    let observer = new MutationObserver(onMutation);
    observer.observe(document.body, { childList: true, subtree: true });
    function onMutation(mutations) {
        for (let mutation of mutations) {
            const marketPanel = document.getElementsByClassName("MarketplacePanel_marketplacePanel__21b7o")
            let IgnoreBids = ['1', '2']
            const bestBids = marketPanel[0].getElementsByClassName('MarketplacePanel_bestBidPrice__6q3Oh');
            if (bestBids.length !== 0) {
                for (const bid of bestBids) {
                    if(IgnoreBids.includes(bid.innerText)) {
                        bid.innerText = ''
                    }
                }
            }
            const table = document.getElementsByClassName("MarketplacePanel_orderBookTable__3zzrv")
            if (table.length !== 0) {
                for(let i = 0; i < table[1].tBodies.length; i++) {
                    const tbody = table[1].tBodies[i];
                    for (let j = 0; j < tbody.rows.length; j++) {
                        const row = tbody.rows[j]
                        for (let k = 0; k < row.cells.length; k++) {
                            const cell = row.cells[k];
                            if (k === 1) {
                                if(IgnoreBids.includes(cell.innerText)) {
                                    console.log(row, cell.innerText)
                                    row.remove()
                                }
                            }
                        }
                    }
                }
            }


        }
    }
})()