Post by wildgoosespeeder on Apr 3, 2010 20:57:16 GMT -8
Most forum software have BBCode buttons with the quick reply but ProBoards doesn't. This mod aims to fix this problem. This code also allows you to add tags and their buttons like the following four tag mods I use on my forum:
Preview
Global Footer
Preview
Global Footer
<script language="javascript">
/*
Ultimate Quick Reply Mod by wildgoosespeeder
Parts of the following codes were used in this code:
UBBC Buttons With Quick Reply by Mithras
Color drop-down in Quick Reply box by Todge
Smileys with quick reply by Peter
*/
if(location.href.match(/thread=/) && !document.postForm && !location.href.match(/action=(downloadattachmentpage|movetopic|reportpost)/) && document.getElementsByTagName("form")[0].method == "post")
{
var buttonsPerRow = 14; // 14 default.
// Buttons - [Image Location, Opening Tag, Closing Tag, Title/Alternate Text]
var buttons = [
["http://s1.images.proboards.com/bold.gif","[b]","[/b]","Bold"],
["http://s1.images.proboards.com/italicize.gif","[i]","[/i]","Italicize"],
["http://s1.images.proboards.com/underline.gif","[u]","[/u]","Underline"],
["http://s1.images.proboards.com/strike.gif","[s]","[/s]","Strikethrough"],
["http://s1.images.proboards.com/glow.gif","[glow=red,2,300]","[/glow]","Glow"],
["http://s1.images.proboards.com/shadow.gif","[shadow=red,left,300]","[/shadow]","Shadow"],
["http://s1.images.proboards.com/move.gif","[move]","[/move]","Marquee"],
["http://s1.images.proboards.com/pre.gif","[pre]","[/pre]","Preformatted Text"],
["http://s1.images.proboards.com/left.gif","[left]","[/left]","Align Left"],
["http://s1.images.proboards.com/center.gif","[center]","[/center]","Align Center"],
["http://s1.images.proboards.com/right.gif","[right]","[/right]","Align Right"],
["http://s1.images.proboards.com/hr.gif","[hr]","","Horizontal Rule"],
["http://s1.images.proboards.com/size.gif","[size=2]","[/size]","Font Size"],
["http://s1.images.proboards.com/face.gif","[font=Verdana]","[/font]","Font Face"],
["http://s1.images.proboards.com/youtube.gif","","YouTube Video"],
["http://s1.images.proboards.com/blockquote.gif","[blockquote]","[/blockquote]","Blockquote"],
["http://s1.images.proboards.com/url.gif","[a href="",""]","[/a]","Insert Hyperlink"],
["http://s1.images.proboards.com/img.gif","[img src="",""]","Insert Image"],
["http://s1.images.proboards.com/email2.gif","[email]","[/email]","Insert Email"],
["http://s1.images.proboards.com/table.gif","[table][tr][td]","[/td][/tr][/table]","Insert Table"],
["http://s1.images.proboards.com/tr.gif","[tr]","[/tr]","Insert Table Row"],
["http://s1.images.proboards.com/td.gif","[td]","[/td]","Insert Table Column Cell"],
["http://s1.images.proboards.com/sup.gif","[sup]","[/sup]","Superscript"],
["http://s1.images.proboards.com/sub.gif","[sub]","[/sub]","Subscript"],
["http://s1.images.proboards.com/tele.gif","[tt]","[/tt]","Teletype"],
["http://s1.images.proboards.com/code.gif","[code]","[/code]","Insert Code"],
["http://s1.images.proboards.com/quote2.gif","[quote]","[/quote]","Insert Quote"],
["http://s1.images.proboards.com/list.gif","[ul]\\n[li]","\\n[/li][li]\\n[/li][li]\\n[/li][/ul]","Insert List"]
];
// List of smileys - [Image Location, UBBC Code, Title/Alternate Text]
var iSmileys = [
["http://s1.images.proboards.com/smiley.gif",":)","Smiley"],
["http://s1.images.proboards.com/wink.gif",";)","Wink"],
["http://s1.images.proboards.com/cheesy.gif",":D","Cheesy"],
["http://s1.images.proboards.com/grin.gif",";D","Grin"],
["http://s1.images.proboards.com/angry.gif","%3E:(","Angry"],
["http://s1.images.proboards.com/sad.gif",":(","Sad"],
["http://s1.images.proboards.com/shocked.gif",":o","Shocked"],
["http://s1.images.proboards.com/cool.gif","8-)","Cool"],
["http://s1.images.proboards.com/huh.gif","???","Huh"],
["http://s1.images.proboards.com/rolleyes.gif","::)","Roll Eyes"],
["http://s1.images.proboards.com/tongue.gif",":P","Tongue"],
["http://s1.images.proboards.com/embarassed.gif",":-[","Embarassed"],
["http://s1.images.proboards.com/lipsrsealed.gif",":-X","Lips Sealed"],
["http://s1.images.proboards.com/undecided.gif",":-/","Undecided"],
["http://s1.images.proboards.com/kiss.gif",":-*","Kiss"],
["http://s1.images.proboards.com/cry.gif",":%27(","Cry"]
];
var hrSize = 435;
var buttonHTML = "";
for(i = 0; i < buttons.length; i++)
{
if(i == buttonsPerRow)
{
var colors = ["Black","Red","Yellow","Pink","Green","Orange","Purple","Blue","Beige","Brown","Teal","Navy","Maroon","Lime Green"];
buttonHTML += " <select name='color' onChange='ubbc(\"[color=\", \"[/color]\", this.options[this.selectedIndex].value);this.selectedIndex=0;'><option value='color'>Colors</option>";
for(c = 0; c < colors.length; c++)
{
buttonHTML += "<option value='" + colors[c].split(" ").join("") + "'>" + colors[c] + "</option>";
}
buttonHTML += "</select><br />";
}
buttonHTML += "<a href='javascript:ubbc(\"" + buttons[i][1] + "\",\"" + buttons[i][2] + "\")'><img src='" + buttons[i][0] + "' border='0' title='" + buttons[i][3] + "' alt='" + buttons[i][3] + "' /></a>";
}
buttonHTML += "<hr width='" + hrSize + "' align='left' />";
for(s = 0; s < iSmileys.length; s++)
{
buttonHTML += "<a href='javascript:ubbc(\" " + iSmileys[s][1] + "\",\"\")'><img src='" + iSmileys[s][0] + "' border='0' title='" + iSmileys[s][2] + "' alt='" + iSmileys[s][2] + "' /></a> ";
}
buttonHTML += "<hr width='" + hrSize + "' align='left' />";
var tds = document.getElementsByTagName("td");
for(a = tds.length; a > 0; a--)
{
if(tds[a-1].width == "100%" && tds[a].align == "right")
{
tds[a-1].innerHTML = buttonHTML + tds[a-1].innerHTML;
break;
}
}
}
function ubbc(open, end)
{
var tAreas = document.getElementsByTagName('textarea');
for(i=0; i<tAreas.length; i++)
{
if(tAreas[i].rows == 5 && tAreas[i].cols == 100)
{
var tArea = tAreas[i];
}
}
var isIE = (document.all)? true : false;
var open = (open)? open : "";
var end = (end)? end : "";
if(isIE)
{
tArea.focus();
var curSelect = document.selection.createRange();
if(arguments[2])
{
curSelect.text = open + arguments[2] + "]" + curSelect.text + end;
}
else
{
curSelect.text = open + curSelect.text + end;
}
}
else if(!isIE && typeof tArea.selectionStart != "undefined")
{
var selStart = tArea.value.substr(0, tArea.selectionStart);
var selEnd = tArea.value.substr(tArea.selectionEnd, tArea.value.length);
var curSelection = tArea.value.replace(selStart, '').replace(selEnd, '');
if(arguments[2])
{
tArea.value = selStart + open + arguments[2] + "]" + curSelection + end + selEnd;
}
else
{
tArea.value = selStart + open + curSelection + end + selEnd;
}
}
else
{
tArea.value += (arguments[2])? open + arguments[2] + "]" + end : open + end;
}
}
</script>