您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Apply a pure black background to any website, ensure text visibility, and differentiate links
当前为
- // ==UserScript==
- // @name Pure Black Background with Visible Text and Links
- // @namespace http://tampermonkey.net/
- // @version 0.3
- // @description Apply a pure black background to any website, ensure text visibility, and differentiate links
- // @author Patrick Gomes
- // @match *://*/*
- // @grant none
- // @require https://code.jquery.com/jquery-3.6.0.min.js
- // ==/UserScript==
- (function() {
- 'use strict';
- // Apply pure black background and ensure text visibility
- const applyStyles = () => {
- $('*').each(function() {
- const color = $(this).css('color');
- if (color) {
- const rgb = color.match(/\d+/g);
- if (rgb) {
- const brightness = (parseInt(rgb[0]) * 299 + parseInt(rgb[1]) * 587 + parseInt(rgb[2]) * 114) / 1000;
- if (brightness < 128) {
- $(this).css('color', '#FFFFFF');
- }
- }
- }
- $(this).css('background-color', '#000000');
- });
- // Style links and visited links
- $('a:link').css('color', '#1E90FF'); // DodgerBlue for unvisited links
- $('a:visited').css('color', '#551A8B'); // Purple for visited links
- // Ensure text visibility for specific div
- $('div.L3Ezfd').css('color', '#FFFFFF');
- // Disable lazy loading for images
- $('img').each(function() {
- $(this).attr('loading', 'eager');
- });
- };
- // Initial style application
- applyStyles();
- // Observe for dynamically loaded content
- const observer = new MutationObserver(applyStyles);
- observer.observe(document.body, { childList: true, subtree: true });
- })();