Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from thedjpetersen/master

Merge with master
  • Loading branch information...
commit 9f0f28fbb209ba1632796771a06dea9747fa7a60 2 parents 4844283 + f01a8c7
@JaTochNietDan JaTochNietDan authored
Showing with 10 additions and 8 deletions.
  1. +9 −7 assets/js/client.js
  2. +1 −1  lib/socket.js
View
16 assets/js/client.js
@@ -324,7 +324,7 @@ $(function() {
channel = irc.chatWindows.getByName(data.name);
if (data.messages) {
- $.each(data.messages, function(index, message){
+ $.each(data.messages.reverse(), function(index, message){
if($('#msg' + message.id).length) {
return true; //continue to next iteration
}
@@ -357,13 +357,15 @@ $(function() {
});
}
- var old_height = channel.view.$('#chat-contents')[0].scrollHeight;
- channel.view.$('#chat-contents').prepend(output);
- var new_height = channel.view.$('#chat-contents')[0].scrollHeight+1000-old_height;
+ try {
+ var old_height = channel.view.$('#chat-contents')[0].scrollHeight;
+ channel.view.$('#chat-contents').prepend(output);
+ var new_height = channel.view.$('#chat-contents')[0].scrollHeight+1000-old_height;
- if(new_height > 1200){
- $('#chat-contents').scrollTop(new_height);
- }
+ if(new_height > 1200){
+ $('#chat-contents').scrollTop(new_height);
+ }
+ } catch (err) {}
});
irc.commands = (function(){
View
2  lib/socket.js
@@ -240,7 +240,7 @@ module.exports = function(socket, app) {
// make sure we're actually connected
if (socket.connID !== -1 && socket.userID !== null) {
// find requested messages
- Message.find({conn_id: socket.connID, chan:data.channelName.toLowerCase()}, { offset: data.skip }, data.amount, function (err, messages) {
+ Message.find({conn_id: socket.connID, chan:data.channelName.toLowerCase()}, { offset: data.skip }, data.amount, [ "at", "Z" ], function (err, messages) {
if (!err) {
var returnData = {};
returnData.name = data.channelName.toLowerCase();
Please sign in to comment.
Something went wrong with that request. Please try again.