-
Notifications
You must be signed in to change notification settings - Fork 5
/
script.js
143 lines (133 loc) · 3.76 KB
/
script.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
const BASE_URL = "https://guya.moe";
const FS_URL = "https://guya.moe/fs";
const MB_URL = "https://guya.moe/mb";
const HT_URL = "https://guya.moe/ht";
const ctx = chrome || browser;
const allowed_url_list = [
"mangadex.org/title",
"mangadex.org/manga",
"mangadex.org/chapter",
"nhentai.net/g",
"imgur.com/a",
"readmanhwa.com/en/webtoon",
"toonily.com/webtoon",
];
const tachiyomi_foolslide_list = [
// %%FOOLSLIDE START%%
"ajianoscantrad.fr",
"deathtollscans.net",
"evilflowers.com",
"faworeader.altervista.org",
"gtothegreatsite.net",
"helveticascans.com",
"hentai.cafe",
"hni-scantrad.com/eng/lel/",
"hni-scantrad.com/lel/",
"jaiminisbox.com",
"kireicake.com",
"kirishimafansub.net",
"kobato.hologfx.com",
"leitura.baixarhentai.net",
"lupiteam.net",
"mabushimajo.com",
"mangascouts.org",
"mangatellers.gr",
"maryfaye.net",
"midnighthaven.shounen-ai.net",
"motokare.xyz",
"otscans.com",
"phantomreader.com",
"ramareader.it",
"read-nifteam.info",
"readedenszero.com",
"reader.powermanga.org",
"reader.silentsky-scans.net",
"reader2.thecatscans.com",
"rusmanga.ru",
"sensescans.com",
"smuglo.li",
"storm-in-heaven.net",
"tortuga-ceviri.com",
"tuttoanimemanga.net",
"yuri-ism.net/slide",
"zandynofansub.aishiteru.org",
// %%FOOLSLIDE END%%
];
// This is more for entries that one might want to keep regardless of what is on tachi, because
// the scraper will erase any entry when updating.
const override_foolslide_list = [];
// This list is for Mangabox and proxy sites
const mangabox_url_list = ["manganelo.com", "mangakakalot.com"];
// This list is for Hitomi and proxy sites
const hitomi_url_list = ["hitomi.la"];
let updateIcon = (tabId) => {
ctx.tabs.get(tabId, (tab) => {
if (!ctx.runtime.lastError) {
try {
if (
allowed_url_list.some((allowed_url) =>
tab.url.includes(allowed_url)
) ||
tachiyomi_foolslide_list.some((allowed_url) =>
tab.url.includes(allowed_url)
) ||
override_foolslide_list.some((allowed_url) =>
tab.url.includes(allowed_url)
) ||
mangabox_url_list.some((allowed_url) =>
tab.url.includes(allowed_url)
) ||
hitomi_url_list.some((allowed_url) => tab.url.includes(allowed_url))
) {
ctx.browserAction.setIcon({ path: "logo_small.png" });
} else {
ctx.browserAction.setIcon({ path: "logo_small_bw.png" });
}
} catch (e) {
ctx.browserAction.setIcon({ path: "logo_small_bw.png" });
}
}
});
};
ctx.browserAction.onClicked.addListener((tab) => {
if (allowed_url_list.some((allowed_url) => tab.url.includes(allowed_url))) {
ctx.tabs.executeScript({
code: `
window.location.href = "${BASE_URL}" + document.location.pathname;
`,
});
} else if (
tachiyomi_foolslide_list.some((allowed_url) =>
tab.url.includes(allowed_url)
) ||
override_foolslide_list.some((allowed_url) => tab.url.includes(allowed_url))
) {
ctx.tabs.executeScript({
code: `
window.location.href = "${FS_URL}" + "/" + document.location.href;
`,
});
} else if (
mangabox_url_list.some((allowed_url) => tab.url.includes(allowed_url))
) {
ctx.tabs.executeScript({
code: `
window.location.href = "${MB_URL}" + "/" + document.location.href;
`,
});
} else if (
hitomi_url_list.some((allowed_url) => tab.url.includes(allowed_url))
) {
ctx.tabs.executeScript({
code: `
window.location.href = "${HT_URL}" + "/" + document.location.href;
`,
});
}
});
ctx.tabs.onUpdated.addListener((tabId) => {
updateIcon(tabId);
});
ctx.tabs.onActivated.addListener((info) => {
updateIcon(info.tabId);
});