Greasy Fork

Greasy Fork is available in English.

Fanfiction.net dark theme

A dark theme for fanfiction.net. Works well for night reading.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Fanfiction.net dark theme
// @namespace   Danielv123
// @description A dark theme for fanfiction.net. Works well for night reading.
// @include     https://www.fanfiction.net/s/*
// @include     https://www.fictionpress.com/s/*
// @version     1.1
// @grant       none
// ==/UserScript==
// Settings:
// Display comment section
var commentSection = false;
// End of settings
//
// Get all elements that have a style attribute
var elms = document.querySelectorAll('*[style]');
// Loop through them
Array.prototype.forEach.call(elms, function (elm) {
  // Get the color value
  var clr = elm.style.backgroundColor || '';
  // Remove all whitespace, make it all lower case
  clr = clr.replace(/\s/g, '').toLowerCase();
  // Switch on the possible values we know of
  console.log(clr)
  switch (clr) {
    case 'white':
      elm.style.backgroundColor = '#262626';
      console.log('Color set')
      break;
  }
});
document.body.style.backgroundColor = '#666'
var lightGreyStuff = document.getElementsByClassName('zmenu')
for (var i = 0; i < lightGreyStuff.length; i++) {
  lightGreyStuff[i].style.backgroundColor = '#454545'
}
document.body.style.color = 'white';
if (commentSection === false) {
  document.getElementById('review').style.display = 'none';
}

setTimeout(() => {
    console.log("Updating CSS")
document.querySelector("body > style").innerHTML += `
.lc-wrapper .xcontrast_txt {
  color:white;
}
.xcontrast_txt{
  color:lightgray;
}
.lc-wrapper .lc {
  background-color: #262626;
}
.lc-left {
  background-color: #262626;
}
`
}, 100)