-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanner.js
37 lines (29 loc) · 975 Bytes
/
banner.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
const JES_SHELL = document.getElementById("jesShell");
function fillShell() {
get('https://localhost:8443/api/v1/jobs/MAS2BAC1/STC62065/files/103/content',
(response) => {
const jsonResponse = JSON.parse(response.responseText);
const data = jsonResponse.content;
const lines = data.split("\n");
clearShell();
lines.forEach((item, index) => {
addItemToJES(item);
});
});
}
function addItemToJES(text) {
const li = document.createElement("li");
li.appendChild(document.createTextNode(text));
JES_SHELL.appendChild(li);
}
function clearShell() {
while (JES_SHELL.firstChild) {
JES_SHELL.removeChild(JES_SHELL.firstChild);
}
}
fillShell();
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (!msg.displayConsole) {
JES_SHELL.hidden = !msg.displayConsole;
} else JES_SHELL.hidden = false;
});