[Phpfreechat-svn] SF.net SVN: phpfreechat: [891] trunk/src/client/pfcclient.js
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-12-07 14:48:43
|
Revision: 891 http://svn.sourceforge.net/phpfreechat/?rev=891&view=rev Author: kerphi Date: 2006-12-07 06:38:34 -0800 (Thu, 07 Dec 2006) Log Message: ----------- bug fix: the max_displayed_lines feature was broken because the tab id was ignored so messages could disapear in other tabs. Modified Paths: -------------- trunk/src/client/pfcclient.js Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-12-06 22:45:30 UTC (rev 890) +++ trunk/src/client/pfcclient.js 2006-12-07 14:38:34 UTC (rev 891) @@ -776,7 +776,7 @@ handleComingRequest: function( cmds ) { var msg_html = $H(); - var max_msgid = 0; + var max_msgid = $H(); //alert(cmds.inspect()); @@ -795,7 +795,7 @@ // format and post message var line = ''; - line += '<div id="pfc_msg'+ id +'" class="pfc_cmd_'+ cmd +' pfc_message'; + line += '<div id="pfc_msg_'+recipientid+'_'+id+'" class="pfc_cmd_'+ cmd +' pfc_message'; line += (id % 2 == 0) ? ' pfc_evenmsg' : ' pfc_oddmsg'; if (oldmsg == 1) line += ' pfc_oldmsg'; line += '">'; @@ -840,7 +840,8 @@ msg_html[recipientid] += line; // remember the max message id in order to clean old lines - if (max_msgid < id) max_msgid = id; + if (!max_msgid[recipientid]) max_msgid[recipientid] = 0; + if (max_msgid[recipientid] < id) max_msgid[recipientid] = id; } // loop on all recipients and post messages @@ -861,22 +862,23 @@ // finaly append this to the message list recipientdiv.appendChild(m); this.gui.scrollDown(tabid, m); + + // delete the old messages from the client (save some memory) + var limit_msgid = max_msgid[recipientid] - pfc_max_displayed_lines; + var elt = $('pfc_msg_'+recipientid+'_'+limit_msgid); + while (elt) + { + // delete this element to save browser memory + if (is_ff) + elt.innerHTML = ''; + else + // this code don't work in FF, why ? don't know .. + elt.parentElement.removeChild(elt); + limit_msgid--; + elt = $('pfc_msg_'+recipientid+'_'+limit_msgid); + } } - // delete the old messages from the client (save some memory) - var limit_msgid = max_msgid - pfc_max_displayed_lines; - var elt = $('pfc_msg'+limit_msgid); - while (elt) - { - // delete this element to save browser memory - if (is_ff) - elt.innerHTML = ''; - else - // this code don't work in FF, why ? don't know .. - elt.parentElement.removeChild(elt); - limit_msgid--; - elt = $('pfc_msg'+limit_msgid); - } }, /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |