BBcode/html in rpg profile
4 posters
Page 1 of 1
BBcode/html in rpg profile
Hello,
I noticed that you can't use BBcode/html in the textfields of the RPG profile. Is there a way to make this possible anyhow?
I noticed that you can't use BBcode/html in the textfields of the RPG profile. Is there a way to make this possible anyhow?
Re: BBcode/html in rpg profile
Text zones will allow the BBCode.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
Re: BBcode/html in rpg profile
On the normal profile, yes, but not with the RPG profile. (Admin panel => Modules => Roleplay Game).
Re: BBcode/html in rpg profile
That's because you can't add a text zone in the role-play game. So I am not sure if this is possible.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
Re: BBcode/html in rpg profile
Maybe there's a way to enable BBcode in rpg fields with javascript? Unfortunately Im not good with that. Html and css I can do fine, but javascript no, so I wouldnt know what to look for.
Re: BBcode/html in rpg profile
If I may ask what BBCode would you use?
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
Re: BBcode/html in rpg profile
I want members to be able to add pictures, make the text bold/italic etc. Basically the same as what you can do with normal profile fields.
Re: BBcode/html in rpg profile
Try Text/List, it looks the same as a Text Zone.
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
Re: BBcode/html in rpg profile
@Farronsister It should be possible to parse the bbcode client-side with JavaScript however, I need a little more information :
1. A link to the page where your RPG field is ( or a link to a topic if the field is in the topics )
2. What field specifically do you want bbcode to work in ?
3. What tag(s) do you want parsed ? ( e.g. [b], [i], [img], etc.. )
Thanks in advance for providing the info above.
1. A link to the page where your RPG field is ( or a link to a topic if the field is in the topics )
2. What field specifically do you want bbcode to work in ?
3. What tag(s) do you want parsed ? ( e.g. [b], [i], [img], etc.. )
Thanks in advance for providing the info above.
Re: BBcode/html in rpg profile
What was the solution if I may ask?
Take Notes- Helper
- Posts : 2337
Reputation : 324
Language : English
Location : Forumountain
Re: BBcode/html in rpg profile
I'm not sure if I'm allowed to copy the code, but he used JavaScript to turn the fields into a div that allows BBcode (like Ange Tuteur suggested)
Re: BBcode/html in rpg profile
I have no problem with sharing the code. Perhaps it could help others with the same problem.
There are maybe better scripts but this will do.
- Code:
$(function() {
var pathname = $(location).attr('pathname');
if (pathname.match("^/u") ) {
$("textarea").each(function(index, value) {
var obj = jQuery(value);
var tmp = obj.val().replace(/[\r\n]/g, "<br />");
$format_search = [
/\[b\](.*?)\[\/b\]/ig,
/\[i\](.*?)\[\/i\]/ig,
/\[u\](.*?)\[\/u\]/ig,
/\[img\](.*?)\[\/img\]/ig
];
$format_replace = [
'<strong>$1</strong>',
'<em>$1</em>',
'<span style="text-decoration: underline;">$1</span>',
'<img class="rpgtext_img" src="$1" />'
];
for (var i =0;i<$format_search.length;i++) {
var tmp = tmp.replace($format_search[i], $format_replace[i]);
}
var newTag = jQuery("<div></div>").html(tmp);
newTag.addClass("rpg_text");
obj.replaceWith(newTag);
});
}
});
There are maybe better scripts but this will do.
10spetter10- Forumember
- Posts : 195
Reputation : 82
Language : Dutch
Similar topics
» How to convert html to bbcode
» HTML/BBCode in Topic Title
» Replace html with bbcode (in posts)
» Share this topic (URL, BBCode & HTML)
» I want to create a bbcode to insert an html code
» HTML/BBCode in Topic Title
» Replace html with bbcode (in posts)
» Share this topic (URL, BBCode & HTML)
» I want to create a bbcode to insert an html code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum