WarningTheme

Предупреждение. Закрытая тема

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.

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

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         WarningTheme
// @namespace    http://tampermonkey.net/
// @version      v1 2024-08-19
// @description  Предупреждение. Закрытая тема
// @author       Melanty & molihan
// @license      MIT
// @match        https://lolz.live/threads/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lolz.live
// @grant        none
// @namespace    https://greasyfork.org/ru/users/1187197
// ==/UserScript==
(function() {
    'use strict';


    function createWarningBanner() {
        var warningBanner = document.createElement("div");
        warningBanner.className = "sectionMain PollContainer mn-15-0-0";
        warningBanner.style.padding = "16px 20px";
        warningBanner.style.fontSize = "16px";
        warningBanner.style.fontWeight = "800";
        warningBanner.style.background = "#342B1C";
        warningBanner.style.color = "#E6BF4A";
        warningBanner.style.display = "flex";
        warningBanner.style.alignItems = "center";

        var lockIcon = document.createElement("i");
        lockIcon.className = "fa fa-lock"; 
        lockIcon.style.marginRight = "10px"; 
        lockIcon.style.fontSize = "16px";


        var warningText = document.createElement("h1");
        warningText.style.fontWeight = "600";
        warningText.innerText = "В этой теме нельзя размещать новые ответы.";

        warningBanner.appendChild(lockIcon);
        warningBanner.appendChild(warningText);

        return warningBanner;
    }


    if (document.body.innerText.includes("Вы не можете выполнить это действие, потому что тема была закрыта.")) {
        var pageContent = document.querySelector(".pageContent");
        if (pageContent) {
            var titleBar = pageContent.querySelector(".titleBar") || document.querySelector(".titleBar");

            if (titleBar) {
                var warningBanner = createWarningBanner();
                titleBar.insertAdjacentElement('afterend', warningBanner);
            }
        }
    }
})();