|
Post by Wormopolis on Mar 10, 2011 18:32:52 GMT -8
Browser Tested: IE and FF placement: BOARD footer
this code has 3 modes. mode 1: you can force all new threads created to end up in a different board you specify. the variable at the top will let you choose which board they go to.
mode 2: you can have it create a drop down list, based off the boards it finds in the forumjump, that the member can select where their post ends up
mode 3: you can create your own dropdown list of boards to restrict which boards the member can choose.
do NOT place in global footer or all new threads will be affected by this code.
<script type="text/javascript"> <!-- // destination board selector on a new thread/post // v1.5 // by Wormopolis // www.wormocodes.com // do not repost - keep header intact
var forceAlwaystoThisBoard="general"; //if you want all posts to go to this board, put in boardid, otherwise leave blank
// if above variable is blank, a drop down will be created
var listAllBoards=true; //put all boards from forumjump into drop down
// if false, it will only list the boards in this array:
var boardDropArray=[ ['general', 'General Board'], //boardid, board name ['postreclass', 'Post Reclass Board'], ['boardid', 'board name'], ['boardid', 'board name'] // no comma last entry ];
// no need to edit below unless you know what you are doing
if (document.postForm) {
if (location.href.match(/thread=/)) document.postForm.thread.parentNode.removeChild(document.postForm.thread);
function changeDest() { dd=document.getElementById('destBoard_drop'); hm=document.getElementById('holdme'); postForm.board.value=(dd.value=='' ? hm.value : dd.value); }
if (forceAlwaystoThisBoard=='') { plc=postForm.counter.parentNode.parentNode; bsel=plc.cloneNode(true); bsel.firstChild.firstChild.innerHTML="Post to Board:"; defaultBoard=(location.href.match(/board=(.*?)&/) ? RegExp.$1 : postForm.board.value); bsel.firstChild.nextSibling.innerHTML='<input id="holdme" type="hidden" value="'+defaultBoard+'"> <select id="destBoard_drop" onchange="changeDest()"> <option value="">current board</option> </select>'; plc.parentNode.insertBefore(bsel, plc.nextSibling);
fj=document.getElementById('forumjump'); dropper=document.getElementById('destBoard_drop');
if (listAllBoards) { for (w=0; w<fj.options.length; w++) { if (fj.options[w].value.match(/board=(.*?)$/)) { btmp=RegExp.$1; nwopt=document.createElement('option'); nwopt.value=btmp; nwopt.text=fj.options[w].innerHTML.replace(/\s*\-+\s*/,''); try { dropper.add(nwopt, null); } catch(ex) { dropper.add(nwopt); } } } } else { for (w=0; w<boardDropArray.length; w++) { nwopt=document.createElement('option'); nwopt.value=boardDropArray[w][0]; nwopt.text=boardDropArray[w][1]; try { dropper.add(nwopt, null); } catch(ex) { dropper.add(nwopt); } } } } else { postForm.board.value=forceAlwaystoThisBoard; } } // --> </script>
|
|