? replace/jquery.min.js Index: jquery_update.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jquery_update/jquery_update.install,v retrieving revision 1.2 diff -u -p -r1.2 jquery_update.install --- jquery_update.install 15 Jun 2008 04:07:14 -0000 1.2 +++ jquery_update.install 19 Jun 2008 17:47:38 -0000 @@ -48,4 +48,5 @@ function jquery_update_update_6100() { */ function jquery_update_uninstall() { variable_del('jquery_update_replace'); + variable_del('jquery_update_compression_type'); } Index: jquery_update.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jquery_update/jquery_update.module,v retrieving revision 1.4 diff -u -p -r1.4 jquery_update.module --- jquery_update.module 15 Jun 2008 05:08:46 -0000 1.4 +++ jquery_update.module 19 Jun 2008 17:47:38 -0000 @@ -54,8 +54,7 @@ function jquery_update_preprocess_page(& $scripts = drupal_add_js(); // Replace jquery.js first. - $jquery_path = JQUERY_UPDATE_REPLACE_PATH . '/jquery.js'; - $new_jquery = array($jquery_path => $scripts['core']['misc/jquery.js']); + $new_jquery = array(jquery_update_path() => $scripts['core']['misc/jquery.js']); $scripts['core'] = array_merge($new_jquery, $scripts['core']); unset($scripts['core']['misc/jquery.js']); @@ -91,7 +90,7 @@ function jquery_update_get_version($jque // No file is passed in so default to the file included with this module. if (is_null($jquery_path)) { - $jquery_path = JQUERY_UPDATE_REPLACE_PATH . '/jquery.js'; + $jquery_path = jquery_update_path(); } // Return the version provided by jQuery Update. @@ -115,3 +114,44 @@ function jquery_update_flush_caches() { $replace = version_compare($jquery_core_version, $jquery_update_version, '<'); variable_set('jquery_update_replace', $replace); } + +/** + * Implementation of hook_menu(). + */ +function jquery_update_menu() { + $items['admin/settings/jquery_update'] = array( + 'title' => 'jQuery Update', + 'description' => 'Configure settings for jQuery Update module.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('jquery_update_settings'), + 'access arguments' => array('administer site configuration'), + ); + return $items; +} + +/** + * Admin settings form. + */ +function jquery_update_settings() { + + // Clear the javascript cache when the setting is updated and check version of jquery file. + $form['#submit'][] = 'drupal_clear_js_cache'; + $form['#submit'][] = 'jquery_update_flush_caches'; + + $form['jquery_update_compression_type'] = array( + '#type' => 'radios', + '#title' => t('jQuery compression type'), + '#options' => array('pack' => t('Packed'), 'min' => t('Minified')), + '#default_value' => variable_get('jquery_update_compression_type', 'pack'), + '#description' => t('From docs.jquery.com: The minified version, while having a larger file size than the packed version, is generally the best version to use on production deployments. The packed version requires non-trivial client-side processing time to uncompress the code.'), + ); + return system_settings_form($form); +} + +/** + * Return the path to the jQuery file. + */ +function jquery_update_path() { + $jquery_file = array('pack' => '/jquery.js', 'min' => '/jquery.min.js'); + return JQUERY_UPDATE_REPLACE_PATH . $jquery_file[variable_get('jquery_update_compression_type', 'pack')]; +}