- 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:
@@ -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 = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user