File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -477,4 +477,37 @@ function addScrollTopBehavior() {
477477 // no-op
478478 }
479479 }
480+
481+ function forceTopbarVisibleAtCurrentPosition ( ) {
482+ accum = 0 ;
483+ dirSign = 0 ;
484+ lastVisible = true ;
485+ setTopbarVisible ( true ) ;
486+ setHeaderVisible ( true ) ;
487+ lastScrollY = window . scrollY || window . pageYOffset || 0 ;
488+ }
489+
490+ document . addEventListener ( 'click' , function ( e ) {
491+ var el = e . target ;
492+ if ( ! el ) return ;
493+ if ( el . closest ) {
494+ el = el . closest ( 'a' ) ;
495+ } else if ( ! el . tagName || el . tagName . toLowerCase ( ) !== 'a' ) {
496+ return ;
497+ }
498+ if ( ! el ) return ;
499+ var href = el . getAttribute ( 'href' ) || '' ;
500+ if ( ! href ) return ;
501+ if ( href . charAt ( 0 ) === '#' ) {
502+ setTimeout ( forceTopbarVisibleAtCurrentPosition , 80 ) ;
503+ return ;
504+ }
505+ try {
506+ var url = new URL ( href , window . location . href ) ;
507+ if ( url . hash && url . pathname === window . location . pathname && url . origin === window . location . origin ) {
508+ setTimeout ( forceTopbarVisibleAtCurrentPosition , 80 ) ;
509+ }
510+ } catch ( err ) {
511+ }
512+ } , true ) ;
480513}
You can’t perform that action at this time.
0 commit comments