Reddit NSFW Blur Remover

Remove NSFW blur.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name     Reddit NSFW Blur Remover
// @version  5.1
// @grant    none
// @include https://www.reddit.com/r/*
// @description Remove NSFW blur.
// @namespace https://greasyfork.org/users/803889
// @license MIT
// ==/UserScript==
document.addEventListener('readystatechange', e => {
    try {
        if (document.querySelectorAll('shreddit-blurred-container div') != null) {
            Array.from(document.querySelectorAll('shreddit-blurred-container div')).forEach(button=>button.click())
        }
    } catch (error){
        if (error instanceof TypeError) {
            console.log('Inital content unblur not working');
        }
    }
  });

window.addEventListener('scroll', function(event) {
    //un-blur all
    try {
        if (document.querySelectorAll('shreddit-blurred-container div') != null) {
            Array.from(document.querySelectorAll('shreddit-blurred-container div')).forEach(button=>button.click())
        }
    } catch (error){
        if (error instanceof TypeError) {
            console.log('Scroll unblur not working');
        }
    }
})

let debug=false
let interval_documentHidden = setInterval(function () {
        if (!document.hidden) {
            if(document.readyState === 'complete') {
                
                //+18 Banner
                try{
                    //Partial Blur
                    document.querySelector('shreddit-experience-tree').shadowRoot.querySelector('shreddit-async-loader').querySelector('xpromo-nsfw-bypassable-modal-desktop').shadowRoot.querySelector('#secondary-button span [class="flex items-center gap-xs"]').click()
                }catch{if(debug){console.log('Partial Blur Not Found')}}
                try{
                    //Full Blur
                    document.querySelector('shreddit-app').querySelector('div:nth-child(4) confirm-over-18').querySelector('button').click()
                }catch{if(debug){console.log('Full Blur Not Found')}}
                
                

                //Google Banner
                try{
                    //Home Page
                    document.querySelector('iframe').remove()
                }catch{if(debug){console.log('Home Page Not Found')}}
                try{
                    //Comments Page
                    document.querySelector('#credential_picker_container').remove()
                }catch{if(debug){console.log('Comments Page Not Found')}}
                clearInterval(interval_documentHidden)
                console.log('"Reddit NSFW Blur Remover" - script complete')
            }
        }
}, 1000);