LeBonCode

Améliore l'UX sur LebonCoin (affiche les téls, masque les annonces vendus et en cours d'achat)

2022-12-10 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         LeBonCode
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Améliore l'UX sur LebonCoin (affiche les téls, masque les annonces vendus et en cours d'achat)
// @author       Yohann Nizon
// @match        https://www.leboncoin.fr/*
// @icon         https://www.leboncoin.fr/_next/static/media/favicon-16.fe104e12.png
// @grant        none
// @license MIT
// ==/UserScript==

let showPhone = true;
let showVendu = true;
let showAchat = true;

window.setInterval(function() {
    const phoneButtons = document.querySelectorAll('button[title="voir le numéro"]');

    if (phoneButtons && showPhone) {
        const delay = Math.floor(2000 + Math.random() * 1000); // Random delay between 2 et 3 seconds
        setTimeout(() => phoneButtons.forEach(button => button.click()), delay);
    }

    let nbRemove = 0;
    let mosaic = document.querySelectorAll('div[data-test-id=listing-mosaic]');
    if (mosaic.length == 1){
        for (const div of mosaic[0].childNodes) {
            if (div.innerText.indexOf('Vendu') > -1 && showVendu) {
                nbRemove++;
                div.remove();
            }
            if (div.innerText.indexOf('Achat en cours') > -1 && showAchat) {
                nbRemove++;
                div.remove();
            }
        }
    } else {
        let divs = document.getElementsByTagName('div');
        for (let div of divs) {
            if (div.className.indexOf('styles_adCard') > -1){
                if (div.innerText.indexOf('Vendu') > -1 && showVendu) {
                    nbRemove++;
                    div.remove();
                }
                if (div.innerText.indexOf('Achat en cours') > -1 && showAchat) {
                    nbRemove++;
                    div.remove();
                }
            }
        }
    }
    console.log(nbRemove + " annonce(s) supprimée(s)");
}, 1000);