Several interrelated questions and suggestions for your consideration:

1) I have been using morule "jQuery Update" 6.x-2.0-alpha1. Now that you got jQuery loading via Google libraries (http://code.google.com/apis/libraries/devguide.html#jquery) I guess this is ineffective or even not working. Shouldn't we turn off jQuery Update when using advagg? Maybe you can put a message to the status screen that jQuery Update is superfluous and should be turned off?

2) Could you provide a choice of different jQuery versions in a settings screen for advagg? All of them are on Google. Just a question of a select box or something.

3) jQuery UI is another library much needed by many Drupal module, and it is also at Google. Could you add it. And then maybe you can put a message to the status screen that jQuery UI can be served via advagg more efficiently but that the standalone module jQuery UI should be turned off.

4) What about support for other libraries that are at Google. Maybe advagg could detect that the site has enabled this or that library locally, but it is also at Google, from where it could be served more efficiently. This is a generic case of (3).

Comments

vacilando’s picture

Further to (1) -- I, for one, cannot actually turn off need jQuery Update as it is required by Skinr UI 6.x-2.x-dev, so it would be highly desirable to be able to have a choice of jQuery versions (2).

vacilando’s picture

I've noticed that in fact advagg pulls http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js which is the same version as what jQuery Update 6.x-2.0-alpha1 offers. But the problem is that e.g. Skinr UI has jQuery Update as a dependency, so I cannot switch it off. There might be other such cases.

vacilando’s picture

StatusFileSize
new9.99 KB
new12.51 KB

More findings: after switching off jQuery Update, thinking that I do not need it having http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js provided by advagg, I ran into all sorts of troubles with the website.

Eventually found that the status page has NO information about jQuery - see snapshot #1. Further, I found that the library loaded by advagg is now http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js ! (Why did it not say: jQuery 1.2.6 on the status page is a mystery!)

Switching on jQuery Update again I saw jQuery 1.3.2 in the status page, http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js in the source from advagg and the site started to behave again.

So it seems that advagg takes jQuery Update as kind of switch, but uses the library from Google. Wish this had been documented, even if in a cursory way.. lost a lot of time.

Anyway, my other questions are still valid.

mikeytown2’s picture

Title: jQuery Update, jQuery UI » jQuery Update status page fix; jQuery UI via google cdn

Looks like you figured out that I use jQuery update as an indicator as to what jQuery version to use. This module is still changing heavily; writing detailed documentation at this point will slow down development... once the pace slows down expect this module to be better documented.

In terms of jQuery UI google only hosts the big jquery file
http://code.google.com/apis/libraries/devguide.html#jqueryUI
Anyway it's on my todo list. Keep the stand alone module turned on.

I will add in support for google CDN replacement one request at a time. Patches accepted.

As for the status page; my guess is jQuery Update looks for their file. I'll have to dig into the module code.

mikeytown2’s picture

Title: jQuery Update status page fix; jQuery UI via google cdn » jQuery UI via google cdn

Looking at jQuery update and it's status shows up on my status page. Long story short, advagg has ZERO impact on the jQuery Update status code.

Code in question:

/**
 * Implementation of hook_requirements().
 */
function jquery_update_requirements($phase) {
  $requirements = array();
  $t = get_t();

  if ($phase == 'runtime') {
    $requirements['jquery_update'] = array(
      'title' => $t('jQuery Update'),
      'severity' => REQUIREMENT_OK,
      'value' => jquery_update_get_version(),
    );
  }

  return $requirements;
}

/**
 * Return the version of jQuery that is installed.
 *
 * This can be used by other modules' hook_requirements() to ensure that the
 * proper version of jQuery is installed.
 *
 * @see version_compare
 */
function jquery_update_get_version($jquery_path = NULL) {
  $version = 0;
  $pattern = '# * jQuery JavaScript Library v([0-9\.a-z]+)#';

  // No file is passed in so default to the file included with this module.
  if (is_null($jquery_path)) {
    $jquery_path = jquery_update_jquery_path();
  }

  // Return the version provided by jQuery Update.
  $jquery = file_get_contents($jquery_path);
  if (preg_match($pattern, $jquery, $matches)) {
    $version = $matches[1];
  }

  return $version;
}

/**
 * Return the path to the jQuery file.
 */
function jquery_update_jquery_path() {
  $jquery_file = array('none' => 'jquery.js', 'min' => 'jquery.min.js');
  return JQUERY_UPDATE_REPLACE_PATH .'/'. $jquery_file[variable_get('jquery_update_compression_type', 'min')];
}

Now for the jQuery UI google CDN...

mikeytown2’s picture

Status: Active » Fixed
StatusFileSize
new2.92 KB

jQuery UI now goes to googles CDN.
Note google only hosts the main file (jquery-ui.js), it does not host the sub files.
This patch has been committed.

vacilando’s picture

Congrats on the jQuery UI inclusion!

Some remaining questions from this thread I'd like to see your opinion about:

1. Even if advagg does have nothing to do with jQuery Update and jQuery UI modules, it would be really good to somehow show that advagg recognizes them and delivers what normally they deliver but from a highly available location at Google. I believe this will one day be listed on the project page and in the README.txt. Still, it would be lovely if the fact could also be indicated on the status page, or on the (planned) GUI. People like me like to verify whether things work as designed, so after activating advagg I would like to see a confirmation that indeed it took care for replacing the local libraries.

2. Any advantage in the idea of providing a select box offering various different jQuery and jQuery UI versions for people to select? Those who don't mind experimenting could bring up the library version as long as they don't see adverse effects.

3. Any other libraries that could be detected like this and fetched from Google or another highly available CDN?

Status: Fixed » Closed (fixed)

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

webfunkin’s picture

I have patched my jQuery update module to render jquery 1.4.2. Will it be possible to get that version from google's cdn?

mikeytown2’s picture

Status: Closed (fixed) » Active

it could be possible. create a "hidden" setting; one that you set in your settings.php file

mikeytown2’s picture

Status: Active » Fixed
StatusFileSize
new1.72 KB

if using the jQuery Update module the the variable to set in settings.php is

$conf['advagg_js_cdn_jquery_update_version'] = '1.4.2';

If not using jQuery Update

$conf['advagg_js_cdn_jquery_version'] = '1.4.2';

This patch has been committed.

webfunkin’s picture

Works. Thanks!

vacilando’s picture

Nice, but just to be absolutely clear -- if I use unpatched jQuery Update module I am fine, advagg knows what to get from Google CDN, right? The settings.php variables are just overrides of that, yes?

webfunkin’s picture

yeah, that's right.

Status: Fixed » Closed (fixed)

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