-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathprevent-fab-3.2.0.js
104 lines (96 loc) · 2.86 KB
/
prevent-fab-3.2.0.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
/* eslint-disable func-names, no-multi-assign */
import { hit, noopFunc, noopThis } from '../helpers';
/**
* @scriptlet prevent-fab-3.2.0
*
* @description
* Prevents execution of the FAB script v3.2.0.
*
* Related UBO scriptlet:
* https://github.com/gorhill/uBlock/wiki/Resources-Library#fuckadblockjs-320-
*
* ### Syntax
*
* ```adblock
* example.org#%#//scriptlet('prevent-fab-3.2.0')
* ```
*
* @added v1.0.4.
*/
export function preventFab(source) {
hit(source);
// redefines Fab function for adblock detection
const Fab = function () {};
Fab.prototype.check = noopFunc;
Fab.prototype.clearEvent = noopFunc;
Fab.prototype.emitEvent = noopFunc;
Fab.prototype.on = function (a, b) {
if (!a) {
b();
}
return this;
};
Fab.prototype.onDetected = noopThis;
Fab.prototype.onNotDetected = function (a) {
a();
return this;
};
Fab.prototype.setOption = noopFunc;
Fab.prototype.options = {
set: noopFunc,
get: noopFunc,
};
const fab = new Fab();
const getSetFab = {
get() { return Fab; },
set() {},
};
const getsetfab = {
get() { return fab; },
set() {},
};
// redefined Fab data properties which if 'FuckAdBlock' variable exists
if (Object.prototype.hasOwnProperty.call(window, 'FuckAdBlock')) {
window.FuckAdBlock = Fab;
} else {
// or redefined Fab accessor properties
Object.defineProperty(window, 'FuckAdBlock', getSetFab);
}
if (Object.prototype.hasOwnProperty.call(window, 'BlockAdBlock')) {
window.BlockAdBlock = Fab;
} else {
Object.defineProperty(window, 'BlockAdBlock', getSetFab);
}
if (Object.prototype.hasOwnProperty.call(window, 'SniffAdBlock')) {
window.SniffAdBlock = Fab;
} else {
Object.defineProperty(window, 'SniffAdBlock', getSetFab);
}
if (Object.prototype.hasOwnProperty.call(window, 'fuckAdBlock')) {
window.fuckAdBlock = fab;
} else {
Object.defineProperty(window, 'fuckAdBlock', getsetfab);
}
if (Object.prototype.hasOwnProperty.call(window, 'blockAdBlock')) {
window.blockAdBlock = fab;
} else {
Object.defineProperty(window, 'blockAdBlock', getsetfab);
}
if (Object.prototype.hasOwnProperty.call(window, 'sniffAdBlock')) {
window.sniffAdBlock = fab;
} else {
Object.defineProperty(window, 'sniffAdBlock', getsetfab);
}
}
export const preventFabNames = [
'prevent-fab-3.2.0',
// aliases are needed for matching the related scriptlet converted into our syntax
'nofab.js',
'ubo-nofab.js',
'fuckadblock.js-3.2.0',
'ubo-fuckadblock.js-3.2.0',
'ubo-nofab',
];
// eslint-disable-next-line prefer-destructuring
preventFab.primaryName = preventFabNames[0];
preventFab.injections = [hit, noopFunc, noopThis];