MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ // Go to bottom button. Credit to Fngplg and Fandyllic (function(window, $, mw) {   'use strict';    var translations = { en: 'Go to bottom' },    buttonStart = typeof window.JumpToBottomStart === 'number' ?        window.JumpToBottomStart :        0,    scrollSpeed = typeof window.JumpToBottomSpeed === 'number' ?        window.JumpToBottomSpeed :        600,    fadeSwitch = typeof window.JumpToBottomFade === 'number' ?        window.JumpToBottomFade :        600,    theText = (typeof window.JumpToBottomText === 'string' && window.JumpToBottomText) ||    translations['en'] || translations.en;    if (window.JumpToBottomLoaded) { return }    window.JumpToBottomLoaded = true;    $(addJumpToBottom);    function hideFade {        $("#jumptobottom").hide;        $(window).scroll(function { if (($(this).scrollTop > buttonStart) && ($(this).scrollTop < ($('#mw-content-text').height - $('.wds-global-footer').height))) { switch (fadeSwitch) { case 0: $('#jumptobottom').show; break; default: $('#jumptobottom').fadeIn; break; }           } else { switch (fadeSwitch) { case 0: $('#jumptobottom').hide; break; default: $('#jumptobottom').fadeOut; break; }           }        });    }    $('body').on('click', '#jumptobottom', function { $('body,html').animate({           scrollTop: $('#mw-content-text').height - $('.wds-global-footer').height + 250            }, scrollSpeed); return false; });   function addJumpToBottom {        if (skin == 'oasis') {            $(' ', { id: 'jumptobottom', style: 'float: right; margin-top: -1px; border-right: none' })           .append( $(' ', {                   type: 'button',                    style: 'height: 20px;',                    text: theText                }) )           .appendTo('#WikiaBarWrapper .toolbar > .tools');            hideFade;        }    } }(this, jQuery, mediaWiki));