MediaWiki:Wikia.js/sidebar.js

/* * Discord sidebar module loader. */

'use strict';
 * (function ($, mw) {

// add module for OP Wiki function addModule { $(' ')           .attr('id', 'rsw-discord') .addClass('rsw-custom-module rail-module') .append(               $('')                    .attr('href', mw.util.wikiGetlink('OnePiece:Discord'))                    .append( $(' ')                           .attr('src', 'https://vignette1.wikia.nocookie.net/shantae/images/9/93/Finalnewlogoopdiscord.png') ),               $(' ')                    .append( $(' ')                           .append(                                'The One Piece Wiki has an official Discord Server! Click the button below to join and chat with fellow fans and editors live, or click ',                                $('')                                    .attr('href', mw.util.wikiGetlink('OnePiece:Discord'))                                    .text('here'),                                ' to read our chat rules.'                            ), $('') .attr('href', 'https://discord.gg/6Ee6Anm') .addClass('wds-button') .text('Get invite') )         )          .insertBefore('#wikia-recent-activity'); }   function init { //load once if ($('#rsw-discord').length) { mw.log('Discord module already loaded'); return; }       if ($('#WikiaRail').hasClass('loaded')) { addModule; } else { $('#WikiaRail').on('afterLoad.rail', addModule); }   }

mw.log('Loading Discord module'); mw.loader.using(['mediawiki.util'], function {        $(init);    });

}(this.jQuery, this.mediaWiki));