Reddit NSFW Blur Remover

Remove NSFW blur.

Από την 11/02/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey 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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);