Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Selecting the check box for "Aggregate JavaScript files" found under "Bandwidth optimization" on admin/config/development/performance makes it such that the Juicebox Gallery disappears on nodes.
Comments
Comment #1
rjacobs CreditAttribution: rjacobs commentedHi,
An issue with the exact same description came up a long time ago (~2 years ago) and was fixed. See: #1906940: "Aggregate JavaScript files" setting breaks Juicebox. The general idea is that the Juicebox javascript library does not function correctly when aggregated with other code by Drupal, so changes were implemented to ensure it does not participate in aggregation even when the core aggregation options are enabled. Since that very old issue was fixed I've not been able to replicate any problems related to this and have not heard of anyone else having problems either.
The only explanations that come to mind off-hand include:
Do any of these things apply to your case?
Comment #2
rjacobs CreditAttribution: rjacobs commentedHummm, it's actually a little weird that the title for this issue matches exactly (character-per-character) with the title from that 2-year-old issue. In fact, the issue description is nearly an exact match as well. I doubt that's a coincidence. @emil_c, did you copy-paste text from that old issue?
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedHello.
Yes, I did see that old issue. I just made a copy/paste of the title since the issue is existent for juicebox-7.x-2.0+4-dev (another version).
Actually I did try to disable some other modules and it looks like advagg is the culprit.
Thank you and sorry for a false alert. :-)
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedIt looks like the culprit is advagg module. It may be it doesn't play nice with Libraries API module.
Comment #5
rjacobs CreditAttribution: rjacobs commentedInteresting. I'm glad you found a solution.
I'm actually going to re-open this as it probably warrens a little follow-up. At a minimum there will be a need for us to document this somewhere given that it looks like advagg is reasonably popular (10000+ installs), so the potential for overlap with users of this module is not totally negligible.
When adding js to a page Drupal core offers a "preprocess" flag that has the following description (in drupal_add_js()): "If TRUE and JavaScript aggregation is enabled, the script file will be aggregated. Defaults to TRUE". For thing to work we make sure this is set to FALSE. If some other module, like advagg is overwriting this in some way, it's quite possibly a bug in that other module.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is strange a little... now it works. All I did was to disable advagg, clear everything in there (advagg) and enable it back. Also I am using perusio's nginx config and CloudFlare. Maybe it is related, maybe not. In CloudFlare I disabled Rocket Loader, which may break js at times.
Thank you.
Comment #7
rjacobs CreditAttribution: rjacobs commentedInteresting, thanks for following-up. When I have some free moments I'll do a local test with advagg + Juicebox. If I can't replicate any issues then I suppose we can close this. As you noted there are likely other external factors that could influence js handling which could be quite isolated or very case-specific.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedMight be a compatibility issue between advagg and juicebox after all. According to advagg README.txt:
HOW TO GET A HIGH PAGESPEED SCORE
---------------------------------
Go to `admin/config/development/performance/advagg`
- uncheck "Use cores grouping logic"
- check "Combine CSS files by using media queries"
Install AdvAgg Modifier if not enabled and go to
`admin/config/development/performance/advagg/mod`
- Under "Move JS to the footer" Select "All"
- set "Enable preprocess on all JS/CSS"
- set "Move JavaScript added by drupal_add_html_head() into drupal_add_js()"
- set "Move CSS added by drupal_add_html_head() into drupal_add_css()"
- Enable every checkbox under "Optimize JavaScript/CSS Ordering"
Install AdvAgg Compress Javascript if not enabled and go to
`admin/config/development/performance/advagg/js-compress`
- Select JSMin if available; otherwise select JSMin+
Enabling
- Under "Move JS to the footer" Select "All"
- set "Enable preprocess on all JS/CSS"
causes the mentioned issue. The temporary solution is to select "All but JavaScript Libraries" under "Move JS to the footer" and to disable "Enable preprocess on all JS".
I might be wrong in calling this an issue with juicebox module but I had no issue with other modules when using the recommended settings.
Thank you.
Comment #9
rjacobs CreditAttribution: rjacobs commentedYep, that seems exactly right. Thanks for pointing out those specifics regarding the AdvAgg Modifier module, it would have taken me to time to track down those details on my own.
The option Enable preprocess on all JS/CSS is incompatible with this module for the reasons outlined in comment #5. Basically we depend on the fact that the library is not aggregated for things to work correctly, so if AdvAgg bypasses this control there will defiantly be issues.
The option Move JS to the footer is incompatible with this module in some circumstances because we need to ensure that our gallery-specific JS (that's part of each gallery's embed code) fires after the main library JS is loaded. So in order for the main library JS to live in the footer we need to defer the execution of this gallery-specific JS. The module has controls to do this, but they are not enabled by default. To change this simply go to the global Juicebox conf options (
admin/config/media/juicebox
) and choose "footer" for the JS Scope. After this, everything should work fine no matter what value is set for AdvAgg's "Move JS to the footer" option.So it looks like the two modules can certainly be enabled together, there are just a couple minor considerations that have to be taken into account when configuring both.
Comment #10
rjacobs CreditAttribution: rjacobs commentedI added a note to the module documentation about this, which then links to this issue. Hopefully that will help future users. Since I don't think there are any functional changes that can/should be made to prevent these conflicts, this basic documentation is probably all we can do.
Comment #12
rat32 CreditAttribution: rat32 commentedBuddies, i was stuck on this and it was solved this way.
There is a switch variable from advagg_mod.module
advagg_mod_js_preprocess
which controls 'bullying' aggregation regardless of the originalpreprocess
settings. Turning off the switch solved the problem. (Thanks for help from the cn community. )