Amanda
Forum Addict
hi
Posts: 251
|
Post by Amanda on Apr 2, 2012 4:08:30 GMT
This code will alphabetize the users online in the info center. This may not be compatible with other info center modifiers. No editing required. Enjoy. ~Wonder
Main Footer
<script> //Alphabetize Users Online v1.0 [CB]
//Copyright 01-03-2006 by ~Wonder //May be reposted anywhere as long as this header remains in tact
if(!location.href.match(/\=/)) { usersOnline=new Array(); for(i=document.links.length-1;i>=0;i--) { if(document.links[i].parentNode.innerHTML.match(/Most users online/)) { usersOnline.push(document.links[i].cloneNode(true)); if(document.links[i].nextSibling) document.links[i].nextSibling.nodeValue=""; document.links[i].style.display="none"; } else if(usersOnline.length>0) break; }
usersOnline.sort(sortLinks); document.links[i+1].parentNode.insertBefore(usersOnline[usersOnline.length-1],document.links[i+1]); for(j=usersOnline.length-2;j>=0;j--) { c=document.createElement("span"); c.innerHTML=", "; document.links[i+1].parentNode.insertBefore(c,document.links[i+1]); document.links[i+1].parentNode.insertBefore(usersOnline[j],c); } }
function sortLinks(a,b) { c=a.innerHTML.charAt(0).toLowerCase(); d=b.innerHTML.charAt(0).toLowerCase(); if(c>d) return 1; if(c<d) return -1; return 0; } </script>
|
|