TraderSamwise / FTX pnl hider

// ==UserScript==
// @name         FTX pnl hider
// @namespace    http://github.com/tradersamwise/
// @version      0.1
// @description  Hide the pnl on the futures page of FTX.com. You MUST refresh the '.../trade/*' path or make it the first page you visit in order to activate the script as FTX uses React virtual router.
// @author       @TraderSamwise
// @match        https://ftx.com/trade/*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
// @license      MIT
// ==/UserScript==


// iterate over the rows and set the color to transparent for each row in the positions table
function hidepnl() {
    let rows = document.getElementsByClassName("MuiTableBody-root")[3].children;
    for (var i = 0; i < rows.length; i++) {
        let row = rows[i]
        row.children[6].children[0].style["color"] = "transparent"
    }
    // document.getElementsByClassName("MuiTableBody-root")[3].children[0].children[6].children[0].style["color"] = "transparent"
}


// set a timeout to allow page to load. then call hidepnl. also set an event listener to re-hide pnl whenever clicking back on positions tab.
(function() {
    'use strict';

    setTimeout(function(){
        hidepnl();
        document.getElementsByClassName("MuiButtonBase-root MuiTab-root MuiTab-textColorInherit Mui-selected MuiTab-fullWidth")[3].children[0].addEventListener("click", function() {
            setTimeout(function(){
                hidepnl();
            }, 200)

        });
    }, 2000);


})();