A Universal Dark Theme

Universal Dark Mode to fix flashbang sites like fitgirl repacks or wikipedia

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         A Universal Dark Theme
// @description  Universal Dark Mode to fix flashbang sites like fitgirl repacks or wikipedia
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-idle
// @version      2.0
// @author       TallTacoTristan
// @license MIT
// @namespace https://greasyfork.org/users/1253611
// ==/UserScript==
  function applyDarkTheme() {
    var style = document.createElement('style');
    style.innerHTML = `
      body, p, span, div, a, h1, h2, h3, h4, h5, h6, li, td:not(video) {
        color: #008080!important;
      }
      body, p, span, div, a, h1, h2, h3, h4, h5, h6, li, td[style*='background-image'] {
        background-color: #000000!important;
        background-image: none!important;
      }
      input[type='text'], input[type='password'], textarea, select {
        background-color: #D8BFD8!important;
        position: relative;
        z-index: 9999;
      }
      /* Add this rule to change non-interactable elements to black */
      body *:not(input[type='text']):not(input[type='password']):not(textarea):not(select) {
        background-color: #000000!important;
        color: #008080!important;
      }
    `;
    document.head.appendChild(style);
  }

  // Check if the current hostname is excluded
  if (!(localStorage.getItem("excluded") === window.location.hostname)) {
    applyDarkTheme();
  }

  // Create your button element
  var includeButton = document.createElement('button');
  includeButton.innerHTML = 'Include';

  var excludeButton = document.createElement('button');
  excludeButton.innerHTML = 'Exclude';

  // Append the buttons to the body of the page
  var buttonContainer = document.createElement('div');
  buttonContainer.style.position = 'fixed';
  buttonContainer.style.top = '10px';
  buttonContainer.style.right = '10px';
  buttonContainer.style.zIndex = '9999';
  buttonContainer.appendChild(includeButton);
  buttonContainer.appendChild(excludeButton);
  document.body.appendChild(buttonContainer);

  // Add functionality to the buttons
  includeButton.addEventListener('click', function() {
    localStorage.removeItem("excluded", window.location.hostname); //make sure this matches
    location.reload();
  });

  excludeButton.addEventListener('click', function() {
    localStorage.setItem("excluded", window.location.hostname); // Change "excluded" to something else if multiple userscripts use this code
    location.reload();
  });

  // Check the localStorage for the user's preference
  var showButtons = GM_getValue('showButtons', true);
  buttonContainer.style.display = showButtons? 'block' : 'none';

  // Register the GM menu commands
  GM_registerMenuCommand("Hide Buttons", function() {
    buttonContainer.style.display = 'none';
    GM_setValue('showButtons', false);
  }, 'h');

  GM_registerMenuCommand("Show Buttons", function() {
    buttonContainer.style.display = 'block';
    GM_setValue('showButtons', true);
  },'s');

  GM_registerMenuCommand("Include Current Site", function() {
    localStorage.removeItem("excluded", window.location.hostname);
    applyDarkTheme();
  });

  GM_registerMenuCommand("Exclude Current Site", function() {
    localStorage.setItem("excluded", window.location.hostname); // Change "excluded" to something else if multiple userscripts use this code
    location.reload();
  });