Post by Mithras on Oct 29, 2006 17:48:00 GMT -8
<script type='text/javascript'>
<!--
// UBBC Buttons Above Quick Reply by Mithras
// Do not repost without permission
// Buttons - [Image Location, Opening Tag, Closing Tag] -- Do not edit unless you want to add buttons, or change the default ones.
var buttons = [
['http://s2.images.proboards.com/bold.gif','[b]','[/b]'],
['http://s2.images.proboards.com/italicize.gif','[i]','[/i]'],
['http://s2.images.proboards.com/underline.gif','[u]','[/u]'],
['http://s2.images.proboards.com/strike.gif','[s]','[/s]'],
['http://s2.images.proboards.com/glow.gif','[glow=red,2,300]','[/glow]'],
['http://s2.images.proboards.com/shadow.gif','[shadow=red,left,300','[/shadow]'],
['http://s2.images.proboards.com/move.gif','[move]','[/move]'],
['http://s2.images.proboards.com/pre.gif','[pre]','[/pre]'],
['http://s2.images.proboards.com/left.gif','[left]','[/left]'],
['http://s2.images.proboards.com/center.gif','[center]','[/center]'],
['http://s2.images.proboards.com/right.gif','[center]','[/center]'],
['http://s2.images.proboards.com/hr.gif','[hr]',''],
['http://s2.images.proboards.com/size.gif','[size=2]','[/size]'],
['http://s2.images.proboards.com/face.gif','[font=Verdana]','[/font]'],
['http://s2.images.proboards.com/blockquote.gif','[blockquote]','[/blockquote]'],
['http://s2.images.proboards.com/url.gif','[a href="','"]','[/a]'],
['http://s2.images.proboards.com/ftp.gif','[ftp]','[/ftp]'],
['http://s2.images.proboards.com/img.gif','[img src="','"]'],
['http://s2.images.proboards.com/email2.gif','[email]','[/email]'],
['http://s2.images.proboards.com/table.gif','[table][tr][td]','[/td][/tr][/table]'],
['http://s2.images.proboards.com/tr.gif','[tr]','[/tr]'],
['http://s2.images.proboards.com/td.gif','[td]','[/td]'],
['http://s2.images.proboards.com/sup.gif','[sup]','[/sup]'],
['http://s2.images.proboards.com/sub.gif','[sub]','[/sub]'],
['http://s2.images.proboards.com/tele.gif','[tt]','[/tt]'],
['http://s2.images.proboards.com/code.gif','[code]','[/code]'],
['http://s2.images.proboards.com/quote2.gif','[quote]','[/quote]'],
['http://s2.images.proboards.com/list.gif','[ul]\n[li]','\n[/li][li]\n[/li][li]\n[/li][/ul]'] // Note: no comma after the last line.
];
function ubbc(open, end){
// This function was created by Peter, but is open source. The first section has been changed.
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;
}
}
if(pb_username!='Guest' && !document.postForm && location.href.match(/thread=/)) {
var tds = document.getElementsByTagName('TD')
for(a=0; a<tds.length; a++) {
if(tds[a].width=='100%' && tds[a+1].align=='right') {
var b = a
}
}
var quickReply = tds[b].innerHTML;
var buttonHTML = '';
for(i=0; i<buttons.length; i++) {
buttonHTML += '<a href="javascript:ubbc(\'' + buttons[i][1] + '\',\'' + buttons[i][2] + '\')"><img src="' + buttons[i][0] + '" border="0" /></a>';
if(i==13) { buttonHTML += '<br />'; }
}
buttonHTML += '<br/>';
tds[b].innerHTML = buttonHTML + '' + quickReply;
}
//-->
</script>
In the array at the top, the first entry is the URL to the image. The defaults are in there now. The second entry is the opening tag, and the third is closing tag.
You don't have to edit anything unless you want to change the images, or add tags.
Global Footer
May 29, 2009: Fixed typos ~ Triad
May 7, 2012: added in disable for guests since they dont see a quick reply but table properties might match a different table. - Wormo