This repository has been archived by the owner on Oct 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chromium-init.js
120 lines (90 loc) · 2.95 KB
/
chromium-init.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
(() => {
'use strict';
var script = () => {
'use strict';
var ublockFunc = (w=window) => {
const scriptName = 'chromium';
const wScriptProp = `ublock-${scriptName}-init.js`;
if(w[wScriptProp]) return;
w[wScriptProp] = true;
main();
function main(){
const log = (w.console_ || console).log;
var symbol = Symbol('ublock');
var toPrim = () => '1';
var nopf = function(){};
var nop = proxify(nopf, {
getPrototypeOf(){ return null; },
setPrototypeOf(){ return nop; },
isExtensible(){ return false; },
preventExtensions(){ return nop; },
getOwnPropertyDescriptor(t, prop){
if(prop === 'prototype')
return Object.getOwnPropertyDescriptor(t, prop);
return {
writable: false,
configurable: true,
};
},
defineProperty(){ return nop; },
has(){ return nop; },
get(t, prop){
if(prop === Symbol.toPrimitive) return toPrim;
return nop;
},
set(){ return true; },
deleteProperty(){ return nop; },
ownKeys(){ return ['prototype']; },
apply(){ return nop; },
construct(){ return nop; },
});
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(w === top){
const f = () => {
if(!('_shadows' in w))
return setTimeout(f);
for(const e of qsa('video[controls]'))
e.removeAttribute('controls');
setTimeout(f, 1e3);
};
f();
}
function qsa(a){
const set = new Set();
for(const e of document.querySelectorAll(a))
set.add(e);
for(const sr of w._shadows)
for(const e of sr.querySelectorAll(a))
set.add(e);
return set;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function proxify(obj, prop, traps=null){
var b = traps !== null;
var proxy, t;
if(b){
t = obj[prop];
}else{
t = obj;
traps = prop;
}
proxy = new w.Proxy(t, traps);
proxy[symbol] = `${t}`;
if(b){
obj[prop] = proxy;
}
return proxy;
}
}
};
ublockFunc();
};
var code = `(${script})();`;
var elem = document.documentElement;
(() => {
const script = document.createElement('script');
script.textContent = code;
document.documentElement.appendChild(script);
script.remove();
})();
})();