|
| 1 | +function uuidv4() { |
| 2 | + let h = new Date().getTime(); |
| 3 | + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (i) { |
| 4 | + let F = (h + 16 * Math.random()) % 16 | 0; |
| 5 | + h = Math.floor(h / 16); |
| 6 | + return (i == "x" ? F : (3 & F) | 8).toString(16); |
| 7 | + }); |
| 8 | +} |
| 9 | + |
1 | 10 | (function () {
|
2 | 11 | "use strict";
|
3 | 12 | (function () {
|
|
17 | 26 | return code.slice(code.indexOf("{") + 1, code.lastIndexOf("}")) || "";
|
18 | 27 | })(code),
|
19 | 28 | fnParams = (function (code) {
|
20 |
| - let i = code.replace(b, ""), |
| 29 | + let i = code.replace(commentRegex, ""), |
21 | 30 | F = i.slice(i.indexOf("(") + 1, i.indexOf(")")).match(s);
|
22 | 31 | return F === null && (F = []), F;
|
23 | 32 | })(code),
|
24 |
| - uuid = |
25 |
| - "id_" + |
26 |
| - (function () { |
27 |
| - let h = new Date().getTime(); |
28 |
| - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( |
29 |
| - /[xy]/g, |
30 |
| - function (i) { |
31 |
| - var F = (h + 16 * Math.random()) % 16 | 0; |
32 |
| - return ( |
33 |
| - (h = Math.floor(h / 16)), |
34 |
| - (i == "x" ? F : (3 & F) | 8).toString(16) |
35 |
| - ); |
36 |
| - } |
37 |
| - ); |
38 |
| - })(); |
| 33 | + uuid = "id_" + uuidv4(); |
39 | 34 | let y = `window['__fnCache']["${uuid}"]= function(${fnParams}){${fnBody}}`,
|
40 | 35 | c = document.createElement("script");
|
41 | 36 | try {
|
|
48 | 43 | return v.appendChild(c), v.removeChild(c), window.__fnCache[`${uuid}`];
|
49 | 44 | }
|
50 | 45 | window.__fnCache = window.__fnCache || {};
|
51 |
| - let b = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, |
| 46 | + let commentRegex = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, |
52 | 47 | s = /([^\s,]+)/g;
|
53 | 48 | function m(r, f, u = !1) {
|
54 | 49 | const w = f.split(/\.|\[(\d+)\]/).filter(Boolean);
|
|
66 | 61 | w = {},
|
67 | 62 | y = {},
|
68 | 63 | c = {};
|
69 |
| - let v = window.__d; |
| 64 | + let modified__d = window.__d; |
70 | 65 | window.__d &&
|
71 |
| - (~v.toString().indexOf("__d_stub") |
| 66 | + (~modified__d.toString().indexOf("__d_stub") |
72 | 67 | ? delete window.__d
|
73 |
| - : (v = new Proxy(window.__d, { |
| 68 | + : (modified__d = new Proxy(window.__d, { |
74 | 69 | apply: (e, t, d) => ((d = i(d)), e.apply(t, d)),
|
75 | 70 | }))),
|
76 | 71 | Object.defineProperty(window, "__d", {
|
77 | 72 | get: function () {
|
78 |
| - return v; |
| 73 | + return modified__d; |
79 | 74 | },
|
80 | 75 | set: function (e) {
|
81 |
| - v = new Proxy(e, { |
| 76 | + modified__d = new Proxy(e, { |
82 | 77 | apply: (t, d, p) => ((p = i(p)), t.apply(d, p)),
|
83 | 78 | });
|
84 | 79 | },
|
|
0 commit comments