JU and JS Alter both operate on the original, unaltered set of scripts, which causes JU to revert any changes made by JS Alter. However, we can easily support jsalter by changing the last line of jquery_update_preprocess_page() from

    $variables['scripts'] = drupal_get_js('header', $scripts);

to

    // If installed, let jsalter.module alter the result.
    $function = module_exists('jsalter') ? 'jsalter_get_js' : 'drupal_get_js';
    $variables['scripts'] = $function('header', $scripts);

thus restoring the functionality of JS Alter which some modules rely on.

CommentFileSizeAuthor
#1 858636-201007302145+0700.patch2.59 KBsammys

Comments

sammys’s picture

StatusFileSize
new2.59 KB

Hi,

I've stumbled on the same problem. While your suggested solution would work it will unfortunately run the jsalter code twice. Once for jquery_update_preprocess_page() and once for jsalter_preprocess_page(). This is VERY undesirable.

Instead of using your solution I've rolled a potential patch that will save that extra step. It simply means jquery_update implements hook_js_alter(). :)

The patch applies to alpha1. Will happily reroll if it doesn't apply to 2.x-dev.

sun’s picture

Status: Active » Needs work

#1 makes sense, but needs some clean-up and also docs. Additionally, this patch or #858578: Errors due to changed order of scripts needs to be re-rolled after one of both landed.

pacufist’s picture

Hi guys! Do you have any progress ?

robloach’s picture

Status: Needs work » Fixed

If you do an update from yesterday in 6.x-2.x-dev, you'll see there's a hook_jquery_update_alter(). Probably needs some documentation fixing though.

pacufist’s picture

Thanks! I`s exactly what I need.

Status: Fixed » Closed (fixed)

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

shark’s picture

Can someone provide a tiny example on how to use this? Is anything required beyond implementing hook_js_alter?

Thanks!