-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrp5adfix.user.js
101 lines (98 loc) · 3.93 KB
/
rp5adfix.user.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
// ==UserScript==
// @name RP5 AdBlock Fix
// @namespace rp5 adblock fix
// @description breaks RP5 anti-ablock features
// @description:ru ломает защиту от блокировки рекламы на сайтах RP5
// @description:ua ломает защиту от блокировки рекламы на сайтах RP5
// @description:kz ломает защиту от блокировки рекламы на сайтах RP5
// @match https://rp5.ru/*
// @match https://m.rp5.ru/*
// @match https://rp5.ua/*
// @match https://m.rp5.ua/*
// @match https://rp5.by/*
// @match https://m.rp5.by/*
// @match https://rp5.kz/*
// @match https://m.rp5.kz/*
// @match https://rp5.co.uk/*
// @match https://m.rp5.co.uk/*
// @match http://rp5.ru/*
// @match http://m.rp5.ru/*
// @match http://rp5.ua/*
// @match http://m.rp5.ua/*
// @match http://rp5.by/*
// @match http://m.rp5.by/*
// @match http://rp5.kz/*
// @match http://m.rp5.kz/*
// @match http://rp5.co.uk/*
// @match http://m.rp5.co.uk/*
// @run-at document-end
// @author StSav012
// @homepageURL /~https://github.com/StSav012/adblockrules/blob/master/rp5adfix.user.js
// @downloadURL /~https://github.com/StSav012/adblockrules/raw/master/rp5adfix.user.js
// @version 25
// ==/UserScript==
"use strict";
var actualCode = '(' + function() {
"use strict";
var ss = window.document.querySelectorAll("script[src][onerror]");
for (var s in Array.from(ss)) {
var e = ss[s].attributes.onerror.value.trim();
if (e.indexOf(' ') === -1) {
while (e.length > 0) {
if (window.hasOwnProperty(e)
&& typeof window[e] === 'function') {
window[e] = function() {};
break;
}
else {
e = e.slice(0, -1);
}
}
}
}
for (var l in window) {
if (window.hasOwnProperty(l)
&& window[l]
&& typeof window[l] === 'object') {
if (window[l].constructor === Object
&& window[l].toString().indexOf('.removeAttr(') !== -1) {
for (f in window[l]) {
if (typeof window[l][f] === 'function') {
if (window[l][f].toString().indexOf('return') !== -1) {
window[l][f] = function() {return 0;};
}
else {
window[l][f] = function() {};
}
}
}
}
else if (window[l].constructor === Array) {
if (window[l].length == 2
&& window[l][1] === 'document') {
window.document[window[l][0]] = undefined;
}
else if (window[l].toString().includes("txt.rp5.")) {
for (var i of window[l]) {
if (i.endsWith("()")) {
var j = i.replace(/\(\)$/, "");
if (typeof window[j] === "function") {
var k = window[j].toString();
if (! k.includes(";") && ! k.includes("=")) {
window[j] = function() {};
}
}
}
}
}
}
}
}
var bannerBottom = document.getElementById("banner-bottom");
if (bannerBottom) {
bannerBottom.parentElement.removeChild(bannerBottom);
}
} + ')();';
var script = document.createElement('script');
script.textContent = actualCode;
(document.body||document.documentElement).appendChild(script);