2006-9-12 02:30 PM
[kae′]
【xanga】最小化你的左面module
功能介紹:
令你 xanga 左面的 module 做到最小化的效果 (全部 module 會被隱藏,只能看到 module的標題)
而 module 的標題則會變成連結,當按上連結時那 module 就會變回正常,而再按一次則可把那module再次隱藏
唔明既可以睇下示範: http://www.xanga.com/easteregg
使用方法:
1. Copy and Paste the scripts into your CLAF's website stats
2. Save and that's it!
[code]
<script type="text/javascript">
//
// ============================
// "Minimize your modules"
// version 2.0, July, 2005
// ============================
//
// ©2005 EasterEgg
// If you change the value of displayTopModule to 1, the top module will be displayed
// by default. Set it's value to 0 if you don't want this.
//
displayTopModule = 1;
allTables = document.getElementsByTagName('table');
leftSideModules = new Array();
for (i=0; i<allTables.length; ++i)
{
if (allTables[i].className == 'left')
{
allTables[i].id = 'leftsidemod' + leftSideModules.length;
leftSideModules.push(allTables[i]);
}
}
function toggleDisplayOrHide(anElement,idNr)
{
extraRow = document.getElementById(idNr).getElementsByTagName('TR')[2];
if (anElement.style.display == 'none')
{
anElement.style.display = ''
if (extraRow)
document.getElementById(idNr).getElementsByTagName('TR')[2].style.display = '';
}
else
{
anElement.style.display = 'none';
if (extraRow)
document.getElementById(idNr).getElementsByTagName('TR')[2].style.display = 'none';
}
}
headerLinkColor = '';
topStyleSheet = document.getElementsByTagName('style')[0];
if (document.URL.indexOf('weblogs'))
topStyleSheet = document.getElementsByTagName('style')[1];
if (topStyleSheet)
{
searchStr = 'table.left TH { color: ';
searchStrPos = topStyleSheet.innerHTML.indexOf(searchStr);
if (searchStrPos)
{
searchStrPos = searchStrPos + searchStr.length;
headerLinkColor = topStyleSheet.innerHTML.substring(searchStrPos, searchStrPos + 7);
}
}
for (n = 0; n<leftSideModules.length; ++n)
{
if (navigator.userAgent.indexOf('Opera') == -1)
{
temp1 = leftSideModules[n].getElementsByTagName('TH')[0].innerHTML;
temp2 = '<a href=\"#\" onclick=\"javascript:toggleDisplayOrHide(document.getElementById(' +
'\'' + leftSideModules[n].id + '\').getElementsByTagName(\'TR\')[1],\'' +
leftSideModules[n].id + '\'); return false;\" style=\"text-decoration: none; color: ' +
headerLinkColor + ';\">' + temp1 + '</a>';
leftSideModules[n].getElementsByTagName('TH')[0].innerHTML = temp2;
if ((n == 0) && (displayTopModule == 1))
leftSideModules[n].getElementsByTagName('TR')[1].style.display = ''
else
leftSideModules[n].getElementsByTagName('TR')[1].style.display = 'none';
if (leftSideModules[n].getElementsByTagName('TR')[2])
leftSideModules[n].getElementsByTagName('TR')[2].style.display = 'none';
}
}
</script>
[/code]
支援Browser: Internet Explorer, Firefox, Netscape