-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGoodManga.js
126 lines (126 loc) · 5.01 KB
/
GoodManga.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
var GoodManga = {
mirrorName : "GoodManga",
canListFullMangas : false,
mirrorIcon : "img/goodmanga.png",
languages : "en",
isMe : function (url) {
return (url.indexOf("www.goodmanga.net/") != -1);
},
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 h1 a", doc).text();
var nameurl = $("#content #manga_head h1 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,
"currentChapter" : curChapName,
"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;
},
removeBanners : function (doc, curUrl) {
$("#mv_ad_top", doc).remove();
$("#mv_ad_bottom", doc).remove();
},
whereDoIWriteScans : function (doc, curUrl) {
return $("#manga_viewer", doc);
},
whereDoIWriteNavigation : function (doc, curUrl) {
return $(".navAMR", 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();
$("#manga_viewer", doc).before("<div class='navAMR'></div>");
$("#manga_viewer", doc).after("<div class='navAMR'></div>");
$(".navAMR", doc).css("text-align", "center");
$("#content", doc).css("background-color", "black");
$("#manga_viewer", doc).css("padding-top", "10px");
},
nextChapterUrl : function (select, doc, curUrl) {
if ($(select).children("option:selected").next().size() != 0) {
return $(select).children("option:selected").next().val();
}
return null;
},
previousChapterUrl : function (select, doc, curUrl) {
if ($(select).children("option:selected").prev().size() != 0) {
return $(select).children("option:selected").prev().val();
}
return null;
},
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);
}
});
},
isImageInOneCol : function (img, doc, curUrl) {
return false;
},
getMangaSelectFromPage : function (doc, curUrl) {
$("select#bottom_chapter_list:first option", doc).each(function (index) {
$(this).val("http://www.goodmanga.net" + $(this).val());
});
return $("select.chapter_select:first", doc);
},
doAfterMangaLoaded : function (doc, curUrl) {
$("body > div:empty", doc).remove();
}
}
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("GoodManga", GoodManga);
}