| 1 |
<?php |
<?php |
| 2 |
// $Id: nice_menus.module,v 1.57 2009/02/06 14:20:48 add1sun Exp $ |
// $Id: nice_menus.module,v 1.58 2009/02/06 14:40:37 add1sun Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 89 |
'#default_value' => variable_get('nice_menus_number', '2'), |
'#default_value' => variable_get('nice_menus_number', '2'), |
| 90 |
'#size' => 2, |
'#size' => 2, |
| 91 |
); |
); |
| 92 |
$form['nice_menus_ie'] = array( |
$form['nice_menus_js'] = array( |
| 93 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 94 |
'#title' => t('Enable IE support'), |
'#title' => t('Use JavaScript'), |
| 95 |
'#description' => t('This will add necessary JavaScript for Nice menus to work properly in Internet Explorer.'), |
'#description' => t('This will add Superfish Jquery to Nice menus. This is required for Nice menus to work properly in Internet Explorer.'), |
| 96 |
'#default_value' => variable_get('nice_menus_ie', 1), |
'#default_value' => variable_get('nice_menus_js', 1), |
| 97 |
); |
); |
| 98 |
|
$form['nice_menus_sf_options'] = array( |
| 99 |
|
'#type' => 'fieldset', |
| 100 |
|
'#title' => t('Advanced: Superfish options'), |
| 101 |
|
'#description' => t('You can change the default Superfish options by filling out the desired values here. These only take effect if the Use JavaScript box above is checked.'), |
| 102 |
|
'#collapsible' => TRUE, |
| 103 |
|
'#collapsed' => TRUE, |
| 104 |
|
); |
| 105 |
|
$form['nice_menus_sf_options']['nice_menus_sf_delay'] = array( |
| 106 |
|
'#type' => 'textfield', |
| 107 |
|
'#title' => t('Mouse delay'), |
| 108 |
|
'#description' => t('The delay in milliseconds that the mouse can remain outside a submenu without it closing.'), |
| 109 |
|
'#default_value' => variable_get('nice_menus_sf_delay', 800), |
| 110 |
|
'#size' => 5, |
| 111 |
|
); |
| 112 |
|
$form['nice_menus_sf_options']['nice_menus_sf_speed'] = array( |
| 113 |
|
'#type' => 'select', |
| 114 |
|
'#title' => t('Animation speed'), |
| 115 |
|
'#multiple' => FALSE, |
| 116 |
|
'#description' => t('Speed of the menu open/close animation.'), |
| 117 |
|
'#options' => array(t('slow'), t('normal'), t('fast')), |
| 118 |
|
'#default_value' => variable_get('nice_menus_sf_speed', 1), |
| 119 |
|
); |
| 120 |
|
|
| 121 |
// Custom validation to make sure the user is entering numbers. |
// Custom validation to make sure the user is entering numbers. |
| 122 |
$form['#validate'][] = 'nice_menus_settings_validate'; |
$form['#validate'][] = 'nice_menus_settings_validate'; |
| 263 |
* and the menus are unstyled. |
* and the menus are unstyled. |
| 264 |
*/ |
*/ |
| 265 |
function nice_menus_init() { |
function nice_menus_init() { |
| 266 |
// Add JavaScript, if enabled. |
// Add Superfish JavaScript, if enabled. |
| 267 |
if (variable_get('nice_menus_ie', 1) == 1) { |
if (variable_get('nice_menus_js', 1) == 1) { |
| 268 |
|
// The script, from http://users.tpg.com.au/j_birch/plugins/superfish. |
| 269 |
|
drupal_add_js(drupal_get_path('module', 'nice_menus') .'/superfish/js/superfish.js'); |
| 270 |
|
// Add the Superfish options variables. |
| 271 |
|
drupal_add_js(array( |
| 272 |
|
'nice_menus_options' => array( |
| 273 |
|
'delay' => variable_get('nice_menus_sf_delay', 800), |
| 274 |
|
'speed' => variable_get('nice_menus_sf_speed', 1), |
| 275 |
|
)),'setting'); |
| 276 |
|
// Add the bgIframe plugin. |
| 277 |
|
drupal_add_js(drupal_get_path('module', 'nice_menus') .'/superfish/js/jquery.bgiframe.min.js'); |
| 278 |
|
// The Nice menus implementation. |
| 279 |
drupal_add_js(drupal_get_path('module', 'nice_menus') .'/nice_menus.js'); |
drupal_add_js(drupal_get_path('module', 'nice_menus') .'/nice_menus.js'); |
| 280 |
} |
} |
| 281 |
|
|