Fishtank.live remove junk

This removes all the junk on fishtank.live so its just the cameras

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Fishtank.live remove junk
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  This removes all the junk on fishtank.live so its just the cameras
// @author       Jamesbannister
// @match        https://www.fishtank.live/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=fishtank.live
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to delete all nodes that are not the specified div or its children
    function modifyNodes() {
        const main = document.querySelector('main');
        if (!main) return;

        const keep = main.querySelector("[class^='MainPanel_main-panel']");
        if (!keep) return;

        // Iterate over all child nodes of main
        Array.from(main.childNodes).forEach(child => {
            // If the child node is not the one to keep, remove it
            if (child !== keep) {
                child.remove();
            }
        });

        // Make the kept div occupy the full viewport width and height
        keep.style.width = '100vw';
        keep.style.height = '100vh';

        // Set the grid-column property of the kept div
        keep.style.gridColumn = '1/3';
    }

    // Function to wait until the DOM nodes are present before running the script
    function waitForElement() {
        if (document.querySelector("[class^='MainPanel_main-panel']") && document.querySelector("[class^='Chat_chat']")) {
            modifyNodes();
        } else {
            setTimeout(waitForElement, 300);
        }
    }

    // Run the function on page load
    window.onload = waitForElement;
})();