Greasy Fork 还支持 简体中文。

Lolz.live Icon Replacer / Deleter

Удаляет иконки или заменяет их на кастомные с настройками

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Lolz.live Icon Replacer / Deleter
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  Удаляет иконки или заменяет их на кастомные с настройками
// @author       eretly
// @match        https://lolz.live/*
// @match        https://lzt.market/*
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // НАСТРОЙКИ
    const YOUR_IMAGE_URL = "https://cspromogame.ru//storage/upload_images/avatars/1309.jpg";
    const OTHERS_IMAGE_URL = "https://avatars.dzeninfra.ru/get-zen_doc/2419806/pub_62405301471f227ab529eff5_6240557718cfc01044432b7c/scale_1200";
    const YOUR_USERNAME = "KusuriYakuzen";
    const REPLACE_MODE = 1; // 1=у себя и у других, 2=только у себя, 3=все кроме себя
    const USE_DIFFERENT_ICON_FOR_OTHERS = true; // true - заменяет иконку у других на OTHERS_IMAGE_URL
    const ROUNDED_STYLE = false; // true - круглые иконки, false - квадратные
    const REMOVE_DEFAULT_ICONS = false; // true - удаляет иконки полностью

    const IMG_STYLE = `
        width: 16px;
        height: 16px;
        vertical-align: middle;
        margin-left: 3px;
        display: inline !important;
        object-fit: cover;
        ${ROUNDED_STYLE ? 'border-radius: 50%;' : ''}
    `;

    const getUsername = (el) => {
        const usernameElement = el.closest('[class*="username"], .message-userDetails, .memberHeader');
        if (!usernameElement) return null;

        const span = usernameElement.querySelector('span:not([class*="icon"]):not([class*="arrow"])');
        if (span) return span.textContent.trim();

        const link = usernameElement.querySelector('a[href*="/members/"]');
        return link ? link.textContent.trim() : null;
    };

    const processIcons = () => {
        document.querySelectorAll('.uniqUsernameIcon, .uniqUsernameIcon--custom').forEach(el => {
            if (el.dataset.processed) return;

            const username = getUsername(el);
            const isCurrentUser = username && username.includes(YOUR_USERNAME);
            let shouldReplace = false;
            let imageUrl = YOUR_IMAGE_URL;

            switch (REPLACE_MODE) {
                case 1:
                    shouldReplace = true;
                    if (USE_DIFFERENT_ICON_FOR_OTHERS && !isCurrentUser) imageUrl = OTHERS_IMAGE_URL;
                    break;
                case 2:
                    shouldReplace = isCurrentUser;
                    break;
                case 3:
                    shouldReplace = !isCurrentUser;
                    if (USE_DIFFERENT_ICON_FOR_OTHERS) imageUrl = OTHERS_IMAGE_URL;
                    break;
            }

            if (shouldReplace) {
                if (REMOVE_DEFAULT_ICONS) {
                    el.remove();
                } else {
                    const img = new Image();
                    img.src = imageUrl;
                    img.style = IMG_STYLE;
                    img.alt = "";
                    el.parentNode.insertBefore(img, el);
                    el.remove();
                }
            }

            el.dataset.processed = "true";
        });
    };

    processIcons();

    const observer = new MutationObserver(processIcons);
    observer.observe(document, { childList: true, subtree: true });

    window.addEventListener('load', () => {
        setTimeout(processIcons, 1000);
        setTimeout(processIcons, 3000);
    });
})();