From d45e0979fab54aaff19942ea8407a855dbda7b15 Mon Sep 17 00:00:00 2001 From: Ted Serbinski Date: Sat, 26 Jan 2008 23:08:39 +0000 Subject: [PATCH] - #199882, new options for controlling menu effects and timing, patch by Steve McKenzie, modified by me --- README.txt | 4 ++-- simplemenu.js | 9 ++++++++- simplemenu.module | 29 ++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index 1f1a1f85..2b89d1f0 100644 --- a/README.txt +++ b/README.txt @@ -11,7 +11,6 @@ Written by Ted Serbinski, aka, m3avrck Requirements: Drupal 5.0 -Icons from: http://www.famfamfam.com/ jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/ @@ -30,13 +29,14 @@ jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/ --- CHANGELOG -------------------------------------------------------- -4.1, 2008-Jan-26 +5.0, 2008-Jan-26 ---------------------- - #199224, fix display issues in IE6/7 - #200086, don't load non-existent custom.css file - #195972, better default CSS to avoid conflicts with themes - #199715, remove absolute positioning to improve theme and CSS attaching compatibility +- #199882, new options for controlling menu effects and timing 4.0, 2007-Nov-22 diff --git a/simplemenu.js b/simplemenu.js index 6c763b32..2a907b84 100644 --- a/simplemenu.js +++ b/simplemenu.js @@ -21,10 +21,17 @@ $(document).ready(function() { $('body').addClass('simplemenu-enabled'); + var animation = {}; + animation[Drupal.settings.simplemenu.effect] = 'toggle'; + // Build menu $('#simplemenu') .append(simplemenu) - .superfish( { speed: 'fast' } ) + .superfish( { + animation: animation, + delay: Drupal.settings.simplemenu.hideDelay, + speed: Drupal.settings.simplemenu.effectSpeed + } ) .find(">li:has(ul)") .mouseover(function(){ $("ul", this).bgIframe({opacity:false}); diff --git a/simplemenu.module b/simplemenu.module index 628cbaa2..024afa2e 100644 --- a/simplemenu.module +++ b/simplemenu.module @@ -46,8 +46,11 @@ function simplemenu_footer() { // pass in base path to the JS file // url() handles appending ?q= but in this case, we need to pass in the variable so the menus work when mod_rewrite is off 'basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='), + 'effect' => variable_get('simplemenu_effect', 'opacity'), + 'effectSpeed' => variable_get('simplemenu_effect_speed', 'fast'), + 'element' => variable_get('simplemenu_element', 'body'), + 'hideDelay' => variable_get('simplemenu_hide_delay', 800), 'placement' => variable_get('simplemenu_element_method', 'prepend'), - 'element' => variable_get('simplemenu_element', 'body') ); drupal_add_js(array('simplemenu' => $settings), 'setting'); @@ -125,6 +128,30 @@ function simplemenu_admin_settings() { '#default_value' => variable_get('simplemenu_exclusions', array()), '#description' => t('Select which themes to not display the menu. Use this when you have a theme that displays its own admin navigation.'), ); + + $form['default_menu']['advanced']['simplemenu_hide_delay'] = array( + '#type' => 'textfield', + '#title' => t('Hide delay'), + '#size' => 4, + '#default_value' => variable_get('simplemenu_hide_delay', 800), + '#description' => t('How long (in milliseconds) should a menu still appear after losing focus.') + ); + + $form['default_menu']['advanced']['simplemenu_effect'] = array( + '#type' => 'radios', + '#title' => t('Show effect'), + '#options' => array('opacity' => t('Fade'), 'height' => t('Slide'), 'none' => t('None')), + '#default_value' => variable_get('simplemenu_effect', 'opacity'), + '#description' => t('The effect used when displaying a menu.') + ); + + $form['default_menu']['advanced']['simplemenu_effect_speed'] = array( + '#type' => 'radios', + '#title' => t('Show speed'), + '#options' => array('slow' => t('Slow'), 'medium' => t('Medium'), 'fast' => t('Fast')), + '#default_value' => variable_get('simplemenu_effect_speed', 'fast'), + '#description' => t('The speed of the effect, not used when "none" is set to show effect.') + ); return system_settings_form($form); }