User:Dorumin/chat.js

importArticles({   type: 'script',    articles: [        'u:dev:PrivateHistory/code.js',        'u:dev:FaviconNotifier/code.js',        'u:dev:IsTyping/code.js',        'u:dev:Tabinsert.js', // WTF WHY ISNT IT TabInsert.js???        'u:dev:ExtendedPrivateMessaging/code.js',        'u:dev:PrivateMessageAlert/code.js',        'u:dev:EscapeEmoticons/code.js'    ] });

(function reload {   if (!window.mainRoom) {        setTimeout(reload, 200);        return;    }    mainRoom.model.chats.bind('afteradd', function { var div = mainRoom.viewDiscussion.chatDiv.get(0); if (div.scrollHeight - div.scrollTop - div.clientHeight < 500) { mainRoom.viewDiscussion.scrollToBottom; }   });

mainRoom.model.privateUsers.bind('add', function(u) {       var room = mainRoom.chats.privates[u.attributes.roomId];        room.model.chats.bind('afteradd', function { var div = room.viewDiscussion.chatDiv.get(0); if (div.scrollHeight - div.scrollTop - div.clientHeight < 500) { room.viewDiscussion.scrollToBottom; }       });    }); });