SamsungTVController/htdocs/index.html

222 lines
8.7 KiB
HTML
Raw Normal View History

2022-12-21 20:23:42 -05:00
<!DOCTYPE html>
<html>
<!--Hello! You have found my TV Controller. The API provided in this source is behind a firewall and will be of no use to you. Move along!-->
2022-12-21 20:23:42 -05:00
<head></head>
2022-12-21 20:32:54 -05:00
<title>Samsung TVController</title>
2022-12-21 20:30:06 -05:00
2022-12-22 00:03:10 -05:00
<style>
body {
background-color: #101010;
color: #ffffff;
}
h1 {
color: #ffffff;
}
nav a {
color: #ffffff;
}
footer {
color: #ffffff;
}
</style>
<script>
let rootURL = "https://grwh.work:3031"
2022-12-22 01:15:51 -05:00
var timer;
// Youtube Shorts Timer -
function startTimer() {
console.log("Shorts timer started!")
alert("Auto Scroll Shorts Timer Started!");
timer = setInterval(function () {
console.log("60 seconds are up, going to next short");
fetch(rootURL + "/down")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: DOWN - SENT!")
})
}, 59000);
}
function stopTimer() {
alert("Auto Scroll Shorts Timer stopped");
clearInterval(timer);
}
2022-12-22 00:03:10 -05:00
let pass = prompt("Enter the password!", "");
2022-12-22 01:18:25 -05:00
let text;
2022-12-22 00:03:10 -05:00
fetch(rootURL + "/checkPass?pass=" + pass)
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == "1") {
if (pass == null || pass == "") {
document.getElementById("view").innerHTML = "WOO"
} else {
2022-12-22 01:15:51 -05:00
document.getElementById("view").innerHTML = "<a href=\"javascript:window.open('help.html','Click for Key ShortCuts!','width=600,height=400')\">Click for Key ShortCuts!</a><BR><BR><a href=\"javascript:window.open('input.html','Click to Send Text Imput!','width=600,height=400')\">Open Text Input</a><BR><BR><button onclick=\"startTimer()\">Enable AutoScroll</button> / <button onclick=\"stopTimer()\"> Disable</button> <BR><BR>Commands Not Working? Issue a new Token using: R";
2022-12-22 00:03:10 -05:00
function addEvent(element, eventName, callback) {
if (element.addEventListener) {
element.addEventListener(eventName, callback, false);
} else if (element.attachEvent) {
element.attachEvent("on" + eventName, callback);
} else {
element["on" + eventName] = callback;
}
}
2022-12-21 20:30:06 -05:00
2022-12-22 00:03:10 -05:00
addEvent(document, "keypress", function (e) {
console.log(e)
2022-12-21 20:30:06 -05:00
2022-12-22 00:03:10 -05:00
e = e || window.event;
2022-12-21 20:30:06 -05:00
2022-12-22 00:03:10 -05:00
if (e.key == "w" || e.code == "Numpad8") {
fetch(rootURL + "/up")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: UP - SENT!")
})
2022-12-21 20:30:06 -05:00
}
2022-12-22 00:03:10 -05:00
if (e.key == "a" || e.code == "Numpad4") {
fetch(rootURL + "/left")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: LEFT - SENT!")
})
}
if (e.key == "s" || e.key == "2") {
fetch(rootURL + "/down")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: DOWN - SENT!")
})
}
if (e.key == "d" || e.code == "Numpad6") {
fetch(rootURL + "/right")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: RIGHT - SENT!")
})
}
2022-12-22 01:15:51 -05:00
if (e.key == "Enter" || e.code == "Numpad5") {
fetch(rootURL + "/enter")
2022-12-22 00:03:10 -05:00
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: ENTER - SENT!")
})
}
if (e.key == "x" || e.code == "NumpadDecimal") {
fetch(rootURL + "/back")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: BACK - SENT!")
})
}
if (e.key == "p" || e.code == "NumpadAdd") {
fetch(rootURL + "/volumeUp")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: VOL UP - SENT!")
})
}
if (e.key == "o" || e.code == "NumpadSubtract") {
fetch(rootURL + "/volumeDown")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: VOL DOWN - SENT!")
})
}
if (e.key == "r") {
fetch(rootURL + "/newToken")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: New Token - SENT!")
})
}
if (e.key == "m" || e.code == "Numpad0") {
fetch(rootURL + "/mute")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: MUTE - SENT!")
})
}
if (e.key == "l") {
fetch(rootURL + "/pmode")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: PMODE - SENT!")
})
}
2022-12-22 01:15:51 -05:00
if (e.key == "h") {
2022-12-22 00:03:10 -05:00
fetch(rootURL + "/home")
.then(function (response) {
return response.json();
})
.then(function (data) {
if (data == 1) return console.log("Command: HOME - SENT!")
})
}
2022-12-22 01:15:51 -05:00
2022-12-22 00:03:10 -05:00
});
}
} else {
document.getElementById("view").innerHTML = "<meta http-equiv=\"refresh\" content=3;> <CENTER>THE PASSWORD PROVIDED WAS INCORRECT!"
}
})
</script>
</head>
<body>
<center>
<div id="view"></div>
<center>
</body>
2022-12-21 20:23:42 -05:00
</html>