mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-25 16:21:50 +01:00
fix wrong chapter count, abstract next page
This commit is contained in:
parent
c0b49c7428
commit
49dc9fe5f6
@ -22,7 +22,6 @@ import org.jetbrains.exposed.sql.and
|
|||||||
import org.jetbrains.exposed.sql.deleteWhere
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.select
|
||||||
import org.jetbrains.exposed.sql.selectAll
|
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.jetbrains.exposed.sql.update
|
import org.jetbrains.exposed.sql.update
|
||||||
|
|
||||||
@ -139,7 +138,7 @@ object Chapter {
|
|||||||
).awaitSingle()
|
).awaitSingle()
|
||||||
|
|
||||||
val chapterId = chapterEntry[ChapterTable.id].value
|
val chapterId = chapterEntry[ChapterTable.id].value
|
||||||
val chapterCount = transaction { ChapterTable.selectAll().count() }
|
val chapterCount = transaction { ChapterTable.select { ChapterTable.manga eq mangaId }.count() }
|
||||||
|
|
||||||
// update page list for this chapter
|
// update page list for this chapter
|
||||||
transaction {
|
transaction {
|
||||||
|
@ -24,7 +24,7 @@ const useStyles = makeStyles({
|
|||||||
|
|
||||||
export default function PagedReader(props: IReaderProps) {
|
export default function PagedReader(props: IReaderProps) {
|
||||||
const {
|
const {
|
||||||
pages, settings, setCurPage, curPage, manga, chapter,
|
pages, settings, setCurPage, curPage, manga, chapter, nextChapter,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
@ -36,7 +36,7 @@ export default function PagedReader(props: IReaderProps) {
|
|||||||
if (curPage < pages.length - 1) {
|
if (curPage < pages.length - 1) {
|
||||||
setCurPage(curPage + 1);
|
setCurPage(curPage + 1);
|
||||||
} else if (settings.loadNextonEnding) {
|
} else if (settings.loadNextonEnding) {
|
||||||
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
|
nextChapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ const useStyles = makeStyles({
|
|||||||
|
|
||||||
export default function VerticalReader(props: IReaderProps) {
|
export default function VerticalReader(props: IReaderProps) {
|
||||||
const {
|
const {
|
||||||
pages, settings, setCurPage, curPage, manga, chapter,
|
pages, settings, setCurPage, curPage, manga, chapter, nextChapter,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
@ -31,8 +31,7 @@ export default function VerticalReader(props: IReaderProps) {
|
|||||||
|
|
||||||
const handleLoadNextonEnding = () => {
|
const handleLoadNextonEnding = () => {
|
||||||
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
|
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
|
||||||
setCurPage(0);
|
nextChapter();
|
||||||
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
import CircularProgress from '@material-ui/core/CircularProgress';
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
import HorizontalPager from '../components/reader/pager/HorizontalPager';
|
import HorizontalPager from '../components/reader/pager/HorizontalPager';
|
||||||
import Page from '../components/reader/Page';
|
import Page from '../components/reader/Page';
|
||||||
import PageNumber from '../components/reader/PageNumber';
|
import PageNumber from '../components/reader/PageNumber';
|
||||||
@ -63,6 +63,7 @@ export default function Reader() {
|
|||||||
const [settings, setSettings] = useLocalStorage<IReaderSettings>('readerSettings', defaultReaderSettings);
|
const [settings, setSettings] = useLocalStorage<IReaderSettings>('readerSettings', defaultReaderSettings);
|
||||||
|
|
||||||
const classes = useStyles(settings)();
|
const classes = useStyles(settings)();
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
const [serverAddress] = useLocalStorage<String>('serverBaseURL', '');
|
const [serverAddress] = useLocalStorage<String>('serverBaseURL', '');
|
||||||
|
|
||||||
@ -133,6 +134,12 @@ export default function Reader() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nextChapter = () => {
|
||||||
|
if (chapter.index < chapter.chapterCount) {
|
||||||
|
history.push(`/manga/${manga.id}/chapter/${chapter.index + 1}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const pages = range(chapter.pageCount).map((index) => ({
|
const pages = range(chapter.pageCount).map((index) => ({
|
||||||
index,
|
index,
|
||||||
src: `${serverAddress}/api/v1/manga/${mangaId}/chapter/${chapterIndex}/page/${index}`,
|
src: `${serverAddress}/api/v1/manga/${mangaId}/chapter/${chapterIndex}/page/${index}`,
|
||||||
@ -155,6 +162,7 @@ export default function Reader() {
|
|||||||
settings={settings}
|
settings={settings}
|
||||||
manga={manga}
|
manga={manga}
|
||||||
chapter={chapter}
|
chapter={chapter}
|
||||||
|
nextChapter={nextChapter}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
1
webUI/react/src/typings.d.ts
vendored
1
webUI/react/src/typings.d.ts
vendored
@ -116,4 +116,5 @@ interface IReaderProps {
|
|||||||
settings: IReaderSettings
|
settings: IReaderSettings
|
||||||
manga: IMangaCard | IManga
|
manga: IMangaCard | IManga
|
||||||
chapter: IChapter | IPartialChpter
|
chapter: IChapter | IPartialChpter
|
||||||
|
nextChapter: () => void
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user