Compare commits
1 Commits
d4e9f6f6d0
...
813eb8ae0d
Author | SHA1 | Date | |
---|---|---|---|
813eb8ae0d |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Cookie Dialog Monster",
|
"name": "Cookie Dialog Monster Mobile",
|
||||||
"version": "8.0.3",
|
"version": "8.0.3",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_appDesc__",
|
"description": "__MSG_appDesc__",
|
||||||
@ -11,19 +11,18 @@
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"default_icon": "assets/icons/off.png",
|
"default_icon": "assets/icons/off.png",
|
||||||
"default_title": "Cookie Dialog Monster"
|
"default_title": "Cookie Dialog Monster Mobile"
|
||||||
},
|
},
|
||||||
"options_page": "options.html",
|
"options_page": "options.html",
|
||||||
"author": "wanhose",
|
"author": "wanhose",
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["scripts/background.js"],
|
"scripts": ["scripts/background.js"]
|
||||||
"service_worker": "scripts/background.js"
|
|
||||||
},
|
},
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "{77e2c00b-e173-4604-863d-01645d8d2826}",
|
"id": "{108d0aea-9bbd-4719-a793-0bc73c1d0064}",
|
||||||
"strict_min_version": "126.0",
|
"strict_min_version": "126.0",
|
||||||
"update_url": "https://www.cookie-dialog-monster.com/mozilla/updates.json"
|
"update_url": "https://www.cookie-dialog-monster.com/mozilla-mobile/updates.json"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
@ -35,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"host_permissions": ["http://*/*", "https://*/*"],
|
"host_permissions": ["http://*/*", "https://*/*"],
|
||||||
"permissions": ["contextMenus", "declarativeNetRequest", "scripting", "storage", "webRequest"],
|
"permissions": ["declarativeNetRequest", "scripting", "storage", "webRequest"],
|
||||||
"web_accessible_resources": [
|
"web_accessible_resources": [
|
||||||
{
|
{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Cookie Dialog Monster > Exclusion List</title>
|
<title>Cookie Dialog Monster Mobile > Exclusion List</title>
|
||||||
<link rel="stylesheet" href="/styles/reset.css" />
|
<link rel="stylesheet" href="/styles/reset.css" />
|
||||||
<link rel="stylesheet" href="/styles/options.css" />
|
<link rel="stylesheet" href="/styles/options.css" />
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter" />
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter" />
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<div>
|
<div>
|
||||||
<h1 class="header-title">
|
<h1 class="header-title">
|
||||||
Cookie Dialog Monster > <span data-i18n="options_exclusionListTitle"></span>
|
Cookie Dialog Monster Mobile > <span data-i18n="options_exclusionListTitle"></span>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1 class="header-title">Cookie Dialog Monster</h1>
|
<h1 class="header-title">Cookie Dialog Monster Mobile</h1>
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<button disabled id="report-button">
|
<button disabled id="report-button">
|
||||||
<svg
|
<svg
|
||||||
|
@ -51,29 +51,11 @@ class RequestManager {
|
|||||||
*/
|
*/
|
||||||
const apiUrl = 'https://api.cookie-dialog-monster.com/rest/v6';
|
const apiUrl = 'https://api.cookie-dialog-monster.com/rest/v6';
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Context menu identifier
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const extensionMenuItemId = 'CDM-MENU';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Context menu identifier
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const reportMenuItemId = 'CDM-REPORT';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Request manager instance
|
* @description Request manager instance
|
||||||
*/
|
*/
|
||||||
const requestManager = new RequestManager();
|
const requestManager = new RequestManager();
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Context menu identifier
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const settingsMenuItemId = 'CDM-SETTINGS';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description A shortcut for browser.scripting
|
* @description A shortcut for browser.scripting
|
||||||
* @type {browser.scripting}
|
* @type {browser.scripting}
|
||||||
@ -125,15 +107,6 @@ async function getData() {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @async
|
|
||||||
* @description Disable report context menu option
|
|
||||||
* @returns {Promise<void>}
|
|
||||||
*/
|
|
||||||
async function disableReport() {
|
|
||||||
return browser.contextMenus.update(reportMenuItemId, { enabled: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Get current hostname
|
* @description Get current hostname
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
@ -263,22 +236,6 @@ async function updateStore(key, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Listen to context menus clicked
|
|
||||||
*/
|
|
||||||
browser.contextMenus.onClicked.addListener((info) => {
|
|
||||||
switch (info.menuItemId) {
|
|
||||||
case reportMenuItemId:
|
|
||||||
browser.action.openPopup();
|
|
||||||
break;
|
|
||||||
case settingsMenuItemId:
|
|
||||||
browser.runtime.openOptionsPage();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Listens to messages
|
* @description Listens to messages
|
||||||
*/
|
*/
|
||||||
@ -288,9 +245,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
|
|||||||
const tabId = sender.tab?.id;
|
const tabId = sender.tab?.id;
|
||||||
|
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
case 'DISABLE_REPORT':
|
|
||||||
if (isPage && tabId !== undefined) disableReport();
|
|
||||||
break;
|
|
||||||
case 'DISABLE_ICON':
|
case 'DISABLE_ICON':
|
||||||
if (isPage && tabId !== undefined) {
|
if (isPage && tabId !== undefined) {
|
||||||
browser.action.setIcon({ path: '/assets/icons/off.png', tabId }, suppressLastError);
|
browser.action.setIcon({ path: '/assets/icons/off.png', tabId }, suppressLastError);
|
||||||
@ -307,11 +261,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
|
|||||||
browser.action.setPopup({ popup: '/popup.html', tabId }, suppressLastError);
|
browser.action.setPopup({ popup: '/popup.html', tabId }, suppressLastError);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ENABLE_REPORT':
|
|
||||||
if (isPage && tabId !== undefined) {
|
|
||||||
browser.contextMenus.update(reportMenuItemId, { enabled: true });
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'GET_DATA':
|
case 'GET_DATA':
|
||||||
getData().then(callback);
|
getData().then(callback);
|
||||||
return true;
|
return true;
|
||||||
@ -356,39 +305,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
|
|||||||
* @description Listens to extension installed
|
* @description Listens to extension installed
|
||||||
*/
|
*/
|
||||||
browser.runtime.onInstalled.addListener((details) => {
|
browser.runtime.onInstalled.addListener((details) => {
|
||||||
const documentUrlPatterns = browser.runtime.getManifest().content_scripts[0].matches;
|
|
||||||
|
|
||||||
browser.contextMenus.create(
|
|
||||||
{
|
|
||||||
contexts: ['all'],
|
|
||||||
documentUrlPatterns,
|
|
||||||
id: extensionMenuItemId,
|
|
||||||
title: 'Cookie Dialog Monster',
|
|
||||||
},
|
|
||||||
suppressLastError
|
|
||||||
);
|
|
||||||
browser.contextMenus.create(
|
|
||||||
{
|
|
||||||
contexts: ['all'],
|
|
||||||
documentUrlPatterns,
|
|
||||||
id: settingsMenuItemId,
|
|
||||||
parentId: extensionMenuItemId,
|
|
||||||
title: browser.i18n.getMessage('contextMenu_settingsOption'),
|
|
||||||
},
|
|
||||||
suppressLastError
|
|
||||||
);
|
|
||||||
browser.contextMenus.create(
|
|
||||||
{
|
|
||||||
contexts: ['all'],
|
|
||||||
documentUrlPatterns,
|
|
||||||
enabled: false,
|
|
||||||
id: reportMenuItemId,
|
|
||||||
parentId: extensionMenuItemId,
|
|
||||||
title: browser.i18n.getMessage('contextMenu_reportOption'),
|
|
||||||
},
|
|
||||||
suppressLastError
|
|
||||||
);
|
|
||||||
|
|
||||||
if (details.reason === 'update') refreshData();
|
if (details.reason === 'update') refreshData();
|
||||||
storage.remove('updateAvailable');
|
storage.remove('updateAvailable');
|
||||||
});
|
});
|
||||||
@ -407,13 +323,6 @@ browser.runtime.onStartup.addListener(() => {
|
|||||||
refreshData();
|
refreshData();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Listen to tab changes
|
|
||||||
*/
|
|
||||||
browser.tabs.onActivated.addListener(() => {
|
|
||||||
disableReport();
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Listen to the moment before a request is made to apply the rules
|
* @description Listen to the moment before a request is made to apply the rules
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
|
Loading…
Reference in New Issue
Block a user