Skip to content

Instantly share code, notes, and snippets.

@Zeryther
Created March 29, 2023 15:53
Show Gist options
  • Save Zeryther/807158c70a2f30f8b07c5d9814c976e4 to your computer and use it in GitHub Desktop.
Save Zeryther/807158c70a2f30f8b07c5d9814c976e4 to your computer and use it in GitHub Desktop.
Hide Vonovia from immowelt - Vonovia nicht auf Immowelt anzeigen lassen
// ==UserScript==
// @name Hide Vonovia
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.immowelt.de/liste/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=immowelt.de
// @grant none
// ==/UserScript==
(function() {
'use strict';
function hideBlacklistedProviders() {
const providerName = document.querySelectorAll('div[class^="ProviderName-"] > span, div[class^="providerName-"] > span');
const blacklist = ["Vonovia"];
//console.log("Hiding blacklisted providers", blacklist);
providerName.forEach(span => {
const text = span.textContent.toLowerCase();
for (const blacklistItem of blacklist) {
if (text.includes(blacklistItem.toLowerCase())) {
// remove list item
let currentElement = span;
while (currentElement.parentElement) {
currentElement = currentElement.parentElement;
if (currentElement.classList && currentElement.classList.value.match(/^EstateItem-/)) {
currentElement.style.display = "none";
break;
}
}
break;
}
}
});
}
hideBlacklistedProviders();
setInterval(hideBlacklistedProviders, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment