fix cyclePrev with only 1 monitor

This commit is contained in:
Andrew Bauer 2021-01-08 13:16:16 -06:00 committed by Isaac Connor
parent 3f73c3bc9d
commit 381bf0c219
1 changed files with 5 additions and 3 deletions

View File

@ -31,11 +31,13 @@ function cycleNext() {
} }
function cyclePrev() { function cyclePrev() {
if ( monIdx ) { monIdx --;
monIdx -= 1; if ( monIdx < 0 ) {
} else {
monIdx = monitorData.length - 1; monIdx = monitorData.length - 1;
} }
if ( !monitorData[monIdx] ) {
console.log('No monitorData for ' + monIdx);
}
window.location.replace('?view=cycle&mid='+monitorData[monIdx].id+'&mode='+mode, cycleRefreshTimeout); window.location.replace('?view=cycle&mid='+monitorData[monIdx].id+'&mode='+mode, cycleRefreshTimeout);
} }