# User Franck Deroche # Date 1244715549 -7200 #468218: Improve Popups compatibility with jQuery Update diff --git a/popups.module b/popups.module --- a/popups.module +++ b/popups.module @@ -152,6 +152,24 @@ $popup_js = array(); + // If the jQuery Update module is enabled, check for possible replacement + // needed to JS files. + if (module_exists('jquery_update')) { + $replacements = jquery_update_get_replacements(); + $path = drupal_get_path('module', 'jquery_update') .'/replace/'; + foreach($replacements as $type => $data) { + foreach($data as $src => $dst) { + $replacements[$type][$src] = $path . $dst; + } + } + // The behavior got called, so we're pretty sure that jQuery is already + // loaded. + unset($js['core']['misc/jquery.js']); + } + else { + $replacements = array(); + } + foreach ($js as $type => $data) { if (!$data) continue; switch ($type) { @@ -166,6 +184,9 @@ break; default: foreach ($data as $path => $info) { + if (isset($replacements[$type][$path])) { + $path = $replacements[$type][$path]; + } $popup_js[$type][$path] = '\n"; } break;