New version plus look.

This commit is contained in:
2018-04-20 01:06:32 -05:00
parent f576e96a64
commit f0a93ebf47
14 changed files with 250 additions and 131 deletions

38
src/scripts/searchTabs.js Normal file
View File

@@ -0,0 +1,38 @@
function findTabs(tabs) {
var selection = [];
clearNodes(listZone);
if (searchBar.value != "") {
for (let tab of tabs) {
var title = tab.title;
if (title.toLowerCase().includes(searchBar.value.toLowerCase())) {
selection.push(tab);
}
}
if (selection.length > 1) {
for (let sel of selection) {
createContainer(sel)
}
errHandler.style.display = "none";
clearNodes(errHandler);
} else {
if (selection[0] != undefined) {
errHandler.style.display = "none";
clearNodes(errHandler);
loadSelTab(selection[0].id);
} else {
errHandler.style.display = "block";
errHandler.appendChild(notFoundText);
}
}
} else { logTabs(tabs); }
}
function clearNodes(targetNode) {
while (targetNode.firstChild) {
targetNode.removeChild(targetNode.firstChild);
}
}
function loadSelTab(id) { browser.tabs.update(id, { active: true }); }
function searchTabs() { tabQuery.then(findTabs, onError); }