-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptInject.js
More file actions
19 lines (17 loc) · 787 Bytes
/
Copy pathscriptInject.js
File metadata and controls
19 lines (17 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//on the message from the background script, start the process, the message is sent when the super slow file is loaded to the page
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.message === "injectScripts") {
//https://stackoverflow.com/questions/9515704/access-variables-and-functions-defined-in-page-context-using-a-content-script
let scriptarr=["utilFuncs.js","gui.js","tabs.js","autoUpdatePlan.js","pageLoad.js","remove.js"];
for (let i = 0; i < scriptarr.length; i++) {
var s = document.createElement('script');
s.src = chrome.runtime.getURL(scriptarr[i]);
s.onload = function() {
this.remove();
};
(document.head || document.documentElement).appendChild(s);
}
}
sendResponse({message: "done"});
});