Skip to content

Commit 419bf3e

Browse files
committed
feat: code by Trae
1 parent ee24d1d commit 419bf3e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

epub_browser/assets/chapter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ function initScript() {
11231123

11241124
// 根据设备类型显示不同的控件
11251125
if (isMobile()) {
1126-
// 移动端:显示 mobile-controls
1126+
// 移动端:只显示 mobile-controls,不操作 top-controls 和 reading-controls
11271127
const mobileControls = document.querySelector('.mobile-controls');
11281128
if (mobileControls) {
11291129
mobileControls.style.display = 'flex';
@@ -1201,7 +1201,7 @@ function initScript() {
12011201

12021202
// 根据设备类型显示不同的控件
12031203
if (isMobile()) {
1204-
// 移动端:显示 mobile-controls
1204+
// 移动端:只显示 mobile-controls,不操作 top-controls 和 reading-controls
12051205
const mobileControls = document.querySelector('.mobile-controls');
12061206
if (mobileControls) {
12071207
mobileControls.style.display = 'flex';
@@ -1244,8 +1244,8 @@ function initScript() {
12441244

12451245
// 检查是否为移动端(通过 mobile-controls 是否显示)
12461246
function isMobile() {
1247-
const mobileControls = document.querySelector('.mobile-controls');
1248-
return window.getComputedStyle(mobileControls).display !== 'none';
1247+
// 更可靠的移动端检测方法
1248+
return window.innerWidth <= 768 || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
12491249
}
12501250

12511251
// 点击屏幕中间部分切换纯净阅读模式

0 commit comments

Comments
 (0)