diff --git a/_locales/de/messages.json b/_locales/de/messages.json
index e4c9479..46a7c4b 100644
--- a/_locales/de/messages.json
+++ b/_locales/de/messages.json
@@ -808,5 +808,18 @@
"resetSettings_confirm": {
"message": "Sind Sie sicher, dass Sie alle Einstellungen zurücksetzen wollen?",
"description": ""
+ },
+
+ "browserAction_settings": {
+ "message": "Einstellungen",
+ "description": ""
+ },
+ "browserAction_test": {
+ "message": "Testen",
+ "description": ""
+ },
+ "browserAction_reportIssue": {
+ "message": "Problem melden",
+ "description": ""
}
}
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index f4f6d4a..5bcfd43 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -808,5 +808,18 @@
"resetSettings_confirm": {
"message": "Are you sure you want to reset all settings?",
"description": ""
+ },
+
+ "browserAction_settings": {
+ "message": "Settings",
+ "description": ""
+ },
+ "browserAction_test": {
+ "message": "Test",
+ "description": ""
+ },
+ "browserAction_reportIssue": {
+ "message": "Report issue",
+ "description": ""
}
}
\ No newline at end of file
diff --git a/browserAction/browserAction.css b/browserAction/browserAction.css
new file mode 100644
index 0000000..268c8c9
--- /dev/null
+++ b/browserAction/browserAction.css
@@ -0,0 +1,43 @@
+body {
+ padding: 1em;
+}
+
+div {
+ display: block;
+}
+
+.action {
+ display: block;
+ padding: 0.5em;
+ background-color: white;
+ border: 1px solid #e0e0e0;
+ cursor: pointer;
+ width: 100%;
+ text-align: left;
+ height: auto;
+ z-index: 1;
+ position: relative;
+}
+
+.action + .action {
+ border-top-width: 0;
+}
+
+.action:first-child {
+ border-radius: 3px 3px 0 0;
+}
+
+.action:last-child {
+ border-radius: 0 0 3px 3px;
+}
+
+.action:active, .action:hover, .action:focus {
+ z-index: 10;
+ background-color: #eaeaea;
+}
+
+.action img {
+ vertical-align: middle;
+ max-height: 19px;
+ margin-right: 0.25em;
+}
\ No newline at end of file
diff --git a/browserAction/browserAction.html b/browserAction/browserAction.html
new file mode 100644
index 0000000..4ebf2f6
--- /dev/null
+++ b/browserAction/browserAction.html
@@ -0,0 +1,16 @@
+
+
+
+ CanvasBlocker browser action
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/browserAction/browserAction.js b/browserAction/browserAction.js
new file mode 100644
index 0000000..7f76d42
--- /dev/null
+++ b/browserAction/browserAction.js
@@ -0,0 +1,65 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+(function(){
+ "use strict";
+
+ const logging = require("./logging");
+ const settings = require("./settings");
+ logging.message("Opened browser action");
+
+ settings.onloaded(function(){
+ var actions = document.getElementById("actions");
+
+ [
+ {
+ label: "settings",
+ icon: browser.extension.getURL("icons/pageAction-showOptions.svg"),
+ action: function(){
+ if (browser.runtime && browser.runtime.openOptionsPage){
+ browser.runtime.openOptionsPage();
+ }
+ else {
+ window.open(browser.extension.getURL("options/options.html"), "_blank");
+ }
+ }
+ },
+ {
+ label: "test",
+ advanced: true,
+ icon: browser.extension.getURL("icons/browserAction-test.svg"),
+ action: function(){
+ window.open("https://canvasblocker.kkapsner.de/test", "_blank");
+ }
+ },
+ {
+ label: "reportIssue",
+ icon: browser.extension.getURL("icons/browserAction-reportIssue.svg"),
+ action: function(){
+ window.open("https://github.com/kkapsner/CanvasBlocker/issues", "_blank");
+ }
+ },
+ ].forEach(function(action){
+ logging.verbose("Action", action);
+ if (action.advanced && !settings.displayAdvancedSettings){
+ logging.verbose("Hiding advanced action");
+ return;
+ }
+ var actionButton = document.createElement("button");
+ actionButton.className = "action";
+
+ var icon = document.createElement("img");
+ icon.src = action.icon;
+
+ actionButton.appendChild(icon);
+
+ actionButton.appendChild(
+ document.createTextNode(
+ browser.i18n.getMessage("browserAction_" + action.label) || action.label
+ )
+ );
+ actionButton.addEventListener("click", action.action);
+ actions.appendChild(actionButton);
+ });
+ });
+}());
\ No newline at end of file
diff --git a/icons/browserAction-reportIssue.svg b/icons/browserAction-reportIssue.svg
new file mode 100644
index 0000000..841043a
--- /dev/null
+++ b/icons/browserAction-reportIssue.svg
@@ -0,0 +1,101 @@
+
+
+
+
diff --git a/icons/browserAction-test.svg b/icons/browserAction-test.svg
new file mode 100644
index 0000000..635bd96
--- /dev/null
+++ b/icons/browserAction-test.svg
@@ -0,0 +1,104 @@
+
+
+
+
diff --git a/manifest.json b/manifest.json
index bb22159..135f6d9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -53,6 +53,15 @@
"browser_style": true,
"page": "options/options.html"
},
+ "browser_action": {
+ "browser_style": true,
+ "default_icon": {
+ "19": "icons/icon.svg",
+ "38": "icons/icon.svg"
+ },
+ "default_title": "CanvasBlocker",
+ "default_popup": "browserAction/browserAction.html"
+ },
"page_action": {
"browser_style": true,
"default_icon": {
diff --git a/releaseNotes.txt b/releaseNotes.txt
index 4abd1d8..503d902 100644
--- a/releaseNotes.txt
+++ b/releaseNotes.txt
@@ -5,6 +5,7 @@ Version 0.5.2:
new features:
- separate persistent random numbers for incognito windows
(resets when closing all incognito windows - like cookies do)
+ - added toolbar icon
fixes:
- optimized CSP