BbCodes & Buttons Manager

BbCodes & Buttons Manager 3.3.5

No permission to download
Preview of version 2.7.0 (Bbm) available on Github:
  • New PreCache listener (disable by default)
    I've coded this listener for me, so I've disabled it by default (to enable it, just go inside the "[Bb Codes & Buttons Manager] Bb Codes Manager" options) . If one of your Bb Code needs to make a database request (which means it will make one request each time your Bb Code is parsed - not good -), it allows to pre-cache some data (the parser tree is read a first time), then to use the new listener to make only one database request using these pre-cache data and injecting your needed information in the pre-cache to use them when the parser tree will be read for the second time (and then parsed).

    This listener will work with the Base & Wysiwyg formatters.

    One addon available here needs it: it modifies the attach tag and, if you don't have a php cache system, it will make a db request each time the attach tag is used in your post. I've modified it and the test was successful. I will contact directly the author, but here's what looks like the Bb Code renderer:
    PHP:
            {
               //Php cache conditional
             }
             else
             {
               if(!empty($rendererStates['bbmPreCacheInit']))
               {
                 $this->pushBbmPreCacheData('tinhteAioAttachementIds', $attachmentId);
               }
               elseif(!empty($rendererStates['bbmPreCacheComplete']))
               {
                  $bbmPreCacheAio = $this->getBbmPreCacheData('tinhteAioAttachementData');
                 
                  if(isset($bbmPreCacheAio[$attachmentId]))
                  {
                    $attachment_check = $bbmPreCacheAio[$attachmentId];
                  }
                  else
                  {
                   //Fallback (should not been needed)
                   $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);         
                  }
               }
               else
               {
                 //Fallback
                 $attachment_check = $this->_getAttachmentModel()->getAttachmentById($attachmentId);
               }
             }

    PHP:
        public static function bbmPreCache(array &$preCache, array &$rendererStates)
         {
         if(empty($preCache['tinhteAioAttachementIds']))
         {
           return false;
         }
         
         $attachementsIds = array_unique($preCache['tinhteAioAttachementIds']);
         $attachementsData = XenForo_Model::create('XenForo_Model_Attachment')->aioGetAttachmentByIds($attachementsIds); //The attachment model has been extended with this new method
         
         $preCache['tinhteAioAttachementData'] = $attachementsData;
         }

  • New JavaScript zLoader (will extend the XenForo ExtLoader)
    1. I was fed up of JavaScript Loading order problems when using the ExtLoader (uses by the XenForo template "require js" tag)
      Expanation:
      Some JS must be loaded before other JS, whereas other must be loaded at the end
      Solution:
      detect if the js file has a prefix (bbm_x_) ; 'x' being a number between 0-9 (will be loaded before other JS) or the letter 'z' (will be loaded after other JS) ; the code is tiny : about 490 bytes
    2. This solution allows to get rid of what I've coded before to be sure the Bbm Redactor JS file is loaded before. There's still an option to load globally this JS file if you need to.

  • The WrapME function has been improved (wrap a Bb Code inside another) - Thanks to @ZeZeene
    It will be automatically disable if the parent tag is 'url'. I think this check must be done globally and not only Bb Code by Bb Code. If you think differently, I can still prevent this check and do it manually in the Bb Codes that need it (spoilerbb from the Bbm Advanced Bb Codes Addon)

  • New internal functions available from Bb Code Callback
    Ie: $parentClass->bbmGetParentTag();

  • Many new Bb Codes helpers
 
Last edited:
New JavaScript zLoader (will extend the XenForo ExtLoader)

Considering you've made your own custom loader anyway, would it be possible to add the HTML5 attributes async and defer to these scripts whenever possible? Would be nice if the loading of the editor wouldn't block the rest of the page from rendering, especially considering it tends to be at the bottom of the page most of the time.

