Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Add Bbc
Topic Started: Dec 24 2007, 01:04 PM (1,633 Views)
Agent Moose
Member Avatar
Member
[ * ]
Below the Board:
Code:
 
<script>
function addBBC(bb,c,ht,ml) {
$("a,div.description,li span,tr th small,tr th").each(function() {
//Created by Agent Moose (z1.zetaboards.com/ZetaCode/)
if(this.innerHTML.match(/\[color=.*\]/i) || this.innerHTML.match(/\[\/color\]/i) || this.innerHTML.match(bb) || this.innerHTML.match(c)) {
this.innerHTML = this.innerHTML.replace(/\[color=(.+?)\]/i,"<font color='$1'>");
this.innerHTML = this.innerHTML.replace(/\[\/color\]/i,"</font>");
this.innerHTML = this.innerHTML.replace(bb,ht);
this.innerHTML = this.innerHTML.replace(c,ml);
};});}
addBBC("START BBC","END BBC","START HTML","END HTML");
</script>

This is just like the the Description and Topic Color code, but you can add your own BBC. The color is automaticly added. You can add bold, italics, strike through and more!

Here is an example:
Code:
 
addBBC("[s]","[/s]","<s>","</s>");

All you will have to do is add [ s ] to the begening of the description of topic name(with no spaces), and [ / s ] to the end of the topic name or description(with no spaces), for it to be strike through!

To add more lines, add more of these:
Code:
 
addBBC("START BBC","END BBC","START HTML","END HTML");


Enjoy :)

Preview: Click Here
Edited by Agent Moose, Dec 24 2007, 01:06 PM.
Offline Profile Quote Post Goto Top
 
choco
SPORE
[ *  *  * ]
It's a good code and a great idea, but it's terribly insecure. For example, if I added a bbcode for <color>, I could do this in a topic title:
[color="red" onclick="window.location.href='http://MYBOARD.COM'] (or whatever)
And if the topic title is clicked, you're on your way to my board.

You may want to add extra matching; either that or don't 'bbcodify' titles with text like 'onclick' in them and so on.
Edited by choco, Dec 24 2007, 01:19 PM.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Nice, but it would be even better if you do the following:

Replace , etc.. in the document.title with an empty string. Very simple to do, but without it, the page looks a bit more messy..
Offline Profile Quote Post Goto Top
 
Deathslayer
Member Avatar
The 1337 one
[ * ]
Would it be possible to edit this to work in the posts themselves ? As there is no DoHTML tag anymore it would be good to be able to use that to make your own Table tags.
Offline Profile Quote Post Goto Top
 
Chris
Member Avatar
Member
[ *  *  *  * ]
Deathslayer
Jan 2 2008, 08:08 AM
Would it be possible to edit this to work in the posts themselves ? As there is no DoHTML tag anymore it would be good to be able to use that to make your own Table tags.
There is already Table BB Code, actually.

[table=#Cols,Title,(Any Value: Makes First Row <th>)]First Cell[c]Second Cell[c]Third[c]On and On[/table]

A Title
First CellSecond CellThird CellFourth Cell
OnAndOnForever
Edited by Chris, Jan 3 2008, 07:35 PM.
Offline Profile Quote Post Goto Top
 
Deathslayer
Member Avatar
The 1337 one
[ * ]
Ooh, wowz, didnt know that one !
Offline Profile Quote Post Goto Top
 
MONF
Member Avatar
Member
[ *  * ]
choco is right. It's too easy to hack and people could easily mess up your board.
Edited by MONF, Jan 6 2008, 12:07 PM.
Offline Profile Quote Post Goto Top
 
DynamicIP
Member Avatar
I'm known as Nor
[ *  * ]
make sure you edit the "document.title" to remove the bbcode ;)
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · User Created Codes · Next Topic »
Add Reply