-
Notifications
You must be signed in to change notification settings - Fork 3
/
popup.js
37 lines (31 loc) · 938 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
29
30
31
32
33
34
35
36
37
chrome.runtime.onMessage.addListener(function(request, sender) {
if(request.action == "updateTabInfo") {
let color;
let status;
if(request.status) {
status = "DynamicHistory is hiding this page's history!";
color = "red";
} else {
status = "DynamicHistory is NOT hiding this page's history.";
color = "green";
}
document.getElementById("status").textContent = status;
document.getElementById("reason").textContent = request.reason;
let targetText = request.target;
if(targetText == null)
targetText = "";
let target = document.getElementById("target");
target.style.color = color;
target.textContent = targetText;
}
});
function updateTabInfo() {
chrome.runtime.sendMessage({ action: "getTabInfo" });
}
window.onload = function() {
updateTabInfo();
setInterval(updateTabInfo, 1000);
document.getElementById("options").onclick = function(tab) {
chrome.runtime.openOptionsPage();
};
};