[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": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流"
}, },
{ {

99
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,33 +486,74 @@ 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) => {
param ??= category if (category !== "每週必看") {
param = encodeURIComponent(param) param ??= category
let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`) param = encodeURIComponent(param)
let data = JSON.parse(res) let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`)
let total = data.total let data = JSON.parse(res)
let maxPage = Math.ceil(total / 80) let total = data.total
let comics = data.content.map((e) => this.parseComic(e)) let maxPage = Math.ceil(total / 80)
return { let comics = data.content.map((e) => this.parseComic(e))
comics: comics, return {
maxPage: maxPage 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: [ * [Optional] load options dynamically. If `optionList` is provided, this will be ignored.
{ * @param category {string}
// For a single option, use `-` to separate the value and text, left for value, right for text * @param param {string?}
options: [ * @return {Promise<{options: string[], label?: string}[]>} - return a list of option group, each group contains a list of options
"mr-最新", */
"mv-總排行", optionLoader: async (category, param) => {
"mv_m-月排行", if (category !== "每週必看") {
"mv_w-周排行", return [
"mv_t-日排行", {
"mp-最多圖片", label: "排序",
"tf-最多喜歡", // 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: { 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: [