29 lines
781 B
JavaScript
29 lines
781 B
JavaScript
/**
|
|
* Persists the dismissal of the Manager (by ROBOTSTXT) admin notice.
|
|
*
|
|
* WordPress only hides a dismissible notice for the current page load;
|
|
* this script stores the dismissal so it does not come back.
|
|
*/
|
|
( function () {
|
|
'use strict';
|
|
|
|
document.addEventListener( 'click', function ( event ) {
|
|
var notice = event.target.closest
|
|
? event.target.closest( '.robotstxt-hello-manager-notice .notice-dismiss' )
|
|
: null;
|
|
|
|
if ( ! notice ) {
|
|
return;
|
|
}
|
|
|
|
var data = new FormData();
|
|
data.append( 'action', 'robotstxt_hello_dismiss_manager_notice' );
|
|
data.append( 'nonce', window.robotstxthellomanagernotice.nonce );
|
|
|
|
window.fetch( window.robotstxthellomanagernotice.ajaxUrl, {
|
|
method: 'POST',
|
|
credentials: 'same-origin',
|
|
body: data
|
|
} );
|
|
} );
|
|
}() );
|