Skip to content

Commit a008dcf

Browse files
authored
Add files via upload
1 parent cf57a49 commit a008dcf

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

UnblockBloomberg/background.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
chrome.runtime.onInstalled.addListener(() => {
2+
console.log("Extension installed");
3+
});

UnblockBloomberg/content.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
window.onload = function() {
2+
// Function to hide an element by ID
3+
function hideElementById(id) {
4+
const element = document.getElementById(id);
5+
if (element) {
6+
element.style.display = 'none';
7+
}
8+
}
9+
10+
// Function to hide elements by class name prefix
11+
function hideElementsByClassPrefix(prefix) {
12+
const elements = document.querySelectorAll(`[class^="${prefix}"]`);
13+
elements.forEach(element => {
14+
element.style.display = 'none';
15+
});
16+
}
17+
18+
// Function to remove ::after pseudo-element styles
19+
function removeAfterPseudoElement(attribute, value) {
20+
const style = document.createElement('style');
21+
style.innerHTML = `[${attribute}="${value}"]::after { content: none !important; }`;
22+
document.head.appendChild(style);
23+
}
24+
25+
// Function to overwrite overflow-y for class names starting with a prefix
26+
function overwriteOverflowYForClassPrefix(prefix) {
27+
const elements = document.querySelectorAll(`[class^="${prefix}"]`);
28+
elements.forEach(element => {
29+
element.style.setProperty('overflow-y', 'auto', 'important');
30+
element.style.setProperty('height', 'auto', 'important');
31+
});
32+
}
33+
34+
function overwriteMaskImageForClassSubstring(substring) {
35+
const elements = document.querySelectorAll(`[class*="${substring}"]`);
36+
elements.forEach(element => {
37+
element.style.maskImage = 'none';
38+
});
39+
}
40+
41+
// Function to remove all class names from the html tag
42+
function removeAllClassNamesFromHtml() {
43+
const htmlElement = document.documentElement;
44+
htmlElement.className = '';
45+
}
46+
47+
// Function to remove all class names from the body tag
48+
function removeAllClassNamesFromBody() {
49+
const bodyElement = document.body;
50+
bodyElement.className = '';
51+
}
52+
removeAfterPseudoElement('data-component', 'nav');
53+
setInterval(() => {
54+
// Example usage
55+
hideElementById('fortress-container-root');
56+
hideElementsByClassPrefix('media-ui-FullWidthAd');
57+
overwriteOverflowYForClassPrefix('media-ui-LeaderboardAd');
58+
overwriteMaskImageForClassSubstring('Blur');
59+
removeAllClassNamesFromHtml();
60+
removeAllClassNamesFromBody();
61+
}, 500);
62+
}

UnblockBloomberg/manifest.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "UnblockBloomberg",
4+
"version": "1.0",
5+
"description": "Remove ads and footer banner elements and disable blur layer.",
6+
"permissions": ["activeTab", "scripting"],
7+
"background": {
8+
"service_worker": "background.js"
9+
},
10+
"content_scripts": [
11+
{
12+
"matches": ["*://*.bloomberg.com/*"],
13+
"js": ["content.js"]
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)