Post by Cali Desilets on Jul 23, 2013 11:11:51 GMT -6
I feel bad,if im not post to post in the Important Board. Any whooo..., I found an Enhanced Code you can use! Since the one you gave at my Ridgeway stie,didn't work.. I found another Enhanced code I could use. You could use this Enhanced code.
Here it is!!!
P.S. Ignore or read my pm I sent you, Sammie.
Here it is!!!
P.S. Ignore or read my pm I sent you, Sammie.
<script type="text/javascript">
<!--
/*
Name: ENHANCED UBBC TABLE TAGS
Location: Global Footer
Created by EtonBones at yahoo d o t com
Do not redistribute without permission
Feel free to edit provided a notation is
added to this header stating that fact.
THIS HEADER MUST REMAIN INTACT.
*/
/*********** *****START EDITABLE USER OPTIONS***********************
If not concerned about the security risk posed by allowing users the ability
to set events such as onclick and onmouseover in their posts
set the following variable to false*/
var DisallowEvents=true;
/*If UBBC Undo installed and you would like enhanced tags added to history
set the following variable to true*/
var UUInstalled=false;
/******END EDITABLE USER OPTIONS (NO FURTHER EDITING NECESSARY)*******/
var NoGood="Enhanced tags need to be between the [td] and [/td]";
function enhanceTable(){
var td=document.getElementsByTagName("td");
for(i=0;i<td.length;i++){
/* if(td[i].width=="20%" && td[i].className.match(/windowbg/)){
var msg=td[i].parentNode.getElementsByTagName('td')[1].getElementsByTagName('tr')[1]; -5/7/10 */
if(td[i].width=="20%" && td[i].className.match(/windowbg/) && td[i].innerHTML.match(/>(Posts: [\d,]+|Guest)</)){
var msg=td[i].nextSibling.getElementsByTagName('tr')[1];
if(msg.getElementsByTagName('table').length){
for(l=0;l<msg.getElementsByTagName('table').length;l++){
parseTags(msg.getElementsByTagName('table')[l]);
//separate func needed since rowspans need to be set first in order to count columns
parseTH(msg.getElementsByTagName('table')[l]);
}
}
}else if(document.postForm && td[i].width=="30%" && td[i].className.match(/windowbg2/) && !document.getElementById('enhancedTable')){
var TR=td[i].parentNode;
var newTR=TR.parentNode.insertRow(TR.rowIndex+1);
TR.id="enhancedTable";
var newTD=document.createElement('td');
newTD.width='30%';
newTD.className='windowbg2';
newTD.innerHTML='<font size="2">Enhanced Table Tags:</font>';
newTR.appendChild(newTD);
newTD=document.createElement('td');
newTD.width='70%';
newTD.className='windowbg2';
newTD.innerHTML='<font size="2">Select Tag:</font><select name="etags" onChange=" addEtag(this.options[this.selectedIndex].value);this.selectedIndex=0;" ><option value="" selected="1">Enhanced Table Tags</option><option value="[th]" >Header</option><option value="[cs=2]">Span Columns</option><option value="[rs=2]">Span Rows</option><option value="[bg=white]">Background Color</option><option value="[atrb=border,0,true]">Any Attribute</option></select> ';
newTR.appendChild(newTD);
}else if(document.postForm && td[i].width=="100%" && td[i].className.match(/titlebg/) && td[i].innerHTML.match(/Topic Summary/)){
var table=td[i].parentNode.parentNode;
var re= /(?:[^\"])(\[(th|cs|rs|bg|atrb).*?\])/gim;
if(table.className.match(/tbody/i))table=table.parentNode;
for(l=2;l<table.rows.length;l=l+2){
if(table.rows[l].cells[0].innerHTML.match(/(?:[^\"\=])(\[(th|cs|rs|bg|atrb).*?\])/gim)){
while(table.rows[l].cells[0].innerHTML.match(/(?:[^\"\=])(\[(th|cs|rs|bg|atrb).*?\])/im ) ){
table.rows[l].cells[0].innerHTML= table.rows[l].cells[0].innerHTML.replace(/(?:[^\"\=])(\[(th|cs|rs|bg|atrb).*?\])/im, stripAnchor(RegExp.$1,RegExp.$2) );
}
}
}
}
}
}
function stripAnchor(str){
var t=/(<A href\=.*\>(.*?)\<\/A\>)/i
if(!str)return "";
var s=str.substr(0,1);
if(s=='\"')return str;
if(s=="\[") s="";
if(str.match(t))str=str.replace(RegExp.$1,RegExp.$2);
return s+"<a title=\""+str+"\">*</a>";
}
function parseTags(TBL){
if(TBL.className !=""){
TBLS=TBL.getElementsByTagName('table')
for(k=0;k<TBLS.length;k++)parseTags(TBLS[k]);
return true;
}
var cell=TBL.getElementsByTagName('td');
var nada="";
for (j=0;j<cell.length;j++){
if(cell[j].innerHTML.match(/(\[cs\=(\d+)\])/i)){
cell[j].setAttribute("colSpan",RegExp.$2);
cell[j].innerHTML=cell[j].innerHTML.replace(RegExp.$1,'');
}
if(cell[j].innerHTML.match(/(\[rs\=(\d+)\])/i)){
cell[j].setAttribute("rowSpan",RegExp.$2);
cell[j].innerHTML=cell[j].innerHTML.replace(RegExp.$1,'');
}
if(cell[j].innerHTML.match(/(\[bg\=(.*?)\])/i)){
cell[j].setAttribute("bgColor",RegExp.$2);
cell[j].innerHTML=cell[j].innerHTML.replace(RegExp.$1,'');
}
while(cell[j].innerHTML.match(/(\[atrb\=(.*?)\])/i)){
var r1=RegExp.$1;
var r2=RegExp.$2;
var atrb=""; var atrbVal="";
var applyTable=false;
var oObj;
if(r2.split(',').length>0){ atrb=r2.split(',')[0]; atrb=atrb.replace(/^\s*|\s*$/g,"");}
if(r2.split(',').length>1) {atrbVal=r2.split(',')[1]; atrbVal=atrbVal.replace(/^\s*|\s*$/g,"");}
if(atrbVal.match(/(<A href\=.*\>(.*)\<\/A\>)/i))atrbVal=atrbVal.replace(RegExp.$1,RegExp.$2);
if(r2.split(',').length>2)applyTable=r2.split(',')[2]?true:false;
oObj=applyTable?TBL:cell[j];
if(atrb != ""){
if(atrb.toLowerCase()=="style"){
oObj.style.cssText+=atrbVal;
}else if(atrb.toLowerCase().substr(0,2)=="on" && DisallowEvents){
nada="<a title=\"Disallowed: "+r1.replace("[","").replace("]","") +"\">*</a>";
}else{
document.expando=false; //IE workaround for casing
try{
oObj.setAttribute(atrb,atrbVal);
}catch(e){
nada="<a title=\"Casing Error: "+r1.replace("[","").replace("]","") +"\">*</a>";
}finally{
document.expando=true;
}
}
}
cell[j].innerHTML=cell[j].innerHTML.replace(r1,nada);
}
}
}
function parseTH(TBL){
if(TBL.className !=""){
TBLS=TBL.getElementsByTagName('table')
for(k=0;k<TBLS.length;k++)parseTags(TBLS[k]);
return true;
}
var cell=TBL.getElementsByTagName('td');
for (j=0;j<cell.length;j++){
if(cell[j].innerHTML.match(/(\[th\])/i)){
cell[j].setAttribute("colSpan",columns(TBL));
cell[j].innerHTML=cell[j].innerHTML.replace(RegExp.$1,'');
}
}
}
function columns(TBL){
//w3c states that a colSpan=0 should make a cell span all columns but IE doesn't honor this, so...
var columns=0;
var tmp;
for(o=0;o<TBL.rows.length;o++){
tmp=0;
for(p=0;p<TBL.rows[o].cells.length;p++){
tmp++
if(TBL.rows[o].cells[p].rowSpan>1)tmp=tmp+TBL.rows[o].cells[p].rowSpan-1;
}
if(tmp>columns)columns=tmp;
}
return columns;
}
function addEtag(tag){
if(tag!=""){
if(UUInstalled){
if(isInsideCell()){
addX(tag);
}else{
alert(NoGood);
document.postForm.message.focus();
}
}else{
if(isInsideCell()){
add(tag);
}else{
alert(NoGood);
document.postForm.message.focus();
}
}
}
}
function isInsideCell(){
//Function purpose: determine if insertion point falls within the bounds of a cell
var msg=document.postForm.message;
if(document.postForm.message.createTextRange){
getCursorPositionIE();
var tmp= document.postForm.message.value.substr(0,document.postForm.message.selectionStart).split("\n").length-1;
setCursorPositionIE(msg.selectionStart-tmp);
}
msg.selectionStart=msg.selectionEnd;
var curr=msg.selectionStart;
if(msg.value.substr(0,curr).lastIndexOf("[td]")==-1 || msg.value.substr(0,curr).lastIndexOf("[td]")<msg.value.substr(0,curr).lastIndexOf("[/td]"))
return false;
if(msg.value.substr(curr).indexOf("[/td]")==-1 || (msg.value.substr(curr).indexOf("[/td]")>msg.value.substr(curr).indexOf("[td]") && msg.value.substr(curr).indexOf("[td]")!=-1))
return false;
if(msg.value.substr(0,curr).lastIndexOf("[")>msg.value.substr(0,curr).lastIndexOf("]"))
return false;
if(msg.value.substr(curr).indexOf("]")<msg.value.substr(curr).indexOf("[") )
return false;
return true;
}
if(location.href.match(/action\=(display|pmview|recent|userrecent|goto|search|calendarview)/) || ( document.postForm ))
enhanceTable();
function setCursorPositionIE(start,end) {
if(document.selection){
var element=document.postForm.message;
end=(end)?end:start;
var range = element.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
}
function getCursorPositionIE(){
if(document.selection){
var element = document.postForm.message;
element.focus();
var range = document.selection.createRange();
var stored_range = range.duplicate();
stored_range.moveToElementText( element );
stored_range.setEndPoint( 'EndToEnd', range );
element.selectionStart = stored_range.text.length - range.text.length;
element.selectionEnd = element.selectionStart + range.text.length;
element.selectionFaux=true;
}
}
//-->
</script>
<script type="text/javascript">
// Justify Text
var jButton = 'http://i28.tinypic.com/51t4bl.gif';
if(document.postForm)
{
var buttons = document.images;
for(b=0; b<buttons.length; b++)
{
if(buttons[b].src.match(/\/right\.(gif|png)/i))
{
buttons = buttons[b+1].parentNode;
break;
}}
var justifyButton = document.createElement('A');
justifyButton.setAttribute('href','javascript:add("[justify]","[/justify]")');
justifyButton.innerHTML = '<img src="'+jButton+'" border="0" alt="Justify">';
buttons.parentNode.insertBefore(justifyButton,buttons);
}
if(!document.location.href.match(/action=headersfooters/))
{
var posts = document.getElementsByTagName('td');
for(p=0; p<posts.length; p++)
{
if(((posts[p].vAlign == 'top' && posts[p].colSpan == '3') || (document.postForm && posts[p].width == '100%' && posts[p].className == 'windowbg2')) && posts[p].innerHTML.match(/\[justify\]/i))
{
posts[p].innerHTML = posts[p].innerHTML.replace(/\[justify\]/ig,'<div align="justify">');
posts[p].innerHTML = posts[p].innerHTML.replace(/\[\/justify\]/ig,'</div>');
}}}
</script>
<script type="text/javascript"><!--
/* Style UBBC Tags v2
Created by iPokemon
[url]http://bytemecodes.proboards.com/[/url]
Do not redistribute or call as your own
Updated September 2nd 2011
Copyright 2011
version = 1*/
if(document.postForm) {
document.postForm.color.parentNode.innerHTML+='<a href="javascript:add(\'[style=]\',\'[/style]\')">style</a>';
}
if(pb_action.match(/(calendar|pm|pre)view|viewprofile|search2|display/i)){
var td = document.getElementsByTagName('td');
var matCH=/\[style=(.+?)\]/gi;
var matCH2=/\[\/style\]/gi;
var matCH3=/\[newclass=(.+?)\](.+?)\[\/newclass\]/gi;
var matCH4=/\[classy=(.+?)\]/gi;
var matCH5=/\[\/classy\]/gi;
var table = document.getElementsByTagName('table');
for(x=5;x<table.length;x++){
if(table[x].className == "code" && table[x].innerHTML.match(/(\[style|\[newclass|\[classy)/i)){
table[x].innerHTML=table[x].innerHTML.replace(/\[/,eval("<b></b>91;"))
table[x].innerHTML=table[x].innerHTML.replace(/\]/,eval("<b></b>93;"));
}
}
for(l=0;l<td.length;l++){
if(td[l].width=="80%"){
td[l].innerHTML = td[l].innerHTML.replace(matCH, '<div style="$1">').replace(matCH2, '</div>').replace(matCH3, '<style type="text/css"> .$1 {$2} </style>').replace(matCH4, '<div class="$1">').replace(matCH5, '</div>');
}
}
}
//--></script>
<script type="text/javascript">
<!--
// scrollerDiv UBBC in posts
// Bones enhanced version
// v2.1
// By Wormopolis - [url]www.wormocodes.com[/url]
// use [scrolly:flags][/scrolly] in post around text
// flags are:
// h(n) height, n=height in pix
// w(n) width, n=width in pix
// sx scroll x direction
// sy scroll y direction
// c(hex) color, hex=color in hex: c(FF3324)
// bg(URL) background-image, URL = image src
// as(style additions)
// ac(classname append)
// flags seperated by commas: [scrolly:h(100),w(50),sy] blah blah blah [/scrolly]
for (tds=document.getElementsByTagName('td'), i=0; i<tds.length; i++) {
if (tds[i].width=="80%" && tds[i].className.match(/windowbg/) && tds[i].vAlign=="top" && tds[i].innerHTML.match(/\[scrolly(?:\:(.*?))?\]([\s\S]*?)\[\/scrolly\]/i) && !tds[i].innerHTML.match(/\[norunubbc\]/)) {
flgs=RegExp.$1; lovetext=RegExp.$2;
tmp='<div class="postDiv'+(flgs.match(/ac\(([\w\s]+?)\)/) ? ' '+RegExp.$1:'')+'" style="'+(flgs.match(/h\((\d+)\)/) ? 'height:'+RegExp.$1+';' : '')+(flgs.match(/w\((\d+)\)/) ? 'width:'+RegExp.$1+';' : '')+(flgs.match(/sx/) ? 'overflow-x:auto; white-space: nowrap;' : '')+(flgs.match(/sy/) ? 'overflow-y:auto;' : '')+(flgs.match(/c\((\w+)\)/) ? 'background-color:'+RegExp.$1+';' : '') +(flgs.match(/bg\((\w+)\)/) ? 'background-image:url('+RegExp.$1+');' : '') +(flgs.match(/as\((.+?)\)/) ? RegExp.$1+';':'')+'" '+(flgs.match(/sx/) ? 'noWrap="nowrap" ' : '') + '>'+ lovetext + '</div>';
postCell=tds[i].getElementsByTagName('table')[0].rows[1].cells[0];
postCell.innerHTML=postCell.innerHTML.replace(/\[scrolly(?:\:(.*?))?\]([\s\S]*?)\[\/scrolly\]/i,tmp);
i--;
}
}
-->
</script>
<script type="text/javascript">
<!--
/*
* Posting Template
* Created By Jordan a.k.a. Triad
* [url]http://support.proboards.com[/url]
*/
function PostingTemplate()
{
this.templates = {};
this.obj = {};
this.init();
}
PostingTemplate.prototype.init = function()
{
if(!localStorage)
return false;
if(pb_action == "modifyprofile" && document.modifyForm)
{
this.getTemplates();
this.addFields();
this.addEvent(document.modifyForm, this.saveTemplates);
this.obj["ubbc"] = this.$("template_ubbc");
this.obj["list"] = this.$("template_list");
}
else if(document.postForm || (pb_action == "display" && location.href.match(/(thread|board)=/i)))
{
this.getTemplates();
this.addTemplateList();
this.obj["list"] = this.$("template_list");
}
}
PostingTemplate.prototype.$ = function(id)
{
if(id) return document.getElementById(id);
return false;
}
PostingTemplate.prototype.addEvent = function(form, func)
{
if(document.addEventListener)
form.addEventListener("submit", func, false);
else if(document.attachEvent)
form.attachEvent("onsubmit", func);
else
form.onsubmit = func;
}
PostingTemplate.prototype.addTemplate = function()
{
if(this.obj.list.options.selectedIndex > 0)
{
var id = this.obj.list.options[this.obj.list.options.selectedIndex].value;
if(this.templates[id].ubbc.length > 0)
document.getElementsByName("message")[0].value += this.templates[id].ubbc;
}
}
PostingTemplate.prototype.selectTemplate = function()
{
if(this.obj.list.options.selectedIndex > 0)
this.obj.ubbc.value = this.templates[this.obj.list.options[this.obj.list.options.selectedIndex].value].ubbc;
else
this.obj.ubbc.value = "";
}
PostingTemplate.prototype.addSelectOptions = function(click)
{
var html = "";
for(key in this.templates)
{
html += '<option value="' + key + '">' + key + '</option>';
}
return html;
}
PostingTemplate.prototype.createTemplate = function()
{
var name = prompt("Enter the name of the template below.","");
if(!name.match(/^[a-zA-Z0-9]+$/i))
{
alert("Please only use the standard alpha letters and numbers for the template name. No commas, spaces, underscores, periods, semi-colons etc.");
return false;
}
for(key in this.templates)
{
if(name == key && this.templates[key].del == 0)
{
alert("This template name is already taken.");
return false;
}
}
if(name)
{
var option = document.createElement("option");
option.value = name;
option.innerHTML = name;
this.obj.list.appendChild(option);
this.obj.list.options.selectedIndex = this.obj.list.options.length-1;
this.obj.ubbc.value = "";
this.templates[this.obj.list.options[this.obj.list.options.selectedIndex].value] = {
ubbc: "",
del: 0
};
}
}
PostingTemplate.prototype.saveUBBC = function()
{
for(key in this.templates)
{
this.templates[this.obj.list.options[this.obj.list.options.selectedIndex].value].ubbc = this.obj.ubbc.value;
return true;
}
}
PostingTemplate.prototype.getTemplates = function()
{
var key = "";
for(x = 0; x < localStorage.length; x++)
{
key = localStorage.key(x);
if(key.match(new RegExp("^pT_" + pb_username + "_","i")))
{
this.templates[key.split("_")[2]] = {
ubbc: decodeURI(localStorage[key]),
del: 0
};
}
}
}
PostingTemplate.prototype.saveTemplates = function()
{
for(key in pT.templates)
{
if(pT.templates[key].del)
localStorage.removeItem("pT_" + pb_username + "_" + key);
else
localStorage.setItem("pT_" + pb_username + "_" + key, encodeURI(pT.templates[key].ubbc));
}
}
PostingTemplate.prototype.deleteTemplate = function()
{
var option = this.obj.list.options[this.obj.list.options.selectedIndex];
if(this.obj.list.options.selectedIndex > 0)
{
if(confirm("Are you sure you want to delete the \"" + option.value + "\" template?"))
{
this.templates[option.value].del = 1;
this.obj.list.removeChild(option);
this.obj.list.options.selectedIndex = 0;
this.obj.ubbc.value = "";
}
}
}
PostingTemplate.prototype.addTemplateList = function()
{
if(document.postForm)
{
var table = document.postForm.getElementsByTagName("table")[0].getElementsByTagName("table")[0];
var row = table.insertRow(document.postForm.message.parentNode.parentNode.parentNode.rowIndex);
var cell = row.insertCell(0);
cell.width = "30%";
cell.className = "windowbg2";
cell.innerHTML = '<font size="2">Posting Template:</font>';
cell = row.insertCell(1);
cell.width = "70%";
cell.className = "windowbg2";
cell.innerHTML = '<font size="1"><select id="template_list" onchange="pT.addTemplate();"><option>--------------------</option>' + this.addSelectOptions() + '</select></font>';
}
else if(document.getElementsByName("message")[0])
{
var target = document.getElementsByName("message")[0].parentNode;
var font = document.createElement("font");
font.size = 1;
font.innerHTML = '<select id="template_list" onchange="pT.addTemplate();" style="margin-left: 10px;"><option>--------------------</option>' + this.addSelectOptions() + '</select>';
target.parentNode.insertBefore(
font,
target.previousSibling
);
}
}
PostingTemplate.prototype.addFields = function()
{
if(document.modifyForm && pb_username == document.modifyForm.user.value)
{
var container = document.createElement("div");
container.innerHTML = '<font size="-1"><b>Posting Templates</b></font><hr size="1" />';
var table = document.createElement("table");
table.appendChild(document.createElement("tbody"));
var row = table.insertRow(0);
var cell = row.insertCell(0);
cell.width = "160";
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<font size="-1">UBBC Template:</font>';
cell = row.insertCell(1);
cell.width = "245"
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<table width="100%" cellspacing="0" cellpadding="0"><tr>' +
'<td width="1%" valign="middle"><font size="-1">' +
'<a href="Javascript:void(0);" onclick="pT.createTemplate();">Create</a><br />' +
'<a href="Javascript:void(0);" onclick="pT.deleteTemplate();">Delete</a>' +
'</font></td>' +
'<td width="99%" align="center" valign="middle"><font size="-1"><select id="template_list" onchange="pT.selectTemplate();"><option>--------------------</option>' + this.addSelectOptions() + '</select></font></td>' +
'</tr></table>';
cell = row.insertCell(2);
cell.width = "245"
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<font size="1">Click on an option to manage your posting templates.</font>';
row = table.insertRow(1);
cell = row.insertCell(0);
cell.width = "160";
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<font size="-1">UBBC:</font>';
cell = row.insertCell(1);
cell.width = "245";
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<font size="-1"><textarea rows="5" cols="32" id= "template_ubbc" onkeyup="pT.saveUBBC();"></textarea></font>';
cell = row.insertCell(2);
cell.width = "245";
cell.vAlign = "top";
cell.className = "windowbg";
cell.innerHTML = '<font size="-2">The UBBC you add here will be available to you to insert into your posts on the posting page as well as in the quick reply section.</font>';
container.appendChild(table);
document.modifyForm.insertBefore(
container,
document.modifyForm.getElementsByTagName("hr")[1].previousSibling
);
}
}
var pT = new PostingTemplate();
//-->
</script>