Editing has been locked on December 31st, 2017. All content and images will keep being available. Thank you for 10 years!

Difference between revisions of "User:Puddin/monobook.js"

From Userpedia
Jump to: navigation, search
(Created page with "function beginChangeLogoImage() { var fadeTime = 1; var logoAnimation = document.getElementById("p-logo-animation"); var logoIndex = Math.floor(Math....")
 
m (Anton moved page User:Mason/monobook.js to User:Puddin/monobook.js: Automatically moved page while renaming the user "Mason" to "Puddin")
 
(No difference)

Latest revision as of 22:17, 30 May 2016

function beginChangeLogoImage() {

        var fadeTime = 1;

        var logoAnimation = document.getElementById("p-logo-animation");
        var logoIndex = Math.floor(Math.random() * UPLogo2012Urls.length);
        logoAnimation.style.backgroundImage = "url('" + UPLogo2012Urls[logoIndex] + "')";
        logoAnimation.style.transition = "opacity " + fadeTime + "s";
        logoAnimation.style.mozTransition = "opacity " + fadeTime + "s";
        logoAnimation.style.webkitTransition = "opacity " + fadeTime + "s";
        logoAnimation.style.oTransition = "opacity " + fadeTime + "s";
        logoAnimation.style.opacity = "1";

        window.setTimeout(endChangeLogoImage, fadeTime * 1000);

}

function endChangeLogoImage() {

        var logo = document.getElementById("p-logo");
        var logoAnimation = document.getElementById("p-logo-animation");

        logo.style.backgroundImage = logoAnimation.style.backgroundImage;

        logoAnimation.style.backgroundImage = "none";
        logoAnimation.style.transition = "none";
        logoAnimation.style.mozTransition = "none";
        logoAnimation.style.webkitTransition = "none";
        logoAnimation.style.oTransition = "none";
        logoAnimation.style.opacity = "0";

}

function setupLogoImage() {

        var logoAnimation = document.createElement('DIV');
        logoAnimation.style.opacity = "0";
        logoAnimation.id = "p-logo-animation";
        document.getElementById("p-logo").appendChild(logoAnimation);

        var images = new Array();

        for (i = 0; i < UPLogo2012Urls.length; i++) {
                images[i] = new Image()
                images[i].src = UPLogo2012Urls[i]
        }

        window.setInterval( beginChangeLogoImage, 5 * 1000 );
        beginChangeLogoImage();

}

addOnloadHook( setupLogoImage );