Hide/Show icon should be shown only if we have opened tabs

This commit is contained in:
baku
2017-01-09 11:05:13 +01:00
parent 76ad3fcb0f
commit 71725d829b
2 changed files with 47 additions and 1 deletions
+17
View File
@@ -10,6 +10,17 @@ function showOrHideContainerTabs(userContextId, hasHiddenTabs) {
method: hasHiddenTabs ? 'showTabs' : 'hideTabs',
userContextId: userContextId
}).then(() => {
return browser.runtime.sendMessage({
method: 'getIdentity',
userContextId: userContextId
});
}).then((identity) => {
if (!identity.hasHiddenTabs && !identity.hasOpenTabs) {
hideorshowIcon.style.display = "none";
} else {
hideorshowIcon.style.display = "";
}
hideorshowIcon.src = hasHiddenTabs ? CONTAINER_HIDE_SRC : CONTAINER_UNHIDE_SRC;
}).then(resolve);
});
@@ -79,6 +90,12 @@ browser.runtime.sendMessage({method: 'queryIdentities'}).then(identities=> {
</tr>`;
identitiesListElement.innerHTML += identityRow;
// No tabs, no icon.
if (!identity.hasHiddenTabs && !identity.hasOpenTabs) {
const hideorshowIcon = document.querySelector(`#uci-${identity.userContextId}-hideorshow-icon`);
hideorshowIcon.style.display = "none";
}
});
const rows = identitiesListElement.querySelectorAll('tr');