Skip to content

Commit

Permalink
Merge pull request #658 from NagaYZ/fix-xoxocomics
Browse files Browse the repository at this point in the history
fix chapter order
  • Loading branch information
Koitharu authored Mar 30, 2024
2 parents f628ed2 + 10b3f2e commit 8174229
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ internal class XoxoComics(context: MangaLoaderContext) :
return if (pages.size <= 1) {
super.getChapters(doc)
} else {
val list = coroutineScope {
val subPageChapterList = coroutineScope {
pages.mapNotNull { page ->
val a = page.selectFirst("a") ?: return@mapNotNull null
if (a.text().isNumeric()) {
Expand All @@ -164,11 +164,12 @@ internal class XoxoComics(context: MangaLoaderContext) :
} else {
null // TODO support pagination with overflow
}
}.awaitAll().flattenTo(ArrayList())
}.awaitAll().flatten()
}
list.addAll(super.getChapters(doc).asReversed())
list.reverse()
list.mapIndexed { i, x -> x.copy(volume = x.volume, number = (i + 1).toFloat()) }
val firstPageChapterList = super.getChapters(doc).asReversed().toMutableList()
firstPageChapterList.addAll(subPageChapterList)
firstPageChapterList.reverse()
firstPageChapterList.mapIndexed { i, x -> x.copy(volume = x.volume, number = (i + 1).toFloat()) }
}
}

Expand Down

0 comments on commit 8174229

Please sign in to comment.