jQuery(document).ready(function ($) {

    // For Multi Page/Post/Category

    

    // for PAGE multi

    $("#wpwab-all-pages-multi").click(function () {
        if ($(this).is(":checked")) {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-page-multi").hide();
        } else {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-page-multi").show();
        }
    });

    var page_value = ($('#wpwab-page-details-multi').val());

    function multi_page_detail_ajax () {
        var page_num = ($(this).data('page-num')) ? $(this).data('page-num') : 1;
        var selected_pages = $('#wpwab-selected-pages-multi').val();

        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_multi_settings_pages',
                selected_pages: selected_pages,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-multi-settings-page').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    }

    if(page_value=='page'){
        multi_page_detail_ajax();
    }
    
    $('body').on('click', '#wpwab-specific-pages-multi,.wpwab-page-trigger', function () {
        multi_page_detail_ajax();
    });


    $('body').on('click', '.wpwab-pagecheckbox-multi', function () {
        var page_id = $(this).val();
        var selected_pages = $('#wpwab-selected-pages-multi').val();
        //alert(selected_pages);
        if(selected_pages == ''){
            selected_pages_array = [];
        }else{
            var selected_pages_array = selected_pages.split(',');
        }
        if ($(this).is(':checked')) {
            if ($.inArray(page_id, selected_pages_array) == -1) {
                selected_pages_array.push(page_id);
            }
        } else {
            if ($.inArray(page_id, selected_pages_array) != -1) {
                var index = $.inArray(page_id, selected_pages_array);
                selected_pages_array.splice(index, 1);
            }
        }
        if (selected_pages_array.length > 0) {
            $('#wpwab-selected-pages-multi').val(selected_pages_array.join());
        }
    });

    // end PAGE multi

    // for POST multi
    var post_value = $('#wpwab-post-details-multi').val();

    function multi_post_detail_ajax () {
        var page_num = ($(this).data('post-num')) ? $(this).data('post-num') : 1;
        var selected_posts = $('#wpwab-selected-posts-multi').val();
        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_multi_settings_posts',
                selected_posts: selected_posts,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-multi-settings-post').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    }

    if(post_value=='post'){
        multi_post_detail_ajax();
    }
    
    $('body').on('click', '#wpwab-specific-post-multi,.wpwab-post-trigger', function () {
        multi_post_detail_ajax();
    });


    $('body').on('click', '.wpwab-postcheckbox-multi', function () {
        var post_id = $(this).val();
        var selected_posts = $('#wpwab-selected-posts-multi').val();
        //alert(selected_posts);
        if(selected_posts == ''){
            selected_posts_array = [];
        }else{
            var selected_posts_array = selected_posts.split(',');
        }
        if ($(this).is(':checked')) {
            if ($.inArray(post_id, selected_posts_array) == -1) {
                selected_posts_array.push(post_id);
            }
        } else {
            if ($.inArray(post_id, selected_posts_array) != -1) {
                var index = $.inArray(post_id, selected_posts_array);
                selected_posts_array.splice(index, 1);
            }
        }
        if (selected_posts_array.length > 0) {
            $('#wpwab-selected-posts-multi').val(selected_posts_array.join());
        }
    });

    $("#wpwab-all-post-multi").click(function () {
        
        if ($(this).is(":checked")) {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-post-multi").hide();
        } else {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-post-multi").show();
        }
    });

    // end POST multi



    var post_value=($('#wpwab-post-details').val());

    if(post_value=='post'){
        var page_num=($(this).data('page-num'))?$(this).data('page-num'):1;
        var selected_posts = $('#wpwab-selected-posts').val();
        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_floating_button',
                selected_posts: selected_posts,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-floating-button-post').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    }
    // reset button click
    $('.wpwab-settings-reset-button'). on('click', function(e) {
        if (!confirm('Are you sure you want to reset the default settings?')) return false;
        $.ajax({
            url: ajaxurl,
            type: "POST",
            data: {
                _wpajaxnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_reset_button',
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                var url = response;
                $(location).attr('href', url); 
            }
        });
    });

    $('body').on('click','#wpwab-specific-post,.wpwab-post-trigger',function () {
        var page_num=($(this).data('page-num'))?$(this).data('page-num'):1;
        var selected_posts = $('#wpwab-selected-posts').val();
        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_floating_button',
                selected_posts: selected_posts,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-floating-button-post').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    });

    $('body').on('click', '.wpwab-checkbox-hide-show', function(){
        var $this = $(this);
        if ($this.is(':checked')) {
            $this.closest('.wpwab-checkbox-outer-wrap').find(".wpwab-checkbox-hide-show-options-wrap").fadeIn();
            $this.closest('.wpwab-settings-wrap').find("#wpwab-slide-animation").hide();

        } else {
            $this.closest('.wpwab-checkbox-outer-wrap').find(".wpwab-checkbox-hide-show-options-wrap").fadeOut();
            $this.closest('.wpwab-settings-wrap').find("#wpwab-slide-animation").show();
        }
    });

    var page_value=($('#wpwab-page-details').val());
    if(page_value=='page'){
        var page_num = ($(this).data('page-num')) ? $(this).data('page-num') : 1;
        var selected_pages = $('#wpwab-selected-pages').val();

        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_floating_button_pages',
                selected_pages: selected_pages,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-floating-button-page').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    }
    
    $('body').on('click', '#wpwab-specific-pages,.wpwab-page-trigger', function () {
        var page_num = ($(this).data('page-num')) ? $(this).data('page-num') : 1;
        var selected_pages = $(this).closest('.wpwab-content-wrap').find('.wpwab-selected-pages').val();

        // alert(page_num);
        // alert(selected_pages);

        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            type: "POST",
            data: {
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_floating_button_pages',
                selected_pages: selected_pages,
                page_num: page_num
            },
            beforeSend: function () {
                $(".wpwab-ajax-loader").show();
            },
            success: function (response) {
                $('.wpwab-floating-button-page').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    });

    $('#wpwab-specific-category').on('click', function () {
        var select_type = $(this).val();
        $.ajax({
            url: wpwab_backend_js_params.ajax_url,
            data: {
                select_type: select_type,
                _wpnonce: wpwab_backend_js_params.ajax_nonce,
                action: 'wpwab_floating_button_category',
                beforeSend: function () {
                    $(".wpwab-ajax-loader").show();
                },
            },
            type: "POST",
            success: function (response) {
                $('.wpwab-floating-button-category').html(response);
                $(".wpwab-ajax-loader").hide();
            }
        });
    });

    $('.wpwab-desktop').click(function () {
        if ($(this).is(':checked')){
            $(this).val('show');
        } else{
            $(this).val('hide');
        }
    });

    $('.wpwab-mobile').click(function () {
        if ($(this).is(':checked')){
            $(this).val('show');
        } else{
            $(this).val('hide');
        }
    });



    $("#wpwab-all-pages").click(function () {
        if ($(this).is(":checked")) {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-page").hide();
        } else {
            $(this).closest('.wpwab-field-wrap').find(".wpwab-field-page").show();
        }
    });

    $("#wpwab-all-post").click(function () {
        if ($(this).is(":checked")) {
            $(".wpwab-field-post").hide();
        } else {
            $(".wpwab-field-post").show();
        }
    });

    $("#wpwab-specific-post").click(function () {
        if ($(this).is(":checked")) {
            $("#wpwab-display-post").show();
        } else {
            $("#wpwab-display-post").hide();
        }
    });

    $("#wpwab-all-post").click(function () {
        if ($(this).is(":checked")) {
            $("#wpwab-display-post").hide();
        } else {
            $("#wpwab-display-post").show();
        }
    });

    $("#wpwab-specific-category").click(function () {
        if ($(this).is(":checked")) {
            $("#wpwab-display-category").show();
        } else {
            $("#wpwab-display-category").hide();
        }
    });

    $("#wpwab-all-category").click(function () {
        if ($(this).is(":checked")) {
            $("#wpwab-display-category").hide();
        } else {
            $("#wpwab-display-category").show();
        }
    });





    $('#wpwab-button-option').change(function () {
        $value_optn = this.value;
        if ($value_optn === 'menu-button') {
            $('.wpwab-sticky-wrap').hide();
        }
        else {
            $('.wpwab-sticky-wrap').show();
        }
    });

    $('.wpwab_short_codeDisp').click(function () {
        $(this).select();
        $(this).focus();
        document.execCommand('copy');
        $(this).siblings('.wpwab_copied-msg').show().delay(1000).fadeOut();
    });

    $('.cpa-color-picker').wpColorPicker();

    $(function () {
        $("#wpwab_button_text").click(function () {
            if ($(this).is(":checked")) {
                $("#wpwab_show_button_text").show();
            } else {
                $("#wpwab_show_button_text").hide();
            }
        });
    });

    $(function () {
        $("#wpwab_tooltip_text").click(function () {
            if ($(this).is(":checked")) {
                $("#wpwab_tooltip_text_value").show();
            } else {
                $("#wpwab_tooltip_text_value").hide();
            }
        });
    });

    $('.wpwab-tab-tigger').click(function () {
        $('.wpwab-tab-tigger').removeClass('wpwab-active');
        $(this).addClass('wpwab-active');
        var active_tab_key = $('.wpwab-tab-tigger.wpwab-active').data('menu');
        $('.wpwab-settings-wrap').removeClass('wpwab-active-container');
        $('.wpwab-settings-wrap[data-menu-ref="' + active_tab_key + '"]').addClass('wpwab-active-container');
    });

    $('.wpwab-floating-tab-tigger').click(function () {
        $('.wpwab-floating-tab-tigger').removeClass('wpwab-active');
        $(this).addClass('wpwab-active');
        var active_tab_key = $('.wpwab-floating-tab-tigger.wpwab-active').data('menu');
        $('.wpwab-floating-settings-wrap').removeClass('wpwab-floating-active-container');
        $('.wpwab-floating-settings-wrap[data-menu-ref="' + active_tab_key + '"]').addClass('wpwab-floating-active-container');
    });

    $('.wpwab-shortcode-tab-tigger').click(function () {
        $('.wpwab-shortcode-tab-tigger').removeClass('wpwab-active');
        $(this).addClass('wpwab-active');
        var active_tab_key = $('.wpwab-shortcode-tab-tigger.wpwab-active').data('menu');
        $('.wpwab-shortcode-settings-wrap').removeClass('wpwab-shortcode-active-container');
        $('.wpwab-shortcode-settings-wrap[data-menu-ref="' + active_tab_key + '"]').addClass('wpwab-shortcode-active-container');
    });

    $('.wpwab-menu-tab-tigger').click(function () {
        $('.wpwab-menu-tab-tigger').removeClass('wpwab-active');
        $(this).addClass('wpwab-active');
        var active_tab_key = $('.wpwab-menu-tab-tigger.wpwab-active').data('menu');
        $('.wpwab-menu-settings-wrap').removeClass('wpwab-menu-active-container');
        $('.wpwab-menu-settings-wrap[data-menu-ref="' + active_tab_key + '"]').addClass('wpwab-menu-active-container');
    });

    $('.wpwab-multiple-tab-tigger').click(function () {
        $('.wpwab-multiple-tab-tigger').removeClass('wpwab-active');
        $(this).addClass('wpwab-active');
        var active_tab_key = $('.wpwab-multiple-tab-tigger.wpwab-active').data('menu');
        $('.wpwab-multiple-settings-wrap').removeClass('wpwab-multiple-active-container');
        $('.wpwab-multiple-settings-wrap[data-menu-ref="' + active_tab_key + '"]').addClass('wpwab-multiple-active-container');
    });
    
    $('#wpwab-button-template').change(function () {
        var template_value = $(this).val();
        var array_break = template_value.split('-');
        var current_id = array_break[1];
        $('.wpwab-grid-common').hide();
        $('#wpwab-grid-demo-' + current_id).show();
    });

    $('#wpwab-button-template-menu').change(function () {
        var template_value = $(this).val();
        var array_break = template_value.split('-');
        var current_id = array_break[1];
        $('.wpwab-grid-common-menu').hide();
        $('#wpwab-grid-demo-menu-' + current_id).show();
    });

    $('#wpwab-button-template-floating').change(function () {
        var template_value = $(this).val();
        var array_break = template_value.split('-');
        var current_id = array_break[1];
        $('.wpwab-floating-common').hide();
        $('#wpwab-floating-demo-' + current_id).show();
    });

    $('.wpwab-field').on('change', '#wpwab-button-location', function () {
        var template_value = $(this).find('option:selected').data('img');
        $(this).closest('.wpwab-field').find('.wpwab-position-common img').attr('src', template_value);
    });
    
    $('.wpwab-field').on('change', '#wpwab-button-location-shortcode', function () {
        var template_value = $(this).find('option:selected').data('img');
        $(this).closest('.wpwab-field').find('.wpwab-shortcode-common img').attr('src', template_value);
    });
    
    $('.wpwab-field').on('change', '#wpwab-button-animation', function () {
        conceptName = $(this).val();
        positiomName = $('#button-position-select').val();
        var defaultclasses ='wpwab-button-wrap wpwab-button-template-1 wpwab-text-icon-both wpwab-button-postion-right wpwab-text-inner-wrapper  ';
        $('.wpwab-button-wrap').removeClass().addClass(defaultclasses + conceptName);
    });

    $('.wpwab-field').on('change', '#wpwab-button-animation-shortcode', function () {
        conceptName = $(this).val();
        positiomName = $('#button-position-select').val();
        var defaultclasses ='wpwab-button-wrap wpwab-button-template-1 wpwab-text-icon-both wpwab-button-postion-right wpwab-text-inner-wrapper  ';
        $('.wpwab-button-wrap').removeClass().addClass(defaultclasses + conceptName);
    });

    $( "#wpwab-button-template-menu" ).on( "click", function() {
        $('.menu-template').hide();
    });

    $( "#wpwab-button-template" ).on( "click", function() {
        $('.menu-template').hide();
    });

    $( "#wpwab-button-template-floating" ).on( "click", function() {
        $('.menu-template').hide();
    });

    $(".wpwab-shortcode-button").click(function () {

        var enable_button = ($("input[name=wpwab_enable_button]").attr('checked')) ? 'show' : 'hide';
        var enable_desktop = ($("input[name=wpwab_enable_desktop_button]").attr('checked')) ? 'show' : 'hide';
        var enable_mobile = ($("input[name=wpwab_enable_mobile_button]").attr('checked')) ? 'show' : 'hide';
        var button_template = $("#wpwab-button-template option:selected").val();
        var button_animation = $("#wpwab-button-animation option:selected").val();


        var animation_type = $('input[name="animation_type"]:checked').val();
        var sliding_animation = ($("input[name=sliding_animation]").attr('checked')) ? '1' : '';

        //alert(animation_type);
        //alert(sliding_animation);

        var button_orientation = $('input[name="wpwab-button-orientation-shortcode"]:checked').val();
        if (button_orientation == 'floating'){
            var button_location = $("#wpwab-button-location-shortcode option:selected").val();
        }else{
            var button_location = 'default';
        }

        var button_text_only = ($("input[name=wpwab_enable_textonly_button]").attr('checked')) ? 'show' : 'hide';
        var button_color = ($("#btn_color").val());
        var text_color = $("#text_color").val();
        var icon_background_color = ($("#icon_background_color").val());
        var icon_color = ($("#icon_color_shortcode").val());
        var contact_number = ($("#wpwab_shortcode_contact_number").val());
        var button_text_enable = ($("input[name=wpwab_button_text_enable]").attr('checked')) ? 'show' : 'hide';
        var button_text = ($("#wpwab_button_text_value_shortcode").val());
        var button_description = $('input[name="button_description"]').val();
        var button_text_position = $('input[name="button_text_align_shortcode"]:checked').val();
        var enable_tooltip = ($("input[name=wpwab_enable_tooltip_shortcode]").attr('checked')) ? 'show' : 'hide';
        var tooltip_text = $('input[name="wpwab_tooltip_name"]').val();
        var button_animation = $('#wpwab-button-animation-shortcode option:selected').val();
        var enable_sticky = ($("input[name=wpwab_enable_sticky_button]").attr('checked')) ? 'show' : 'hide';

        $("#wpwab_generated_shortcode").html("[wp_whatsapp_button" + 
            " " + "enable_desktop='" + enable_desktop + "'" + 
            " " + "enable_mobile='" + enable_mobile + "'" + 
            " " + "button_template='" + button_template + "'" + 
            " " + "button_color='" + button_color + "'" + 
            " " + "icon_color='" + icon_color + "'" + 
            " " + "contact_number='" + contact_number + "'" + 
            " " + "button_location='" + button_location + "'" + 
            " " + "button_enable_text='" + button_text_enable + "'" + 
            " " + "button_text='" + button_text + "'" + 
            " " + "button_description='" + button_description + "'" + 
            " " + "button_text_position='" + button_text_position + "'" + 
            " " + "button_text_only='" + button_text_only + "'" + 
            " " + "tooltip_text='" + tooltip_text + "'" + 
            " " + "button_animation='" + button_animation + "'" + 
            " " + "animation_type='" + animation_type + "'" + 
            " " +"sliding_animation='" + sliding_animation + "'" + 
            " " +  "enable_tooltip='" + enable_tooltip + "'" + 
            " " + "enable_sticky='" + enable_sticky + "'" + 
            " " + "icon_background_color='" + icon_background_color + "'" + 
            " " + "text_color='" + text_color + "']"
        );
    });

    $('body').on('click', '.wpwab-pagecheckbox', function () {
        var page_id = $(this).val();
        var selected_pages = $('#wpwab-selected-pages').val();
        if(selected_pages == ''){
            selected_pages_array = [];
        }else{
            var selected_pages_array = selected_pages.split(',');
        }
        if ($(this).is(':checked')) {
            if ($.inArray(page_id, selected_pages_array) == -1) {
                selected_pages_array.push(page_id);
            }
        } else {
            if ($.inArray(page_id, selected_pages_array) != -1) {
                var index = $.inArray(page_id, selected_pages_array);
                selected_pages_array.splice(index, 1);
            }
        }
        if (selected_pages_array.length > 0) {
            $('#wpwab-selected-pages').val(selected_pages_array.join());
        }
    });

    $('body').on('click', '.wpwab-postcheckbox', function () {
        var page_id = $(this).val();
        var selected_posts = $('#wpwab-selected-posts').val();
        if(selected_posts == ''){
            selected_posts_array = [];
        }else{
            var selected_posts_array = selected_posts.split(',');
        }
        if ($(this).is(':checked')) {
            if ($.inArray(page_id, selected_posts_array) == -1) {
                selected_posts_array.push(page_id);
            }
        } else {
            if ($.inArray(page_id, selected_posts_array) != -1) {
                var index = $.inArray(page_id, selected_posts_array);
                selected_posts_array.splice(index, 1);
            }
        }
        if (selected_posts_array.length > 0) {
            $('#wpwab-selected-posts').val(selected_posts_array.join());
        }
    });
    $(".wpwab_contact_number").intlTelInput();


    $('#wpwab-add-contact').click(function (e) {
        
        $.ajax({
            type: 'post',
            url: wpwab_backend_js_params.ajax_url,
            data: {
                action: 'wpwab_append_elements',
                _wpnonce: wpwab_backend_js_params.ajax_nonce
            },
            beforeSend: function (xhr) {
            },
            success: function (res) {
                console.log(res);
                res = $.parseJSON(res);
                var div_to_append = res;
                $('.wpwab-custom-wrapper').append(div_to_append);
            }
        });
        
    });

    $('.wpwab-media-uploader').on('click', function () {
        // alert('hey');
        var selector = $(this);
        var image = wp.media({
            title: 'Upload Image',
            // multiple: true if you want to upload multiple files at once
            multiple: false
        }).open()
                .on('select', function (e) {
                    // This will return the selected image from the Media Uploader, the result is an object
                    var uploaded_image = image.state().get('selection').first();
                    // We convert uploaded_image to a JSON object to make accessing it easier
                    // Output to the console uploaded_image
                    console.log(uploaded_image);
                    var image_url = uploaded_image.toJSON().url;
                    // Let's assign the url value to the input field
                    selector.parent().find('input[type="text"]').val(image_url);
                    //selector.closest('.wpwab-custom-value').find('.wpwab-custom-preview img').attr('src', image_url);
                    selector.closest('.wpwab-field-wrap').find('.wpwab-custom-preview').html('<img src="' + image_url + '"/>');
                });
    });

    $('.wpwab-icon').on('change',function () {
        var value = $(this).val();
        if (value == 'custom'){
            $(this).closest('.wpwab-content-wrap').find('.wpwab-upload-wrapper').show();
        } else {
            $(this).closest('.wpwab-content-wrap').find('.wpwab-upload-wrapper').hide();
        }

    });

    $('body').on('click', '.wpwab-abc', function (e) {
        var $target = $(e.target);
        if(!$target.hasClass('wpwab-elements-delete-trigger')){
            if ($(this).closest('.wpwab-content-wrap').find('span').hasClass("fa-chevron-down") ) {
                    var selector = $(this);
                    $(this).addClass('wpwab-element-border');
                    selector.children('.wpwab-element-action-buttons').find('span').removeClass().addClass("fa fa-chevron-up");
                    $(this).closest('.wpwab-content-wrap').find('.wpwab-elements-settings-wrap').slideDown(1000, function () {
                    });
            } else {
                var selector = $(this);
                
                selector.children('.wpwab-element-action-buttons').find('span').removeClass().addClass("fa fa-chevron-down");
                $(this).closest('.wpwab-content-wrap').find('.wpwab-elements-settings-wrap').slideUp(1000, function () {

                });
                $(this).closest('.wpwab-element').removeClass('wpwab-element-border');

            }
        }
    });

    $('.wpwab-custom-wrapper').on('keyup','.wpwab-label-class', function(){
        // Getting the current value of textarea
        var currentText = $(this).val();
        // Setting the Div content
        // $(this).closest('.wpwab-content-wrap').find(".wpwab-element-top-label").val(currentText);
        $(this).closest('.wpwab-content-wrap').find(".wpwab-label-keyup").text(currentText);
    });

    //deleting the elements
    $('body').on('click', '.wpwab-elements-delete-trigger', function () {
        var del= wpwab_backend_js_params.delete_message;
        if (confirm(del)) {
            $(this).closest('.wpwab-wrap').fadeOut(500, function () {
                $(this).remove();
            });
        }
    });

});
