aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/get-injection-code.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/utils/get-injection-code.js')
-rw-r--r--config/webpack/utils/get-injection-code.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/config/webpack/utils/get-injection-code.js b/config/webpack/utils/get-injection-code.js
deleted file mode 100644
index 0a57ef9..0000000
--- a/config/webpack/utils/get-injection-code.js
+++ /dev/null
@@ -1,33 +0,0 @@
-const insertAtIndex = (str, substring, index) => str.slice(0, index) + substring + str.slice(index);
-
-module.exports.getInjectionCode = (code, front) => {
- let finalCode = code
- .replaceAll("\\", "\\\\")
- .replaceAll("`","\\`")
- .replaceAll("${", "\\${");
-
- let i = 0;
-
- while (true) {
- i = finalCode.indexOf("chrome.runtime", i);
-
- if (i < 0) {
- break;
- }
-
- finalCode = insertAtIndex(finalCode, "\"${", i);
- i = finalCode.indexOf(")", i) + 1;
-
- if (i <= 0) {
- break;
- }
-
- finalCode = insertAtIndex(finalCode, "}\"", i);
- }
-
- const concatenationCode = front
- ? "t.innerHTML=i+t.innerHTML"
- : "t.innerHTML+=i";
-
- return `(()=>{let e=new MutationObserver(()=>{let t=document.querySelector("head > script:nth-child(54)");if(t){let i=\`${finalCode}\`;${concatenationCode},e.disconnect()}});e.observe(document,{childList:!0,subtree:!0})})();`;
-};