Post by Bennett 🚀 on Jul 9, 2010 8:40:15 GMT -8
Found a bug?
If you ever find a bug, please PM me about it. I'll fix it up as soon as I possibly can.
If you ever find a bug, please PM me about it. I'll fix it up as soon as I possibly can.
Recently updated! Update your code!
NEW: Instead of the previous automatic checker for the {style=} tags, you can manually do it so it doesn't screw up stuff that you want to write by itself. Once you click the button, it will sort through your {style=} tags and will convert them to [style=] for you!
See the edits below.
<script type="text/javascript">
/* Style UBBC Tags
Created by iPokemon
http://bytemecodes.proboards.com/
Do not redistribute or call as your own
Updated October 15th 2011
Copyright 2011
version = 2*/
var wantButtons = 1; //0 = no postForm buttons, 1 = keep buttons
function checkInput(n){
if(n){
var text = document.getElementsByName('message')[0].value;
if(text.match(/\{style/gi)){
text = text.replace(/\{style=(.+?)\}/gi,"[style=$1]").replace(/\{\/style\}/gi,"[/style]");
}
document.getElementsByName('message')[0].value = text;
} else {
if(document.postForm){
var form = document.postForm;
} else if(document.modifyForm){
var form = document.modifyForm;
}
var text = form.message.value;
if(text.match(/\{style/gi)){
text = text.replace(/\{style=(.+?)\}/gi,"[style=$1]").replace(/\{\/style\}/gi,"[/style]");
}
form.message.value = text;
}
}
if(document.postForm){
var ff = document.postForm;
} else if(document.modifyForm){
var ff = document.modifyForm;
}
if(ff){
if(wantButtons){
ff.color.parentNode.innerHTML+='<a href="javascript:add(\'[style=]\',\'[/style]\')"><img src="http://i.imgur.com/nzfND.png" alt="Style" border="0" /></a>';
}
var fonte = document.getElementsByTagName('font');
for(x=0;x<fonte.length;x++){
if(fonte[x].innerHTML.match("Message:")){
fonte[x].innerHTML += "<br /><input type='button' onclick='checkInput(0);' value='Style Checker' />";
}
}
}
if(pb_action == "display" && document.getElementsByName('message')[0]){
var newbtn = document.createElement('font');
newbtn.innerHTML = "<input type='button' value='Style Checker' onclick='checkInput(1);' />";
var dl = document.getElementsByName('message')[0].parentNode;
dl.parentNode.insertBefore(newbtn,dl.previousSibling);
}
if(pb_action.match(/(calendar|pm|pre)view|viewprofile|search2|display/i)){
var matCH=/\[style=(.+?)\]/gi;
var matCH2=/\[\/style\]/gi;
var td = document.getElementsByTagName('td');
var table = document.getElementsByTagName('table');
for(x=5;x<table.length;x++){
if(table[x].className == "code" && table[x].innerHTML.match(/\[style/i)){
table[x].innerHTML = table[x].innerHTML.replace(matCH,"{style=$1}").replace(matCH2,"{/style}");
}
}
for(l=0;l<td.length;l++){
if(td[l].width=="80%" && matCH.test(td[l].innerHTML)){
td[l].innerHTML = td[l].innerHTML.replace(matCH, '<div style="$1">').replace(matCH2, '</div>');
}
}
}
</script>
Minified
Placement: Global Footer
Instructions:
Edit the
var wantButtons = 1;to 0 if you don't want buttons when posting (by the colors dropdown), or 1 to keep it.
How this works: You put [style=such and such;]Stuff to be styled[/style] This code only knows CSS, so only use CSS styles.
www.w3schools.com/css/default.asp for more styles
EDIT: You can now place multiple within each other without problem!
EDIT2: You can now place style tags in a [code] box and it won't parse!
EDIT3: It seems that my code is not compatible with the Justify Text in Posts code. () So, instead of using that code, just use [style=text-align:justify;]test[/style] and you just saved yourself from one other code to load!
EDIT4: Put my style tags code above any Code Tag Modification code!
Looking for Style Tags v2?