WordPress/wp-admin/js/xfn.min.js
Sergey Biryukov a6284311e8 Privacy: improve wp_privacy_erase_personal_data(), return boolean values.
Props ericdaams.
Merges [43061] to the 4.9 branch.
See #43602.
Built from https://develop.svn.wordpress.org/branches/4.9@43110


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-02 03:44:24 +00:00

1 line
2.7 KiB
JavaScript

jQuery(document).ready(function(a){a("#link_rel").prop("readonly",!0),a("#linkxfndiv input").bind("click keyup",function(){var b=a("#me").is(":checked"),c="";a("input.valinp").each(function(){b?a(this).prop("disabled",!0).parent().addClass("disabled"):(a(this).removeAttr("disabled").parent().removeClass("disabled"),a(this).is(":checked")&&""!==a(this).val()&&(c+=a(this).val()+" "))}),a("#link_rel").val(b?"me":c.substr(0,c.length-1))})}),jQuery(document).ready(function(a){function b(a,b){a.children().hide(),a.children("."+b).show()}function c(a){a.next().hasClass("request-results")&&a.next().remove()}function d(b,d,e,f){c(b);var g="";f.length&&(a.each(f,function(a,b){g=g+"<li>"+b+"</li>"}),g="<ul>"+g+"</ul>"),b.after(function(){return'<tr class="request-results"><td colspan="5"><div class="notice inline notice-alt '+d+'"><p>'+e+"</p>"+g+"</div></td></tr>"})}var e=window.privacyToolsL10n||{};a(".export_personal_data a").click(function(f){function g(a){b(k,"export_personal_data_success"),"undefined"!=typeof a?window.location=a:p||h(e.noExportFile)}function h(a){b(k,"export_personal_data_failed"),a&&d(l,"notice-error",e.exportError,[a])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:b,id:m,page:c,security:n,sendAsEmail:p},method:"post"}).done(function(a){if(!a.success)return void h(a.data);var d=a.data;d.done?b<o?setTimeout(i(b+1,1)):g(d.url):setTimeout(i(b,c+1))}).fail(function(a,b,c){h(c)})}f.preventDefault(),f.stopPropagation();var j=a(this),k=j.parents(".export_personal_data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("exporters-count"),p=!!k.data("send-as-email");k.blur(),c(l),b(k,"export_personal_data_processing"),i(1,1)}),a(".remove_personal_data a").click(function(f){function g(){b(k,"remove_personal_data_idle");var a=e.noDataFound,c="notice-success";!1===p?!1===q?a=e.noDataFound:(a=e.noneRemoved,c="notice-warning"):!1===q?a=e.foundAndRemoved:(a=e.someNotRemoved,c="notice-warning"),d(l,"notice-success",a,[])}function h(){b(k,"remove_personal_data_failed"),d(l,"notice-error",e.removalError,[])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:b,id:m,page:c,security:n},method:"post"}).done(function(a){if(!a.success)return void h();var d=a.data;d.items_removed&&(p=p||d.items_removed),d.items_retained&&(q=q||d.items_retained),d.messages&&(r=r.concat(d.messages)),d.done?b<o?setTimeout(i(b+1,1)):g():setTimeout(i(b,c+1))}).fail(function(){h()})}f.preventDefault(),f.stopPropagation();var j=a(this),k=j.parents(".remove_personal_data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("erasers-count"),p=!1,q=!1,r=[];k.blur(),c(l),b(k,"remove_personal_data_processing"),i(1,1)})});