The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Help with coding custom bbcodes

View previous topic View next topic Go down

Solved Help with coding custom bbcodes

Post by Rarcer on November 2nd 2012, 11:11 pm

Sorry if this is in the wrong board.

Anyway, I'd like to add another color bbcode. Like Text!
I've managed to add it to the list, but the color just stays black, and I don't know how to get rid of the brackets.

Anyone know hkw to fix this? Help is appreciated.


Last edited by Rarcer on November 3rd 2012, 5:20 pm; edited 1 time in total

Rarcer
New Member

Posts : 5
Reputation : 1
Language : English

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by SLGray on November 2nd 2012, 11:20 pm

Is your forum's version phpBB 3?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by Rarcer on November 3rd 2012, 5:16 pm

Yep. Phpbb3 prosilver.

Rarcer
New Member

Posts : 5
Reputation : 1
Language : English

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by SLGray on November 3rd 2012, 5:33 pm

Could you post how you added the new color?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by Rarcer on November 3rd 2012, 5:49 pm

Here's the code. Pretty sure it's in Javascript but I'm not 100%.

Code:

(function(){var d={add:function(b,e,c){$(function(){if(document.getElementById("text_edit")){void 0==c&&(c="");var a=document.createElement("span");a.innerHTML='<button class="button2" style="height: 22px; margin-right: 5px;" onClick="bbfontstyle(\''+e+"', '"+c+"'); return false;\">"+b+"</button>";document.getElementById("new_buttons_area").appendChild(a)}})},list:function(b,e,c){$(function(){if(document.getElementById("text_edit")){var a=document.createElement("span");a.innerHTML='<input type="button" style="height: 22px; margin-right: 5px;" value="'+ b+'" onclick="selectWysiwyg(this, \''+c+'\');" class="button2">';document.getElementById("new_buttons_area").appendChild(a);a=document.createElement("div");a.id=c;a.className="select";a.style.visibility="hidden";for(var d in e)a.innerHTML+="<button onmouseout=\"this.className='';\" onmouseover=\"this.className='selectHover';\" onclick=\"bbfontstyle('"+e[d]+"', '');selectWysiwyg(this, '"+c+"');return false;\">"+d+"</button><br>";document.getElementById("text_editor_select_controls").appendChild(a)}})}, init:function(){$(function(){if(document.getElementById("html_edit")){var b=document.createElement("div");b.id="new_buttons_area";b.style.paddingTop="5px";document.getElementById("html_edit").parentNode.insertBefore(b,document.getElementById("html_edit").nextSibling)}})}};window.buttons=d;d.init()})();
buttons.add('Light red', '[color=lightred]','[/color]');

Got it from some guy named Rideem on fmquery. I think you might've linked someone else to it in another thread.

Anyway, it adds (color=lightred)(/color) to the text box when you click on the button, but that's it. Know how to actually make the color light red when you post?

Rarcer
New Member

Posts : 5
Reputation : 1
Language : English

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by SLGray on November 3rd 2012, 7:19 pm

One problem is that there is not a color called light red.

Take a look here for the lists of colors - http://en.wikipedia.org/wiki/Hex_color & http://en.wikipedia.org/wiki/List_of_colors


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36697
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by Rarcer on November 3rd 2012, 11:47 pm

Nevermind I just got the hexcode for the color I wanted and added it. Works like I wanted it to. Thanks for your help, slg.

Rarcer
New Member

Posts : 5
Reputation : 1
Language : English

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by Rarcer on November 3rd 2012, 11:52 pm

Solved.

Rarcer
New Member

Posts : 5
Reputation : 1
Language : English

Back to top Go down

Solved Re: Help with coding custom bbcodes

Post by Sanket on November 4th 2012, 4:14 am

Topic Solved & Locked

Sanket
ForumGuru

Male Posts : 48766
Reputation : 2819
Language : English
Location : Mumbai

http://webartzforum.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum