# HG changeset patch # User Atul Varma # Date 1241134026 25200 # Node ID fb25fead33748460bb09f1a6423a93903d64e23d # Parent eb727ffda1244356c6d09d5172063bb46bf3ae00 displaying long conversations shouldn't be as jerky now. diff -r eb727ffda124 -r fb25fead3374 media/js/openwebchat.js --- a/media/js/openwebchat.js Thu Apr 30 14:12:54 2009 -0700 +++ b/media/js/openwebchat.js Thu Apr 30 16:27:06 2009 -0700 @@ -179,7 +179,10 @@ $('#outgoing-message').keydown(onKey); $('#outgoing-message').keyup(onKey); - function onMessage(msg) { + function onMessage(msg, doAnimation) { + if (typeof(doAnimation) == "undefined") + doAnimation = true; + var block = $('#templates .message').clone(); if (owStorage.get('lastMessage') == msg.content) @@ -198,7 +201,7 @@ block.hide(); $('#incoming-messages').append(block); - if (animatingMessages < MAX_ANIMATING_MESSAGES) { + if (doAnimation && animatingMessages < MAX_ANIMATING_MESSAGES) { animatingMessages += 1; block.slideDown( @@ -211,14 +214,14 @@ } var currStoredMessage = 0; - var CHUNK_SIZE = 20; + var CHUNK_SIZE = 100; var UI_BREATHE_TIME = 10; function showStoredConversation() { if (currStoredMessage < convStorage.length) { var i = 0; while (i < CHUNK_SIZE && currStoredMessage < convStorage.length) { - onMessage(convStorage.get(currStoredMessage)); + onMessage(convStorage.get(currStoredMessage), false); currStoredMessage += 1; i += 1; }