Skip to content

Commit adf81f5

Browse files
committed
优化 代码
1 parent dcd15ff commit adf81f5

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

DarkMode.user.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 护眼模式
3-
// @version 1.2.0
3+
// @version 1.2.1
44
// @author X.I.U
55
// @description 简单有效的全网通用护眼模式、夜间模式、暗黑模式
66
// @match *://*/*
@@ -254,6 +254,9 @@
254254
GM_setValue(`${Name}`, true);
255255
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
256256
}
257+
if (Name === 'menu_autoRecognition') {
258+
location.reload(); // 刷新网页
259+
}
257260
registerMenuCommand(); // 重新注册脚本菜单
258261
};
259262

@@ -332,7 +335,10 @@
332335
}, 5);
333336
}
334337

335-
let websiteList = menu_value('menu_forcedToEnable'); // 强制当前网站启用护眼模式
338+
let websiteList = [];
339+
if (menu_value('menu_autoRecognition')) { // 智能排除自带暗黑模式的网页 (beta)
340+
websiteList = menu_value('menu_forcedToEnable'); // 强制当前网站启用护眼模式
341+
}
336342

337343
// 为了避免 body 还没加载导致无法检查是否设置背景颜色
338344
let timer = setInterval(function(){ // 每 10 毫秒检查一下 body 是否已存在

0 commit comments

Comments
 (0)