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,
"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"]
}
]
}

View File

@@ -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';
}
}
});
}