-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathset-popads-dummy.js
51 lines (47 loc) · 1.13 KB
/
set-popads-dummy.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
/* eslint-disable func-names, no-multi-assign */
import { hit } from '../helpers';
/**
* @scriptlet set-popads-dummy
*
* @description
* Sets static properties PopAds and popns.
*
* Related UBO scriptlet:
* https://github.com/gorhill/uBlock/wiki/Resources-Library#popads-dummyjs-
*
* ### Syntax
*
* ```adblock
* example.org#%#//scriptlet('set-popads-dummy')
* ```
*
* @added v1.0.4.
*/
export function setPopadsDummy(source) {
delete window.PopAds;
delete window.popns;
Object.defineProperties(window, {
PopAds: {
get: () => {
hit(source);
return {};
},
},
popns: {
get: () => {
hit(source);
return {};
},
},
});
}
export const setPopadsDummyNames = [
'set-popads-dummy',
// aliases are needed for matching the related scriptlet converted into our syntax
'popads-dummy.js',
'ubo-popads-dummy.js',
'ubo-popads-dummy',
];
// eslint-disable-next-line prefer-destructuring
setPopadsDummy.primaryName = setPopadsDummyNames[0];
setPopadsDummy.injections = [hit];