1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Added option to ignore APIs

As mentioned in #233
This commit is contained in:
kkapsner 2018-08-24 16:47:27 +02:00
parent 5ced858173
commit da14aaff51
7 changed files with 52 additions and 0 deletions

View File

@ -513,6 +513,16 @@
"message": "Ignorierliste", "message": "Ignorierliste",
"description": "" "description": ""
}, },
"ignoredAPIs_title": {
"message": "Ignorierte APIs",
"description": ""
},
"ignoredAPIs_description": {
"message": "Für die ausgewählten APIs werden keinerlei Benachrichtigungen angezeigt.",
"description": ""
},
"ignorelistDomain": { "ignorelistDomain": {
"message": "verschweige Domain", "message": "verschweige Domain",
"description": "" "description": ""

View File

@ -513,6 +513,15 @@
"message": "Ignore list", "message": "Ignore list",
"description": "" "description": ""
}, },
"ignoredAPIs_title": {
"message": "Ignored APIs",
"description": ""
},
"ignoredAPIs_description": {
"message": "No notifications will be displayed for the selected APIs.",
"description": ""
},
"ignorelistDomain": { "ignorelistDomain": {
"message": "silence domain", "message": "silence domain",
"description": "" "description": ""

View File

@ -36,6 +36,9 @@
const apiMap = new Map(); const apiMap = new Map();
scope.show = function showNotification(tabId, url, api){ scope.show = function showNotification(tabId, url, api){
if (settings.ignoredAPIs[api]){
return;
}
logging.notice("Show notification for tab", tabId); logging.notice("Show notification for tab", tabId);
if ( if (
settings.get("showNotifications", url) && settings.get("showNotifications", url) &&

View File

@ -182,6 +182,15 @@
name: "ignoreList", name: "ignoreList",
defaultValue: "" defaultValue: ""
}, },
{
name: "ignoredAPIs",
defaultValue: {},
keys: [
"canvas",
"audio",
],
defaultKeyValue: false
},
{ {
name: "showCallingFile", name: "showCallingFile",
defaultValue: false defaultValue: false

View File

@ -235,6 +235,23 @@
} }
] ]
}, },
{
"name": "ignoredAPIs",
"displayDependencies": [
{
"showNotifications": [true],
"displayAdvancedSettings": [true]
},
{
"displayBadge": [true],
"displayAdvancedSettings": [true]
},
{
"highlightBrowserAction": ["color", "blink"],
"displayAdvancedSettings": [true]
}
]
},
{ {
"name": "showCallingFile", "name": "showCallingFile",
"displayDependencies": { "displayDependencies": {

View File

@ -195,6 +195,9 @@
else { else {
for (var delta = 0; delta < 20 && i + delta < length; delta += 1){ for (var delta = 0; delta < 20 && i + delta < length; delta += 1){
let notification = notifications[i + delta]; let notification = notifications[i + delta];
if (settings.ignoredAPIs[notification.api]){
continue;
}
verbose(notification); verbose(notification);
notification.url = new URL(notification.url); notification.url = new URL(notification.url);
domainNotification( domainNotification(

View File

@ -10,6 +10,7 @@ Version 0.5.3:
- added option to control browser action icon on notifications - added option to control browser action icon on notifications
- added theme for browser action popup - added theme for browser action popup
- added badge - added badge
- added option to ignore APIs
fixes: fixes:
- CSP did not work properly for worker-src - CSP did not work properly for worker-src