vericudebuget commited on
Commit
f70b5d4
·
verified ·
1 Parent(s): 7910a8e

Delete brainly

Browse files
brainly/background.js DELETED
@@ -1,28 +0,0 @@
1
- chrome.runtime.onInstalled.addListener(() => {
2
- chrome.storage.sync.set({ blockedSites: [] });
3
- updateDeclarativeNetRequestRules();
4
- });
5
-
6
- chrome.storage.onChanged.addListener((changes, namespace) => {
7
- if (namespace === 'sync' && changes.blockedSites) {
8
- updateDeclarativeNetRequestRules();
9
- }
10
- });
11
-
12
- async function updateDeclarativeNetRequestRules() {
13
- const { blockedSites } = await chrome.storage.sync.get('blockedSites');
14
- const rules = blockedSites.map((site, index) => ({
15
- id: index + 1,
16
- priority: 1,
17
- action: { type: 'block' },
18
- condition: {
19
- urlFilter: `||${site}^`,
20
- resourceTypes: ['script']
21
- }
22
- }));
23
-
24
- await chrome.declarativeNetRequest.updateDynamicRules({
25
- removeRuleIds: rules.map(rule => rule.id),
26
- addRules: rules
27
- });
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
brainly/icons/64.png DELETED
Binary file (964 Bytes)
 
brainly/icons/icon128.png DELETED
Binary file (2.43 kB)
 
brainly/icons/icon16.png DELETED
Binary file (1.03 kB)
 
brainly/icons/icon48.png DELETED
Binary file (964 Bytes)
 
brainly/manifest.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "manifest_version": 3,
3
- "name": "JavaScript Disabler",
4
- "version": "1.0",
5
- "description": "Disables JavaScript on specified websites and their subdomains.",
6
- "permissions": [
7
- "storage",
8
- "declarativeNetRequest"
9
- ],
10
- "host_permissions": [
11
- "<all_urls>"
12
- ],
13
- "background": {
14
- "service_worker": "background.js"
15
- },
16
- "action": {
17
- "default_popup": "popup.html",
18
- "default_icon": {
19
- "16": "icons/icon16.png",
20
- "48": "icons/icon48.png",
21
- "128": "icons/icon128.png"
22
- }
23
- },
24
- "icons": {
25
- "16": "icons/icon16.png",
26
- "48": "icons/icon48.png",
27
- "128": "icons/icon128.png"
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
brainly/popup.html DELETED
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>JavaScript Disabler</title>
5
- <style>
6
- body { width: 300px; padding: 10px; }
7
- ul { list-style-type: none; padding: 0; }
8
- li { margin-bottom: 5px; }
9
- button { margin-left: 5px; }
10
- </style>
11
- </head>
12
- <body>
13
- <h1>JavaScript Disabler</h1>
14
- <input type="text" id="site" placeholder="Enter domain (e.g., example.com)">
15
- <button id="addSite">Add Site</button>
16
- <h2>Blocked Sites:</h2>
17
- <ul id="siteList"></ul>
18
- <script src="popup.js"></script>
19
- </body>
20
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
brainly/popup.js DELETED
@@ -1,41 +0,0 @@
1
- document.getElementById('addSite').addEventListener('click', addSite);
2
-
3
- function addSite() {
4
- const site = document.getElementById('site').value.trim();
5
- if (site) {
6
- chrome.storage.sync.get('blockedSites', (data) => {
7
- const blockedSites = new Set(data.blockedSites || []);
8
- blockedSites.add(site);
9
- chrome.storage.sync.set({ blockedSites: Array.from(blockedSites) }, () => {
10
- updateSiteList();
11
- document.getElementById('site').value = '';
12
- });
13
- });
14
- }
15
- }
16
-
17
- function removeSite(site) {
18
- chrome.storage.sync.get('blockedSites', (data) => {
19
- const blockedSites = new Set(data.blockedSites || []);
20
- blockedSites.delete(site);
21
- chrome.storage.sync.set({ blockedSites: Array.from(blockedSites) }, updateSiteList);
22
- });
23
- }
24
-
25
- function updateSiteList() {
26
- chrome.storage.sync.get('blockedSites', (data) => {
27
- const siteList = document.getElementById('siteList');
28
- siteList.innerHTML = '';
29
- (data.blockedSites || []).forEach((site) => {
30
- const li = document.createElement('li');
31
- li.textContent = site;
32
- const removeButton = document.createElement('button');
33
- removeButton.textContent = 'Remove';
34
- removeButton.onclick = () => removeSite(site);
35
- li.appendChild(removeButton);
36
- siteList.appendChild(li);
37
- });
38
- });
39
- }
40
-
41
- updateSiteList();