aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2019-03-24 21:54:11 +0100
committerRahiel Kasim <rahielkasim@gmail.com>2019-03-24 21:54:11 +0100
commit110bc0e03ef52d89ee6197bc7fc63ae6bbba66dd (patch)
treef8473588dac745f261060de1acea6b2f7bcf7e69
parent6525760e7dbff584541631de1153ab02a0c4069b (diff)
option to open new archive pages in background when manually archiving
-rw-r--r--src/archiveror.js8
-rw-r--r--src/options.html6
-rw-r--r--src/options.js7
-rw-r--r--src/utils.js1
4 files changed, 20 insertions, 2 deletions
diff --git a/src/archiveror.js b/src/archiveror.js
index cfe05a5..77e4390 100644
--- a/src/archiveror.js
+++ b/src/archiveror.js
@@ -60,7 +60,11 @@ function archiveOnline(url, services) {
// archive url online at services (a list of strings)
if (isLocal(url)) return; // don't archive internal pages, "file://", "chrome://", etc.
let tabId, link;
- chrome.storage.local.get({archiveServices: defaults.archiveServices, email: defaults.email}, function (items) {
+ chrome.storage.local.get({
+ archiveServices: defaults.archiveServices,
+ background: defaults.background,
+ email: defaults.email
+ }, function (items) {
if (services === undefined) {
services = items.archiveServices;
}
@@ -68,7 +72,7 @@ function archiveOnline(url, services) {
for (let service of services) {
link = getArchivingURL(url, service, items.email);
- chrome.tabs.create({url: link}, function (tab) {
+ chrome.tabs.create({url: link, active: !items.background}, function (tab) {
tabId = tab.id;
// support updating clipboard with new link from archive.is "save the page again"
chrome.tabs.onUpdated.addListener(URLToClipboard);
diff --git a/src/options.html b/src/options.html
index 85b08f7..7e5d359 100644
--- a/src/options.html
+++ b/src/options.html
@@ -90,6 +90,12 @@
(<a href="https://support.google.com/chrome/answer/95574">instructions</a>)
</div>
+ <h3>Advanced</h3>
+ <label for="background">
+ <input type="checkbox" id="background">
+ Open new archive pages in background when manually archiving
+ </label>
+
<script src="options.js"></script>
</body>
</html>
diff --git a/src/options.js b/src/options.js
index 61e02d7..ccbf16e 100644
--- a/src/options.js
+++ b/src/options.js
@@ -20,11 +20,13 @@ function saveOptions() {
let dir = document.getElementById("dir").value; // TODO: check dir for forbidden characters
let email = document.getElementById("email").value;
let bookmarks = document.getElementById("bookmarks").checked;
+ let background = document.getElementById("background").checked;
chrome.storage.local.set({
archiveBookmarks: bookmarks,
archiveDir: dir,
archiveServices: services,
+ background: background,
bookmarkServices: bookmarkServices,
email: email,
});
@@ -35,6 +37,7 @@ function restoreOptions() {
archiveBookmarks: defaults.archiveBookmarks,
archiveDir: defaults.archiveDir,
archiveServices: defaults.archiveServices,
+ background: defaults.background,
bookmarkServices: defaults.bookmarkServices,
email: defaults.email,
}, setOptions);
@@ -44,6 +47,10 @@ function restoreOptions() {
document.getElementById("bookmarks").checked = true;
}
+ if (items.background === true) {
+ document.getElementById("background").checked = true;
+ }
+
document.getElementById("dir").value = items.archiveDir;
document.getElementById("email").value = items.email;
for (let s of items.archiveServices) {
diff --git a/src/utils.js b/src/utils.js
index 9f3de70..68c2268 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -4,6 +4,7 @@ export const defaults = {
archiveBookmarks: true,
archiveDir: "Archiveror",
archiveServices: ["archive.is"],
+ background: false,
bookmarkServices: ["archive.is"],
email: "",
};