fix: [Novel Updates]: Images and CSS (#1186)
* novel-updates: add Daoist Quest * novel-updates: fix * novel-updates: remove lazy-loaded images and add new css * novel-updates: text-align in unordered lists * novel-updates: enhance css * novel-updates: remove clip-path * novel-updates: update bg color * novel-updates: update * novel-updates: revert version
This commit is contained in:
@@ -167,7 +167,7 @@ class NovelFire implements Plugin.PluginBase {
|
||||
'.box-notification',
|
||||
/^nf/, // Regular expression to match tags starting with 'nf'
|
||||
];
|
||||
bloatElements.map(tag => {
|
||||
bloatElements.forEach(tag => {
|
||||
if (tag instanceof RegExp) {
|
||||
loadedCheerio('*')
|
||||
.filter((_, el) =>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin';
|
||||
class NovelUpdates implements Plugin.PluginBase {
|
||||
id = 'novelupdates';
|
||||
name = 'Novel Updates';
|
||||
version = '0.7.6';
|
||||
version = '0.7.7';
|
||||
icon = 'src/en/novelupdates/icon.png';
|
||||
customCSS = 'src/en/novelupdates/customCSS.css';
|
||||
site = 'https://www.novelupdates.com/';
|
||||
@@ -196,7 +196,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
domain: string[],
|
||||
url: string,
|
||||
) {
|
||||
let bloatClasses = [];
|
||||
let bloatElements = [];
|
||||
let chapterTitle = '';
|
||||
let chapterContent = '';
|
||||
let chapterText = '';
|
||||
@@ -225,13 +225,13 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'fictionread':
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.content > style',
|
||||
'.highlight-ad-container',
|
||||
'.meaning',
|
||||
'.word',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.title-image span').first().text() ||
|
||||
'Title not found';
|
||||
@@ -276,6 +276,23 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'hiraethtranslation':
|
||||
const bloatAttributes = [
|
||||
'data-lazy-srcset',
|
||||
'data-lazy-src',
|
||||
'data-lazy-sizes',
|
||||
'data-ll-status',
|
||||
];
|
||||
// Iterate over each selector for images that may have these attributes
|
||||
['img.entered', 'img.lazyloaded'].forEach(selector => {
|
||||
loadedCheerio(selector).each(function () {
|
||||
// Loop through the attributes and remove them from the image
|
||||
bloatAttributes.forEach(attr => {
|
||||
loadedCheerio(this).removeAttr(attr); // Remove specified attribute
|
||||
});
|
||||
// Optionally, remove the class if you want
|
||||
loadedCheerio(this).removeClass('entered lazyloaded'); // Remove class if needed
|
||||
});
|
||||
});
|
||||
chapterTitle =
|
||||
loadedCheerio('li.active').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('.text-left').html()!;
|
||||
@@ -318,7 +335,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'isotls': // mii translates
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'footer',
|
||||
'header',
|
||||
'nav',
|
||||
@@ -326,7 +343,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
'.ezoic-adpicker-ad',
|
||||
'.ezoic-videopicker-video',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('head title').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('main article').html()!;
|
||||
@@ -345,8 +362,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
}
|
||||
break;
|
||||
case 'mirilu':
|
||||
bloatClasses = ['#jp-post-flair'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['#jp-post-flair'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
const titleElement_mirilu = loadedCheerio(
|
||||
'.entry-content p strong',
|
||||
).first();
|
||||
@@ -356,16 +373,16 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'novelplex':
|
||||
bloatClasses = ['.passingthrough_adreminder'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['.passingthrough_adreminder'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.halChap--jud').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('.halChap--kontenInner ').html()!;
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'novelworldtranslations':
|
||||
bloatClasses = ['.separator img'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['.separator img'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
loadedCheerio('.entry-content a')
|
||||
.filter((_, el) => {
|
||||
return (
|
||||
@@ -409,12 +426,12 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
return loadedCheerio(this).css('display') === 'block';
|
||||
});
|
||||
const loadedCheerioSnow = parseHTML(displayedDiv_snow.html()!);
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.responsivevoice-button',
|
||||
'.zoomdesc-cont p img',
|
||||
'.zoomdesc-cont p noscript',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerioSnow(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerioSnow(tag).remove());
|
||||
chapterContent = loadedCheerioSnow('.zoomdesc-cont').html()!;
|
||||
const titleElement_snow = loadedCheerioSnow('.scroller h2').first();
|
||||
if (titleElement_snow.length) {
|
||||
@@ -429,8 +446,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
}
|
||||
break;
|
||||
case 'readingpia':
|
||||
bloatClasses = ['.ezoic-ad', '.ezoic-adpicker-ad', '.ez-video-wrap'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['.ezoic-ad', '.ezoic-adpicker-ad', '.ez-video-wrap'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterText = loadedCheerio('.chapter-body').html() || 'Text not found';
|
||||
break;
|
||||
case 'redoxtranslation':
|
||||
@@ -465,20 +482,20 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'sacredtexttranslations':
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.entry-content blockquote',
|
||||
'.entry-content div',
|
||||
'.reaction-buttons',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.entry-title').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('.entry-content').html()!;
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'scribblehub':
|
||||
bloatClasses = ['.wi_authornotes'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['.wi_authornotes'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.chapter-title').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('.chp_raw').html()!;
|
||||
@@ -513,13 +530,13 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
const body_syringe = await result_syringe.text();
|
||||
loadedCheerio = parseHTML(body_syringe);
|
||||
}
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.has-inline-color',
|
||||
'.wp-block-buttons',
|
||||
'.wpcnt',
|
||||
'#jp-post-flair',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterContent = loadedCheerio('.entry-content').html()!;
|
||||
const titleElement_syringe = loadedCheerio('.entry-content h3').first();
|
||||
if (titleElement_syringe.length) {
|
||||
@@ -532,14 +549,14 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
break;
|
||||
case 'tinytranslation':
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.content noscript',
|
||||
'.google_translate_element',
|
||||
'.navigate',
|
||||
'.post-views',
|
||||
'br',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.title-content').first().text() || 'Title not found';
|
||||
loadedCheerio('.title-content').first().remove();
|
||||
@@ -577,8 +594,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
}
|
||||
break;
|
||||
case 'wuxiaworld':
|
||||
bloatClasses = ['.MuiLink-root'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['.MuiLink-root'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('h4 span').first().text() || 'Title not found';
|
||||
chapterContent = loadedCheerio('.chapter-content').html()!;
|
||||
@@ -591,8 +608,8 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = await fetchApi(json_yoru).then(r => r.text());
|
||||
break;
|
||||
case 'zetrotranslation':
|
||||
bloatClasses = ['hr', 'p:contains("\u00a0")'];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements = ['hr', 'p:contains("\u00a0")'];
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterContent = loadedCheerio('.text-left').html()!;
|
||||
const titleElement_zetro = loadedCheerio('.text-left h2').first();
|
||||
if (titleElement_zetro.length) {
|
||||
@@ -611,7 +628,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
}
|
||||
|
||||
async parseChapter(chapterPath: string): Promise<string> {
|
||||
let bloatClasses = [];
|
||||
let bloatElements = [];
|
||||
let chapterTitle = '';
|
||||
let chapterContent = '';
|
||||
let chapterText = '';
|
||||
@@ -740,13 +757,13 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
if (!isWordPress && !isBlogspot) {
|
||||
chapterText = await this.getChapterBody(loadedCheerio, domain, url);
|
||||
} else if (isBlogspot) {
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.button-container',
|
||||
'.ChapterNav',
|
||||
'.ch-bottom',
|
||||
'.separator',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.entry-title').first().text() ||
|
||||
loadedCheerio('.post-title').first().text() ||
|
||||
@@ -759,7 +776,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
chapterText = `<h2>${chapterTitle}</h2><hr><br>${chapterContent}`;
|
||||
}
|
||||
} else if (isWordPress) {
|
||||
bloatClasses = [
|
||||
bloatElements = [
|
||||
'.ad',
|
||||
'.author-avatar',
|
||||
'.chapter-warning',
|
||||
@@ -782,7 +799,7 @@ class NovelUpdates implements Plugin.PluginBase {
|
||||
'#jp-post-flair',
|
||||
'#textbox',
|
||||
];
|
||||
bloatClasses.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
chapterTitle =
|
||||
loadedCheerio('.entry-title').first().text() ||
|
||||
loadedCheerio('.entry-title-main').first().text() ||
|
||||
|
||||
@@ -204,7 +204,7 @@ class Webnovel implements Plugin.PluginBase {
|
||||
const loadedCheerio = parseHTML(body);
|
||||
|
||||
const bloatElements = ['.para-comment'];
|
||||
bloatElements.map(tag => loadedCheerio(tag).remove());
|
||||
bloatElements.forEach(tag => loadedCheerio(tag).remove());
|
||||
|
||||
return (
|
||||
loadedCheerio('.cha-tit').html()! + loadedCheerio('.cha-words').html()!
|
||||
|
||||
Reference in New Issue
Block a user