From 0a5d6ca4ba195917e0332e3aa520a782052f96f1 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 2 Jan 2021 16:57:23 -0600 Subject: [PATCH] replace mootools in cycle.js --- web/skins/classic/views/js/cycle.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/web/skins/classic/views/js/cycle.js b/web/skins/classic/views/js/cycle.js index de958d8d0..dd364f70b 100644 --- a/web/skins/classic/views/js/cycle.js +++ b/web/skins/classic/views/js/cycle.js @@ -1,4 +1,6 @@ var periodical_id; +var pauseBtn = $j('#pauseBtn'); +var playBtn = $j('#playBtn'); function nextCycleView() { window.location.replace('?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout); @@ -6,14 +8,14 @@ function nextCycleView() { function cyclePause() { $clear(periodical_id); - $('pauseBtn').disabled = true; - $('playBtn').disabled = false; + pauseBtn.prop('disabled', true); + playBtn.prop('disabled', false); } function cycleStart() { periodical_id = nextCycleView.periodical(cycleRefreshTimeout); - $('pauseBtn').disabled = false; - $('playBtn').disabled = true; + pauseBtn.prop('disabled', false); + playBtn.prop('disabled', true); } function cycleNext() { @@ -45,8 +47,8 @@ function initCycle() { } function changeSize() { - var width = $('width').get('value'); - var height = $('height').get('value'); + var width = $j('#width').val(); + var height = $j('#height').val(); // Scale the frame monitor_frame = $j('#imageFeed'); @@ -62,7 +64,7 @@ function changeSize() { } /* Stream could be an applet so can't use moo tools */ - var streamImg = $('liveStream'+monitorData[monIdx].id); + var streamImg = document.getElementById('liveStream'+monitorData[monIdx].id); if ( streamImg ) { if ( streamImg.nodeName == 'IMG' ) { var src = streamImg.src; @@ -78,16 +80,16 @@ function changeSize() { } else { console.log('Did not find liveStream'+monitorData[monIdx].id); } - $('scale').set('value', ''); + $j('#scale').val(''); Cookie.write('zmCycleScale', '', {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleWidth', width, {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleHeight', height, {duration: 10*365, samesite: 'strict'}); } // end function changeSize() function changeScale() { - var scale = $('scale').get('value'); - $('width').set('value', 'auto'); - $('height').set('value', 'auto'); + var scale = $j('#scale').val(); + $j('#width').val('auto'); + $j('#height').val('auto'); Cookie.write('zmCycleScale', scale, {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleWidth', 'auto', {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleHeight', 'auto', {duration: 10*365, samesite: 'strict'}); @@ -153,4 +155,4 @@ function changeScale() { } } // end function changeScale() -window.addEventListener('DOMContentLoaded', initCycle); +$j(document).ready(initCycle);