$(document).ready(function () {
    if ($('.similar-products-v2').length) {
        var counter = 0;
        
        function init() {
            //var lines = window.innerWidth < 768 ? 5 : 7;
            var clampTexts = $('.product-card__description-text');
            var clampExtras = clampTexts.closest('.swiper-wrapper').find('.product-card__content');
            var arr = Wick.Clamping.variableArray(clampExtras);
            var maxValue = 0;
            for (var k = 0; k < arr.length; k++) {
                if (arr[k] > maxValue) {
                    maxValue = arr[k];
                }
            }
            Wick.Clamping.flush(clampTexts);
            Wick.Clamping.clampAll(clampTexts, {id: counter + 'one', lines: maxValue + 3, variableLines: arr});
            counter++;
        }
        
        init();
        
        $(window).on('resize', _.debounce(function () {
            init();
        }, 250));
    }
});
