Create A Forum - Support Forums

Support => Create a Forum Codes and Support => Topic started by: Agent Moose on November 23, 2015, 03:23:42 am

Title: [Code] Hoverover Member Legend
Post by: Agent Moose on November 23, 2015, 03:23:42 am
Add this to your footers:
Code: [Select]
<script type="text/javascript">
var Groups = new Array(), YES;
//Created by Agent Moose (November 22, 2015)
Groups["#00aabb"] = "Administrator";
Groups["green"] = "Moderator";
Groups["COLOR"] = "MEMBERGROUP NAME";

//Only Edit the word "Newbie".  This is used for Membergroups who don't have a color.
Groups["none"] = "Newbie";
 
var hc = document.getElementById("upshrinkHeaderIC");
var para = hc.getElementsByTagName("p");
for(x=0;x<para.length;x++){
if(para[x].innerHTML.match(/Users active in/i)){
para[x].innerHTML += "<br /><br />Legend: <span id='legend'></span>";
var h = para[x].getElementsByTagName("a");
for(i=0;i<h.length;i++){
h[i].innerHTML = "<span onmouseover='red(this);' onmouseout='blue();'>" + h[i].innerHTML + "</span>";
};
};
};
function red(AgentMoose){
(AgentMoose.parentNode.style.color) ? YES = AgentMoose.parentNode.style.color : YES = "none";
if(YES !== undefined && /rgb\((.*)\,(.*)\,(.*)\)/i.test(YES)){
var SEY = "#" + toHex(RegExp.$1) + toHex(RegExp.$2) + toHex(RegExp.$3);
YES = SEY;
};
document.getElementById("legend").innerHTML = Groups[YES.toLowerCase() || YES.toUpperCase()];
};
function blue(){
setTimeout(function(){
document.getElementById("legend").innerHTML = "&n" + "bsp;";
}, 500);
};
function toHex(N) {
if(N === null){
return "00";
};
N = parseInt(N);
if(N === 0 || isNaN(N)){
return "00";
};
N = Math.max(0,N);
N = Math.min(N,255);
N = Math.round(N);
return "0123456789ABCDEF".charAt((N - N % 16) / 16) + "0123456789ABCDEF".charAt(N % 16);
};
</script>

It's been awhile since I've created a code. Years, probably.  Anyway, this code has been created for some time, but I never did release it.

It adds a member legend to the bottom of your forum under the users online list.  When you hover of a user, it will tell you what membergroup that person is in.

You can edit the code by adding more of these lines:
Code: [Select]
Groups["COLOR"] = "MEMBERGROUP NAME";Replace the COLOR with the color of the membergroup name.  You can use HEX (#00aabb) or color codes (red, blue, green, ect.)
Replace MEMBERGROUP NAME with the name of the membergroup that color resides with.  (Admin, Moderator, ect.)

There is this line:
Code: [Select]
Groups["none"] = "Default";That line is there so that if there is no color for that membergroup, it will default to showing the word "Default".  You can change that if you wish.

As always, enjoy the code!  If you have any questions, please ask.  I'll try to answer as soon as I can.