Skip to content

Commit 994f7bb

Browse files
committed
fix: 🐛 修复绅士漫画显示错误
#316
1 parent 04f347a commit 994f7bb

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,15 +522,12 @@ try {
522522
let getImgList: InitOptions['getImgList'] | undefined;
523523
if (location.pathname.startsWith('/photos-slide-aid-')) {
524524
getImgList = async () => {
525-
await wait(() => querySelector('#content img'));
526-
// 如果是单/双页模式,得先切换成下拉模式来显示所有图片
527-
const nowMode = querySelector(':is(#btn-d, #btn-s).active');
528-
if (nowMode) unsafeWindow.reader.setMode('vertical');
529-
const imgList = querySelectorAll<HTMLImageElement>(
530-
'#content img',
531-
).map((e) => e.getAttribute('src')!);
532-
nowMode?.click();
533-
return imgList;
525+
const id = location.pathname.match(/-(\d+).html/)?.[1];
526+
if (!id) throw new Error(t('site.changed_load_failed'));
527+
const res = await request<string>(`/photos-item-aid-${id}.html`);
528+
const reRes = res.responseText.match(/"page_url":(\[.+\]),/);
529+
if (!reRes) throw new Error(t('site.changed_load_failed'));
530+
return eval(reRes[1]) as string[]; // oxlint-disable-line no-eval
534531
};
535532
} else if (location.pathname.startsWith('/photos-slist-aid-'))
536533
getImgList = () =>

0 commit comments

Comments
 (0)