Skip to content

Commit

Permalink
build: merge master to package (auto)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 2, 2023
2 parents 163c28c + 7b0ddaf commit 7ab4b7a
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions src/Pixiv Downloader/illust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,32 +123,18 @@ export async function createPbdDownloadManager() {
</div>
`);

updatePbdDownloadManager(pbdDownloadManager);

return pbdDownloadManager;
}

export async function updatePbdDownloadManager(pbdDownloadManager: HTMLDivElement) {
const pbdSelect = pbdDownloadManager.querySelector<HTMLSelectElement>("select")!;

const pbdDownload = pbdDownloadManager.querySelector<HTMLButtonElement>("#pbd-download")!;
const pbdBulkDownload = pbdDownloadManager.querySelector<HTMLButtonElement>("#pbd-bulk-download")!;
const pbdSelect = pbdDownloadManager.querySelector<HTMLSelectElement>("select")!;
const pbdFilename = pbdDownloadManager.querySelector<HTMLInputElement>("#pbd-filename")!;

const illustId = getIllustId();
const illustPages = await fetchIllustPages(illustId);

pbdSelect.innerHTML = "";
pbdFilename.value = GM_getValue("illust_filename") ?? DEFAULT_FILENAME_FORMAT;

pbdFilename.addEventListener("change", () => {
GM_setValue("illust_filename", pbdFilename.value);
});

for (const page of illustPages) {
const partName = getIllustPagePartName(page.urls.original)!;
const elem = fromHTML(`<option value="${page.urls.original}">${partName}</option>`)
pbdSelect.append(elem);
}

const template = {
headers: {
Expand All @@ -173,4 +159,25 @@ export async function updatePbdDownloadManager(pbdDownloadManager: HTMLDivElemen
});
}
});

updatePbdDownloadManager(pbdDownloadManager);

return pbdDownloadManager;
}

export async function updatePbdDownloadManager(pbdDownloadManager: HTMLDivElement) {
const pbdSelect = pbdDownloadManager.querySelector<HTMLSelectElement>("select")!;
const pbdFilename = pbdDownloadManager.querySelector<HTMLInputElement>("#pbd-filename")!;

const illustId = getIllustId();
const illustPages = await fetchIllustPages(illustId);

pbdSelect.innerHTML = "";
pbdFilename.value = GM_getValue("illust_filename") ?? DEFAULT_FILENAME_FORMAT;

for (const page of illustPages) {
const partName = getIllustPagePartName(page.urls.original)!;
const elem = fromHTML(`<option value="${page.urls.original}">${partName}</option>`)
pbdSelect.append(elem);
}
}

0 comments on commit 7ab4b7a

Please sign in to comment.