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