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
/
wzs-init.js
167 lines (128 loc) · 4.16 KB
/
wzs-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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
(() => {
'use strict';
var script = () => {
'use strict';
var ublockFunc = (w=window) => {
const scriptName = 'wzs';
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];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
w.nodeName = nop;
w.limit = nop;
// Audio
{
const ctor = w.Audio;
class Audio{
constructor(...args){
const audio = new ctor(...args);
const methods = Object.create(null);
return new Proxy({}, {
get(t, k){
if(Object.hasOwnProperty.call(methods, k))
return methods[k];
let v = audio[k];
if(typeof v === 'function'){
v = v.bind(audio);
methods[k] = v;
return v;
}
return v;
},
set(t, k, v){
if(k === 'loop')
return 1;
audio[k] = v;
return 1;
},
});
}
}
w.Audio = Audio;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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();
})();
})();