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.
JS is not compressed in garland theme
JS is not compressed in garland theme
Comments
Comment #1
prathamesh.save CreditAttribution: prathamesh.save commentedWhen I include the JS file through theme.info, then none of the javascript is included in civicrm and the console shows cj is not defined and other js errors.
My file system is private.
I am using civicrm 4.1.6 and drupal 6.26.
I have latest version of this module installed.
Comment #2
prathamesh.save CreditAttribution: prathamesh.save commentedComment #3
p5systems CreditAttribution: p5systems commentedHello prathamesh.save,
You can add js in your theme through drupal_add_js('jsfolder/yourjs.js'); in your templete.php file of the theme.
Comment #6
flug CreditAttribution: flug commentedProblem when running advagg and civicrm together: "console shows cj is not defined and other js errors." Basically no js or ajax works within CiviCRM. Contribution forms are missing the credit card fields. Civicrm Dashboard items don't show and give a error indicating js must be turned on. Etc.
The root of this problem has to do with the fact that Drupal & CiviCRM use different versions of JQuery. CiviCRM calls its version cj and prefixes all jquery calls with cj to differentiate. Whether this works seems to be very dependent on the order in which the jquery and other js modules are loaded. If you look at the javascript console or errors you see see a large number of "cj not defined" errors.
Here is how I solved (using Drupal 6, Civicrm 4.2, Jquery update, advagg modules):
- You'll need the module weights module enabled (it's part of drupal core)
- Go to admin/build/modules
- Set weight for JQuery UPdate to 98
- Weight for Advanced CSS/JS Aggregation to 99
- Weight for CiviCRM to 100
Depending on what other modules you have & issues regarding their relative weights, you might need to adjust this a bit--maybe it is 298, 299, and 300 instead of 98, 99, 100. But the basic idea is that both JQuery Update & AdvAgg must be loaded BEFORE CiviCRM. AdvAgg needs to be loaded AFTER most other modules but before CiviCRM.
Out of the box AdvAgg has weight of 250, putting it after CiviCRM. This causes the problem. Adjusting the module weights appears to solve it.
Related topics from the CiviCRM message boards:
http://forum.civicrm.org/index.php?topic=23203.0 (AdvAgg vs Civicrm & javascript)
http://forum.civicrm.org/index.php?topic=21761.0 (Potential issues/solutions re: CiviCRM & Jquery update)