[jm] 添加每周必看

This commit is contained in:
2025-09-03 23:05:31 +08:00
parent 91823846a0
commit 62fbe9294b
2 changed files with 74 additions and 27 deletions

View File

@@ -46,7 +46,7 @@
"name": "禁漫天堂", "name": "禁漫天堂",
"fileName": "jm.js", "fileName": "jm.js",
"key": "jm", "key": "jm",
"version": "1.2.2", "version": "1.3.0",
"description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流" "description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流"
}, },
{ {

57
jm.js
View File

@@ -7,9 +7,9 @@ class JM extends ComicSource {
// unique id of the source // unique id of the source
key = "jm" key = "jm"
version = "1.2.2" version = "1.3.0"
minAppVersion = "1.2.5" minAppVersion = "1.5.0"
static jmVersion = "2.0.6" static jmVersion = "2.0.6"
@@ -370,6 +370,12 @@ class JM extends ComicSource {
/// title of the category page, used to identify the page, it should be unique /// title of the category page, used to identify the page, it should be unique
title: "禁漫天堂", title: "禁漫天堂",
parts: [ parts: [
{
name: "每週必看",
type: "fixed",
categories: ["每週必看"],
itemType: "category",
},
{ {
name: "成人A漫", name: "成人A漫",
type: "fixed", type: "fixed",
@@ -480,6 +486,7 @@ class JM extends ComicSource {
* @returns {Promise<{comics: Comic[], maxPage: number}>} * @returns {Promise<{comics: Comic[], maxPage: number}>}
*/ */
load: async (category, param, options, page) => { load: async (category, param, options, page) => {
if (category !== "每週必看") {
param ??= category param ??= category
param = encodeURIComponent(param) param = encodeURIComponent(param)
let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`) let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`)
@@ -491,10 +498,27 @@ class JM extends ComicSource {
comics: comics, comics: comics,
maxPage: maxPage maxPage: maxPage
} }
} else {
let res = await this.get(`${this.baseUrl}/week/filter?id=${options[0]}&page=1&type=${options[1]}&page=0`)
let data = JSON.parse(res)
let comics = data.list.map((e) => this.parseComic(e))
return {
comics: comics,
maxPage: 1
}
}
}, },
// provide options for category comic loading /**
optionList: [ * [Optional] load options dynamically. If `optionList` is provided, this will be ignored.
* @param category {string}
* @param param {string?}
* @return {Promise<{options: string[], label?: string}[]>} - return a list of option group, each group contains a list of options
*/
optionLoader: async (category, param) => {
if (category !== "每週必看") {
return [
{ {
label: "排序",
// For a single option, use `-` to separate the value and text, left for value, right for text // For a single option, use `-` to separate the value and text, left for value, right for text
options: [ options: [
"mr-最新", "mr-最新",
@@ -506,7 +530,30 @@ class JM extends ComicSource {
"tf-最多喜歡", "tf-最多喜歡",
], ],
} }
], ]
} else {
let res = await this.get(`${this.baseUrl}/week`)
let data = JSON.parse(res)
let options = []
for (let e of data["categories"]) {
options.push(`${e["id"]}-${e["time"]}`)
}
return [
{
label: "時間",
options: options,
},
{
label: "類型",
options: [
"manga-日漫",
"hanman-韓漫",
"another-其他",
]
}
]
}
},
ranking: { ranking: {
// For a single option, use `-` to separate the value and text, left for value, right for text // For a single option, use `-` to separate the value and text, left for value, right for text
options: [ options: [