File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', () => {
3434 var arr = current_location . split ( "/" )
3535 var regx = / \/ v [ 0 - 9 \. ] + /
3636 if ( regx . test ( current_location ) ) {
37- window . location = window . location . href . replace ( regx , `${ target_version } ` )
37+ window . location = window . location . href . replace ( regx , `/ ${ target_version } ` )
3838 } else {
3939 window . location = `/${ target_version } ${ current_location } `
4040 }
@@ -63,11 +63,13 @@ document.addEventListener('DOMContentLoaded', () => {
6363
6464 // Table of contents
6565 const $tocController = document . getElementById ( "toc" ) ;
66- $tocController . addEventListener ( 'click' , ( ) => {
67- $tocController . classList . toggle ( 'is-active' ) ;
68- const target = $tocController . dataset . target ;
69- const $target = document . getElementById ( target ) ;
70- $target . classList . toggle ( 'is-hidden-touch' ) ;
71- } )
66+ if ( $tocController ) {
67+ $tocController . addEventListener ( 'click' , ( ) => {
68+ $tocController . classList . toggle ( 'is-active' ) ;
69+ const target = $tocController . dataset . target ;
70+ const $target = document . getElementById ( target ) ;
71+ $target . classList . toggle ( 'is-hidden-touch' ) ;
72+ } )
73+ }
7274
7375} ) ;
You can’t perform that action at this time.
0 commit comments