The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

BBcode/html in rpg profile

4 posters

Go down

BBcode/html in rpg profile Empty BBcode/html in rpg profile

Post by Farronsister April 20th 2016, 11:08 am

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?
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Take Notes April 20th 2016, 3:44 pm

Text zones will allow the BBCode.
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 20th 2016, 7:05 pm

On the normal profile, yes, but not with the RPG profile. (Admin panel => Modules => Roleplay Game).
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Take Notes April 20th 2016, 7:53 pm

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
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 20th 2016, 11:53 pm

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.
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Take Notes April 21st 2016, 2:57 am

If I may ask what BBCode would you use?
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 21st 2016, 7:47 am

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.
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Take Notes April 21st 2016, 6:02 pm

Try Text/List, it looks the same as a Text Zone.
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 21st 2016, 9:10 pm

That doesn't work. Sad
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Ange Tuteur April 23rd 2016, 12:05 am

@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. salut
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 23rd 2016, 12:18 am

Someone has found the solution for me! Thanks for your help anyway! Smile
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Take Notes April 23rd 2016, 1:01 am

What was the solution if I may ask?
Take Notes
Take Notes
Helper
Helper

Male Posts : 2337
Reputation : 324
Language : English
Location : Forumountain

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by Farronsister April 23rd 2016, 8:58 am

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)
Farronsister
Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

BBcode/html in rpg profile Empty Re: BBcode/html in rpg profile

Post by 10spetter10 April 24th 2016, 11:18 am

I have no problem with sharing the code. Perhaps it could help others with the same problem.

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
10spetter10
Forumember

Posts : 195
Reputation : 82
Language : Dutch

Back to top Go down

Back to top

- Similar topics

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