]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseuiwindow.js
Add nickname validation.
[irc/quakenet/qwebirc.git] / js / ui / baseuiwindow.js
index 8c2f73c5d392944184d952220858f16b1e8109be..feda6dd807a19e875278a17d4991a6e60a1a99e4 100644 (file)
@@ -3,6 +3,8 @@ qwebirc.ui.HILIGHT_ACTIVITY = 1;
 qwebirc.ui.HILIGHT_SPEECH = 2;
 qwebirc.ui.HILIGHT_US = 3;
 
+qwebirc.ui.MAXIMUM_LINES_PER_WINDOW = 1000;
+
 qwebirc.ui.WINDOW_LASTLINE = qwebirc.ui.WINDOW_QUERY | qwebirc.ui.WINDOW_MESSAGES | qwebirc.ui.WINDOW_CHANNEL | qwebirc.ui.WINDOW_STATUS;
 
 qwebirc.ui.Window = new Class({
@@ -127,7 +129,12 @@ qwebirc.ui.Window = new Class({
     if(type)
       line = this.parentObject.theme.message(type, line, lhilight);
     
-    qwebirc.ui.Colourise(qwebirc.irc.IRCTimestamp(new Date()) + " " + line, element, this.client.exec, this.parentObject.urlDispatcher.bind(this.parentObject), this);
+    var tsE = document.createElement("span");
+    tsE.className = "timestamp";
+    tsE.appendChild(document.createTextNode(qwebirc.irc.IRCTimestamp(new Date()) + " "));
+    element.appendChild(tsE);
+    
+    qwebirc.ui.Colourise(line, element, this.client.exec, this.parentObject.urlDispatcher.bind(this.parentObject), this);
     this.scrollAdd(element);
   },
   errorMessage: function(message) {
@@ -182,6 +189,8 @@ qwebirc.ui.Window = new Class({
     if($defined(element)) {
       var sd = this.scrolledDown();
       parent.appendChild(element);
+      if(parent.childNodes.length > qwebirc.ui.MAXIMUM_LINES_PER_WINDOW)
+        parent.removeChild(parent.firstChild);
       if(sd) {
         if(this.scrolltimer)
           $clear(this.scrolltimer);