Add button to unhide all groups in popup.
Adds a button with the text "Unhide all", next to the "Sort tabs" button in the popup menu. This button will show all tabs from all containers.
This commit is contained in:
parent
d4fcd061f9
commit
ce0417b9d0
5 changed files with 41 additions and 4 deletions
|
@ -450,7 +450,7 @@ manage things like container crud */
|
|||
margin-inline-start: var(--inline-item-space-size);
|
||||
}
|
||||
|
||||
#container-panel #sort-containers-link {
|
||||
#container-panel .action-link {
|
||||
align-items: center;
|
||||
block-size: var(--block-url-label-size);
|
||||
border: 1px solid #d8d8d8;
|
||||
|
@ -460,11 +460,12 @@ manage things like container crud */
|
|||
font-size: var(--small-text-size);
|
||||
inline-size: var(--inline-button-size);
|
||||
justify-content: center;
|
||||
margin-left: var(--block-line-space-size);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#container-panel #sort-containers-link:hover,
|
||||
#container-panel #sort-containers-link:focus {
|
||||
#container-panel .action-link:hover,
|
||||
#container-panel .action-link:focus {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,8 +299,26 @@ const backgroundLogic = {
|
|||
return await identityState.storageArea.set(options.cookieStoreId, containerState);
|
||||
},
|
||||
|
||||
async unhideAllTabs(windowId) {
|
||||
const [identities, state] = await Promise.all([
|
||||
browser.contextualIdentities.query({}),
|
||||
backgroundLogic.queryIdentitiesState(windowId)
|
||||
]);
|
||||
|
||||
const promises = [];
|
||||
identities.filter(identity => {
|
||||
const stateObject = state[identity.cookieStoreId];
|
||||
return stateObject && stateObject.hasHiddenTabs;
|
||||
}).map(identity => identity.cookieStoreId)
|
||||
.forEach(cookieStoreId => {
|
||||
// We need to call unhideContainer in messageHandler to prevent it from
|
||||
// unhiding multiple times
|
||||
promises.push(messageHandler.unhideContainer(cookieStoreId));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
cookieStoreId(userContextId) {
|
||||
return `firefox-container-${userContextId}`;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ const messageHandler = {
|
|||
case "exemptContainerAssignment":
|
||||
response = assignManager._exemptTab(m);
|
||||
break;
|
||||
case "unhideAllTabs":
|
||||
response = backgroundLogic.unhideAllTabs(m.message.windowId);
|
||||
break;
|
||||
}
|
||||
return response;
|
||||
});
|
||||
|
|
|
@ -500,6 +500,20 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||
}
|
||||
});
|
||||
|
||||
Logic.addEnterHandler(document.querySelector("#unhide-all-containers-link"), async function () {
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
method: "unhideAllTabs",
|
||||
message: {
|
||||
windowId: browser.windows.WINDOW_ID_CURRENT
|
||||
}
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
const selectables = [...document.querySelectorAll("[tabindex='0'], [tabindex='-1']")];
|
||||
const element = document.activeElement;
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
</label>
|
||||
</div>
|
||||
<div class="container-panel-controls">
|
||||
<a href="#" class="action-link" id="unhide-all-containers-link" title="Show all hidden containers">Show all</a>
|
||||
<a href="#" class="action-link" id="sort-containers-link" title="Sort tabs into container order">Sort Tabs</a>
|
||||
</div>
|
||||
<div class="scrollable panel-content" tabindex="-1">
|
||||
|
|
Loading…
Add table
Reference in a new issue