Chrome extension to reject cookies

This commit is contained in:
A.R-M 2024-07-21 00:07:19 -04:00
commit b374e5897e
4 changed files with 57 additions and 0 deletions

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# Reject Cookies Extension
## Overview
A Chrome extension to reject cookies. Interacts with cookie consent popups on websites based on predefined selectors.
## Features
- Rejects cookie consent popups
- Configurable with multiple selectors to handle different types of popups.
## Installation
1. **Clone the repository** or **download** the code.
2. **Open Chrome** and go to `chrome://extensions/.`
4. Enable **Developer Mode** by toggling the switch in the top-right corner.
5. Click **Load unpacked** and select the project directory (~/Downloads/reject-cookies).
The extension should now appear in your list of extensions.

0
background.js Normal file
View File

17
content.js Normal file
View File

@ -0,0 +1,17 @@
const selectors = [
'button[aria-label="reject"]',
'button[data-testid="reject"]',
'button[class*="reject"]',
];
function clickButton(selector) {
const button = document.querySelector(selector);
if (button) {
button.click();
}
}
selectors.forEach(selector => {
clickButton(selector);
});

18
manifest.json Normal file
View File

@ -0,0 +1,18 @@
{
"manifest_version": 3,
"name": "Reject Cookies",
"version": "1.0",
"description": "Automatically reject all cookie popups.",
"permissions": ["activeTab", "scripting"],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"],
"run_at": "document_end"
}
]
}