|
Post by Wormopolis on Sept 24, 2011 10:48:18 GMT -8
browsers tested: IE, FF and Chrome placement: main or global footer
this will organize the different sections of a member's profile and create a tag across the top for each section. will also work with other profile mods that add new sections, as long as this code runs after.
CSS included to let you style the look of the tabs and boxes
<style type="text/css"> <!-- .profileTable {background-color: #0044ff; border: #00ff44 1px solid;} .profileTableTab {background-color: #111111; cursor: pointer} .profileTableTabActive {background-color: #444444; cursor: pointer} .profileTableData {background-color: #111111; height: 300px;} --> </style>
<script type="text/javascript"> <!-- // Auburns profile sections v1.1 // by Wormopolis - www.wormocodes.com // keep header intact - do not repost unless you are Auburn
if (pb_action=='viewprofile' && !location.href.match(/noprofrem/)) { var chkPlace=document.getElementsByName('maxresults')[0]; if (chkPlace) { chkPlace.parentNode.parentNode.parentNode.previousSibling.rowSpan=7; if (true && chkPlace.parentNode.nodeName=='FORM') { var holdrow=chkPlace.parentNode.parentNode.parentNode.parentNode.previousSibling.rowIndex+1; var oldtbl=chkPlace.parentNode.parentNode.parentNode.parentNode; var holdtbl=oldtbl.parentNode; var holdthis=oldtbl.innerHTML; holdthis=holdthis.split('</FONT>'); holdthis[1]+='</FORM>'; holdthis=holdthis.join('</FONT>'); holdthis=holdthis.split(/<td(.*?)>/i); holdthis[0]=holdthis[0].split('</TD>')[0]; holdthis[1]=holdthis[1].split('</TD>')[0]; holdtbl.removeChild(oldtbl); holdtbl.removeChild(holdtbl.getElementsByTagName('form')[0]); var nwrw=holdtbl.insertRow(holdrow); nwrw.id='testing'; nwrw.insertCell(0); nwrw.cells[0].vAlign='top'; nwrw.cells[0].width='25%'; nwrw.cells[0].rowSpan='7'; nwrw.cells[0].innerHTML=holdthis[0]; nwrw.insertCell(-1); nwrw.cells[1].vAlign='top'; nwrw.cells[1].innerHTML=holdthis[1]; } //cant believe I had to do all that to fix the PB nesting error! } for (tds=document.getElementsByTagName('td'), cl=0; cl<tds.length; cl++) { if (true && tds[cl].width=='80%' && tds[cl].className.match(/windowbg/) && tds[cl].innerHTML.match(/member's bio/i)) { var topRow=tds[cl].getElementsByTagName('b')[0].cloneNode(true); // seek out HR bars, start from end. var sectionCount=0; while(tds[cl].getElementsByTagName('hr').length) { curbar=tds[cl].getElementsByTagName('hr'); curbarlast=curbar[curbar.length-1]; if (curbarlast.parentNode.size && curbarlast.parentNode.size=='2' && curbarlast.parentNode.firstChild.nodeName.toUpperCase()=='B') { sectionCount++; var nwtbl=document.createElement('table'); nwtbl.style.display='none'; nwtbl.width='100%'; var nwrw=nwtbl.insertRow(0); var tmpholder=nwrw.parentNode; var headRow=curbarlast.parentNode.parentNode.parentNode; var curRow=headRow.nextSibling; var keepTitle=headRow.getElementsByTagName('b')[0].firstChild.nodeValue.replace(' - ',''); nwtbl.id=keepTitle; headRow.parentNode.removeChild(headRow); while (curRow) { var nxtvictim=curRow.nextSibling; tmpholder.appendChild(curRow); curRow=nxtvictim; } tds[cl].insertBefore(nwtbl, tds[cl].firstChild.nextSibling); } else { var tmprep=document.createElement('div'); tmprep.className='replacehr'; curbarlast.parentNode.replaceChild(tmprep, curbarlast); } } break; } } for (dvs=document.getElementsByTagName('div'), dd=dvs.length-1; dd>=0; dd--) { if (dvs[dd].className=='replacehr') dvs[dd].parentNode.replaceChild(document.createElement('hr'), dvs[dd]); }
function showPData(targ) { var tblid=targ.firstChild.value; var cltab=targ.parentNode; for (tabcls=cltab.parentNode.childNodes, tt=0; tt<tabcls.length; tt++) tabcls[tt].className='profileTableTab'; cltab.className='profileTableTabActive'; var tempthing=document.getElementById(tblid); for (tbls=document.getElementById('profileTableData').childNodes, tt=0; tt<tbls.length; tt++) tbls[tt].style.display='none'; tempthing.style.display='inline'; }
topRow.firstChild.nodeValue=''; var abducted=tds[cl].firstChild.firstChild; abducted.className='profileTable'; abducted.insertRow(0); targCell=abducted.rows[0].insertCell(0); targCell.colSpan=sectionCount; targCell.className=targCell.id='profileTableData'; abducted.insertRow(0); for (w=0; w<sectionCount; w++) { curTabCell=abducted.rows[0].insertCell(-1); curTabCell.className='profileTableTab'; var nxtTbl=abducted.parentNode.nextSibling; curTabCell.innerHTML='<div width="100%" onclick="showPData(this);"><input type="hidden" value="'+nxtTbl.id+'">'+nxtTbl.id+'<div>'; targCell.appendChild(nxtTbl); } cntr=tds[cl].insertBefore(document.createElement('center'), tds[cl].firstChild); cntr.appendChild(topRow) abducted.rows[0].cells[0].firstChild.onclick();
}
// --> </script>
preview: running on WormoCodes
|
|