05/11/2024 22:00:00
// ==UserScript==
// @name Cache les objets "vendu" et "achat en cours" sur leboncoin.fr
// @namespace Tampermonkey Scripts
// @match https://www.leboncoin.fr/recherche*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leboncoin.fr
// @grant none
// @version 1.1
// @author SuperWaper
// @description 05/11/2024 22:00:00
// @license GPLv3
// ==/UserScript==
const observer = new MutationObserver((mutations) => {
const spans = document.querySelectorAll('span');
for (const span of spans) {
// Check one or other pellets
if (span.textContent.includes("Achat en cours") || span.textContent.includes("Vendu")) {
// Catch container div
let o = span.closest('[data-test-id="adcard-outlined"]'); // Container name
// If element exist, hide it
if (o) {
o.style.display = "none";
}
}
}
});
// Observer for all document changes
observer.observe(document.body, { childList: true, subtree: true });