Sleazy Fork is available in English.

Reddit NSFW Bypass

Watches for reddit NSFW login prompt, then deletes it and reveals contents.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         Reddit NSFW Bypass
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Watches for reddit NSFW login prompt, then deletes it and reveals contents.
// @author       You
// @match        https://www.reddit.com/r/*
// @icon         https://www.reddit.com/favicon.ico
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

	function doRemove(){

        const element = document.getElementById("blocking-modal-contents");
        if (element !== null) {
            element.remove();
            console.log(`[ElementRemover] 'blocking-modal-contents' removed.`);
        }

		document.querySelectorAll("svg[icon-name='nsfw-fill']").forEach(svgImage => {
			let targetParent = svgImage.parentNode.parentNode.parentNode;
			if (targetParent) {
				let imageElement = targetParent.querySelector("img");
				if (imageElement && imageElement.style && imageElement.style.filter.includes("blur")) {
					imageElement.style.filter = imageElement.style.filter.replace(/blur\(\d+px\)/g, '');
					svgImage.parentNode.parentNode.remove();
					console.log(`[ElementRemover] NSFW image revealed.`);
				}
			}
		});

		function revealNsfwContent(container) {
			revealTextContent(container);
			revealThumbnailContent(container);
		}

		function revealThumbnailContent(container) {
			const blurredBody = container.querySelector("div[slot='post-media-container']");
			if (!blurredBody) return;

			const revealedDiv = container.querySelector("div[slot='revealed']");
			if (!revealedDiv) return;
			if (revealedDiv.parentNode == blurredBody) return;

			blurredBody.insertBefore(revealedDiv, blurredBody.firstChild);

			for (let i = blurredBody.children.length - 1; i >= 1; i--) {
				blurredBody.removeChild(blurredBody.children[i]);
			}

			console.log(`[ElementRemover] NSFW thumbnail revealed. ${blurredBody.children.length} children remain.`);
		}

		function revealTextContent(container) {
			const textBody = container.querySelector("shreddit-post-text-body");
			if (!textBody) return;

			const contentZone = textBody.querySelector("div");
			if (!contentZone) return;

			textBody.querySelectorAll("div[slot='revealed']").forEach(div => {
				const contentElement = div.querySelector("div[property='schema:articleBody']");
				if (!contentElement) return;

				contentZone.insertBefore(contentElement, contentZone.firstChild);
				console.log(`[ElementRemover] NSFW content revealed.`);

				while (contentZone.children.length > 1) {
					contentZone.removeChild(contentZone.lastChild);
				}
			});
		}

		document.querySelectorAll("shreddit-post").forEach(article => revealNsfwContent(article));
    }


    const observer = new MutationObserver((_,__) => { doRemove(); });

    doRemove(null);

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

})();