#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) => {
|
browser.runtime.onMessage.addListener((message) => {
|
||||||
addMessage(message);
|
addMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
browser.runtime.onMessage.addListener(message => {
|
||||||
|
if (message.action === 'confirmSortDialogue') {
|
||||||
|
const result = confirm("confirm sorting tabs");
|
||||||
|
return Promise.resolve({result});
|
||||||
|
}
|
||||||
|
});
|
|
@ -756,17 +756,23 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
Utils.addEnterHandler(document.querySelector("#always-open-in"), () => {
|
Utils.addEnterHandler(document.querySelector("#always-open-in"), () => {
|
||||||
Logic.showPanel(ALWAYS_OPEN_IN_PICKER);
|
Logic.showPanel(ALWAYS_OPEN_IN_PICKER);
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.addEnterHandler(document.querySelector("#sort-containers-link"), async () => {
|
Utils.addEnterHandler(document.querySelector("#sort-containers-link"), async () => {
|
||||||
try {
|
|
||||||
await browser.runtime.sendMessage({
|
const [tab] = await browser.tabs.query({currentWindow: true, active: true});
|
||||||
method: "sortTabs"
|
|
||||||
});
|
// sort without dialouge if active page dosent have content script
|
||||||
window.close();
|
if(!/^(https?|wss?|file):/.test(tab.url)) {
|
||||||
} catch (e) {
|
browser.runtime.sendMessage({method: "sortTabs"});
|
||||||
window.close();
|
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 mozillaVpnToutName = "moz-tout-main-panel";
|
||||||
const mozillaVpnPermissionsWarningDotName = "moz-permissions-warning-dot";
|
const mozillaVpnPermissionsWarningDotName = "moz-permissions-warning-dot";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue