diff --git a/background.js b/background.js index e69de29..9fa68db 100644 --- a/background.js +++ b/background.js @@ -0,0 +1,4 @@ +chrome.runtime.onInstalled.addListener(() => { + console.log("Reject Cookies extension installed."); + }); + \ No newline at end of file diff --git a/content.js b/content.js index 060eaaa..5510aaa 100644 --- a/content.js +++ b/content.js @@ -3,8 +3,6 @@ chrome.storage.sync.get('selectors', (data) => { 'button[aria-label="reject"]', 'button[data-testid="reject"]', 'button[class*="reject"]' - - // Add selectors as needed ]; function clickButton(selector) { diff --git a/icon128.png b/images/icon128.png similarity index 100% rename from icon128.png rename to images/icon128.png diff --git a/icon16.png b/images/icon16.png similarity index 100% rename from icon16.png rename to images/icon16.png diff --git a/icon48.png b/images/icon48.png similarity index 100% rename from icon48.png rename to images/icon48.png diff --git a/manifest.json b/manifest.json index 456f0de..fe3c5ce 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "Reject Cookies", "version": "1.0", "description": "Automatically reject all cookie popups.", - "permissions": ["activeTab", "scripting"], + "permissions": ["activeTab", "storage", "scripting"], "background": { "service_worker": "background.js" }, @@ -13,6 +13,14 @@ "js": ["content.js"], "run_at": "document_end" } - ] + ], + "action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/icon16.png", + "48": "images/icon48.png", + "128": "images/icon128.png" + } + } } \ No newline at end of file diff --git a/popup.html b/popup.html index 5214f4d..77e727f 100644 --- a/popup.html +++ b/popup.html @@ -3,19 +3,75 @@ Reject Cookies Settings

Reject Cookies Settings

-

Enter selectors to reject cookies, one per line:

+

+ Enter CSS selectors for cookie rejection buttons. One per line. +
For example: button[aria-label="reject"] +

-

+

+
+

Current Selectors:

+ +
diff --git a/popup.js b/popup.js index e69de29..252b23e 100644 --- a/popup.js +++ b/popup.js @@ -0,0 +1,38 @@ +document.addEventListener('DOMContentLoaded', () => { + const textarea = document.getElementById('selectors'); + const saveButton = document.getElementById('save'); + const status = document.getElementById('status'); + const selectorsList = document.getElementById('selectors-list'); + + // Load existing selectors + chrome.storage.sync.get('selectors', (data) => { + const selectors = data.selectors || []; + textarea.value = selectors.join('\n'); + updateSelectorsList(selectors); + }); + + // Save button click event + saveButton.addEventListener('click', () => { + const selectors = textarea.value.split('\n').map(s => s.trim()).filter(s => s.length > 0); + + // Simple validation for selectors + if (selectors.length === 0) { + status.textContent = 'Please enter at least one selector.'; + status.style.color = 'red'; + return; + } + + chrome.storage.sync.set({ selectors: selectors }, () => { + status.textContent = 'Selectors saved!'; + status.style.color = '#28a745'; + updateSelectorsList(selectors); + setTimeout(() => status.textContent = '', 2000); + }); + }); + + // Update the list of selectors in the popup + function updateSelectorsList(selectors) { + selectorsList.innerHTML = selectors.map(selector => `
  • ${selector}
  • `).join(''); + } + }); + \ No newline at end of file