File tree Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ const loadCopyButton = () => {
2121            codeEl . querySelectorAll ( '.go, .gp, .gt' ) . forEach ( el  =>  el . hidden  =  true ) 
2222            codeEl . querySelectorAll ( '.gt' ) . forEach ( el  =>  { 
2323                while  ( ( el  =  el . nextSibling )  &&  el . nodeType  !==  Node . DOCUMENT_NODE )  { 
24-                     if  ( el . nodeType  ===  Node . ELEMENT_NODE  &&  el . matches ( ".gp, .go" ) )  break 
24+                     if  ( el . nodeType  ===  Node . ELEMENT_NODE  &&  el . matches ( ".gp, .go" ) )  { 
25+                         break 
26+                     } 
2527                    if  ( el . nodeType  ===  Node . TEXT_NODE  &&  el . textContent . trim ( ) )  { 
2628                        const  wrapper  =  document . createElement ( 'span' ) 
2729                        el . after ( wrapper ) 
@@ -55,9 +57,14 @@ const loadCopyButton = () => {
5557        // if we find a console prompt (.gp), prepend the (deeply cloned) button 
5658        const  clonedButton  =  button . cloneNode ( true ) 
5759        clonedButton . onclick  =  buttonClick   // onclick isn't cloned :( 
58-         if  ( el . querySelector ( ".gp" )  !==  null )  el . prepend ( clonedButton ) 
60+         if  ( el . querySelector ( ".gp" )  !==  null )  { 
61+             el . prepend ( clonedButton ) 
62+         } 
5963    } ) 
6064} 
6165
62- if  ( document . readyState  !==  "loading" )  loadCopyButton ( ) 
63- else  document . addEventListener ( "DOMContentLoaded" ,  loadCopyButton ) 
66+ if  ( document . readyState  !==  "loading" )  { 
67+     loadCopyButton ( ) 
68+ }  else  { 
69+     document . addEventListener ( "DOMContentLoaded" ,  loadCopyButton ) 
70+ } 
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ document.addEventListener('DOMContentLoaded', function () {
3131    // Close menu when link on the sideMenu is clicked 
3232    sideMenu . addEventListener ( 'click' ,  function  ( event )  { 
3333        let  target  =  event . target 
34-         if  ( target . tagName . toLowerCase ( )  !==  'a' )  return 
34+         if  ( target . tagName . toLowerCase ( )  !==  'a' )  { 
35+             return 
36+         } 
3537        closeMenu ( ) 
3638    } ) 
3739    // Add accessibility data when sideMenu is opened/closed 
Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ const initialiseSidebar = () => {
3434  const  sidebarArrow  =  sidebarButton . querySelector ( 'span' ) 
3535
3636  // for some reason, the document has no sidebar do not run into errors 
37-   if  ( typeof  sidebar  ===  "undefined" )  return 
37+   if  ( typeof  sidebar  ===  "undefined" )  { 
38+     return 
39+   } 
3840
3941  const  flipArrow  =  element  =>  element . innerText  =  ( element . innerText  ===  "»" )  ? "«"  : "»" 
4042
@@ -60,11 +62,21 @@ const initialiseSidebar = () => {
6062    ( sidebarWrapper . style . display  ===  "none" )  ? expand_sidebar ( )  : collapse_sidebar ( ) 
6163  } ) 
6264
63-   if  ( ! window . localStorage . getItem ( "sidebar" ) )  return 
65+   if  ( ! window . localStorage . getItem ( "sidebar" ) )  { 
66+     return 
67+   } 
6468  const  value  =  window . localStorage . getItem ( "sidebar" ) 
65-   if  ( value  ===  "collapsed" )  collapse_sidebar ( ) 
66-   else  if  ( value  ===  "expanded" )  expand_sidebar ( ) 
69+   if  ( value  ===  "collapsed" )  { 
70+     collapse_sidebar ( ) 
71+   } 
72+   else  if  ( value  ===  "expanded" )  { 
73+     expand_sidebar ( ) 
74+   } 
6775} 
6876
69- if  ( document . readyState  !==  "loading" )  initialiseSidebar ( ) 
70- else  document . addEventListener ( "DOMContentLoaded" ,  initialiseSidebar ) 
77+ if  ( document . readyState  !==  "loading" )  { 
78+   initialiseSidebar ( ) 
79+ } 
80+ else  { 
81+   document . addEventListener ( "DOMContentLoaded" ,  initialiseSidebar ) 
82+ } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments