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.

How Do I Create My Own BB Codes?

3 posters

Go down

In progress How Do I Create My Own BB Codes?

Post by Ailyn March 29th 2017, 07:37

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.
Ailyn
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 March 29th 2017, 08:53

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?

Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

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

Post by Ailyn March 29th 2017, 14:02

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
Ailyn
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 March 31st 2017, 02:18

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?
Ailyn
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 March 31st 2017, 02:28

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.
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

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

Post by Ailyn April 1st 2017, 03:25

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):
How Do I Create My Own BB Codes? Compar10



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?).
Ailyn
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 April 1st 2017, 07:47

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


How Do I Create My Own BB Codes? Slgray10

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

Male Posts : 51453
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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

Post by Ailyn April 2nd 2017, 04:35

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.
Ailyn
Ailyn
Forumember

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

http://amandatest.forumotion.com

Back to top Go down

Back to top

- Similar topics

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