From 9c021a8248d5502adf65046f5a534364c95a2b6a Mon Sep 17 00:00:00 2001 From: nyne Date: Mon, 18 Nov 2024 17:09:36 +0800 Subject: [PATCH] support rich text comments --- _template_.js | 6 ++++++ ehentai.js | 10 ++++++++-- index.json | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/_template_.js b/_template_.js index 374cfb4..7371570 100644 --- a/_template_.js +++ b/_template_.js @@ -587,6 +587,12 @@ class NewComicSource extends ComicSource { }, /** * [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 subId {string?} - ComicDetails.subId * @param page {number} diff --git a/ehentai.js b/ehentai.js index 2cf47b4..538ea56 100644 --- a/ehentai.js +++ b/ehentai.js @@ -7,7 +7,7 @@ class Ehentai extends ComicSource { // unique id of the source key = "ehentai" - version = "1.0.7" + version = "1.0.8" minAppVersion = "1.0.0" @@ -963,7 +963,13 @@ class Ehentai extends ComicSource { for(let c of document.querySelectorAll('div.c1')) { 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 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) if(isNaN(score)) { score = null diff --git a/index.json b/index.json index 7badb99..c00d573 100644 --- a/index.json +++ b/index.json @@ -45,7 +45,7 @@ "name": "ehentai", "fileName": "ehentai.js", "key": "ehentai", - "version": "1.0.7" + "version": "1.0.8" }, { "name": "禁漫天堂",