-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
25 lines (23 loc) · 912 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
// Function to format the timestamp
function formatTimestamp(timestamp) {
const date = new Date(timestamp);
return date.toLocaleString();
}
// Function to update popup with stored request details
chrome.storage.local.get("requestDetails", function (data) {
if (data.requestDetails) {
const details = data.requestDetails;
document.getElementById("requestUrl").textContent = details.url;
document.getElementById("requestTime").textContent = formatTimestamp(
details.timeStamp
);
// Assuming you want to display an image
// This example just uses the URL if it happens to be an image
if (details.url.match(/\.(jpeg|jpg|gif|png)$/) != null) {
document.getElementById("requestImage").src = details.url;
}
} else {
document.getElementById("requestUrl").textContent = "No details available";
document.getElementById("requestTime").textContent = "";
}
});