PornoLab Less Spoilers

Allows to get rid of some spoilers in posts, for example in quotes

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 or Violentmonkey 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         PornoLab Less Spoilers
// @namespace    copyMister
// @version      1.0
// @description  Allows to get rid of some spoilers in posts, for example in quotes
// @description:ru  Позволяет убрать некоторые спойлеры в постах, например в цитатах
// @author       copyMister
// @license      MIT
// @match        https://pornolab.net/forum/viewtopic.php*
// @match        https://pornolab.net/forum/search.php*
// @match        https://pornolab.net/forum/privmsg.php*
// @match        https://pornolab.cc/forum/viewtopic.php*
// @match        https://pornolab.cc/forum/search.php*
// @match        https://pornolab.cc/forum/privmsg.php*
// @match        https://pornolab.biz/forum/viewtopic.php*
// @match        https://pornolab.biz/forum/search.php*
// @match        https://pornolab.biz/forum/privmsg.php*
// @match        https://pornolab.lib/forum/viewtopic.php*
// @match        https://pornolab.lib/forum/search.php*
// @match        https://pornolab.lib/forum/privmsg.php*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pornolab.net
// @run-at       document-body
// @grant        GM_addStyle
// @homepageURL  https://pornolab.net/forum/viewtopic.php?t=2714164
// ==/UserScript==

(function() {
    'use strict';

    $.holdReady(true);

    GM_addStyle('.q { max-height: none !important; }');

    document.addEventListener('DOMContentLoaded', function() {
        document.querySelectorAll('.sp-body[title="Цитата"]').forEach(function(sp) {
            sp.firstElementChild.remove();
            sp.parentElement.outerHTML = sp.innerHTML;
        });

        document.querySelectorAll(
            ':is(.post-user-message, .post_body) > .sp-wrap > .sp-body:is(:not([title]), [title=""])'
        ).forEach(function(sp) {
            if (sp.parentElement.parentElement.innerHTML.trim() === sp.parentElement.outerHTML.trim()) {
                while (sp.firstElementChild && sp.firstElementChild.classList.contains('sp-wrap')) {
                    sp.firstElementChild.outerHTML = sp.firstElementChild.firstElementChild.innerHTML;
                }
                sp.parentElement.outerHTML = sp.innerHTML
                    .replaceAll(/(?:Ѣ|Ѣ)/g, 'Е')
                    .replaceAll(/(?:ѣ|ѣ)/g, 'е')
                    .replaceAll(/(?:[ѴІ]|Ѵ|І)/g, 'И')
                    .replaceAll(/(?:[ѵі]|ѵ|і)/g, 'и')
                    .replaceAll(/(?:Ѿ|Ѿ)/g, 'От')
                    .replaceAll(/(?:ѿ|ѿ)/g, 'от')
                    .replaceAll(/ъ(&|[.,:;?!»"')\-\]]|\s|$)/gi, '$1')
                    .trim();
            }
        });

        $.holdReady(false);
    });
})();