您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
White background for pages that not set background color
- // ==UserScript==
- // @name WhiteBG
- // @namespace iFantz7E.WhiteBG
- // @version 1.12
- // @description White background for pages that not set background color
- // @include *
- // @run-at document-start
- // @grant none
- // @copyright 2016, 7-elephant
- // ==/UserScript==
- function attachOnLoad(callback)
- {
- window.addEventListener("load", function (e)
- {
- callback();
- });
- }
- function attachOnReady(callback)
- {
- document.addEventListener("DOMContentLoaded", function (e)
- {
- callback();
- });
- }
- function main()
- {
- if (window.parent === window && document.documentElement && document.body)
- {
- var bgHead = window.getComputedStyle(document.documentElement).backgroundColor;
- if (bgHead === "transparent" || bgHead === "rgba(0, 0, 0, 0)")
- {
- var bgBody = window.getComputedStyle(document.body).backgroundColor;
- if (bgBody === "transparent" || bgBody === "rgba(0, 0, 0, 0)")
- {
- document.documentElement.style.setProperty("background-color", "white", "important");
- document.body.style.setProperty("background-color", "white", "important");
- }
- }
- }
- }
- attachOnReady(main);