View source for MediaWiki:Common.js
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
var config = mw.config.values;
window.dev = window.dev || {};
window.dev.waitFor = function(query, callback, extraDelay) {
if ('function' == typeof callback && 'string' == typeof query) {
extraDelay = extraDelay || 0;
if (document.querySelector(query)) {
setTimeout(callback, extraDelay);
} else {
// set up the mutation observer
var observer = new MutationObserver(function (mutations, me) {
// mutations is an array of mutations that occurred
// me is the MutationObserver instance
var targetNode = document.querySelector(query);
if (targetNode) {
setTimeout(callback, extraDelay);
me.disconnect(); // stop observing
return;
}
});
000
1:0
Return to MediaWiki:Common.js.