watch.js - finish mootools replacement

This commit is contained in:
Andrew Bauer 2020-12-12 12:45:36 -06:00
parent 2f0df74c54
commit 237335c022
1 changed files with 10 additions and 10 deletions

View File

@ -648,7 +648,7 @@ function controlCmd(event) {
controlReq(data); controlReq(data);
if ( streamMode == 'single' ) { if ( streamMode == 'single' ) {
fetchImage.pass($('imageFeed').getElement('img')).delay(1000); setTimeout(fetchImage, 1000, $j('#imageFeed img'));
} }
} }
@ -662,12 +662,12 @@ function controlCmdImage( x, y ) {
controlReq(data); controlReq(data);
if ( streamMode == 'single' ) { if ( streamMode == 'single' ) {
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 ); setTimeout(fetchImage, 1000, $j('#imageFeed img'));
} }
} }
function fetchImage( streamImage ) { function fetchImage( streamImage ) {
streamImage.src = streamImage.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) )); streamImage.attr('src', streamImage.attr('src').replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) )));
} }
function handleClick( event ) { function handleClick( event ) {
@ -824,25 +824,25 @@ function initPage() {
if ( monitorType != 'WebSite' ) { if ( monitorType != 'WebSite' ) {
if ( streamMode == 'single' ) { if ( streamMode == 'single' ) {
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout ); statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2); setInterval(watchdogCheck, statusRefreshTimeout*2, 'status');
} else { } else {
streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout ); streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2); setInterval(watchdogCheck, statusRefreshTimeout*2, 'stream');
} }
if ( canStreamNative || (streamMode == 'single') ) { if ( canStreamNative || (streamMode == 'single') ) {
var streamImg = $('imageFeed').getElement('img'); var streamImg = $j('#imageFeed img');
if ( !streamImg ) { if ( !streamImg ) {
streamImg = $('imageFeed').getElement('object'); streamImg = $j('#imageFeed object');
} }
if ( !streamImg ) { if ( !streamImg ) {
console.error('No streamImg found for imageFeed'); console.error('No streamImg found for imageFeed');
} else { } else {
if ( streamMode == 'single' ) { if ( streamMode == 'single' ) {
streamImg.addEvent('click', fetchImage.pass(streamImg)); streamImg.click(streamImg, fetchImage);
fetchImage.pass(streamImg).periodical(imageRefreshTimeout); setInterval(fetchImage, imageRefreshTimeout, $j('#imageFeed img'));
} else { } else {
streamImg.addEvent('click', function(event) { streamImg.click(function(event) {
handleClick(event); handleClick(event);
}); });
} }