Utilisateur:Zelda/perf.js
Apparence
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.//<pre><nowiki>
// desactivation de la fonction runOnLoad
doneOnloadHook = true;
var onLoadFunctions = []
/*
* Redéfinition de la fonction addLoadEvent
*/
function addLoadEvent(func)
{
onLoadFunctions [onLoadFunctions.length] = func;
}
function executeLoadFunctions() {
var footer = document.getElementById("footer");
var table = "<table align=\"center\">"
for (var i in onLoadFunctions) {
var startDate = new Date();
onLoadFunctions[i]();
var endDate = new Date();
// function.name is non standard !
table += "<tr><td>" + onLoadFunctions[i].name + "</td><td>" + (endDate.getTime() - startDate.getTime()) + "ms</td></tr>";
}
table += "</table>";
footer.innerHTML += table;
}
function unregisterLoadFunction(func) {
window.removeEventListener("load", func, false);
addLoadEvent(func);
}
function unregisterLoadFunctions() {
// fontions de runOnLoad desactivee (voir ci dessus)
addLoadEvent(histrowinit);
addLoadEvent(unhidetzbutton);
addLoadEvent(tabbedprefs);
addLoadEvent(updateTooltipAccessKeys);
addLoadEvent(akeytt);
addLoadEvent(scrollEditBox);
addLoadEvent(setupCheckboxShiftClick);
addLoadEvent(sortables_init);
for (var i = 0; i < onloadFuncts.length; i++) {
addLoadEvent(onloadFuncts[i]);
}
// fonctions mediawiki appelee via hookEven
unregisterLoadFunction(runOnloadHook);
unregisterLoadFunction(mwSetupToolbar);
unregisterLoadFunction(scrollEditBox);
unregisterLoadFunction(allmessagesfilter_init);
// fontions de common.js appelee via addOnLoad()
unregisterLoadFunction(toolTipPlusMinus);
unregisterLoadFunction(LienAdQouBAouPdQ);
unregisterLoadFunction(forcePreview);
unregisterLoadFunction(otherLanguages);
}
if (window.addEventListener) {
unregisterLoadFunctions();
window.addEventListener("load", executeLoadFunctions, false);
}
//</nowiki></pre>