From adf81f58fc70aee8ee80f299be318633d7b49771 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DarkMode.user.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DarkMode.user.js b/DarkMode.user.js index 6d10fb7..d9d2d85 100644 --- a/DarkMode.user.js +++ b/DarkMode.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 护眼模式 -// @version 1.2.0 +// @version 1.2.1 // @author X.I.U // @description 简单有效的全网通用护眼模式、夜间模式、暗黑模式 // @match *://*/* @@ -254,6 +254,9 @@ GM_setValue(`${Name}`, true); GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500}); } + if (Name === 'menu_autoRecognition') { + location.reload(); // 刷新网页 + } registerMenuCommand(); // 重新注册脚本菜单 }; @@ -332,7 +335,10 @@ }, 5); } - let websiteList = menu_value('menu_forcedToEnable'); // 强制当前网站启用护眼模式 + let websiteList = []; + if (menu_value('menu_autoRecognition')) { // 智能排除自带暗黑模式的网页 (beta) + websiteList = menu_value('menu_forcedToEnable'); // 强制当前网站启用护眼模式 + } // 为了避免 body 还没加载导致无法检查是否设置背景颜色 let timer = setInterval(function(){ // 每 10 毫秒检查一下 body 是否已存在