From e26e633764ac81654782ced55a9a777eccefc3b1 Mon Sep 17 00:00:00 2001 From: hymbz Date: Sat, 12 Oct 2024 22:31:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E4=BF=AE=E5=A4=8D=E5=87=BA?= =?UTF-8?q?=E9=94=99=E5=9B=BE=E7=89=87=E6=A0=87=E8=AF=86=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Manga/actions/imageLoad.ts | 4 ++-- src/components/Manga/components/ComicImg.module.css | 3 +++ src/helper/other.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Manga/actions/imageLoad.ts b/src/components/Manga/actions/imageLoad.ts index 914e0e80..24b186df 100644 --- a/src/components/Manga/actions/imageLoad.ts +++ b/src/components/Manga/actions/imageLoad.ts @@ -53,7 +53,7 @@ export const handleImgError = (url: string, e?: HTMLImageElement) => { img.type = undefined; if ( imgIndex.some((i) => renderImgList().has(i)) && - (imgErrorNum.get(img.src) ?? 0) < 3 + (imgErrorNum.get(img.src) ?? 0) < 2 ) img.loadType = 'wait'; }); @@ -235,7 +235,7 @@ createEffectOn(loadingImgList, async (downImgList, prevImgList) => { if (abortMap.has(url) || store.imgMap[url].blobUrl) continue; const controller = new AbortController(); - const handleTimeout = debounce(timeoutAbort, 1000 * 5); + const handleTimeout = debounce(timeoutAbort, 1000 * 3); controller.signal.addEventListener('abort', handleTimeout.clear); abortMap.set(url, controller); handleTimeout(url); diff --git a/src/components/Manga/components/ComicImg.module.css b/src/components/Manga/components/ComicImg.module.css index 4392ccb2..08c154d7 100644 --- a/src/components/Manga/components/ComicImg.module.css +++ b/src/components/Manga/components/ComicImg.module.css @@ -37,7 +37,10 @@ margin-right: inherit; margin-bottom: auto; margin-left: inherit; + } + & > picture, + & > picture::after { background-color: var(--hover-bg-color, #fff3); background-image: var(--md-photo); background-repeat: no-repeat; diff --git a/src/helper/other.ts b/src/helper/other.ts index 27c48929..14f6d748 100644 --- a/src/helper/other.ts +++ b/src/helper/other.ts @@ -241,6 +241,7 @@ export const waitImgLoad = ( ) => new Promise((resolve, reject) => { const img = typeof target === 'string' ? new Image() : target; + if (img.complete) resolve(img); const id = timeout ? window.setTimeout(() => reject(new Error('timeout')), timeout)