Difference between revisions of "MediaWiki:Monobook.js"

From The Infosphere, the Futurama Wiki
Jump to navigation Jump to search
(added WinFirefoxUploadDialogueFixer)
(update for FF3.5)
 
Line 42: Line 42:
addOnloadHook(columnAreaImage);
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)*/
/*Currently only text colour of the upload dialogue is able to be styled for the Windows version of Firefox, all versions before 3.5*/
function WinFirefoxUploadDialogueFixer(){
function WinFirefoxUploadDialogueFixer(){
     if(navigator.userAgent.match("Firefox") && navigator.userAgent.match("Windows"))
     if(navigator.userAgent.match("Firefox") && navigator.userAgent.match("Windows"))
     {
     {
         var uploadFile;
         if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
        { //test for Firefox/x.x or Firefox x.x
            var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
            if (ffversion<3.5)
            {
                var uploadFile;
          
          
        if (document.getElementById ) {
                if (document.getElementById ) {
            uploadFile= document.getElementById("wpUploadFile");
                    uploadFile= document.getElementById("wpUploadFile");
        } else if (document.all ) {
                } else if (document.all ) {
            uploadFile= document.all["wpUploadFile"];
                    uploadFile= document.all["wpUploadFile"];
        } else {
                } else {
            return;
                    return;
        }
                }
        if ( uploadFile&& uploadFile.style ){
                if ( uploadFile&& uploadFile.style ){
            uploadFile.style.color = 'black';
                    uploadFile.style.color = 'black';
                }
            }
         }
         }
     }
     }

Latest revision as of 02:55, 1 July 2009

/* 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 before 3.5*/
function WinFirefoxUploadDialogueFixer(){
    if(navigator.userAgent.match("Firefox") && navigator.userAgent.match("Windows"))
    {
        if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent))
        { //test for Firefox/x.x or Firefox x.x
            var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
            if (ffversion<3.5)
            {
                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);