User:Bearborg/global.js

// Attach a confirmation popup to rollback links var attachRollbackPopups = function { $(".mw-rollback-link > a").each(function (i, elem) {       elem.onclick = function (event) {            if (!confirm('Revert edit?')) {                event.preventDefault;                return false;            }        };    }); }

// Observer for Ajax refreshes on Recent Changes, to reattach popups as needed var rcRefreshIconObserver = new MutationObserver(   function(mutationsList, observer) {        for(let mutation of mutationsList) {            if (mutation.target.style.display == "none") {                // Icon is being hidden, so a refresh just finished.                attachRollbackPopups;            }        }    } );

attachRollbackPopups; // Run once before ajax refreshes start var rcRefreshIcon = document.getElementById('ajaxLoadProgress'); // Attach if necessary if (rcRefreshIcon) { rcRefreshIconObserver.observe(rcRefreshIcon, { attributeFilter: ["style"] }); }