diff --git a/app/settings/manifest.js b/app/settings/manifest.js index c0a202a5..7c8e4788 100644 --- a/app/settings/manifest.js +++ b/app/settings/manifest.js @@ -490,6 +490,8 @@ setting_definitions.push( "type": "description", "text": ( ` ` diff --git a/app/win/main_tl.js b/app/win/main_tl.js index bdd1f8c8..3b43a3d0 100644 --- a/app/win/main_tl.js +++ b/app/win/main_tl.js @@ -1123,22 +1123,46 @@ function actionCloseTabAndSave(tab_node_id, tab_node, unused_action_id, unused_a let tab_val = D.tabs.by_node_id(tab_node_id); if(!tab_val || tab_val.tab_id === K.NONE) return; //already closed => nop let window_node_id = tab_node.parent; - M.remember(window_node_id); - let tab_id = tab_val.tab_id; // since markTabAsClosed clears it - M.markTabAsClosed(tab_val); + function doCloseAndSave() { + M.remember(window_node_id); - let seq = ASQH.NowCC((cc)=>{ - chrome.tabs.remove(tab_id, cc); - // Because the tab is already marked as closed, onTabRemoved() - // won't delete its node. - }); + let tab_id = tab_val.tab_id; // since markTabAsClosed clears it + M.markTabAsClosed(tab_val); - seq.val(()=>{ - // Refresh the tab.index values for the remaining tabs - M.updateTabIndexValues(window_node_id); - saveTree(); - }); + let seq = ASQH.NowCC((cc)=>{ + chrome.tabs.remove(tab_id, cc); + // Because the tab is already marked as closed, onTabRemoved() + // won't delete its node. + }); + + seq.val(()=>{ + // Refresh the tab.index values for the remaining tabs + M.updateTabIndexValues(window_node_id); + saveTree(); + }); + } + + let need_confirmation_audible = ( + (tab_val.isAudible && S.isCONFIRM_DEL_OF_AUDIBLE_TABS()) + ); + + if(!need_confirmation_audible) { + doCloseAndSave(); + } else { + showConfirmationModalDialog( + _T('dlgpCloseAudibleTab', M.get_html_label(tab_val)), + !need_confirmation_audible, + // "Don't show again" is hidden if it was just about audio + ) + + // Processing after the dialog closes + .val((result)=>{ + if(result && result.reason === 'yes') { + doCloseAndSave(); + } + }) + } } //actionCloseTabAndSave() diff --git a/static/_locales/de/messages.json b/static/_locales/de/messages.json index 618e0acd..55083093 100644 --- a/static/_locales/de/messages.json +++ b/static/_locales/de/messages.json @@ -83,6 +83,16 @@ } } } + , "dlgpCloseAudibleTab": { + "message": "Registerkarte \"$TITLE$\" schließen? Sie spielt jetzt Musik." + ,"description":"Prompt for whether the user wants to delete a tab that is playing music (audible)." + ,"placeholders":{ + "title": { + "content": "$1" + ,"example": "(this is the title of the tab that will be closed)" + } + } + } , "dlgpCloseAudibleWindow": { "message": "Fenster \"$TITLE$\" schließen? Es spielt jetzt Musik." ,"description":"Prompt for whether the user wants to delete a window that is playing music (audible)." diff --git a/static/_locales/en/messages.json b/static/_locales/en/messages.json index e942bd2c..e41756d7 100644 --- a/static/_locales/en/messages.json +++ b/static/_locales/en/messages.json @@ -84,6 +84,16 @@ } } } + , "dlgpCloseAudibleTab": { + "message": "Close tab \"$TITLE$\"? It is currently playing music." + ,"description":"Prompt for whether the user wants to delete a tab that is playing music (audible)." + ,"placeholders":{ + "title": { + "content": "$1" + ,"example": "(this is the title of the tab that will be closed)" + } + } + } , "dlgpCloseAudibleWindow": { "message": "Close window \"$TITLE$\"? It is currently playing music." ,"description":"Prompt for whether the user wants to delete a window that is playing music (audible)." diff --git a/static/_locales/fr/messages.json b/static/_locales/fr/messages.json index 83bfb0ea..d0eb6cff 100644 --- a/static/_locales/fr/messages.json +++ b/static/_locales/fr/messages.json @@ -83,6 +83,16 @@ } } } + , "dlgpCloseAudibleTab": { + "message": "Fermer \"$TITLE$\"? It is currently playing music." + ,"description":"Prompt for whether the user wants to delete a tab that is playing music (audible). TODO TRANSLATE" + ,"placeholders":{ + "title": { + "content": "$1" + ,"example": "(this is the title of the tab that will be closed)" + } + } + } , "dlgpCloseAudibleWindow": { "message": "Fermer \"$TITLE$\"? It is currently playing music." ,"description":"Prompt for whether the user wants to delete a window that is playing music (audible). TODO TRANSLATE" diff --git a/static/_locales/ru/messages.json b/static/_locales/ru/messages.json index 9d6d6f6e..7620f1c3 100644 --- a/static/_locales/ru/messages.json +++ b/static/_locales/ru/messages.json @@ -83,6 +83,16 @@ } } } + , "dlgpCloseAudibleTab": { + "message": "Закрыть вкладку \"$TITLE$\"? В текущем окне воспроизводится музыка." + ,"description":"Prompt for whether the user wants to delete a tab that is playing music (audible). (TODO check/fix translation)" + ,"placeholders":{ + "title": { + "content": "$1" + ,"example": "(this is the title of the tab that will be closed)" + } + } + } , "dlgpCloseAudibleWindow": { "message": "Закрыть окно \"$TITLE$\"? В текущем окне воспроизводится музыка." ,"description":"Prompt for whether the user wants to delete a window that is playing music (audible). TODO TRANSLATE"