User:DR/common.js: Difference between revisions
< User:DR
Content deleted Content added
No edit summary |
No edit summary Tags: Mobile edit Mobile web edit |
||
Line 28: | Line 28: | ||
})(); |
})(); |
||
// </nowiki> |
// </nowiki> |
||
window.clearDeleteReasonConfig = { |
|||
applyOnlyOnMobile: false |
|||
}; |
Revision as of 11:04, 14 March 2025
importScript('User:DR/UserInfoEN.js'); // Backlink: [[User:DR/UserInfoEN.js]]
// <nowiki>
(function() {
'use strict';
const config = window.clearDeleteReasonConfig || { applyOnlyOnMobile: true };
if (window.location.search.includes('action=delete') && (!config.applyOnlyOnMobile || /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent))) {
// window.addEventListener('load', function() {
// const reasonInput = document.querySelector('input[name="wpReason"]');
// if (reasonInput) {
// reasonInput.value = '';
// }
// });
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes.length) {
const reasonInput = document.querySelector('input[name="wpReason"]');
if (reasonInput) {
reasonInput.value = '';
observer.disconnect();
}
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
}
})();
// </nowiki>
window.clearDeleteReasonConfig = {
applyOnlyOnMobile: false
};