Reddit - Block NSFW

Redirects NSFW subreddits to another site.

目前为 2016-02-28 提交的版本。查看 最新版本

// ==UserScript==
// @name		Reddit - Block NSFW
// @description		Redirects NSFW subreddits to another site.
// @version		1.0
// @include		/^https?://.*\.reddit\.com/r/.*$/
// @license		GPLv3
// @grant		GM_xmlhttpRequest
// @namespace https://gf.qytechs.cn/users/10480
// ==/UserScript==

var redirectUrl = "https://www.reddit.com";	// Set this to url you want to redirect to.

var url = document.URL;

if (url.substring(url.length-1) != "/")
{
	url = url + "/";
}

var jsonUrl = url + "about.json";

var json = GM_xmlhttpRequest
({
	method: "GET",
	url: jsonUrl,
	synchronous: true
}).responseText;

json = JSON.parse(json);

if (json.data.over18)
{
	window.location.replace(redirectUrl);
}

QingJ © 2025

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