-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
28 lines (25 loc) · 882 Bytes
/
content.js
File metadata and controls
28 lines (25 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let currentBrowser;
if (navigator.userAgent.indexOf("Chrome") !== -1) {
currentBrowser = chrome;
} else {
currentBrowser = browser;
}
document.addEventListener("loadMath", function (e) {
const { isSpreadsheet } = e.detail;
if (isSpreadsheet) {
const scriptEl = document.createElement("script");
const url = currentBrowser.runtime.getURL("spreadsheet_math.js");
scriptEl.src = url;
(document.head || document.documentElement).appendChild(scriptEl);
scriptEl.onload = function () {
scriptEl.parentNode.removeChild(scriptEl);
};
}
});
const scriptEl3 = document.createElement("script");
const url3 = currentBrowser.runtime.getURL("load_math.js");
scriptEl3.src = url3;
(document.head || document.documentElement).appendChild(scriptEl3);
scriptEl3.onload = function () {
scriptEl3.parentNode.removeChild(scriptEl3);
};