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.7 0.2 0.2.1 0.2.2 0.2.3
cf7-conditional-fields / js / scripts_admin_all_pages.js
cf7-conditional-fields / js Last commit date
polyfill.js 3 years ago scripts.js 2 weeks ago scripts.js.map 3 years ago scripts_admin copy.js 4 years ago scripts_admin.js 1 year ago scripts_admin_all_pages.js 8 months ago scripts_es6.js 3 years ago temp.js 4 years ago
scripts_admin_all_pages.js
50 lines
1 // ------------------------------------
2 // DISMISS NOTICES
3 // ------------------------------------
4
5 document.addEventListener('DOMContentLoaded', () => {
6 // Delegated click handler covers notices added later, too
7 document.addEventListener('click', (event) => {
8 const trigger = event.target.closest(
9 '.wpcf7cf-admin-notice .notice-dismiss, .wpcf7cf-admin-notice .notice-dismiss-alt'
10 );
11 if (!trigger) return;
12
13 event.preventDefault();
14
15 const noticeEl = trigger.closest('.wpcf7cf-admin-notice');
16 if (!noticeEl) return;
17
18 const noticeId = noticeEl.dataset.noticeId || '';
19 const nonce = noticeEl.dataset.nonce || '';
20
21 // Update hidden input when noticeId is empty (parity with original)
22 if (noticeId === '') {
23 const input = document.querySelector('input[name="wpcf7cf_options[notice_dismissed]"]');
24 if (input) input.value = 'true';
25 }
26
27 // Fire AJAX (needs admin `ajaxurl`; front-end must localize it)
28 if (typeof ajaxurl !== 'undefined') {
29 const params = new URLSearchParams();
30 params.append('action', 'wpcf7cf_dismiss_notice');
31 params.append('noticeId', noticeId);
32 params.append('nonce', nonce);
33
34 fetch(ajaxurl, {
35 method: 'POST',
36 credentials: 'same-origin',
37 headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
38 body: params.toString(),
39 cache: 'no-cache'
40 }).then((response) => {
41 if (response.ok) {
42 // Remove notice from DOM on success
43 noticeEl.remove();
44 }
45 }).catch(() => {
46 // Silently fail
47 });
48 }
49 });
50 });