replace mootools in cycle.js

This commit is contained in:
Andrew Bauer 2021-01-02 16:57:23 -06:00
parent c166b0de0f
commit 1ab181ec54
1 changed files with 14 additions and 12 deletions

View File

@ -1,4 +1,6 @@
var periodical_id; var periodical_id;
var pauseBtn = $j('#pauseBtn');
var playBtn = $j('#playBtn');
function nextCycleView() { function nextCycleView() {
window.location.replace('?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout); window.location.replace('?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout);
@ -6,14 +8,14 @@ function nextCycleView() {
function cyclePause() { function cyclePause() {
$clear(periodical_id); $clear(periodical_id);
$('pauseBtn').disabled = true; pauseBtn.prop('disabled', true);
$('playBtn').disabled = false; playBtn.prop('disabled', false);
} }
function cycleStart() { function cycleStart() {
periodical_id = nextCycleView.periodical(cycleRefreshTimeout); periodical_id = nextCycleView.periodical(cycleRefreshTimeout);
$('pauseBtn').disabled = false; pauseBtn.prop('disabled', false);
$('playBtn').disabled = true; playBtn.prop('disabled', true);
} }
function cycleNext() { function cycleNext() {
@ -45,8 +47,8 @@ function initCycle() {
} }
function changeSize() { function changeSize() {
var width = $('width').get('value'); var width = $j('#width').val();
var height = $('height').get('value'); var height = $j('#height').val();
// Scale the frame // Scale the frame
monitor_frame = $j('#imageFeed'); monitor_frame = $j('#imageFeed');
@ -62,7 +64,7 @@ function changeSize() {
} }
/* Stream could be an applet so can't use moo tools */ /* 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 ) {
if ( streamImg.nodeName == 'IMG' ) { if ( streamImg.nodeName == 'IMG' ) {
var src = streamImg.src; var src = streamImg.src;
@ -78,16 +80,16 @@ function changeSize() {
} else { } else {
console.log('Did not find liveStream'+monitorData[monIdx].id); 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('zmCycleScale', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', width, {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleWidth', width, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', height, {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleHeight', height, {duration: 10*365, samesite: 'strict'});
} // end function changeSize() } // end function changeSize()
function changeScale() { function changeScale() {
var scale = $('scale').get('value'); var scale = $j('#scale').val();
$('width').set('value', 'auto'); $j('#width').val('auto');
$('height').set('value', 'auto'); $j('#height').val('auto');
Cookie.write('zmCycleScale', scale, {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleScale', scale, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', 'auto', {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleWidth', 'auto', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', 'auto', {duration: 10*365, samesite: 'strict'}); Cookie.write('zmCycleHeight', 'auto', {duration: 10*365, samesite: 'strict'});
@ -153,4 +155,4 @@ function changeScale() {
} }
} // end function changeScale() } // end function changeScale()
window.addEventListener('DOMContentLoaded', initCycle); $j(document).ready(initCycle);