aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBenjamin Barenblat <bbaren@google.com>2018-09-10 10:12:33 -0400
committerBenjamin Barenblat <bbaren@google.com>2018-09-10 10:12:33 -0400
commitb5bb57ff01f88bd9de411e1d963cfae2e285c82a (patch)
treed26c7ca2fa56ad6e48d791e8b169cf3186fbbc9f
parent6842b33e8157bfab60096001355c76ac06b63e6b (diff)
Gray out button on URL schemes the Wayback Machine doesn’t indexv1.0.1
Switch from a browser action to a page action, and disable the page action on some pages clearly not accessible through the Wayback Machine (e.g., pages under chrome://).
-rw-r--r--background.js16
-rw-r--r--manifest.json11
2 files changed, 22 insertions, 5 deletions
diff --git a/background.js b/background.js
index 30d924a..6beab65 100644
--- a/background.js
+++ b/background.js
@@ -12,6 +12,20 @@
// License for the specific language governing permissions and limitations under
// the License.
-chrome.browserAction.onClicked.addListener(function(tab) {
+chrome.pageAction.onClicked.addListener(function(tab) {
chrome.tabs.update(null, {url: 'https://web.archive.org/web/*/' + tab.url});
});
+
+chrome.runtime.onInstalled.addListener(function() {
+ chrome.declarativeContent.onPageChanged.removeRules(null, function() {
+ chrome.declarativeContent.onPageChanged.addRules([
+ {
+ conditions: [
+ new chrome.declarativeContent.PageStateMatcher(
+ {pageUrl: {schemes: ['ftp', 'http', 'https']}}),
+ ],
+ actions: [new chrome.declarativeContent.ShowPageAction()],
+ },
+ ]);
+ });
+});
diff --git a/manifest.json b/manifest.json
index 3fcba3c..586022a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,14 +1,14 @@
{
"manifest_version": 2,
"name": "Wayback Machine Lookup",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "Reopen the current tab in the Wayback Machine",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
- "browser_action": {
+ "page_action": {
"default_title": "Reopen the current tab in the Wayback Machine"
},
"author": "Benjamin Barenblat <bbaren@google.com>",
@@ -16,6 +16,9 @@
"persistent": false,
"scripts": ["background.js"]
},
- "minimum_chrome_version": "21",
- "permissions": ["activeTab"]
+ "minimum_chrome_version": "33",
+ "permissions": [
+ "activeTab",
+ "declarativeContent"
+ ]
}