Post by moneyman18 on Dec 30, 2010 4:53:34 GMT
Description: Allows users to collapse the individual sections of the info center and also the info center as a whole.
Tested In: Firefox 3.6.13, Opera 10, Google Chrome 8, Internet Explorer 8
Main Footer
Note: If you are using a custom info center this code may not work.
You may edit and repost just keep the header intact.
Tested In: Firefox 3.6.13, Opera 10, Google Chrome 8, Internet Explorer 8
Main Footer
<script type="text/javascript"><!--
/*
* Collapsible Info Center Sections
* Made by moneyman18
*/
var mTable = document.getElementsByTagName('table');
for(a = mTable.length-1; a > 4; a--)
if(mTable[a].width == '100%' && mTable[a].cellPadding == 4 && mTable[a].cellSpacing == 1 && mTable[a].rows[0].cells[0].innerHTML.match(/Info Center/i)){
var rows = mTable[a].rows;
function collapseAll(disp){
if(disp == 'none' && !rows[0].cells[0].innerHTML.match(/\(Collapsed\)/))
rows[0].cells[0].innerHTML += ' <font size="1" style="font-weight: normal;"><i>(Collapsed)</i></font>';
else if(rows[0].cells[0].innerHTML.match(/\(Collapsed\)/))
rows[0].cells[0].removeChild( rows[0].cells[0].lastChild );
for(i = 1; i < rows.length; i++){
rows[i].style.display = disp;
if((mB = rows[i].getElementsByTagName('b')) && mB[0] && document.cookie.match(mB[0].innerHTML.replace(/ /g, '')+'=collapsed')){
collapseSection(rows[i].cells[0], 'none');
i++;
}
}
document.cookie = 'infoCenter=collapsed; expires=Sat, 20 Jan '+(disp == 'none'? 2050 : 1990)+' 12:12:12 UTC; path=/';
}
function collapseSection(section, disp){
var cell = section.firstChild.nodeName.toLowerCase() == 'font'? section : section.getElementsByTagName('font')[0].parentNode;
var match = /\(Collapsed\)/.test(cell.innerHTML);
if(disp == 'none' && !match)
cell.innerHTML += ' <font size="1" style="font-weight: normal;"><i>(Collapsed)</i></font>';
else if(disp != 'none' && match)
cell.removeChild( cell.lastChild );
section.parentNode.nextSibling.style.display = disp;
document.cookie = section.id+'=collapsed; expires=Sat, 20 Jan '+(disp == 'none'? 2050 : 1990)+' 12:12:12 UTC; path=/';
}
for(b = 0; b < rows.length; b++)
if(rows[b].cells[0].className && (rows[b].cells[0].className == 'titlebg' || rows[b].cells[0].className == 'catbg'))
with(rows[b].cells[0]){
id = b == 0? 'infoCenter' : getElementsByTagName('b')[0].innerHTML.replace(/ /g, '');
style.cursor = 'pointer';
onclick = function(){
if(this.id == 'infoCenter')
collapseAll((document.cookie.match('infoCenter=collapsed')? '' : 'none'));
else
collapseSection(this, (document.cookie.match(this.id+'=collapsed')? '' : 'none'));
};
}
window.onload = function(){
collapseAll((document.cookie.match('infoCenter=collapsed')? 'none' : ''));
};
break;
}
//--></script>
Note: If you are using a custom info center this code may not work.
You may edit and repost just keep the header intact.