Forum Moderators: open
Fortunately this board allows us to insert pieces of HTML, script and CSS into the template (Control Panel > System Preferences). So I wrote a bit of code that scans a page for certain member names and that enables some custom CSS. It works on the pages that list all topics in a forum.
In the field 'Custom Code Insert Top', enter this:
<script>var fl = new Array('Brett_tabke','jenstar');</script><style>tr.my {background: #ff0;} span.my {font-weight: bold;}</style>
The <script> block contains a comma-separated list of quoted member names. It is not case sensitive.
The <style> block contains custom style rules:
* tr.my is the table row with subject, started by, messages et cetera.
* span.my is a <span>-element containing the member name.
All that should be on one line. Also note that the field takes no more than 500 characters.
In the field 'Custom Code Insert Bottom', enter this script:
<script>var re=new RegExp(),d=document,ce,nt,sp;for(var i=0;i<fl.length;i++){sp=0;nt='';re.compile('('+fl[i]+')','gi');ce=d.getElementsByTagName('center')[4];
while((result=re.exec(ce.innerHTML))!=null){nt+=ce.innerHTML.substring(sp,result.index)+'<span class="my">'+result[0]+'<\/span>';sp=re.lastIndex;}ce.innerHTML=nt+ce.innerHTML.substring(sp);}var as=d.getElementsByTagName('span');for(var i=0;i<as.length;i++){as[i].parentNode.parentNode.parentNode.className='my';}</script>
You don't need to edit anything in that script. Just make sure it all goes on one line. (I had to insert a line break before 'while' in order not to break this page's layout.)
The script is far from perfect: if someone would mention Brett_Tabke in a posting's subject or description, that would get highlighted too. Suggestions for a solution and for other improvements are welcome!
Tested and seen working in IE 6 (Win), Opera 8 (Win/Mac) and Firefox 1.0.4 (Win/Mac). Doesn't work in Safari...
You can indeed put the script on your own server / site, and call it with <script src="http://www.example.com/myscript.js"></script>. It won't work in an iframe, because of cross domain scripting issues.
Putting the script on your own server may be handy if you're already using the custom code fields, e.g. for a custom site search box.