|
Post by Wormopolis on Jul 22, 2011 0:38:44 GMT -8
Browsers Tested: IE Chrome and FF Placement: global footer
This code will change the number of displayed stars to reflect post count instead of the fixed number of stars assigned to a member group USING the member group star set.
so lets say you have a custom star for a member group, this code will display the number of stars with the numbers you put into the array (typically the same assignments you would give regular post ranks)
<script type="text/javascript"> <!-- // membergroup stars follow post ranks // v1.1 // by Wormopolis - www.wormocodes.com // original concept - Staff have normal ranks by Ross
// set affected member groups to have only 1 star
var excludeGroups="3|4|12"; //seperate by |
var postRankStars=[ [0, 0], //post count , number of stars [1, 1], [10, 2], [20, 3], [50, 4], [100, 5], [150, 6], [200, 7], [400, 8], [800, 9], [1000, 10], [2500, 11], [5000, 12] //no comma last entry ];
var lineBreakAfterHowManyStars=6; //set to 0 if you want it to always put stars on one line
//no need to edit below
var excl=new RegExp('group('+excludeGroups+')$',''); if (pb_action.match(/(display|viewprofile|search2|pmview|calendarview)/)) { for (tds=document.getElementsByTagName('td'), tt=0; tt<tds.length; tt++) { if (tds[tt].width=='20%' && tds[tt].vAlign=='top' && tds[tt].innerHTML.match(/posts: (.*?)(\n?)</i)) { var pstcnt=parseInt(RegExp.$1.replace(/\,/g,'')); var mplnks=tds[tt].getElementsByTagName('a'), st=0; var vpadj=(pb_action=='viewprofile' ? 0 : 2); if (mplnks.length>2 && mplnks[vpadj].className && mplnks[vpadj].className.match(/group/) && !mplnks[vpadj].className.match(excl)) { var starBabies=tds[tt].getElementsByTagName('img'); for (a=postRankStars.length-1; a>=0; a--) { if (pstcnt>=postRankStars[a][0]) { var starcnt=postRankStars[a][1]; break; } } while (starBabies[st] && (!starBabies[st].alt || starBabies[st].alt!='*')) st++; if (starBabies[st]) { while (starBabies[st].nextSibling && starBabies[st].nextSibling.nodeName.match(/img/i)) starBabies[st].parentNode.removeChild(starBabies[st].nextSibling); var savestar=starBabies[st].cloneNode(true); var starspot=starBabies[st].nextSibling; starBabies[st].parentNode.removeChild(starBabies[st]); for (ns=0; ns<starcnt; ns++) { starspot.parentNode.insertBefore(savestar.cloneNode(true), starspot); if ((ns+1)%lineBreakAfterHowManyStars==0 && lineBreakAfterHowManyStars>0) starspot.parentNode.insertBefore(document.createElement('br'), starspot); } } } } } } //--> </script>
|
|
|
Post by Wormopolis on Dec 25, 2011 1:15:38 GMT -8
version update 1.1: optional variable for adding a line break after a certain number of stars
|
|