Commit 97b77e6e authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

Fix ReadManga mature flag

parent d8289662
Pipeline #29846965 passed with stages
in 2 minutes and 30 seconds
......@@ -20,7 +20,7 @@ if (typeof registerMangaObject === "function") {
},
getListChaps: async function (urlManga) {
let doc = await amr.loadPage(urlManga + "?mature=1", { nocache: true, preventimages: true })
let doc = await amr.loadPage(urlManga + "?mtr=1", { nocache: true, preventimages: true })
let res = []
var mng_nm = (urlManga.split("/")).pop();
$("div.expandable td > a", doc).each(function (index) {
......@@ -36,11 +36,18 @@ if (typeof registerMangaObject === "function") {
return res
},
passAdult: async function(doc, curUrl) {
if ($("a[href='?mtr=1']").length > 0) {
doc = await amr.loadPage(curUrl + "?mtr=1")
}
return doc
},
getInformationsFromCurrentPage: async function (doc, curUrl) {
doc = await this.passAdult(doc, curUrl)
var name = $($("#mangaBox h1 a:first-child", doc).contents()[0]).text();
var nameurl = "http://readmanga.me" + $("#mangaBox h1 a:first-child", doc).attr("href");
var chapurl = "http://readmanga.me" + $("#chapterSelectorSelect:first option:selected", doc).val();
if (chapurl.indexOf("?") > 0) chapurl = chapurl.substring(0, chapurl.indexOf("?"));
return {
"name": name,
"currentMangaURL": nameurl,
......@@ -49,6 +56,8 @@ if (typeof registerMangaObject === "function") {
},
getListImages: async function (doc, curUrl) {
doc = await this.passAdult(doc, curUrl)
var res = [];
var matches = $.map($("script", doc), el => $(el).text()).join(";") //doc.documentElement.innerHTML; --> replace to work in JSDOM
matches = matches.match(/rm_h\.init\(.*?\]\]/);
......@@ -70,7 +79,9 @@ if (typeof registerMangaObject === "function") {
whereDoIWriteScans: function (doc, curUrl) {
return $("#mangaBox", doc);
},
isCurrentPageAChapterPage: function (doc, curUrl) {
isCurrentPageAChapterPage: async function (doc, curUrl) {
doc = await this.passAdult(doc, curUrl)
return ($("img#mangaPicture", doc).length > 0);
},
doSomethingBeforeWritingScans: function (doc, curUrl) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment