Post by Devin on Apr 6, 2009 22:41:54 GMT -5
Code Name: Sub-Boards Dropdown in Board Cell
Creator: Devin
Preview: Click
Definition: Adds the sub-boards in their parent's board cell, in a dropdown box.
Placement: Main Footer
What to Edit: The first couple variables, read the comments!
Additional Comments: Thank kathy025 for the idea
Creator: Devin
Preview: Click
Definition: Adds the sub-boards in their parent's board cell, in a dropdown box.
Placement: Main Footer
<script type="text/javascript">
<!--
/* Sub-Boards Dropdown in Board Cell
By Devin - Don't redistribute */
var subboardTitle = "Sub Forums";
var subboardMessage = 0; //0 to hide the default sub-board message, e.g. (2 sub-boards)
// No more editing
var td = document.getElementsByTagName("TD");
var fj = document.getElementById("forumjump");
var sbm = /\s\(\d+\ssub-boards?\)/i;
pb_bubble++;
var SBDD = {
init: function(){
if(location.href.match(/action=home/i) || !location.href.match(/(action|board)=/i)){
this.makeEm();
this.fillEm();
}
},
makeEm: function(){
for(i = 0; i < td.length; i++){
if(td[i].width == "8%" && td[i+1] && td[i+1].width == "66%"){
td[i+1].style.cursor = "default";
}
if(td[i].width == "66%" && td[i].innerHTML.match(sbm)){
var sbHolder = document.createElement("DIV");
sbHolder.id = "sbh_" + td[i].getElementsByTagName("a")[0].href.split(/board=/i)[1];
if(subboardMessage == 0){
td[i].innerHTML = td[i].innerHTML.replace(sbm, "");
}
td[i].appendChild(sbHolder);
}
}
},
fillEm: function(){
for(i = 4; i < fj.options.length; i++){
if(!fj.options[i].text.match(/---\s/) && fj.options[i+1] && fj.options[i+1].text.match(/---\s/i)){
var cur_board = fj.options[i].value.split(/board=/i)[1];
if(document.getElementById("sbh_" + cur_board)){
var cur_sel = "<select onchange='if(this.options[this.selectedIndex].value) window.location = \"index.cgi?board=\" + this.options[this.selectedIndex].value + \"\"'><option>" + subboardTitle + "</option>";
while(fj.options[i+1].text.match(/---\s/i)){
i++;
cur_sel += "<option value='" + fj.options[i].value.split(/board=/i)[1] + "'>" + fj.options[i].text.split("--- ")[1] + "</option>";
}
document.getElementById("sbh_" + cur_board).innerHTML = cur_sel;
}
}
}
}
}
SBDD.init();
//-->
</script>
What to Edit: The first couple variables, read the comments!
Additional Comments: Thank kathy025 for the idea