MediaWiki:PurgeButton.js

(function($, mw) {   'use strict';    var nsNr = mw.config.get('wgNamespaceNumber');    if (nsNr < 0 || window.PurgeButtonsLoaded || document.getElementById('control_purge')) {        return;    }    window.PurgeButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code)    $(addPurgeButton);    function purgePage {        var page = encodeURIComponent(mw.config.get('wgPageName'));        $.get('/index.php?title=' + page + '&action=purge', function { location.reload(true); });       $('html,body').css({ display: 'block', overflow: 'hidden' });       $(' ').appendTo(document.body)            .css('height', $(window).height);    }    function addOasisPurgeButton {        $('.WikiaPageHeader > .wikia-menu-button').after('Demotivate');   }    function addPurgeButton {        switch (mw.config.get('skin')) {            case 'monobook':                $('#p-cactions > .pBody > ul').append('' + 'Demotivate');               break;            case 'oasis':            case 'wikia':                addOasisPurgeButton;                $('#purge').css('margin', '3px 0 0 13px');                break;        }        $('#purge').click(purgePage);    } }(jQuery, mediaWiki));