From 0acbe2294a630bae3d99f2abba8d7974acb2d356 Mon Sep 17 00:00:00 2001 From: teddy Date: Tue, 1 Oct 2024 09:20:05 +0100 Subject: [PATCH] Disable Blacklisted Domain Redirects \n feat: Blacklist and whitelist domain lists updated. --- .../manifest.json | 10 ++++---- .../scripts/content.js | 23 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) rename {disable_workday => disable_blacklisted_domain_redirects}/manifest.json (60%) rename {disable_workday => disable_blacklisted_domain_redirects}/scripts/content.js (50%) diff --git a/disable_workday/manifest.json b/disable_blacklisted_domain_redirects/manifest.json similarity index 60% rename from disable_workday/manifest.json rename to disable_blacklisted_domain_redirects/manifest.json index 5cdad37..dec70ce 100644 --- a/disable_workday/manifest.json +++ b/disable_blacklisted_domain_redirects/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "name": "Blacklist Domain Disabler", + "name": "Blacklisted Domain Redirect Disabler", "version": "1.0", "description": "Disables buttons and onclick methods for blacklisted domains on specific sites", "permissions": [ @@ -9,11 +9,11 @@ "content_scripts": [ { "matches": [ - "*://*.example.org/*", - "*://*.example.edu/*", - "*://*.linkedin.com/*" + "*://*.linkedin.com/*", + "*://*.indeed.com/*", + "*://*.reed.co.uk/*" ], - "js": ["content.js"] + "js": ["scripts/content.js"] } ] } diff --git a/disable_workday/scripts/content.js b/disable_blacklisted_domain_redirects/scripts/content.js similarity index 50% rename from disable_workday/scripts/content.js rename to disable_blacklisted_domain_redirects/scripts/content.js index f5ab95b..994f654 100644 --- a/disable_workday/scripts/content.js +++ b/disable_blacklisted_domain_redirects/scripts/content.js @@ -1,7 +1,8 @@ // content.js const blacklistedDomains = [ - "linkedin.com", + "cord.co", + "myworkdayjobs.com", // Add more domains to the blacklist ]; @@ -12,16 +13,16 @@ function disableBlacklistedLinks() { const href = element.href || element.onclick?.toString(); if (href) { - const url = new URL(href, window.location.origin); - - if (blacklistedDomains.some(domain => url.hostname.includes(domain))) { - element.style.pointerEvents = 'none'; - element.style.opacity = '0.5'; - element.onclick = null; - element.setAttribute('disabled', 'disabled'); - element.title = 'This link has been disabled due to blacklisting'; - element.textContent = 'This link has been disabled due to blacklisting'; - } + const url = new URL(href, window.location.origin); + + if (blacklistedDomains.some(domain => url.hostname.includes(domain))) { + element.style.pointerEvents = 'none'; + element.style.opacity = '0.5'; + element.onclick = null; + element.setAttribute('disabled', 'disabled'); + element.title = 'This link has been disabled due to blacklisting'; + element.textContent = 'This link has been disabled due to blacklisting'; + } } }); }