-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_userscript.js
70 lines (64 loc) · 2.02 KB
/
_userscript.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
(() => {
function TrapDateToPartsFormatterFn(formatter) {
return new Proxy(formatter, {
apply(target, thisArg, args) {
args[1].pattern = args[1].pattern.replace("h:mm a", "HH:mm"); //change "11:00 PM" to "23:00" and "12:00 AM" to "00:00"
return Reflect.apply(target, thisArg, args);
},
});
}
function TrapKQqjExports(exports) {
return new Proxy(exports, {
defineProperty(target, propName, attributes) {
if (propName === "_dateToPartsFormatterFn") {
console.log(propName, attributes);
attributes.value = TrapDateToPartsFormatterFn(attributes.value);
}
return Reflect.defineProperty(target, propName, attributes);
},
});
}
function TrapKQqjModule(module) {
return new Proxy(module, {
defineProperty(target, propName, attributes) {
if (propName === "exports") {
console.log("trapped module exports");
attributes.value = TrapKQqjExports(attributes.value);
}
return Reflect.defineProperty(target, propName, attributes);
},
});
}
function TrapKQqj(KQqj) {
return new Proxy(KQqj, {
apply(target, thisArg, args) {
console.log("trapped module");
args[0] = TrapKQqjModule(args[0]);
return Reflect.apply(target, thisArg, args);
},
});
}
function TrapPush(push) {
return new Proxy(push, {
apply(target, thisArg, args) {
if (args[0][1].KQqj) {
console.log("trapped KQqj");
args[0][1].KQqj = TrapKQqj(args[0][1].KQqj);
}
return Reflect.apply(target, thisArg, args);
},
});
}
function TrapWebpackJsonp(target = []) {
return new Proxy(target, {
defineProperty(target, propName, attributes) {
if (propName === "push") {
console.log("trapped push");
attributes.value = TrapPush(attributes.value);
}
return Reflect.defineProperty(target, propName, attributes);
},
});
}
window.webpackJsonp = TrapWebpackJsonp([]);
})();