@@ -134,16 +134,14 @@ class HelpWidget {
134134 cell = docById ( "right-arrow" ) ;
135135
136136 cell . onclick = ( ) => {
137+ if ( page >= HELPCONTENT . length - 1 ) {
138+ return ;
139+ }
140+
137141 page = page + 1 ;
138142 leftArrow . classList . remove ( "disabled" ) ;
139- if ( page === HELPCONTENT . length ) {
140- page = 0 ;
141- }
142- if ( page == 0 ) {
143- this . widgetWindow . updateTitle ( _ ( "Take a tour" ) ) ;
144- } else {
145- this . widgetWindow . updateTitle ( HELPCONTENT [ page ] [ 0 ] ) ;
146- }
143+
144+ this . widgetWindow . updateTitle ( HELPCONTENT [ page ] [ 0 ] ) ;
147145 this . _showPage ( page ) ;
148146 } ;
149147 } else {
@@ -326,6 +324,11 @@ class HelpWidget {
326324 helpBody . innerHTML = "" ;
327325 const totalPages = HELPCONTENT . length ;
328326 const pageCount = `${ page + 1 } /${ totalPages } ` ;
327+ const rightArrow = docById ( "right-arrow" ) ;
328+ const leftArrow = docById ( "left-arrow" ) ;
329+
330+ rightArrow . classList . toggle ( "disabled" , page === HELPCONTENT . length - 1 ) ;
331+ leftArrow . classList . toggle ( "disabled" , page === 0 ) ;
329332
330333 // Previous HTML content is removed, and new one is generated.
331334 let body = "" ;
@@ -366,18 +369,16 @@ class HelpWidget {
366369 const cell = docById ( "right-arrow" ) ;
367370 const leftArrow = docById ( "left-arrow" ) ;
368371 cell . onclick = ( ) => {
372+ if ( page >= HELPCONTENT . length - 1 ) {
373+ return ;
374+ }
375+
369376 page = page + 1 ;
370377 leftArrow . classList . remove ( "disabled" ) ;
371- if ( page === HELPCONTENT . length ) {
372- page = 0 ;
373- }
374- if ( page == 0 ) {
375- this . widgetWindow . updateTitle ( _ ( "Take a tour" ) ) ;
376- } else {
377- this . widgetWindow . updateTitle ( HELPCONTENT [ page ] [ 0 ] ) ;
378- }
379- this . _showPage ( page ) ;
380- } ;
378+
379+ this . widgetWindow . updateTitle ( HELPCONTENT [ page ] [ 0 ] ) ;
380+ this . _showPage ( page ) ;
381+ } ;
381382 if ( page === 0 ) {
382383 leftArrow . classList . add ( "disabled" ) ;
383384 }
@@ -653,4 +654,4 @@ class HelpWidget {
653654 }
654655 }
655656 }
656- }
657+ }
0 commit comments