Filter popup
This commit is contained in:
21
popup.js
21
popup.js
@@ -128,32 +128,21 @@ function buildRow(entry) {
|
||||
}
|
||||
|
||||
async function loadCapturedUrls() {
|
||||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
const activeTab = tabs[0];
|
||||
|
||||
if (!activeTab || typeof activeTab.id !== "number") {
|
||||
setStatus("No active tab found.");
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await browser.runtime.sendMessage({
|
||||
type: "GET_TAB_URLS",
|
||||
tabId: activeTab.id
|
||||
});
|
||||
const response = await browser.runtime.sendMessage({ type: "GET_HISTORY" });
|
||||
|
||||
if (!response || !response.ok) {
|
||||
setStatus("Unable to load captured URLs.");
|
||||
setStatus("Unable to load captured samples.");
|
||||
return;
|
||||
}
|
||||
|
||||
listEl.innerHTML = "";
|
||||
const entries = Array.isArray(response.entries) ? response.entries : [];
|
||||
const entries = Array.isArray(response.history) ? response.history : [];
|
||||
if (!entries.length) {
|
||||
setStatus("No captured samples for this tab yet.");
|
||||
setStatus("No captured samples yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus(`Captured samples for this tab: ${entries.length}`);
|
||||
setStatus(`Captured samples: ${entries.length}`);
|
||||
for (const entry of entries) {
|
||||
listEl.appendChild(buildRow(entry));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user