您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adding background color for sites that miss that attribute (see screenshots)
- // ==UserScript==
- // @name dark-one-fix
- // @namespace dark-one-fix
- // @description Adding background color for sites that miss that attribute (see screenshots)
- // @include http://*
- // @include https://*
- // @version 0.1.0
- // @author Sergey Ushakov <sergushakov.public@gmail.com>
- // @grant none
- // ==/UserScript==
- /* globals window, document, Array */
- (function() {
- 'use strict';
- var bgColor = document.body.style.backgroundColor || "",
- color = document.body.style.color || "",
- inputs = ["input", "textarea"],
- colors = {
- bgColor: "#fff",
- color: "#000"
- },
- mozDefColors = {
- bgColor: "rgb(32, 31, 31)",
- color: "rgb(212, 210, 207)"
- }
- ;
- if (bgColor.length === 0) {
- document.body.style.backgroundColor = colors.bgColor;
- }
- if (color.length === 0) {
- document.body.style.color = colors.color;
- }
- inputs.forEach(function(selector) {
- Array.prototype.forEach.call(document.querySelectorAll(selector), function(x){
- var style = window.getComputedStyle(x, null);
- if (style.getPropertyValue("background-color") === mozDefColors.bgColor) {
- x.style.backgroundColor = colors.bgColor;
- }
- if (style.getPropertyValue("color") === mozDefColors.color) {
- x.style.color = colors.color;
- }
- });
- });
- })();