Post by Wormopolis on Jul 20, 2009 14:38:08 GMT -8
Browser tested: IE and FF
placement: board footer
creates a selection list that member must choose before thread can be created. selection appends a set prefix to the beginning of a thread for things like request types or character creations. selection list does not show up when modifying the post except for admins.
code:
placement: board footer
creates a selection list that member must choose before thread can be created. selection appends a set prefix to the beginning of a thread for things like request types or character creations. selection list does not show up when modifying the post except for admins.
code:
<script type="text/javascript">
<!--
// Prefix on posts using checkboxes
// By Wormopolis - Request by Kami
// keep header intact
var chkBxArray = [
["<CODE>","Code Request"], //format: PREFIX , checkbox label
["<IMG>","Image Request"],
["<BAN>","Banner Request"],
["<SIG>","Signature Request"],
["<ILuvWorm>","Request to date Wormo"]
];
var explanationOFsubmitdisabled="Submit button disabled until Request Type chosen";
var additionalInstruction="Please read rules before posting";
var leftSideLabel="Request Type:";
// no need to edit below, unless you know what you are doing
adminCheck=false;
for (adm=document.getElementsByTagName('a'), i=0; i<adm.length; i++) {
if (adm[i].href.match(/action=admin/)) adminCheck=true;
}
if (document.postForm && !location.href.match(/createpoll/) && (adminCheck || !location.href.match(/modifypost/))) {
frm=document.postForm.subject;
// so apparently that doesnt work in FF
frmTbl=frm.parentNode.parentNode.parentNode;
chkbxCell=frmTbl.rows[2].cells[1].cloneNode(true);
descCell=frmTbl.rows[2].cells[0].cloneNode(true);
descCell.firstChild.innerHTML=leftSideLabel;
chkbxCell.innerHTML="";
chkbxCell.id="prefixes";
keepchk=false;
nwchkbx=additionalInstruction +"<br>";
for (k=0; k<chkBxArray.length; k++) {
if (postForm.subject.value.match(chkBxArray[k][0])) {
postForm.subject.value=postForm.subject.value.replace(chkBxArray[k][0]+' ','');
defchk="checked='checked'";
keepchk=true;
} else {
defchk="";
}
nwchkbx+="<input name='prfix' type='radio' style='background-color=\"transparent\"' onclick='document.getElementById(\"sbmit\").disabled=\"\"; document.getElementById(\"distext\").style.display=\"none\"' "+defchk+" value='"+chkBxArray[k][0]+"'>"+chkBxArray[k][1]+"<br>";
}
chkbxCell.innerHTML=nwchkbx;
rowIwant=frmTbl.insertRow(2);
rowIwant.appendChild(descCell);
rowIwant.appendChild(chkbxCell);
for (inp=document.getElementsByTagName('input'), j=0; j<inp.length; j++) {
if (inp[j].type=='submit' && inp[j].tabIndex==3) {
if (!keepchk) {
inp[j].disabled=true;
inp[j].id="sbmit";
inp[j].parentNode.appendChild(document.createElement('br'));
distext=document.createElement('font');
distext.id="distext";
distext.innerHTML=explanationOFsubmitdisabled;
inp[j].parentNode.appendChild(distext);
}
}
}
function addin() {
choices=document.getElementById('prefixes').getElementsByTagName('input');
for ( i=0; i<choices.length; i++) {
if (choices[i].checked) postForm.subject.value=choices[i].value+" "+postForm.subject.value;
}
}
if (document.addEventListener) {
document.postForm.addEventListener('submit',addin,false);
} else {
document.postForm.attachEvent('onsubmit',addin);
}
}
// -->
</script>