commit b374e5897e874ffa9ddb5e8503a0640d29b8783b Author: A.R-M <20049946+ahmedrmusa@users.noreply.github.com> Date: Sun Jul 21 00:07:19 2024 -0400 Chrome extension to reject cookies diff --git a/README.md b/README.md new file mode 100644 index 0000000..a60dd4b --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/background.js b/background.js new file mode 100644 index 0000000..e69de29 diff --git a/content.js b/content.js new file mode 100644 index 0000000..a3387fe --- /dev/null +++ b/content.js @@ -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); + }); + \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..456f0de --- /dev/null +++ b/manifest.json @@ -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": [""], + "js": ["content.js"], + "run_at": "document_end" + } + ] + } + \ No newline at end of file