Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit 156a78a

Browse files
committed
+ Minor update.
- Fix a infinite loading issue of the search function. - Fix the chapter list order. - Add language config.
1 parent 3169d97 commit 156a78a

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ async function handleMangaListSearch (page: number, keyword: string) {
5858
})
5959
})
6060

61+
// Check it should return the empty list.
62+
const $pagination = $document.find('.pagination.mb-0')
63+
.last()
64+
.children('.page-item.active')
65+
66+
if ($pagination) {
67+
const _currentPage = parseIntSafe($pagination.text(), 1)
68+
if (page > _currentPage) {
69+
result.list = []
70+
}
71+
}
72+
6173
window.Rulia.endWithResult(result)
6274
} catch (error) {
6375
window.Rulia.endWithException((error as Error).message)
@@ -91,6 +103,14 @@ async function getMangaList (rawPage: string, rawPageSize: string, keyword?: str
91103
}
92104

93105
try {
106+
const userConfig = window.Rulia.getUserConfig() ?? {}
107+
const langs = userConfig.langs
108+
if (langs) {
109+
url += url.includes('?')
110+
? `&langs=${langs}`
111+
: `?langs=${langs}`
112+
}
113+
94114
const rawStr = await window.Rulia.httpRequest({
95115
url,
96116
method: 'GET',
@@ -194,6 +214,9 @@ async function getMangaData (dataPageUrl: string) {
194214
result.chapterList.push(item)
195215
})
196216

217+
// Reverse the chapter list.
218+
result.chapterList.reverse()
219+
197220
window.Rulia.endWithResult(result)
198221
} catch (error) {
199222
window.Rulia.endWithException((error as Error).message)

src/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@
66
"author": "LancerComet",
77
"tags": ["bato", "Manga"],
88
"homepage": "https://github.com/RuliaReader/plugin.bato",
9-
"requestedVersion": "0.17.0"
9+
"requestedVersion": "0.17.0",
10+
"userConfig": {
11+
"langs": {
12+
"displayName": "Languages",
13+
"description": "You can specific the manga languages. The format is the form of \"zh,en,fr,ja\", which you can find in the end of the bato urls: https://mto.to/browse?langs=zh,en,fr,ja"
14+
}
15+
}
1016
}

0 commit comments

Comments
 (0)