-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathAnimeA.js
127 lines (127 loc) · 4.9 KB
/
AnimeA.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
127
var AnimeA = {
mirrorName: "AnimeA",
canListFullMangas: false,
mirrorIcon: "img/animea.png",
languages: "en",
isMe: function (url) {
return (url.indexOf("manga.animea.net/") !== -1);
},
getMangaList: function (search, callback) {
$.ajax({
url: "http://manga.animea.net/browse.html?input=Search&title=" + search,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
xhr.setRequestHeader("X-Set-Cookie", "skip=1");
xhr.withCredentials = true;
},
success: function (objResponse) {
var div = document.createElement("div"),
res = [];
div.innerHTML = objResponse.replace(/<img/g, '<noload');
$(".mangalisttext a", div).each(function () {
res[res.length] = [$(this).text(), "http://manga.animea.net" + $(this).attr("href")];
});
callback("AnimeA", res);
}
});
},
getListChaps: function (urlManga, mangaName, obj, callback) {
$.ajax({
url: urlManga,
beforeSend: function (xhr) {
xhr.setRequestHeader("Cache-Control", "no-cache");
xhr.setRequestHeader("Pragma", "no-cache");
xhr.setRequestHeader("X-Set-Cookie", "skip=1");
xhr.withCredentials = true;
},
success: function (objResponse) {
var div = document.createElement("div");
div.innerHTML = objResponse.replace(/<img/g, '<noload');
var res = [];
$("ul.chapterlistfull li > a", div).each(function () {
res[res.length] = [$(this).text(), "http://manga.animea.net" + $(this).attr("href")];
});
callback(res, obj);
}
});
},
getInformationsFromCurrentPage: function (doc, curUrl, callback) {
var name = $(".description h1 a", doc).text(),
currentMangaURL = "http://manga.animea.net" + $(".description h1 a", doc).attr("href"),
chapter = $('.description h1', doc).text(),
currentChapter = chapter.replace(/Page.*/,'').trim(),
currentChapterURL = "http://manga.animea.net/" + $('.scan a', doc).attr('href').replace(/-page.*/, '') + '.html';
callback({
"name": name,
"currentChapter": currentChapter,
"currentMangaURL": currentMangaURL,
"currentChapterURL": currentChapterURL
});
},
getListImages: function (doc, curUrl) {
var ref = curUrl;
var pos = ref.search(/.html|-page/g);
ref = ref.substr(0, pos) + "-page-";
var res = [];
$("select.mangaselecter.pageselect option", doc).each(function (index) {
res[index] = ref + $(this).val() + ".html";
});
return res;
},
removeBanners: function (doc, curUrl) {
$("iframe", doc).remove();
$(".ads300", doc).remove();
},
whereDoIWriteScans: function (doc, curUrl) {
return $(".h_contentmp", doc);
},
whereDoIWriteNavigation: function (doc, curUrl) {
return $(".navAMR", doc);
},
isCurrentPageAChapterPage: function (doc, curUrl) {
return ($("img.scanmr", doc).size() > 0);
},
doSomethingBeforeWritingScans: function (doc, curUrl) {
$(".hca", doc).remove();
$(".h_contentmp", doc).empty();
$(".h_contentmp", doc).before($("<div>").addClass("navAMR"));
$(".h_contentmp", doc).after($("<div>").addClass("navAMR"));
},
nextChapterUrl: function (select, doc, curUrl) {
if ($(select).children("option:selected").prev().size() !== 0) {
return $(select).children("option:selected").prev().val();
}
return null;
},
previousChapterUrl: function (select, doc, curUrl) {
if ($(select).children("option:selected").next().size() !== 0) {
return $(select).children("option:selected").next().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 = $("img.scanmr", div).attr("src");
$(image).attr("src", src);
}
});
},
isImageInOneCol: function (img, doc, curUrl) {
return false;
},
getMangaSelectFromPage: function (doc, curUrl) {
return null;
},
doAfterMangaLoaded: function (doc, curUrl) {
$("body > div:empty", doc).remove();
}
};
// Call registerMangaObject to be known by includer
if (typeof registerMangaObject == 'function') {
registerMangaObject("AnimeA", AnimeA);
}