Issue #11 - Showing all the hidden tabs before opening a new one

This commit is contained in:
baku 2017-01-09 09:36:58 +01:00
parent 4b92b775b4
commit f87eece6cc

View file

@ -31,21 +31,23 @@ function hideContainerTabs(userContextId) {
} }
function showContainerTabs(userContextId) { function showContainerTabs(userContextId) {
const hideorshowIcon = document.querySelector(`#uci-${userContextId}-hideorshow-icon`); return new Promise((resolve, reject) => {
const hideorshowIcon = document.querySelector(`#uci-${userContextId}-hideorshow-icon`);
browser.runtime.sendMessage({ browser.runtime.sendMessage({
method: 'showTabs', method: 'showTabs',
userContextId: userContextId userContextId: userContextId
}).then(hiddenTabUrls=> { }).then(hiddenTabUrls=> {
hiddenTabUrls.forEach(url=> { hiddenTabUrls.forEach(url=> {
browser.runtime.sendMessage({ browser.runtime.sendMessage({
method: 'openTab', method: 'openTab',
userContextId: userContextId, userContextId: userContextId,
url: url url: url
});
}); });
}); }).then(() => {
}).then(() => { hideorshowIcon.src = CONTAINER_HIDE_SRC;
hideorshowIcon.src = CONTAINER_HIDE_SRC; }).then(resolve);
}); });
} }
@ -130,11 +132,13 @@ browser.runtime.sendMessage({method: 'queryIdentities'}).then(identities=> {
} }
}); });
} else if (e.target.matches('.newtab-icon')) { } else if (e.target.matches('.newtab-icon')) {
browser.runtime.sendMessage({ showContainerTabs(userContextId).then(() => {
method: 'openTab', browser.runtime.sendMessage({
userContextId: userContextId}) method: 'openTab',
.then(() => { userContextId: userContextId})
window.close(); .then(() => {
window.close();
});
}); });
} }
}); });