-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.js
63 lines (56 loc) · 1.18 KB
/
window.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
(function (window) {
var title = 'Wanna use some java-script? Please, don\'t!';
window.alert = window.alert.bind(window, title);
var ignore = [
'alert', 'document'
];
function override(obj) {
for (var prop in obj) {
if (ignore.indexOf(prop) > -1) continue;
switch (typeof obj[prop]) {
case 'object':
override(prop);
break;
case 'string':
obj[prop] = title;
break;
case 'function':
obj[prop] = function () {
alert(title);
}
break;
case 'number':
obj[prop] = NaN;
break;
}
}
}
override(window);
window.console = {
log: alert,
assert: alert,
clear: alert,
constructor: alert,
count: alert,
debug: alert,
dir: alert,
dirxml: alert,
error: alert,
group: alert,
groupCollapsed: alert,
groupEnd: alert,
info: alert,
log: alert,
markTimeline: alert,
profile: alert,
profileEnd: alert,
table: alert,
time: alert,
timeEnd: alert,
timeStamp: alert,
timeline: alert,
timelineEnd: alert,
trace: alert,
warn: alert,
};
})(window);