Bodega Bot Green Room Magnifier chrome

Adds magnifying buttons to green room cameras on Bodega Bot

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Bodega Bot Green Room Magnifier chrome
// @version     1.2
// @description Adds magnifying buttons to green room cameras on Bodega Bot
// @match       https://tinychat.com/room/*
// @match       https://tinychat.com/*
// @grant       none
// @run-at      document-idle
// @namespace   https://greasyfork.org/users/1024912
// ==/UserScript==

(function() {
    'use strict';

    // Function to add magnify buttons to green room cameras
    function addMagnifyButtons() {
        // Select all camera elements in the green room
        const cameras = document.querySelectorAll(".green-room-camera"); // Adjust the selector based on actual class/ID

        cameras.forEach(camera => {
            // Check if the button already exists to avoid duplicates
            if (camera.querySelector('.magnify-button')) return;

            // Create magnify button
            const magnifyButton = document.createElement("button");
            magnifyButton.innerText = "🔍";
            magnifyButton.className = 'magnify-button';
            magnifyButton.style.position = "absolute";
            magnifyButton.style.bottom = "10px";
            magnifyButton.style.left = "10px";
            magnifyButton.style.zIndex = "1000";
            magnifyButton.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
            magnifyButton.style.border = "1px solid #ccc";
            magnifyButton.style.borderRadius = "5px";
            magnifyButton.style.cursor = "pointer";
            magnifyButton.onclick = () => {
                // Toggle magnify effect
                if (camera.style.transform === "scale(2)") {
                    camera.style.transform = "scale(1)";
                } else {
                    camera.style.transform = "scale(2)";
                }
            };

            // Append magnify button to the camera element
            camera.style.position = "relative"; // Ensure the camera element is positioned relatively
            camera.appendChild(magnifyButton);
        });
    }

    // Run the function to add magnify buttons after the page loads
    document.addEventListener('DOMContentLoaded', addMagnifyButtons);

    // Re-run the function if cameras are dynamically added to the DOM
    const observer = new MutationObserver(addMagnifyButtons);
    observer.observe(document.body, { childList: true, subtree: true });

})();