Browse Source

- #199882, new options for controlling menu effects and timing, patch by Steve McKenzie, modified by me

Ted Serbinski 17 years ago
parent
commit
d45e0979fa
3 changed files with 38 additions and 4 deletions
  1. 2 2
      README.txt
  2. 8 1
      simplemenu.js
  3. 28 1
      simplemenu.module

+ 2 - 2
README.txt

@@ -11,7 +11,6 @@ Written by Ted Serbinski, aka, m3avrck
 
 
 Requirements: Drupal 5.0
 Requirements: Drupal 5.0
 
 
-Icons from: http://www.famfamfam.com/
 jQuery Superfish: http://users.tpg.com.au/j_birch/plugins/superfish/
 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 --------------------------------------------------------
 --- CHANGELOG --------------------------------------------------------
 
 
-4.1, 2008-Jan-26
+5.0, 2008-Jan-26
 ----------------------
 ----------------------
 
 
 - #199224, fix display issues in IE6/7 
 - #199224, fix display issues in IE6/7 
 - #200086, don't load non-existent custom.css file
 - #200086, don't load non-existent custom.css file
 - #195972, better default CSS to avoid conflicts with themes
 - #195972, better default CSS to avoid conflicts with themes
 - #199715, remove absolute positioning to improve theme and CSS attaching compatibility
 - #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
 4.0, 2007-Nov-22

+ 8 - 1
simplemenu.js

@@ -21,10 +21,17 @@ $(document).ready(function() {
 
 
   $('body').addClass('simplemenu-enabled');
   $('body').addClass('simplemenu-enabled');
 
 
+  var animation = {};
+  animation[Drupal.settings.simplemenu.effect] = 'toggle';
+  
   // Build menu
   // Build menu
   $('#simplemenu')
   $('#simplemenu')
     .append(simplemenu)
     .append(simplemenu)
-    .superfish( { speed: 'fast' } )
+    .superfish( { 
+      animation: animation,
+      delay: Drupal.settings.simplemenu.hideDelay,
+      speed: Drupal.settings.simplemenu.effectSpeed
+    } )
   	.find(">li:has(ul)")
   	.find(">li:has(ul)")
   		.mouseover(function(){
   		.mouseover(function(){
   			$("ul", this).bgIframe({opacity:false});
   			$("ul", this).bgIframe({opacity:false});

+ 28 - 1
simplemenu.module

@@ -46,8 +46,11 @@ function simplemenu_footer() {
       // pass in base path to the JS file
       // 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
       // 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='),
       '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'),
       'placement' => variable_get('simplemenu_element_method', 'prepend'),
-      'element' => variable_get('simplemenu_element', 'body')
     );
     );
 
 
     drupal_add_js(array('simplemenu' => $settings), 'setting');
     drupal_add_js(array('simplemenu' => $settings), 'setting');
@@ -125,6 +128,30 @@ function simplemenu_admin_settings() {
     '#default_value' => variable_get('simplemenu_exclusions', array()),
     '#default_value' => variable_get('simplemenu_exclusions', array()),
     '#description' => t('Select which themes to <strong>not</strong> display the menu. Use this when you have a theme that displays its own admin navigation.'),
     '#description' => t('Select which themes to <strong>not</strong> 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);
   return system_settings_form($form);
 }
 }