c5a326f3cc42beca0b59c284a2819763548c166a
max
  Wed Jul 8 05:31:13 2026 -0700
Add top-right "Share a link" and "Login" links to the menu bar, refs #10138

New js/topLinks.js drives two links at the top-right of the menu bar on all pages:

- Login: links to the login page when logged out; when logged in it shows the
username and opens an account dialog (My Sessions / My Custom Tracks /
My Track Hubs, change password, sign out).
- Share a link: on hgTracks, one click saves the current view as a session and
shows a copyable short link, with an optional "Specify name" rename step; works
logged-in or anonymously (reserved user "l"). On hgTrackUi and the hgc/hgGene
item-details popup it instead shares the page URL with the hgsid stripped and
the db argument kept.

hgSession gains two JSON endpoints (hgS_doSaveSessionJson, hgS_doRenameSessionJson)
that reuse saveCartAsSession() and addSessionLink(). The menu bar is patched in
lib/web.c (CGI pages) and hgMenubar.c (static pages) via comment placeholders in
globalNavBar.inc. On narrow/phone screens the links collapse into a menu icon with
a dropdown so they no longer overlap the menu.

diff --git src/hg/js/makefile src/hg/js/makefile
index 897098a1e8b..ff5ea01c1eb 100644
--- src/hg/js/makefile
+++ src/hg/js/makefile
@@ -1,63 +1,63 @@
 kentSrc = ../..
 include ../../inc/common.mk
 include install.mk
 
 SUBDIRS= external model react tutorials
 include subdirs.mk
 
 # UCSC js files must pass jshint
 UCSC_JS_FILES=ajax.js alleles.js assemblySearch.js autocomplete.js \
     autocompleteCat.js edwPersona.js facetedComposite.js \
     gar.js hgCustom.js hgCollection.js  hgGateway.js hgGtexTrackSettings.js \
     hgHubConnect.js hgTracks.js hgc.js hgMyData.js hgPhyloPlace.js \
     hgVai.js hui.js jsHelper.js utils.js ddcl.js subCfg.js \
     encodeProject.js encodeDataSummary.js encodeDataMatrix.js encodeChipMatrix.js encodeMatrix.js d3.dendrograms.js \
 	cdwSummaryJs.js spectrum.min.js hgSearch.js lorax.js liftRequest.js \
-	myVariantsBlocks.js
+	myVariantsBlocks.js topLinks.js
 
 # ES6 module files loaded via dynamic import() on hgc details pages
 MODULE_FILES=hgc.histogram.js
 
 # STATIC files must pass jshint
 STATIC_FILES=staticDoc.js dbDbTaxonomy.js analytics.js
 
 # JQUERY files and other third pary files which have NOT BEEN TOUCHED by UCSC
 JQUERY_FILES_UNTOUCHED= \
     d3pie.min.js \
     jquery.js jquery.imgareaselect.js jquery-ui.js jquery.contextmenu.js \
     jquery.cookie.js jquery.watermark.js jquery.watermarkinput.js jquery.ui.colorPicker.js \
     jquery.floatheader.js jquery.rotateTableCellContent.js jquery.plugins.js \
     jquery.validate.min.js jquery.history.js jquery.treetable.js mousetrap.min.js dagre-d3.js \
     igv.min.js igvFileHelper.js
 
 # JQUERY or other third pary files which HAVE BEEN MODIFIED by UCSC
 JQUERY_FILES_MODIFIED=jquery.tablednd.js ui.dropdownchecklist.js
 
 JQUERY_FILES=${JQUERY_FILES_UNTOUCHED} ${JQUERY_FILES_MODIFIED}
 
 # SYMLINKED files are include in CGIs via a version or timestamped symlink
 #           to force client side updates
 SYMLINKED_FILES=${UCSC_JS_FILES} ${JQUERY_FILES}
 
 ifdef LOWELAB
     # LOWE lab files should be forced through jshint (but currently aren't)
     SYMLINKED_FILES += lowetooltip.js loweautocomplete.js
 endif
 
 jshintTop:
 	${JSHINT} ${UCSC_JS_FILES} ${STATIC_FILES}
 
 doInstallTop: jshintTop
 	@mkdir -p ${DEST}/
 	../utils/cpAndLinkToResourceFiles.pl ${extra} -exclude='makefile' \
 			-versionFile=../inc/versionInfo.h -destDir=${DEST} ${SYMLINKED_FILES}
 	rsync -a ${STATIC_FILES} ${DEST}/
 	rsync -a ${MODULE_FILES} ${DEST}/
 
 tags:
 	ctags ${UCSC_JS_FILES} model/*/*.js
 
 clean:
 	rm -f tags
 
 doInstall: doInstallTop ${SUBDIRS:%=%.doInstall}