Skip to content

Commit 6f788bb

Browse files
committed
fix: 🐛 修复简易阅读模式在部分网站只能加载出前几张图的 bug
#291
1 parent 2a4e4cd commit 6f788bb

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/helper/other.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ type SingleThreadedState<T extends any[]> = {
162162
/** 连续调用的间隔 */
163163
timeout?: number;
164164
/** 确保本次运行完后再运行一次 */
165-
continueRun: () => void;
165+
continueRun: (...args: T) => void;
166166
};
167167
/** 确保函数在同一时间下只有一个在运行 */
168168
export const singleThreaded = <T extends any[]>(

src/userscript/otherSite/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export const otherSite = async () => {
216216
if (newUrl === store.manga.imgList[i]) return;
217217

218218
isEdited ||= true;
219-
setState('comicMap', '', 'imgList', i, newUrl);
219+
setState('comicMap', '', 'imgList', (list) => list!.with(i, newUrl));
220220
}),
221221
);
222222
if (isEdited)

src/userscript/otherSite/triggerLazyLoad.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const waitTime = 300;
140140

141141
/** 触发页面上图片元素的懒加载 */
142142
export const triggerLazyLoad = singleThreaded(
143-
async (state, targetImgList: HTMLElement[], runCondition: () => boolean) => {
143+
async (_, targetImgList: HTMLElement[], runCondition: () => boolean) => {
144144
for (const e of targetImgList) {
145145
imgShowObserver.observe(e);
146146
if (!imgMap.has(e))
@@ -168,7 +168,5 @@ export const triggerLazyLoad = singleThreaded(
168168
}
169169

170170
await triggerTurnPage(waitTime, runCondition);
171-
172-
if (targetImgList.length > 0) state.continueRun();
173171
},
174172
);

0 commit comments

Comments
 (0)