User:Belialoftheillusions/chat.js

// Create a button to toggle self-visibility in main user list. mw.hook('dev.chat').then(function(chat) {   return new chat.Button({ name: 'Chat-js', attr: { text: 'Self' click: function { var el = mainRoom.userMain.view.el; if (!el.style.length) { el.style = 'display: none;' } else { el.removeAttribute('style'); }           }        }    }); }); // Unhide yourself when Chat has rendered. mw.hook('dev.chat.render').add(function(mainRoom) {   mainRoom.userMain.view.el.removeAttr('style'); }); /** * Note that this is equivalent to: * mw.hook('dev.chat.socket').add(function(mainRoom) { *      mainRoom.socket.bind('initial', function { *         mainRoom.userMain.view.el.removeAttr('style'); *     }); *  }); */ importArticle({ type: 'script', article: 'u:dev:MediaWiki:Chat-js.js' });