Jump to content

User:TheGrimme/HideRefDeskHeader.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TheGrimme (talk | contribs) at 20:35, 30 November 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <pre><nowiki>
//  Hides the header info at the top of reference desk pages GPL, (c) 2006, [[en:User:TheGrimme]]


// hook
addOnloadHook(HideRefDeskHeader);

//init
function HideRefDeskHeader()
{
// For now, get all tables and remove the first one with this border
    var tables = document.getElementsByTagName("TABLE");
    var removedTable = null;
    for(var i=0; i < tables.length; i++)
    {
       
        var table = tables[i];
        var match = "1px solid rgb(170, 170, 170)"
        if(table.style.border == match)
        {
            table.style.display = "none";
            removedTable = table;
            break;
        }
    }
   
    // Move the table of contents into the old spot.  Best use of space
    var toc = document.getElementById("toc");
    if(toc != null && removedTable != null)
    {
        var tocParent = toc.parentNode;
        var removedParent = removedTable.parentNode;
        removedParent.appendChild(tocParent.removeChild(toc));
    } 
}


//<nowiki></pre>