// 

(() => {

    let search = document.getElementById("search_all_posts");

    let whole_data = document.querySelectorAll("div.card-cont");

    let filtered_data = Array.from(whole_data).filter(element => {
        return element.style.display === 'block';
    });


    search.addEventListener("input", () => {
        let value = search.value.toLowerCase();
        whole_data.forEach(ele => {
            
            // if (ele.style.display == 'block') {

                let title = ele.querySelector("span.title-card").innerText.toLowerCase();
                let desc = ele.querySelector("div.card-body-text").innerText.toLowerCase();

                if (!title.includes(value) && !desc.includes(value)) {
                    ele.style.display = 'none';
                } else {
                    ele.style.display = 'block';
                }
            // }
        });
        // console.log(value)
    });

})();
