aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2017-05-07 10:09:46 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2017-05-07 10:15:16 +0200
commit7319e10a7331f6bcafdc0bf656da98fa385ab239 (patch)
tree5d9959d74307db383876e78505f78fce5dbdd1ef
parent37c7fb052ba7b808a8143e228590561a921d1aa9 (diff)
port Firefox version to WebExtensions, drop old Add-on SDK code
-rw-r--r--.travis.yml4
-rw-r--r--README.md5
-rwxr-xr-xbuild-chromium.sh13
-rwxr-xr-xbuild-firefox.sh13
-rwxr-xr-xbuild.bash22
-rw-r--r--firefox/data/icon-16-star.pngbin743 -> 0 bytes
-rw-r--r--firefox/data/icon-16.pngbin501 -> 0 bytes
-rw-r--r--firefox/data/icon-32-star.pngbin1871 -> 0 bytes
-rw-r--r--firefox/data/icon-32.pngbin1127 -> 0 bytes
-rw-r--r--firefox/data/icon-64-star.pngbin4763 -> 0 bytes
-rw-r--r--firefox/data/icon-64.pngbin1589 -> 0 bytes
-rw-r--r--firefox/data/icon.pngbin1165 -> 0 bytes
-rw-r--r--firefox/data/rodentia-icons_help-about.svg28
-rw-r--r--firefox/lib/bookmarks.js26
-rw-r--r--firefox/lib/main.js157
-rw-r--r--firefox/package.json60
-rw-r--r--package.json21
-rw-r--r--src/archiveror.js (renamed from chromium/archiveror.js)8
-rw-r--r--src/icon-128.png (renamed from chromium/icon-128.png)bin3238 -> 3238 bytes
-rw-r--r--src/icon-16.png (renamed from chromium/icon-16.png)bin334 -> 334 bytes
-rw-r--r--src/icon-19.png (renamed from chromium/icon-19.png)bin422 -> 422 bytes
-rw-r--r--src/icon-38.png (renamed from chromium/icon-38.png)bin1249 -> 1249 bytes
-rw-r--r--src/icon-48.png (renamed from chromium/icon-48.png)bin1574 -> 1574 bytes
-rw-r--r--src/manifest.json (renamed from chromium/manifest.json)9
-rw-r--r--src/matt-icons_media-floppy.svg (renamed from firefox/data/matt-icons_media-floppy.svg)0
-rw-r--r--src/options.html (renamed from chromium/options.html)19
-rw-r--r--src/options.js (renamed from chromium/options.js)7
-rw-r--r--src/utils.js (renamed from utils.js)13
-rw-r--r--webpack.config.js4
29 files changed, 70 insertions, 339 deletions
diff --git a/.travis.yml b/.travis.yml
index 5553816..e889b30 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,6 @@ language: node_js
node_js:
- "stable"
script:
- - ./build-chromium.sh
- - ./build-firefox.sh
+ - ./build.bash chromium
+ - ./build.bash firefox
- npm run lint
diff --git a/README.md b/README.md
index e58d87e..2a34dbd 100644
--- a/README.md
+++ b/README.md
@@ -62,8 +62,8 @@ extensions and enable it: <https://i.imgur.com/ahrfe3M.png>.
## Credits
-* Both the [floppy disk icon][floppy] and the [star icon][star] are by the
- artist [sixsixfive](https://sixsixfive.deviantart.com/) and were generously
+* The [floppy disk icon][floppy] is by the
+ artist [sixsixfive](https://sixsixfive.deviantart.com/) and was generously
released into the public domain.
* This extension would not be possible without the free archiving services
provided by <https://archive.is>, <https://archive.org> and
@@ -72,4 +72,3 @@ extensions and enable it: <https://i.imgur.com/ahrfe3M.png>.
Branwen served as inspiration for this add-on.
[floppy]: https://openclipart.org/detail/211780/matt-icons_media-floppy-by-sixsixfive-211780
-[star]: https://openclipart.org/detail/212371/rodentia-icons_help-about-by-sixsixfive-212371
diff --git a/build-chromium.sh b/build-chromium.sh
deleted file mode 100755
index 508d499..0000000
--- a/build-chromium.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-# Run from archiveror root folder
-set -e
-dist="dist-chromium/"
-
-rm -rf "$dist"
-mkdir "$dist"
-find chromium/ -not -name "*.js" -exec cp '{}' "$dist" \;
-npm run build
-cp LICENSE.txt "$dist"
-
-cd "$dist"
-zip archiveror.zip ./*
diff --git a/build-firefox.sh b/build-firefox.sh
deleted file mode 100755
index c837f1b..0000000
--- a/build-firefox.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-# Run from archiveror root folder
-set -e
-dist="dist-firefox/"
-
-rm -rf "$dist"
-mkdir -p "$dist"/data
-cp firefox/data/*.png "$dist"/data/
-npm run build
-cp firefox/package.json "$dist"
-cp LICENSE.txt "$dist"
-
-npm run xpi
diff --git a/build.bash b/build.bash
new file mode 100755
index 0000000..9666ece
--- /dev/null
+++ b/build.bash
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+set -euo pipefail
+IFS=$'\n\t'
+
+dist="dist/"
+BROWSER=$1
+
+rm -rf "$dist"
+mkdir "$dist"
+find src/ -not -name "*.js" -exec cp '{}' "$dist" \;
+cp LICENSE.txt "$dist"
+npm run build
+
+cd "$dist"
+if [[ $BROWSER = 'chromium' ]]; then
+ # the "applications" key is only supported on Firefox
+ jq 'del(.applications)' manifest.json > mani.json
+ rm manifest.json
+ mv mani.json manifest.json
+fi
+
+zip archiveror.zip *.js *.html *.png manifest.json LICENSE.txt
diff --git a/firefox/data/icon-16-star.png b/firefox/data/icon-16-star.png
deleted file mode 100644
index fca2509..0000000
--- a/firefox/data/icon-16-star.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon-16.png b/firefox/data/icon-16.png
deleted file mode 100644
index 891424a..0000000
--- a/firefox/data/icon-16.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon-32-star.png b/firefox/data/icon-32-star.png
deleted file mode 100644
index 8716061..0000000
--- a/firefox/data/icon-32-star.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon-32.png b/firefox/data/icon-32.png
deleted file mode 100644
index 7dd9d5c..0000000
--- a/firefox/data/icon-32.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon-64-star.png b/firefox/data/icon-64-star.png
deleted file mode 100644
index f31fe23..0000000
--- a/firefox/data/icon-64-star.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon-64.png b/firefox/data/icon-64.png
deleted file mode 100644
index 2d9b79d..0000000
--- a/firefox/data/icon-64.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/icon.png b/firefox/data/icon.png
deleted file mode 100644
index 9f2619c..0000000
--- a/firefox/data/icon.png
+++ /dev/null
Binary files differ
diff --git a/firefox/data/rodentia-icons_help-about.svg b/firefox/data/rodentia-icons_help-about.svg
deleted file mode 100644
index 94b7aea..0000000
--- a/firefox/data/rodentia-icons_help-about.svg
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--part of the rodentia icon theme by sixsixfive released under CC0 (https://creativecommons.org/publicdomain/zero/1.0/) on openclipart-->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48">
- <defs id="0">
- <linearGradient id="2">
- <stop id="D" stop-color="#2e3436" stop-opacity="0.594"/>
- <stop id="E" offset="1" stop-color="#2e3436" stop-opacity="0"/>
- </linearGradient>
- <linearGradient id="3">
- <stop id="F" stop-color="#fff"/>
- <stop id="G" offset="1" stop-color="#fff" stop-opacity="0"/>
- </linearGradient>
- <linearGradient id="4">
- <stop id="H" stop-color="#eeeeec" stop-opacity="0.8"/>
- <stop id="I" offset="1" stop-color="#eeeeec" stop-opacity="0"/>
- </linearGradient>
- <radialGradient cx="24.533" cy="41.15" r="20.841" id="5" xlink:href="#2" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.23714285,0,31.39333)"/>
- <linearGradient y1="5.781" x2="0" y2="42.44" id="6" xlink:href="#4" gradientUnits="userSpaceOnUse"/>
- <linearGradient x1="14.197" y1="-30.75" x2="33.595" y2="72.08" id="7" xlink:href="#3" gradientUnits="userSpaceOnUse"/>
- </defs>
- <g transform="translate(-0.74058872,-1.7067048)" id="1">
- <path d="m 45.37343,41.152306 a 20.840815,4.9422503 0 1 1 -41.6816289,0 20.840815,4.9422503 0 1 1 41.6816289,0 z" transform="matrix(1.0681945,0,0,1.0826698,-1.4650164,-2.6735133)" id="8" opacity="0.8" fill="url(#5)"/>
- <path d="m 23.875,4.1875 a 0.96721468,0.96721468 0 0 0 -0.75,0.59375 l -5.40625,12.5625 -13.625,1.25 a 0.96721468,0.96721468 0 0 0 -0.53125,1.6875 l 10.25,9.03125 -3,13.34375 a 0.96721468,0.96721468 0 0 0 1.4375,1.0625 l 11.75,-7 11.75,6.96875 a 0.96721468,0.96721468 0 0 0 1.4375,-1.0625 l -3,-13.3125 10.25,-9.03125 a 0.96721468,0.96721468 0 0 0 -0.53125,-1.6875 l -13.625,-1.25 L 24.875,4.78125 a 0.96721468,0.96721468 0 0 0 -1,-0.59375 z" id="9" fill="#9c7f00"/>
- <path d="m 11.760485,42.867542 3.12627,-13.899048 -10.7069796,-9.397751 14.1848526,-1.321784 5.62915,-13.0870075 5.640451,13.0821415 14.185995,1.309535 -10.698866,9.406993 3.138271,13.896344 -12.252711,-7.2683 -12.246433,7.278877 z" id="A" fill="#edd400"/>
- <path d="M 24,6.28125 18.78125,18.4375 a 0.45469846,0.45469846 0 0 1 -0.375,0.25 l -13.125,1.21875 9.90625,8.71875 a 0.45469846,0.45469846 0 0 1 0.125,0.4375 l -2.90625,12.875 11.375,-6.75 a 0.45469846,0.45469846 0 0 1 0.4375,0 l 11.375,6.71875 L 32.6875,29.0625 a 0.45469846,0.45469846 0 0 1 0.125,-0.4375 l 9.90625,-8.71875 -13.125,-1.21875 a 0.45469846,0.45469846 0 0 1 -0.375,-0.25 L 24,6.28125 z" id="B" fill="none" stroke="url(#6)"/>
- <path d="M 24,5.15625 18.375,18.25 4.1875,19.5625 13.46875,27.71875 C 21.912793,24.68021 32.956402,22.29177 43.125,20.15625 L 43.8125,19.5625 29.625,18.25 24,5.15625 z" id="C" opacity="0.6" fill="url(#7)"/>
- </g>
-</svg>
diff --git a/firefox/lib/bookmarks.js b/firefox/lib/bookmarks.js
deleted file mode 100644
index c817f94..0000000
--- a/firefox/lib/bookmarks.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// from: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Creating_event_targets (https://archive.today/O62L2)
-/* global XPCOMUtils */
-const {emit, on, once, off} = require("sdk/event/core");
-
-const {Cc, Ci, Cu} = require("chrome");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-const bookmarkService = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]
- .getService(Ci.nsINavBookmarksService);
-
-const bookmarkObserver = {
- onItemAdded: function (aItemId, aFolder, aIndex) {
- emit(exports, "added", bookmarkService.getBookmarkURI(aItemId).spec);
- },
- onItemVisited: function (aItemId, aVisitID, time) {
- emit(exports, "visited", bookmarkService.getBookmarkURI(aItemId).spec);
- },
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
-};
-
-bookmarkService.addObserver(bookmarkObserver, false);
-
-exports.on = on.bind(null, exports);
-exports.once = once.bind(null, exports);
-exports.removeListener = function removeListener(type, listener) {
- off(exports, type, listener);
-};
diff --git a/firefox/lib/main.js b/firefox/lib/main.js
deleted file mode 100644
index ec0d27e..0000000
--- a/firefox/lib/main.js
+++ /dev/null
@@ -1,157 +0,0 @@
-const buttons = require("sdk/ui/button/action");
-const clipboard = require("sdk/clipboard");
-const cm = require("sdk/context-menu");
-const Hotkey = require("sdk/hotkeys").Hotkey;
-const preferences = require("sdk/simple-prefs");
-const Request = require("sdk/request").Request;
-const ss = require("sdk/simple-storage");
-const tabs = require("sdk/tabs");
-
-const bookmarks = require("./bookmarks");
-const { get_archiving_url, is_local, services } = require("./../utils.js");
-
-
-function archive(url) {
- // silently submit url to archive.is
- if (is_local(url))
- return;
- const r = Request({
- url: "https://archive.is/submit/",
- content: {"url": url, "anyway": 1},
- onComplete: function (response) {
- // Extract link from response
- let link = response.text.match(/(https?:\/\/archive.is\/\w+)/)[0];
- postArchive(url, link);
- }
- }).post();
-}
-
-function postArchive(url, link) {
- data[url] = link;
- showArchive(url);
-}
-
-// Store archive links for bookmarks
-if (!ss.storage.data)
- ss.storage.data = {};
-let data = ss.storage.data;
-
-
-const defaultButton = {
- label: "Archive Page",
- icon: {
- "16": "./icon-16.png",
- "32": "./icon-32.png",
- "64": "./icon-64.png"
- }
-};
-
-const showButton = {
- label: "Go to archived page",
- icon: {
- "16": "./icon-16-star.png",
- "32": "./icon-32-star.png",
- "64": "./icon-64-star.png"
- }
-};
-
-let button = buttons.ActionButton({
- id: "archive-button",
- label: defaultButton.label,
- icon: defaultButton.icon,
- onClick: function (state) {
- if (button.state("tab").label === defaultButton.label)
- archivePage();
- else
- tabs.open(data[tabs.activeTab.url]);
- }
-});
-
-function archivePage(service) {
- if (is_local(tabs.activeTab.url))
- return; // internal page, "file://" or "about:" etc.
- if (service === undefined)
- service = preferences.prefs.archiveService;
- let email = preferences.prefs.email;
- let url = get_archiving_url(tabs.activeTab.url, service, email);
-
- tabs.open({
- url: url,
- onReady: function () { // triggers for all new urls opened in this tab
- clipboard.set(tabs.activeTab.url);
- }});
-}
-
-// Make a hotkey to archive current page
-let archiveKey;
-function setArchiveKey() {
- if (archiveKey !== undefined)
- archiveKey.destroy();
- archiveKey = Hotkey({
- combo: preferences.prefs.archiveKey,
- onPress: archivePage
- });
-}
-setArchiveKey();
-
-function showArchive(url) {
- // If we have archived a bookmark, change the icon to reflect this and
- // let the button open the archive link.
- if (url in data) {
- button.state("tab", showButton);
- // and reset the button when we change the page again
- resetButton();
- } else
- autoArchive(url);
-
- function resetButton() {
- const currentTab = tabs.activeTab;
- currentTab.once("ready", function () {
- if (!(tabs.activeTab.url in data)) {
- button.state(currentTab, defaultButton);
- } else
- resetButton();
- });
- }
-}
-
-function autoArchive(url) {
- if (preferences.prefs.archiveBookmarks === true) {
- archive(url);
- }
-}
-
-// right-click context menu
-let menuItems = [];
-for (let i = 0; i < services.length; i++) {
- menuItems.push(cm.Item({
- label: services[i],
- data: services[i]
- }));
-}
-let archiveContextMenu = cm.Menu({
- label: "Archive",
- context: cm.PageContext(),
- contentScript: `self.on("click", function (node, data) {
- self.postMessage(data);
- })`,
- onMessage: function (service) {
- archivePage(service);
- },
- items: menuItems
-});
-
-exports.main = function () {
- // archive newly made bookmarks
- bookmarks.on("added", autoArchive);
- // Inform user we have an archive of their bookmark
- bookmarks.on("visited", showArchive);
- // listen for pref change
- preferences.on("archiveKey", setArchiveKey);
-};
-
-exports.onUnload = function () {
- bookmarks.removeListener("added", archive);
- bookmarks.removeListener("visited", showArchive);
- preferences.removeListener("archiveKey", setArchiveKey);
-};
diff --git a/firefox/package.json b/firefox/package.json
deleted file mode 100644
index ecfaa9e..0000000
--- a/firefox/package.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "name": "archiveror",
- "title": "Archiveror",
- "id": "archiveror@love.addons.mozilla.org",
- "main": "lib/main.js",
- "icon": "resource://archiveror-at-love-dot-addons-dot-mozilla-dot-org/data/icon.png",
- "description": "Archive the webpages you love.",
- "homepage": "https://github.com/rahiel/archiveror",
- "author": "Rahiel Kasim",
- "license": "GPL-3.0+ (https://github.com/rahiel/archiveror/blob/master/LICENSE.txt)",
- "version": "0.5.3",
- "preferences": [
- {
- "name": "archiveService",
- "type": "radio",
- "title": "Archiving Service",
- "description": "The archiving service to use for manual archiving.",
- "value": "archive.is",
- "options": [
- {
- "value": "archive.is",
- "label": "archive.is"
- },
- {
- "value": "archive.org",
- "label": "archive.org (Wayback Machine)"
- },
- {
- "value": "webcitation.org",
- "label": "webcitation.org (requires email, no HTTPS)"
- }
- ]
- },
- {
- "name": "archiveKey",
- "title": "The hotkey to archive the current page with.",
- "description": "Archive the current page. The archive url will be in your clipboard.",
- "type": "string",
- "value": "alt-shift-Y"
- },
- {
- "name": "archiveBookmarks",
- "title": "Archive bookmarks",
- "description": "Enable to automatically archive bookmarks.",
- "type": "bool",
- "value": true
- },
- {
- "name": "email",
- "title": "Email address",
- "description": "The email address used for archiving on webcitation.org. You will receive a link to the archive by email.",
- "type": "string",
- "value": ""
- }
- ],
- "permissions": {
- "private-browsing": true,
- "multiprocess": true
- }
-}
diff --git a/package.json b/package.json
index b3ff808..015a4ec 100644
--- a/package.json
+++ b/package.json
@@ -4,12 +4,10 @@
"author": "Rahiel Kasim",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "lint": "eslint . --ignore-path .gitignore",
- "build": "babel firefox/ utils.js -d dist-firefox && webpack --optimize-minimize",
- "firedev": "babel firefox/ utils.js -d dist-firefox --watch",
- "chromedev": "webpack --watch",
- "firefox": "jpm -b /usr/bin/firefox --addon-dir dist-firefox run",
- "xpi": "jpm --addon-dir dist-firefox xpi"
+ "lint": "eslint . --ignore-path .gitignore && web-ext lint -s ./dist",
+ "build": "webpack --optimize-minimize",
+ "firefox": "web-ext run -s ./dist --verbose",
+ "start": "webpack --watch"
},
"repository": {
"type": "git",
@@ -19,22 +17,17 @@
"url": "https://github.com/rahiel/archiveror/issues"
},
"devDependencies": {
- "babel-cli": "^6.24.1",
+ "babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"eslint": "^3.19.0",
- "jpm": "^1.3.1",
"source-map-loader": "^0.2.1",
+ "web-ext": "^1.9.1",
"webpack": "^2.5.0"
},
"babel": {
"presets": [
- [
- "es2015",
- {
- "modules": false
- }
- ]
+ "es2015"
]
}
}
diff --git a/chromium/archiveror.js b/src/archiveror.js
index 03d5bd5..73b99a3 100644
--- a/chromium/archiveror.js
+++ b/src/archiveror.js
@@ -1,4 +1,4 @@
-import { get_archiving_url, is_local, services } from "./../utils.js";
+import { get_archiving_url, is_local, services, hasPageCapture } from "./utils.js";
function archive_is(url) {
@@ -264,8 +264,10 @@ for (let service of services) {
parentId: menu
});
}
-chrome.contextMenus.create({type: "separator", id: "separator", parentId: menu});
-chrome.contextMenus.create({title: "Save MHTML as...", id: "MHTML", parentId: menu});
+if (hasPageCapture) {
+ chrome.contextMenus.create({type: "separator", id: "separator", parentId: menu});
+ chrome.contextMenus.create({title: "Save MHTML as...", id: "MHTML", parentId: menu});
+}
chrome.contextMenus.onClicked.addListener(function (info, tab) {
if (info.menuItemId === "MHTML")
saveLocal(tab, false);
diff --git a/chromium/icon-128.png b/src/icon-128.png
index 540bb15..540bb15 100644
--- a/chromium/icon-128.png
+++ b/src/icon-128.png
Binary files differ
diff --git a/chromium/icon-16.png b/src/icon-16.png
index a38c267..a38c267 100644
--- a/chromium/icon-16.png
+++ b/src/icon-16.png
Binary files differ
diff --git a/chromium/icon-19.png b/src/icon-19.png
index 5c71813..5c71813 100644
--- a/chromium/icon-19.png
+++ b/src/icon-19.png
Binary files differ
diff --git a/chromium/icon-38.png b/src/icon-38.png
index 326b02b..326b02b 100644
--- a/chromium/icon-38.png
+++ b/src/icon-38.png
Binary files differ
diff --git a/chromium/icon-48.png b/src/icon-48.png
index 1fa3be1..1fa3be1 100644
--- a/chromium/icon-48.png
+++ b/src/icon-48.png
Binary files differ
diff --git a/chromium/manifest.json b/src/manifest.json
index 201d076..d9d361d 100644
--- a/chromium/manifest.json
+++ b/src/manifest.json
@@ -2,8 +2,13 @@
"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.0",
-
+ "version": "0.6.1",
+ "applications": {
+ "gecko": {
+ "id": "archiveror@love.addons.mozilla.org",
+ "strict_min_version": "52.0"
+ }
+ },
"icons": {
"16": "icon-16.png",
"48": "icon-48.png",
diff --git a/firefox/data/matt-icons_media-floppy.svg b/src/matt-icons_media-floppy.svg
index 86aa161..86aa161 100644
--- a/firefox/data/matt-icons_media-floppy.svg
+++ b/src/matt-icons_media-floppy.svg
diff --git a/chromium/options.html b/src/options.html
index 2dac9ed..468883c 100644
--- a/chromium/options.html
+++ b/src/options.html
@@ -25,15 +25,16 @@
<a href="http://webcitation.org/">webcitation.org</a> (requires email, no HTTPS)
</label>
- <h3>Archiving mode</h3>
- <label for="online">
- <input type="radio" name="mode" id="online" value="online">Online
- </label>
- <br>
- <label for="local">
- <input type="radio" name="mode" id="local" value="local">Local (MHTML)
- </label>
-
+ <div id="archivingMode">
+ <h3>Archiving mode</h3>
+ <label for="online">
+ <input type="radio" name="mode" id="online" value="online">Online
+ </label>
+ <br>
+ <label for="local">
+ <input type="radio" name="mode" id="local" value="local">Local (MHTML)
+ </label>
+ </div>
<div id="local_options" style="display:none">
<h3>Archive Location</h3>
diff --git a/chromium/options.js b/src/options.js
index ddda383..2ac70f1 100644
--- a/chromium/options.js
+++ b/src/options.js
@@ -1,3 +1,5 @@
+import { hasPageCapture } from "./utils.js";
+
function save_options() {
function get_options(name) {
@@ -73,3 +75,8 @@ function message(text) {
status.textContent = "";
}, 3000);
}
+
+if (!hasPageCapture) {
+ let div = document.getElementById("archivingMode");
+ div.style.display = "none";
+}
diff --git a/utils.js b/src/utils.js
index fb0f917..a88158d 100644
--- a/utils.js
+++ b/src/utils.js
@@ -1,5 +1,3 @@
-// code shared between the extensions
-
export const services = ["archive.is", "archive.org", "webcitation.org"];
const blacklist = ["file://", "about:", "chrome://", "http://127.0.0.1", "http://localhost"];
@@ -24,8 +22,9 @@ export function get_archiving_url(page, service, email) {
return url;
}
-// exports for firefox
-exports = {
- get_archiving_url: get_archiving_url,
- services: services
-};
+export let hasPageCapture;
+if (chrome.hasOwnProperty("pageCapture")) {
+ hasPageCapture = true;
+} else {
+ hasPageCapture = false;
+}
diff --git a/webpack.config.js b/webpack.config.js
index f626153..4f4e19c 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,8 +1,8 @@
/* global __dirname */
module.exports = {
entry: {
- "dist-chromium/archiveror": "./chromium/archiveror.js",
- "dist-chromium/options": "./chromium/options.js"
+ "dist/archiveror": "./src/archiveror.js",
+ "dist/options": "./src/options.js"
},
output: {
path: __dirname + "/",