I'm working with the Quicktabs 2.x module, with content loaded via Ajax. When it pulls the AJAX content, it seems to bring down the unaggregated .js and .css files individually and not the advagg bundles.

Not quite sure why yet, or even which module would require a fix (this one or Quicktabs), but I thought I'd get a thread started in the event that anyone else has seen this. Should be easy to reproduce, set up quicktabs, with Ajax: Yes in the Quicktabs setup. Then click your second Quicktab and check Firebug+NET to watch the .js/.css come in for the new block.

CommentFileSizeAuthor
#6 quicktabs-advagg-1172010-6.patch1.9 KBmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rjbrown99’s picture

One other note, this will also break Internet Explorer in Ajax Quicktabs if you have lots of CSS files. You run into the IE limit of 32 total CSS files loaded per page. As a second follow on issue, Quicktabs does not pull ajax loaded content from the CDN. All static graphics are not rewritten and are served up from the main Drupal server. Probably a different issue for a different queue...

In all cases this smells like changes to QuickTabs, quicktabs.module, quicktabs_ajax_js_css(). That function states that it originated in ctools, so perhaps there is some overlap in the fix from the various ctools+advagg issues.

This seems very relevant: http://drupal.org/node/1149792#comment-4451240
This even more so: http://drupal.org/node/1149792#comment-4457270

Mikeytown2: In that last comment re: sending back the aggregated bundles via Javascript, let's assume for a moment that I fixed Quicktabs to have a nearly identical function to ctools_ajax_render(). In that case, when you talk about 'sending back the bundles' with that example JS code, can you be more specific? I can use that to bundle it all up, but how am I passing that back to the server side?

mikeytown2’s picture

Title: Quicktabs loaded via AJAX do not pull advagg bundles » Quicktabs, AdvAgg - Loaded via AJAX do not pull advagg bundles

This looks like it will require a change in Quicktabs. Moving it there; I will come up with a patch; should also include the CDN fix as a byproduct (if your using advagg).

mikeytown2’s picture

Project: Advanced CSS/JS Aggregation » Quick Tabs
Version: 6.x-1.x-dev » 6.x-2.x-dev
Category: bug » feature
rjbrown99’s picture

Yea I banged my head against this for a while and only partially got it working. I'm guessing it is going to be quite a lot like the ctools fix since the function is derived from that module. Thanks Mikeytown2 for the help.

My workaround for now is non-ajax'd quicktabs loading ajax views that are cached.

mikeytown2’s picture

I'm going to put most of the code changes in advagg; issue for that #1174908: Option to output JS/CSS as a files array

So hopefully all we have to do is add

  if (module_exists('advagg') && variable_get('advagg_enabled', ADVAGG_ENABLED)) {
    return advagg_***;
  }

to the top of the quicktabs_ajax_js_css() function.

mikeytown2’s picture

Status: Active » Needs review
FileSize
1.9 KB

Like most things, this is more complicated then originally thought. The json request needs to send to the server what css/js files are already loaded & then it needs to only send back an aggregate of the files missing. Right now we can send back an aggregate of the whole thing but that's a lot of extra code getting loaded for no good reason. The other thing has to do with conditional CSS from modules like CSS Embedded Images. In short to do this "right", it will take some effort on from both sides.

Here's a patch to get you through; it loads the aggregates. Quicktabs will need a lot of work for it to be fully optimized. We don't use Quicktabs so I won't be leading the charge on this issue.

rjbrown99’s picture

Thanks mikeytown2 for looking into it. I'm testing with Quicktabs-6.x-2.0-rc5 and so far with the patch I'm still seeing it load individual CSS/JS files and not the aggregates. I'll poke around and let you know what I come up with.

Quicktabs ajax = off
2 total Quicktabs in my setup
Each tab is a views3 block of content with a pager
The views are ajax-enabled

As far as I can tell so far, the quicktabs_ajax_js_css() function isn't even being called at all which is probably part of it. This is specifically when hitting the views pager to go to the next page. It does a GET from:

 /views/ajax?js=1&page=1&view_name=view_wall&view_display_id=block_2&view_args=&view_path=node&view_base_path=null&view_dom_id=1&pager_element=0

... so perhaps this needs to tie back into Views land as well for ajax'd stuff. I forked off a new Views issue here: #1193578: Emulate theme('page') processing to obtain list of css/js files.

netw3rker’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)