(defer does the exact same thing as async except that all scripts with the defer attribute are guaranteed to be executed in the order in which they are on the page. When both attributes are present, async overrides defer. They don't need to have a value set, so just <script async src="you-know-the-deal"></script> or <script async>inline stuff</script> should be enough)
 
Considering you've made your own custom loader anyway, would it be possible to add the HTML5 attributes async and defer to these scripts whenever possible? Would be nice if the loading of the editor wouldn't block the rest of the page from rendering, especially considering it tends to be at the bottom of the page most of the time.

(defer does the exact same thing as async except that all scripts with the defer attribute are guaranteed to be executed in the order in which they are on the page. When both attributes are present, async overrides defer. They don't need to have a value set, so just <script async src="you-know-the-deal"></script> or <script async>inline stuff</script> should be enough)
"My" loader is just a basic JS modification of the original "Ext loader". At this level, you only have 1 information, the JS url; that's why I use a dummy prefix system to sort the url to load (that's not pretty, but at least I don't have any errors and I can use this system for the new Bb Codes I'm currently coding).
If you want to do more using JS, it will require to modify more original JS function. That's clearly not a clean way. The ideal solution would be that XenForo developers add some attributes to the template require js tag, but that's a huge work to do. A few months ago, I've quickly looked if it was possible... but there are too much changes to do.
 
Hello! I am having issues with the addon causing the "Reply" post button to function incorrectly. It goes to the fast reply box with no quote text inside and posting a response shows the quote, but with no body text that was entered. How should I go about solving this?
 
Hello! I am having issues with the addon causing the "Reply" post button to function incorrectly. It goes to the fast reply box with no quote text inside and posting a response shows the quote, but with no body text that was entered. How should I go about solving this?
I can't reproduce. Check your javascript console to detect any errors. Try to update to last version of the addon too, same thing for TinyMCE if you use it.
 
I can't reproduce. Check your javascript console to detect any errors. Try to update to last version of the addon too, same thing for TinyMCE if you use it.
Thank you for your response Cedric!
Unfortunately, nothing is coming up on the Javascript console and I am running both newest versions. This only occurs in the richtext editor it seems. I recently updated Xenforo to 1.2.5 as well, but it happened before in .4 as well. Any ideas?
 
Thank you for your response Cedric!
Unfortunately, nothing is coming up on the Javascript console and I am running both newest versions. This only occurs in the richtext editor it seems. I recently updated Xenforo to 1.2.5 as well, but it happened before in .4 as well. Any ideas?
If you don't have any error in the console, I don't have any ideas. This addon doesn't modify or interfer with the reply XenForo JS functions.
You didn't reply me. Do you use the last version of this addon (and TinyMCE Quattro if you have it)?

If when you disable the BBM addon, your problem is solved, then contact me by pm with your website, a temporary admin account and a ftp access to the bbm libraries and javascript.
 
If you don't have any error in the console, I don't have any ideas. This addon doesn't modify or interfer with the reply XenForo JS functions.
You didn't reply me. Do you use the last version of this addon (and TinyMCE Quattro if you have it)?

If when you disable the BBM addon, your problem is solved, then contact me by pm with your website, a temporary admin account and a ftp access to the bbm libraries and javascript.
I am using Bb Codes & Buttons Manager 2.6.2.3 and TinyMCE Quattro 2.1.1.2. I reinstalled BBM as well as TinyMCE, but that did not fix it. It seems that disabling TinyMCE also fixes the problem. I'm not sure which one is the issue, BBM or TinyMCE...

I would appreciate it if you were okay with looking at my forum's files and seeing for yourself, would this be okay with you?
 
I am using Bb Codes & Buttons Manager 2.6.2.3 and TinyMCE Quattro 2.1.1.2. I reinstalled BBM as well as TinyMCE, but that did not fix it. It seems that disabling TinyMCE also fixes the problem. I'm not sure which one is the issue, BBM or TinyMCE...

I would appreciate it if you were okay with looking at my forum's files and seeing for yourself, would this be okay with you?
Yes, see my previous post. Are you using the bbm options that allows you to have a different editor configuration according to the ControllerName/action or view ? If yes, what is its configuration?
 
I got this error when using BB Codes in XenPorta, any help ?

12798114114_14c29ef88d_b.jpg
 
When I turn off the BBCODE add-on, it's gone, when I turn on, it's show like that
a) Edit your post code to delete the center Bb Code (the addon can't add it itself, it must be in the post)
or
b) Go to the addon option "[Bb Codes & Buttons Manager] XenForo Bb Codes Control" and set the option "Xen tags - Empty Content Check" to "no" (default value).
 
SOLVED: I found that the add-on, at the time, was causing quotes with the "Click to expand" bar not to work. After looking around for a bit, I disabled Template Modifications for BBM one by one and this one seemed to be the issue.
BBM_Template.png


The contents of the modification were:

Code:
    <script src="{$jQuerySource}"></script>  
    <xen:if is="{$jQuerySource} != {$jQuerySourceLocal}">
        <script>if (!window.jQuery) { document.write('<scr'+'ipt type="text/javascript" src="{$jQuerySourceLocal}"><\/scr'+'ipt>'); }</script>
    </xen:if><xen:if is="{$xenOptions.uncompressedJs} == 1 OR {$xenOptions.uncompressedJs} == 3">
    <script src="{$javaScriptSource}/jquery/jquery.xenforo.rollup.js?_v={$xenOptions.jsVersion}"></script></xen:if>  
    <script src="{xen:helper javaScriptUrl, '{$javaScriptSource}/xenforo/xenforo.js?_v={$xenOptions.jsVersion}'}"></script>
<!--XenForo_Require:JS-->

and the Find and Replace was
Code:
Find:
<!--XenForo_Require:JS-->

Replace:
$0
<xen:include template="bbm_page_container_js_head" />

Does this make any sense to you? (I don't get it all all, haha)

I hope this can help someone in the future! Thank you for your help Cedric.
 
Last edited:
@sweetfoo
This shouldn't occur, unless your js didn't refresh (see the FAQ of TinyMCE to show how to force the js to refresh). But anyway the new version of BBM 2.7.x is using a new workaround to avoid problems with the Ext loader (see post 565).
 
Top Bottom