User:Anonminati/chat.js

importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PrivateMessageAlert/code.js',        'u:dev:NewMessageCount.js',        'u:dev:MediaWiki:ChatOptions/code.js',        'u:dev:MediaWiki:IsTyping.js',        'u:dev:MediaWiki:!pm.js',        'u:dev:MediaWiki:ResponsivePrivateList/code.js',        'u:dev:FaviconNotifier/code.js',        'u:dev:MediaWiki:ExtendedPrivateMessaging/code.js',        'u:dev:MediaWiki:EscapeEmoticons.js',        'u:dev:MediaWiki:Tabinsert.js',        'u:dev:MediaWiki:CapsFirst/code.js',    ] });

/** PRIVATE HEADER SCRIPT **/

// @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');        }    })); });