MediaWiki:Monobook.js

From The Infosphere, the Futurama Wiki
Revision as of 09:08, 27 April 2009 by Quolnok (talk | contribs) (added WinFirefoxUploadDialogueFixer)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for users using the MonoBook skin */
function columnAreaImage(){
    if(document.title.split(" ")[0] == "Preferences")
    {
        return;
    }
 
    var divS;
    var divC;
    if (document.getElementById ) {
        divS = document.getElementById("column-content");
        divC = document.getElementById("content");
    } else if (document.all ) {
        divS = document.all["column-content"];
        divC = document.all["content"];
    } else {
        return;
    }
    if ( divS && divS.style ){
        var divSHval;
        if (divS.style.pixelHeight) { 
            divSHval= divS.style.pixelHeight;
        } else {
            divSHval=  divS.offsetHeight;
        }
 
        if(Number(divSHval) >1176){
        //1136=768(number bigger than background image and side buttons)+imgheight(370)
            divS.style.backgroundImage = "url(/images/c/cb/Infosphere_Sidebar.png)";
            divS.style.backgroundPosition = "bottom left";
            divS.style.backgroundRepeat = "no-repeat";
            if(divC && divC.style ) {
                //Uhm... apparently this is working now!  Woo!
                divC.style.backgroundImage = "url(/images/4/43/Infosphere_Content.png)";
                divC.style.backgroundPosition = "bottom left";
                divC.style.backgroundRepeat = "no-repeat";
            }
        }
    }
}

addOnloadHook(columnAreaImage);

/*Currently only text colour of the upload dialogue is able to be styled for the Windows version of Firefox, all versions (currently 3.0.9)*/
function WinFirefoxUploadDialogueFixer(){
    if(navigator.userAgent.match("Firefox") && navigator.userAgent.match("Windows"))
    {
        var uploadFile;
        
        if (document.getElementById ) {
            uploadFile= document.getElementById("wpUploadFile");
        } else if (document.all ) {
            uploadFile= document.all["wpUploadFile"];
        } else {
            return;
        }
        if ( uploadFile&& uploadFile.style ){
            uploadFile.style.color = 'black';
        }
    }
}

addOnloadHook(WinFirefoxUploadDialogueFixer);