Post by snap2000 on Aug 17, 2005 11:06:46 GMT -8
This code is just about the same as my Staff Online Code, except that the staff online are embedded in the users online box.
Location: Main Footer
Instructions: For instructions on how to use this code, please refer to those found for the Staff Online Code.
The only minor differences are the two variables in blue and green:
showOfflineGroups - set this to 1 if you would like groups with no one in that group currently online to show in the list (identical to the displaying of invisible users, for example), or 0 if you wouldn't.
showGroupStyles - set this to 1 if you would like the group names to inherit their style from your stylesheet, or 0 if you wouldn't.
Note: The use of showGroupStyles requires a stylesheet like that found below. Group colors set by the Modify Groups page of your admin panel will not take effect.
An example stylesheet:
For help on customizing your groups using stylesheets, please ask in the Support Board, or send me a PM.
Location: Main Footer
<script type="text/javascript"><!--
/* Embedded Staff Online by snap2000 */
var showOfflineGroups = 1; //Show groups with 0 online?
var showGroupStyles = 1; //Inherit group styles from stylesheet?
var staffGroups = [
["Administrator", "1"],
["Global Moderator", "2"],
["Moderator", "3"]
];
var row=document.getElementsByTagName("tr");
if(!location.href.match(/\?action\=(?!home)/)) {
for(r=0;r<row.length;r++) {
if(row[r].firstChild.className=="catbg" && row[r].firstChild.innerHTML.match("Users Online")) {
var staffColors=[],staffCount=[],mcount=0;
for(g=0;g<staffGroups.length;g++) staffCount[g]=0;
var onlineCell=row[r+1].lastChild.getElementsByTagName("font")[0];
var links=onlineCell.getElementsByTagName("a");
for(a=0;a<links.length;a++) {
if(links.className && links.className.match(/^group(\d+)$/)) {
reg=eval("\/\\b"+RegExp.$1+"\\b\/");
for(g=0;g<staffGroups.length;g++) {
if(staffGroups[g][1].match(reg)) {
staffCount[g]++;
s=1;
} else if(g+1==staffGroups.length) {
mcount++;
}
}
} else {
mcount++;
}
}
var addGroups="";
for(g=0;g<staffGroups.length;g++) {
if(staffCount[g]>0 || showOfflineGroups==1) {
var addColor=(showGroupStyles==1 ? "group"+staffGroups[g][1].split("|")[0] : '');
addGroups+=staffCount[g]+' <span class="'+addColor+'">'+staffGroups[g][0]+(staffCount[g]!=1?'s':'')+"</span>, ";
}
}
onlineCell.innerHTML=addGroups+onlineCell.innerHTML.replace(/^\d+ Staff Members*,\s\d+\s(\w+?)s*,\s/,mcount+" $1"+(mcount!=1 ? "s" : "")+", ");
break;
}
}
}
//--></script>
/* Embedded Staff Online by snap2000 */
var showOfflineGroups = 1; //Show groups with 0 online?
var showGroupStyles = 1; //Inherit group styles from stylesheet?
var staffGroups = [
["Administrator", "1"],
["Global Moderator", "2"],
["Moderator", "3"]
];
var row=document.getElementsByTagName("tr");
if(!location.href.match(/\?action\=(?!home)/)) {
for(r=0;r<row.length;r++) {
if(row[r].firstChild.className=="catbg" && row[r].firstChild.innerHTML.match("Users Online")) {
var staffColors=[],staffCount=[],mcount=0;
for(g=0;g<staffGroups.length;g++) staffCount[g]=0;
var onlineCell=row[r+1].lastChild.getElementsByTagName("font")[0];
var links=onlineCell.getElementsByTagName("a");
for(a=0;a<links.length;a++) {
if(links.className && links.className.match(/^group(\d+)$/)) {
reg=eval("\/\\b"+RegExp.$1+"\\b\/");
for(g=0;g<staffGroups.length;g++) {
if(staffGroups[g][1].match(reg)) {
staffCount[g]++;
s=1;
} else if(g+1==staffGroups.length) {
mcount++;
}
}
} else {
mcount++;
}
}
var addGroups="";
for(g=0;g<staffGroups.length;g++) {
if(staffCount[g]>0 || showOfflineGroups==1) {
var addColor=(showGroupStyles==1 ? "group"+staffGroups[g][1].split("|")[0] : '');
addGroups+=staffCount[g]+' <span class="'+addColor+'">'+staffGroups[g][0]+(staffCount[g]!=1?'s':'')+"</span>, ";
}
}
onlineCell.innerHTML=addGroups+onlineCell.innerHTML.replace(/^\d+ Staff Members*,\s\d+\s(\w+?)s*,\s/,mcount+" $1"+(mcount!=1 ? "s" : "")+", ");
break;
}
}
}
//--></script>
Instructions: For instructions on how to use this code, please refer to those found for the Staff Online Code.
The only minor differences are the two variables in blue and green:
showOfflineGroups - set this to 1 if you would like groups with no one in that group currently online to show in the list (identical to the displaying of invisible users, for example), or 0 if you wouldn't.
showGroupStyles - set this to 1 if you would like the group names to inherit their style from your stylesheet, or 0 if you wouldn't.
Note: The use of showGroupStyles requires a stylesheet like that found below. Group colors set by the Modify Groups page of your admin panel will not take effect.
An example stylesheet:
<style type="text/css"><!--
.group1,a.group1 { color:#FF0000; }
.group2,a.group2 { color:#00FF00; }
.group3,a.group3 { color:#0000FF; }
--></style>
For help on customizing your groups using stylesheets, please ask in the Support Board, or send me a PM.