function profileMenuPatch() {
      var user_dropdown = $('#user_info_dropdown').next('ul'),
          impersonate_item;

      function addUnimpersonateItem() {
        impersonate_item.parent().after('<li><a href="snd_ui16dp_unimpersonate.do"' +
          ' target="gsft_main">Unimpersonate</a>');
        jslog('snd_ui16_developer_patch user menu patch applied.');
      }

      // will only add unimpersonate link if impersonate link is found
      impersonate_item = user_dropdown.find('[sn-modal-show="impersonate"]');

      if (impersonate_item) {
        if (config.profile_menu.check_impersonation) {
          $.ajax({
            url: '/snd_ui16dp.do?action=getImpersonationDetails',
            type: 'GET',
            dataType: 'JSON'
          }).done(function (data) {
            if (data.result && data.result.is_impersonating) {
              addUnimpersonateItem();
            } else {
              jslog('snd_ui16_developer_patch confirmed user is not impersonating.');
            }
          }).fail(function () {
            jslog('snd_ui16_developer_patch failed to check impersonation details.');
          });
        } else {
          addUnimpersonateItem();
        }
      }

      // add link to user preferences if admin
      if (config.profile_menu.link_preferences && userHasRole()) {
        user_dropdown.children().first()
            .after('<li><a href="/sys_user_preference_list.do?sysparm_query=user=' + top.NOW.user.userID + '" ' +
                   'target="gsft_main">Preferences</a></li>');
      }
    }
/**
     * Patch the user profile menu by adding more items to it, most importantly
     * the ability to unimpersonate.
     *
     * @return {undefined}
     */
Patch the user profile menu by adding more items to it, most importantly
the ability to unimpersonate.

@return {undefined}
Patch the user profile menu by adding more items to it most importantly the ability to unimpersonate . @return { undefined }
function profileMenuPatch() {
      var user_dropdown = $('#user_info_dropdown').next('ul'),
          impersonate_item;
      function addUnimpersonateItem() {
        impersonate_item.parent().after('<li><a href="snd_ui16dp_unimpersonate.do"' +
          ' target="gsft_main">Unimpersonate</a>');
        jslog('snd_ui16_developer_patch user menu patch applied.');
      }
      impersonate_item = user_dropdown.find('[sn-modal-show="impersonate"]');
      if (impersonate_item) {
        if (config.profile_menu.check_impersonation) {
          $.ajax({
            url: '/snd_ui16dp.do?action=getImpersonationDetails',
            type: 'GET',
            dataType: 'JSON'
          }).done(function (data) {
            if (data.result && data.result.is_impersonating) {
              addUnimpersonateItem();
            } else {
              jslog('snd_ui16_developer_patch confirmed user is not impersonating.');
            }
          }).fail(function () {
            jslog('snd_ui16_developer_patch failed to check impersonation details.');
          });
        } else {
          addUnimpersonateItem();
        }
      }
      if (config.profile_menu.link_preferences && userHasRole()) {
        user_dropdown.children().first()
            .after('<li><a href="/sys_user_preference_list.do?sysparm_query=user=' + top.NOW.user.userID + '" ' +
                   'target="gsft_main">Preferences</a></li>');
      }
    }
function profileMenuPatch ( ) { var user_dropdown = $ ( '#user_info_dropdown' ) . next ( 'ul' ) , impersonate_item ; function addUnimpersonateItem ( ) { impersonate_item . parent ( ) . after ( '<li><a href="snd_ui16dp_unimpersonate.do"' + ' target="gsft_main">Unimpersonate</a>' ) ; jslog ( 'snd_ui16_developer_patch user menu patch applied.' ) ; } impersonate_item = user_dropdown . find ( '[sn-modal-show="impersonate"]' ) ; if ( impersonate_item ) { if ( config . profile_menu . check_impersonation ) { $ . ajax ( { url : '/snd_ui16dp.do?action=getImpersonationDetails' , type : 'GET' , dataType : 'JSON' } ) . done ( function ( data ) { if ( data . result && data . result . is_impersonating ) { addUnimpersonateItem ( ) ; } else { jslog ( 'snd_ui16_developer_patch confirmed user is not impersonating.' ) ; } } ) . fail ( function ( ) { jslog ( 'snd_ui16_developer_patch failed to check impersonation details.' ) ; } ) ; } else { addUnimpersonateItem ( ) ; } } if ( config . profile_menu . link_preferences && userHasRole ( ) ) { user_dropdown . children ( ) . first ( ) . after ( '<li><a href="/sys_user_preference_list.do?sysparm_query=user=' + top . NOW . user . userID + '" ' + 'target="gsft_main">Preferences</a></li>' ) ; } }
Patch the user profile menu by adding more items to it, most importantly
 the ability to unimpersonate.
Patch the user profile menu by adding more items to it most importantly the ability to unimpersonate .
// will only add unimpersonate link if impersonate link is found // add link to user preferences if admin