@Hazuki 发现了一个非常诡异的 bug:欧路词典在安卓系统上不能正确的设置黑暗模式,iOS 正常。我自己调试了一下,发现是 jQuery 因为不明原因导致 $("body")
选中了一个 class
是 expDiv
的 div
元素,进而无法修改 body
的 data-theme
为 dark
。不知道是不是被欧路词典内置的 jQuery 重载了?
然后,这样 patch 一下就能正确设置:
diff --git a/oaldpe-old.js b/oaldpe.js
index c893575..f4918da 100755
--- a/oaldpe-old.js
+++ b/oaldpe.js
@@ -1182,7 +1182,7 @@ function main() {
}
// Set the theme based on the body's class
- const setEudicTheme = () => $oaldpe.attr('data-theme', $('body').is('.black, .night') ? 'dark' : 'light');
+ const setEudicTheme = () => $oaldpe.attr('data-theme', $(document.body).is('.black, .night') ? 'dark' : 'light');
setEudicTheme(); // Initial check
new MutationObserver((mutationsList) => {
mutationsList.forEach((mutation) => {
在 oaldpe.js
的第 1185 行。
一些环境信息:
- OALDPE:20250110
- 欧路词典:10.0.2
- 系统:OneUI 6.1.1, Android 14