template/copy/script/navigation/enhancednav.js
function hideNavContextMenu(event)
   {
      var contextMenuButton = $('#context-menu');
      var popupmenu = $('#contextpopup .mdl-menu__container');

      // If an event is defined then make sure it isn't targeting the context menu.
      if (event)
      {
         // Picked element is not the menu
         if (!$(event.target).parents('#contextpopup').length > 0)
         {
            // Hide menu if currently visible
            if (popupmenu.hasClass('is-visible')) { contextMenuButton.click(); }
         }
      }
      else // No event defined so always close context menu and remove node highlighting.
      {
         // Hide menu if currently visible
         if (popupmenu.hasClass('is-visible')) { contextMenuButton.click(); }
      }
   }
function hideNavContextMenu(event)
   {
      var contextMenuButton = $('#context-menu');
      var popupmenu = $('#contextpopup .mdl-menu__container');

      // If an event is defined then make sure it isn't targeting the context menu.
      if (event)
      {
         // Picked element is not the menu
         if (!$(event.target).parents('#contextpopup').length > 0)
         {
            // Hide menu if currently visible
            if (popupmenu.hasClass('is-visible')) { contextMenuButton.click(); }
         }
      }
      else // No event defined so always close context menu and remove node highlighting.
      {
         // Hide menu if currently visible
         if (popupmenu.hasClass('is-visible')) { contextMenuButton.click(); }
      }
   }
function hideNavContextMenu ( event ) { var contextMenuButton = $ ( '#context-menu' ) ; var popupmenu = $ ( '#contextpopup .mdl-menu__container' ) ; // If an event is defined then make sure it isn't targeting the context menu. if ( event ) { // Picked element is not the menu if ( ! $ ( event . target ) . parents ( '#contextpopup' ) . length > 0 ) { // Hide menu if currently visible if ( popupmenu . hasClass ( 'is-visible' ) ) { contextMenuButton . click ( ) ; } } } else // No event defined so always close context menu and remove node highlighting. { // Hide menu if currently visible if ( popupmenu . hasClass ( 'is-visible' ) ) { contextMenuButton . click ( ) ; } } }
Hides the nav context menu if visible. If an event is supplied it is checked against any existing context menu
and is ignored if the context menu is within the parent hierarchy.

@param {object|undefined}  event - Optional event
Hides the nav context menu if visible . If an event is supplied it is checked against any existing context menu and is ignored if the context menu is within the parent hierarchy .