- added a reinit function for acf fields after form validation

- added a plugin version of the modal patch for form builder
This commit is contained in:
asus
2024-03-03 21:48:39 +01:00
parent 483c02a4c6
commit cf9a020162
8 changed files with 67 additions and 7 deletions

View File

@@ -0,0 +1,30 @@
let modal_wrapper_UNIQ_ID_7623 = document.querySelector('#de-fb-modal-wrapper-');
// create an observer on first #de-fb-modal-wrapper- to check if child nodes are added
const observer_UNIQ_ID_7623 = new MutationObserver(wait_for_close_button_UNIQ_ID_7623);
observer_UNIQ_ID_7623.observe(modal_wrapper_UNIQ_ID_7623, {
subtree: true,
childList: true,
});
// observe mutations to see if they include the creation of the button .modal-close
// if the button is created, add an eventListener to it
function wait_for_close_button_UNIQ_ID_7623(mutationsList) {
mutationsList.forEach((mutation) => {
// check if nodes were added
if (mutation.type !== 'childList')
return;
// check if added nodes includes the button .modal-close
let modal_close = document.querySelector('#de-fb-modal-wrapper- .modal-close');
if (modal_close !== null) {
modal_close.addEventListener("click", delete_modal_UNIQ_ID_7623);
}
});
}
// when triggered, the .modal-close button will remove all childs from #de-fb-modal-wrapper-
function delete_modal_UNIQ_ID_7623() {
modal_wrapper_UNIQ_ID_7623.innerHTML = '';
}