diff --git a/jquery_update.install b/jquery_update.install index e167a23..1425c95 100644 --- a/jquery_update.install +++ b/jquery_update.install @@ -32,6 +32,8 @@ function jquery_update_uninstall() { variable_del('jquery_update_compression_type'); variable_del('jquery_update_jquery_version'); variable_del('jquery_update_jquery_admin_version'); + variable_del('jquery_update_jquery_specific_paths_version'); + variable_del('jquery_update_jquery_specific_paths_paths'); variable_del('jquery_update_jquery_cdn'); } diff --git a/jquery_update.module b/jquery_update.module index 25523a5..1120642 100644 --- a/jquery_update.module +++ b/jquery_update.module @@ -94,6 +94,16 @@ function jquery_update_library_alter(&$javascript, $module) { $version = $admin_version; } } + + $specific_paths_version = variable_get('jquery_update_jquery_specific_paths_version', ''); + $specific_paths_paths = variable_get('jquery_update_jquery_specific_paths_paths', ''); + + if (!empty($specific_paths_version) && !empty($specific_paths_paths) && drupal_match_path(current_path(), $specific_paths_paths)) { + if (version_compare($version, $specific_paths_version, '!=')) { + $version = $specific_paths_version; + } + } + // If the ajax version is set then that one always win. if (!empty($_POST['ajax_page_state']['jquery_version'])) { $ajax_version = $_POST['ajax_page_state']['jquery_version']; @@ -202,6 +212,33 @@ function jquery_update_settings_form() { '#description' => t('Optionally select a different version of jQuery to use on administrative pages.'), ); + $form['version_options']['jquery_update_jquery_specific_paths_version'] = array( + '#type' => 'select', + '#title' => t('Alternate jQuery version for specific paths'), + '#options' => array( + '' => t('Default jQuery Version'), + 'default' => t('Default (provided by Drupal)'), + '1.5' => '1.5', + '1.7' => '1.7', + '1.8' => '1.8', + '1.10' => '1.10', + ), + '#default_value' => variable_get('jquery_update_jquery_specific_paths_version', ''), + '#description' => t('Optionally select a different version of jQuery to use on specific paths. This will override other jQuery version choices.'), + ); + + $form['version_options']['jquery_update_jquery_specific_paths_paths'] = array( + '#type' => 'textarea', + '#title' => t('Paths'), + '#default_value' => variable_get('jquery_update_jquery_specific_paths_paths', ''), + '#states' => array( + 'invisible' => array( + '[name="jquery_update_jquery_specific_paths_version"]' => array('value' => ''), + ), + ), + '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '')) +); + $form['jquery_update_compression_type'] = array( '#type' => 'radios', '#title' => t('jQuery compression level'),