Grizzway Tools

Epic fixes and visual mods for fishtank.live

当前为 2025-03-24 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Grizzway Tools
// @namespace    http://tampermonkey.net/
// @version      3.2
// @description  Epic fixes and visual mods for fishtank.live
// @author       Grizzway
// @match        https://www.fishtank.live/*
// @grant        GM_addStyle
// @license MIT 
// ==/UserScript==

(function() {
    'use strict';

    // Sound blocking functionality
    const blockedSounds = [
        'https://cdn.fishtank.live/sounds/suicidebomb.mp3',
        'https://cdn.fishtank.live/sounds/nuke-1.mp3',
        'https://cdn.fishtank.live/sounds/nuke-2.mp3',
        'https://cdn.fishtank.live/sounds/nuke-3.mp3',
        'https://cdn.fishtank.live/sounds/horn.mp3'
    ];

    // Intercept fetch requests
    const originalFetch = window.fetch;
    window.fetch = async function(resource, init) {
        if (typeof resource === 'string' && blockedSounds.some(sound => resource.includes(sound))) {
            console.log('Blocked sound (fetch):', resource);
            return new Response(null, { status: 403 });
        }
        return originalFetch(resource, init);
    };

    // Intercept XMLHttpRequests
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(method, url) {
        if (blockedSounds.some(sound => url.includes(sound))) {
            console.log('Blocked sound (XHR):', url);
            this.abort();
        } else {
            originalOpen.apply(this, arguments);
        }
    };

    // Block audio elements directly
    const originalAudio = window.Audio;
    window.Audio = function(...args) {
        if (args.length && blockedSounds.some(sound => args[0].includes(sound))) {
            console.log('Blocked sound (Audio element):', args[0]);
            return new Audio();
        }
        return new originalAudio(...args);
    };

    // Block audio played through HTMLAudioElement
    const originalAudioPlay = HTMLAudioElement.prototype.play;
    HTMLAudioElement.prototype.play = function() {
        if (blockedSounds.some(sound => this.src.includes(sound))) {
            console.log('Blocked sound (HTMLAudioElement):', this.src);
            return Promise.reject('Blocked sound');
        }
        return originalAudioPlay.apply(this, arguments);
    };

    // List of unwanted classes to remove
    const unwantedClasses = [
        'mirror',
        'live-stream-player_blur__7BhBE'
    ];

    // Check every 3 seconds and remove unwanted classes
    setInterval(() => {
        const body = document.querySelector('body');
        if (body) {
            unwantedClasses.forEach(className => {
                if (body.classList.contains(className)) {
                    body.classList.remove(className);
                }
            });
        }

        // Target both body and video player specifically
        const videoPlayer = document.querySelector('.live-stream-player_container__A4sNR');
        [body, videoPlayer].forEach(element => {
            if (element) {
                unwantedClasses.forEach(className => {
                    if (element.classList.contains(className)) {
                        element.classList.remove(className);
                    }
                });
            }
        });
    }, 3000);

    // Extract logged-in username
    function getLoggedInUsername() {
        const userElement = document.querySelector('.top-bar-user_display-name__bzlpw');
        return userElement ? userElement.textContent.trim() : null;
    }

    // Remove text-shadow and change font-weight for the logged-in user
    function styleLoggedInUserMessages() {
        const username = getLoggedInUsername();
        if (!username) return;

        const messages = document.querySelectorAll('.chat-message-default_user__uVNvH');
        messages.forEach(message => {
            if (message.textContent.includes(username)) {
                const userElement = message;
                if (userElement) {
                    userElement.style.textShadow = 'none';
                    userElement.style.fontWeight = '1000';
                }

                const messageTextElement = message.closest('.chat-message-default_chat-message-default__JtJQL').querySelector('.chat-message-default_body__iFlH4');
                if (messageTextElement) {
                    messageTextElement.style.textShadow = 'none';
                    messageTextElement.style.fontWeight = '1000';
                }
            }
        });
    }

    // Highlight messages and add glowing username for the logged-in user
    function highlightUserMessages() {
        const username = getLoggedInUsername();
        if (!username) return;

        const messages = document.querySelectorAll('.chat-message-default_user__uVNvH');
        messages.forEach(message => {
            if (message.textContent.includes(username)) {
                const chatMessage = message.closest('.chat-message-default_chat-message-default__JtJQL');

                if (chatMessage && !chatMessage.classList.contains('highlighted-message')) {
                    chatMessage.classList.add('highlighted-message');
                }

                if (!message.classList.contains('glowing-username')) {
                    message.classList.add('glowing-username');
                }
            }
        });
    }

    // Re-check messages every second and apply the styles
    setInterval(() => {
        highlightUserMessages();
        styleLoggedInUserMessages();
    }, 1000);

    // Custom style for the user's messages
    GM_addStyle(`
        body, .layout_layout__5rz87, .select_options__t1ibN {
            background-image: url('https://images.gamebanana.com/img/ss/mods/5f681fd055666.jpg') !important;
            background-size: cover !important;
            background-position: center !important;
            background-repeat: no-repeat !important;
        }
        .chat_chat__2rdNg {
            background-image: url('https://i.imgur.com/UVjYx1I.gif') !important;
            background-size: cover !important;
            background-position: center !important;
            background-repeat: no-repeat !important;
        }
        .highlighted-message {
            background-color: rgba(125, 5, 5, 0.4) !important;
        }
        .glowing-username {
            -webkit-text-stroke: 1px rgba(0, 255, 0, 0.2);
            filter: drop-shadow(0 0 1px #00ff00) drop-shadow(0 0 2px #00ff00);
        }
        .maejok-input-invalid, .maejok-context-message, .maejok-tts-warning-text,
        .chat_header__8kNPS, .top-bar_top-bar__X4p2n, .panel_body__O5yBA, .inventory_slots__D4IrC {
            background-color: limegreen !important;
            border-color: limegreen !important;
        }
        .panel_header__T2yFW {
            background-color: darkgreen !important;
        }
        .top-bar_top-bar__X4p2n {
            box-shadow: none !important;
        }
        .maejok-context-message svg path {
            fill: black !important;
        }
        .live-stream_name__ngU04, {
            color: limegreen !important;
        }
        .hls-stream-player_hls-stream-player__BJiGl, .live-stream-player_container__A4sNR, .layout_center__Vsd3b {
            opacity: 1;
        }
        .ads_ads__Z1cPk {
            opacity: 0;
        }
    `);
})();