User:Dorumin/discord.​js

// This enables the tweaks necessary for a Discord CCC theme, such as high res popout menu avatars and group tags.  // @requires discord.css importArticle({   type: 'script',    article: 'u:dev:MediaWiki:Chat-js.js' });

/* Short header */ mw.messages.set('chat-private-headline', '$1');

mw.hook('dev.chat.render').add(function {   ['main', 'private'].forEach(function(scope) { mainRoom.viewUsers.bind(scope + 'ListClick', function(e) {           var user = mainRoom.model.users.findByName(e.name),                menu = document.getElementById('UserStatsMenu'),                $menu = $(menu);            $menu.find('img').attr('src', function(_, src) { if (!user) return src.replace('/scale-to-width-down/28', '/scale-to-width-down/256'); return user.attributes.avatarSrc.replace('/scale-to-width-down/28', '/scale-to-width-down/256'); });

if (!user) return; // WTF var $groups = $(' ').attr('class', 'groups'); $menu.find('.info').append($groups); user.attributes.groups.forEach(function(group) {               $groups.append($(' ', {                    'class': 'group',                    'data-group': group                }));            });

if (menu.getBoundingClientRect.bottom > innerHeight) { $menu.offset({                   top: innerHeight - $menu.height                }); }       });    }); });