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


    jQuery('.bug_blog_color').wpColorPicker();


    $( ".widget-social-input .item-list" ).sortable({ handle: '.sort' });


    $(document).on('click', ".widget-social-input .item .remove", function(){

        $(this).parent().remove();

    })


    $(document).on('click', ".widget-social-input .add", function(){

        var name_field = $(this).attr('name-data');

        var unique_key = $.now();


        var html = '<div class="item"><input type="text" placeholder="fa-facebook" value="" name="'+name_field+'['+unique_key+'][icon]"> <input type="text" placeholder="profile url" value="" name="'+name_field+'['+unique_key+'][url]"> <span class="remove"><i class="fa fa-times" aria-hidden="true"></i></span> <span class="sort"><i class="fa fa-bars" aria-hidden="true"></i></span><br><input class="bug_blog_color" placeholder="#ffffff" value="" name="'+name_field+'['+unique_key+'][bg_color]" type="text"> <input class="bug_blog_color" placeholder="#fffff" value="" name="'+name_field+'['+unique_key+'][color]" type="text"></div>';

        $(".widget-social-input").append(html);

        //$('.bug_blog_color').wpColorPicker();

    })

})




