Compare commits

...

3 Commits

13 changed files with 20 additions and 110 deletions

View File

@ -10,7 +10,6 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"minify": "^9.2.0",
"rimraf": "^5.0.5"
},
"engines": {

View File

@ -3,14 +3,14 @@
input="./src"
output="./build"
mkdir $output
mkdir -p "$output"
for file in $(find $input -name "*.css" -o -name "*.html" -o -name "*.js" | sed "s|^$input/||"); do
for file in $(find "$input" -name "*.css" -o -name "*.html" -o -name "*.js" | sed "s|^$input/||"); do
input_file="$input/$file"
output_file="$output/$file"
mkdir -p "${output_file%/*}" && touch "$output_file"
yarn minify $input_file > $output_file
mkdir -p "${output_file%/*}"
cp "$input_file" "$output_file"
done
cp -nR "$input/." $output
cp -nR "$input/." "$output"

View File

@ -4,4 +4,4 @@ path=$(pwd)
version=$(jq -r '.version' "$path/build/manifest.json")
cd "$path/build" || exit
zip -r "$path/$(basename $path)-$version.zip" . -x */\.* *.git* \.* *.md *.sh *.zip
zip -r "$path/$version.zip" . -x */\.* *.git* \.* *.md *.sh *.zip

View File

@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Cookie Dialog Monster",
"version": "8.0.0",
"name": "Cookie Dialog Monster Mobile",
"version": "8.0.1",
"default_locale": "en",
"description": "__MSG_appDesc__",
"icons": {
@ -11,19 +11,18 @@
},
"action": {
"default_icon": "assets/icons/off.png",
"default_title": "Cookie Dialog Monster"
"default_title": "Cookie Dialog Monster Mobile"
},
"options_page": "options.html",
"author": "wanhose",
"background": {
"scripts": ["scripts/background.js"],
"service_worker": "scripts/background.js"
"scripts": ["scripts/background.js"]
},
"browser_specific_settings": {
"gecko": {
"id": "{77e2c00b-e173-4604-863d-01645d8d2826}",
"id": "{108d0aea-9bbd-4719-a793-0bc73c1d0064}",
"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": [
@ -57,7 +56,7 @@
}
],
"host_permissions": ["http://*/*", "https://*/*"],
"permissions": ["contextMenus", "declarativeNetRequest", "scripting", "storage", "webRequest"],
"permissions": ["declarativeNetRequest", "scripting", "storage", "webRequest"],
"web_accessible_resources": [
{
"matches": ["http://*/*", "https://*/*"],

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<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/options.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter" />
@ -13,7 +13,7 @@
<header>
<div>
<h1 class="header-title">
Cookie Dialog Monster > <span data-i18n="options_exclusionListTitle"></span>
Cookie Dialog Monster Mobile > <span data-i18n="options_exclusionListTitle"></span>
</h1>
</div>
</header>

View File

@ -10,7 +10,7 @@
</head>
<body>
<header>
<h1 class="header-title">Cookie Dialog Monster</h1>
<h1 class="header-title">Cookie Dialog Monster Mobile</h1>
<div class="header-actions">
<button disabled id="report-button">
<svg

View File

@ -51,29 +51,11 @@ class RequestManager {
*/
const apiUrl = 'https://api.cookie-dialog-monster.com/rest/v5';
/**
* @description Context menu identifier
* @type {string}
*/
const extensionMenuItemId = 'CDM-MENU';
/**
* @description Context menu identifier
* @type {string}
*/
const reportMenuItemId = 'CDM-REPORT';
/**
* @description Request manager instance
*/
const requestManager = new RequestManager();
/**
* @description Context menu identifier
* @type {string}
*/
const settingsMenuItemId = 'CDM-SETTINGS';
/**
* @description A shortcut for browser.scripting
* @type {browser.scripting}
@ -125,15 +107,6 @@ async function getData() {
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
* @param {string} url
@ -291,22 +264,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
*/
@ -316,9 +273,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
const tabId = sender.tab?.id;
switch (message.type) {
case 'DISABLE_REPORT':
if (isPage && tabId !== undefined) disableReport();
break;
case 'DISABLE_ICON':
if (isPage && tabId !== undefined) {
browser.action.setIcon({ path: '/assets/icons/off.png', tabId }, suppressLastError);
@ -335,11 +289,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
browser.action.setPopup({ popup: '/popup.html', tabId }, suppressLastError);
}
break;
case 'ENABLE_REPORT':
if (isPage && tabId !== undefined) {
browser.contextMenus.update(reportMenuItemId, { enabled: true });
}
break;
case 'GET_DATA':
getData().then(callback);
return true;
@ -385,39 +334,6 @@ browser.runtime.onMessage.addListener((message, sender, callback) => {
* @description Listens to extension installed
*/
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') {
storage.remove('updateAvailable');
}
@ -437,13 +353,6 @@ browser.runtime.onStartup.addListener(() => {
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
* @returns {Promise<void>}

View File

@ -57,6 +57,10 @@
{
"version": "7.3.2",
"update_link": "https://www.cookie-dialog-monster.com/releases/7.3.2.xpi"
},
{
"version": "8.0.1",
"update_link": "https://www.cookie-dialog-monster.com/releases/8.0.1.xpi"
}
]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1147,7 +1147,6 @@ __metadata:
eslint: "npm:^8.57.0"
eslint-config-prettier: "npm:^9.1.0"
eslint-plugin-prettier: "npm:^5.1.3"
minify: "npm:^9.2.0"
rimraf: "npm:^5.0.5"
languageName: unknown
linkType: soft