add ability to filter the container list
This commit is contained in:
+18
-1
@@ -51,7 +51,6 @@ async function getExtensionInfo() {
|
||||
return extensionInfo;
|
||||
}
|
||||
|
||||
|
||||
// This object controls all the panels, identities and many other things.
|
||||
const Logic = {
|
||||
_identities: [],
|
||||
@@ -465,6 +464,23 @@ const Logic = {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
filterContainerList() {
|
||||
const pattern = /^\s+|\s+$/g;
|
||||
const list = Array.from(document.querySelectorAll("#identities-list tr"));
|
||||
const search = document.querySelector("#search-terms").value.replace(pattern, "").toLowerCase();
|
||||
|
||||
for (const i in list) {
|
||||
const text = list[i].querySelector("td div span");
|
||||
|
||||
if (text.innerText.replace(pattern, "").toLowerCase().includes(search) ||
|
||||
!search) {
|
||||
list[i].style.display = "block";
|
||||
} else {
|
||||
list[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -847,6 +863,7 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||
|
||||
document.addEventListener("keydown", Logic.keyboardNavListener);
|
||||
document.addEventListener("keydown", Logic.shortcutListener);
|
||||
document.addEventListener("input", Logic.filterContainerList);
|
||||
|
||||
MozillaVPN.handleContainerList(identities);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user