Greasy Fork

Greasy Fork is available in English.

Remove Reddit Login Requirement

Remove the on-screen modal that forces you to log in for certain posts.

当前为 2023-04-12 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove Reddit Login Requirement
// @namespace    socuul.reddit_rem_loginreq
// @version      1.0.1
// @description  Remove the on-screen modal that forces you to log in for certain posts.
// @author       SoCuul
// @license      MIT
// @match        http://*.reddit.com/*
// @match        https://*.reddit.com/*
// @icon         https://reddit.com/favicon.ico
// @grant        none
// ==/UserScript==

// Prevents script to load twice as Reddit uses iframes
if (window.top != window.self) { return false; }

(function() {
    const nsfwBlockingModal = document.querySelector('[bundlename=desktop_rpl_nsfw_blocking_modal]')
    nsfwBlockingModal?.remove()

    const nsfwBlurredContainer = document.querySelector('shreddit-blurred-container')?.shadowRoot?.firstElementChild
    nsfwBlurredContainer?.setAttribute('class', nsfwBlurredContainer.attributes?.getNamedItem('class')?.nodeValue?.replace(/xs:rounded-t-\[16px\] xs:rounded-b-\[16px\]/g, ''))

    const mainContent = document.querySelector('.sidebar-grid')
    mainContent?.setAttribute('style', mainContent.attributes?.getNamedItem('style')?.nodeValue?.replace(/filter: blur\(4px\);/g, ''))

    const body = document.querySelector('body')
    body?.setAttribute('style', body.attributes?.getNamedItem('style')?.nodeValue?.replace(/pointer-events: none; overflow: hidden;/g, ''))

    //Remove other elements
    const observerOptions = { subtree: true, childList: true }
    const mObserver = new MutationObserver(function() {

        const nsfwBlockingContainer = document.querySelector('xpromo-nsfw-blocking-container')?.shadowRoot?.querySelector('.prompt')
        nsfwBlockingContainer?.remove()

    })

    mObserver.observe(document, observerOptions)

})();