Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing MangaHere #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions MangaHere.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var MangaHere = {
//This function must call callback("Mirror name", [returned list]);
getMangaList: function (search, callback) {
$.ajax({
url: "http://www.mangahere.co/search.php?name=" + search,
url: "https://www.mangahere.co/search.php?name=" + search,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
Expand All @@ -27,7 +27,8 @@ var MangaHere = {
div.innerHTML = objResponse;
var res = [];
$(".result_search dl dt a:first-child", div).each(function (index) {
res[res.length] = [$(this).text().trim(), $(this).attr("href")];
url = this.href.replace("chrome-extension", "https")
res[res.length] = [$(this).text().trim(), url];
});
callback("Manga Here", res);
}
Expand All @@ -50,7 +51,8 @@ var MangaHere = {
div.innerHTML = objResponse;
var res = [];
$(".detail_list ul li span.left a", div).each(function (index) {
res[res.length] = [$(this).text().trim(), $(this).attr("href")];
url = this.href.replace("chrome-extension", "https")
res[res.length] = [$(this).text().trim(), url];
});
callback(res, obj);
}
Expand All @@ -72,9 +74,9 @@ var MangaHere = {
name = name.substr(0, name.length - 5).trim();
}
currentChapter = $($(".readpage_top .title a", doc)[0]).text();
currentChapterURL = $($(".readpage_top .title a", doc)[0]).attr("href");
console.log(currentChapterURL);
currentMangaURL = $($(".readpage_top .title a", doc)[1]).attr("href");
currentChapterURL = $(".readpage_top .title a", doc)[0].href.replace("chrome-extension", "https");
console.log(currentChapterURL);
currentMangaURL = $(".readpage_top .title a", doc)[1].href.replace("chrome-extension", "https");
callback({
"name": name,
"currentChapter": currentChapter,
Expand All @@ -89,7 +91,7 @@ var MangaHere = {
//This function runs in the DOM of the current consulted page.
var res = [];
$("select.wid60:first option", doc).each(function (index) {
res[res.length] = $(this).val();
res[res.length] = "https:" + $(this).val();
});
return res;
},
Expand Down Expand Up @@ -119,9 +121,9 @@ var MangaHere = {
//This method is called before displaying full chapters in the page
doSomethingBeforeWritingScans: function (doc, curUrl) {
//This function runs in the DOM of the current consulted page.
$("#viewer", doc).empty().append($("<div class='amrcontainer'></div>"));
$(".go_page.clearfix", doc).empty();
$("<div class='navAMR widepage'></div>").appendTo($(".amrcontainer", doc));
$("#viewer", doc).empty().append($("<div class='amrcontainer'></div>"));
$(".go_page.clearfix", doc).empty();
$("<div class='navAMR widepage'></div>").appendTo($(".amrcontainer", doc));
$("<div class='scanAMR widepage'></div>").appendTo($(".amrcontainer", doc));
$("<div class='navAMR widepage'></div>").appendTo($(".amrcontainer", doc));
},
Expand Down Expand Up @@ -176,13 +178,13 @@ var MangaHere = {
doAfterMangaLoaded: function (doc, curUrl) {
//This function runs in the DOM of the current consulted page.
$("body > div:empty", doc).remove();
var script = doc.createElement('script');
var script = doc.createElement('script');
script.innerText = "Hotkeys.hotkeys.clear();";
doc.body.appendChild(script);
$(".spanForImg").css("text-align", "left");
$(".spanForImg").css("text-align", "left");
}
};
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("Manga Here", MangaHere);
registerMangaObject("Manga Here", MangaHere);
}