FANDOM


//

// ============================================================
// SkinMover. Allows you to switch between Oasis, Monobook, Uncyclopedia or WowWiki 
// ============================================================



jQuery(function ($) {
    'use strict';
    if ($('.ca-skin-a').length) {
        return;
    }
    var elem = mw.html,
        monobook = window.monoBookText || 'See in Monobook',
        uncyclopedia = window.uncyclopediaText || 'See in Uncyclopedia',
        wowwiki = window.wowWikiText || 'See in Wowwiki',
        oasis = window.oasisText || 'See in FANDOM',
        qstring = (window.location.search) ? '&' : '?';

    function skinlink(myskin, skintext) {
        return elem.element('li', {}, new elem.Raw(
        elem.element('a', {
            href: (window.location.href).replace(/#.*/, '') + qstring + $.param({useskin: myskin}),
            title: 'See this page in ' + myskin + ' skin',
            'class': 'ca-skin-a'
        }, skintext)));
    }

    var $monobook = skinlink('monobook', monobook),
        $uncyclopedia = skinlink('uncyclopedia', uncyclopedia),
        $wowwiki = skinlink('wowwiki', wowwiki),
        $oasis = skinlink('oasis', oasis)

    if (mw.config.get('skin') === 'oasis') {
        $('.page-header__contribution-buttons .wds-list').append($monobook, $uncyclopedia);
    } else if (mw.config.get('skin') === 'monobook') {
        $('#p-cactions > .pBody > ul').append($oasis, $uncyclopedia);
    } else if (mw.config.get('skin') === 'uncyclopedia') {
        $('#p-cactions > .pBody > ul').append($oasis, $monobook);
    } else if (mw.config.get('skin') === 'wowwiki') {
        $('#p-cactions > .pBody > ul').append($oasis, $monobook, $uncyclopedia);
    } else {
    $('#p-cactions > .pBody > ul').append($oasis, $monobook, $uncyclopedia, $wowwiki);
    }
});
//