File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 315
315
var pageName = path . substr ( firstSlash ) ;
316
316
var dotLoc = pageName . lastIndexOf ( "." ) ;
317
317
if ( dotLoc == - 1 )
318
+ {
318
319
dotLoc = pageName . length ;
320
+ if ( ! pageName . endsWith ( "/" ) )
321
+ pageName += "/" ;
322
+ pageName += "index" ;
323
+ }
319
324
var currentPageID = pageName . substr ( 0 , dotLoc ) ;
320
325
321
326
var tocLists = document . getElementsByClassName ( "toc_root_list" ) ;
356
361
curItem . getAttribute ( "class" ) . startsWith ( "toc_root_list" ) )
357
362
break ;
358
363
}
364
+ // Restore scrollbar position.
365
+ window . onbeforeunload = function ( ) {
366
+ window . name = window . scrollY ;
367
+ } ;
368
+ if ( window . name . length ( ) != 0 )
369
+ {
370
+ var lastScrollPosition = parseInt ( window . name ) ;
371
+ tocColumn . scroll ( 0 , lastScrollPosition ) ;
372
+ }
373
+ // Ensure the selected item is visible.
359
374
if ( selectedItem != null )
375
+ {
360
376
selectedItem . scrollIntoView ( true ) ;
377
+ }
361
378
var subItems = selectedItem . getElementsByTagName ( "li" ) ;
362
379
var subSectionTitles = [ ] ;
363
380
var subSectionTitleStrs = [ ] ;
You can’t perform that action at this time.
0 commit comments