@@ -441,16 +441,16 @@ function playground_text(playground, hidden = true) {
441
441
} ) ( ) ;
442
442
443
443
( function sidebar ( ) {
444
- var html = document . querySelector ( "html " ) ;
444
+ var body = document . querySelector ( "body " ) ;
445
445
var sidebar = document . getElementById ( "sidebar" ) ;
446
446
var sidebarLinks = document . querySelectorAll ( '#sidebar a' ) ;
447
447
var sidebarToggleButton = document . getElementById ( "sidebar-toggle" ) ;
448
448
var sidebarResizeHandle = document . getElementById ( "sidebar-resize-handle" ) ;
449
449
var firstContact = null ;
450
450
451
451
function showSidebar ( ) {
452
- html . classList . remove ( 'sidebar-hidden' )
453
- html . classList . add ( 'sidebar-visible' ) ;
452
+ body . classList . remove ( 'sidebar-hidden' )
453
+ body . classList . add ( 'sidebar-visible' ) ;
454
454
Array . from ( sidebarLinks ) . forEach ( function ( link ) {
455
455
link . setAttribute ( 'tabIndex' , 0 ) ;
456
456
} ) ;
@@ -471,8 +471,8 @@ function playground_text(playground, hidden = true) {
471
471
} ) ;
472
472
473
473
function hideSidebar ( ) {
474
- html . classList . remove ( 'sidebar-visible' )
475
- html . classList . add ( 'sidebar-hidden' ) ;
474
+ body . classList . remove ( 'sidebar-visible' )
475
+ body . classList . add ( 'sidebar-hidden' ) ;
476
476
Array . from ( sidebarLinks ) . forEach ( function ( link ) {
477
477
link . setAttribute ( 'tabIndex' , - 1 ) ;
478
478
} ) ;
@@ -483,14 +483,14 @@ function playground_text(playground, hidden = true) {
483
483
484
484
// Toggle sidebar
485
485
sidebarToggleButton . addEventListener ( 'click' , function sidebarToggle ( ) {
486
- if ( html . classList . contains ( "sidebar-hidden" ) ) {
486
+ if ( body . classList . contains ( "sidebar-hidden" ) ) {
487
487
var current_width = parseInt (
488
488
document . documentElement . style . getPropertyValue ( '--sidebar-width' ) , 10 ) ;
489
489
if ( current_width < 150 ) {
490
490
document . documentElement . style . setProperty ( '--sidebar-width' , '150px' ) ;
491
491
}
492
492
showSidebar ( ) ;
493
- } else if ( html . classList . contains ( "sidebar-visible" ) ) {
493
+ } else if ( body . classList . contains ( "sidebar-visible" ) ) {
494
494
hideSidebar ( ) ;
495
495
} else {
496
496
if ( getComputedStyle ( sidebar ) [ 'transform' ] === 'none' ) {
@@ -506,14 +506,14 @@ function playground_text(playground, hidden = true) {
506
506
function initResize ( e ) {
507
507
window . addEventListener ( 'mousemove' , resize , false ) ;
508
508
window . addEventListener ( 'mouseup' , stopResize , false ) ;
509
- html . classList . add ( 'sidebar-resizing' ) ;
509
+ body . classList . add ( 'sidebar-resizing' ) ;
510
510
}
511
511
function resize ( e ) {
512
512
var pos = ( e . clientX - sidebar . offsetLeft ) ;
513
513
if ( pos < 20 ) {
514
514
hideSidebar ( ) ;
515
515
} else {
516
- if ( html . classList . contains ( "sidebar-hidden" ) ) {
516
+ if ( body . classList . contains ( "sidebar-hidden" ) ) {
517
517
showSidebar ( ) ;
518
518
}
519
519
pos = Math . min ( pos , window . innerWidth - 100 ) ;
@@ -522,7 +522,7 @@ function playground_text(playground, hidden = true) {
522
522
}
523
523
//on mouseup remove windows functions mousemove & mouseup
524
524
function stopResize ( e ) {
525
- html . classList . remove ( 'sidebar-resizing' ) ;
525
+ body . classList . remove ( 'sidebar-resizing' ) ;
526
526
window . removeEventListener ( 'mousemove' , resize , false ) ;
527
527
window . removeEventListener ( 'mouseup' , stopResize , false ) ;
528
528
}
0 commit comments