// source --> https://crown2kmedia.gr/wp-content/themes/grupi/elementor/js/ct-elementor.js?ver=1.5.6 
( function( $ ) {
    /**
     * @param $scope The Widget wrapper element as a jQuery element
     * @param $ The jQuery alias
     */
    var WidgetCTIlineHandler = function( $scope, $ ) {
    	
        setTimeout(function(){
            $('.elementor > .elementor-element, .elementor-section-wrap > .elementor-element').each(function () {
                var _el_particle = $(this).find(".elementor-container .el-move-parents"),
                    _el_particle_remove = $(this).find(".elementor-widget-wrap .el-move-parents"),
                    _row_particle = $(this).find("> .elementor-container");
                _row_particle.before(_el_particle.clone());
                _el_particle_remove.remove();
            });
            $('.ct-contact-form-layout1.style2 .input-filled').each(function () {
                var icon_input = $(this).find(".input-icon, label"),
                    control_wrap = $(this).find('.wpcf7-form-control');
                control_wrap.before(icon_input.clone());
                icon_input.remove();
            });
        }, 200);

    };

    // Make sure you run this code under Elementor.
    $( window ).on( 'elementor/frontend/init', function() {
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_social.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_particle_animate.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_square_animate.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_contact_form.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_text_below.default', WidgetCTIlineHandler );
    } );
} )( jQuery );
// source --> https://crown2kmedia.gr/wp-content/themes/grupi/elementor/js/ct-inline-css.js?ver=1.5.6 
( function( $ ) {
    /**
     * @param $scope The Widget wrapper element as a jQuery element
     * @param $ The jQuery alias
     */
    var WidgetCTIlineHandler = function( $scope, $ ) {
    	
        var _inline_css = "<style>";
	    $scope.find('.ct-inline-css').each(function () {
	        var _this = $(this);
	        _inline_css += _this.attr("data-css") + " ";
	        _this.remove();
	    });
	    _inline_css += "</style>";
	    $('head').append(_inline_css);

    };

    // Make sure you run this code under Elementor.
    $( window ).on( 'elementor/frontend/init', function() {
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_button.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_text_editor.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_particle_animate.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_square_animate.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_text_below.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_sticky.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_mailchimp_form.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_social.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_heading.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_fancy_box.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_counter.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_progressbar.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_portfolio_grid.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_tabs.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_testimonial_carousel.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_blog_carousel.default', WidgetCTIlineHandler );
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_info_box.default', WidgetCTIlineHandler );
    } );
} )( jQuery );
// source --> https://crown2kmedia.gr/wp-content/themes/grupi/elementor/js/ct-countdown.js?ver=1.5.6 
( function( $ ) {
    /**
     * @param $scope The Widget wrapper element as a jQuery element
     * @param $ The jQuery alias
     */
    var WidgetCTIlineHandler = function( $scope, $ ) {
        
        $('.ct-countdown').each(function () {
            var _this = $(this);
            var count_down = $(this).find('> div').data("count-down");
            setInterval(function () {
                var startDateTime = new Date().getTime();
                var endDateTime = new Date(count_down).getTime();
                var distance = endDateTime - startDateTime;
                var days = Math.floor(distance / (1000 * 60 * 60 * 24));
                var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
                var seconds = Math.floor((distance % (1000 * 60)) / 1000);
                var text_day = days !== 1 ? _this.attr('data-days') : _this.attr('data-day');
                var text_hour = hours !== 1 ? _this.attr('data-hours') : _this.attr('data-hour');
                var text_minu = minutes !== 1 ? _this.attr('data-minutes') : _this.attr('data-minute');
                var text_second = seconds !== 1 ? _this.attr('data-seconds') : _this.attr('data-second');

                var color_from = days !== 1 ? _this.attr('data-color-from') : _this.attr('data-color-from');
                var color_to = days !== 1 ? _this.attr('data-color-to') : _this.attr('data-color-to');

                days = days < 10 ? '0' + days : days;
                hours = hours < 10 ? '0' + hours : hours;
                minutes = minutes < 10 ? '0' + minutes : minutes;
                seconds = seconds < 10 ? '0' + seconds : seconds;

                _this.html(''
                    + '<div class="countdown-item countdown-day"><div class="countdown-item-inner"><div class="countdown-amount">' + days + '</div><div class="countdown-period"><svg xmlns="http://www.w3.org/2000/svg" width="73" height="30" viewBox="0 0 73 30"><defs><linearGradient id="ct-countdown-gradient-icon" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:' + color_from + ';stop-opacity:1" /><stop offset="100%" style="stop-color:' + color_to + ';stop-opacity:1" /></linearGradient></defs><path fill="url(#ct-countdown-gradient-icon)" d="M7.94,26.386a15.012,15.012,0,0,0-6.42,1.669L9.385,9.417c1.46-3.459,4.481-5.62,7.759-5.542H63.6s6.29-.2,8.347-2.071c0.02-.018.047,0,0.038,0.033-0.444,1.417-5.591,17.861-5.7,18.075-0.732,1.406-1.989,5.783-12.1,6.7Z"/></svg>' + text_day + '</div></div></div>'
                    + '<div class="countdown-item countdown-hour"><div class="countdown-item-inner"><div class="countdown-amount">' + hours + '</div><div class="countdown-period"><svg xmlns="http://www.w3.org/2000/svg" width="73" height="30" viewBox="0 0 73 30"><defs><linearGradient id="ct-countdown-gradient-icon" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:' + color_from + ';stop-opacity:1" /><stop offset="100%" style="stop-color:' + color_to + ';stop-opacity:1" /></linearGradient></defs><path fill="url(#ct-countdown-gradient-icon)" d="M7.94,26.386a15.012,15.012,0,0,0-6.42,1.669L9.385,9.417c1.46-3.459,4.481-5.62,7.759-5.542H63.6s6.29-.2,8.347-2.071c0.02-.018.047,0,0.038,0.033-0.444,1.417-5.591,17.861-5.7,18.075-0.732,1.406-1.989,5.783-12.1,6.7Z"/></svg>' + text_hour + '</div></div></div>'
                    + '<div class="countdown-item countdown-minute"><div class="countdown-item-inner"><div class="countdown-amount">' + minutes + '</div><div class="countdown-period"><svg xmlns="http://www.w3.org/2000/svg" width="73" height="30" viewBox="0 0 73 30"><defs><linearGradient id="ct-countdown-gradient-icon" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:' + color_from + ';stop-opacity:1" /><stop offset="100%" style="stop-color:' + color_to + ';stop-opacity:1" /></linearGradient></defs><path fill="url(#ct-countdown-gradient-icon)" d="M7.94,26.386a15.012,15.012,0,0,0-6.42,1.669L9.385,9.417c1.46-3.459,4.481-5.62,7.759-5.542H63.6s6.29-.2,8.347-2.071c0.02-.018.047,0,0.038,0.033-0.444,1.417-5.591,17.861-5.7,18.075-0.732,1.406-1.989,5.783-12.1,6.7Z"/></svg>' + text_minu + '</div></div></div>'
                    + '<div class="countdown-item countdown-second"><div class="countdown-item-inner"><div class="countdown-amount">' + seconds + '</div><div class="countdown-period"><svg xmlns="http://www.w3.org/2000/svg" width="73" height="30" viewBox="0 0 73 30"><defs><linearGradient id="ct-countdown-gradient-icon" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" style="stop-color:' + color_from + ';stop-opacity:1" /><stop offset="100%" style="stop-color:' + color_to + ';stop-opacity:1" /></linearGradient></defs><path fill="url(#ct-countdown-gradient-icon)" d="M7.94,26.386a15.012,15.012,0,0,0-6.42,1.669L9.385,9.417c1.46-3.459,4.481-5.62,7.759-5.542H63.6s6.29-.2,8.347-2.071c0.02-.018.047,0,0.038,0.033-0.444,1.417-5.591,17.861-5.7,18.075-0.732,1.406-1.989,5.783-12.1,6.7Z"/></svg>' + text_second + '</div></div></div>'
                );
            }, 100);
        });

    };

    // Make sure you run this code under Elementor.
    $( window ).on( 'elementor/frontend/init', function() {
        elementorFrontend.hooks.addAction( 'frontend/element_ready/ct_countdown.default', WidgetCTIlineHandler );
    } );
} )( jQuery );