diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json index a1071ecf..3cb41e98 100644 --- a/src/_locales/de/messages.json +++ b/src/_locales/de/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "in den Einstellung für automatisches Tab aussetzen." }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "Mehr Informationen zu Chromes Verwerfen Funktionalität findest du unter:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "Diesen Tab aufwachen" }, "html_popup_suspend_tab": { "message": "Diesen Tab jetzt aussetzen" }, "html_popup_dont_suspend_now": { "message": "Jetzt nicht aussetzen" }, diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 6ddfeb7c..1c0c0365 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "specified in the Automatic tab suspension options." }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "For more information on Chrome discarding refer to:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "Unsuspend this tab" }, "html_popup_suspend_tab": { "message": "Suspend this tab now" }, "html_popup_dont_suspend_now": { "message": "Don't suspend for now" }, diff --git a/src/_locales/pt_BR/messages.json b/src/_locales/pt_BR/messages.json index 73eda089..6211c7bf 100644 --- a/src/_locales/pt_BR/messages.json +++ b/src/_locales/pt_BR/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "especificada nas opções de suspensão de guia Automática." }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "Para mais informações sobre o descarte do Chrome, consulte:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "Recarregar esta guia" }, "html_popup_suspend_tab": { "message": "Suspender esta guia agora" }, "html_popup_dont_suspend_now": { "message": "Não suspender agora" }, diff --git a/src/_locales/pt_PT/messages.json b/src/_locales/pt_PT/messages.json index 857e8eef..1ccafa38 100644 --- a/src/_locales/pt_PT/messages.json +++ b/src/_locales/pt_PT/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "especificada nas opções de suspensão de guia Automática." }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "Para mais informações sobre o descarte do Chrome, consulte:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "Recarregar esta guia" }, "html_popup_suspend_tab": { "message": "Suspender esta guia agora" }, "html_popup_dont_suspend_now": { "message": "Não suspender agora" }, diff --git a/src/_locales/ru/messages.json b/src/_locales/ru/messages.json index fc7d6e93..fbff13c1 100644 --- a/src/_locales/ru/messages.json +++ b/src/_locales/ru/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": {"message": "в настройке \"Автоматически приостанавливать вкладки после\"." }, "html_options_suspend_on_low_memory_tooltip_line6": {"message": "Для получения дополнительной информации о механизме выгрузки вкладок Chrome см.:"}, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "Возобновить эту вкладку" }, "html_popup_suspend_tab": { "message": "Приостановить эту вкладку" }, "html_popup_dont_suspend_now": { "message": "Не приостанавливать" }, diff --git a/src/_locales/tr/messages.json b/src/_locales/tr/messages.json index a9c55c48..5c5e75e8 100644 --- a/src/_locales/tr/messages.json +++ b/src/_locales/tr/messages.json @@ -122,6 +122,8 @@ "html_popup_unsuspend_all_tabs": { "message": "Tüm sekmelerin askısını kaldır" }, "html_popup_unsuspend_selected_tabs": { "message": "Seçilen sekmenin askısını kaldır" }, "html_popup_unsuspend_tab": { "message": "Bu sekmenin askısını kaldır" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_recovery_description_line1": { "message": "Uzantının çökmesinden kurtuldunuz gibi görünüyor." }, "html_recovery_description_line2": { "message": "Askıya alınan sekmeleriniz çökmüş veya kaybolmuş olabilir." }, "html_recovery_disable_screen_capturing": { "message": "Ekran görüntüsü yakalama devre dışı" }, diff --git a/src/_locales/zh_CN/messages.json b/src/_locales/zh_CN/messages.json index 1eec5a20..10f9965f 100644 --- a/src/_locales/zh_CN/messages.json +++ b/src/_locales/zh_CN/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "" }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "有关 automatic tab discarding 的更多信息,请参阅:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "恢复当前标签页" }, "html_popup_suspend_tab": { "message": "冻结此标签页" }, "html_popup_dont_suspend_now": { "message": "现在还不要冻结" }, diff --git a/src/_locales/zh_TW/messages.json b/src/_locales/zh_TW/messages.json index 3c5d67e2..d8f901cd 100644 --- a/src/_locales/zh_TW/messages.json +++ b/src/_locales/zh_TW/messages.json @@ -121,6 +121,8 @@ "html_options_suspend_on_low_memory_tooltip_line5": { "message": "" }, "html_options_suspend_on_low_memory_tooltip_line6": { "message": "有關 Chrome discarding 的更多資訊,請參閱:" }, "html_options_suspend_on_low_memory_tooltip_discarding_link": { "message": "https://developers.google.com/web/updates/2015/09/tab-discarding" }, + "html_popup_pause_suspend": { "message": "Pause suspend" }, + "html_popup_unpause_suspend": { "message": "Unpause suspend" }, "html_popup_unsuspend_tab": { "message": "回復目前分頁" }, "html_popup_suspend_tab": { "message": "凍結此分頁" }, "html_popup_dont_suspend_now": { "message": "現在還不要凍結" }, diff --git a/src/js/background.js b/src/js/background.js index 4975b1ff..c778ac34 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -50,6 +50,7 @@ var tgs = (function() { let _isCharging = false; let _triggerHotkeyUpdate = false; let _suspensionToggleHotkey; + let _pauseValue = 0; function getExtensionGlobals() { const globals = { @@ -609,6 +610,23 @@ var tgs = (function() { delete _tabStateByTabId[tabId]; } + function pauseTgs() { + _pauseValue = gsStorage.getOption(gsStorage.SUSPEND_TIME); + if (_pauseValue === 0) return; + + // store current timeout in _pauseValue, and set global timeout to never + gsStorage.setOption(gsStorage.SUSPEND_TIME, 0); + resetAutoSuspendTimerForAllTabs(); + } + + function unpauseTgs() { + if (_pauseValue === 0) return; + + // restore global timeout from value in _pauseValue + gsStorage.setOption(gsStorage.SUSPEND_TIME, _pauseValue); + resetAutoSuspendTimerForAllTabs(); + } + function unsuspendTab(tab) { if (!gsUtils.isSuspendedTab(tab)) return; @@ -1868,6 +1886,8 @@ var tgs = (function() { resetAutoSuspendTimerForAllTabs, getSuspensionToggleHotkey, + pauseTgs, + unpauseTgs, unsuspendTab, unsuspendHighlightedTab, unwhitelistHighlightedTab, diff --git a/src/js/popup.js b/src/js/popup.js index c9c47568..8bf51cca 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -73,6 +73,14 @@ }); function setSuspendCurrentVisibility(tabStatus) { + if (gsStorage.getOption(gsStorage.SUSPEND_TIME) > 0) { + document.getElementById('pauseSuspend').style.display = 'block'; + document.getElementById('unpauseSuspend').style.display = 'none'; + } else { + document.getElementById('pauseSuspend').style.display = 'none'; + document.getElementById('unpauseSuspend').style.display = 'block'; + } + var suspendOneVisible = ![ gsUtils.STATUS_SUSPENDED, gsUtils.STATUS_SPECIAL, @@ -267,6 +275,18 @@ } function addClickHandlers() { + document + .getElementById('pauseSuspend') + .addEventListener('click', function() { + tgs.pauseTgs(); + window.close(); + }); + document + .getElementById('unpauseSuspend') + .addEventListener('click', function() { + tgs.unpauseTgs(); + window.close(); + }); document .getElementById('unsuspendOne') .addEventListener('click', function(e) { diff --git a/src/popup.html b/src/popup.html index bd565e71..41c60fbe 100644 --- a/src/popup.html +++ b/src/popup.html @@ -12,6 +12,14 @@
+
+ + +