-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.js
28 lines (26 loc) · 861 Bytes
/
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
function popup() {
let taskName = document.getElementById("input-task-name").value;
let testFormat = document.getElementById("test-format").value;
chrome.tabs.query({ currentWindow: true, active: true }, (tabs) => {
chrome.tabs.sendMessage(
tabs[0].id,
{
message: "download start",
taskName: taskName,
testFormat: testFormat,
},
(response) => {
if (response === "received download start") {
alert(
`download for task "${taskName}" (${testFormat} format) has started, please wait...`
);
} else if (response == "test format not allowed") {
alert("test format not allowed, aborted.");
}
}
);
});
}
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("button").addEventListener("click", popup);
});