« MediaWiki:Gadget-inline-js-loader.js » : différence entre les versions
(Ajouté un mécanisme de vérification de la définition de inlineJS) |
(Ajout console.log) |
||
Ligne 8 : | Ligne 8 : | ||
{ | { | ||
setTimeout(eJS, 500); | setTimeout(eJS, 500); | ||
console.log("Loading inline-js-loader failed, tying again in 500ms"); | |||
return; | return; | ||
} | } |
Version du 8 avril 2020 à 21:53
console.log("Loaded inline-js-loader");
eJS = function()
{
/* It sometimes happens that gadgets are called before the inlineJS is delcared, making the loading
fail. In this case, give it another 500ms and do a recursive call to try again. */
if(typeof inlineJS == 'undefined')
{
setTimeout(eJS, 500);
console.log("Loading inline-js-loader failed, tying again in 500ms");
return;
}
for(var n in inlineJS) // Each function to be executed is added to the inlineJS object.
{
f = inlineJS[n];
if(typeof f === 'function' ) { f(); }
}
}
eJS();