Fixed window selection issue.

This commit is contained in:
Maxim Stewart 2018-09-30 17:03:56 -05:00
parent c70553b0e4
commit 9c763c0e7b
4 changed files with 47 additions and 35 deletions

View File

@ -4,10 +4,9 @@ Search Firefox tabs and get a list or automatic direct to the searched tab.
# Download
https://addons.mozilla.org/en-US/firefox/addon/tab-search-and-manage/
# Version: 1.2.8
# Version: 1.2.9
<ul>
<li>Fixed search type persistence.</li>
<li>Fixed missing starting tabs in list.</li>
<li>Fixed window selection issue.</li>
</ul>
***Note:

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Tab Search and Manage",
"version": "1.2.8",
"version": "1.2.9",
"description": "This plugin can search, drag-n-drop ordering, and (un)hide all or some tabs.",
"applications": {

View File

@ -14,32 +14,34 @@ var windowIndex = 0;
function logTabs(tabs) {
windowIndex = 0;
tabsAction.query({currentWindow: true, active: true}).then((tab) => {
focusedWinID = tab[0].windowId;
}, focusedWinID);
for (let tab of tabs) {
currentWinId = tab.windowId;
if (currentWinId == newWinId) {
createContainer(tab);
} else {
if (windowIndex != 0) {
var pTag = document.createElement("P");
var msg = (focusedWinID == tab.windowId)
? "[ Current Window ] " : "Window: " + tab.windowId;
var pText = document.createTextNode(msg);
pTag.className = "windowIdHeaders";
pTag.appendChild(pText);
listZone.appendChild(pTag);
windowIndex++;
tabsAction.query({currentWindow: true, active: true}).then((tab) => {
console.log(tab);
focusedWinID = tab[0].windowId;
}, focusedWinID).then(() => {
for (let tab of tabs) {
currentWinId = tab.windowId;
if (currentWinId == newWinId) {
createContainer(tab);
} else {
createContainer(tab);
windowIndex = 1;
if (windowIndex != 0) {
var pTag = document.createElement("P");
var msg = (focusedWinID == tab.windowId)
? "[ Current Window ] " : "Window: " + tab.windowId;
var pText = document.createTextNode(msg);
pTag.className = "windowIdHeaders";
pTag.appendChild(pText);
listZone.appendChild(pTag);
windowIndex++;
createContainer(tab);
} else {
createContainer(tab);
windowIndex = 1;
}
}
newWinId = currentWinId;
}
newWinId = currentWinId;
}
});
newWinId = undefined;
// Set poped-out-window position and 100px up from selected elm
@ -56,6 +58,19 @@ function createContainer(tab) {
var hidnStImgTag = document.createElement("IMG");
var icoImgTag = document.createElement("IMG"); // Used to properly set bg
// Set oldElm so eventListeners.js has starting ref
if (tab.active == true) {
browser.windows.getCurrent().then((window) => {
if (tab.windowId == window.id) {
spanTag.className = "block block-focused";
if (oldElm) {
oldElm.setAttribute("class", "block");
}
oldElm = spanTag;
}
}, tab, oldElm, spanTag);
}
spanTag.setAttribute("tabID", tab.id);
spanTag.title = tab.title;
spanTag.id = "iconElm";
@ -83,15 +98,6 @@ function createContainer(tab) {
pTag.appendChild(iconText);
spanTag.appendChild(pTag);
listZone.appendChild(spanTag);
// Set oldElm so eventListeners.js has starting ref
if (tab.active == true) {
spanTag.className = "block block-focused";
if (oldElm) {
oldElm.setAttribute("class", "block");
}
oldElm = spanTag;
}
}
function createTab() {

View File

@ -16,7 +16,14 @@ function findTabs(tabs) {
searchBar.value = "";
errHandler.style.display = "none";
clearNodes(errHandler);
loadSelTab(selection[0].id);
if (selection[0].windowId == focusedWinID) {
loadSelTab(selection[0].id);
} else {
browser.windows.update(selection[0].windowId, {focused: true})
.finally(loadSelTab(selection[0].id));
}
getTabs();
} else {
errHandler.style.display = "block";