Skip to content

Commit 4fbac21

Browse files
authored
Merge pull request #15 from drunkg00se/hotfix/1.0.3
Hotfix/1.0.3
2 parents d2f60bd + 89e573b commit 4fbac21

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pixiv-downloader",
33
"private": true,
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/lib/components/Modal/Changelog/Changelog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<header class="modal-header text-2xl font-bold">Pixiv Downloader {__VERSION__}</header>
1515
<article class="modal-body mt-4">
1616
<ul class="list-disc list-inside leading-loose">
17-
<li>Danbooru:修复Firefox下载图片时请求被cf拒绝的问题。</li>
17+
<li>修复(Pixiv):Pixiv更新导致“已关注用户的作品”页不显示下载器的问题。</li>
1818
</ul>
1919
</article>
2020
<footer class="modal-footer relative mt-4 text-sm">

src/sites/pixiv/observerCB/downloadBar.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '../helpers/batchDownload';
99
import { config, type ConfigData } from '@/lib/config';
1010
import { getSelfId } from '@/sites/pixiv/helpers/getSelfId';
11+
import { logger } from '@/lib/logger';
1112

1213
export type FilterOption = Pick<
1314
ConfigData,
@@ -247,11 +248,21 @@ export function createFollowLatestDownloadBar() {
247248
return;
248249
}
249250

250-
const nav = document.querySelector('nav');
251-
if (!nav || nav.parentElement!.childElementCount === 1) return;
251+
const navBar = document.querySelector<HTMLDivElement>('section > div:nth-child(3)');
252+
if (!navBar || navBar.childElementCount !== 2) {
253+
logger.warn('Can not find container for download bar.');
254+
return;
255+
}
256+
257+
const baseClassesEl = document.querySelector<HTMLAnchorElement>(
258+
'section > div:first-child a:not([aria-current])'
259+
);
260+
if (!baseClassesEl) {
261+
logger.warn('Can not find styled element for download bar.');
262+
return;
263+
}
252264

253-
const navBar = nav.parentElement as HTMLDivElement;
254-
const modeSwitch = nav.nextElementSibling as HTMLDivElement;
265+
const modeSwitch = navBar.children[1] as HTMLDivElement;
255266
const filter = createFilter();
256267
navBar.parentElement!.insertBefore(filter, navBar);
257268

@@ -264,7 +275,7 @@ export function createFollowLatestDownloadBar() {
264275
dlBarRef.statusBar = dlBar.appendChild(statusBar);
265276

266277
//下载按钮
267-
const baseClasses = nav.querySelector<HTMLAnchorElement>('a:not([aria-current])')!.classList;
278+
const baseClasses = baseClassesEl.classList;
268279

269280
dlBarRef.abortBtn = dlBar.appendChild(
270281
createPdlBtn({

0 commit comments

Comments
 (0)