clearInterval when location.replacing so that timer stops. Prevents infinite loop
This commit is contained in:
parent
372e493b9c
commit
813fd36b0a
|
@ -965,6 +965,7 @@ var secondsToCycle = 0;
|
||||||
function nextCycleView() {
|
function nextCycleView() {
|
||||||
secondsToCycle --;
|
secondsToCycle --;
|
||||||
if (secondsToCycle<=0) {
|
if (secondsToCycle<=0) {
|
||||||
|
secondsToCycle = 0;
|
||||||
window.location.replace('?view=watch&mid='+nextMid+'&mode='+mode+'&cycle=true');
|
window.location.replace('?view=watch&mid='+nextMid+'&mode='+mode+'&cycle=true');
|
||||||
}
|
}
|
||||||
$j('#secondsToCycle').text(secondsToCycle);
|
$j('#secondsToCycle').text(secondsToCycle);
|
||||||
|
@ -991,6 +992,7 @@ function cycleNext() {
|
||||||
if (!monitorData[monIdx]) {
|
if (!monitorData[monIdx]) {
|
||||||
console.log('No monitorData for ' + monIdx);
|
console.log('No monitorData for ' + monIdx);
|
||||||
}
|
}
|
||||||
|
clearInterval(intervalId);
|
||||||
window.location.replace('?view=watch&cycle=true&mid='+monitorData[monIdx].id+'&mode='+mode);
|
window.location.replace('?view=watch&cycle=true&mid='+monitorData[monIdx].id+'&mode='+mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,6 +1004,7 @@ function cyclePrev() {
|
||||||
if (!monitorData[monIdx]) {
|
if (!monitorData[monIdx]) {
|
||||||
console.log('No monitorData for ' + monIdx);
|
console.log('No monitorData for ' + monIdx);
|
||||||
}
|
}
|
||||||
|
clearInterval(intervalId);
|
||||||
window.location.replace('?view=watch&cycle=true&mid='+monitorData[monIdx].id+'&mode='+mode);
|
window.location.replace('?view=watch&cycle=true&mid='+monitorData[monIdx].id+'&mode='+mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue