Commit 7003784d authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

Implement MyMangaReaderCMS abstract implem and create a few ones

parent f31416ef
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "ChibiManga",
mirrorIcon: "chibimanga.png",
languages: "en",
domains: ["www.cmreader.info"],
home: "http://www.cmreader.info/",
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "http://www.cmreader.info"
}
})
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "Fallen Angels",
mirrorIcon: "fallenangels.png",
languages: "en",
domains: ["manga.fascans.com"],
home: "http://manga.fascans.com/",
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "http://manga.fascans.com"
}
})
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "Hatigarm Scans",
mirrorIcon: "hatigarmscans.png",
languages: "en",
domains: ["www.hatigarmscans.net"],
home: "http://www.hatigarmscans.net/",
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "http://www.hatigarmscans.net"
},
test_options: {
search_phrase: "on"
},
})
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "MangaLEL",
mirrorIcon: "mangalel.png",
languages: "fr",
domains: ["www.manga-lel.com"],
home: "https://www.manga-lel.com/",
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "https://www.manga-lel.com"
}
})
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "Mangazuki",
mirrorIcon: "mangazuki.png",
languages: "en",
domains: ["mangazuki.co"],
home: "https://mangazuki.co/",
canListFullMangas: true,
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "https://mangazuki.co"
}
})
}
\ No newline at end of file
/**
* Abstract implementation for all sites based on FoolSlide
*/
var MyMangaReaderCMS = function (options) {
this.default_options = {
base_url: "https://mymangareadercms/"
}
this.options = Object.assign(this.default_options, options || {})
this.mirrorName = "MyMangaReaderCMS"
this.canListFullMangas = false
this.getMangaList = async function (search) {
let res = []
if (!this.canListFullMangas) {
let json = await amr.loadJson(
this.options.base_url + "/search?query=" + search,
{ nocache: true }
)
var sugs = json.suggestions;
for (let obj of sugs) {
res[res.length] = [obj.value, this.options.base_url + "/manga/" + obj.data];
}
} else {
let doc = await amr.loadPage(this.options.base_url + "/manga-list", { nocache: true, preventimages: true })
$("h5.media-heading > a[href*='/manga/']", doc).each(function() {
res.push([$(this).text().trim(), $(this).attr("href")])
})
}
return res
}
this.getListChaps = async function (urlManga) {
let doc = await amr.loadPage(urlManga, { nocache: true, preventimages: true })
let res = []
$("ul.chapters a[href*='/manga/']", doc).each(function () {
res.push([$(this).text(), $(this).attr("href")])
})
return res
}
this.getInformationsFromCurrentPage = async function (doc, curUrl) {
var name;
var currentMangaURL;
var currentChapterURL;
var chap = $("#chapter-list li.active a", doc);
currentChapterURL = chap.attr("href");
var mg = $("#navbar-collapse-1 > .nav > li > a[href*='/manga/']", doc);
name = mg.text();
if (name.endsWith("Manga")) name = name.substring(0, name.length - 5).trim();
currentMangaURL = mg.attr("href");
return {
"name": name,
"currentMangaURL": currentMangaURL,
"currentChapterURL": currentChapterURL
}
}
this.getListImages = async function (doc, curUrl) {
var res = [];
$(".viewer-cnt #all img", doc).each(
function () {
var src = $(this).attr("data-src");
if (src && src !== '') {
if (src.indexOf("//") === 0) src = this.protocol() + src;
res.push(src.trim())
}
}
)
return res
}
this.protocol = function () {
return this.options.base_url.substr(0, this.options.base_url.indexOf("/"));
}
this.getImageFromPageAndWrite = async function (urlImg, image) {
$(image).attr("src", urlImg);
}
this.whereDoIWriteScans = function (doc, curUrl) {
return $(".viewer-cnt", doc);
}
this.isCurrentPageAChapterPage = function (doc, curUrl) {
return $("#ppp img.scan-page", doc).length > 0;
}
this.doSomethingBeforeWritingScans = function (doc, curUrl) {
$(".viewer-cnt", doc).empty()
$(".pager-cnt", doc).remove()
}
this.doAfterMangaLoaded = function (doc, curUrl) {
}
}
if (typeof registerAbstractImplementation === 'function') {
registerAbstractImplementation("MyMangaReaderCMS")
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "Read Manhua",
mirrorIcon: "readmanhua.png",
languages: "en",
domains: ["readmanhua.net"],
home: "https://readmanhua.net/",
canListFullMangas: true,
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "https://readmanhua.net"
}
})
}
\ No newline at end of file
if (typeof registerMangaObject === 'function') {
registerMangaObject({
mirrorName: "ScanFR",
canListFullMangas: false,
mirrorIcon: "scanfr.png",
languages: "fr",
domains: ["www.scan-fr.io", "scan-fr.io"],
home: "http://www.scan-fr.io/",
getMangaList: async function (search) {
let json = await amr.loadJson(
"http://www.scan-fr.io/search?query=" + search,
{ nocache: true }
)
let res = []
var sugs = json.suggestions;
for (let obj of sugs) {
res[res.length] = [obj.value, "http://www.scan-fr.io/manga/" + obj.data];
}
return res
},
getListChaps: async function(urlManga) {
let doc = await amr.loadPage(urlManga, { nocache: true, preventimages: true })
let res = []
$("ul.chapters h5 a", doc).each(function (index) {
res[res.length] = [$(this).text(), $(this).attr("href")]
})
return res
},
getInformationsFromCurrentPage: async function(doc, curUrl) {
var name;
var currentMangaURL;
var currentChapterURL;
var chap = $("#chapter-list li.active a", doc);
currentChapterURL = chap.attr("href");
var mg = $("#navbar-collapse-1 .nav:nth-child(2) > li:first-child > a", doc);
name = mg.text();
if (name.endsWith("Manga")) name = name.substring(0, name.length - 5).trim();
currentMangaURL = mg.attr("href");
return {
"name": name,
"currentMangaURL": currentMangaURL,
"currentChapterURL": currentChapterURL
}
},
getListImages: async function(doc, curUrl) {
var res = [];
var path = curUrl;
var chapurl = $("#chapter-list li.active a", doc).attr("href");
$(".viewer-cnt #all img", doc).each(
function (index) {
var src = $(this).attr("data-src").trim();
if (src.indexOf("//") === 0) src = location.protocol + src;
res[index] = src;
}
)
return res
},
getImageFromPageAndWrite: async function (urlImg, image) {
$(image).attr("src", urlImg);
},
whereDoIWriteScans: function (doc, curUrl) {
return $(".viewer-cnt", doc);
},
isCurrentPageAChapterPage: function (doc, curUrl) {
return $("#ppp img.scan-page", doc).length > 0;
},
doSomethingBeforeWritingScans: function (doc, curUrl) {
$(".viewer-cnt", doc).empty();
},
doAfterMangaLoaded: function (doc, curUrl) {
abstract: "MyMangaReaderCMS",
abstract_options: {
base_url: "http://www.scan-fr.io"
}
})
}
\ No newline at end of file
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