diff --git a/jquery_update.module b/jquery_update.module index 956c9e5..d8b6d43 100644 --- a/jquery_update.module +++ b/jquery_update.module @@ -78,9 +78,22 @@ function jquery_update_library_alter(&$javascript, $module) { $path = drupal_get_path('module', 'jquery_update'); $version = variable_get('jquery_update_jquery_version', '1.10'); + // Make sure this path is not excluded from update. + $current_path = $_GET['q']; + $update_exceptions = variable_get('jquery_update_exception_paths',''); + $alias_path = drupal_get_path_alias($current_path); + $excluded = drupal_match_path($current_path, $update_exceptions) || drupal_match_path($alias_path, $update_exceptions); + // exclusions or inclusions? + $inclusion = intval( variable_get('jquery_update_exception_condition',0) ); + if ( ($inclusion && $excluded) || (!$inclusion && !$excluded) ) { + $include = TRUE; + } else { + $include = FALSE; + } + // Modified System Library. - if ($module === 'system') { + if ($module != 'system' || !$include) { // Make sure we inject either the minified or uncompressed version as desired. $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; @@ -236,6 +249,41 @@ function jquery_update_settings_form() { '#description' => t('Use jQuery and jQuery UI from a CDN. If the CDN is not available the local version of jQuery and jQuery UI will be used.'), ); + /* + * jQuery update not on these pages + */ + $form['jquery_update_exception_condition'] = array( + '#type' => 'radios', + '#options' => array( + '0' => t('DO NOT update jQuery on these pages'), + '1' => t('ONLY update jQuery on these pages'), + ), + '#default_value' => variable_get('jquery_update_exception_condition', '0'), + ); + $form['jquery_update_exception_paths'] = array( + '#type' => 'textarea', + '#default_value' => variable_get('jquery_update_exception_paths', ''), + '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. is the front page."), + ); + + /* + * jQuery update not on these pages + */ + $form['jquery_update_exception_condition'] = array( + '#type' => 'radios', + '#options' => array( + '0' => t('DO NOT update jQuery on these pages'), + '1' => t('ONLY update jQuery on these pages'), + ), + '#default_value' => variable_get('jquery_update_exception_condition', '0'), + ); + + $form['jquery_update_exception_paths'] = array( + '#type' => 'textarea', + '#default_value' => variable_get('jquery_update_exception_paths', ''), + '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. is the front page."), + ); + return system_settings_form($form); }