Skip to content

Instantly share code, notes, and snippets.

@overflowy
Created December 18, 2022 21:27
Show Gist options
  • Save overflowy/b27f9769a14720f7f3dea945b5441816 to your computer and use it in GitHub Desktop.
Save overflowy/b27f9769a14720f7f3dea945b5441816 to your computer and use it in GitHub Desktop.
Immobiliare.it Blacklist
// ==UserScript==
// @name Immobiliare.it Blacklist
// @namespace Violentmonkey Scripts
// @match https://www.immobiliare.it/*
// @grant none
// @version 1.0
// @author overflowy@riseup.net
// @run-at document-idle
// @description 18/12/2022, 21:13:07
// ==/UserScript==
const blacklist = [
"A.P. Tiburtina",
"AFFITTO PRIVATO CIPRO",
"AP Garbatella",
"AP SAN GIOVANNI",
"Belvedere Immobiliare",
"ENNEVI SERVICE SRL",
"Roomless",
"TROVA AFFITTO CENTOCELLE",
"TROVA AFFITTO TUSCOLANA",
];
const removeBlacklisted = () => {
blacklist.forEach((item) => {
let children = document.querySelectorAll(`img[alt="${item}"]`);
children.forEach((child) => {
let closestParent = child.closest(".nd-list__item");
if (closestParent) {
closestParent.remove();
console.log(`Removed occurence: ${item}`);
}
});
});
};
var previousLocation;
setInterval(() => {
let currentLocation = `${location.pathname}${location.search}`;
if (previousLocation !== currentLocation) {
previousLocation = currentLocation;
setTimeout(() => {
removeBlacklisted();
}, 1000);
}
}, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment