aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md23
-rw-r--r--README.md2
-rw-r--r--background.js23
-rw-r--r--manifest.json5
-rw-r--r--options.html6
5 files changed, 27 insertions, 32 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index c980350..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# How to Contribute
-
-We'd love to accept your patches and contributions to this project. There are
-just a few small guidelines you need to follow.
-
-## Contributor License Agreement
-
-Contributions to this project must be accompanied by a Contributor License
-Agreement. You (or your employer) retain the copyright to your contribution;
-this simply gives us permission to use and redistribute your contributions as
-part of the project. Head over to <https://cla.developers.google.com/> to see
-your current agreements on file or to sign a new one.
-
-You generally only need to submit a CLA once, so if you've already submitted one
-(even if it was for a different project), you probably don't need to do it
-again.
-
-## Code reviews
-
-All submissions, including submissions by project members, require review. We
-use GitHub pull requests for this purpose. Consult
-[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
-information on using pull requests.
diff --git a/README.md b/README.md
index 6f223fa..366d6f3 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,6 @@
This Chrome extension adds a Wayback Machine button to your browser toolbar.
When you click it, it searches for the current tab in the Wayback Machine.
-This is not an official Google product.
-
## Icon
The Wayback Machine Button icon is the
diff --git a/background.js b/background.js
index 4494843..04b8117 100644
--- a/background.js
+++ b/background.js
@@ -12,7 +12,9 @@
// License for the specific language governing permissions and limitations under
// the License.
-chrome.pageAction.onClicked.addListener(function(tab) {
+const MENU_ITEM_OPEN_LINK = 'openLink';
+
+function open(url) {
chrome.storage.sync.get({
clickBehavior: 'search',
}, function(items) {
@@ -20,8 +22,18 @@ chrome.pageAction.onClicked.addListener(function(tab) {
if (items.clickBehavior == 'direct') {
waybackStem = 'https://web.archive.org/web/';
}
- chrome.tabs.update(null, {url: waybackStem + tab.url});
+ chrome.tabs.update(null, {url: waybackStem + url});
});
+}
+
+chrome.pageAction.onClicked.addListener(function(tab) {
+ open(tab.url);
+});
+
+chrome.contextMenus.onClicked.addListener(function(info, tab) {
+ if (info.menuItemId == MENU_ITEM_OPEN_LINK) {
+ open(info.linkUrl);
+ }
});
chrome.runtime.onInstalled.addListener(function() {
@@ -36,4 +48,11 @@ chrome.runtime.onInstalled.addListener(function() {
},
]);
});
+
+ chrome.contextMenus.create({
+ 'id': MENU_ITEM_OPEN_LINK,
+ 'title': 'Open link in the Wayback Machine',
+ 'contexts': ['link'],
+ 'targetUrlPatterns': ['ftp://*/*', 'http://*/*', 'https://*/*'],
+ });
});
diff --git a/manifest.json b/manifest.json
index 7985aeb..b8a3c08 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Wayback Machine Lookup",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "Reopen the current tab in the Wayback Machine",
"icons": {
"16": "icon16.png",
@@ -16,13 +16,14 @@
"persistent": false,
"scripts": ["background.js"]
},
- "minimum_chrome_version": "33",
+ "minimum_chrome_version": "35",
"options_ui": {
"chrome_style": true,
"page": "options.html"
},
"permissions": [
"activeTab",
+ "contextMenus",
"declarativeContent",
"storage"
]
diff --git a/options.html b/options.html
index 1ea1d58..47042af 100644
--- a/options.html
+++ b/options.html
@@ -14,8 +14,8 @@ the License. -->
<!DOCTYPE html>
<title>Wayback Machine Lookup</title>
<form id="clickBehavior">
- Clicking the button:<br>
- <label><input type="radio" name="clickBehavior" value="search"> Searches for the page in the Wayback Machine.</label><br>
- <label><input type="radio" name="clickBehavior" value="direct"> Opens the most recent capture of the page.</label>
+ When searching the Wayback Machine:<br>
+ <label><input type="radio" name="clickBehavior" value="search"> Show all search results.</label><br>
+ <label><input type="radio" name="clickBehavior" value="direct"> Automatically open the most recent capture.</label>
</form>
<script src="options.js"></script>