// source --> https://jardinsdupontrouge.com/wp-content/plugins/stars-testimonials-with-slider-and-masonry-grid/js/grid.js?ver=6.9.4 
jQuery(document).ready(function () {
    set_testimonial_height();
});
jQuery(window).on('load', function () {
    set_testimonial_height();
});
jQuery(window).on('resize', function () {
    set_testimonial_height();
});

function set_testimonial_height() {
    if (jQuery(".premio-testimonials-grid .pre-testimonials-content").length) {

        jQuery(".premio-testimonials-grid .blockquote").height("auto");
        jQuery(".premio-testimonials-grid .premio-testimonials-content").each(function () {
            jQuery(this).find(".blockquote").height("auto");
            maxHeight = 0;
            jQuery(this).find(".blockquote").each(function () {
                thisHeight = parseInt(jQuery(this).height());
                if (thisHeight > maxHeight) {
                    maxHeight = thisHeight;
                }
            });
            jQuery(this).find(".blockquote").height(maxHeight);
        });

        jQuery(".premio-testimonials-grid .pre-testimonials-content").height("auto");
        jQuery(".premio-testimonials-grid .premio-testimonials-content").each(function () {
            jQuery(this).find(".pre-testimonials-content").height("auto");
            maxHeight = 0;
            jQuery(this).find(".pre-testimonials-content").each(function () {
                thisHeight = parseInt(jQuery(this).height());
                if (thisHeight > maxHeight) {
                    maxHeight = thisHeight;
                }
            });
            jQuery(this).find(".pre-testimonials-content").height(maxHeight);
        });
    }
};
// source --> https://jardinsdupontrouge.com/wp-content/plugins/stars-testimonials-with-slider-and-masonry-grid/js/read-more.js?ver=6.9.4 
(function (factory) {
    "use strict";
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    }
    else if(typeof module !== 'undefined' && module.exports) {
        module.exports = factory(require('jquery'));
    }
    else {
        factory(jQuery);
    }
}(function ($, undefined) {
    $(document).ready(function(){
        $(document).on("click", ".stars-testimonials .stars-read-more", function(e){
            e.preventDefault();
            addStarsPopupCode();
            var htmlContent = $(this).closest(".premio-read-more-content").find(".read-more-content").html();
            $("#stars-content-area").html(htmlContent);
            $("#star-testimonial-box").addClass("active");
            setTimeout(function(){
                $(".star-testimonial-content-area").addClass("active");
            }, 100);
        });

        $(document).on("click", "#star-testimonial-box", function(){

            $("#star-testimonial-content-area").removeClass("active");
            setTimeout(function(){
                $("#star-testimonial-box").removeClass("active");
            }, 100);
        });

        $(document).on("click", ".close-stars-testimonial", function(e){
            e.stopPropagation();
            e.preventDefault();
            $("#star-testimonial-content-area").removeClass("active");
            setTimeout(function(){
                $("#star-testimonial-box").removeClass("active");
            }, 100);
        });

        $(document).on("click", "#star-testimonial-content", function(e){
            e.stopPropagation();
        });
    });

    function addStarsPopupCode() {
        if(!$("#star-testimonial-box").length) {
            $("body").append("<div id='star-testimonial-box' class='star-testimonial-box'></div>");
            $("#star-testimonial-box").append("<div id='star-testimonial-content' class='star-testimonial-content'></div>");
            $("#star-testimonial-content").append("<div id='star-testimonial-content-area' class='star-testimonial-content-area'></div>");
            $("#star-testimonial-content-area").append("<a href='#' class='close-stars-testimonial'><span></span></a>");
            $("#star-testimonial-content-area").append("<div id='stars-content-area' class='stars-content-area'></div>");
        }
    }
}));