@@ -113,9 +113,12 @@ $(function() {
113113
114114
115115 // separated out the clicks - this one for the left top level nav
116- $ ( '#handbook-holder' ) . on ( 'click' , '.tabs-nav nav.top-nav > a' , function ( e ) {
116+ $ ( '#handbook-holder' ) . on ( 'click' , '.tabs-nav nav.top-nav > a, .prevnextnav .prev, .prevnextnav .next ' , function ( e ) {
117117 const nav_elements = $ ( '.tabs-nav nav.top-nav > a' ) ;
118118 var id = $ ( this ) . closest ( 'nav' ) . attr ( 'internal-destination' ) ;
119+ if ( ! id ) {
120+ id = $ ( this ) . attr ( 'internal-destination' ) ;
121+ }
119122 console . log ( "ID = " + id ) ;
120123
121124 $ ( '.tabs-content .content.visible div.section-main > *:not(.chapters)' ) . show ( ) ;
@@ -222,6 +225,7 @@ $(function() {
222225 $ ( 'html body' ) . scrollTop ( $ ( '.footnote#' + $ ( this ) . attr ( 'rid' ) ) . offset ( ) . top ) ;
223226 } ) ;
224227
228+ //--------------------------------------------------------------------------------------------------------
225229 function fixFootnotes ( ) {
226230 $ ( '.footnote sup' ) . remove ( ) ;
227231 $ ( '.footnote-link' ) . each ( function ( index ) {
@@ -230,27 +234,35 @@ $(function() {
230234 }
231235
232236
237+ //--------------------------------------------------------------------------------------------------------
233238 function genPrevNextLevelN ( ) {
234239 console . log ( 'genprevnext level 1' ) ;
235240 var nextsection = $ ( '.content.visible' ) . next ( )
236241 var nextsectionid = nextsection . attr ( 'internal-destination' ) ;
237242 var nextsectiontitle = nextsection . find ( '.section-title' ) . text ( ) ;
238243 if ( ! nextsectionid ) {
239244 $ ( '.content.visible .prevnextnav .next .nexttext' ) . text ( '' ) ;
245+ $ ( '.content.visible .prevnextnav .next' ) . css ( 'visibility' , 'hidden' ) ;
240246 } else {
241247 $ ( '.content.visible .prevnextnav .next .nexttext' ) . text ( nextsectiontitle ) ;
248+ $ ( '.content.visible .prevnextnav .next' ) . attr ( 'internal-destination' , nextsectionid ) ;
249+ $ ( '.content.visible .prevnextnav .next' ) . css ( 'visibility' , 'visible' ) ;
242250 }
243251
244252 var prevsection = $ ( '.content.visible' ) . prev ( )
245253 var prevsectionid = prevsection . attr ( 'internal-destination' ) ;
246254 var prevsectiontitle = prevsection . find ( '.section-title' ) . text ( ) ;
247255 if ( ! prevsectionid ) {
248256 $ ( '.content.visible .prevnextnav .prev .prevtext' ) . text ( '' ) ;
257+ $ ( '.content.visible .prevnextnav .prev' ) . css ( 'visibility' , 'hidden' ) ;
249258 } else {
250259 $ ( '.content.visible .prevnextnav .prev .prevtext' ) . text ( prevsectiontitle ) ;
260+ $ ( '.content.visible .prevnextnav .prev' ) . attr ( 'internal-destination' , prevsectionid ) ;
261+ $ ( '.content.visible .prevnextnav .prev' ) . css ( 'visibility' , 'visible' ) ;
251262 }
252263 }
253264
265+ //--------------------------------------------------------------------------------------------------------
254266 function genPrevNextLevelNN ( ) {
255267 console . log ( 'genprevnext level 2' ) ;
256268 var nextchapter = $ ( '.chapters.visible' ) . next ( )
@@ -265,7 +277,7 @@ $(function() {
265277 } else {
266278 $ ( '.content.visible .prevnextnav .next .nexttext' ) . text ( nextchaptertitle ) ;
267279 }
268-
280+
269281 var prevchapter = $ ( '.chapters.visible' ) . prev ( )
270282 var prevchapterid = prevchapter . attr ( 'internal-destination' ) ;
271283 var prevchaptertitle = prevchapter . find ( 'h3:first' ) . text ( ) ;
@@ -279,8 +291,7 @@ $(function() {
279291 }
280292 }
281293
282-
283-
294+ //--------------------------------------------------------------------------------------------------------
284295 function donav ( ) {
285296 // search querystring for error param value
286297 var matches = window . location . search . match ( / x r e f = ( [ \w . ] + ) / ) ;
0 commit comments