User:Ucucha/hiderefs.js

var refs_hidden = false;

// hides refs if shown, shows them if hidden function hiderefs {   // can't use getElementsByClassName because IE apparently doesn't support it    var refs = document.getElementsByTagName("sup"); for(var i = 0; i < refs.length; i++) {       if($(refs[i]).hasClass("reference")) refs[i].style.display = refs_hidden ? "inline" : "none"; }   // also hide reflist var reflists = document.getElementsByTagName("div"); for(var i = 0; i < reflists.length; i++) {       if(hasClass(reflists[i], "references")) reflists[i].style.display = refs_hidden ? "block" : "none"; }   refs_hidden = refs_hidden ? false : true; document.getElementById("t-hide-refs").getElementsByTagName("span")[0].innerHTML = refs_hidden ? "Show references" : "Hide references"; }

addOnloadHook(   function    {        mw.util.addPortletLink('p-tb', 'javascript:hiderefs', 'Hide references', 't-hide-refs', 'Shows/hides references', , );    } );