Post by iAlex on Dec 30, 2007 19:28:15 GMT -5
This code will allow you to split certain categories that you specify. This means that you will be able create a gap above a category of your choice, rather than all categories being split from each other.
This code should also be compatible with most head/base codes and Slipstream everywhere. Just ensure that this code is placed before them.
Cross Browser.
Global Footer.
Open Source.
<script type="text/javascript">
<!--
/*Split Certain Categories - By iAlex - Open Source*/
var iCatId=/^(Category Id|Category Id 2|Category Id 3)$/; //Category Id's
if(location.href.match(/action=home/) || !location.href.match(/action/) && !document.postForm && !document.modifyForm && !document.title.match(/\s-\sLogin/)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).className=="catbg" && iTd.item(i).colSpan=="5" && iTd.item(i).align!="right" && iTd.item(i).firstChild.name.match(iCatId) && iTd.item(i).parentNode.previousSibling.firstChild.className!="titlebg"){
var iParent=iTd.item(i).parentNode.parentNode.parentNode;
var iSplit=document.createElement('div');
while(iTd.item(i).parentNode.nextSibling && iTd.item(i).parentNode.nextSibling.nodeName.match(/tr/i)){
iSplit.appendChild(iTd.item(i).parentNode.nextSibling);
}
iSplit.insertBefore(iTd.item(i).parentNode, iSplit.firstChild);
iSplit.insertBefore(iParent.rows.item(0).cloneNode(true), iSplit.firstChild);
iSplit.innerHTML='<b'+'r/><b'+'r/><table border="0" width="100%" cellspacing="0" cellpadding="0" class="bordercolor"><tr><td><table cellpadding="4" cellspacing="1" border="0" width="100%">'+iSplit.innerHTML+'</table></td></tr></table>';
var iTab=iParent.parentNode.parentNode.parentNode.parentNode;
iTab.parentNode.insertBefore(iSplit, iTab.nextSibling);
}
}
}
//-->
</script>
You simply need to edit the red text at the top of the code with the ID (not the names) of the categories you wish to split:
var iCatId=/^(Category Id|Category Id 2|Category Id 3)$/; //Category Id's
You can add as many categories as you wish, just separate each with a: |
var iCatId=/^(Category Id|Category Id 2|Category Id 3|Category Id 4|Category Id 5)$/; //Category Id's
This code should also be compatible with most head/base codes and Slipstream everywhere. Just ensure that this code is placed before them.
Cross Browser.
Global Footer.
Open Source.
<script type="text/javascript">
<!--
/*Split Certain Categories - By iAlex - Open Source*/
var iCatId=/^(Category Id|Category Id 2|Category Id 3)$/; //Category Id's
if(location.href.match(/action=home/) || !location.href.match(/action/) && !document.postForm && !document.modifyForm && !document.title.match(/\s-\sLogin/)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).className=="catbg" && iTd.item(i).colSpan=="5" && iTd.item(i).align!="right" && iTd.item(i).firstChild.name.match(iCatId) && iTd.item(i).parentNode.previousSibling.firstChild.className!="titlebg"){
var iParent=iTd.item(i).parentNode.parentNode.parentNode;
var iSplit=document.createElement('div');
while(iTd.item(i).parentNode.nextSibling && iTd.item(i).parentNode.nextSibling.nodeName.match(/tr/i)){
iSplit.appendChild(iTd.item(i).parentNode.nextSibling);
}
iSplit.insertBefore(iTd.item(i).parentNode, iSplit.firstChild);
iSplit.insertBefore(iParent.rows.item(0).cloneNode(true), iSplit.firstChild);
iSplit.innerHTML='<b'+'r/><b'+'r/><table border="0" width="100%" cellspacing="0" cellpadding="0" class="bordercolor"><tr><td><table cellpadding="4" cellspacing="1" border="0" width="100%">'+iSplit.innerHTML+'</table></td></tr></table>';
var iTab=iParent.parentNode.parentNode.parentNode.parentNode;
iTab.parentNode.insertBefore(iSplit, iTab.nextSibling);
}
}
}
//-->
</script>
You simply need to edit the red text at the top of the code with the ID (not the names) of the categories you wish to split:
var iCatId=/^(Category Id|Category Id 2|Category Id 3)$/; //Category Id's
You can add as many categories as you wish, just separate each with a: |
var iCatId=/^(Category Id|Category Id 2|Category Id 3|Category Id 4|Category Id 5)$/; //Category Id's