#1309 add confirm sorting dialoge
This commit is contained in:
parent
037a804725
commit
240d62fb55
2 changed files with 20 additions and 7 deletions
|
@ -45,3 +45,10 @@ async function addMessage(message) {
|
|||
browser.runtime.onMessage.addListener((message) => {
|
||||
addMessage(message);
|
||||
});
|
||||
|
||||
browser.runtime.onMessage.addListener(message => {
|
||||
if (message.action === 'confirmSortDialogue') {
|
||||
const result = confirm("confirm sorting tabs");
|
||||
return Promise.resolve({result});
|
||||
}
|
||||
});
|
|
@ -756,16 +756,22 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
|||
Utils.addEnterHandler(document.querySelector("#always-open-in"), () => {
|
||||
Logic.showPanel(ALWAYS_OPEN_IN_PICKER);
|
||||
});
|
||||
|
||||
Utils.addEnterHandler(document.querySelector("#sort-containers-link"), async () => {
|
||||
try {
|
||||
await browser.runtime.sendMessage({
|
||||
method: "sortTabs"
|
||||
});
|
||||
window.close();
|
||||
} catch (e) {
|
||||
window.close();
|
||||
|
||||
const [tab] = await browser.tabs.query({currentWindow: true, active: true});
|
||||
|
||||
// sort without dialouge if active page dosent have content script
|
||||
if(!/^(https?|wss?|file):/.test(tab.url)) {
|
||||
browser.runtime.sendMessage({method: "sortTabs"});
|
||||
return;
|
||||
}
|
||||
|
||||
const {result} = await browser.tabs.sendMessage(tab.id, {action: 'confirmSortDialogue'});
|
||||
if(result)browser.runtime.sendMessage({method: "sortTabs"});
|
||||
window.close();
|
||||
});
|
||||
|
||||
|
||||
const mozillaVpnToutName = "moz-tout-main-panel";
|
||||
const mozillaVpnPermissionsWarningDotName = "moz-permissions-warning-dot";
|
||||
|
|
Loading…
Add table
Reference in a new issue