@@ -67,7 +67,7 @@ export class Panel {
6767 this . searchButton = span ;
6868 }
6969
70- addPlayPauseButton ( pInitialStatus ) {
70+ addPlayPauseButton ( ) {
7171 const playButton = document . createElement ( "span" ) ;
7272 playButton . innerText = Character . CH_PLAY ;
7373 playButton . classList . add ( "small-button" ) ;
@@ -102,7 +102,7 @@ export class Panel {
102102 pClickEvent . stopPropagation ( ) ;
103103 } ) ;
104104
105- this . setPlayPauseButton ( pInitialStatus ) ;
105+ this . setPlayPauseButton ( "none" ) ;
106106 }
107107
108108 setPlayPauseButton ( pStatus ) {
@@ -113,6 +113,7 @@ export class Panel {
113113 if ( this . pauseButton ) {
114114 this . pauseButton . style . display = pStatus === "play" ? "" : "none" ;
115115 }
116+ this . _updateMsg ( ) ;
116117 }
117118
118119 addHelpButton ( pHelpTextArr , pUrl ) {
@@ -238,19 +239,52 @@ export class Panel {
238239 }
239240
240241 addMsg ( ) {
241- const msg = document . createElement ( "div" ) ;
242- msg . id = this . key + "-msg" ;
243- msg . classList . add ( "msg" ) ;
244- msg . innerText = "(loading)" ;
245- this . div . appendChild ( msg ) ;
246- this . msg = msg ;
242+ const msgDiv = document . createElement ( "div" ) ;
243+ msgDiv . id = this . key + "-msg" ;
244+ msgDiv . classList . add ( "msg" ) ;
245+ this . div . appendChild ( msgDiv ) ;
246+ this . msgDiv = msgDiv ;
247+ this . setMsg ( "(loading)" ) ;
247248 }
248249
249- setMsg ( pText , isHTML = false ) {
250+ setMsg ( pText ) {
251+ this . msgTxt = pText ;
252+ this . _updateMsg ( ) ;
253+ }
254+
255+ _updateMsg ( ) {
256+ if ( ! this . msgDiv ) {
257+ // the div is not created yet
258+ return ;
259+ }
260+
261+ let txt = this . msgTxt ;
262+ let isHTML = false ;
263+
264+ if ( this . playOrPause === "pause" && this . pauseButton ) {
265+ if ( txt ) {
266+ txt += ", " ;
267+ }
268+ if ( this . table && this . table . tBodies [ 0 ] . rows . length ) {
269+ txt += "press " + Character . buttonInText ( Character . CH_PLAY ) + " to continue" ;
270+ } else {
271+ txt += "press " + Character . buttonInText ( Character . CH_PLAY ) + " to begin" ;
272+ }
273+ isHTML = true ;
274+ }
275+
276+ if ( this . playOrPause === "play" && this . playButton ) {
277+ if ( txt ) {
278+ txt += ", " ;
279+ }
280+ txt += "press " + Character . buttonInText ( Character . CH_PAUSE ) + " to pause" ;
281+ isHTML = true ;
282+ }
283+
250284 if ( isHTML ) {
251- this . msg . innerHTML = pText ;
285+ this . msgDiv . innerHTML = txt ;
252286 } else {
253- this . msg . innerText = pText ;
287+ this . msgDiv . innerText = txt ;
254288 }
255289 }
256290
@@ -315,8 +349,8 @@ export class Panel {
315349 this . table . tFoot . appendChild ( tr ) ;
316350
317351 // hide the "(loading)" message
318- if ( this . msg !== null ) {
319- this . msg . style . display = "none" ;
352+ if ( this . msgDiv ) {
353+ this . msgDiv . style . display = "none" ;
320354 }
321355
322356 return true ;
@@ -725,8 +759,8 @@ export class Panel {
725759 if ( this . table ) {
726760 this . clearTable ( ) ;
727761 }
728- if ( this . msg ) {
729- this . msg . innerText = "(loading)" ;
762+ if ( this . msgDiv ) {
763+ this . setMsg ( "(loading)" ) ;
730764 }
731765 if ( this . timeField ) {
732766 this . timeField . innerHTML = " " ;
0 commit comments