support rich text comments

This commit is contained in:
2024-11-18 17:09:36 +08:00
parent ea042b848a
commit 9c021a8248
3 changed files with 15 additions and 3 deletions

View File

@@ -587,6 +587,12 @@ class NewComicSource extends ComicSource {
}, },
/** /**
* [Optional] load comments * [Optional] load comments
*
* Since app version 1.0.6, rich text is supported in comments.
* Following html tags are supported: ['a', 'b', 'i', 'u', 's', 'br', 'span', 'img'].
* span tag supports style attribute, but only support font-weight, font-style, text-decoration.
* All images will be placed at the end of the comment.
* Auto link detection is enabled, but only http/https links are supported.
* @param comicId {string} * @param comicId {string}
* @param subId {string?} - ComicDetails.subId * @param subId {string?} - ComicDetails.subId
* @param page {number} * @param page {number}

View File

@@ -7,7 +7,7 @@ class Ehentai extends ComicSource {
// unique id of the source // unique id of the source
key = "ehentai" key = "ehentai"
version = "1.0.7" version = "1.0.8"
minAppVersion = "1.0.0" minAppVersion = "1.0.0"
@@ -963,7 +963,13 @@ class Ehentai extends ComicSource {
for(let c of document.querySelectorAll('div.c1')) { for(let c of document.querySelectorAll('div.c1')) {
let name = c.querySelector('div.c3 > a').text let name = c.querySelector('div.c3 > a').text
let time = c.querySelector('div.c3')?.text?.split("Posted on")?.at(1)?.split('by')?.at(0)?.trim() ?? 'unknown' let time = c.querySelector('div.c3')?.text?.split("Posted on")?.at(1)?.split('by')?.at(0)?.trim() ?? 'unknown'
let content = c.querySelector('div.c6').text let content = ''
if(typeof appVersion) {
// since 1.0.6, [appVersion] field is available and rich comment is supported
content = c.querySelector('div.c6').innerHTML
} else {
content = c.querySelector('div.c6').text
}
let score = Number(c.querySelector('div.c5 > span')?.text) let score = Number(c.querySelector('div.c5 > span')?.text)
if(isNaN(score)) { if(isNaN(score)) {
score = null score = null

View File

@@ -45,7 +45,7 @@
"name": "ehentai", "name": "ehentai",
"fileName": "ehentai.js", "fileName": "ehentai.js",
"key": "ehentai", "key": "ehentai",
"version": "1.0.7" "version": "1.0.8"
}, },
{ {
"name": "禁漫天堂", "name": "禁漫天堂",