Commit 857594bb authored by Duhoux Pierre-Louis's avatar Duhoux Pierre-Louis

[INIT] First commit (10 implementations and node script to create websites.json

parents
# Set the default line endings. This avoids issues with committing via different kinds of OS's.
* text=auto
\ No newline at end of file
This diff is collapsed.
All Mangas Reader mirrors implementation repository
=======
View the magic behind how we control our mirrors and push your contributions.
Mirrors implementations are in mirrors, icons for websites are in icons.
To update implementations or create new one, follow these steps :
- fork this repository
- run a local server at the root of your local repo, to do so, you can install http-server through npm and then run the server :
npm install http-server -g
http-server
- create the websites.json file using node :
node .\update-ws.js
- Configure your local repository in AMR (in the extension, open options > Supported websites > at the bottom click "New Repository" and enter http://localhost:8080)
- Go to the lab (in the extension, open options > Supported websites > at the bottom, click on AMR Laboratory)
- Click on Refresh Mirrors to update AMR mirrors list, select your mirror and run tests
You can quickly debug issues by changing code, reloading mirrors, running tests. Sometimes, if you use console.log to debug, it appears in the background.html log
Don't forget to run "node .\update-ws.js" if you update implementations attributes
Please keep the files updated and pull requests for your updates / new implementations
\ No newline at end of file
var EasyGoing = {
mirrorName : "Easy Going",
canListFullMangas : true,
mirrorIcon : "easygoing.png",
languages : "en",
webSites: ["http://*.egscans.org/*","http://*.egscans.com/*"],
getMangaList : function (search, callback) {
"use strict";
$.ajax({
url : "http://read.egscans.com/",
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div"),
res = [];
div.innerHTML = objResponse.replace(/<img /gi, '<noload');
$("select[name='manga'] option", div).each(function () {
if ($(this).attr('value') !== 0) {
res[res.length] = [$(this).text(), "http://read.egscans.com/" + $(this).attr('value')];
}
});
callback("Easy Going", res);
}
});
},
getListChaps : function (urlManga, mangaName, obj, callback) {
"use strict";
$.ajax({
url : urlManga,
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div"),
res = [];
div.innerHTML = objResponse.replace(/<img /gi, '<noload');
$("select[name='chapter'] option", div).each(function (index) {
res[res.length] = [$(this).text(), urlManga + '/' + $(this).attr('value')];
});
res.reverse();
callback(res, obj);
}
});
},
getInformationsFromCurrentPage : function (doc, curUrl, callback) {
"use strict";
var name = $("select[name='manga'] option:selected", doc).text(),
currentChapter = $("select[name='chapter'] option:selected", doc).text(),
currentMangaURL = "http://read.egscans.com/" + $("select[name='manga'] option:selected", doc).attr('value'),
currentChapterURL = currentMangaURL + '/' + $("select[name='chapter'] option:selected", doc).attr('value');
callback({
"name" : name,
"currentChapter" : currentChapter,
"currentMangaURL" : currentMangaURL,
"currentChapterURL" : currentChapterURL
});
},
getListImages : function (doc, curUrl) {
"use strict";
var res = [],
img = [],
txt,
i;
txt = $(".mid > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > script:nth-child(2)", doc).html();
txt = JSON.stringify(txt);
img = txt.match(/img_url\.push\(\'.+?\' \)/g);
for (i = 0; img.length > i; i += 1) {
res.push("http://read.egscans.com/" + img[i].match(/'(.*?)'/ig)[0].replace(/'/g, ""));
}
return res;
},
whereDoIWriteScans : function (doc, curUrl) {
"use strict";
return $('.imgAMR', doc);
},
isCurrentPageAChapterPage : function (doc, curUrl) {
"use strict";
return ($("select[name='chapter']", doc).length > 0);
},
doSomethingBeforeWritingScans : function (doc, curUrl) {
"use strict";
$('td.mid', doc).empty();
$('td.mid', doc).append($("<div class='imgAMR'></div>"));
},
getImageFromPageAndWrite : function (urlImg, image, doc, curUrl) {
"use strict";
$(image).attr("src", urlImg);
},
doAfterMangaLoaded : function (doc, curUrl) {
"use strict";
$("body > div:empty", doc).remove();
$('select', doc).css('background-color', 'white');
$('option', doc).css('background-color', 'white').css('color', 'black');
}
};
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("Easy Going", EasyGoing);
}
\ No newline at end of file
var GoodManga = {
mirrorName : "GoodManga",
canListFullMangas : false,
mirrorIcon : "goodmanga.png",
languages : "en",
webSites: ["http://www.goodmanga.net/*"],
getMangaList : function (search, callback) {
$.ajax({
url : "http://www.goodmanga.net/manga-search?key=" + search + "&search=Go" + "",
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
var res = [];
$(".series_list .right_col h3 a:first-child", div).each(function (index) {
res[res.length] = [$(this).text().trim(), $(this).attr("href")];
});
callback("GoodManga", res);
}
});
},
getListChaps : function (urlManga, mangaName, obj, callback) {
$.ajax({
url : urlManga,
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
var res = [];
$("#chapters ul li a", div).each(function (index) {
res[res.length] = [$(this).text().trim(), $(this).attr("href")];
});
callback(res, obj);
}
});
},
getInformationsFromCurrentPage : function (doc, curUrl, callback) {
var name = $("#content #manga_head h3 a", doc).text();
var nameurl = $("#content #manga_head h3 a", doc).attr("href");
var curChapName = $("select.chapter_select:first option:selected", doc).text();
var chapurl = $("#page #content #assets #asset_1 select.chapter_select:first option:selected", doc).val();
callback({
"name" : name.trim(),
"currentChapter" : curChapName.trim(),
"currentMangaURL" : nameurl,
"currentChapterURL" : chapurl
});
},
getListImages : function (doc, curUrl2) {
var res = [];
$("#page #content #assets #asset_2 select.page_select:first option", doc).each(function (index) {
res[res.length] = $(this).val();
});
return res;
},
whereDoIWriteScans : function (doc, curUrl) {
return $("#manga_viewer", doc);
},
isCurrentPageAChapterPage : function (doc, curUrl) {
return ($("div#content div#manga_viewer img", doc).size() > 0);
},
doSomethingBeforeWritingScans : function (doc, curUrl) {
$("#manga_nav_top", doc).remove();
$("#manga_nav_bottom", doc).remove();
$("#manga_viewer", doc).empty();
$("#content", doc).css("background-color", "black");
$("#manga_viewer", doc).css("padding-top", "10px");
},
getImageFromPageAndWrite : function (urlImg, image, doc, curUrl) {
$.ajax({
url : urlImg,
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse;
var src = $("#manga_viewer img", div).attr("src");
$(image).attr("src", src);
}
});
},
doAfterMangaLoaded : function (doc, curUrl) {
$("body > div:empty", doc).remove();
}
}
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("GoodManga", GoodManga);
}
\ No newline at end of file
var MangaFox = {
mirrorName: "Manga-Fox",
canListFullMangas: false,
canSearch: true,
mirrorIcon: "mangafox.png",
webSites: ["https://fanfox.net/*", "http://fanfox.net/*"],
languages: "en",
getMangaList: function(search, callback) {
"use strict";
var urlManga = "https://fanfox.net/search.php?name=" + search +
"&advopts=1";
$.ajax({
url: urlManga,
beforeSend: function(xhr) {
xhr.setRequestHeader("Cache-Control",
"no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success: function(objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
if (objResponse.indexOf("No Manga Series") !==
-1) {
callback("Manga-Fox", []);
} else {
var res = [];
$("#mangalist .manga_text .title", div).each(
function(index, a) {
res[index] = [$(a).html(),
"https:" + $(a).attr("href")
];
});
callback("Manga-Fox", res);
}
}
});
},
getListChaps: function(urlManga, mangaName, obj, callback) {
"use strict";
$.ajax({
url: urlManga + "?no_warning=1",
beforeSend: function(xhr) {
xhr.setRequestHeader("Cache-Control",
"no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success: function(objResponse) {
var div = document.createElement("div");
objResponse = objResponse.replace(/<imgb[^>]*>/ig, ''); //avoid loading cover image
div.innerHTML = objResponse;
var res = [];
var mangaName = $('#title h2', div).text().substr(
5, $('#title h2', div).text().length -
18);
$("ul.chlist h3, ul.chlist h4", div).each(
function(index) {
if ($('a', $(this)).attr("href")
.indexOf("/manga/") !== -1) {
var vol = $(this).parents(
'ul.chlist').prev(
'div.slide').children(
'h3').contents(
':not(span)').text()
.trim().substr(7);
var tit = 'Vol ' + vol +
' Ch ' + $('a', $(this))
.text().substr(
mangaName.length +
1) + ': ' + $(
'span.title', $(
this)).text();
var url = $('a', $(this)).attr(
"href");
var curChapURL = url.substr(
0, url.lastIndexOf(
"/") + 1);
if (curChapURL.substr(
curChapURL.length -
2, 2) === "//") {
curChapURL = curChapURL
.substr(0,
curChapURL.length -
1);
}
res[res.length] = [tit.trim(),
"https:" + curChapURL
];
}
});
callback(res, obj);
}
});
},
getInformationsFromCurrentPage: function(doc, curUrl, callback) {
"use strict";
var str = $('#series > strong a', doc).text(); // dom lookups are expensive!
var name = $('#related > h3 a', doc).text() || str.substring(0,
str.length - 6); //falls through #related, into #series
var currentChapter = $("#series h1", doc).text();
var url = curUrl;
var posSl5 = 0;
var i;
for (i = 0; i < 5; i += 1) {
posSl5 = url.indexOf("/", posSl5 + 1);
}
var curChapURL = url.substr(0, url.lastIndexOf("/") + 1);
if (curChapURL.substr(curChapURL.length - 2, 2) === "//") {
curChapURL = curChapURL.substr(0, curChapURL.length - 1);
}
callback({
"name": name,
"currentChapter": currentChapter.trim(),
"currentMangaURL": url.substr(0, posSl5 + 1),
"currentChapterURL": curChapURL
});
},
getListImages: function(doc, curUrl) {
"use strict";
var res = [];
$('#top_bar select.m option', doc).each(function() {
if (this.value > 0) {
res.push(curUrl.substr(0, curUrl.lastIndexOf(
"/") + 1) + this.value + '.html');
}
});
return res;
},
whereDoIWriteScans: function(doc, curUrl) {
"use strict";
return $("#viewer", doc);
},
isCurrentPageAChapterPage: function(doc, curUrl) {
"use strict";
if ($("#viewer", doc) !== null) {
return ($("#viewer", doc).size() !== 0);
}
return false;
},
doSomethingBeforeWritingScans: function(doc, curUrl) {
"use strict";
$('#viewer', doc).css({
'width': 'auto',
'margin': 'auto',
'background-color': 'black'
});
$("#image", doc).remove();
$("#tool", doc).next().remove();
$(".widepage.page", doc).remove();
$('.fb_iframe_widget', doc).remove();
$(".read_img", doc).css("background-image", "none");
if (typeof doc.createElement === 'function') {
var script = doc.createElement('script');
script.innerText = "$(document).unbind('keydown');";
doc.body.appendChild(script);
}
},
getImageFromPageAndWrite: function(urlImg, image, doc, curUrl) {
"use strict";
$.ajax({
url: urlImg,
success: function(objResponse) {
var src = $('#image', objResponse).attr('src');
$(image).attr("src", src);
},
error: function() {
$(image).attr("src", "");
}
});
},
doAfterMangaLoaded: function(doc, curUrl) {
"use strict";
$("body > div:empty", doc).remove();
}
};
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("Manga-Fox", MangaFox);
}
var MangaHere = {
mirrorName: "Manga Here",
canListFullMangas: false,
mirrorIcon: "mangahere.png",
languages: "en",
webSites: ["https://www.mangahere.cc/*", "http://www.mangahere.cc/*"],
getMangaList: function (search, callback) {
$.ajax({
url: "https://www.mangahere.cc/search.php?name=" + search,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success: function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse;
var res = [];
$(".result_search dl dt a:first-child", div).each(function (index) {
res[res.length] = [$(this).text().trim(), "https:" + $(this).attr("href")];
});
callback("Manga Here", res);
}
});
},
getListChaps: function (urlManga, mangaName, obj, callback) {
$.ajax({
url: urlManga,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success: function (objResponse) {
var div = document.createElement("div");
objResponse = objResponse.replace(/<img\b[^>]*>/ig, ''); //avoid loading cover image
div.innerHTML = objResponse;
var res = [];
$(".detail_list ul li span.left a", div).each(function (index) {
res[res.length] = [$(this).text().trim(), "https:" + $(this).attr("href")];
});
callback(res, obj);
}
});
},
getInformationsFromCurrentPage: function (doc, curUrl, callback) {
var name;
var currentChapter;
var currentMangaURL;
var currentChapterURL;
name = $($(".readpage_top .title a", doc)[1]).text().trim();
if (name.length >= 5 && name.substr(name.length - 5, 5) == "Manga") {
name = name.substr(0, name.length - 5).trim();
}
currentChapter = $($(".readpage_top .title a", doc)[0]).text();
currentChapterURL = "https:" + $($(".readpage_top .title a", doc)[0]).attr("href");
currentMangaURL = "https:" + $($(".readpage_top .title a", doc)[1]).attr("href");
callback({
"name": name,
"currentChapter": currentChapter,
"currentMangaURL": currentMangaURL,
"currentChapterURL": currentChapterURL
});
},
getListImages: function (doc, curUrl) {
var res = [];
$("select.wid60:first option", doc).each(function (index) {
if (!isNaN(parseFloat($(this).text()))) res[res.length] = "https:" + $(this).val();
});
return res;
},
whereDoIWriteScans: function (doc, curUrl) {
return $(".scanAMR", doc);
},
isCurrentPageAChapterPage: function (doc, curUrl) {
return ($("#image", doc).size() > 0);
},
doSomethingBeforeWritingScans: function (doc, curUrl) {
$("#viewer", doc).empty().append($("<div class='amrcontainer'></div>"));
$("#viewer", doc).css({
"margin": "0",
"text-align": "center",
"width": "100%"
});
$(".go_page.clearfix", doc).empty();
$("<div class='scanAMR widepage'></div>").appendTo($(".amrcontainer", doc));
},
getImageFromPageAndWrite: function (urlImg, image, doc, curUrl) {
$.ajax({
url: urlImg,
success: function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse;
var src = $("#image", div).attr("src");
$(image).attr("src", src);
}
});
},
doAfterMangaLoaded: function (doc, curUrl) {
$("body > div:empty", doc).remove();
var script = doc.createElement('script');
script.innerText = "Hotkeys.hotkeys.clear();";
doc.body.appendChild(script);
//$(".spanForImg").css("text-align", "left");
}
};
if (typeof registerMangaObject == 'function') {
registerMangaObject("Manga Here", MangaHere);
}
var MangaReader = {
mirrorName : "Manga Reader",
canListFullMangas : false,
canSearch: true,
mirrorIcon : "mangareader.png",
webSites: ["https://www.mangareader.net/*"],
languages : "en",
getMangaList : function (search, callback) {
var urlManga = "https://www.mangareader.net/search/?w=" + search + "&rd=0&status=0&order=0&genre=0000000000000000000000000000000000000&p=0";
$.ajax({
url : urlManga,
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
var res = [];
$(".manga_name a", div).each(function (index) {
res[res.length] = [$(this).text(), "https://www.mangareader.net" + $(this).attr("href")];
});
callback("Manga Reader", res);
}
});
},
getListChaps : function (urlManga, mangaName, obj, callback) {
if (urlManga.indexOf("http://") == 0) urlManga = "https://" + urlManga.substring(7);
$.ajax({
url : urlManga,
beforeSend : function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
var res = [];
var mangaName = $("#mangaproperties h1", div).text().replace("Manga", "").trim();
$("#chapterlist #listing tr td:first-child a", div).each(function (index) {
res[res.length] = [$(this).text().replace(mangaName, "").trim(), "https://www.mangareader.net" + $(this).attr("href")];
});
res = res.reverse();
callback(res, obj);
}
});
},
getInformationsFromCurrentPage : function (doc, curUrl, callback) {
var name = $($("#mangainfo h2.c2 a", doc)[0]).text().replace("Manga", "").trim();
var mangaurl = "https://www.mangareader.net" + $($("#mangainfo h2.c2 a", doc)[0]).attr("href");
var currentChapter = $("#mangainfo h1", doc).text().replace(name, "").trim();
var curChapUrl = "https://www.mangareader.net" + $($("#mangainfo_son a", doc)[0]).attr("href");
callback({
"name" : name,
"currentChapter" : currentChapter,
"currentMangaURL" : mangaurl,
"currentChapterURL" : curChapUrl
});
},
getListImages : function (doc, curUrl) {
res = [];
$("#pageMenu option", doc).each(function (index) {
res[res.length] = "https://www.mangareader.net" + $(this).val();
});
return res;
},
whereDoIWriteScans : function (doc, curUrl) {
return $("#inject-chap", doc);
},
isCurrentPageAChapterPage : function (doc, curUrl) {
return ($("img", $("#imgholder", doc)).size() !== 0);
},
doSomethingBeforeWritingScans : function (doc, curUrl) {
var imgholder = $("#imgholder", doc).closest("table");
var ws = $("<div id='inject-chap'></div>");
imgholder.before(ws);
imgholder.empty();
ws.css("width", "auto");
$("#selection", doc).next().remove();
$("#selection", doc).remove();
$("#navi", doc).empty();
$("#selectmanga", doc).empty();
$("#wrapper_body", doc).css("width", "auto");
$("#topchapter", doc).css("width", "950px");
$("#topchapter", doc).css("text-align", "center");
},
getImageFromPageAndWrite : function (urlImg, image, doc, curUrl) {
$.ajax({
url : urlImg,
success : function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse;
var src = $("#imgholder img", div).attr("src");
$(image).attr("src", src);
}
});
},
doAfterMangaLoaded : function (doc, curUrl) {
$("body > div:empty", doc).remove();
}
};
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("Manga Reader", MangaReader);
}
\ No newline at end of file
var MangaStream = {
mirrorName: "MangaStream",
canListFullMangas: true,
mirrorIcon: "mangastream.png",
languages: "en",
webSites: ["http://mangastream.com/*","http://readms.com/*","http://readms.net/*"],
getMangaList: function (search, callback) {
"use strict";
$.ajax({
url: "https://readms.net/manga",
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},
success: function (objResponse) {
var div = document.createElement("div"),
res = [];
div.innerHTML = objResponse.replace(/<img/gi, '<noload');
$('.table-striped strong a', div).each(function (index) {
res[index] = [$(this).text().trim(), "https://readms.net" + $(this).attr('href')];
});
callback("MangaStream", res);
}
});
},
getListChaps: function (urlManga, mangaName, obj, callback) {
"use strict";
$.ajax({
url: urlManga,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
},