Added all window search and list with toggling functionality.

This commit is contained in:
2018-05-21 04:48:34 -05:00
parent 316d9840f6
commit da93d9cfc3
9 changed files with 118 additions and 37 deletions

View File

@@ -1,7 +1,5 @@
function findTabs(tabs) {
var selection = [];
clearNodes(listZone);
if (searchBar.value != "") {
for (let tab of tabs) {
var title = tab.title;
@@ -10,16 +8,16 @@ function findTabs(tabs) {
}
}
if (selection.length > 1) {
for (let sel of selection) {
createContainer(sel)
}
logTabs(selection);
errHandler.style.display = "none";
clearNodes(errHandler);
} else {
if (selection[0] != undefined) {
searchBar.value = "";
errHandler.style.display = "none";
clearNodes(errHandler);
loadSelTab(selection[0].id);
getTabs();
} else {
errHandler.style.display = "block";
errHandler.appendChild(notFoundText);
@@ -37,6 +35,14 @@ function clearNodes(targetNode) {
function loadSelTab(id) { browser.tabs.update(id, { active: true }); }
function searchTabs() {
tabsAction.query({currentWindow: true})
.then(findTabs, onError);
var elm = document.getElementById("searchMode");
var currentMode = (elm.getAttribute("searchwindowsmode") == "false");
clearNodes(listZone);
if (currentMode == false) {
tabsAction.query({}).then(findTabs, onError);
} else {
tabsAction.query({currentWindow: currentMode})
.then(findTabs, onError)
}
}