mirror of
https://github.com/venera-app/venera-configs.git
synced 2025-09-27 16:37:23 +00:00
add ehentai, update template
This commit is contained in:
@@ -24,7 +24,7 @@ class NewComicSource extends ComicSource {
|
|||||||
// [Optional] account related
|
// [Optional] account related
|
||||||
account = {
|
account = {
|
||||||
/**
|
/**
|
||||||
* login, return any value to indicate success
|
* [Optional] login with account and password, return any value to indicate success
|
||||||
* @param account {string}
|
* @param account {string}
|
||||||
* @param pwd {string}
|
* @param pwd {string}
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
@@ -64,6 +64,35 @@ class NewComicSource extends ComicSource {
|
|||||||
*/
|
*/
|
||||||
checkStatus: (url, title) => {
|
checkStatus: (url, title) => {
|
||||||
|
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* [Optional] Callback when login success
|
||||||
|
*/
|
||||||
|
onLoginSuccess: () => {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Optional] login with cookies
|
||||||
|
* Note: If `this.account.login` is implemented, this will be ignored
|
||||||
|
*/
|
||||||
|
loginWithCookies: {
|
||||||
|
fields: [
|
||||||
|
"ipb_member_id",
|
||||||
|
"ipb_pass_hash",
|
||||||
|
"igneous",
|
||||||
|
"star",
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
* Validate cookies, return false if cookies are invalid.
|
||||||
|
*
|
||||||
|
* Use `Network.setCookies` to set cookies before validate.
|
||||||
|
* @param values {string[]} - same order as `fields`
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
validate: async (values) => {
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -132,7 +161,15 @@ class NewComicSource extends ComicSource {
|
|||||||
return comics
|
return comics
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
}
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only use for `multiPageComicList` type.
|
||||||
|
* `loadNext` would be ignored if `load` function is implemented.
|
||||||
|
* @param next {string | null} - next page token, null if first page
|
||||||
|
* @returns {Promise<{comics: Comic[], next: string?}>} - next is null if no next page.
|
||||||
|
*/
|
||||||
|
loadNext(next) {},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -266,7 +303,7 @@ class NewComicSource extends ComicSource {
|
|||||||
/**
|
/**
|
||||||
* load search result
|
* load search result
|
||||||
* @param keyword {string}
|
* @param keyword {string}
|
||||||
* @param options {string[]} - options from optionList
|
* @param options {(string | null)[]} - options from optionList
|
||||||
* @param page {number}
|
* @param page {number}
|
||||||
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
||||||
*/
|
*/
|
||||||
@@ -300,13 +337,21 @@ class NewComicSource extends ComicSource {
|
|||||||
// provide options for search
|
// provide options for search
|
||||||
optionList: [
|
optionList: [
|
||||||
{
|
{
|
||||||
|
// [Optional] default is `select`
|
||||||
|
// type: select, multi-select, dropdown
|
||||||
|
// For select, there is only one selected value
|
||||||
|
// For multi-select, there are multiple selected values or none. The `load` function will receive a json string which is an array of selected values
|
||||||
|
// For dropdown, there is one selected value at most. If no selected value, the `load` function will receive a null
|
||||||
|
type: "select",
|
||||||
// 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: [
|
||||||
"0-time",
|
"0-time",
|
||||||
"1-popular"
|
"1-popular"
|
||||||
],
|
],
|
||||||
// option label
|
// option label
|
||||||
label: "sort"
|
label: "sort",
|
||||||
|
// default selected options
|
||||||
|
default: null,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -427,7 +472,16 @@ class NewComicSource extends ComicSource {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
}
|
},
|
||||||
|
/**
|
||||||
|
* load comics with next page token
|
||||||
|
* @param next {string | null} - next page token, null for first page
|
||||||
|
* @param folder {string}
|
||||||
|
* @returns {Promise<{comics: Comic[], next: string?}>}
|
||||||
|
*/
|
||||||
|
loadNext: async (next, folder) => {
|
||||||
|
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// single comic related
|
/// single comic related
|
||||||
@@ -442,6 +496,10 @@ class NewComicSource extends ComicSource {
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* [Optional] load thumbnails of a comic
|
* [Optional] load thumbnails of a comic
|
||||||
|
*
|
||||||
|
* To render a part of an image as thumbnail, return `${url}@x=${start}-${end}&y=${start}-${end}`
|
||||||
|
* - If width is not provided, use full width
|
||||||
|
* - If height is not provided, use full height
|
||||||
* @param id {string}
|
* @param id {string}
|
||||||
* @param next {string?} - next page token, null for first page
|
* @param next {string?} - next page token, null for first page
|
||||||
* @returns {Promise<{thumbnails: string[], next: string?}>} - `next` is next page token, null for no more
|
* @returns {Promise<{thumbnails: string[], next: string?}>} - `next` is next page token, null for no more
|
||||||
@@ -458,6 +516,17 @@ class NewComicSource extends ComicSource {
|
|||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rate a comic
|
||||||
|
* @param id
|
||||||
|
* @param rating {number} - [0-10] app use 5 stars, 1 rating = 0.5 stars,
|
||||||
|
* @returns {Promise<any>} - return any value to indicate success
|
||||||
|
*/
|
||||||
|
starRating: async (id, rating) => {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load images of a chapter
|
* load images of a chapter
|
||||||
* @param comicId {string}
|
* @param comicId {string}
|
||||||
@@ -479,7 +548,7 @@ class NewComicSource extends ComicSource {
|
|||||||
* @param url
|
* @param url
|
||||||
* @param comicId
|
* @param comicId
|
||||||
* @param epId
|
* @param epId
|
||||||
* @returns {{}}
|
* @returns {{} | Promise<{}>}
|
||||||
*/
|
*/
|
||||||
onImageLoad: (url, comicId, epId) => {
|
onImageLoad: (url, comicId, epId) => {
|
||||||
/*
|
/*
|
||||||
|
77
_venera_.js
77
_venera_.js
@@ -308,14 +308,17 @@ function setInterval(callback, delay) {
|
|||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Cookie(name, value, domain = null) {
|
/**
|
||||||
let obj = {};
|
* Create a cookie object.
|
||||||
obj.name = name;
|
* @param name {string}
|
||||||
obj.value = value;
|
* @param value {string}
|
||||||
if (domain) {
|
* @param domain {string}
|
||||||
obj.domain = domain;
|
* @constructor
|
||||||
}
|
*/
|
||||||
return obj;
|
function Cookie({name, value, domain}) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -491,7 +494,7 @@ class HtmlDocument {
|
|||||||
/**
|
/**
|
||||||
* Query a single element from the HTML document.
|
* Query a single element from the HTML document.
|
||||||
* @param {string} query - The query string.
|
* @param {string} query - The query string.
|
||||||
* @returns {HtmlElement} The first matching element.
|
* @returns {HtmlElement | null} The first matching element.
|
||||||
*/
|
*/
|
||||||
querySelector(query) {
|
querySelector(query) {
|
||||||
let k = sendMessage({
|
let k = sendMessage({
|
||||||
@@ -530,6 +533,22 @@ class HtmlDocument {
|
|||||||
key: this.key
|
key: this.key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the element by its id.
|
||||||
|
* @param id {string}
|
||||||
|
* @returns {HtmlElement|null}
|
||||||
|
*/
|
||||||
|
getElementById(id) {
|
||||||
|
let k = sendMessage({
|
||||||
|
method: "html",
|
||||||
|
function: "getElementById",
|
||||||
|
key: this.key,
|
||||||
|
id: id
|
||||||
|
})
|
||||||
|
if(k == null) return null;
|
||||||
|
return new HtmlElement(k, this.key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -703,6 +722,36 @@ class HtmlElement {
|
|||||||
doc: this.doc,
|
doc: this.doc,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the previous sibling element of the element. If the element has no previous sibling, return null.
|
||||||
|
* @returns {HtmlElement|null}
|
||||||
|
*/
|
||||||
|
get previousElementSibling() {
|
||||||
|
let k = sendMessage({
|
||||||
|
method: "html",
|
||||||
|
function: "getPreviousSibling",
|
||||||
|
key: this.key,
|
||||||
|
doc: this.doc,
|
||||||
|
})
|
||||||
|
if(k == null) return null;
|
||||||
|
return new HtmlElement(k, this.doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next sibling element of the element. If the element has no next sibling, return null.
|
||||||
|
* @returns {HtmlElement|null}
|
||||||
|
*/
|
||||||
|
get nextElementSibling() {
|
||||||
|
let k = sendMessage({
|
||||||
|
method: "html",
|
||||||
|
function: "getNextSibling",
|
||||||
|
key: this.key,
|
||||||
|
doc: this.doc,
|
||||||
|
})
|
||||||
|
if (k == null) return null;
|
||||||
|
return new HtmlElement(k, this.doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HtmlNode {
|
class HtmlNode {
|
||||||
@@ -789,9 +838,10 @@ let console = {
|
|||||||
* @param maxPage {number?}
|
* @param maxPage {number?}
|
||||||
* @param language {string?}
|
* @param language {string?}
|
||||||
* @param favoriteId {string?} - Only set this field if the comic is from favorites page
|
* @param favoriteId {string?} - Only set this field if the comic is from favorites page
|
||||||
|
* @param stars {number?} - 0-5, double
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Comic({id, title, subtitle, cover, tags, description, maxPage, language, favoriteId}) {
|
function Comic({id, title, subtitle, cover, tags, description, maxPage, language, favoriteId, stars}) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.subtitle = subtitle;
|
this.subtitle = subtitle;
|
||||||
@@ -801,6 +851,7 @@ function Comic({id, title, subtitle, cover, tags, description, maxPage, language
|
|||||||
this.maxPage = maxPage;
|
this.maxPage = maxPage;
|
||||||
this.language = language;
|
this.language = language;
|
||||||
this.favoriteId = favoriteId;
|
this.favoriteId = favoriteId;
|
||||||
|
this.stars = stars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -821,9 +872,11 @@ function Comic({id, title, subtitle, cover, tags, description, maxPage, language
|
|||||||
* @param updateTime {string?}
|
* @param updateTime {string?}
|
||||||
* @param uploadTime {string?}
|
* @param uploadTime {string?}
|
||||||
* @param url {string?}
|
* @param url {string?}
|
||||||
|
* @param stars {number?} - 0-5, double
|
||||||
|
* @param maxPage {number?}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ComicDetails({title, cover, description, tags, chapters, isFavorite, subId, thumbnails, recommend, commentCount, likesCount, isLiked, uploader, updateTime, uploadTime, url}) {
|
function ComicDetails({title, cover, description, tags, chapters, isFavorite, subId, thumbnails, recommend, commentCount, likesCount, isLiked, uploader, updateTime, uploadTime, url, stars, maxPage}) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.cover = cover;
|
this.cover = cover;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -840,6 +893,8 @@ function ComicDetails({title, cover, description, tags, chapters, isFavorite, su
|
|||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
this.uploadTime = uploadTime;
|
this.uploadTime = uploadTime;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
this.stars = stars;
|
||||||
|
this.maxPage = maxPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
1118
ehentai.js
Normal file
1118
ehentai.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -40,5 +40,11 @@
|
|||||||
"fileName": "wnacg.js",
|
"fileName": "wnacg.js",
|
||||||
"key": "wnacg",
|
"key": "wnacg",
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ehentai",
|
||||||
|
"fileName": "ehentai.js",
|
||||||
|
"key": "ehentai",
|
||||||
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user