Skip to content

Commit

Permalink
fix: Fix typo and syntax error in WeReadHelper-mark.js and WeReadHelp…
Browse files Browse the repository at this point in the history
…er.js
  • Loading branch information
mefengl committed Dec 13, 2023
1 parent 6f95e86 commit 7f91b9f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
> 一个目前还在开发中的 Chrome 扩展,现在能做的有自动发送当前网页文章内容到 ChatGPT 去翻译,去总结,还在开发中,欢迎体验~
[Join Discord Server | 加入 Discord 讨论 | Discordのディスカッションに参加する](https://discord.gg/pwTKpnc2sF)
> 一个 Discord 服务器,这里会回复的快一点,欢迎加入讨论~
> 一个 Discord 服务器,这里会回复的快一点,欢迎加入讨论~
22 changes: 12 additions & 10 deletions WeReadHelper-mark.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,24 @@ const pageSound2 = 'data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4L
$('.readerControls').stop().css('opacity', '0.8')
// 解决有时用户头像无法正常工作的问题
// 设置一个最大重载次数
const MAX_RELOAD_COUNT = 3;
const MAX_RELOAD_COUNT = 3
// 从 localStorage 获取当前重载次数
let reloadCount = parseInt(localStorage.getItem('reloadCount')) || 0;
let reloadCount = Number.parseInt(localStorage.getItem('reloadCount')) || 0
setTimeout(() => {
if (!$('.wr_avatar_img').attr('src').includes('wx.qlogo.cn')) {
if (reloadCount < MAX_RELOAD_COUNT) {
localStorage.setItem('reloadCount', ++reloadCount);
location.reload();
} else {
localStorage.removeItem('reloadCount');
console.error('Reached max reload count, not reloading anymore.');
localStorage.setItem('reloadCount', ++reloadCount)
location.reload()
}
} else {
localStorage.removeItem('reloadCount');
else {
localStorage.removeItem('reloadCount')
console.error('Reached max reload count, not reloading anymore.')
}
}
else {
localStorage.removeItem('reloadCount')
}
}, 2500);
}, 2500)
})
}, 200)

Expand Down
22 changes: 12 additions & 10 deletions WeReadHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,24 @@ const pageSound2 = 'data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4L
$('.readerControls').stop().css('opacity', '0.8')
// 解决有时用户头像无法正常工作的问题
// 设置一个最大重载次数
const MAX_RELOAD_COUNT = 3;
const MAX_RELOAD_COUNT = 3
// 从 localStorage 获取当前重载次数
let reloadCount = parseInt(localStorage.getItem('reloadCount')) || 0;
let reloadCount = Number.parseInt(localStorage.getItem('reloadCount')) || 0
setTimeout(() => {
if (!$('.wr_avatar_img').attr('src').includes('wx.qlogo.cn')) {
if (reloadCount < MAX_RELOAD_COUNT) {
localStorage.setItem('reloadCount', ++reloadCount);
location.reload();
} else {
localStorage.removeItem('reloadCount');
console.error('Reached max reload count, not reloading anymore.');
localStorage.setItem('reloadCount', ++reloadCount)
location.reload()
}
else {
localStorage.removeItem('reloadCount')
console.error('Reached max reload count, not reloading anymore.')
}
} else {
localStorage.removeItem('reloadCount');
}
else {
localStorage.removeItem('reloadCount')
}
}, 2500);
}, 2500)
})
}, 200)

Expand Down

0 comments on commit 7f91b9f

Please sign in to comment.