replace mootools in cycle.js

This commit is contained in:
Andrew Bauer 2021-01-02 16:57:23 -06:00 committed by Isaac Connor
parent b1b71e5f09
commit 0a5d6ca4ba
1 changed files with 14 additions and 12 deletions

View File

@ -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);