From 5a23b3fdb970bb0c3e79f47ba9296455d237d9f0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 4 Oct 2010 17:46:01 +0000 Subject: - Patch #561858 by effulgentsia, sun, rfay, Nick_vh, merlinofchaos, katbailey, dereine, tstoeckler: drupal_add_js() and drupal_add_css() to work for AJAX requests too by adding lazy-load to AJAX framework. --- misc/ajax.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'misc') diff --git a/misc/ajax.js b/misc/ajax.js index 616195463..87f567fcd 100644 --- a/misc/ajax.js +++ b/misc/ajax.js @@ -231,6 +231,17 @@ Drupal.ajax.prototype.beforeSubmit = function (form_values, element, options) { form_values.push({ name: 'ajax_html_ids[]', value: this.id }); }); + // Allow Drupal to return new JavaScript and CSS files to load without + // returning the ones already loaded. + form_values.push({ name: 'ajax_page_state[theme]', value: Drupal.settings.ajaxPageState.theme }); + form_values.push({ name: 'ajax_page_state[theme_token]', value: Drupal.settings.ajaxPageState.themeToken }); + for (var key in Drupal.settings.ajaxPageState.css) { + form_values.push({ name: 'ajax_page_state[css][' + key + ']', value: 1 }); + } + for (var key in Drupal.settings.ajaxPageState.js) { + form_values.push({ name: 'ajax_page_state[js][' + key + ']', value: 1 }); + } + // Insert progressbar or throbber. if (this.progress.type == 'bar') { var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.id, eval(this.progress.update_callback), this.progress.method, eval(this.progress.error_callback)); -- cgit v1.2.3