jQuery(document).ready(function ($) { /* Confirm click */ $(document).on( 'click', '.confirm-click', function(e){ e.preventDefault(); var msg = $(this).data('message'); if ( confirm(msg) == true ){ if ($(this).hasClass('blograzzi-reset-settings')){ button = $(this); button.siblings('.status-icon').removeClass('hide'); var data = { action : 'blograzzi-reset-settings', nonce : $(this).data('nonce'), }; $.post(blograzziCustomizer.ajaxurl, data, function(response) { if (response == '0') { button.siblings('.status-icon').removeClass( 'fa-refresh fa-spin'); button.siblings('.status-icon').addClass( 'fa-check'); setTimeout(function(){location.reload();}, 500); } else { $('.blograzzi-status-message', button.parents('.customize-control')).append('
  • ' + response + '
  • '); button.siblings('.status-icon').addClass('hide'); } }); } } return false; }); /* Improve \
    \ \ \
    \
    \ \ \
    \
    \ \ \
    \
    \ \ \
    \ \ \ '; $('.blograzzi-social-profiles').append(html); $('#new-socialprofile-type').val(''); $('#new-socialprofile-title').val(''); $('#new-socialprofile-url').val(''); $('#new-socialprofile-icon-url').val('').parent().addClass('hide'); $('#new-socialprofile-icon-name').val('').parent().addClass('hide'); $('.blograzzi-social-profiles').trigger('change'); }); /* Update the social profile values and trigger change */ $('.blograzzi-social-profile input').keyup(function(){ key = $(this).data('key'); $('input[name="social-profile-data"]', $(this).parents('.blograzzi-social-profile')).data(key, $(this).val()); $('.blograzzi-social-profiles').trigger('change'); }); /* Update the values when change is triggered */ $('.blograzzi-social-profiles').change(function(){ profiles = []; $('input[name="social-profile-data"]').each(function(){ profileType = $(this).data('type'); profileName = $(this).data('name'); profileDesc = $(this).data('title'); profileUrl = $(this).data('url'); profileIconUrl = $(this).data('icon-url'); profileIconName = $(this).data('icon-name'); socialProfile = { type : profileType, name : profileName, title : profileDesc, url : profileUrl, icon_url: profileIconUrl, icon_name: profileIconName }; profiles.push(socialProfile); }); $(this).parents('.customize-control').find('#blograzzi_settings_social_profiles').val(JSON.stringify(profiles)).trigger('change'); }); /** * Import theme files */ });