Disable Blacklisted Domain Redirects \n feat: Blacklist and whitelist domain lists updated.

This commit is contained in:
2024-10-01 09:20:05 +01:00
parent 0d2c91add0
commit 0acbe2294a
2 changed files with 17 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Blacklist Domain Disabler", "name": "Blacklisted Domain Redirect Disabler",
"version": "1.0", "version": "1.0",
"description": "Disables buttons and onclick methods for blacklisted domains on specific sites", "description": "Disables buttons and onclick methods for blacklisted domains on specific sites",
"permissions": [ "permissions": [
@@ -9,11 +9,11 @@
"content_scripts": [ "content_scripts": [
{ {
"matches": [ "matches": [
"*://*.example.org/*", "*://*.linkedin.com/*",
"*://*.example.edu/*", "*://*.indeed.com/*",
"*://*.linkedin.com/*" "*://*.reed.co.uk/*"
], ],
"js": ["content.js"] "js": ["scripts/content.js"]
} }
] ]
} }

View File

@@ -1,7 +1,8 @@
// content.js // content.js
const blacklistedDomains = [ const blacklistedDomains = [
"linkedin.com", "cord.co",
"myworkdayjobs.com",
// Add more domains to the blacklist // Add more domains to the blacklist
]; ];
@@ -12,16 +13,16 @@ function disableBlacklistedLinks() {
const href = element.href || element.onclick?.toString(); const href = element.href || element.onclick?.toString();
if (href) { if (href) {
const url = new URL(href, window.location.origin); const url = new URL(href, window.location.origin);
if (blacklistedDomains.some(domain => url.hostname.includes(domain))) { if (blacklistedDomains.some(domain => url.hostname.includes(domain))) {
element.style.pointerEvents = 'none'; element.style.pointerEvents = 'none';
element.style.opacity = '0.5'; element.style.opacity = '0.5';
element.onclick = null; element.onclick = null;
element.setAttribute('disabled', 'disabled'); element.setAttribute('disabled', 'disabled');
element.title = 'This link has been disabled due to blacklisting'; element.title = 'This link has been disabled due to blacklisting';
element.textContent = 'This link has been disabled due to blacklisting'; element.textContent = 'This link has been disabled due to blacklisting';
} }
} }
}); });
} }