Lolz Transparent Chat

Делает чат LolzTeam прозрачным.

目前為 2024-11-25 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Lolz Transparent Chat
// @namespace    http://tampermonkey.net/
// @version      1.9
// @description  Делает чат LolzTeam прозрачным.
// @author       https://lolz.live/members/5332159/zDEBRY
// @match        https://lzt.market/*
// @match        https://lolz.live/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const blurEnabled = true; // Установите true для включения размытия или false для его отключения

    const applyStylesToChat = (chatElement) => {
        if (chatElement) {
            chatElement.style.backgroundColor = 'rgba(0, 0, 0, 0.4)';
            chatElement.style.backdropFilter = blurEnabled ? 'blur(8px)' : 'none';
            chatElement.style.border = '1px solid rgba(255, 255, 255, 0.2)';

            const childElements = chatElement.querySelectorAll('*');
            childElements.forEach(el => {
                el.style.backgroundColor = 'transparent';
                el.style.border = 'none';
            });

            const taggedMessageBlocks = chatElement.querySelectorAll('.chat2-message-tagged.lztng-4kgdqr .chat2-message-block.lztng-4kgdqr');
            taggedMessageBlocks.forEach(block => {
                block.style.border = '2px solid rgb(0, 255, 0)';
                block.style.borderRadius = '10px';
                block.style.backgroundColor = 'transparent';
                block.style.padding = '4px';
            });

            const messageBlocks = chatElement.querySelectorAll('.chat2-message-block.lztng-4kgdqr');
            messageBlocks.forEach(block => {
                block.style.backgroundColor = 'transparent';
            });
        }
    };

    const createRainbowText = (nickElement) => {
        if (!nickElement.classList.contains('rainbow-applied')) {
            nickElement.style.backgroundImage = 'linear-gradient(90deg, red, orange, yellow, green, cyan, blue, violet)';
            nickElement.style.webkitBackgroundClip = 'text';
            nickElement.style.webkitTextFillColor = 'transparent';
            nickElement.style.fontWeight = 'bold';
            nickElement.style.animation = 'rainbow 3s linear infinite';
            nickElement.classList.add('rainbow-applied');
        }
    };

    const applyRainbowNick = () => {
        const nickElements = document.querySelectorAll('span');
        nickElements.forEach(nickElement => {
            if (nickElement.textContent === 'zDEBRY') {
                createRainbowText(nickElement);
            }
        });
    };

    const initializeChatStyling = () => {
        const chatElement = document.querySelector('[class^="chat2-floating"]');

        if (chatElement) {
            applyStylesToChat(chatElement);

            const observer = new MutationObserver(() => {
                applyStylesToChat(chatElement);
                applyRainbowNick();
            });

            observer.observe(chatElement, {
                childList: true,
                subtree: true
            });
        } else {
            setTimeout(initializeChatStyling, 300);
        }

        applyRainbowNick();
    };

    const addRainbowAnimationStyles = () => {
        const style = document.createElement('style');
        style.textContent = `
            @keyframes rainbow {
                0% { background-position: 0% 50%; }
                100% { background-position: 100% 50%; }
            }
        `;
        document.head.appendChild(style);
    };

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', () => {
            addRainbowAnimationStyles();
            initializeChatStyling();
        });
    } else {
        addRainbowAnimationStyles();
        initializeChatStyling();
    }
})();