diff --git a/README.md b/README.md index 251232e..617e4f0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Consider this add-on done (except for bugfixes). I may or may not add new featur - **Access browser tabs** : required to list the tabs ; - **Input data to the clipboard** : required to copy the list to the clipboard ; -- **Display notifications** : not required stricto sensu (as the extension could work without it) but it is used to improve the user experience by providing visual feedback about what is going on ; +- **Display notifications** : not required stricto sensu (as the extension could work without it) but it is used to improve the user experience by providing visual feedback about what is going on (if the "Enable Notifications" option is selected) ; - **Storage** : required to store settings. ## Screenshots diff --git a/_locales/de/messages.json b/_locales/de/messages.json index ce14069..b3edfe8 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -44,6 +44,9 @@ "popupFilterTabsPlaceholder": { "message": "Filter Tabs" }, + "optionsNotifications": { + "message": "Benachrichtigungen aktivieren" + }, "optionsCustomHeader": { "message": "Benutzerdefinierter Header" }, diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json index bcf7b24..3efdbed 100644 --- a/_locales/en_US/messages.json +++ b/_locales/en_US/messages.json @@ -44,6 +44,9 @@ "popupFilterTabsPlaceholder": { "message": "Filter tabs" }, + "optionsNotifications": { + "message": "Enable Notifications" + }, "optionsCustomHeader": { "message": "Custom header" }, diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 15ad700..d56cbc3 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -44,6 +44,9 @@ "popupFilterTabsPlaceholder": { "message": "Filtrer les onglets" }, + "optionsNotifications": { + "message": "Activer les notifications" + }, "optionsCustomHeader": { "message": "EntĂȘte personnalisĂ©e" }, diff --git a/options/options.html b/options/options.html index 588e296..9bd1dee 100644 --- a/options/options.html +++ b/options/options.html @@ -34,6 +34,13 @@

Options

+
+

+ + +

+
+

: diff --git a/options/options.js b/options/options.js index d6b72ed..f4ea192 100644 --- a/options/options.js +++ b/options/options.js @@ -6,6 +6,7 @@ w.addEventListener('load', function () { optionsFormatCustom = d.getElementById('options-format-custom') optionsButtonResetFormat = d.getElementById('options-button-reset-format') optionsFilterTabs = d.getElementById('options-filter-tabs') + optionsNotifications = d.getElementById('options-notifications') optionsCustomHeader = d.getElementById('options-custom-header') optionsButtonResetHeader = d.getElementById('options-button-reset-header') @@ -32,6 +33,10 @@ w.addEventListener('load', function () { saveOptions() }) + optionsNotifications.addEventListener('change', function () { + saveOptions() + }) + optionsButtonResetHeader.addEventListener('click', function () { optionsCustomHeader.value = '' saveOptions() @@ -71,6 +76,7 @@ function restoreOptions () { optionsIgnorePinned.checked = items.options.ignorePinned optionsFormatCustom.value = items.options.formatCustom optionsFilterTabs.checked = items.options.filterTabs + optionsNotifications.checked = items.options.enableNotifications optionsCustomHeader.value = items.options.customHeader setOptionsButtonResetFormatVisibility() @@ -85,6 +91,7 @@ function saveOptions () { ignorePinned: optionsIgnorePinned.checked, formatCustom: optionsFormatCustom.value, filterTabs: optionsFilterTabs.checked, + notifications: optionsNotifications.checked, customHeader: optionsCustomHeader.value } }) diff --git a/popup/popup.js b/popup/popup.js index a5facf9..4250b1d 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -3,7 +3,8 @@ var popupButtonCopy, popupButtonExport, popupFormat, popupLabelFormatTitles, popupLabelFormatCustom, popupLimitWindow, currentWindowId, os, - optionsIgnoreNonHTTP, optionsIgnorePinned, optionsFormatCustom, optionsFilterTabs, optionsCustomHeader + optionsIgnoreNonHTTP, optionsIgnorePinned, optionsFormatCustom, optionsFilterTabs, optionsCustomHeader, + optionsNotifications var defaultPopupStates = { 'states': { @@ -168,17 +169,21 @@ function copyToClipboard () { var message = d.execCommand('copy') ? 'copiedToClipboard' : 'notCopiedToClipboard' - browser.notifications.create('ExportTabsURLs', { - 'type': 'basic', - 'title': browser.i18n.getMessage('appName'), - 'iconUrl': '../img/icon.svg', - 'message': browser.i18n.getMessage(message) - }) + if (optionsNotifications) { + browser.notifications.create('ExportTabsURLs', { + 'type': 'basic', + 'title': browser.i18n.getMessage('appName'), + 'iconUrl': '../img/icon.svg', + 'message': browser.i18n.getMessage(message) + }) + } popupButtonCopy.classList.add('disabled') setTimeout(function () { - browser.notifications.clear('ExportTabsURLs') + if (optionsNotifications) { + browser.notifications.clear('ExportTabsURLs') + } popupButtonCopy.classList.remove('disabled') }, 3000) } @@ -228,5 +233,6 @@ function getOptions () { optionsFormatCustom = items.options.formatCustom optionsFilterTabs = items.options.filterTabs optionsCustomHeader = items.options.customHeader + optionsNotifications = items.options.notifications }) }