From 0f8593da3e75b8d44399c5f04edf000555b7406a Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Thu, 6 Apr 2023 22:17:13 +0530 Subject: Now downloading plot information pdf as well. --- config/webpack/utils/get-injection-code.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'config/webpack/utils') diff --git a/config/webpack/utils/get-injection-code.js b/config/webpack/utils/get-injection-code.js index ec969c1..0a57ef9 100644 --- a/config/webpack/utils/get-injection-code.js +++ b/config/webpack/utils/get-injection-code.js @@ -1,9 +1,30 @@ +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"; -- cgit v1.2.3