When JavaScript aggregation is enabled on a site using a locally-hosted library its language files (and probably some other files) can't be loaded from the library. The main timeline.js script gets aggregated too. When it initializes, it sets its location to the site's files directory where the aggregated file is cached and tries to dynamically load other library files from that same directory. Of course, they aren't located there.
Proposed Solution
TimelineJS has a setting for specifying the location of the library files. I didn't previously know what this setting was made for, but it seems to have been created for this exact situation. The plugin should automatically set this value whenever the library files are served locally.
Original Report
After enabling language NL on my site, i noticed that my already working timeline was showing an error
Could not load language ["nl"]: Not Found
I found out this message originates from sites\all\libraries\TimelineJS3\source\js\language\TL.Language.js
where some ajax call is performed in case language differs from 'en', and returns a response > 200.
In an effort to debug this piece of JS, i had to first disable my Advanced Aggregation setting (provided by https://www.drupal.org/project/advagg).
This action seemed to solve the occurring error.
After some tweaking i found out the error was caused by the enabled "Fix improperly set type" in the AdvAgg JS settings
I'm not an aggregation specialist and the symptoms it may cause, but i thought it might be useful sharing this information.
Comments
Comment #2
dcam CreditAttribution: dcam commentedActually, the problem isn't exclusive to site using Advanced Aggregation or that setting. It occurs when using core's built-in JS aggregation too.
Comment #3
dcam CreditAttribution: dcam commentedD8 patch, not that it matters since we don't have any tests for the module yet.
Comment #5
dcam CreditAttribution: dcam commentedComment #6
dcam CreditAttribution: dcam commentedWell, I take that back partly. D8's core aggregation will aggregate JS from other libraries, but D7's won't. D7 must have Advanced Aggregation enabled to reproduce the issue. The fix is still the same.
Comment #7
dcam CreditAttribution: dcam commentedD7 patch.
Comment #9
dcam CreditAttribution: dcam commentedComment #10
dcam CreditAttribution: dcam commentedUnless there's an additional bug report in the next few days then then these will be the last changes to go into the 3.1 releases. 8.x-3.1 and 7.x-3.1 will be released on the 3.0 launch anniversary, October 10.
Comment #11
RAWDESK CreditAttribution: RAWDESK for Colruyt Group Services commented@dcam Reviewed and tested patch #7.
Works like a charm.
Thanks for the fix!
Comment #12
dcam CreditAttribution: dcam commentedNo problem. Thank you for testing it.
Comment #14
giufog CreditAttribution: giufog commentedGood morning to all, I installed Views TimelineJS 7.x-3.1 but still gives me the error reported at the beginning, it appears when the language is not English
Comment #15
dcam CreditAttribution: dcam commented@giufog Are you using the Advanced Aggregation module to aggregate your site's JS?