Post by Chris on May 14, 2007 15:34:09 GMT -8
Overview: This is an idea I borrowed from back when I was an AOL'er. Emails in your inbox sent from AOL staff were made distinct by a different color so they stood out from the rest. Reading the email itself also showed as distinct since the background had a special color as well.
Installation: Paste in Global Footer then edit the variables in the preferences section of the code to match your forum and taste before saving changes.
*Preferences section is at start of code between the
/******************** Start Preferences ********************/
and
/****** End Preferences(no further editing necessary) ******/
lines
*Remove the part in blue if you don't want an icon legend
Code:
<script type="text/javascript">
<!--
/* Highlight Messages From Staff - Eton Bones*/
/******************** Start Preferences ********************/
// set usernames of staff members here
var Staff=/user=(admin|username1|username2|username3)$/i
// set the highlight color a member will see if PM is from a staff member (RGB hex [ex:#oecc00] or standard HTML color names [ex:yellow] accepted)
var hilightColor="#0ecc00";
// set true if background of message itself should be highlighted as well else set false
var bgHighlight=true;
/****** End Preferences(no further editing necessary) ******/
if(location.href.match(/action=(pm(?:view)?)($|&view=[12])/)){
bgHighlight=((bgHighlight && RegExp.$1=="pmview")?true:false)
if(bgHighlight){
var mcell=document.getElementsByTagName('td');
for (var count=0;count<mcell.length;count++){
if(mcell[count].width=="80%"&& mcell[count].className=="windowbg"){
mcell[count].style.backgroundColor=hilightColor;
mcell=mcell[count].getElementsByTagName('td');
mcell[mcell.length-1].style.backgroundColor=hilightColor;
mcell[mcell.length-2].style.backgroundColor=hilightColor;
mcell[mcell.length-1].parentNode.parentNode.parentNode.parentNode.style.backgroundColor = hilightColor;
break;
}
}
}else{
var inp=document.getElementsByTagName('input');
for (var count=1;count<inp.length;count++){
if(inp[count].type=="checkbox"&&inp[count].name.match(/delete-\d+/)){
var line=inp[count].parentNode.parentNode.getElementsByTagName('td');
if(line[3].getElementsByTagName('a').length&&line[3].getElementsByTagName('a')[0].href.match(Staff)){
for(var count1=0;count1<line.length;count1++){
line[count1].style.backgroundColor=hilightColor;
if(count1==2){
line[count1].onmouseover= function(){setWindowStatus(this.innerText);return true;};
line[count1].onmouseout=function(){setWindowStatus('');return true;}
}
}
}
}
else if(inp[count].type=="submit"&&inp[count].value=="Delete Selected Messages"){
var leg=document.createElement('center');
var fj=document.getElementById('forumjump');
leg.innerHTML='<table width="'+(fj?"200px":"100%")+'" cellpadding="4" cellspacing="1" align="center" class="bordercolor" ><tr><td class="titlebg" width="100%" colspan="2" align="center"><font size=2><b>Message Legend</B></font></td></tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/imclose.gif" alt="[unread]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Unread Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/imopen.gif" alt="[read]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Read Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/answered.gif" alt="[replied]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Replied Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><button style="background-color:'+hilightColor+';" readonly>highlight<\/button><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Official Message<\/font><\/tr><\/table>'
if(!fj) fj=inp[count]
fj=fj.parentNode.parentNode.parentNode.parentNode;
fj.parentNode.insertBefore(leg,fj.nextSibling);
}
}
}
}
//-->
</script>
Notes:
Installation: Paste in Global Footer then edit the variables in the preferences section of the code to match your forum and taste before saving changes.
*Preferences section is at start of code between the
/******************** Start Preferences ********************/
and
/****** End Preferences(no further editing necessary) ******/
lines
*Remove the part in blue if you don't want an icon legend
Code:
<script type="text/javascript">
<!--
/* Highlight Messages From Staff - Eton Bones*/
/******************** Start Preferences ********************/
// set usernames of staff members here
var Staff=/user=(admin|username1|username2|username3)$/i
// set the highlight color a member will see if PM is from a staff member (RGB hex [ex:#oecc00] or standard HTML color names [ex:yellow] accepted)
var hilightColor="#0ecc00";
// set true if background of message itself should be highlighted as well else set false
var bgHighlight=true;
/****** End Preferences(no further editing necessary) ******/
if(location.href.match(/action=(pm(?:view)?)($|&view=[12])/)){
bgHighlight=((bgHighlight && RegExp.$1=="pmview")?true:false)
if(bgHighlight){
var mcell=document.getElementsByTagName('td');
for (var count=0;count<mcell.length;count++){
if(mcell[count].width=="80%"&& mcell[count].className=="windowbg"){
mcell[count].style.backgroundColor=hilightColor;
mcell=mcell[count].getElementsByTagName('td');
mcell[mcell.length-1].style.backgroundColor=hilightColor;
mcell[mcell.length-2].style.backgroundColor=hilightColor;
mcell[mcell.length-1].parentNode.parentNode.parentNode.parentNode.style.backgroundColor = hilightColor;
break;
}
}
}else{
var inp=document.getElementsByTagName('input');
for (var count=1;count<inp.length;count++){
if(inp[count].type=="checkbox"&&inp[count].name.match(/delete-\d+/)){
var line=inp[count].parentNode.parentNode.getElementsByTagName('td');
if(line[3].getElementsByTagName('a').length&&line[3].getElementsByTagName('a')[0].href.match(Staff)){
for(var count1=0;count1<line.length;count1++){
line[count1].style.backgroundColor=hilightColor;
if(count1==2){
line[count1].onmouseover= function(){setWindowStatus(this.innerText);return true;};
line[count1].onmouseout=function(){setWindowStatus('');return true;}
}
}
}
}
else if(inp[count].type=="submit"&&inp[count].value=="Delete Selected Messages"){
var leg=document.createElement('center');
var fj=document.getElementById('forumjump');
leg.innerHTML='<table width="'+(fj?"200px":"100%")+'" cellpadding="4" cellspacing="1" align="center" class="bordercolor" ><tr><td class="titlebg" width="100%" colspan="2" align="center"><font size=2><b>Message Legend</B></font></td></tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/imclose.gif" alt="[unread]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Unread Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/imopen.gif" alt="[read]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Read Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><img src="http://s4.images.proboards.com/answered.gif" alt="[replied]"/><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Replied Message<\/font><\/tr><tr><td width="30%" class="windowbg" vAlign="top" align="center"><font size=2><button style="background-color:'+hilightColor+';" readonly>highlight<\/button><td width="70%" class="windowbg" vAlign="top" align="center"><font size=2>Official Message<\/font><\/tr><\/table>'
if(!fj) fj=inp[count]
fj=fj.parentNode.parentNode.parentNode.parentNode;
fj.parentNode.insertBefore(leg,fj.nextSibling);
}
}
}
}
//-->
</script>
Notes:
- Tested on Firefox v2.0.0.3 and Internet Explorer v6.0.2900; SP2