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.

How Do I Create My Own BB Codes?

View previous topic View next topic Go down

In progress How Do I Create My Own BB Codes?

Post by Ailyn on March 29th 2017, 6:37 am

I apologize if this is somewhere already, but after several searches throughout the site, I found nothing. I'm new to this type of forum and really rusty at coding in general but if I get to it enough, I'll remember it.

I want to make my own custom BB Codes for my forum, is this possible? I was hoping there was a place in the admin CP that would let me make my own, like a few boards I was apart of in the pasts, but I'm not seeing anything like that here. If I have to add it through JS, that's fine, but I'm an absolute novice at it and would really appreciate some sort of example I can go by. Thank you for your time.
avatar
Ailyn
Forumember

Female Posts : 25
Reputation : 3
Language : English
Location : Oregon

http://amandatest.forumotion.com

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Draxion on March 29th 2017, 7:53 am

Hi there, this script I know creates a new BBcode '[mod][/mod]' and '[adm][/adm]'. Maybe you can study and try to learn from that?

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1052
Reputation : 156
Language : English
Location : USA

http://dawnofthedragons.forumotion.com/

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Ailyn on March 29th 2017, 1:02 pm

@Draxion wrote:Hi there, this script I know creates a new BBcode '[mod][/mod]' and '[adm][/adm]'. Maybe you can study and try to learn from that?


Thanks for replying. I'll take a look over it tomorrow, much appreciated. Smile
avatar
Ailyn
Forumember

Female Posts : 25
Reputation : 3
Language : English
Location : Oregon

http://amandatest.forumotion.com

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Ailyn on March 31st 2017, 1:18 am

Anyone have an additional suggestions? The buttons are an idea, but I'm still learning. Is there really no easy way to make and insert your own BBCode?
avatar
Ailyn
Forumember

Female Posts : 25
Reputation : 3
Language : English
Location : Oregon

http://amandatest.forumotion.com

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Draxion on March 31st 2017, 1:28 am

If you need help, I could try with that script I gave you. As long as I know what particular codes you want to make.
avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 1052
Reputation : 156
Language : English
Location : USA

http://dawnofthedragons.forumotion.com/

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Ailyn on April 1st 2017, 2:25 am

@Draxion wrote:If you need help, I could try with that script I gave you. As long as I know what particular codes you want to make.

Possibly. What I'm trying to do is similar to what a different site I used to be at would do. The [indent] bbcode is apparently attached to this js
Code:
    "indent": {
      trimContents: true,
      openTag: function(params, content) {
        return '<div class="bb-indent">';
      },
      closeTag: function(params, content) {
        return '</div>';
      }

The bbcode would basically do what you see in the top part of the image below (don't ask about the content, it came from a role playing site):




Another code I'm trying to work out is how to make the editor use the tab key to indent a line instead of pushing on to the next button. I had a friend give me this code in suggestion:
Code:
$("textarea").keydown(function(e) {
    if(e.keyCode === 9) { // tab was pressed
        // get caret position/selection
        var start = this.selectionStart;
            end = this.selectionEnd;

        var $this = $(this);

        // set textarea value to: text before caret + tab + text after caret
        $this.val($this.val().substring(0, start)
                    + "\t"
                    + $this.val().substring(end));

        // put caret at right position again
        this.selectionStart = this.selectionEnd = start + 1;

        // prevent the focus lose
        return false;
        //alert("TEST");
    }
});

and the one listed here : Enable Tab Indentation (github)

But neither of them yield any results. When I enter them into the JS area, I have them set to all pages (could this be a problem?).
avatar
Ailyn
Forumember

Female Posts : 25
Reputation : 3
Language : English
Location : Oregon

http://amandatest.forumotion.com

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by SLGray on April 1st 2017, 6:47 am

Since you will only be using them in topics, you should try just in topics.


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

avatar
SLGray
Administrator
Administrator

Male Posts : 38494
Reputation : 2589
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

In progress Re: How Do I Create My Own BB Codes?

Post by Ailyn on April 2nd 2017, 3:35 am

@SLGray wrote:Since you will only be using them in topics, you should try just in topics.

Ok, I tried changing things yesterday so that it was only in topics and nothing changed outwardly.

I was able to jerryrig the warning button code to give me the desired paragraph padding I needed for a bbCode for [indent], so that's not so much of a concern now.

Now I just want to make the board recognize the 'Tab' key for what it does in word processors and not as anything else. Any ideas? Like, could I put either of the tab indentation codes into the templates that handle posting/topics and PMs? I want to try that, but I wouldn't know where to start.
avatar
Ailyn
Forumember

Female Posts : 25
Reputation : 3
Language : English
Location : Oregon

http://amandatest.forumotion.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