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')} */
/**
* @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 {
// 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: [
{
// [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"
],
// [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,
// [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
}
],
/**
* [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: {
// For a single option, use `-` to separate the value and text, left for value, right for text
options: [

View File

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

99
jm.js
View File

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