Post by Ross on Oct 10, 2005 14:27:14 GMT -8
Global Footer
What this does is either replaces a staff members member group with the equivalent rank or adds the equivalent rank to the profile.
<script type="text/javascript">
<!--
/* staff have normal ranks - ross */
var keep = 'yes'; //Keep the member group? 'yes' or 'no'
star = 'images.proboards.com/star.gif'; //URL of the member star
rank = [];
rank[0]=['New Member',1,0];
rank[1]=['Junior Member',2,50];
rank[2]=['Full Member',3,100];
rank[3]=['Senior Member',4,250];
rank[4]=['God',5,500];
td = document.getElementsByTagName("td");
for(i=0; i<td.length; i++)
{
if(td[i].width == '20%' && td[i].innerHTML.match(/group/i) && !td[i].innerHTML.match(/group0/i) && td[i].parentNode.innerHTML.match(/Posts: (.+?)</))
{
posts = parseInt(RegExp.$1.replace(/,/g,''));
newRank = document.createElement('div');
for(r=rank.length-1; r>=0; r--)
{
if(posts >= rank[r][2])
{
newRank.appendChild(document.createElement('br'));
newRank.appendChild(document.createTextNode(rank[r][0]));
newRank.appendChild(document.createElement('br'));
for(z=0; z<rank[r][1]; z++)
{
newRank.appendChild(document.createElement('img'));
newRank.lastChild.src = star;
}
newRank.appendChild(document.createElement('br'));
break;
}
}
if(keep.toLowerCase() == 'no')
{
td[i].innerHTML = td[i].innerHTML.replace(/<br>(.+?)<br><img(.+?)<br>/i,newRank.innerHTML)
}
else
{
td[i].innerHTML = td[i].innerHTML.replace(/<br><img(.+?)<br>/i,'<br><img$1' +newRank.innerHTML)
}
}
}
//-->
</script>
Edit the stuff in red, following the comments. Then, edit the ranks in purple. Following this layout:
rank[1]=['Rank Name',2,50];
Green - This number needs to always be one greater than the previous number.
Blue - Rank Name
Orange - Number of Stars for this rank
Red - Number of posts required to reach this rank
Make sure that the ranks keep in this order, the one with the highest number of posts at the bottom.
Advanced
Due to popular request, if you would not like the code to affect members of the administrator group then add the bit in red to this line of the code
{
if(td.width == '20%' && td.innerHTML.match(/group/i) && td.parentNode.innerHTML.match(/Posts: (.+?)</) && !td.item(i).innerHTML.match(/group1"/))
{
What this does is either replaces a staff members member group with the equivalent rank or adds the equivalent rank to the profile.
<script type="text/javascript">
<!--
/* staff have normal ranks - ross */
var keep = 'yes'; //Keep the member group? 'yes' or 'no'
star = 'images.proboards.com/star.gif'; //URL of the member star
rank = [];
rank[0]=['New Member',1,0];
rank[1]=['Junior Member',2,50];
rank[2]=['Full Member',3,100];
rank[3]=['Senior Member',4,250];
rank[4]=['God',5,500];
td = document.getElementsByTagName("td");
for(i=0; i<td.length; i++)
{
if(td[i].width == '20%' && td[i].innerHTML.match(/group/i) && !td[i].innerHTML.match(/group0/i) && td[i].parentNode.innerHTML.match(/Posts: (.+?)</))
{
posts = parseInt(RegExp.$1.replace(/,/g,''));
newRank = document.createElement('div');
for(r=rank.length-1; r>=0; r--)
{
if(posts >= rank[r][2])
{
newRank.appendChild(document.createElement('br'));
newRank.appendChild(document.createTextNode(rank[r][0]));
newRank.appendChild(document.createElement('br'));
for(z=0; z<rank[r][1]; z++)
{
newRank.appendChild(document.createElement('img'));
newRank.lastChild.src = star;
}
newRank.appendChild(document.createElement('br'));
break;
}
}
if(keep.toLowerCase() == 'no')
{
td[i].innerHTML = td[i].innerHTML.replace(/<br>(.+?)<br><img(.+?)<br>/i,newRank.innerHTML)
}
else
{
td[i].innerHTML = td[i].innerHTML.replace(/<br><img(.+?)<br>/i,'<br><img$1' +newRank.innerHTML)
}
}
}
//-->
</script>
Edit the stuff in red, following the comments. Then, edit the ranks in purple. Following this layout:
rank[1]=['Rank Name',2,50];
Green - This number needs to always be one greater than the previous number.
Blue - Rank Name
Orange - Number of Stars for this rank
Red - Number of posts required to reach this rank
Make sure that the ranks keep in this order, the one with the highest number of posts at the bottom.
Advanced
Due to popular request, if you would not like the code to affect members of the administrator group then add the bit in red to this line of the code
{
if(td.width == '20%' && td.innerHTML.match(/group/i) && td.parentNode.innerHTML.match(/Posts: (.+?)</) && !td.item(i).innerHTML.match(/group1"/))
{