Revision: 691
Author: kerphi
Date: 2006-08-22 07:14:42 -0700 (Tue, 22 Aug 2006)
ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=691&view=rev
Log Message:
-----------
Fix demo34 for the new 1.x api
Added Paths:
-----------
trunk/demo/demo34_add_a_link_on_nicknames/mytheme/customize.js
Removed Paths:
-------------
trunk/demo/demo34_add_a_link_on_nicknames/mytheme/templates/
Added: trunk/demo/demo34_add_a_link_on_nicknames/mytheme/customize.js
===================================================================
--- trunk/demo/demo34_add_a_link_on_nicknames/mytheme/customize.js (rev 0)
+++ trunk/demo/demo34_add_a_link_on_nicknames/mytheme/customize.js 2006-08-22 14:14:42 UTC (rev 691)
@@ -0,0 +1,61 @@
+pfcClient.prototype.updateNickList = function(tabid,lst)
+{
+ this.nicklist[tabid] = lst;
+ var nicks = lst;
+ var nickdiv = this.gui.getOnlineContentFromTabId(tabid).firstChild;
+ var ul = document.createElement('ul');
+ for (var i=0; i<nicks.length; i++)
+ {
+ var li = document.createElement('li');
+ if (nicks[i] != this.nickname)
+ {
+ // this is someone -> create a privmsg link
+ var img = document.createElement('img');
+ img.setAttribute('src', this.res.getFileUrl('images/user.gif'));
+ img.alt = this.res.getLabel('Private message');
+ img.title = img.alt;
+ img.style.marginRight = '5px';
+ var a = document.createElement('a');
+ a.setAttribute('href', '');
+ a.pfc_nick = nicks[i];
+ a.onclick = function(){pfc.sendRequest('/privmsg', this.pfc_nick); return false;}
+ a.appendChild(img);
+ li.appendChild(a);
+ }
+ else
+ {
+ // this is myself -> do not create a privmsg link
+ var img = document.createElement('img');
+ img.setAttribute('src', this.res.getFileUrl('images/user-me.gif'));
+ img.alt = '';
+ img.title = img.alt;
+ img.style.marginRight = '5px';
+ li.appendChild(img);
+ }
+
+
+ // nobr is not xhtml valid but it's a workeround
+ // for IE which doesn't support 'white-space: pre' css rule
+ var nobr = document.createElement('nobr');
+ var a = document.createElement('a');
+ a.pfc_nick = nicks[i];
+ a.setAttribute('href','http://www.google.com/search?q='+nicks[i]);
+ a.setAttribute('target','_blank');
+ //a.onclick = function(){pfc.insert_text(this.pfc_nick+", ","",false); return false;}
+ a.appendChild(document.createTextNode(nicks[i]));
+ a.setAttribute('class', 'pfc_nickmarker pfc_nick_'+ hex_md5(_to_utf8(nicks[i])));
+ a.setAttribute('className', 'pfc_nickmarker pfc_nick_'+ hex_md5(_to_utf8(nicks[i]))); // for IE6
+
+ nobr.appendChild(a);
+ li.appendChild(nobr);
+ li.style.borderBottom = '1px solid #AAA';
+
+ ul.appendChild(li);
+ }
+ var fc = nickdiv.firstChild;
+ if (fc)
+ nickdiv.replaceChild(ul,fc);
+ else
+ nickdiv.appendChild(ul,fc);
+ this.colorizeNicks(nickdiv);
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|