Adding a shorter autoscroll to take into account request times.

This commit is contained in:
raven 2022-12-22 02:58:58 -05:00
parent 4f3adbf261
commit b927a86410

View File

@ -37,23 +37,23 @@
// Youtube Shorts Timer - // Youtube Shorts Timer -
function startTimer() { function startTimer() {
console.log("Shorts timer started!") console.log("Shorts timer started!")
showSuccessAlert("Started Shorts 60 Second Timer") showSuccessAlert("Started Shorts Timer")
timer = setInterval(function () { timer = setInterval(function () {
console.log("60 seconds are up, going to next short"); console.log("Time is up, going to next short");
fetch(rootURL + "/down") fetch(rootURL + "/down")
.then(function (response) { .then(function (response) {
return response.json(); return response.json();
}) }).then(function (data) {
.then(function (data) { console.log("Resonse from AutoScroll Request: " + data)
if (data == 1) { if (data == 1) {
showSuccessAlert("Next Short Requested Successfully!") showSuccessAlert("Next Short Requested Successfully!")
return console.log("Command: Next Short - SENT!") console.log("Command: Next Short - SENT!")
} else { } else {
showSuccessAlert("Next Short Request FAILED!") showSuccessAlert("Next Short Request FAILED!")
return console.log("Command: Next Short FAILED!") console.log("Command: Next Short FAILED!")
} }
}) })
}, 60000); }, 54000);
} }
function stopTimer() { function stopTimer() {
@ -65,7 +65,6 @@
document.getElementById("view2").innerHTML = "<div class=\"alert alert-success\" role=\"alert\"><CENTER>" + message + "</CENTER></div>"; document.getElementById("view2").innerHTML = "<div class=\"alert alert-success\" role=\"alert\"><CENTER>" + message + "</CENTER></div>";
setInterval(function () { setInterval(function () {
console.log("60 seconds are up, going to next short");
document.getElementById("view2").innerHTML = ""; document.getElementById("view2").innerHTML = "";
}, 15000); }, 15000);
@ -78,7 +77,7 @@
console.log("60 seconds are up, going to next short"); console.log("60 seconds are up, going to next short");
document.getElementById("view2").innerHTML = ""; document.getElementById("view2").innerHTML = "";
}, 10000); }, 15000);
} }
@ -113,8 +112,6 @@
} }
addEvent(document, "keypress", function (e) { addEvent(document, "keypress", function (e) {
console.log(e)
e = e || window.event; e = e || window.event;
if (e.key == "w" || e.code == "Numpad8") { if (e.key == "w" || e.code == "Numpad8") {