User:Dorumin/discord.​js

//  importArticle({   type: 'script',    article: 'u:dev:MediaWiki:Chat-js/code.js' });

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);            $('#UserStatsMenu 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'); });

/* Fixed chat header PMs */ var menu = document.getElementById('UserStatsMenu'), $menu = $(menu); if ('main' == 'private') { menu.classList.add('private-menu'); } else { menu.classList.remove('private-menu'); }

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                }); }       });    }); });