Show advanced fields by default in modal form

Re: Show advanced fields by default in modal form

by Dominique Palumbo -
Number of replies: 0
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi,

I add another idea... still tricky but better, I think or hope : ).
The settimeout can be remove by selecting an element created after the link.
I look in other many directions... ( like core/modal_events)

// Inspired by https://stackoverflow.com/questions/15268661/jquery-on-create-event-for-dynamically-created-elements
function callback(records) {
records.forEach(function (record) {
var list = record.addedNodes;
var i = list.length - 1;
for ( ; i > -1; i-- ) {
if (list[i].className == 'modal-backdrop in show') {
setTimeout (function() {
$('.moreless-toggler').click();
},2000);
}
}
});
}

var observer = new MutationObserver(callback);
var targetNode = document.body;
observer.observe(targetNode, { childList: true, subtree: true });

I hope it's better this time : )