|
Post by Wormopolis on Apr 30, 2012 21:57:59 GMT -8
Browsers tested: IE, FF and chrome placement: global footer
this code will let you setup different on/off icons for the boards on the main page or the sub-boards from within the board settings panel
<script type="text/javascript"> <!-- // different On/Off Icons per board // board setup panel // v 1.01 // by Wormopolis - www.wormocdes.com // keep header intact - do not repost
var folderToOnOffImages="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/onofficons/"; //to conserve space use a common folder
if (pb_action.match(/boardcreate2|boardmodify2/)) { for (frm=document.getElementsByTagName('form'), ff=0; ff<frm.length; ff++) { if (frm[ff].getAttributeNode("action").value && frm[ff].getAttributeNode("action").value.match(/action=board(create|modify)3/)) break; } if (frm[ff]) { var descrow=frm[ff].description.parentNode.parentNode.parentNode; var nwrw=descrow.cloneNode(true); nwrw.id='onoff_row'; descrow.parentNode.parentNode.width='90%'; nwrw.firstChild.firstChild.innerHTML="On/Off Icons:"; nwrw.firstChild.nextSibling.firstChild.innerHTML="On:<br>"+folderToOnOffImages+"<input name='on_icon' width='40' onmouseout='if (this.value) {document.getElementById(\"on_icon_check\").src=folderToOnOffImages+this.value; document.getElementById(\"on_icon_check\").style.display=\"\"; } else { document.getElementById(\"on_icon_check\").style.display=\"none\";}' onblur='if (this.value) {document.getElementById(\"on_icon_check\").src=folderToOnOffImages+this.value; document.getElementById(\"on_icon_check\").style.display=\"\"; } else { document.getElementById(\"on_icon_check\").style.display=\"none\";}'><center><img id='on_icon_check' style='display:none' src='blank.gif'></center>Off:<br>"+folderToOnOffImages+"<input name='off_icon' width='40' onmouseout='if (this.value) {document.getElementById(\"off_icon_check\").src=folderToOnOffImages+this.value; document.getElementById(\"off_icon_check\").style.display=\"\"; } else { document.getElementById(\"off_icon_check\").style.display=\"none\";}' onblur='if (this.value) {document.getElementById(\"off_icon_check\").src=folderToOnOffImages+this.value; document.getElementById(\"off_icon_check\").style.display=\"\"; } else { document.getElementById(\"off_icon_check\").style.display=\"none\";}'><center><img id='off_icon_check' style='display:none' src='blank.gif'></center>"; nwrw.firstChild.nextSibling.nextSibling.firstChild.innerHTML="Enter on/off icons if you want to customize them"; descrow.parentNode.insertBefore(nwrw, descrow.nextSibling); if (frm[ff].description.value.match(/\[onoff=(.*?):(.*?)\]/)) { var holdthis=frm[ff].description.value.match(/\[onoff=(.*?):(.*?)\]/); frm[ff].on_icon.value=holdthis[1]; if (holdthis[1]) { document.getElementById("on_icon_check").src=folderToOnOffImages+holdthis[1]; document.getElementById("on_icon_check").style.display=''; } frm[ff].off_icon.value=holdthis[2]; if (holdthis[2]) { document.getElementById("off_icon_check").src=folderToOnOffImages+holdthis[2]; document.getElementById("off_icon_check").style.display=''; } frm[ff].description.value=frm[ff].description.value.replace(/\[onoff=(.*?):(.*?)\]/,''); } if (frm[ff].addEventListener) { frm[ff].addEventListener('submit',addOnOfftoDesc,true); } else { frm[ff].attachEvent('onsubmit',addOnOfftoDesc); } } } if (pb_action.match(/home|boardindex/)) { for (td=document.getElementsByTagName('td'), tt=0; tt<td.length; tt++) { if (td[tt].width=='66%' && td[tt].className.match(/windowbg/)) { var getmtch=td[tt].innerHTML.match(/\[onoff=(.*?):(.*?)\]/); if (getmtch) { var onoffimg=td[tt].previousSibling.firstChild; if (getmtch[1] && onoffimg.src.match(/on\.(jpg|png|gif)/)) { onoffimg.src=folderToOnOffImages+getmtch[1]; } if (getmtch[2] && onoffimg.src.match(/off\.(jpg|png|gif)/)) { onoffimg.src=folderToOnOffImages+getmtch[2]; } td[tt].innerHTML=td[tt].innerHTML.replace(/\[onoff=(.*?):(.*?)\]/,''); } } } } function addOnOfftoDesc() { var brdfrm= document.getElementById('onoff_row').parentNode.parentNode.parentNode; if (brdfrm.on_icon.value || brdfrm.off_icon.value) { brdfrm.description.value+='[onoff='+brdfrm.on_icon.value +':'+ brdfrm.off_icon.value+ ']'; } }
//--> </script>
|
|