Fishtank.live remove junk

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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;
})();