User:DR/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
DR (talk | contribs)
No edit summary
DR (talk | contribs)
No edit summary
Line 3: Line 3:
'use strict';
'use strict';
if (window.location.search.includes('action=delete')) {
if (window.location.search.includes('action=delete')) {
window.addEventListener('load', function() {
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var reasonInput = document.querySelector('input[name="wpReason"]');
if (reasonInput) {
if (mutation.addedNodes.length) {
reasonInput.value = '';
var reasonInput = document.querySelector('input[name="wpReason"]');
}
if (reasonInput) {
reasonInput.value = '';
observer.disconnect();
}
}
});
});
});

observer.observe(document.body, { childList: true, subtree: true });
}
}
})();
})();