victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 20, 2010 4:52:40 GMT -8
May I have this code altered for selection list to show up when modifying. It will be placed in the Classified section of my board and they have to choose a Prefix of BUY, SELL, TRADE, ENDED. So when they get a result, they have to modify the prefix and choose ENDED. Also may I have the prefixes color coordinated so they can stand out (BUY: SELL: TRADE: ENDED)
<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
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>
|
|
|
Post by Wormopolis on Jan 20, 2010 8:20:49 GMT -8
if they go back and modify the post, do you want all the other Prefixes disabled except for "ENDED"?
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 20, 2010 8:48:08 GMT -8
No they don't need to be disabled just in case they are modifying because of an error; they can be available. Thanks
|
|
|
Post by Wormopolis on Jan 20, 2010 15:11:24 GMT -8
added in color attributes to array. re-enabled prefix selection on modify.
<script type="text/javascript"> <!-- // Prefix on posts using checkboxes // By Wormopolis - Request by Kami // keep header intact
var chkBxArray = [ ["<CODE>","Code Request","CCCC00"], //format: PREFIX , checkbox label, color of label ["<IMG>","Image Request","FF0000"], ["<BAN>","Banner Request","00FF00"], ["<SIG>","Signature Request","0000FF"], ["<ILuvWorm>","Request to date Wormo","FF9999"] ];
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
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/)) { 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]+"'><font color='"+chkBxArray[k][2]+"'>"+chkBxArray[k][1]+"</font><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>
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 22, 2010 4:21:43 GMT -8
It works fine but I need the prefix color to show up in the original post. Right now the color are only when selecting which is great but I also need the Sell, Buy, Trade, Ended to be that color in the title post to stand out.
Example: SELL: PRS-505 BUY: PRS-900 Daily Edition
var chkBxArray = [ ["SELL:", "Want to sale a product (SELL)","004F00"], //format: PREFIX , checkbox label, color of label ["BUY:","Want to buy a product (BUY)","CD0000"], ["TRADE:","Want to trade a product (TRADE)","303030"], ["Ended:","Item no longer available (ENDED)","191970"] ];
|
|
|
Post by Wormopolis on Jan 22, 2010 8:37:06 GMT -8
does it need to do it on the main page as well? That will take longer to write.
having it show on the thread list wont take as long, but I will need a bit.
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 22, 2010 11:49:12 GMT -8
I need it to show up next to the subject. It's showing up next to the subject but it's not color coordinated. Like this thread is in the Request Board and the Subject is Prefix selection on new threads by Wormopolis!
So when I open the request board, I would see:
BUY: Prefix selection on new threads by Wormopolis!
And all the BUY are the same color and so on..
|
|
|
Post by Wormopolis on Jan 22, 2010 14:22:32 GMT -8
no I get what you mean, but my question was if they have to be colored on the main page as well (like if they show up in the "last post" column)?
|
|
|
Post by Wormopolis on Jan 22, 2010 14:42:23 GMT -8
<script type="text/javascript"> <!-- // Prefix on posts using checkboxes // v 2.0 // By Wormopolis - Request by Kami // keep header intact
var chkBxArray = [ ["<CODE>","Code Request","CCCC00"], //format: PREFIX , checkbox label, color of label ["<IMG>","Image Request","FF0000"], ["<BAN>","Banner Request","00FF00"], ["<SIG>","Signature Request","0000FF"], ["<ILuvWorm>","Request to date Wormo","FF9999"] ];
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
adminCheck=false; for (adm=document.getElementsByTagName('a'), i=0; i<adm.length; i++) { if (adm[i].href.match(/action=admin/)) adminCheck=true; }
if (location.href.match(/board=/) && !location.href.match(/action=display/)) { for (tbar=document.getElementsByTagName('td'), pr=0; pr<tbar.length; pr++) { if (tbar[pr].className=='windowbg' && tbar[pr].width=='48%') { ttl=tbar[pr].getElementsByTagName('font')[0]; for (pf=0; pf<chkBxArray.length; pf++) { if (ttl.innerHTML.match(chkBxArray[pf][0])) { tmp="<font color='"+chkBxArray[pf][2]+"'>"+chkBxArray[pf][0]+"</font>"; ttl.innerHTML=ttl.innerHTML.replace(chkBxArray[pf][0],tmp) break; } } } } } if (document.postForm && !location.href.match(/createpoll/)) { 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]+"'><font color='"+chkBxArray[k][2]+"'>"+chkBxArray[k][1]+"</font><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>
that will do it for the thread listings at least. I need to make 1 more revision to this incase they dont specify a color hex to go with a prefix, it chooses default color. but this version works if all prefixes have a hex.
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 24, 2010 17:58:25 GMT -8
I ran into a forum that has exactly what I'm searching for doing a Google search. It's a huge coincidence, so I thought i would share the link. It does not look like a proboards but here is the link: www.mobileread.com/forums/forumdisplay.php?f=124
|
|
|
Post by Wormopolis on Jan 24, 2010 21:17:19 GMT -8
I knew what you meant. I just made a mistake. apparently it didnt like the "<" and ">" in there so I had to escape them.
I also added a class to the prefix tag so you can manipulate it some more
<style type="text/css"> .prfx {background-color: EEEEEE; border: #000000 1px solid;} </style>
<script type="text/javascript"> <!-- // Prefix on posts using checkboxes // v 2.0 // By Wormopolis - Request by Kami // keep header intact
var chkBxArray = [ ["<CODE>","Code Request","CCCC00"], //format: PREFIX , checkbox label, color of label ["<IMG>","Image Request","FF0000"], ["<BAN>","Banner Request","00FF00"], ["<SIG>","Signature Request","0000FF"], ["<ILuvWorm>","Request to date Wormo","FF9999"] ];
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
adminCheck=false; for (adm=document.getElementsByTagName('a'), i=0; i<adm.length; i++) { if (adm[i].href.match(/action=admin/)) adminCheck=true; }
if (location.href.match(/board=/) && !location.href.match(/action=display/)) { for (tbar=document.getElementsByTagName('td'), pr=0; pr<tbar.length; pr++) { if (tbar[pr].className=='windowbg' && tbar[pr].width=='48%') {
ttl=tbar[pr].getElementsByTagName('font')[0]; for (pf=0; pf<chkBxArray.length; pf++) { if (ttl.innerHTML.match(chkBxArray[pf][0].replace('<','<').replace('>','>'))) { tmp="<font class='prfx' color='"+chkBxArray[pf][2]+"'>"+chkBxArray[pf][0].replace('<','<').replace('>','>')+"</font>"; ttl.innerHTML=ttl.innerHTML.replace(chkBxArray[pf][0].replace('<','<').replace('>','>'),tmp) break; } } } } } if (document.postForm && !location.href.match(/createpoll/)) { 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]+"'><font color='"+chkBxArray[k][2]+"'>"+chkBxArray[k][1]+"</font><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>
|
|
victory1
Full Member
Posts: 102
victory1 said 0 great things
|
Post by victory1 on Jan 25, 2010 8:19:49 GMT -8
Thank you! ;D I love it and it worked perfectly!! ;D
|
|
|
Post by Wormopolis on Jan 25, 2010 9:05:23 GMT -8
excellent!
|
|