--- a/jquery_update_old.module ma jul 23 10:53:56 2012 +++ b/jquery_update.module ma jul 23 10:46:18 2012 @@ -64,9 +64,22 @@ * Implementation of hook_library_alter(). */ function jquery_update_library_alter(&$javascript, $module) { + + // Make sure this path is not excluded from update. + $current_path = $_GET['q']; + $update_exceptions = variable_get('jquery_update_exception_paths',''); + $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; + } // We are updating just the system module. For all other cases we return. - if ($module != 'system') { + if ($module != 'system' || !$include) { return; } @@ -148,6 +161,23 @@ '#default_value' => variable_get('jquery_update_jquery_cdn', 'none'), '#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."), + ); return system_settings_form($form); } @@ -166,6 +196,7 @@ * The version of jQuery to use. */ function jquery_update_jquery_replace(&$javascript, $cdn, $path, $min, $version) { + // Make sure to use the latest version in given branch. $trueversion = NULL; switch ($version) {