aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2017-10-21 15:19:07 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2017-10-21 15:19:07 +0200
commit95c14c50f0279fe79b4eca93cc7ab9918035df39 (patch)
tree1afc533116547140d96dfbfcecec39601c46a351
parent87d144f15f0ecbc4753d31d27c26eb3ef754e3cb (diff)
append the date and time to MHTML filenames
-rw-r--r--README.md3
-rw-r--r--package.json12
-rw-r--r--src/archiveror.js13
-rw-r--r--src/manifest.json2
-rw-r--r--src/options.html2
-rw-r--r--src/options.js15
6 files changed, 33 insertions, 14 deletions
diff --git a/README.md b/README.md
index a2e6f0d..400fe65 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,8 @@ services to archive a single page in multiple web archives.
Archiveror can also make local copies of webpages. One page will be saved in a
single [MHTML](https://en.wikipedia.org/wiki/MHTML) file. Bookmarks will be
saved automatically. Pages can also be manually saved by either clicking the
-button or pressing Ctrl+Shift+S.
+button or pressing Ctrl+Shift+S. The filenames end with the UTC date and time of
+when the archive was made.
To enable local archiving, right click the Archiveror button, go to the options
and then pick "Local".
diff --git a/package.json b/package.json
index a832933..a14f463 100644
--- a/package.json
+++ b/package.json
@@ -17,13 +17,13 @@
"url": "https://github.com/rahiel/archiveror/issues"
},
"devDependencies": {
- "babel-core": "^6.25.0",
- "babel-loader": "^7.0.0",
+ "babel-core": "^6.26.0",
+ "babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
- "eslint": "^4.7.2",
- "source-map-loader": "^0.2.1",
- "web-ext": "^2.0.0",
- "webpack": "^3.6.0"
+ "eslint": "^4.9.0",
+ "source-map-loader": "^0.2.2",
+ "web-ext": "^2.2.2",
+ "webpack": "^3.8.1"
},
"babel": {
"presets": [
diff --git a/src/archiveror.js b/src/archiveror.js
index ae4de1a..248ded5 100644
--- a/src/archiveror.js
+++ b/src/archiveror.js
@@ -236,7 +236,18 @@ function sanitizeFilename(title) {
}
function makeFilename(title) {
- return sanitizeFilename(title) + ".mhtml";
+ return sanitizeFilename(title) + "_" + getTimestamp() + ".mhtml";
+}
+
+function getTimestamp() {
+ let date = new Date();
+ let y = date.getUTCFullYear();
+ let m = date.getUTCMonth().toString().padStart(2, "0");
+ let d = date.getUTCDate().toString().padStart(2, "0");
+ let H = date.getUTCHours().toString().padStart(2, "0");
+ let M = date.getUTCMinutes().toString().padStart(2, "0");
+ let timestamp = `${y}-${m}-${d}_${H}-${M}`;
+ return timestamp;
}
// Keyboard shortcuts
diff --git a/src/manifest.json b/src/manifest.json
index 0e78623..b9e35c5 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,7 +2,7 @@
"name": "Archiveror",
"author": "Rahiel Kasim",
"description": "Archive webpages on archive.is, archive.org and more or on your own computer in MHTML format. Automatically archive your bookmarks.",
- "version": "0.6.2",
+ "version": "0.7",
"applications": {
"gecko": {
"id": "archiveror@love.addons.mozilla.org",
diff --git a/src/options.html b/src/options.html
index 65c8891..341afd7 100644
--- a/src/options.html
+++ b/src/options.html
@@ -63,7 +63,7 @@
<div style="margin-bottom: 10px">
<h3>Bookmarks</h3>
<label for="bookmarks">
- <input type="checkbox" name="bookmarks" id="bookmarks">Automatically archive bookmarks
+ <input type="checkbox" id="bookmarks">Automatically archive bookmarks
</label>
</div>
diff --git a/src/options.js b/src/options.js
index 548ed09..0188db6 100644
--- a/src/options.js
+++ b/src/options.js
@@ -1,5 +1,6 @@
import { hasPageCapture } from "./utils.js";
+
function save_options() {
function get_options(name) {
@@ -23,15 +24,21 @@ function save_options() {
let bookmarks = document.getElementById("bookmarks").checked;
chrome.storage.local.set({
- archiveMode: mode, archiveDir: dir, archiveBookmarks: bookmarks, archiveServices: services,
- email: email
+ archiveBookmarks: bookmarks,
+ archiveDir: dir,
+ archiveMode: mode,
+ archiveServices: services,
+ email: email,
});
}
function restore_options() {
chrome.storage.local.get({ // below are the default values
- archiveMode: "online", archiveDir: "Archiveror", archiveBookmarks: true, archiveServices: ["archive.is"],
- email: ""
+ archiveBookmarks: true,
+ archiveDir: "Archiveror",
+ archiveMode: "online",
+ archiveServices: ["archive.is"],
+ email: "",
}, set_options);
function set_options(items) {