how i can make custom bbcode for forum post content????

Ask anything you want to know
Post Reply
obaydulbc
Posts: 29
Joined: Tue Mar 07, 2023 1:37 pm

how i can make custom bbcode for forum post content????

Post by obaydulbc »

i am trying many javascript but. i cant make custom bbcode for forum post content... can anyone help me???
zunaid
Posts: 5
Joined: Tue Mar 07, 2023 9:08 am

Re: how i can make custom bbcode for forum post content????

Post by zunaid »

Forum already support bbcode! What you are missing?
samuel_anttunes
Posts: 29
Joined: Thu Mar 09, 2023 12:25 pm

Re: how i can make custom bbcode for forum post content????

Post by samuel_anttunes »

obaydulbc wrote: Thu Mar 09, 2023 11:18 am i am trying many javascript but. i cant make custom bbcode for forum post content... can anyone help me???

Hello friend, follow the javascript:


no ender:

Code: Select all

 <div id="output"></div> 
This div will exit the result of the javascript variable. [br]

Code: Select all

 <script>
  $str = ' %content% ';

// The array of regex patterns to look for
$format_search =  [
    /\[b\](.*?)\[\/b\]/ig,
  /\[youtube\](.*?)\[\/youtube\]/ig,
      /\[caixa\](.*?)\[\/caixa\]/ig,
    /\[i\](.*?)\[\/i\]/ig,
    /\[u\](.*?)\[\/u\]/ig
]; // NOTE: No comma after the last entry

// The matching array of strings to replace matches with
$format_replace = [
    '<strong>$1</strong>',
  '<iframe width="560" height="315" src="https://www.youtube.com/embed/$1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>',
  '<br/><br/>Codigo:<br/><textarea    rows="5" cols="30" class="button-45" role="button" style="" disabled>$1</textarea><br/>Caixa:<br/><textarea class="text" rows="5" cols="33">$1</textarea><button id="copy">Copiar</button><br/><br/>',
    '<em>$1</em>',
    '<span style="text-decoration: underline;">$1</span>'
];

// Perform the actual conversion
for (var i =0;i<$format_search.length;i++) {
  $str = $str.replace($format_search[i], $format_replace[i]);
}
document.getElementById('output').innerHTML=$str;
</script> <style> strong { font-weight:bold }
em { font-style:italic } </style>


in the second line of code has a function called $str that pulls the text from (%content%), if you use any variable or you must modify it to your desire.

In the $format_search function it pulls the BBcode displayed in the $str. and in the $format_replace function it converts BBcode to html. Modify the codes to your preferred.


Note: javascript should be the last applied between the codes, if adding it on top would leave the page blank.

http://jsfiddle.net/mplungjan/m8zLX/
-----------------------------BONUS----------------------------------------------------------
I have this javascript that convert links from youtube to player without bbcode.

https://godcode.wapka.xyz/f?id=47818&ti ... m%20bbcode
Last edited by samuel_anttunes on Sat Mar 11, 2023 2:16 pm, edited 1 time in total.
obaydulbc
Posts: 29
Joined: Tue Mar 07, 2023 1:37 pm

Re: how i can make custom bbcode for forum post content????

Post by obaydulbc »

cool
obaydulbc
Posts: 29
Joined: Tue Mar 07, 2023 1:37 pm

Re: how i can make custom bbcode for forum post content????

Post by obaydulbc »

zunaid wrote: Thu Mar 09, 2023 11:22 am Forum already support bbcode! What you are missing?
example i want to put a view full image link in Image tag.. how you will design it???
Rem22
Posts: 2
Joined: Mon Apr 03, 2023 4:53 pm

Re: how i can make custom bbcode for forum post content????

Post by Rem22 »

This new wapka site is hard to understand, a neutral person can't just config it
obaydulbc
Posts: 29
Joined: Tue Mar 07, 2023 1:37 pm

Re: how i can make custom bbcode for forum post content????

Post by obaydulbc »

Yes. But it is also easy if you know about all wapka configuration. It is so easy
Post Reply