| 1 |
import domReady from '@wordpress/dom-ready'; |
| 2 |
import { __, sprintf } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
domReady( () => { |
| 5 |
const keyEl = document.querySelector( '#apikey' ); |
| 6 |
const requiresRecrawlNotice = document.querySelectorAll( |
| 7 |
'.parsely-form-controls[data-requires-recrawl="true"] .help-text' |
| 8 |
); |
| 9 |
if ( ! ( keyEl && requiresRecrawlNotice.length ) ) { |
| 10 |
return; |
| 11 |
} |
| 12 |
|
| 13 |
const notice = sprintf( |
| 14 |
/* translators: %s: The API Key that will be used to request a recrawl */ |
| 15 |
__( |
| 16 |
'<strong style="color:#d63638">Important:</strong> changing this value on a site currently tracked with Parse.ly will require reprocessing of your Parse.ly data. Once you have changed this value, please contact <a href="mailto:support@parsely.com?subject=Please reprocess %s">support@parsely.com</a>', |
| 17 |
'wp-parsely' |
| 18 |
), |
| 19 |
keyEl.value |
| 20 |
); |
| 21 |
|
| 22 |
[].forEach.call( requiresRecrawlNotice, function( node ) { |
| 23 |
const descWrapper = document.createElement( 'p' ); |
| 24 |
descWrapper.className = 'description'; |
| 25 |
descWrapper.innerHTML = notice; |
| 26 |
node.appendChild( descWrapper ); |
| 27 |
} ); |
| 28 |
} ); |
| 29 |
|