Add lock icon to madara theme locked chapters & setting to zetro translation to hide locked chapters (#1406)
* Add lock icon to madara theme locked chapters & setting to zetro translation to hide locked chapters * Increment version number * Fix storage * Add hide locked chapters toggle to webnovel plugin * Fix version number from rebase
This commit is contained in:
@@ -2,11 +2,12 @@ import { CheerioAPI, load as parseHTML } from 'cheerio';
|
||||
import { fetchApi } from '@libs/fetch';
|
||||
import { Filters, FilterTypes } from '@libs/filterInputs';
|
||||
import { Plugin } from '@typings/plugin';
|
||||
import { storage } from '@libs/storage';
|
||||
|
||||
class Webnovel implements Plugin.PluginBase {
|
||||
id = 'webnovel';
|
||||
name = 'Webnovel';
|
||||
version = '1.0.1';
|
||||
version = '1.0.2';
|
||||
icon = 'src/en/webnovel/icon.png';
|
||||
site = 'https://www.webnovel.com';
|
||||
headers = {
|
||||
@@ -18,6 +19,14 @@ class Webnovel implements Plugin.PluginBase {
|
||||
'referrer': this.site,
|
||||
},
|
||||
};
|
||||
hideLocked = storage.get('hideLocked');
|
||||
pluginSettings = {
|
||||
hideLocked: {
|
||||
value: '',
|
||||
label: 'Hide locked chapters',
|
||||
type: 'Switch',
|
||||
},
|
||||
};
|
||||
|
||||
async parseNovels(
|
||||
loadedCheerio: CheerioAPI,
|
||||
@@ -143,12 +152,11 @@ class Webnovel implements Plugin.PluginBase {
|
||||
(loadedCheerio(ele_c).find('a').attr('title')?.trim() ||
|
||||
'No Title Found');
|
||||
const chapterPath = loadedCheerio(ele_c).find('a').attr('href');
|
||||
const locked = loadedCheerio(ele_c).find('svg').length;
|
||||
|
||||
if (chapterPath) {
|
||||
if (chapterPath && !(locked && this.hideLocked)) {
|
||||
chapters.push({
|
||||
name: loadedCheerio(ele_c).find('svg').length
|
||||
? `${chapterName} 🔒`
|
||||
: chapterName,
|
||||
name: locked ? `${chapterName} 🔒` : chapterName,
|
||||
path: chapterPath,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user