Greasy Fork 还支持 简体中文。

reddit fake subscriber status

Makes subreddits appear as if you are subscribed.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        reddit fake subscriber status
// @namespace   k21np2rnmxy2s8dg8
// @match       https://*.reddit.com/r/*
// @grant       none
// @version     1.0
// @description Makes subreddits appear as if you are subscribed.
// @license     MIT
// @run-at      document-start
// @inject-into content
// ==/UserScript==

(function () {
	"use strict";

	// STEP 1: Override CSS that messes with the 'join' button
	const style = document.createElement("style");
	// Increase specificity of our selector by repeating .active a bunch
	const bloatedSelector = ".option.add" + (".active".repeat(16));
	style.textContent = `${bloatedSelector}::after,${bloatedSelector}::before{content:none!important;display:none!important;pointer-events:none!important;visibility:hidden!important;width:0!important;height:0!important;padding:0!important;z-index:-2147483648!important;}`;

	function addStyle() {
		addStyle = null; // only insert style once
		document.head.prepend(style);
	}

	// STEP 2: Add class="subscriber" to the body tag, to fool
	// custom stylesheets which style by this class.
	function addSubscriberClass() {
		document.body.classList.add("subscriber");
	}


	// Try to apply both fixes.
	// Returns true if this happened,
	// false if we need to keep waiting.
	function tryModifyPage() {
		if (document.body) {
			addStyle?.();
			addSubscriberClass();

			return true;
		} else if (document.head) {
			// Apply style while we wait for the body
			addStyle?.();
		}

		return false;
	}


	if (!tryModifyPage()) {
		// Wait for <head> and/or <body> to show up,
		// then try again.
		new MutationObserver(function () {
			if (tryModifyPage()) {
				this.disconnect();
			}
		}).observe(document.documentElement, { childList: true });
	}
})();