gracefully handle non-existence of imageFeed

This commit is contained in:
Isaac Connor 2018-09-20 09:07:28 -04:00
parent c6e953c4a9
commit 6181e52c47
1 changed files with 10 additions and 5 deletions

View File

@ -239,7 +239,7 @@ function getCmdResponse( respObj, respText ) {
if ( streamStatus.auth ) { if ( streamStatus.auth ) {
// Try to reload the image stream. // Try to reload the image stream.
var streamImg = document.getElementById('evtStream'); var streamImg = $j('#evtStream');
if ( streamImg ) if ( streamImg )
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth ); streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
} // end if haev a new auth hash } // end if haev a new auth hash
@ -992,12 +992,17 @@ function initPage() {
progressBarNav (); progressBarNav ();
streamCmdTimer = streamQuery.delay( 250 ); streamCmdTimer = streamQuery.delay( 250 );
if ( canStreamNative ) { if ( canStreamNative ) {
var streamImg = $('imageFeed').getElement('img'); var imageFeed = $('imageFeed');
if ( !imageFeed ) {
console.log('No element with id tag imageFeed found.');
} else {
var streamImg = imageFeed.getElement('img');
if ( !streamImg ) if ( !streamImg )
streamImg = $('imageFeed').getElement('object'); streamImg = imageFeed.getElement('object');
$(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } ); $(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } );
} }
} }
}
nearEventsQuery(eventData.Id); nearEventsQuery(eventData.Id);
initialAlarmCues(eventData.Id); //call ajax+renderAlarmCues initialAlarmCues(eventData.Id); //call ajax+renderAlarmCues
if (scale == "auto") changeScale(); if (scale == "auto") changeScale();