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
/
blank-init.js
127 lines (97 loc) · 3.09 KB
/
blank-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
121
122
123
124
125
126
127
(() => {
'use strict';
var script = () => {
'use strict';
var ublockFunc = (w=window) => {
const scriptName = 'blank';
const wScriptProp = `ublock-${scriptName}-init.js`;
if(w[wScriptProp]) return;
w[wScriptProp] = 1;
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; },
});
const url = location.href.match(/^[^\/]+?\:\/{2,3}(.+)/)[1];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Code goes here
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function show(e){
e.classList.add('ublock-safe');
}
function qs(a, b=null){
if(b === null){
b = a;
a = document;
}
return a.querySelector(b);
}
function qsa(a, b=null){
if(b === null){
b = a;
a = document;
}
return a.querySelectorAll(b);
}
function decode(str){
return str.split('').
map(a => a.charCodeAt(0) - 32).
map(a => 94 - a).
map(a => String.fromCharCode(32 + a)).
join('');
}
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();
})();
})();