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

rjacobs’s picture

Issue tags: -juicebox

Hi,

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:

  • If you are using a very old version of the module (before 7.x-1.0-beta1)
  • If you are doing something in custom code that bypasses the way this module adds galleries and related assets to a page.
  • If you are doing some custom alterations to library definitions that are handled by Libraries API.

Do any of these things apply to your case?

rjacobs’s picture

Hummm, 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?

Anonymous’s picture

Hello.
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. :-)

Anonymous’s picture

Status: Active » Closed (works as designed)

It looks like the culprit is advagg module. It may be it doesn't play nice with Libraries API module.

rjacobs’s picture

Title: "Aggregate JavaScript files" setting breaks Juicebox » Potential conflicts with advagg module
Category: Bug report » Task
Priority: Major » Normal
Status: Closed (works as designed) » Active

Interesting. 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.

Anonymous’s picture

This 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.

rjacobs’s picture

Interesting, 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.

Anonymous’s picture

Might 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.

rjacobs’s picture

Yep, 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.

rjacobs’s picture

Status: Active » Fixed

I 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rat32’s picture

Buddies, 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 original preprocess settings. Turning off the switch solved the problem. (Thanks for help from the cn community. )