mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-09 12:20:25 +01:00
5ddf97e142
This adds a progress indicator for "Download Personal Data" and "Erase Personal Data" row actions, which can take a while with a lot of data. Props garrett-eclipse, allendav, dominic_ks, xkon, karmatosed, birgire. Fixes #44264. Built from https://develop.svn.wordpress.org/trunk@47246 git-svn-id: http://core.svn.wordpress.org/trunk@47046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
/*! This file is auto-generated */
|
|
jQuery(document).ready(function(u){var l=window.privacyToolsL10n||{};function p(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function m(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function v(e,t,a,s){var n="",o="request-results";m(e),s.length&&(u.each(s,function(e,t){n=n+"<li>"+t+"</li>"}),n="<ul>"+n+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(o+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(o+=" status-request-failed"),e.after(function(){return'<tr class="'+o+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+a+"</p>"+n+"</div></td></tr>"})}u(".export-personal-data-handle").click(function(e){var o=u(this),r=o.parents(".export-personal-data"),i=o.parents("tr"),s=i.find(".export-progress");function d(e){p(r,"export-personal-data-failed"),e&&v(i,"notice-error",l.exportError,[e])}function c(e){var t=0<exportersCount?e/exportersCount:0,a=Math.round(100*t).toString()+"%";s.html(a)}requestID=r.data("request-id"),nonce=r.data("nonce"),exportersCount=r.data("exporters-count"),sendAsEmail=!!r.data("send-as-email"),e.preventDefault(),e.stopPropagation(),r.blur(),m(i),c(0),p(r,"export-personal-data-processing"),function a(s,n){u.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:s,id:requestID,page:n,security:nonce,sendAsEmail:sendAsEmail},method:"post"}).done(function(e){var t=e.data;e.success?t.done?s<exportersCount?(c(s),setTimeout(a(s+1,1))):function(e){var t=l.emailSent;p(r,"export-personal-data-success"),v(i,"notice-success",t,[]),o.hide(),void 0!==e?window.location=e:sendAsEmail||d(l.noExportFile)}(t.url):setTimeout(a(s,n+1)):d(e.data)}).fail(function(e,t,a){d(a)})}(1,1)}),u(".remove-personal-data-handle").click(function(e){var o=u(this),r=o.parents(".remove-personal-data"),i=o.parents("tr"),s=i.find(".erasure-progress");function d(){p(r,"remove-personal-data-failed"),v(i,"notice-error",l.removalError,[])}function c(e){var t=0<erasersCount?e/erasersCount:0,a=Math.round(100*t).toString()+"%";s.html(a)}requestID=r.data("request-id"),nonce=r.data("nonce"),erasersCount=r.data("erasers-count"),hasRemoved=!1,hasRetained=!1,messages=[],e.stopPropagation(),r.blur(),m(i),c(0),p(r,"remove-personal-data-processing"),function a(s,n){u.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:s,id:requestID,page:n,security:nonce},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(hasRemoved=hasRemoved||t.items_removed),t.items_retained&&(hasRetained=hasRetained||t.items_retained),t.messages&&(messages=messages.concat(t.messages)),t.done?s<erasersCount?(c(s),setTimeout(a(s+1,1))):function(){var e=l.noDataFound,t="notice-success";p(r,"remove-personal-data-success"),!1===hasRemoved?!1===hasRetained?e=l.noDataFound:(e=l.noneRemoved,t="notice-warning"):!1===hasRetained?e=l.foundAndRemoved:(e=l.someNotRemoved,t="notice-warning"),v(i,t,e,messages),o.hide()}():setTimeout(a(s,n+1))):d()}).fail(function(){d()})}(1,1)}),u(document).on("click",function(e){var t,a,s,n=u(e.target);if(n.is("button.privacy-text-copy")&&((a=(t=n.parent().parent()).find("div.wp-suggested-text")).length||(a=t.find("div.policy-text")),a.length))try{window.getSelection().removeAllRanges(),s=document.createRange(),a.addClass("hide-privacy-policy-tutorial"),s.selectNodeContents(a[0]),window.getSelection().addRange(s),document.execCommand("copy"),a.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(e){}})}); |