mirror of
https://github.com/danbulant/Mangades
synced 2026-07-09 13:00:54 +00:00
titles
This commit is contained in:
parent
0a4b9d538d
commit
cf7c147b69
4 changed files with 44 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@
|
||||||
/public/build/
|
/public/build/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.routify
|
||||||
20
src/pages/[manga]/[chapter]/_layout.svelte
Normal file
20
src/pages/[manga]/[chapter]/_layout.svelte
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script>
|
||||||
|
export var scoped;
|
||||||
|
export var chapter;
|
||||||
|
|
||||||
|
var mangaId = scoped.id;
|
||||||
|
$: mangaId = scoped.id;
|
||||||
|
var manga = scoped.manga;
|
||||||
|
$: manga = scoped.manga;
|
||||||
|
|
||||||
|
function getChapter(id) {
|
||||||
|
const data = request("chapter/" + id);
|
||||||
|
console.log(data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var chapterData = getchapter(chapter);
|
||||||
|
$: chapterData = getChapter(chapter);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<slot scoped={({ manga, mangaId, id: chapter, chapter: chapterData })} />
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import request from "../../util/request";
|
import { title } from "process";
|
||||||
|
import request from "../../util/request";
|
||||||
|
|
||||||
export var scoped;
|
export var scoped;
|
||||||
|
|
||||||
|
|
@ -8,8 +9,10 @@
|
||||||
var manga = scoped.manga;
|
var manga = scoped.manga;
|
||||||
$: manga = scoped.manga;
|
$: manga = scoped.manga;
|
||||||
|
|
||||||
function getMangaChapters(id) {
|
async function getMangaChapters(id) {
|
||||||
return request("manga/" + id + "/feed");
|
const data = await request("manga/" + id + "/feed");
|
||||||
|
data.results.sort((a, b) => a.data.attributes.chapter - b.data.attributes.chapter);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chapters = getMangaChapters(mangaId);
|
var chapters = getMangaChapters(mangaId);
|
||||||
|
|
@ -19,16 +22,26 @@
|
||||||
console.log(chapters);
|
console.log(chapters);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Chapters of {manga.title.en}</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>{manga.title.en}</h1>
|
<h1>{manga.title.en}</h1>
|
||||||
|
|
||||||
{#await chapters}
|
{#await chapters}
|
||||||
Loading chapters...
|
Loading chapters...
|
||||||
{:then chapters}
|
{:then chapters}
|
||||||
<ol>
|
<ol class="hide-nums">
|
||||||
{#each chapters.results as chapter}
|
{#each chapters.results as chapter}
|
||||||
<li>{chapter.data.attributes.title}</li>
|
<li>{chapter.data.attributes.volume ? "Vol " + chapter.data.attributes.volume : ""} Chapter {chapter.data.attributes.chapter} {chapter.data.attributes.title}</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ol>
|
</ol>
|
||||||
{/await}
|
{/await}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.hide-nums {
|
||||||
|
list-style-type: disc;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -27,6 +27,10 @@
|
||||||
$: result.then(console.log);
|
$: result.then(console.log);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Mangadex search</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<h1>MANGADEX</h1>
|
<h1>MANGADEX</h1>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue