|
Post by Wormopolis on Dec 19, 2008 14:36:17 GMT -8
Browser tested: IE and FF Placement: Main Footer Lists sub-boards in a DIV that shows/hides on a mouseover/mouseout. Must have "Display # of sub-boards" set to true under General settings.
<script type="text/javascript"> <!--
/* Sub Boards in hiding div drop down by Wormopolis */ // version 1.1 /* Please keep header intact and do not repost */
function XBrowserAddHandler(target,eventName,handlerName) { if ( target.addEventListener ) { target.addEventListener(eventName, function(e){target[handlerName](e);}, false); } else { target.attachEvent("on" + eventName, function(e){target[handlerName](e);}); } }
if(window.location.href.match(/action=home/) || !window.location.href.match(/action/)) { var cells=document.getElementsByTagName('td'); var jumper=document.getElementById('forumjump').options; for (i=cells.length-1; i>0; i--) { if(cells[i].width && cells[i].width=="66%" && cells[i].className=="windowbg2" && cells[i].align=="left" && cells[i].vAlign=="top" && cells[i].innerHTML.match(/\((\d+)\ssub-board(s)?\)/)){ subBds=cells[i].getElementsByTagName('font'); for (e=0; e<subBds.length; e++) { if (subBds[e].innerHTML.match(/\((\d+)\ssub-board(s)?\)/)){ subBdstarget=subBds[e]; } } subBdstarget.innerHTML='<div id="oldsub'+i+'" align="left" style="width:120px"> SHOW SUB FORUMS </div>'; showspot=subBdstarget.getElementsByTagName('div')[0]; container=subBdstarget.parentNode.parentNode; var iFont=document.createElement('div'); iFont.id='subs'+i; iFont.style.width="120px" iFont.align="left"; iFont.className="windowbg"; iFont.style.display="none"; iFont.innerHTML='SUB FORUMS:<br>'; var iBoardName=cells[i].getElementsByTagName('a')[0].href.split('board=')[1]; for(a=0;a<jumper.length;a++){ if(jumper[a].value.match(/board=/) && jumper[a].value.split('board=')[1]==iBoardName){ for(c=a+1;c<jumper.length;c++){ if(!jumper[c] || !jumper[c].innerHTML.match(/---\s/)){ break; }
iFont.innerHTML+='<a href="'+jumper[c].value+'">'+jumper[c].innerHTML.replace(/---\s/g, '')+'</a><br>';
} } } subBdstarget.appendChild(iFont);
function SubBoardDivShow(e) { pb_bubble=1; newsub=document.getElementById('subs'+this.SubBoards); oldsub=document.getElementById('oldsub'+this.SubBoards); newsub.style.display=""; oldsub.style.display="none"; var evt = e ? e: window.event; if(evt.stopPropagation){ evt.stopPropagation(); }else{ evt.cancelBubble = true; } }
function SubBoardDivHide(e) { newsub=document.getElementById('subs'+this.SubBoards); oldsub=document.getElementById('oldsub'+this.SubBoards); oldsub.style.display=""; newsub.style.display="none"; pb_bubble=0; }
function stopprop(e) { var evt = e ? e: window.event; if(evt.stopPropagation){ evt.stopPropagation(); }else{ evt.cancelBubble = true; } }
showspot.SubBoards=i; iFont.SubBoards=i; container.SubBoards=i; showspot.OverHandler = SubBoardDivShow; iFont.OverHandler = stopprop; container.OverHandler = SubBoardDivHide;;
XBrowserAddHandler(showspot,"mouseover","OverHandler"); XBrowserAddHandler(container,"mouseover","OverHandler"); XBrowserAddHandler(iFont,"mouseover","OverHandler");
} } }
//--> </script>
Preview: Before: After:
|
|
JJ
Not New Member
Posts: 5
JJ said 0 great things
|
Post by JJ on Apr 21, 2009 9:52:58 GMT -8
I joined just to tell you that this code is awesome. I love it. I saw it over at PB support this morning and just put it on my site. Wow!
|
|
|
Post by Wormopolis on Apr 21, 2009 12:46:04 GMT -8
eventually I am merging it with my new forum remodel code: Hookworm
Thank you for the compliment!
|
|
JJ
Not New Member
Posts: 5
JJ said 0 great things
|
Post by JJ on Apr 21, 2009 12:49:09 GMT -8
You are very welcome. I will be on the lookout for your name and codes in the future.
|
|
|
Post by Wormopolis on Apr 19, 2010 2:20:58 GMT -8
version upgrade 1.1: should handle board names when they get replaced by images.
|
|
caspian
Not New Member
Posts: 2
caspian said 0 great things
|
Post by caspian on Apr 19, 2010 18:07:15 GMT -8
The updated version works beautifully! Thank you kindly.
|
|