Welcome Guest [Log In] [Register]
Viewing Single Post From: Add New BB Code Tags v.1.5
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Code: HTML
 
<script>

/****************************************************
Add new BBCode Tags by Viral of http://www.zetaresources.com
Not to be redistributed or re-hosted without Viral's permission
****************************************************/

extraTags=[];n=0
extraTags[n++]=["Marquee","yes","[marquee]","[/marquee]","<marquee onmouseover='this.stop()' onmouseout='this.start()'>","</marquee>"]
extraTags[n++]=["Marquee Right","Yes","[marquee=right]","[/marquee]","<marquee onmouseover='this.stop()' onmouseout='this.start()' direction='right'>","</marquee>"]
extraTags[n++]=["P","","[p]","[/p]","<p>","</p>"]
extraTags[n++]=["Reverse","yes","[reverse]","[/reverse]","<bdo dir='rtl'>","</bdo>"]
extraTags[n++]=["Block Quote","","[blockquote]","[/blockquote]","<blockquote>","</blockquote>"]

if(location.href.match('topic') || location.href.match('single')){
td=document.getElementsByTagName('td');
for(i=0;i<td.length;i++){
if(td[i].className=="c_post"){
thepost=td[i].innerHTML;
for(j=0;j<extraTags.length;j++){
thepost=thepost.split(extraTags[j][2]).join(extraTags[j][4]).split(extraTags[j][3]).join(extraTags[j][5]);
}
td[i].innerHTML=thepost;
}}}

if(location.href.match('post')){
td=document.getElementsByTagName('td');
for(k=0;k<td.length;k++){
lots=td[k].innerHTML;
for(u=0;u<extraTags.length;u++){
lots=lots.split(extraTags[u][2]).join(extraTags[u][4]).split(extraTags[u][3]).join(extraTags[u][5]);
td[k].innerHTML=lots;
}}}

function addExtraTag(open,close){
texty=document.getElementsByTagName('textarea')[0];
texty.innerHTML+=open+close+" ";
}

if(location.href.match('post')){
bbc=document.getElementById('c_bbcode');
for(f=0;f<extraTags.length;f++){
if(extraTags[f][1]=="yes" || extraTags[f][1]=="Yes"){
bbc.innerHTML="<button type=\"button\" name=\""+extraTags[f][0]+"\" onmouseover=\"ZetaHelp('"+extraTags[f][0]+"')\" onclick=\"addExtraTag('"+extraTags[f][2]+"','"+extraTags[f][3]+"')\">"+extraTags[f][0]+"</button> "+bbc.innerHTML;
}}}

if(location.href.match('post')){
texty=document.getElementsByTagName('textarea');
for(y=0;y<texty.length;y++){
post=texty[y].value;
for(r=0;r<extraTags.length;r++){
post=post.split(extraTags[r][4]).join(extraTags[r][2]).split(extraTags[r][5]).join(extraTags[r][3]);
texty[y].value=post;
}}}

</script>


Bugs Fixed:

  • Quoting Posts change to HTML Tags
  • Editing Posts change to HTML Tags


Goes Below the Board, should be straight forward.

Viral.

Copied and pasted at school and Notepad was being ******* so the code was messing up when pasting, if it doesn't work, please post here and I will update when I get back home.
Edited by Viral, Jan 29 2008, 05:09 AM.
Offline Profile Quote Post
Add New BB Code Tags v.1.5 · User Created Codes