禁用加粗斜体

将加粗、倾斜文本恢复标准文字,阅读舒适。ps:原本想将文字恢复为黑色,但暗黑模式可能有白色、灰色,不好配置。

// ==UserScript==
// @name         禁用加粗斜体
// @namespace    https://greasyfork.org/users/1171320
// @version      1.2
// @description  将加粗、倾斜文本恢复标准文字,阅读舒适。ps:原本想将文字恢复为黑色,但暗黑模式可能有白色、灰色,不好配置。
// @author       yzcjd
// @author2     Lama AI 辅助
// @match        *://*/*
// @run-at       document-end
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 定义函数以恢复字体样式
    function normalizeFontStyles() {
        // 获取所有元素
        const elements = document.querySelectorAll('*');

        elements.forEach(element => {
            const style = window.getComputedStyle(element);

            // 检查字体样式并恢复正常
            if (style.fontStyle === 'italic' || style.fontWeight >= 600) {
                element.style.fontStyle = 'normal';
                element.style.fontWeight = 'normal';
            }
        });
    }

    // 执行函数以恢复字体样式
    normalizeFontStyles();
})();