From 4ec46f463b20b04b9252167117f38c3f285b397f Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Tue, 18 Dec 2012 18:55:34 +0100 Subject: [PATCH] chat buffer limitation --- lib/tab.nsui.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tab.nsui.js b/lib/tab.nsui.js index 1576274..3f6b47d 100644 --- a/lib/tab.nsui.js +++ b/lib/tab.nsui.js @@ -125,8 +125,16 @@ Tab.prototype.setActive = function() { this.el_lst.classList.add("tab-active"); } +Tab.prototype.flushText = function() { + var str = this.chat_log.innerHTML, sep = "
", t = str.split(sep); + + if (t.length > 1000) { + this.chat_log.innerHTML = str.substring(str.indexOf(sep) + sep.length); + } +}; + Tab.prototype.appendText = function(text) { - // TODO: flush text + this.flushText(); this.chat_log.innerHTML += text; this.chat_log.scrollTop = 42000; };