Utilisateur:Zelda/perf.js
Un article de Wikipédia, l'encyclopédie libre.
Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.
//<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>