diff -Naurp dhtml_menu.original/dhtml_menu.admin.inc dhtml_menu/dhtml_menu.admin.inc --- dhtml_menu.original/dhtml_menu.admin.inc 2008-11-08 18:35:12.000000000 +0100 +++ dhtml_menu/dhtml_menu.admin.inc 2010-04-01 11:28:52.000000000 +0200 @@ -20,6 +20,7 @@ function dhtml_menu_settings(&$form_stat 'children' => t('Close menus when their parent menu is closed.'), 'clone' => t('Add an extra page link to each expanding menu item.'), 'doubleclick' => t('Go to the page on double-click.'), + 'bullets' => t('Use bullet to expand menu items (If selected the two preceding options will be ignored).'), ), '#default_value' => variable_get('dhtml_menu_effects', unserialize(DHTML_MENU_DEFAULT)), ); diff -Naurp dhtml_menu.original/dhtml_menu.css dhtml_menu/dhtml_menu.css --- dhtml_menu.original/dhtml_menu.css 2008-11-05 23:20:28.000000000 +0100 +++ dhtml_menu/dhtml_menu.css 2010-04-01 11:28:52.000000000 +0200 @@ -9,3 +9,27 @@ li.start-collapsed ul display:none; } +li.dhtml-menu +{ + position: relative; +} + +li.dhtml-menu a.dhtmlMenuControl +{ + position: absolute; + left: -0.5em; + width: 1em; + height: 0; + padding: 1em 3px 1px 3px; + overflow: hidden; + background: none; + text-decoration: none; +} +li.dhtml-menu a.dhtmlMenuControl, +li.dhtml-menu a.dhtmlMenuControl:hover, +li.dhtml-menu a.dhtmlMenuControl:active, +li.dhtml-menu a.dhtmlMenuControl:visited +{ + text-decoration: none; + outline: none; +} diff -Naurp dhtml_menu.original/dhtml_menu.js dhtml_menu/dhtml_menu.js --- dhtml_menu.original/dhtml_menu.js 2009-01-12 11:13:30.000000000 +0100 +++ dhtml_menu/dhtml_menu.js 2010-04-08 11:36:57.000000000 +0200 @@ -43,23 +43,40 @@ Drupal.behaviors.dhtmlMenu = function() */ $('ul.menu li.dhtml-menu:not(.leaf,.no-dhtml)').each(function() { var li = this; - if (effects.clone) { + // Add class to 'branch' links for theming + $(li).find('a:first').attr("class","branch"); + if (effects.clone && !effects.bullets) { var ul = $(li).find('ul:first'); if (ul.length) { $(li).find('a:first').clone().prependTo(ul).wrap('
  • '); } } - if (effects.doubleclick) { + if (effects.doubleclick && !effects.bullets) { $(li).find('a:first').dblclick(function(e) { window.location = this.href; }); } - - $(li).find('a:first').click(function(e) { - Drupal.dhtmlMenu.toggleMenu($(li)); - return false; - }); + + /* If item bullets are to be used for the toggle behaviour, + * insert a new link tag to be used for menu expansion. + */ + if(effects.bullets) { + var toggleLinkTitle = Drupal.t('Show/Hide Submenu'); + var toggleLinkText = Drupal.t('Toggle Menu'); + var toggleLink = ''+ toggleLinkText +''; + $(li).find('a:first').before(toggleLink); + $(li).find('a.dhtmlMenuControl').click(function(e) { + Drupal.dhtmlMenu.toggleMenu($(li)); + return false; + }); + } + else { + $(li).find('a:first').click(function(e) { + Drupal.dhtmlMenu.toggleMenu($(li)); + return false; + }); + } }); } @@ -106,7 +123,7 @@ Drupal.dhtmlMenu.toggleMenu = function(l // Siblings are all open menus that are neither parents nor children of this menu. $(li).find('li').addClass('own-children-temp'); - + // If the relativity option is on, select only the siblings that have the same parent if (effects.relativity) { var siblings = $(li).parent().find('li.expanded').not('.own-children-temp').not(':has(#' + id + ')'); @@ -152,13 +169,16 @@ Drupal.dhtmlMenu.cookieGet = function() } /** - * Saves the dhtml_menu cooki. + * Saves the dhtml_menu cookie. */ Drupal.dhtmlMenu.cookieSet = function() { + var effects = Drupal.settings.dhtmlMenu; var expanded = new Array(); $('li.expanded').each(function() { - expanded.push($(this).find('a:first').attr('id').substr(5)); + if(effects.bullets) + expanded.push($(this).find('a:eq(1)').attr('id').substr(5)); + else + expanded.push($(this).find('a:first').attr('id').substr(5)); }); document.cookie = 'dhtml_menu=' + expanded.join(',') + ';path=/'; } - diff -Naurp dhtml_menu.original/dhtml_menu.module dhtml_menu/dhtml_menu.module --- dhtml_menu.original/dhtml_menu.module 2009-06-05 02:09:25.000000000 +0200 +++ dhtml_menu/dhtml_menu.module 2010-04-08 10:42:13.000000000 +0200 @@ -11,7 +11,7 @@ * Effects enabled by default. This is an array and * must be unserialized to be used. Constants can not contain arrays. */ -define('DHTML_MENU_DEFAULT', serialize(array('slide' => 'slide', 'clone' => 'clone'))); +define('DHTML_MENU_DEFAULT', serialize(array('slide' => 'slide', 'clone' => 'clone', 'bullets' => 'bullets'))); /** * Implementation of hook_init(). @@ -121,6 +121,11 @@ function dhtml_menu_theme_menu_item($lin if (!$menu) $has_children = FALSE; // Sanitize tree. If we found no children, the item has none. } + // Add extra CSS class to menu items with children + if($has_children) { + $extra_class .= ' branch '; + } + // If the current item can expand, and is neither saved as open nor in the active trail, close it. if ($menu && !($in_active_trail || in_array(substr($item['options']['attributes']['id'], 5), $cookie))) { $extra_class .= ' collapsed start-collapsed ';