Difference between revisions of "MediaWiki:Common.js"

From DKC Speedruns
Jump to: navigation, search
Line 50: Line 50:
 
     snowing.id = 'snowing';
 
     snowing.id = 'snowing';
 
     body.appendChild(snowing);
 
     body.appendChild(snowing);
    setTimeout(function() {
 
        body.style.display = 'initial';
 
    }, 120);
 
 
     preloadThrow = document.createElement('img');
 
     preloadThrow = document.createElement('img');
 
     preloadThrow.src = 'https://lh3.googleusercontent.com/aafEpqMbKyN7lefvMButXX_7Q-DMnoMXMmYgF-77ddQnvqtI56QuYzeceTbQzkqAv68ICDVNVw7Ewsf6K00ZrXaQiRExMokX9j3GYToLXQ=s0';
 
     preloadThrow.src = 'https://lh3.googleusercontent.com/aafEpqMbKyN7lefvMButXX_7Q-DMnoMXMmYgF-77ddQnvqtI56QuYzeceTbQzkqAv68ICDVNVw7Ewsf6K00ZrXaQiRExMokX9j3GYToLXQ=s0';

Revision as of 21:50, 5 December 2017

/* Any JavaScript here will be loaded for all users on every page load. */

if (window.location.href.indexOf('https://dkcspeedruns.com/Leaderboards') > -1) {
    setTimeout(function() {
        console.log('test');
        var editLinks = document.getElementsByClassName('mw-editsection-visualeditor');
        for (var i = 0; i < editLinks.length; i++) {
            editLinks[i].style.display = 'none';
            var newLink = document.createElement('a');
            newLink.href = 'https://dkcspeedruns.com/' + editLinks[i].href.substr(51).split('&')[0] + '?veaction=edit';
            newLink.innerHTML = 'edit',
                editLinks[i].parentNode.insertBefore(newLink, editLinks[i]);
        }
    }, 1000);
}

if (window.location.href == 'https://dkcspeedruns.com/Main_Page') {
    var body, donkey, clickbait, krool, bleak, bleakFrames, idling, throwing, snow, snowball, launch, preloadThrow;
    body = document.getElementsByTagName('body')[0];
    donkey = document.createElement('span');
    donkey.className = 'donkey-vine';
    body.appendChild(donkey);
    donkeyImg = document.createElement('img');
    donkeyImg.src = 'https://lh3.googleusercontent.com/qcXQ6Eev0ihpbLEqjiFIOMxGI8qOlCTBWOACtzC_QA89kKoRJmeEqOf-fdL5A0DCekZHm6eGRvoyOHW9wQrHXKZ3BaWwd1_r14T855ZOog=s0';
    donkey.appendChild(donkeyImg);
    clickbait = document.createElement('img');
    clickbait.src = 'https://lh3.googleusercontent.com/eOOIdVO2nbcWBDrOhq_iv-GkaZP5pXlvv84yqaPLwWRsNKZwseqw2XF65v-zu8n7oJfeZBLAyb0aU0hVekSHbfZ8j11XtYFVk4jumnC00w=s0';
    clickbait.id = "clickbait";
    document.getElementById('bodyContent').insertBefore(clickbait, document.getElementById('bodyContent').firstChild);
    krool = document.createElement('div');
    krool.id = 'krool';
    krool.className = 'pop-out';
    krool.className += ' paused';
    body.appendChild(krool);
    clickbait.onclick = function() {
        krool.classList.remove('paused');
    }
    bleak = document.createElement('div');
    bleak.id = 'bleak';
    body.appendChild(bleak);
    bleakFrames = document.createElement('div');
    bleakFrames.className = 'idling';
    bleak.appendChild(bleakFrames);
    snowball = document.createElement('div');
    snowball.id = 'snowball';
    body.appendChild(snowball);
    snowballFrames = document.createElement('div');
    snowball.appendChild(snowballFrames);
    snowing = document.createElement('div');
    snowing.id = 'snowing';
    body.appendChild(snowing);
    preloadThrow = document.createElement('img');
    preloadThrow.src = 'https://lh3.googleusercontent.com/aafEpqMbKyN7lefvMButXX_7Q-DMnoMXMmYgF-77ddQnvqtI56QuYzeceTbQzkqAv68ICDVNVw7Ewsf6K00ZrXaQiRExMokX9j3GYToLXQ=s0';
    preloadThrow.style.opacity = '0';
    preloadThrow.style.height = '0';
    preloadThrow.id = "preloadThrow";
    body.appendChild(preloadThrow);
    launch = document.createElement('style');
    launch.type = 'text/css';
    launch.innerHTML = '.launch { transition-duration: 1s; transform: scale(' + (window.innerHeight * 2) / 48 + ', ' + (window.innerHeight * 2) / 48 + '); bottom: ' + (window.innerHeight * 0.9) / 2 + 'px !important; right: ' + (window.innerWidth) / 2 + 'px !important}';
    document.getElementsByTagName('head')[0].appendChild(launch);
    setTimeout(function() {
        bleak.className = 'up';
        setTimeout(function() {
            bleakFrames.className = 'throwing';
            setTimeout(function() {
                snowballFrames.style.display = 'block';
                snowball.className = 'launch';
                setTimeout(function() {
                    snowballFrames.style.display = 'none';
                }, 600);
                setTimeout(function() {
                    snowing.className = 'flash';
                }, 550);
            }, 400);
            setTimeout(function() {
                bleakFrames.className = 'idling';
                setTimeout(function() {
                    bleak.className = 'down';
                }, 1500);
            }, 1000);
        }, 3000);
    }, 1500);
}