User:Bearborg/global.js

importArticles({	type: 'script',	articles: [       		'u:dev:MediaWiki:MultiUpload.js',	] });

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

function attachRefreshUpdates { var rcRefreshIcon = document.getElementById('ajaxLoadProgress'); // Attach if necessary if (rcRefreshIcon) { // Observer for Ajax refreshes on Recent Changes, to reattach popups as needed var rcRefreshIconObserver = new MutationObserver(           function detectFinishedRefresh (mutationsList, observer) {                mutationsList.forEach(function (mutation) { if (mutation.target.style.display == "none") { // Icon is being hidden, so a refresh just finished. attachRollbackPopups; }               });            }        );        rcRefreshIconObserver.observe(rcRefreshIcon, { attributeFilter: ["style"] }); } }

$(window).on("load", function {   attachRollbackPopups; // Run once before ajax refreshes start    setTimeout(attachRefreshUpdates, 300); // Need to wait a bit for ajax script to run });