-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
25 lines (23 loc) · 834 Bytes
/
popup.js
File metadata and controls
25 lines (23 loc) · 834 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
document.addEventListener("DOMContentLoaded", () => {
console.log("[Popup] Loaded");
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
if (!tabs[0]) {
document.getElementById("safetyStatus").textContent = "No active tab.";
return;
}
chrome.tabs.sendMessage(
tabs[0].id,
{ action: "getSafetyStatus" },
(response) => {
if (chrome.runtime.lastError || !response) {
console.warn("[Popup] Message failed:", chrome.runtime.lastError);
document.getElementById("safetyStatus").textContent =
"Unable to get status.";
} else {
console.log("[Popup] Received response:", response);
document.getElementById("safetyStatus").textContent = response.safety;
}
}
);
});
});