diff --git a/assets/global.css b/assets/global.css index 6a079d6..b98cef7 100644 --- a/assets/global.css +++ b/assets/global.css @@ -20,6 +20,7 @@ main { max-width: 600px; margin: auto; + padding: 0 20px; } a { diff --git a/package.json b/package.json index 5e6bdb7..ac7b4d8 100644 --- a/package.json +++ b/package.json @@ -26,15 +26,15 @@ "devDependencies": { "@rollup/plugin-commonjs": "^19.0.2", "@rollup/plugin-node-resolve": "13.0.0", - "@roxi/routify": "^2.18.4", + "@roxi/routify": "^2.18.8", "@types/streamsaver": "^2.0.1", "cross-env": "^7.0.3", - "fs-extra": "^10.0.0", + "fs-extra": "^10.1.0", "nollup": "^0.16.5", "npm-run-all": "^4.1.5", - "postcss": "^8.4.5", - "postcss-import": "^14.0.2", - "rollup": "^2.63.0", + "postcss": "^8.4.16", + "postcss-import": "^14.1.0", + "rollup": "^2.79.0", "rollup-plugin-hot": "^0.1.1", "rollup-plugin-livereload": "^2.0.5", "rollup-plugin-svelte": "^7.1.0", @@ -43,8 +43,8 @@ "rollup-plugin-workbox": "^5.2.1", "spank": "^1.9.0", "spassr": "^2.6.0", - "svelte": "^3.45.0", - "svelte-preprocess": "^4.10.1", + "svelte": "^3.50.0", + "svelte-preprocess": "^4.10.7", "tossr": "^1.4.2" }, "routify": { @@ -57,9 +57,11 @@ ] }, "dependencies": { + "@formkit/auto-animate": "1.0.0-beta.3", "fflate": "^0.6.10", - "streamsaver": "^2.0.5", - "svelte-markdown": "^0.2.2", - "swiper": "^8.1.5" + "streamsaver": "^2.0.6", + "svelte-local-storage-store": "^0.3.1", + "svelte-markdown": "^0.2.3", + "swiper": "^8.3.2" } } diff --git a/src/components/anilistItems.svelte b/src/components/anilistItems.svelte index cfec198..bfa1115 100644 --- a/src/components/anilistItems.svelte +++ b/src/components/anilistItems.svelte @@ -1,6 +1,7 @@ -
+
{#each entries as entry} + {@const title = entry.attributes.title.en || entry.attributes.title.ja || Object.values(entry.attributes.title)[0]} open(entry)}>
{#if entry.relationships.find(t => t.type === "cover_art")} - + {title} {:else} Broken art {/if}
-

{entry.attributes.title.en || entry.attributes.title.ja || Object.values(entry.attributes.title)[0]}

+

{title}

{#if entry.attributes.lastChapter} CH {entry.attributes.lastChapter} {/if} diff --git a/src/main.js b/src/main.js index e76bdd2..6282aa3 100644 --- a/src/main.js +++ b/src/main.js @@ -27,7 +27,12 @@ function display(formatted, type) { const error = console.error.bind(console); window.console.error = (...args) => { error(...args); - display(JSON.stringify(args), "error"); + args = args.map(arg => { + if(typeof arg === "string") return arg; + if(arg instanceof Error) return arg.message + "\n" + arg.stack; + return JSON.stringify(arg); + }); + display(args.join("\n"), "error"); } window.onerror = (event, SourceBuffer, line, col, error) => { diff --git a/src/pages/_layout.svelte b/src/pages/_layout.svelte index 76ae43e..049a410 100644 --- a/src/pages/_layout.svelte +++ b/src/pages/_layout.svelte @@ -20,9 +20,7 @@ {#if $logs.length}
{#each $logs as item} -
- {item.text} -
+
{item.text}
{/each}
{/if} @@ -37,4 +35,7 @@ padding: 5px; box-shadow: 0 0 2px 0 black; } + pre { + white-space: pre-wrap; + } \ No newline at end of file diff --git a/src/pages/index.svelte b/src/pages/index.svelte index 7cb93b5..f292680 100644 --- a/src/pages/index.svelte +++ b/src/pages/index.svelte @@ -7,13 +7,17 @@ import ListOrGrid from "../components/listOrGrid.svelte"; import ratelimit from '../util/ratelimit'; import MangadexItems from '../components/mangadexItems.svelte'; - + + /** @type {string} */ var name = $params.search; $: { const url = new URL(window.location.toString()); url.searchParams.set("search", name || ""); history.replaceState(history.state, "", url.toString()); } + + var allowNSFW = false; + const filters = { contentRating: ["safe", "suggestive"], demographic: [], @@ -21,6 +25,9 @@ sort: "updatedAt", sortValue: "desc" }; + + filters.contentRating = allowNSFW ? [] : ["safe", "suggestive"]; + /** * Searches for results * @param {string} title @@ -91,16 +98,17 @@ function open() { var id = name; - if(name.startsWith("https://mangadex.org/title/")) { - id = name.substring("https://mangadex.org/title/".length); - id = id.split("/")[0]; - } else if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(name)) { + if(id.startsWith("https://mangadex.org/title/")) { + id = id.substring("https://mangadex.org/title/".length); + id = id.match(/[^\/?#]*/)[0]; + } + if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id)) { return alert("You provided invalid ID or link. Make sure you copy the full URL from mangadex.org title page"); } $goto("./" + id); } - const anilistID = window.location.hostname === "localhost" ? "8375" : "8374"; + const anilistID = window.location.hostname === "manga.danbulant.eu" ? "8374" : "8375"; let userDetails = isLogedIn() && getUserDetails(); let userManga = isLogedIn() && getUserManga(); @@ -124,10 +132,7 @@
-
- - Made by TechmandanCZ#3372 -
+ {#if isLogedIn()} {#await userDetails then userDetails} @@ -141,7 +146,17 @@
{#if isLogedIn()} - +
+ + +
+ +
{#if result}

Search results

@@ -162,7 +177,7 @@ {/if} {:else}

- Sign in via Anilist to view your manga list and search for manga online. + Sign in via Anilist to view your manga list and search for manga online. You can still read manga or download it without signing in using direct mangadex URLs.

{/if} @@ -190,6 +205,10 @@