User:Dorumin/privateheader.​js

// This adds icons on the chat header instead of the PM list at the bottom of the right rail, and fixes the position of the user stats menu.  // @requires privateheader.css importArticle({   type: 'script',    article: 'u:dev:MediaWiki:Chat-js.js' });

mw.hook('dev.chat.render').add(function {   ['main', 'private'].forEach(function(scope) { mainRoom.viewUsers.bind(scope + 'ListClick', function(e) {           var menu = document.getElementById('UserStatsMenu');            if (scope == 'private') {                menu.classList.add('private-menu');            } else {                menu.classList.remove('private-menu');            }        }); });

mainRoom.viewUsers.bind('privateListClick', function(e) {       var menu = document.getElementById('UserStatsMenu');

if (menu.style.display == 'none') return; var right = $(window).width - (e.target.offset.left + e.target.outerWidth * .5) - menu.clientWidth / 2; menu.style.top = '56px'; menu.style.right = right + 'px'; });

/* FIXME: Dirty hack */ $(window).click($.debounce(0, function { var menu = document.getElementById('UserStatsMenu'); if (menu.style.display == 'none' && menu.classList.contains('private-menu')) { menu.classList.remove('private-menu'); }   })); });