From ca09c315374e4d219ded530b7b99219916822426 Mon Sep 17 00:00:00 2001 From: Batorian <53831711+Batorian@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:13:01 +0100 Subject: [PATCH] Improvement: Novel Updates: Several Changes (#1447) * novel_updates: added GreenzTL * novel_updates: fix skydemonorder * novel_updates: add styles to arcanetranslations * novel_updates: revert version change --- .../static/src/en/novelupdates/customCSS.css | 31 +++++++++++ src/plugins/english/novelupdates.ts | 53 +++++++++++++++++-- 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/public/static/src/en/novelupdates/customCSS.css b/public/static/src/en/novelupdates/customCSS.css index 8f1fe19..b96298b 100644 --- a/public/static/src/en/novelupdates/customCSS.css +++ b/public/static/src/en/novelupdates/customCSS.css @@ -1,3 +1,34 @@ +/** + * Novel Updates -> Arcane Translations + * https://www.novelupdates.com/group/arcane-translations/ + * Necessary to display chapterContent correctly + */ + +.arcane_box_blue { + text-align: center; + border: 2px solid #00219b; + padding: 20px; + box-shadow: 0 0 10px #00219b; + background-color: black; + position: relative; + z-index: 1; +} + +.arcane_title_blue { + color: white; + font-weight: bold; + text-transform: uppercase; + margin-bottom: 10px; + text-shadow: 0 0 10px blue; +} + +.arcane_text_blue { + color: white; + border-top: 2px solid white; + padding-top: 10px; + text-shadow: 0 0 8px blue; +} + /** * Novel Updates -> Daoist Quest * https://www.novelupdates.com/group/daoist-quest/ diff --git a/src/plugins/english/novelupdates.ts b/src/plugins/english/novelupdates.ts index e4618db..1c1180d 100644 --- a/src/plugins/english/novelupdates.ts +++ b/src/plugins/english/novelupdates.ts @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin'; class NovelUpdates implements Plugin.PluginBase { id = 'novelupdates'; name = 'Novel Updates'; - version = '0.7.12'; + version = '0.7.13'; icon = 'src/en/novelupdates/icon.png'; customCSS = 'src/en/novelupdates/customCSS.css'; site = 'https://www.novelupdates.com/'; @@ -211,6 +211,36 @@ class NovelUpdates implements Plugin.PluginBase { chapterContent = loadedCheerio('#spliced-comic').html()!; chapterText = `

${chapterTitle}



${chapterContent}`; break; + // Last edited in 0.7.13 - 21/01/2025 + case 'arcanetranslations': + bloatElements = ['.bottomnav']; + bloatElements.forEach(tag => loadedCheerio(tag).remove()); + chapterTitle = loadedCheerio('.epwrapper .cat-series').first().text(); + + loadedCheerio('.entry-content div').each((_, element) => { + const el = loadedCheerio(element); + const style = el.attr('style'); + + if (!style) return; // Skip elements without inline styles + + // Check for specific styles + if (/border:.*#00219b/.test(style)) { + // Check if 'border' contains '#00219b' + el.removeAttr('style').addClass('arcane_box_blue'); + } else if ( + style.includes('text-transform: uppercase') && + /text-shadow:.*blue/.test(style) // Check if 'text-shadow' contains 'blue' + ) { + el.removeAttr('style').addClass('arcane_title_blue'); + } else if (/text-shadow:.*blue/.test(style)) { + // Check if 'text-shadow' contains 'blue' + el.removeAttr('style').addClass('arcane_text_blue'); + } + }); + + chapterContent = loadedCheerio('.entry-content').html()!; + chapterText = `

${chapterTitle}



${chapterContent}`; + break; case 'asuratls': const titleElement_asura = loadedCheerio('.post-body div b').first(); chapterTitle = titleElement_asura.text() || 'Title not found'; @@ -282,6 +312,14 @@ class NovelUpdates implements Plugin.PluginBase { chapterText = content_genesis + footnotes_genesis ?? ''; break; + // Last edited in 0.7.13 - 21/01/2025 + case 'greenztl': + const chapterId_greenz = url.split('/').pop(); + const url_greenz = `https://api.greenztl.com/api//chapters/${chapterId_greenz}`; + const json_greenz = await fetchApi(url_greenz).then(r => r.json()); + + chapterText = json_greenz.currentChapter.content; + break; case 'helscans': chapterTitle = loadedCheerio('.entry-title-main').first().text() || @@ -532,6 +570,7 @@ class NovelUpdates implements Plugin.PluginBase { chapterContent = loadedCheerio('.chp_raw').html()!; chapterText = `

${chapterTitle}



${chapterContent}`; break; + // Last edited in 0.7.13 - 21/01/2025 case 'skydemonorder': /** * Check for age verification @@ -542,14 +581,18 @@ class NovelUpdates implements Plugin.PluginBase { if (ageVerification_skydemon.includes('age verification required')) { throw new Error('Age verification required, please open in webview.'); } - chapterTitle = `${loadedCheerio('header h2').first().text().trim() || 'Title not found'} | ${loadedCheerio('header h3').first().text().trim() || 'Title not found'}`; + chapterTitle = `${loadedCheerio('header .font-medium.text-sm').first().text().trim()}`; chapterContent = loadedCheerio('#startContainer + * > *') .first() .html()!; if (!chapterContent) { chapterContent = `${loadedCheerio('#chapter-body').html()!}

There could be missing content, please check in webview.`; } - chapterText = `

${chapterTitle}



${chapterContent}`; + if (chapterTitle) { + chapterText = `

${chapterTitle}



${chapterContent}`; + } else { + chapterText = chapterContent; + } break; case 'stabbingwithasyringe': /** @@ -744,6 +787,7 @@ class NovelUpdates implements Plugin.PluginBase { */ const outliers = [ 'anotivereads', + 'arcanetranslations', 'asuratls', 'darkstartranslations', 'fictionread', @@ -761,6 +805,7 @@ class NovelUpdates implements Plugin.PluginBase { isBlogspot = false; } + // Last edited in 0.7.13 - 21/01/2025 /** * Blogspot sites: * - ΒΌ-Assed @@ -772,7 +817,7 @@ class NovelUpdates implements Plugin.PluginBase { * * WordPress sites: * - Anomlaously Creative (Outlier) - * - Arcane Translations + * - Arcane Translations (Outlier) * - Blossom Translation * - Darkstar Translations (Outlier) * - Dumahs Translations