Adding new Contect Alerts that self dissapear using Twitter BootStrap 5

This commit is contained in:
raven 2022-12-22 02:25:16 -05:00
parent 7eaf0f2b86
commit 627b41b6bb

View File

@ -2,7 +2,9 @@
<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!--> <!--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!-->
<head></head> <head>
<div id="view2"></div>
</head>
<title>Samsung TVController</title> <title>Samsung TVController</title>
<style> <style>
@ -23,14 +25,19 @@
color: #ffffff; color: #ffffff;
} }
</style> </style>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<script> <script>
let rootURL = "https://grwh.work:3031" let rootURL = "https://grwh.work:3031"
var timer; var timer;
// Youtube Shorts Timer - // Youtube Shorts Timer -
function startTimer() { function startTimer() {
console.log("Shorts timer started!") console.log("Shorts timer started!")
alert("Auto Scroll Shorts Timer Started!"); showSuccessAlert("Started Shorts 60 Second Timer")
timer = setInterval(function () { timer = setInterval(function () {
console.log("60 seconds are up, going to next short"); console.log("60 seconds are up, going to next short");
fetch(rootURL + "/down") fetch(rootURL + "/down")
@ -40,16 +47,42 @@
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: DOWN - SENT!") if (data == 1) return console.log("Command: DOWN - SENT!")
}) })
}, 59000); }, 60000);
} }
function stopTimer() { function stopTimer() {
alert("Auto Scroll Shorts Timer stopped"); showSuccessAlert("Shorts Timer Disabled!")
clearInterval(timer); clearInterval(timer);
} }
function showSuccessAlert(message) {
document.getElementById("view2").innerHTML = "<div class=\"alert alert-success\" role=\"alert\"><CENTER>" + message + "</CENTER></div>";
setInterval(function () {
console.log("60 seconds are up, going to next short");
document.getElementById("view2").innerHTML = "";
}, 10000);
}
function showFailAlert(message) {
document.getElementById("view2").innerHTML = "<div class=\"alert alert-danger\" role=\"alert\"><CENTER>" + message + "</CENTER></div>";
setInterval(function () {
console.log("60 seconds are up, going to next short");
document.getElementById("view2").innerHTML = "";
}, 10000);
}
showSuccessAlert("You have logged in successfully!")
let pass = prompt("Enter the password!", ""); let pass = prompt("Enter the password!", "");
let text; let text;
fetch(rootURL + "/checkPass?pass=" + pass) fetch(rootURL + "/checkPass?pass=" + pass)
.then(function (response) { .then(function (response) {
return response.json(); return response.json();
@ -60,7 +93,7 @@
document.getElementById("view").innerHTML = "WOO" document.getElementById("view").innerHTML = "WOO"
} else { } else {
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"; 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')\"><button>Open Text Input</button></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";
function addEvent(element, eventName, callback) { function addEvent(element, eventName, callback) {
@ -84,7 +117,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: UP - SENT!") if (data == 1) {
showSuccessAlert("UP Sent Successfully!")
return console.log("Command: UP - SENT!")
} else {
showSuccessAlert("UP FAILED!")
return console.log("Command: UP FAILED!")
}
}) })
} }
@ -94,7 +133,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: LEFT - SENT!") if (data == 1) {
showSuccessAlert("LEFT Sent Successfully!")
return console.log("Command: LEFT - SENT!")
} else {
showSuccessAlert("LEFT FAILED!")
return console.log("Command: LEFT FAILED!")
}
}) })
} }
@ -104,7 +149,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: DOWN - SENT!") if (data == 1) {
showSuccessAlert("DOWN Sent Successfully!")
return console.log("Command: DOWN - SENT!")
} else {
showSuccessAlert("DOWN FAILED!")
return console.log("Command: DOWN FAILED!")
}
}) })
} }
@ -114,7 +165,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: RIGHT - SENT!") if (data == 1) {
showSuccessAlert("RIGHT Sent Successfully!")
return console.log("Command: RIGHT - SENT!")
} else {
showSuccessAlert("UP FAILED!")
return console.log("Command: RIGHT FAILED!")
}
}) })
} }
@ -124,7 +181,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: ENTER - SENT!") if (data == 1) {
showSuccessAlert("ENTER Sent Successfully!")
return console.log("Command: ENTER - SENT!")
} else {
showSuccessAlert("ENTER FAILED!")
return console.log("Command: ENTEr FAILED!")
}
}) })
} }
@ -134,7 +197,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: BACK - SENT!") if (data == 1) {
showSuccessAlert("BACK Sent Successfully!")
return console.log("Command: BACK - SENT!")
} else {
showSuccessAlert("BACK FAILED!")
return console.log("Command: BACK FAILED!")
}
}) })
} }
@ -144,7 +213,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: VOL UP - SENT!") if (data == 1) {
showSuccessAlert("VOLUME UP Sent Successfully!")
return console.log("Command: VOLUME UP - SENT!")
} else {
showSuccessAlert("VOLUME UP FAILED!")
return console.log("Command: VOLUME UP FAILED!")
}
}) })
} }
@ -154,7 +229,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: VOL DOWN - SENT!") if (data == 1) {
showSuccessAlert("VOLUME DOWN Sent Successfully!")
return console.log("Command: VOLUME DOWN - SENT!")
} else {
showSuccessAlert("VOLUME DOWN FAILED!")
return console.log("Command: VOLUME DOWN FAILED!")
}
}) })
} }
@ -164,7 +245,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: New Token - SENT!") if (data == 1) {
showSuccessAlert("New Token Request Sent Successfully!")
return console.log("Command: New Token Request - SENT!")
} else {
showSuccessAlert("New Token Request FAILED!")
return console.log("Command: New Token Request FAILED!")
}
}) })
} }
@ -175,7 +262,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: MUTE - SENT!") if (data == 1) {
showSuccessAlert("Mute Sent Successfully!")
return console.log("Command: BACK - SENT!")
} else {
showSuccessAlert("Mute FAILED!")
return console.log("Command: Mute FAILED!")
}
}) })
} }
@ -185,7 +278,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: PMODE - SENT!") if (data == 1) {
showSuccessAlert("Picture Mode Sent Successfully!")
return console.log("Command: Picutr Mode - SENT!")
} else {
showSuccessAlert("Picture Mode FAILED!")
return console.log("Command: Picture Mode FAILED!")
}
}) })
} }
@ -195,7 +294,13 @@
return response.json(); return response.json();
}) })
.then(function (data) { .then(function (data) {
if (data == 1) return console.log("Command: HOME - SENT!") if (data == 1) {
showSuccessAlert("HOME Sent Successfully!")
return console.log("Command: HOME - SENT!")
} else {
showSuccessAlert("HOME FAILED!")
return console.log("Command: HOME FAILED!")
}
}) })
} }
@ -214,7 +319,9 @@
<body> <body>
<center> <center>
<div id="view"></div> <div id="view"></div>
<center> <center>
</body> </body>