diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f5e961..f5fd41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Add option to always prefer links when downloading from pages that match a regex list of URLs (#100) * Add notification option for when a link is downloaded instead of the source +* Add option to close tabs marked for saving (FF, #68) # 3.3.0 diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 367f370..fe66e87 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -593,5 +593,9 @@ "o_cNotifyLinkPreferred": { "message": "Show notification when a link was downloaded instead of the source" + }, + + "o_cCloseTabOnSave": { + "message": "Close tabs marked for saving" } } diff --git a/src/menu.js b/src/menu.js index bfa70d6..d16574f 100644 --- a/src/menu.js +++ b/src/menu.js @@ -552,7 +552,7 @@ const Menus = { } const opts = { - currentTab: t, // Global + currentTab: t, // Global, linkText: t.title, now: new Date(), pageUrl: t.url, @@ -577,6 +577,13 @@ const Menus = { }; Download.renameAndDownload(state); + + // TODO: Store tabs marked for saving and close only on successful save + if (options.closeTabOnSave) { + window.setTimeout(() => { + browser.tabs.remove(t.id); + }, timeoutInterval); + } }, timeoutInterval * i); }); }); diff --git a/src/option.js b/src/option.js index 3cbd4a5..9062f4e 100644 --- a/src/option.js +++ b/src/option.js @@ -71,6 +71,7 @@ const OptionsManagement = { { name: "truncateLength", type: T.VALUE, default: 240 }, { name: "fetchViaContent", type: T.BOOL, default: false }, { name: "tabEnabled", type: T.BOOL, default: false }, + { name: "closeTabOnSave", type: T.BOOL, default: false }, { name: "setRefererHeader", type: T.BOOL, default: false }, { name: "setRefererHeaderFilter", diff --git a/src/options/options.html b/src/options/options.html index e3a7137..d13cb78 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -264,7 +264,15 @@