Author Topic: [Code] Hoverover Member Legend  (Read 520 times)

0 Members and 0 Guests are viewing this topic.

Offline Agent Moose

  • Newbie
  • *
  • Posts: 37
  • Karma: 12
  • Gender: Male
  • Miss me?
  • Location: South Carolina, United States
    • View Profile
[Code] Hoverover Member Legend
« 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.
« Last Edit: November 23, 2015, 03:33:25 am by Agent Moose »
Code: [Select]
//Hint hint :)
if(/action=profile;u=(.*);sa=UserPage/i.test(location.href)){
var number = RegExp.$1;
var username = (smf_id_member !== "0") ? document.getElementById("upper_section").getElementsByTagName("li")[0].getElementsByTagName("span")[0].innerHTML : void(0);

Share on Facebook Share on Twitter


 

Related Topics

  Subject / Started by Replies Last post
12 Replies
3515 Views
Last post December 02, 2014, 06:57:57 pm
by CyanProductions
0 Replies
658 Views
Last post August 24, 2011, 11:24:36 pm
by .: ♥яєνєяωιѕнєѕ :.
1 Replies
865 Views
Last post March 14, 2012, 04:53:55 pm
by aIURbliS
4 Replies
32284 Views
Last post November 23, 2015, 03:26:07 am
by Agent Moose
0 Replies
439 Views
Last post October 14, 2013, 10:21:03 pm
by forum