Compare commits

...

2 Commits

Author SHA1 Message Date
62fbe9294b [jm] 添加每周必看 2025-09-03 23:05:31 +08:00
91823846a0 Update template 2025-09-03 22:02:39 +08:00
3 changed files with 114 additions and 30 deletions

View File

@@ -1,4 +1,19 @@
/** @type {import('./_venera_.js')} */ /** @type {import('./_venera_.js')} */
/**
* @typedef {Object} PageJumpTarget
* @Property {string} page - The page name (search, category)
* @Property {Object} attributes - The attributes of the page
*
* @example
* {
* page: "search",
* attributes: {
* keyword: "example",
* },
* }
*/
class NewComicSource extends ComicSource { class NewComicSource extends ComicSource {
// Note: The fields which are marked as [Optional] should be removed if not used // Note: The fields which are marked as [Optional] should be removed if not used
@@ -256,20 +271,42 @@ class NewComicSource extends ComicSource {
``` ```
*/ */
}, },
// provide options for category comic loading // [Optional] provide options for category comic loading
optionList: [ optionList: [
{ {
// [Optional] The label will not be displayed if it is empty.
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: [
"newToOld-New to Old", "newToOld-New to Old",
"oldToNew-Old to New" "oldToNew-Old to New"
], ],
// [Optional] {string[]} - show this option only when the value not in the list // [Optional] {string[]} - show this option only when the category not in the list
notShowWhen: null, notShowWhen: null,
// [Optional] {string[]} - show this option only when the value in the list // [Optional] {string[]} - show this option only when the category in the list
showWhen: null showWhen: null
} }
], ],
/**
* [Optional] load options dynamically. If `optionList` is provided, this will be ignored.
* @since 1.5.0
* @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) => {
return [
{
// [Optional] The label will not be displayed if it is empty.
label: "",
// For a single option, use `-` to separate the value and text, left for value, right for text
options: [
"newToOld-New to Old",
"oldToNew-Old to New"
],
}
]
},
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: [

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: [