mirror of
https://github.com/danbulant/Mangades
synced 2026-06-14 03:41:13 +00:00
fix requests
This commit is contained in:
parent
ea3fa779a5
commit
30cb06bd0b
4 changed files with 9 additions and 7 deletions
|
|
@ -14,7 +14,7 @@
|
|||
Loading art
|
||||
{:then list}
|
||||
{#each list.data.sort((a, b) => a.attributes.volume - b.attributes.volume) as item}
|
||||
<img on:click={() => selectedImage = `https://cors-anywhere.danbulant.cloud/https://uploads.mangadex.org/covers/${mangaId}/${item.attributes.fileName}.512.jpg`} width=512 height=805 src="https://cors-anywhere.danbulant.cloud/https://uploads.mangadex.org/covers/{mangaId}/{item.attributes.fileName}.512.jpg" alt="" draggable={false}>
|
||||
<img on:click={() => selectedImage = `https://uploads.mangadex.org/covers/${mangaId}/${item.attributes.fileName}.512.jpg`} width=512 height=805 src="https://uploads.mangadex.org/covers/{mangaId}/{item.attributes.fileName}.512.jpg" alt="" draggable={false}>
|
||||
{/each}
|
||||
{/await}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@
|
|||
|
||||
<div class="flex">
|
||||
{#if relationships.find(t => t.type === "cover_art")}
|
||||
<img class="cover" class:r18={!["safe", "suggestive"].includes(manga.contentRating)} draggable="false" src="https://cors-anywhere.danbulant.cloud/https://uploads.mangadex.org/covers/{mangaId}/{relationships.find(t => t.type === "cover_art").attributes.fileName}.512.jpg" alt="" on:click={() => selectedImage = `https://cors-anywhere.danbulant.cloud/https://uploads.mangadex.org/covers/${mangaId}/${relationships.find(t => t.type === "cover_art").attributes.fileName}.512.jpg`}>
|
||||
<img class="cover" class:r18={!["safe", "suggestive"].includes(manga.contentRating)} draggable="false" src="https://uploads.mangadex.org/covers/{mangaId}/{relationships.find(t => t.type === "cover_art").attributes.fileName}.512.jpg" alt="" on:click={() => selectedImage = `https://uploads.mangadex.org/covers/${mangaId}/${relationships.find(t => t.type === "cover_art").attributes.fileName}.512.jpg`}>
|
||||
{/if}
|
||||
<div class="info">
|
||||
{#if relationships.find(t => t.type === "author")}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import AnilistItems from "../components/anilistItems.svelte";
|
||||
import ListOrGrid from "../components/listOrGrid.svelte";
|
||||
import ratelimit from '../util/ratelimit';
|
||||
import MangadexItems from '../components/mangadexItems.svelte';
|
||||
import MangadexItems from '../components/mangadexItems.svelte';
|
||||
|
||||
var name = $params.search;
|
||||
$: {
|
||||
|
|
@ -67,11 +67,13 @@ import MangadexItems from '../components/mangadexItems.svelte';
|
|||
*/
|
||||
async function scroll(e) {
|
||||
if(scrollSearch !== null) return;
|
||||
if(document.body.scrollHeight - window.scrollY - window.innerHeight < 800 && (await result).data.length < (await result).total) {
|
||||
const resulted = await result;
|
||||
if(!resulted || !resulted.data) return;
|
||||
if(document.body.scrollHeight - window.scrollY - window.innerHeight < 800 && resulted.data.length < resulted.total) {
|
||||
scrollSearch = name;
|
||||
const res = await search(name, filters, (await result).data.length);
|
||||
const res = await search(name, filters, resulted.data.length);
|
||||
if(scrollSearch === name && res.data.length) {
|
||||
(await result).data.push(...res.data);
|
||||
resulted.data.push(...res.data);
|
||||
result = result; // trigger reload
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ export const proxy = "https://cors-anywhere.danbulant.cloud/";
|
|||
export const base = proxy + "https://api.mangadex.org/";
|
||||
|
||||
function request(endpoint, query, type = "GET", body) {
|
||||
return fetch(base + endpoint + encodeURIComponent(encodeURIComponent(query ? "?" + query.toString() : "")), {
|
||||
return fetch(base + endpoint + ((query ? "?" + query.toString() : "")), {
|
||||
method: type,
|
||||
body: body ? JSON.stringify(body) : undefined
|
||||
}).then(resp => resp.json());
|
||||
|
|
|
|||
Loading…
Reference in a new issue