User:K599/Discord.js

//Code based on https://dev.fandom.com/wiki/MediaWiki:YoutubePlayer/code.js

//Loading this JavaScript allows Discord widgets to be embedded by inserting the following code: // //data-id: The server ID of your Discord server, found in server settings under the widget tab. //data-theme: The theme of the widget, can be either "dark" (default) or "light".

mw.hook('wikipage.content').add(function($content) {   $content.find('.discord:not(.loaded)').each(function { var $this = $(this), data = $this.data, uri = new mw.Uri('https://discord.com/widget/');

uri.query = { id: String(data.id || '').trim, theme: String(data.theme || '').trim };       $this.html(            $(' ', { width: String(data.width || '').trim, height: String(data.height || '').trim, src: uri.toString, style: 'border: none;', allowtransparency: 'true' })       ).addClass('loaded'); }); });