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.

I want to add a custom kotlin code BBcode

4 posters

Go down

In progress I want to add a custom kotlin code BBcode

Post by megamein Sun 14 Jul - 22:17

I searched a lot in the ACP but I didn't find anywhere where I can add custom BBcode.
avatar
megamein
Forumember

Posts : 74
Reputation : 3
Language : english

Back to top Go down

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

Post by SLGray Sun 14 Jul - 22: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.
SLGray
SLGray
Administrator
Administrator

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

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

Back to top Go down

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

Post by Ikerepc Sun 14 Jul - 23: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

http://admins.forumotion.com

Back to top Go down

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

Post by Ikerepc Mon 15 Jul - 0: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

http://admins.forumotion.com

Back to top Go down

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

Post by Ikerepc Wed 17 Jul - 21: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
Ikerepc
Ikerepc
Active Poster

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

http://admins.forumotion.com

Back to top Go down

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

Post by skouliki Wed 24 Jul - 12:28

hello 

is this solved?
skouliki
skouliki
Manager
Manager

Female Posts : 15133
Reputation : 1696
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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