Skip to content

Commit

Permalink
Remove ad div in Outlook when adblocking is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
agam778 committed Aug 9, 2024
1 parent c2c9100 commit fd7d61b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,39 @@ app.on("web-contents-created", (event, contents) => {
}
}
}
BrowserWindow.getAllWindows().forEach((window) => {
if (window.webContents.getURL().includes("outlook.live.com")) {
window.webContents
.executeJavaScript(
`
const observer = new MutationObserver((mutationsList) => {
let adElementFound = false;
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const adElement = document.querySelector('div.GssDD');
if (adElement) {
adElement.remove();
adElementFound = true;
}
}
}
if (adElementFound) {
observer.disconnect();
}
});
observer.observe(document.body, { childList: true, subtree: true });
const adElement = document.querySelector('div.GssDD');
if (adElement) {
adElement.remove();
observer.disconnect();
}
`
)
.catch();
}
});
contents.insertCSS(
`
::-webkit-scrollbar {
Expand Down

0 comments on commit fd7d61b

Please sign in to comment.