From ddaa2979cd8e7523e3f72fec7d93c0827ecdddb2 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Tue, 29 Jun 2021 18:00:11 +0200 Subject: [PATCH] I hate comeso --- assets/robots.txt | 2 + src/components/chapter.svelte | 21 +++++- src/pages/[manga]/index.svelte | 73 +++++++++++++++++--- src/pages/index.svelte | 118 +++++++-------------------------- src/util/arrays.js | 15 +++++ 5 files changed, 127 insertions(+), 102 deletions(-) create mode 100644 src/util/arrays.js diff --git a/assets/robots.txt b/assets/robots.txt index 01b0f9a..8265403 100644 --- a/assets/robots.txt +++ b/assets/robots.txt @@ -1,2 +1,4 @@ # https://www.robotstxt.org/robotstxt.html User-agent: * +Allow: / +Disallow: /* \ No newline at end of file diff --git a/src/components/chapter.svelte b/src/components/chapter.svelte index 0e1df99..152b063 100644 --- a/src/components/chapter.svelte +++ b/src/components/chapter.svelte @@ -7,9 +7,25 @@ export var selected; export var disabledDownload = false; export var progress = 0; + + /** + * @param {MouseEvent} e + */ + function click(e) { + dispatch("select", e); + } + + /** + * @param {MouseEvent} e + */ + function mouseenter(e) { + if(e.buttons & 1) { + dispatch("select"); + } + } - dispatch("select")} class:selected={selected} style="background-image: linear-gradient(to right, rgba(0, 255, 0, 0.247) {progress * 100}%, transparent {progress * 100}%)"> + {chapter.data.attributes.volume ? "Vol " + chapter.data.attributes.volume : ""} {chapter.data.attributes.chapter ? "Chapter " + chapter.data.attributes.chapter : ""} {chapter.data.attributes.title} @@ -22,6 +38,7 @@ position: relative; transition: background-image 0.3s; background-repeat: no-repeat; + user-select: none; } tr.selected { @@ -44,6 +61,8 @@ text-decoration: none; cursor: pointer; user-select: none; + text-align: right; + padding-right: 10px; } td.action:hover { diff --git a/src/pages/[manga]/index.svelte b/src/pages/[manga]/index.svelte index 55617a1..99c339f 100644 --- a/src/pages/[manga]/index.svelte +++ b/src/pages/[manga]/index.svelte @@ -5,6 +5,7 @@ import { CBZGenerator } from "../../util/generateCbz"; import request from "../../util/request"; import { BaseGenerator } from "../../util/baseGenerator"; + import { arraysEqual } from "../../util/arrays"; export var scoped; @@ -168,7 +169,23 @@ } } - $: console.log(format); + var copyrightOpen = false; + + function selectAll() { + chapters.then(res => { + var chapters = res.results; + if(arraysEqual(selected, chapters)) { + selected = []; + } else { + selected = chapters.slice(); + } + if(selected.length) { + text = `Selected ${selected.length} chapters`; + } else { + text = defaultText; + } + }); + } @@ -181,10 +198,22 @@

{manga.title.en}

-