replace furry

Уточка в диалогах и на странице 404.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         replace furry
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Уточка в диалогах и на странице 404.
// @author       Shadman
// @match        https://lolz.live/*
// @match        https://lzt.market/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lolz.live
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const CONVERSATIONS_IMAGE_URL = "https://i.ibb.co/Rphyg3QH/utka-lolz.png";
    const ERROR_404_IMAGE_URL = "https://i.ibb.co/bMvVSTdV/utya-utya-duck.png";
    const style = document.createElement('style');
    style.innerHTML = `
        /* Правило для диалогов */
        img.conversationCapImage {
            content: url("${CONVERSATIONS_IMAGE_URL}") !important;
            object-fit: contain;
        }
        .error-container img {
            content: url("${ERROR_404_IMAGE_URL}") !important;
            object-fit: contain;
            width: 100%; /* На странице ошибки картинка может быть большой */
            max-height: 300px; /* Ограничим высоту, чтобы не была на весь экран */
        }
    `;
    document.head.appendChild(style);
    function replaceSources() {
        const convImg = document.querySelector('img.conversationCapImage');
        if (convImg && convImg.src !== CONVERSATIONS_IMAGE_URL) {
            convImg.src = CONVERSATIONS_IMAGE_URL;
        }
        const errorImg = document.querySelector('.error-container img');
        if (errorImg && errorImg.src !== ERROR_404_IMAGE_URL) {
            errorImg.src = ERROR_404_IMAGE_URL;
            errorImg.removeAttribute('width');
            errorImg.removeAttribute('height');
        }
    }

    const observer = new MutationObserver((mutations) => {
        replaceSources();
    });

    observer.observe(document.documentElement, {
        childList: true,
        subtree: true
    });

    replaceSources();
})();