Commit a6d5075c authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

Merge branch 'patch-1' into 'master'

Add new mirror for mintmanga.com (clone readmanga.me with nsfw)

See merge request !1
parents 05270711 235967b1
Pipeline #40187093 passed with stages
in 2 minutes and 5 seconds
if (typeof registerMangaObject === "function") {
registerMangaObject({
mirrorName: "MintManga",
canListFullMangas: false,
mirrorIcon: "mintmanga.png",
languages: "ru",
domains: ["mintmanga.com"],
home: "http://mintmanga.com/",
chapter_url: /^\/.*\/vol.*\/[0-9]+.*$/g,
getMangaList: async function (search) {
let json = await amr.loadJson(
"http://mintmanga.com/search/suggestion?query=" + search,
{ nocache: true, preventimages: true }
)
let res = [];
for (let sug of json.suggestions) {
res[res.length] = [sug.value, "http://mintmanga.com" + sug.link]
}
return res
},
getListChaps: async function (urlManga) {
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) {
var str = $(this).attr("href");
str = str.split("/")[1];
if (str === mng_nm) {
res[res.length] = [
$($(this).contents()[0]).text(),
"http://mintmanga.com" + $(this).attr("href")
];
}
})
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://mintmanga.com" + $("#mangaBox h1 a:first-child", doc).attr("href");
var chapurl = "http://mintmanga.com" + $("#chapterSelectorSelect:first option:selected", doc).val();
return {
"name": name,
"currentMangaURL": nameurl,
"currentChapterURL": chapurl
}
},
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\(.*?\]\]/);
if (matches) {
matches = matches[0].slice(10);
matches = matches.split("'").join('"');
var b = JSON.parse(matches);
for (var i = 0; i < b.length; i++) {
res[i] = b[i][1] + b[i][0] + b[i][2];
}
}
return res;
},
getImageFromPageAndWrite: async function (urlImg, image) {
$(image).attr("src", urlImg);
},
whereDoIWriteScans: function (doc, curUrl) {
return $("#mangaBox", doc);
},
isCurrentPageAChapterPage: async function (doc, curUrl) {
doc = await this.passAdult(doc, curUrl)
return ($("img#mangaPicture", doc).length > 0);
},
doSomethingBeforeWritingScans: function (doc, curUrl) {
$("#mangaBox", doc).prev().remove();
$("#mangaBox", doc).prev().remove();
$(".second-nav", doc).append($("h1", doc));
$("h1", doc).css("text-align", "center");
$("#mangaBox", doc).empty();
$(".footerControl", doc).remove();
$("#mangaBox", doc).css("width", "100%");
$("#mangaBox", doc).css("padding", "0");
$("#mangaBox", doc).css("padding-top", "10px");
$("#mangaBox", doc).css("padding-bottom", "10px");
$("#mangaBox", doc).css("border", "0");
$("#mangaBox", doc).css("background-color", "black");
},
doAfterMangaLoaded: function (doc, curUrl) {
$("body > div:empty", doc).remove();
}
})
}
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