template/copy/script/navigation/enhancednav.js
function onNavContextClick(event)
   {
      // Hides any existing nav context menu.
      hideNavContextMenu(event);

      var target = $(this);

      var packageLink = target.data('package-link');
      var packageType = target.data('package-type') || '...';

      // Create proper name for package type.
      switch (packageType)
      {
         case 'npm':
            packageType = 'NPM';
            break;
      }

      var packageVersion = target.data('package-version');

      var scmLink = target.data('scm-link');
      var scmType = target.data('scm-type') || '...';

      // Create proper name for SCM type.
      switch (scmType)
      {
         case 'github':
            scmType = 'Github';
            break;
      }

      var popupmenu = $('#contextpopup .mdl-menu__container');

      // Populate data for the context menu.
      popupmenu.find('li').each(function(index)
      {
         var liTarget = $(this);

         switch (index)
         {
            case 0:
               if (scmLink)
               {
                  liTarget.text('Open on ' + scmType);
                  liTarget.data('link', scmLink);
                  liTarget.removeClass('hidden');

                  // Add divider if there are additional non-hidden items
                  if (packageLink || packageVersion) { liTarget.addClass('mdl-menu__item--full-bleed-divider'); }
                  else { liTarget.removeClass('mdl-menu__item--full-bleed-divider'); }
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;

            case 1:
               if (packageLink)
               {
                  liTarget.text('Open on ' + packageType);
                  liTarget.data('link', packageLink);
                  liTarget.removeClass('hidden');

                  // Add divider if there are additional non-hidden items
                  if (packageVersion) { liTarget.addClass('mdl-menu__item--full-bleed-divider'); }
                  else { liTarget.removeClass('mdl-menu__item--full-bleed-divider'); }
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;

            case 2:
               if (packageVersion)
               {
                  liTarget.text('Version: ' + packageVersion);
                  liTarget.removeClass('hidden');
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;
         }
      });

      // Wrapping in a 100ms timeout allows MDL to draw animation when showing a context menu after one has been hidden.
      setTimeout(function()
      {
         // For MDL a programmatic click of the hidden context menu.
         var contextMenuButton = $("#context-menu");
         contextMenuButton.click();

         // Necessary to defer reposition of the context menu.
         setTimeout(function()
         {
            popupmenu.parent().css({ position: 'relative' });
            popupmenu.css({ left: event.pageX, top: event.pageY - $('header').outerHeight(), position:'absolute' });
         }, 0);
      }, 100);
   }
function onNavContextClick(event)
   {
      // Hides any existing nav context menu.
      hideNavContextMenu(event);

      var target = $(this);

      var packageLink = target.data('package-link');
      var packageType = target.data('package-type') || '...';

      // Create proper name for package type.
      switch (packageType)
      {
         case 'npm':
            packageType = 'NPM';
            break;
      }

      var packageVersion = target.data('package-version');

      var scmLink = target.data('scm-link');
      var scmType = target.data('scm-type') || '...';

      // Create proper name for SCM type.
      switch (scmType)
      {
         case 'github':
            scmType = 'Github';
            break;
      }

      var popupmenu = $('#contextpopup .mdl-menu__container');

      // Populate data for the context menu.
      popupmenu.find('li').each(function(index)
      {
         var liTarget = $(this);

         switch (index)
         {
            case 0:
               if (scmLink)
               {
                  liTarget.text('Open on ' + scmType);
                  liTarget.data('link', scmLink);
                  liTarget.removeClass('hidden');

                  // Add divider if there are additional non-hidden items
                  if (packageLink || packageVersion) { liTarget.addClass('mdl-menu__item--full-bleed-divider'); }
                  else { liTarget.removeClass('mdl-menu__item--full-bleed-divider'); }
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;

            case 1:
               if (packageLink)
               {
                  liTarget.text('Open on ' + packageType);
                  liTarget.data('link', packageLink);
                  liTarget.removeClass('hidden');

                  // Add divider if there are additional non-hidden items
                  if (packageVersion) { liTarget.addClass('mdl-menu__item--full-bleed-divider'); }
                  else { liTarget.removeClass('mdl-menu__item--full-bleed-divider'); }
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;

            case 2:
               if (packageVersion)
               {
                  liTarget.text('Version: ' + packageVersion);
                  liTarget.removeClass('hidden');
               }
               else
               {
                  liTarget.addClass('hidden');
               }
               break;
         }
      });

      // Wrapping in a 100ms timeout allows MDL to draw animation when showing a context menu after one has been hidden.
      setTimeout(function()
      {
         // For MDL a programmatic click of the hidden context menu.
         var contextMenuButton = $("#context-menu");
         contextMenuButton.click();

         // Necessary to defer reposition of the context menu.
         setTimeout(function()
         {
            popupmenu.parent().css({ position: 'relative' });
            popupmenu.css({ left: event.pageX, top: event.pageY - $('header').outerHeight(), position:'absolute' });
         }, 0);
      }, 100);
   }
function onNavContextClick ( event ) { // Hides any existing nav context menu. hideNavContextMenu ( event ) ; var target = $ ( this ) ; var packageLink = target . data ( 'package-link' ) ; var packageType = target . data ( 'package-type' ) || '...' ; // Create proper name for package type. switch ( packageType ) { case 'npm' : packageType = 'NPM' ; break ; } var packageVersion = target . data ( 'package-version' ) ; var scmLink = target . data ( 'scm-link' ) ; var scmType = target . data ( 'scm-type' ) || '...' ; // Create proper name for SCM type. switch ( scmType ) { case 'github' : scmType = 'Github' ; break ; } var popupmenu = $ ( '#contextpopup .mdl-menu__container' ) ; // Populate data for the context menu. popupmenu . find ( 'li' ) . each ( function ( index ) { var liTarget = $ ( this ) ; switch ( index ) { case 0 : if ( scmLink ) { liTarget . text ( 'Open on ' + scmType ) ; liTarget . data ( 'link' , scmLink ) ; liTarget . removeClass ( 'hidden' ) ; // Add divider if there are additional non-hidden items if ( packageLink || packageVersion ) { liTarget . addClass ( 'mdl-menu__item--full-bleed-divider' ) ; } else { liTarget . removeClass ( 'mdl-menu__item--full-bleed-divider' ) ; } } else { liTarget . addClass ( 'hidden' ) ; } break ; case 1 : if ( packageLink ) { liTarget . text ( 'Open on ' + packageType ) ; liTarget . data ( 'link' , packageLink ) ; liTarget . removeClass ( 'hidden' ) ; // Add divider if there are additional non-hidden items if ( packageVersion ) { liTarget . addClass ( 'mdl-menu__item--full-bleed-divider' ) ; } else { liTarget . removeClass ( 'mdl-menu__item--full-bleed-divider' ) ; } } else { liTarget . addClass ( 'hidden' ) ; } break ; case 2 : if ( packageVersion ) { liTarget . text ( 'Version: ' + packageVersion ) ; liTarget . removeClass ( 'hidden' ) ; } else { liTarget . addClass ( 'hidden' ) ; } break ; } } ) ; // Wrapping in a 100ms timeout allows MDL to draw animation when showing a context menu after one has been hidden. setTimeout ( function ( ) { // For MDL a programmatic click of the hidden context menu. var contextMenuButton = $ ( "#context-menu" ) ; contextMenuButton . click ( ) ; // Necessary to defer reposition of the context menu. setTimeout ( function ( ) { popupmenu . parent ( ) . css ( { position : 'relative' } ) ; popupmenu . css ( { left : event . pageX , top : event . pageY - $ ( 'header' ) . outerHeight ( ) , position : 'absolute' } ) ; } , 0 ) ; } , 100 ) ; }
Shows the nav context menu

@param {object}   event - jQuery mouse event
Shows the nav context menu