Greasy Fork 还支持 简体中文。

Reddit - force default theme

Force subreddits to use the default theme, even while logged out

目前為 2018-03-03 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Reddit - force default theme
// @description Force subreddits to use the default theme, even while logged out
// @namespace   reddit-force-default-theme
// @author      valacar
// @version     1.0
// @license     MIT
// @include     https://www.reddit.com/*
// @include     https://np.reddit.com/*
// @include     https://xm.reddit.com/*
// @grant       none
// @run-at      document-start
// @noframes
// @compatible  firefox Firefox
// @compatible  chrome Chrome
// ==/UserScript==

(function() {
  'use strict';

  // replace header logo with default snoo mascot (little alien guy) on subreddits that replace it
  function fixHeader(headerNode) {
    headerNode.innerHTML = "";
    headerNode.removeAttribute("src");
    headerNode.classList.add("default-header");
    headerNode.setAttribute("title", "reddit.com");
    headerNode.id = "header-img";
  }

  function mutationCallback(mutationRecord) {
    for (const mr of mutationRecord) {
      for (const node of mr.addedNodes) {
        // fix header
        if (node.id && node.id === "header-img-a") {
          fixHeader(node);
        }
        // delete signup banner
        if (node.classList && node.classList.contains("listingsignupbar")) {
          node.remove();
        }
      }
    }
  }


  // find and remove any custom stylesheet
  const customStyles = document.head.querySelectorAll('link[rel="stylesheet"][title="applied_subreddit_stylesheet"]');
  for (const link of [...customStyles]) {
    link.remove();
  }

  // create observer and start watching for dynamic content
  const watcher = new MutationObserver(mutationCallback);
  watcher.observe(document, {childList: true, subtree: true});

  // kill mutation observer after a while
  setTimeout(() => {
    watcher.disconnect();
  }, 10 * 1000);

})();