From 62fbe9294b0c1929b743a9ffb1fc9de4f40c40cf Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 3 Sep 2025 23:05:31 +0800 Subject: [PATCH] =?UTF-8?q?[jm]=20=E6=B7=BB=E5=8A=A0=E6=AF=8F=E5=91=A8?= =?UTF-8?q?=E5=BF=85=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.json | 2 +- jm.js | 99 ++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 27 deletions(-) diff --git a/index.json b/index.json index fefb278..14dc02d 100644 --- a/index.json +++ b/index.json @@ -46,7 +46,7 @@ "name": "禁漫天堂", "fileName": "jm.js", "key": "jm", - "version": "1.2.2", + "version": "1.3.0", "description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流" }, { diff --git a/jm.js b/jm.js index 8ec37a7..90bf9a3 100644 --- a/jm.js +++ b/jm.js @@ -7,9 +7,9 @@ class JM extends ComicSource { // unique id of the source key = "jm" - version = "1.2.2" + version = "1.3.0" - minAppVersion = "1.2.5" + minAppVersion = "1.5.0" 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: "禁漫天堂", parts: [ + { + name: "每週必看", + type: "fixed", + categories: ["每週必看"], + itemType: "category", + }, { name: "成人A漫", type: "fixed", @@ -480,33 +486,74 @@ class JM extends ComicSource { * @returns {Promise<{comics: Comic[], maxPage: number}>} */ load: async (category, param, options, page) => { - param ??= category - param = encodeURIComponent(param) - let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`) - let data = JSON.parse(res) - let total = data.total - let maxPage = Math.ceil(total / 80) - let comics = data.content.map((e) => this.parseComic(e)) - return { - comics: comics, - maxPage: maxPage + if (category !== "每週必看") { + param ??= category + param = encodeURIComponent(param) + let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`) + let data = JSON.parse(res) + let total = data.total + let maxPage = Math.ceil(total / 80) + let comics = data.content.map((e) => this.parseComic(e)) + return { + comics: comics, + 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: [ - { - // For a single option, use `-` to separate the value and text, left for value, right for text - options: [ - "mr-最新", - "mv-總排行", - "mv_m-月排行", - "mv_w-周排行", - "mv_t-日排行", - "mp-最多圖片", - "tf-最多喜歡", - ], + /** + * [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 + options: [ + "mr-最新", + "mv-總排行", + "mv_m-月排行", + "mv_w-周排行", + "mv_t-日排行", + "mp-最多圖片", + "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: { // For a single option, use `-` to separate the value and text, left for value, right for text options: [