Affiliate: Bol.com links verwijderen

document.addEventListener('DOMContentLoaded', function() {
    // Select all anchor tags on the page
    const allLinks = document.getElementsByTagName('a');

    // Patterns to match (add more if needed)
    const affiliatePatterns = [
        'https://partner.bol.com/',
        '//partner.bol.com/',
        'partner.bol.com/'
    ];

    // Convert HTMLCollection to Array for easier iteration
    Array.from(allLinks).forEach(link => {
        const href = link.getAttribute('href');

        if (href) {
            // Check if href matches any affiliate pattern
            const isAffiliateLink = affiliatePatterns.some(pattern => 
                href.includes(pattern)
            );

            if (isAffiliateLink) {
                // Remove href but keep the tag and its content
                link.removeAttribute('href');

                // Optional: Add visual indication it was an affiliate link
                link.style.opacity = '0.7';
                link.style.cursor = 'default';
                link.title = 'Affiliate link removed';
            }
        }
    });
});

Author: jeroen

Just another HTMLy user.