Filters Redesign (#658)
* Add XCheckboxFilter * Fix madara typo * Change the branch name in config * Add typing for madara popoularnovels filters * Add preview and refactor PluginWrapper * Add preview HTML sanitize and other improv. * Web improvements + sanitizeHTML * Add dark mode * Add git run less to compile less * Add less.js to remove the need for compiling less
This commit is contained in:
@@ -40,21 +40,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fetch_1 = require("@libs/fetch");
|
||||
var filterInputs_1 = require("@libs/filterInputs");
|
||||
var cheerio_1 = require("cheerio");
|
||||
var defaultCover_1 = require("@libs/defaultCover");
|
||||
var novelStatus_1 = require("@libs/novelStatus");
|
||||
var parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
var dayjs_1 = __importDefault(require("dayjs"));
|
||||
var MadaraDefaultPath = {
|
||||
novels: 'novel',
|
||||
novel: 'novel',
|
||||
chapter: 'novel'
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
};
|
||||
var MadaraPlugin = /** @class */ (function () {
|
||||
function MadaraPlugin(metadata) {
|
||||
this.id = metadata.id;
|
||||
this.name = metadata.sourceName + "[madara]";
|
||||
var iconFileName = metadata.sourceName.replace(/\s+/g, "").toLowerCase();
|
||||
var iconFileName = metadata.sourceName
|
||||
.replace(/\s+/g, "")
|
||||
.toLowerCase();
|
||||
this.icon = "multisrc/madara/icons/".concat(iconFileName, ".png");
|
||||
this.site = metadata.sourceSite;
|
||||
this.version = "1.0.0";
|
||||
@@ -77,22 +80,32 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
url += ((_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.path) === null || _e === void 0 ? void 0 : _e.genres) + filters.genres;
|
||||
}
|
||||
else {
|
||||
url += ((_g = (_f = this.options) === null || _f === void 0 ? void 0 : _f.path) === null || _g === void 0 ? void 0 : _g.novels) ? this.options.path.novels : MadaraDefaultPath.novels;
|
||||
url += ((_g = (_f = this.options) === null || _f === void 0 ? void 0 : _f.path) === null || _g === void 0 ? void 0 : _g.novels)
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
}
|
||||
url += '/page/' + pageNo + '/' +
|
||||
'?m_orderby=' + (showLatestNovels ? 'latest' : ((filters === null || filters === void 0 ? void 0 : filters.sort) || 'rating'));
|
||||
url +=
|
||||
"/page/" +
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : (filters === null || filters === void 0 ? void 0 : filters.sort) || "rating");
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(url).then(function (res) { return res.text(); })];
|
||||
case 1:
|
||||
body = _h.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
var novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
var image = loadedCheerio(this).find('img');
|
||||
var novelCover = image.attr('data-src') || image.attr('src');
|
||||
var novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
loadedCheerio(".manga-title-badges").remove();
|
||||
loadedCheerio(".page-item-detail").each(function () {
|
||||
var novelName = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.text()
|
||||
.trim();
|
||||
var image = loadedCheerio(this).find("img");
|
||||
var novelCover = image.attr("data-src") || image.attr("src");
|
||||
var novelUrl = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.find("a")
|
||||
.attr("href") || "";
|
||||
var novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
@@ -119,71 +132,78 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _b.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges, #manga-title span').remove();
|
||||
loadedCheerio(".manga-title-badges, #manga-title span").remove();
|
||||
novel.name =
|
||||
loadedCheerio('.post-title h1').text().trim() ||
|
||||
loadedCheerio('#manga-title h1').text();
|
||||
loadedCheerio(".post-title h1").text().trim() ||
|
||||
loadedCheerio("#manga-title h1").text();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
loadedCheerio(".summary_image > a > img").attr("data-lazy-src") ||
|
||||
loadedCheerio(".summary_image > a > img").attr("data-src") ||
|
||||
loadedCheerio(".summary_image > a > img").attr("src") ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
var detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
var detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
loadedCheerio(".post-content_item, .post-content").each(function () {
|
||||
var detailName = loadedCheerio(this).find("h5").text().trim();
|
||||
var detail = loadedCheerio(this)
|
||||
.find(".summary-content")
|
||||
.text()
|
||||
.trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\\t\\n]/g, ',');
|
||||
case "Genre(s)":
|
||||
case "التصنيفات":
|
||||
novel.genres = detail.replace(/[\\t\\n]/g, ",");
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
case "Author(s)":
|
||||
case "المؤلف":
|
||||
case "المؤلف (ين)":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
case "Status":
|
||||
case "الحالة":
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
detail.includes("OnGoing") || detail.includes("مستمرة")
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
loadedCheerio("div.summary__content .code-block,script").remove();
|
||||
novel.summary =
|
||||
loadedCheerio('div.summary__content').text().trim() ||
|
||||
loadedCheerio('#tab-manga-about').text().trim() ||
|
||||
loadedCheerio('.post-content_item h5:contains("Summary")').next().text().trim();
|
||||
loadedCheerio("div.summary__content").text().trim() ||
|
||||
loadedCheerio("#tab-manga-about").text().trim() ||
|
||||
loadedCheerio('.post-content_item h5:contains("Summary")')
|
||||
.next()
|
||||
.text()
|
||||
.trim();
|
||||
if (!(((_a = this.options) === null || _a === void 0 ? void 0 : _a.useNewChapterEndpoint) !== true)) return [3 /*break*/, 3];
|
||||
novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
novelId = loadedCheerio(".rating-post-id").attr("value") ||
|
||||
loadedCheerio("#manga-chapters-holder").attr("data-id") ||
|
||||
"";
|
||||
formData = new FormData();
|
||||
formData.append("action", "manga_get_chapters");
|
||||
formData.append("manga", novelId);
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(this.site + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(this.site + "wp-admin/admin-ajax.php", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
})
|
||||
.then(function (res) { return res.text(); })];
|
||||
}).then(function (res) { return res.text(); })];
|
||||
case 2:
|
||||
html = _b.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 3: return [4 /*yield*/, (0, fetch_1.fetchApi)(novelUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(function (res) { return res.text(); })];
|
||||
case 3: return [4 /*yield*/, (0, fetch_1.fetchApi)(novelUrl + "ajax/chapters/", {
|
||||
method: "POST",
|
||||
}).then(function (res) { return res.text(); })];
|
||||
case 4:
|
||||
html = _b.sent();
|
||||
_b.label = 5;
|
||||
case 5:
|
||||
if (html !== '0') {
|
||||
if (html !== "0") {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
var chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
loadedCheerio(".wp-manga-chapter").each(function () {
|
||||
var chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
var releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.find("span.chapter-release-date")
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
@@ -193,10 +213,14 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
releaseDate = (0, dayjs_1.default)().format("LL");
|
||||
}
|
||||
var chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
var chapterUrl = loadedCheerio(this).find("a").attr("href") || "";
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return [2 /*return*/, novel];
|
||||
@@ -213,9 +237,10 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _a.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html() || "";
|
||||
chapterText = loadedCheerio(".text-left").html() ||
|
||||
loadedCheerio(".text-right").html() ||
|
||||
loadedCheerio(".entry-content").html() ||
|
||||
"";
|
||||
return [2 /*return*/, chapterText];
|
||||
}
|
||||
});
|
||||
@@ -233,14 +258,17 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _a.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
var novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
var image = loadedCheerio(this).find('img');
|
||||
var novelCover = image.attr('data-src') || image.attr('src');
|
||||
loadedCheerio(".c-tabs-item__content").each(function () {
|
||||
var novelName = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.text()
|
||||
.trim();
|
||||
var image = loadedCheerio(this).find("img");
|
||||
var novelCover = image.attr("data-src") || image.attr("src");
|
||||
var novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
.find(".post-title")
|
||||
.find("a")
|
||||
.attr("href") || "";
|
||||
var novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
@@ -265,5 +293,5 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
};
|
||||
return MadaraPlugin;
|
||||
}());
|
||||
var plugin = new MadaraPlugin({ "id": "turkcelightnovels", "sourceSite": "https://turkcelightnovels.com/", "sourceName": "TurkceLightNovels", "filters": [{ "key": "sort", "label": "Order by", "values": [{ "label": "Rating", "value": "rating" }, { "label": "A-Z", "value": "alphabet" }, { "label": "Latest", "value": "latest" }, { "label": "Most Views", "value": "views" }, { "label": "New", "value": "new-manga" }, { "label": "Trending", "value": "trending" }], "inputType": 1 }], "options": { "path": { "novels": "light-novel", "novel": "light-novel", "chapter": "light-novel" }, "lang": "Turkish" } });
|
||||
var plugin = new MadaraPlugin({ "id": "turkcelightnovels", "sourceSite": "https://turkcelightnovels.com/", "sourceName": "TurkceLightNovels", "filters": { "sort": { "label": "Order by", "value": "", "options": [{ "label": "Default", "value": "" }, { "label": "Rating", "value": "rating" }, { "label": "A-Z", "value": "alphabet" }, { "label": "Latest", "value": "latest" }, { "label": "Most Views", "value": "views" }, { "label": "New", "value": "new-manga" }, { "label": "Trending", "value": "trending" }], "type": filterInputs_1.FilterTypes.Picker } }, "options": { "path": { "novels": "light-novel", "novel": "light-novel", "chapter": "light-novel" }, "lang": "Turkish" } });
|
||||
exports.default = plugin;
|
||||
|
||||
@@ -40,21 +40,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fetch_1 = require("@libs/fetch");
|
||||
var filterInputs_1 = require("@libs/filterInputs");
|
||||
var cheerio_1 = require("cheerio");
|
||||
var defaultCover_1 = require("@libs/defaultCover");
|
||||
var novelStatus_1 = require("@libs/novelStatus");
|
||||
var parseMadaraDate_1 = require("@libs/parseMadaraDate");
|
||||
var dayjs_1 = __importDefault(require("dayjs"));
|
||||
var MadaraDefaultPath = {
|
||||
novels: 'novel',
|
||||
novel: 'novel',
|
||||
chapter: 'novel'
|
||||
novels: "novel",
|
||||
novel: "novel",
|
||||
chapter: "novel",
|
||||
};
|
||||
var MadaraPlugin = /** @class */ (function () {
|
||||
function MadaraPlugin(metadata) {
|
||||
this.id = metadata.id;
|
||||
this.name = metadata.sourceName + "[madara]";
|
||||
var iconFileName = metadata.sourceName.replace(/\s+/g, "").toLowerCase();
|
||||
var iconFileName = metadata.sourceName
|
||||
.replace(/\s+/g, "")
|
||||
.toLowerCase();
|
||||
this.icon = "multisrc/madara/icons/".concat(iconFileName, ".png");
|
||||
this.site = metadata.sourceSite;
|
||||
this.version = "1.0.0";
|
||||
@@ -77,22 +80,32 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
url += ((_e = (_d = this.options) === null || _d === void 0 ? void 0 : _d.path) === null || _e === void 0 ? void 0 : _e.genres) + filters.genres;
|
||||
}
|
||||
else {
|
||||
url += ((_g = (_f = this.options) === null || _f === void 0 ? void 0 : _f.path) === null || _g === void 0 ? void 0 : _g.novels) ? this.options.path.novels : MadaraDefaultPath.novels;
|
||||
url += ((_g = (_f = this.options) === null || _f === void 0 ? void 0 : _f.path) === null || _g === void 0 ? void 0 : _g.novels)
|
||||
? this.options.path.novels
|
||||
: MadaraDefaultPath.novels;
|
||||
}
|
||||
url += '/page/' + pageNo + '/' +
|
||||
'?m_orderby=' + (showLatestNovels ? 'latest' : ((filters === null || filters === void 0 ? void 0 : filters.sort) || 'rating'));
|
||||
url +=
|
||||
"/page/" +
|
||||
pageNo +
|
||||
"/" +
|
||||
"?m_orderby=" +
|
||||
(showLatestNovels ? "latest" : (filters === null || filters === void 0 ? void 0 : filters.sort) || "rating");
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(url).then(function (res) { return res.text(); })];
|
||||
case 1:
|
||||
body = _h.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges').remove();
|
||||
loadedCheerio('.page-item-detail').each(function () {
|
||||
var novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
var image = loadedCheerio(this).find('img');
|
||||
var novelCover = image.attr('data-src') || image.attr('src');
|
||||
var novelUrl = loadedCheerio(this).find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
loadedCheerio(".manga-title-badges").remove();
|
||||
loadedCheerio(".page-item-detail").each(function () {
|
||||
var novelName = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.text()
|
||||
.trim();
|
||||
var image = loadedCheerio(this).find("img");
|
||||
var novelCover = image.attr("data-src") || image.attr("src");
|
||||
var novelUrl = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.find("a")
|
||||
.attr("href") || "";
|
||||
var novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
@@ -119,71 +132,78 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _b.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.manga-title-badges, #manga-title span').remove();
|
||||
loadedCheerio(".manga-title-badges, #manga-title span").remove();
|
||||
novel.name =
|
||||
loadedCheerio('.post-title h1').text().trim() ||
|
||||
loadedCheerio('#manga-title h1').text();
|
||||
loadedCheerio(".post-title h1").text().trim() ||
|
||||
loadedCheerio("#manga-title h1").text();
|
||||
novel.cover =
|
||||
loadedCheerio('.summary_image > a > img').attr('data-lazy-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('data-src') ||
|
||||
loadedCheerio('.summary_image > a > img').attr('src') ||
|
||||
loadedCheerio(".summary_image > a > img").attr("data-lazy-src") ||
|
||||
loadedCheerio(".summary_image > a > img").attr("data-src") ||
|
||||
loadedCheerio(".summary_image > a > img").attr("src") ||
|
||||
defaultCover_1.defaultCover;
|
||||
loadedCheerio('.post-content_item, .post-content').each(function () {
|
||||
var detailName = loadedCheerio(this).find('h5').text().trim();
|
||||
var detail = loadedCheerio(this).find('.summary-content').text().trim();
|
||||
loadedCheerio(".post-content_item, .post-content").each(function () {
|
||||
var detailName = loadedCheerio(this).find("h5").text().trim();
|
||||
var detail = loadedCheerio(this)
|
||||
.find(".summary-content")
|
||||
.text()
|
||||
.trim();
|
||||
switch (detailName) {
|
||||
case 'Genre(s)':
|
||||
case 'التصنيفات':
|
||||
novel.genres = detail.replace(/[\\t\\n]/g, ',');
|
||||
case "Genre(s)":
|
||||
case "التصنيفات":
|
||||
novel.genres = detail.replace(/[\\t\\n]/g, ",");
|
||||
break;
|
||||
case 'Author(s)':
|
||||
case 'المؤلف':
|
||||
case 'المؤلف (ين)':
|
||||
case "Author(s)":
|
||||
case "المؤلف":
|
||||
case "المؤلف (ين)":
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Status':
|
||||
case 'الحالة':
|
||||
case "Status":
|
||||
case "الحالة":
|
||||
novel.status =
|
||||
detail.includes('OnGoing') || detail.includes('مستمرة')
|
||||
detail.includes("OnGoing") || detail.includes("مستمرة")
|
||||
? novelStatus_1.NovelStatus.Ongoing
|
||||
: novelStatus_1.NovelStatus.Completed;
|
||||
break;
|
||||
}
|
||||
});
|
||||
loadedCheerio('div.summary__content .code-block,script').remove();
|
||||
loadedCheerio("div.summary__content .code-block,script").remove();
|
||||
novel.summary =
|
||||
loadedCheerio('div.summary__content').text().trim() ||
|
||||
loadedCheerio('#tab-manga-about').text().trim() ||
|
||||
loadedCheerio('.post-content_item h5:contains("Summary")').next().text().trim();
|
||||
loadedCheerio("div.summary__content").text().trim() ||
|
||||
loadedCheerio("#tab-manga-about").text().trim() ||
|
||||
loadedCheerio('.post-content_item h5:contains("Summary")')
|
||||
.next()
|
||||
.text()
|
||||
.trim();
|
||||
if (!(((_a = this.options) === null || _a === void 0 ? void 0 : _a.useNewChapterEndpoint) !== true)) return [3 /*break*/, 3];
|
||||
novelId = loadedCheerio('.rating-post-id').attr('value') ||
|
||||
loadedCheerio('#manga-chapters-holder').attr('data-id') || '';
|
||||
novelId = loadedCheerio(".rating-post-id").attr("value") ||
|
||||
loadedCheerio("#manga-chapters-holder").attr("data-id") ||
|
||||
"";
|
||||
formData = new FormData();
|
||||
formData.append("action", "manga_get_chapters");
|
||||
formData.append("manga", novelId);
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(this.site + 'wp-admin/admin-ajax.php', {
|
||||
method: 'POST',
|
||||
return [4 /*yield*/, (0, fetch_1.fetchApi)(this.site + "wp-admin/admin-ajax.php", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
})
|
||||
.then(function (res) { return res.text(); })];
|
||||
}).then(function (res) { return res.text(); })];
|
||||
case 2:
|
||||
html = _b.sent();
|
||||
return [3 /*break*/, 5];
|
||||
case 3: return [4 /*yield*/, (0, fetch_1.fetchApi)(novelUrl + 'ajax/chapters/', { method: 'POST' })
|
||||
.then(function (res) { return res.text(); })];
|
||||
case 3: return [4 /*yield*/, (0, fetch_1.fetchApi)(novelUrl + "ajax/chapters/", {
|
||||
method: "POST",
|
||||
}).then(function (res) { return res.text(); })];
|
||||
case 4:
|
||||
html = _b.sent();
|
||||
_b.label = 5;
|
||||
case 5:
|
||||
if (html !== '0') {
|
||||
if (html !== "0") {
|
||||
loadedCheerio = (0, cheerio_1.load)(html);
|
||||
}
|
||||
chapters = [];
|
||||
loadedCheerio('.wp-manga-chapter').each(function () {
|
||||
var chapterName = loadedCheerio(this).find('a').text().trim();
|
||||
loadedCheerio(".wp-manga-chapter").each(function () {
|
||||
var chapterName = loadedCheerio(this).find("a").text().trim();
|
||||
var releaseDate = null;
|
||||
releaseDate = loadedCheerio(this)
|
||||
.find('span.chapter-release-date')
|
||||
.find("span.chapter-release-date")
|
||||
.text()
|
||||
.trim();
|
||||
if (releaseDate) {
|
||||
@@ -193,10 +213,14 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
/**
|
||||
* Insert current date
|
||||
*/
|
||||
releaseDate = (0, dayjs_1.default)().format('LL');
|
||||
releaseDate = (0, dayjs_1.default)().format("LL");
|
||||
}
|
||||
var chapterUrl = loadedCheerio(this).find('a').attr('href') || '';
|
||||
chapters.push({ name: chapterName, releaseTime: releaseDate, url: chapterUrl });
|
||||
var chapterUrl = loadedCheerio(this).find("a").attr("href") || "";
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
releaseTime: releaseDate,
|
||||
url: chapterUrl,
|
||||
});
|
||||
});
|
||||
novel.chapters = chapters.reverse();
|
||||
return [2 /*return*/, novel];
|
||||
@@ -213,9 +237,10 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _a.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
chapterText = loadedCheerio('.text-left').html() ||
|
||||
loadedCheerio('.text-right').html() ||
|
||||
loadedCheerio('.entry-content').html() || "";
|
||||
chapterText = loadedCheerio(".text-left").html() ||
|
||||
loadedCheerio(".text-right").html() ||
|
||||
loadedCheerio(".entry-content").html() ||
|
||||
"";
|
||||
return [2 /*return*/, chapterText];
|
||||
}
|
||||
});
|
||||
@@ -233,14 +258,17 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
case 1:
|
||||
body = _a.sent();
|
||||
loadedCheerio = (0, cheerio_1.load)(body);
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
var novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
var image = loadedCheerio(this).find('img');
|
||||
var novelCover = image.attr('data-src') || image.attr('src');
|
||||
loadedCheerio(".c-tabs-item__content").each(function () {
|
||||
var novelName = loadedCheerio(this)
|
||||
.find(".post-title")
|
||||
.text()
|
||||
.trim();
|
||||
var image = loadedCheerio(this).find("img");
|
||||
var novelCover = image.attr("data-src") || image.attr("src");
|
||||
var novelUrl = loadedCheerio(this)
|
||||
.find('.post-title')
|
||||
.find('a')
|
||||
.attr('href') || '';
|
||||
.find(".post-title")
|
||||
.find("a")
|
||||
.attr("href") || "";
|
||||
var novel = {
|
||||
name: novelName,
|
||||
cover: novelCover,
|
||||
@@ -265,5 +293,5 @@ var MadaraPlugin = /** @class */ (function () {
|
||||
};
|
||||
return MadaraPlugin;
|
||||
}());
|
||||
var plugin = new MadaraPlugin({ "id": "webnoveloku", "sourceSite": "https://www.webnoveloku.com/", "sourceName": "WebNovelOku ", "filters": [{ "key": "sort", "label": "Sırala", "values": [{ "label": "A-Z", "value": "alphabet" }, { "label": "En Son", "value": "latest" }, { "label": "Görüntülenme", "value": "views" }, { "label": "Popülarite", "value": "trending" }, { "label": "Reyting", "value": "rating" }, { "label": "Yeni", "value": "new-manga" }], "inputType": 1 }], "options": { "lang": "Turkish" } });
|
||||
var plugin = new MadaraPlugin({ "id": "webnoveloku", "sourceSite": "https://www.webnoveloku.com/", "sourceName": "WebNovelOku ", "filters": { "sort": { "label": "Sırala", "value": "", "options": [{ "label": "Default", "value": "" }, { "label": "A-Z", "value": "alphabet" }, { "label": "En Son", "value": "latest" }, { "label": "Görüntülenme", "value": "views" }, { "label": "Popülarite", "value": "trending" }, { "label": "Reyting", "value": "rating" }, { "label": "Yeni", "value": "new-manga" }], "type": filterInputs_1.FilterTypes.Picker } }, "options": { "lang": "Turkish" } });
|
||||
exports.default = plugin;
|
||||
|
||||
@@ -48,11 +48,11 @@ var LSHNovel = /** @class */ (function () {
|
||||
this.version = "1.0.0";
|
||||
this.userAgent = "";
|
||||
this.cookieString = "";
|
||||
this.filters = [
|
||||
{
|
||||
key: "order",
|
||||
this.filters = {
|
||||
order: {
|
||||
value: "popular",
|
||||
label: "Önerilen",
|
||||
values: [
|
||||
options: [
|
||||
{ label: "Varsayılan", value: "" },
|
||||
{ label: "A-Z", value: "title" },
|
||||
{ label: "Z-A", value: "titlereverse" },
|
||||
@@ -60,35 +60,35 @@ var LSHNovel = /** @class */ (function () {
|
||||
{ label: "Son Eklenenler", value: "latest" },
|
||||
{ label: "Bestimiz", value: "popular" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
type: filterInputs_1.FilterTypes.Picker,
|
||||
},
|
||||
{
|
||||
key: "status",
|
||||
status: {
|
||||
label: "Statü",
|
||||
values: [
|
||||
value: "",
|
||||
options: [
|
||||
{ label: "Tümü", value: "" },
|
||||
{ label: "Ongoing", value: "ongoing" },
|
||||
{ label: "Hiatus", value: "hiatus" },
|
||||
{ label: "Completed", value: "completed" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Picker,
|
||||
type: filterInputs_1.FilterTypes.Picker,
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
type: {
|
||||
value: [],
|
||||
label: "Tür",
|
||||
values: [
|
||||
options: [
|
||||
{ label: "Çeviri Novel", value: "ceviri-novel" },
|
||||
{ label: "Liz-Chan", value: "liz-chan" },
|
||||
{ label: "Manhwa", value: "manhwa" },
|
||||
{ label: "Orijinal Novel", value: "orijinal-novel" },
|
||||
{ label: "Web Novel", value: "web-novel" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
type: filterInputs_1.FilterTypes.CheckboxGroup,
|
||||
},
|
||||
{
|
||||
key: "genres",
|
||||
genres: {
|
||||
value: [],
|
||||
label: "Kategori",
|
||||
values: [
|
||||
options: [
|
||||
{ label: "+18", value: "18" },
|
||||
{ label: "Action", value: "action" },
|
||||
{ label: "Adult", value: "adult" },
|
||||
@@ -124,9 +124,9 @@ var LSHNovel = /** @class */ (function () {
|
||||
{ label: "Tragedy", value: "tragedy" },
|
||||
{ label: "Yaoi", value: "yaoi" },
|
||||
],
|
||||
inputType: filterInputs_1.FilterInputs.Checkbox,
|
||||
type: filterInputs_1.FilterTypes.CheckboxGroup,
|
||||
},
|
||||
];
|
||||
};
|
||||
}
|
||||
LSHNovel.prototype.popularNovels = function (pageNo, _a) {
|
||||
var filters = _a.filters;
|
||||
@@ -136,15 +136,13 @@ var LSHNovel = /** @class */ (function () {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
link = "".concat(this.site, "series/?page=").concat(pageNo);
|
||||
if (filters) {
|
||||
if (Array.isArray(filters.genres) && filters.genres.length) {
|
||||
link += filters.genres.map(function (i) { return "&genre[]=".concat(i); }).join("");
|
||||
}
|
||||
if (Array.isArray(filters.type) && filters.type.length)
|
||||
link += filters.type.map(function (i) { return "&lang[]=".concat(i); }).join("");
|
||||
if (filters.genres.value.length) {
|
||||
link += filters.genres.value.map(function (i) { return "&genre[]=".concat(i); }).join("");
|
||||
}
|
||||
link += "&status=" + ((filters === null || filters === void 0 ? void 0 : filters.status) ? filters.status : "");
|
||||
link += "&order=" + ((filters === null || filters === void 0 ? void 0 : filters.order) ? filters.order : "popular");
|
||||
if (filters.type.value.length)
|
||||
link += filters.type.value.map(function (i) { return "&lang[]=".concat(i); }).join("");
|
||||
link += "&status=" + filters.status;
|
||||
link += "&order=" + filters.order;
|
||||
headers = new Headers();
|
||||
if (this.cookieString) {
|
||||
headers.append("cookie", this.cookieString);
|
||||
@@ -175,7 +173,6 @@ var LSHNovel = /** @class */ (function () {
|
||||
});
|
||||
});
|
||||
};
|
||||
;
|
||||
LSHNovel.prototype.parseNovelAndChapters = function (novelUrl) {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var url, headers, result, body, loadedCheerio, novel, chapter;
|
||||
@@ -204,7 +201,12 @@ var LSHNovel = /** @class */ (function () {
|
||||
loadedCheerio("img.wp-post-image").attr("src");
|
||||
loadedCheerio("div.spe > span").each(function () {
|
||||
var detailName = loadedCheerio(this).find("b").text().trim();
|
||||
var detail = loadedCheerio(this).find('b').remove().end().text().trim();
|
||||
var detail = loadedCheerio(this)
|
||||
.find("b")
|
||||
.remove()
|
||||
.end()
|
||||
.text()
|
||||
.trim();
|
||||
switch (detailName) {
|
||||
case "Yazar:":
|
||||
novel.author = detail;
|
||||
|
||||
Reference in New Issue
Block a user