Bunnings Grey Out Marketplace Items

Greys out Bunnings items with "Marketplace" badge

// ==UserScript==
// @name         Bunnings Grey Out Marketplace Items
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Greys out Bunnings items with "Marketplace" badge
// @match        https://www.bunnings.com.au/*
// @grant        none
// @license      GNU GPLv2
// ==/UserScript==

(function () {
    'use strict';

    const greyOutItems = () => {
        // Select all product tiles
        const productTiles = document.querySelectorAll('article.search-product-tile');

        productTiles.forEach(tile => {
            const badge = tile.querySelector('div.badgeText');
            if (badge && badge.textContent.trim().toLowerCase() === 'marketplace') {
                // Apply grey-out styling
                tile.style.opacity = '0.4';
                tile.style.filter = 'grayscale(100%)';
                tile.style.pointerEvents = 'none'; // optional: disable interaction
                tile.style.transition = 'all 0.3s ease-in-out';
                console.log('Grayed out a Marketplace item:', tile);
            }
        });
    };

    // Observe dynamic content loading
    const observer = new MutationObserver(greyOutItems);
    observer.observe(document.body, { childList: true, subtree: true });

    // Initial check
    window.addEventListener('load', greyOutItems);
})();