-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.js
68 lines (67 loc) · 2.59 KB
/
popup.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
let session;
const isFake=()=>{
return false;
}
async function targetWebSitePreWork(){
let script = document.createElement("script");
script.src = chrome.runtime.getURL('ortScript.js');
script.onload = async function () {
console.log("ortScript onload");
let script = document.createElement("script");
script.src = chrome.runtime.getURL('min.js');
script.onload = async function () {
console.log("min onload");
let script = document.createElement("script");
script.src = chrome.runtime.getURL('image-loader.js');
script.onload = async function () {
console.log("image-loader onload");
let script = document.createElement("script");
script.src = chrome.runtime.getURL('ndarray-browser-min.js');
script.onload = async function () {
console.log("ndarray-browser-min onload");
let script = document.createElement("script");
script.src = chrome.runtime.getURL('imagenet.js');
script.onload = async function () {
console.log("imagenet onload");
};
document.documentElement.firstChild.appendChild(script);
};
document.documentElement.firstChild.appendChild(script);
};
document.documentElement.firstChild.appendChild(script);
};
document.documentElement.firstChild.appendChild(script);
};
document.documentElement.firstChild.appendChild(script);
}
async function prework(){
let startBut = document.getElementById("StartButton");
startBut.style.backgroundColor = 'black';
try{
let [tab] = await chrome.tabs.query({active: true, currentWindow: true});
chrome.scripting.executeScript({
target:{ tabId: tab.id},
function: targetWebSitePreWork
})
startBut.addEventListener("click", async()=>{
// chrome.storage.sync.set({ort:res});
let [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
chrome.scripting.executeScript({
target: { tabId: tab.id },
function: main
});
});
}
catch(e){
console.log(e);
}
}
prework();
async function main(){
var script = document.createElement("script");
script.src = chrome.runtime.getURL('run.js');
script.onload = async function () {
console.log("run onload");
};
document.documentElement.firstChild.appendChild(script);
}