NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 6, 2011 4:00:44 GMT -8
divisionsoftriad.proboards.comHey Wormo, I'm trying to integrate two codes into The Ultimate Info Center Code. 1. Display Highest Ranking Member by Wormopolis and 2. Your News in Info Center by Hey support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70561On the Display Highest Ranking, is it possible to have it display the highest member in several groups? (I.E) My rank structure has several people that are of Equal rank. Is it possible to display: Highest Admin (groups 1,13,0) Highest Angel (groups 2,5,11) Highest Demon (groups 3,6,12) Highest Reaper (groups 4,7,8,9) (the groups numbers aren't accurate it's just an example) And there's also a small issue of the pm notification that's built into the Info Center Rework not working. It doesn't display the numbers at all.
|
|
|
Post by Wormopolis on Oct 7, 2011 23:57:13 GMT -8
change these 2 lines:
var totalPMs = (td[2].innerHTML.match(/you have (.+?),/i)) ? RegExp.$1: ''; var newPMs = (td[2].innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: '';
to this:
var totalPMs = (welcometablesave.getElementsByTagName('td')[2].innerHTML.match(/you have (.+?),/i)) ? RegExp.$1: ''; var newPMs = (welcometablesave.getElementsByTagName('td')[2].innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: '';
<script type="text/javascript"> <!-- // declare highest ranking member
rankOrderArrayAdmin=[1,13,0]; rankOrderArrayAngel=[2,5,11]; rankOrderArrayDemon=[3,6,12]; rankOrderArrayReaper=[4,7,8,9];
for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) { if (tds[i].className=='catbg' && tds[i].colSpan==2 && tds[i].innerHTML.match(/users online/i)) { var HRfragment=document.createDocumentFragment(); targetCell=tds[i].parentNode.nextSibling.firstChild.nextSibling; userList=targetCell.getElementsByTagName('font')[0].getElementsByTagName('a'); highestGroupAdmin=rankOrderArrayAdmin.length; highestNameAdmin=""; highestGroupAngel=rankOrderArrayAngel.length; highestNameAngel=""; highestGroupDemon=rankOrderArrayDemon.length; highestNameDemon=""; highestGroupReaper=rankOrderArrayReaper.length; highestNameReaper=""; for (j=0; j<userList.length; j++) { if (userList[j].className.match(/group(\d+)/)) { res=parseInt(RegExp.$1); newresAdmin=rankOrderArrayAdmin.length; newresAngel=rankOrderArrayAngel.length; newresDemon=rankOrderArrayDemon.length; newresReaper=rankOrderArrayReaper.length; for (r=0; r<rankOrderArrayAdmin.length; r++) if (res==rankOrderArrayAdmin[r]) newresAdmin=r; if (newresAdmin<highestGroupAdmin) { highestGroupAdmin=newresAdmin; highestNameAdmin=userList[j]; } for (r=0; r<rankOrderArrayAngel.length; r++) if (res==rankOrderArrayAngel[r]) newresAngel=r; if (newresAngel<highestGroupAngel) { highestGroupAngel=newresAngel; highestNameAngel=userList[j]; } for (r=0; r<rankOrderArrayDemon.length; r++) if (res==rankOrderArrayDemon[r]) newresDemon=r; if (newresDemon<highestGroupDemon) { highestGroupDemon=newresDemon; highestNameDemon=userList[j]; } for (r=0; r<rankOrderArrayReaper.length; r++) if (res==rankOrderArrayReaper[r]) newresReaper=r; if (newresReaper<highestGroupReaper) { highestGroupReaper=newresReaper; highestNameReaper=userList[j]; } } } if (highestNameAdmin || highestNameAngel || highestNameDemon || highestNameReaper) { if (highestNameAdmin) { HRfragment.appendChild(document.createTextNode('Highest Ranking Admin: ')); HRfragment.appendChild(highestNameAdmin.cloneNode(true)); HRfragment.appendChild(document.createElement('br')); } if (highestNameAngel) { HRfragment.appendChild(document.createTextNode('Highest Ranking Angel: ')); HRfragment.appendChild(highestNameAngel.cloneNode(true)); HRfragment.appendChild(document.createElement('br')); } if (highestNameDemon) { HRfragment.appendChild(document.createTextNode('Highest Ranking Demon: ')); HRfragment.appendChild(highestNameDemon.cloneNode(true)); HRfragment.appendChild(document.createElement('br')); } if (highestNameReaper) { HRfragment.appendChild(document.createTextNode('Highest Ranking Reaper: ')); HRfragment.appendChild(highestNameReaper.cloneNode(true)); HRfragment.appendChild(document.createElement('br')); } } } }
// --> </script>
then in the info center, where you want the list to appear (assuming):
var usersOn = td[t+4].innerHTML.split(/<br\s?\/?>/i)[1].replace('\'','\''); userHolder += ''+usersOn+''; userHolder+= "<br>"+HRfragment.innerHTML;
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 8, 2011 6:10:02 GMT -8
Okay I implemented both codes.
The PM fix didn't work. It still doesn't show the numbers.
I put in your new code and then replaced the code like you showed. Only now it says: undefined.
|
|
|
Post by Wormopolis on Oct 8, 2011 11:53:48 GMT -8
ok.. new approach.
up in this code // Get Forum Time for 'Time limit on deleting/modifying posts' code
insert these 2 lines var totalPMs = (td[2].innerHTML.match(/you have (.+?),/i)) ? RegExp.$1: ''; var newPMs = (td[2].innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: '';
then remove the 2 lines I had you modify from the info center code completely.
|
|
|
Post by Wormopolis on Oct 8, 2011 12:01:21 GMT -8
change this
userHolder+= "<br>"+HRfragment.innerHTML;
to this
userHolder+= (HRfragment ? "<br>"+HRfragment.innerHTML : "" );
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 8, 2011 14:08:59 GMT -8
Getting there. Now it says:
You have undefined, undefined new.
And the highest ranking still says undefined.
Edit:
Also now if you try to look at it as anyone but the admin it's all out of whack.
(Is it possibly the time limit code? Because that isn't working. I could still modify after the time limit was up.)
|
|
|
Post by Wormopolis on Oct 8, 2011 15:20:54 GMT -8
its ou of whack because the IC code is getting interrupted.
sometimes codes just dont play well together.
Im still looking.
|
|
|
Post by Wormopolis on Oct 8, 2011 15:28:33 GMT -8
I modified the code above
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 8, 2011 17:50:16 GMT -8
If the time restriction code isn't compatible then I can delete it altogether. It's not working anyways. (Was going to be my next request on the support board.) We can even get rid of the PM modification in the Info Board since I have the PM center up top beneath the banner. The only thing to integrate then is the ranking groups. (I applied the new code.)
|
|
|
Post by Wormopolis on Oct 8, 2011 18:17:09 GMT -8
the PM one still isnt working?
I can only test the highest ranking if someone is online. otherwise it returns nothing.
|
|
|
Post by Wormopolis on Oct 8, 2011 18:19:47 GMT -8
ok those 2 lines up in the time code
var totalPMs = (td[2].innerHTML.match(/you have (.+?),/i)) ? RegExp.$1: ''; var newPMs = (td[2].innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: '';
change those to this:
pmchk=document.getElementsByTagName('td')[2]; var totalPMs = (pmchk.innerHTML.match(/you have (.+?),/i)) ? RegExp.$1: ''; var newPMs = (pmchk.innerHTML.match(/<\/a>, (.+?) new/i)) ? RegExp.$1: '';
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 8, 2011 18:42:58 GMT -8
Okay that fixed the PM issue. I've been online this whole time. I can sign in as my other profile if it will help.
|
|
|
Post by Wormopolis on Oct 8, 2011 18:44:14 GMT -8
apparently you arent allowed to access a documentfragment.innerHTML
so change
var HRfragment=document.createDocumentFragment();
to this
var HRfragment=document.createElement('div');
|
|
NetMaster
Code Helper
"Get caught in my web!"
Posts: 305
NetMaster said 0 great things
|
Post by NetMaster on Oct 8, 2011 19:13:15 GMT -8
Awesome Wormo! It works! Thank you once again. (Now to get that time restriction working. But I'll post that in the support forum.)
|
|
|
Post by Wormopolis on Oct 8, 2011 21:07:56 GMT -8
change this
userHolder += ''+usersOn+''; userHolder+= (HRfragment ? "<br>"+HRfragment.innerHTML : "" );
to this
userHolder += ''+usersOn+ (HRfragment ? '<br>'+HRfragment.innerHTML : '' );
|
|