Skip to content

Commit

Permalink
Inifinite scrolling for private messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-emberex committed Feb 28, 2012
1 parent 1760f94 commit 0332bbe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion assets/js/views/chat.js
Expand Up @@ -171,7 +171,15 @@ var ChatView = Backbone.View.extend({
$('#chat-contents').scroll(function(){
if ($('#chat-contents').scrollTop() < 150) {
var skip = (-50)-$('#chat-contents').children().length;
irc.socket.emit('getOldMessages',{channelName: irc.chatWindows.getActive().get('name'), skip:skip, amount: 10});
var windowName = irc.chatWindows.getActive().get('name');
var target;
if(windowName[0] == '#'){
target = windowName;
} else {
var userName = irc.me.get('nick');
target = (userName < windowName) ? userName + windowName : windowName + userName;
}
irc.socket.emit('getOldMessages',{channelName: target, skip:skip, amount: 10});
}
});
},
Expand Down

0 comments on commit 0332bbe

Please sign in to comment.