From: Chris Porter Date: Mon, 20 Oct 2008 17:53:14 +0000 (+0100) Subject: Improve nicklist performance. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/52090a1fd94e6880264f7a2518e3aa88b0919dd0 Improve nicklist performance. Add nicklist manipulation (stage 1). --- diff --git a/TODO.txt b/TODO.txt index 4db38a5..35fa380 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,8 @@ sound padding prettify wizard -double click -> query tab completion options for notices and stuff +noscript +@+ in nick shown in text +hilight in query bug fix \ No newline at end of file diff --git a/js/irc/ircclient.js b/js/irc/ircclient.js index 7004f22..23dc104 100644 --- a/js/irc/ircclient.js +++ b/js/irc/ircclient.js @@ -124,6 +124,16 @@ qwebirc.irc.IRCClient = new Class({ nickchanentry.prefixes = prefixes.join(""); }, + stripPrefix: function(nick) { + var l = nick.charAt(0); + if(!l) + return nick; + + if(this.prefixes.indexOf(l) != -1) + return nick.substring(1); + + return nick; + }, removePrefix: function(nickchanentry, prefix) { nickchanentry.prefixes = nickchanentry.prefixes.replaceAll(prefix, ""); }, diff --git a/js/jslib.js b/js/jslib.js index 07a7e74..63281a3 100644 --- a/js/jslib.js +++ b/js/jslib.js @@ -139,4 +139,12 @@ RegExp.escape = function(text) { } return text.replace(arguments.callee.sRE, '\\$1'); +} + +qwebirc.ui.insertAt = function(position, parent, element) { + if(!parent.childNodes || (position >= parent.childNodes.length)) { + parent.appendChild(element); + } else { + parent.insertBefore(element, parent.childNodes[position]); + } } \ No newline at end of file diff --git a/js/ui/baseuiwindow.js b/js/ui/baseuiwindow.js index 82c5af7..ded43fd 100644 --- a/js/ui/baseuiwindow.js +++ b/js/ui/baseuiwindow.js @@ -16,6 +16,7 @@ qwebirc.ui.Window = new Class({ this.scrolltimer = null; this.commandhistory = this.parentObject.commandhistory; this.scrolleddown = true; + this.lastNickHash = {}; //new CommandHistory(); }, updateNickList: function(nicks) { @@ -124,6 +125,32 @@ qwebirc.ui.Window = new Class({ this.scrolltimer = null; } }, + updateNickList: function(nicks) { + var nickHash = {}; + var added = []; + var lnh = this.lastNickHash; + + for(var i=0;i