| 24 | return [moduleName, extensionId]; |
| 25 | } |
| 26 | function cacheFunction(code) { |
| 27 | const fnBody = (function (code) { |
| 28 | return code.slice(code.indexOf("{") + 1, code.lastIndexOf("}")) || ""; |
| 29 | })(code), |
| 30 | fnParams = (function (code) { |
| 31 | let i = code.replace(commentRegex, ""), |
| 32 | F = i.slice(i.indexOf("(") + 1, i.indexOf(")")).match(s); |
| 33 | return F === null && (F = []), F; |
| 34 | })(code), |
| 35 | uuid = "id_" + make_uuid(); |
| 36 | let y = `window['__fnCache']["${uuid}"]= function(${fnParams}){${fnBody}}`, |
| 37 | c = document.createElement("script"); |
| 38 | try { |
| 39 | c.appendChild(document.createTextNode(y)); |
| 40 | } catch { |
| 41 | c.text = y; |
| 42 | } |
| 43 | let v = |
| 44 | document.getElementsByTagName("head")[0] || document.documentElement; |
| 45 | return v.appendChild(c), v.removeChild(c), window.__fnCache[`${uuid}`]; |
| 46 | } |
| 47 | window.__fnCache = window.__fnCache || {}; |
| 48 | let commentRegex = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, |
| 49 | s = /([^\s,]+)/g; |