Shreddit Unblur Images NSFW

Unblur images and redgifs iframes in sh.reddit.com

当前为 2024-01-24 提交的版本,查看 最新版本

// ==UserScript==
// @name            Shreddit Unblur Images NSFW
// @namespace       https://gf.qytechs.cn/users/821661
// @match           https://www.reddit.com/*
// @match           https://sh.reddit.com/*
// @grant           GM_addStyle
// @version         1.0
// @author          hdyzen
// @description     Unblur images and redgifs iframes in sh.reddit.com
// @license         MIT
// ==/UserScript==
'use strict';

// Verify if Shreddit
const shReddit = document.querySelector('shreddit-app');
if (!shReddit) return;

// Regex for match id image
const regexIdImg = /https:\/\/.*\/(.*)\?/;

// Interval time
const sleepTime = 2000;

// Unblur images, redgifs iframes
async function checkMedia() {
    while (true) {
        await new Promise(resolve => setTimeout(resolve, sleepTime));
        const medias = document.querySelectorAll('img.max-h-\\[100vw\\].h-full.w-full.object-contain.relative[src*="?blur="], shreddit-async-loader[bundlename="embed"');
        medias.forEach(media => {
            if (media.nodeName === 'IMG') {
                const containerImg = media.closest('shreddit-blurred-container');
                const style = document.createElement('style');
                style.innerHTML = `.inner.blurred {filter: unset !important;display: unset !important;pointer-events: unset !important;} .bg-scrim{display: none !important;} button.button-media{display: none !important;}.outer{pointer-events: none!important;}`;
                containerImg.shadowRoot.appendChild(style);

                media.src = `https://i.redd.it/${media.src.match(regexIdImg)[1]}`;
                media.onclick = e => {
                    window.open(e.target.src, '_blank');
                };

                return;
            }
            media.closest('shreddit-blurred-container').outerHTML = media.children[0].getAttribute('html');
        });
    }
}
checkMedia();

GM_addStyle(`
body {
    overflow: unset !important;
    pointer-events: unset !important;
}
shreddit-async-loader[bundlename="desktop_rpl_nsfw_blocking_modal"], div[style="position: fixed; inset: 0px; backdrop-filter: blur(4px);"]  {
    display: none !important;
}
[slot="blurred"] {
  height: 100%;
}
img.max-h-\[100vw\].h-full.w-full.object-contain.relative[src^="https://i.redd.it/"] {
    pointer-events: auto ;
}
`);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址