I'm using Floatbox in several applications, amongst others in some MODX Revolution Sites. Today a conflict was revealed:
In a customer's site I use Floatbox in news articles (for the images). I don't want to use the alt or the title attributes for the captions, so I define them explicitly in the data-fb-options attribute:
<a href="path/to/image.jpg" class="floatbox" data-fb-options="caption:`This is my caption"><img src="path/to/thumbnail.jpg" alt="Some description" /></a>
The caption has to be surrounded by backticks (`).
Now I use the content of this news article page for a teaser on the home page. The problem is that MODX also uses backticks for the parameters of its "snippets", which are basically PHP scripts managed by the CMS. The "chunk" (or template) for such a teaser e. g. contains the following MODX tag(s):
[[!ShortenText? &text=`[[!EliminateTags? &text=`[[+content]]`]]` &length=`[[+numChars:default=`150`]]` &postfix=`ellipsis`]]
So the content of the news article ([[+content]]) is surrounded by backticks and contains backticks itself.
This nevertheless worked in several news articles, but for some reason not in the one I had to create today - the teaser text was empty -, and I'm not overly astonished.
I could solve this by hacking the floatbox.js script; I changed
g=/`([^`]*)`)/g,h;
to
g=/`([^`]*)`|#([^#]*#)/g,h;
and used the # character instead of the backtick in the definition of the caption.
Well, this is okay for the time being, but I'd prefer an official solution, especially with regard to future updates - if I forget to apply the hack, some captions will be quite strange (# plus the first word of the defined caption).
Could you imagine making the character that has to surround the caption (or other parameters) configurable? Ideally the backticks should also be accepted (as in my hack) so that existing and working definitions wouldn't have to be changed.
Thank you very much in advance for considering this,
Jan