diff --git a/src/pages/[manga]/index.svelte b/src/pages/[manga]/index.svelte index a1a3c29..456b4b3 100644 --- a/src/pages/[manga]/index.svelte +++ b/src/pages/[manga]/index.svelte @@ -42,7 +42,6 @@ hashes.push(hash); } - console.log(URLs); text = "Found " + URLs.length + " pages"; const file = streamSaver.createWriteStream(`${manga.title.en} ${chapter.data.attributes.chapter}.epub`, { writableStrategy: undefined, // (optional) @@ -60,7 +59,6 @@ writer.write(data); } if(final) { - console.log("Finished generating zip."); writer.close(); } }; @@ -78,13 +76,6 @@ `), true); - /** - * @param {string} string - */ - function format(string) { - return string.substr(0, string.lastIndexOf(".")).replace(/-/g, ""); - } - const opf = new ZipPassThrough("OEBPS/content.opf"); zip.add(opf); opf.push(enc.encode(` @@ -96,8 +87,9 @@ en Unknown https://manga.danbulant.eu/${mangaId}/${chapter.data.id} + Image - ${chapter.data.attributes.updatedAt.toString().split("+")[0]} + ${chapter.data.attributes.updatedAt.toString().split("+")[0]}Z pre-paginated portrait landscape @@ -105,47 +97,51 @@ - ${hashes.map(t => ` `).join("\n")} + ${hashes.map((t, i) => ` `).join("\n")} + ${hashes.map((t, i) => ` `).join("\n")} - ${hashes.map((t, i) => ` `).join("\n")} + ${hashes.map((t, i) => ` `).join("\n")} + `), true); const ncx = new ZipPassThrough("OEBPS/toc.ncx"); zip.add(ncx); - ncx.push(enc.encode(` - - - - - - - - ${manga.title.en} ${chapter.data.attributes.chapter} - - - Unknown - + ncx.push(enc.encode(` + + + + + + + + + ${manga.title.en} ${chapter.data.attributes.chapter} + + + Unknown + - - - - ${manga.title.en} ${chapter.data.attributes.chapter} - - - - -`), true); + + ${hashes.map((t, i) => ` + + + ${manga.title.en} ${chapter.data.attributes.chapter} ${i} + + + + `).join("\n")} + +`), true); const fallback = new ZipPassThrough("OEBPS/fallback.xhtml"); zip.add(fallback); fallback.push(enc.encode(` - ${manga.title.en} ${chapter.data.attributes.chapter} @@ -153,6 +149,15 @@

This book cannot be opened on this device or using this program

We're sorry

+ + `), true); @@ -165,6 +170,19 @@ const image = new ZipPassThrough("OEBPS/" + hash); zip.add(image); image.push(new Uint8Array(await res.arrayBuffer()), true); + const textContent = new ZipPassThrough("OEBPS/" + i + ".xhtml"); + zip.add(textContent); + textContent.push(enc.encode(` + + + Page ${i + 1} + + + + + + + `), true); } zip.end();