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.
The forum of the forums
4 posters

    I want to add a custom kotlin code BBcode

    avatar
    megamein
    Forumember


    Posts : 74
    Reputation : 3
    Language : english

    In progress I want to add a custom kotlin code BBcode

    Post by megamein Sun 14 Jul 2019 - 21:17

    I searched a lot in the ACP but I didn't find anywhere where I can add custom BBcode.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51499
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: I want to add a custom kotlin code BBcode

    Post by SLGray Sun 14 Jul 2019 - 21:33

    There is not a default way to add custom BBCode in the AP.  There might be a way with coding.



    I want to add a custom kotlin code BBcode Slgray10

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


    Male Posts : 1186
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    In progress Re: I want to add a custom kotlin code BBcode

    Post by Ikerepc Sun 14 Jul 2019 - 22:54

    What forum version are you using?

    If you are using Invision, this should work, if something else, just write which one.
    This code will replace [g] and [/g] tags as bold. Tell me what exactly code you need so I can do it differently.

    You only need to modify variables code and replacement.
    Ask if you have any questions

    Javascript code: (enable it In topics)
    Code:
    $(function() {
      var elements = document.getElementsByClassName("post-entry");
      var code = /\[g\](.*?)\[\/g\]/g;
      var replacement = "<b>$1</b>";
      for (var i = 0, l = elements.length; i < l; i++) {
        elements[i].innerHTML = elements[i].innerHTML.replace(code, replacement);
      }
    });
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1186
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    In progress Re: I want to add a custom kotlin code BBcode

    Post by Ikerepc Sun 14 Jul 2019 - 23:00

    Or if you need few custom bbcodes, you can use arrays and one more for loop like this:

    Code:
    $(function() {
      var elements = document.getElementsByClassName("post-entry");
      var code = [/\[g\](.*?)\[\/g\]/g, /\[m\](.*?)\[\/m\]/g];
      var replacement = ["<b>$1</b>", "<i>$1</i>"];
      for (var i = 0, l = elements.length; i < l; i++) {
        for (t = 0; t < code.length; ++t) {
           elements[i].innerHTML = elements[i].innerHTML.replace(code[t], replacement[t]);
        }
      }
    });
    Ikerepc
    Ikerepc
    Active Poster


    Male Posts : 1186
    Reputation : 167
    Language : Who cares...
    Location : Where web help & support is needed

    In progress Re: I want to add a custom kotlin code BBcode

    Post by Ikerepc Wed 17 Jul 2019 - 20:41

    Soo... Is this helpful and do you need anything else on this topic?... I mean, do you understand regex code and all, what forum version you have, is this working?...

    I see you were online today so just asking if you solved this or need any other help Smile
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15312
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    In progress Re: I want to add a custom kotlin code BBcode

    Post by skouliki Wed 24 Jul 2019 - 11:28

    hello 

    is this solved?


      Current date/time is Mon 23 Sep 2024 - 9:21