Created
December 18, 2022 21:27
-
-
Save overflowy/b27f9769a14720f7f3dea945b5441816 to your computer and use it in GitHub Desktop.
Immobiliare.it Blacklist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Immobiliare.it Blacklist | |
// @namespace Violentmonkey Scripts | |
// @match https://www.immobiliare.it/* | |
// @grant none | |
// @version 1.0 | |
// @author [email protected] | |
// @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