[Phpfreechat-svn] SF.net SVN: phpfreechat: [1177] trunk/data/public/js
Status: Beta
Brought to you by:
kerphi
|
From: <gpi...@us...> - 2007-09-06 14:11:43
|
Revision: 1177
http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1177&view=rev
Author: gpinzone
Date: 2007-09-06 07:11:45 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
Smiley key sorting caused performance problems on clients. Created new array for smiley keys and sort it during setSmiley() function calls.
Modified Paths:
--------------
trunk/data/public/js/pfcclient.js
trunk/data/public/js/pfcresource.js
Modified: trunk/data/public/js/pfcclient.js
===================================================================
--- trunk/data/public/js/pfcclient.js 2007-09-03 14:16:03 UTC (rev 1176)
+++ trunk/data/public/js/pfcclient.js 2007-09-06 14:11:45 UTC (rev 1177)
@@ -1460,8 +1460,7 @@
// try to parse smileys
var smileys = this.res.getSmileyHash();
- // Sort keys by longest to shortest. This prevents a smiley like :) from being used on >:)
- var sl = smileys.keys().sort(function (a,b){return (b.unescapeHTML().length - a.unescapeHTML().length);});
+ var sl = this.res.getSmileyKeys();
for(var i = 0; i < sl.length; i++)
{
// We don't want to replace smiley strings inside of tags.
Modified: trunk/data/public/js/pfcresource.js
===================================================================
--- trunk/data/public/js/pfcresource.js 2007-09-03 14:16:03 UTC (rev 1176)
+++ trunk/data/public/js/pfcresource.js 2007-09-06 14:11:45 UTC (rev 1177)
@@ -12,6 +12,7 @@
this.fileurl = $H();
this.smileys = $H();
this.smileysreverse = $H();
+ this.smileyskeys = new Array();
},
setLabel: function(key, value)
@@ -48,6 +49,9 @@
{
this.smileys[key] = value;
this.smileysreverse[value] = key;
+ this.smileyskeys.push(key);
+ // Sort keys by longest to shortest. This prevents a smiley like :) from being used on >:)
+ this.smileyskeys = this.smileyskeys.sort(function (a,b){return (b.unescapeHTML().length - a.unescapeHTML().length);})
},
getSmiley: function(key)
{
@@ -63,7 +67,11 @@
getSmileyReverseHash: function()
{
return this.smileysreverse;
- }
+ },
+ getSmileyKeys: function()
+ {
+ return this.smileyskeys;
+ },
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|