Hide Specific Flag Cards on Speaky

Hides all user cards with specified flags on Speaky

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Hide Specific Flag Cards on Speaky
// @description  Hides all user cards with specified flags on Speaky
// @match        *://*.speaky.com/*
// @grant        none
// @version 0.0.1.20250303131759
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function() {
    'use strict';

    const flagIds = [
        "flag-icons-ma", // Morocco
        "flag-icons-us", // US
        "flag-icons-dz", // Algeria
        "flag-icons-ae", // UAE
        "flag-icons-ca", // Canada
        "flag-icons-gb", // UK
        "flag-icons-sa", // Saudi Arabia
        "flag-icons-iq", // Iraq
        "flag-icons-eg", // Egypt
        "flag-icons-au"  // Australia
    ];

    function hideFlagCards() {
        document.querySelectorAll('li.c-PJLV').forEach(li => {
            flagIds.forEach(flagId => {
                if (li.querySelector(`svg[id="${flagId}"]`)) {
                    li.style.display = 'none';
                }
            });
        });
    }

    function hideLanguageCards() {
        document.querySelectorAll('li.c-PJLV').forEach(li => {
            const speaksAr = li.querySelector('.c-kgeLBM-jWbhrq-speaks-true')?.textContent.includes('ar');
            const learnsArElement = li.querySelector('.c-kgeLBM-gEsXtw-learns-true');
            const learnsAr = learnsArElement ? learnsArElement.textContent.includes('ar') : false;
            if (speaksAr || !learnsArElement || !learnsAr) {
                li.style.display = 'none';
            }
        });
    }

    function hideCards() {
        hideFlagCards();
        hideLanguageCards();
    }

    // Run initially
    hideCards();

    // Observe mutations
    const observer = new MutationObserver(hideCards);
    observer.observe(document.body, { childList: true, subtree: true });
})();