Files
JROTC/updatestatus.html
2019-04-29 12:28:38 -04:00

134 lines
5.0 KiB
HTML

<html>
<head>
<title>Update JROTC Database</title>
<script src="js/script.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.5.3/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyB0keF26uKYDOR2o-8HYkgoOGWhsPyHdkg",
authDomain: "jrotc-database.firebaseapp.com",
databaseURL: "https://jrotc-database.firebaseio.com",
projectId: "jrotc-database",
storageBucket: "jrotc-database.appspot.com",
messagingSenderId: "787128694744"
};
firebase.initializeApp(config);
</script>
<script>
function onLoad() {
readData("commanderscup", function(data) {
document.getElementById("alphacurrentpoints").innerHTML = data.Alpha
document.getElementById("bravocurrentpoints").innerHTML = data.Bravo
updatePage()
setInterval(statusView(), 30000)
});
setKeyHandle("location", eventSend);
setKeyHandle("alpha", cupSend);
setKeyHandle("bravo", cupSend);
setKeyHandle("customtime", eventSend)
var x = document.getElementById("body")
x.style.display = 'none'
}
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
var x = document.getElementById("body")
x.style.display = 'block'
document.getElementById("customtimebox").style.display = 'none'
document.getElementById("infobox").innerHTML = ""
readData("nextevent", function(array) {
document.getElementById("event").value = array["event"]
})
// ...
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
console.log(errorCode)
console.log(errorMessage)
document.getElementById('infobox').innerHTML = 'ERROR: Permission Denied. Contact the S-6 to be granted permission.<br>Check to make sure that <a href="https://www.asus.com/us/support/FAQ/1007483/">popups are enabled.</a>'
// ...
});
</script>
</head>
<body onload="javascript:onLoad()">
<br>
<div id="infobox">
Please enable popups to login to update the Nokomis JROTC Database<br> Consult <a href="https://www.asus.com/us/support/FAQ/1007483/"> this website </a>for more information on how to enable popups on chrome.
</div>
<div id="body">
<div id="write-box">
Next Battalion Event Update:<br> Event Type:
<select id="event" onchange="updatePage()">
<option value="FOR" selected>Formation</option>
<option value="UNI">Uniform Only</option>
<option value="CUS">Custom Message</option>
</select><br>
<div id="uniformbox">
Uniform Type:
<select id="uniformtype" onchange="updatePage()">
<option value="ACU" selected>ACU</option>
<option value="ASU (Class A)">ASU (Class A)</option>
<option value="Class B">ASU (No Tie / Class B)</option>
<option value="T-Shirt" >T-Shirt</option>
</select><br></div>
<div id="datebox">
Date:
<input type="date" id="date"><br></div>
<div id="timebox">
Time of Formation:
<select id="time" onchange="timeChange()">
<option value="RTI" selected>RTI</option>
<option value="Custom">Custom</option>
</select>
<br><span id="customtimebox">Custom Time Value:
<input type="text" id="customtime"></span>
</div>
<div id="locationbox">
Location (i.e Gym, etc):
<input type="text" id="location"><br></div>
<div id="messagebox">
Custom Message:
<input type="text" id="custommessage"><br></div>
<input type="button" value="Update" onclick="eventSend()">
<br>
<br> Current Message:<br>
<div id="box" style="border: 2px;border-color: black;">
Loading...
</div>
<br>
<br> Commanders Cup Points Update:<br> Alpha Companies Points (Current: <span id="alphacurrentpoints">Loading...</span>):
<input type="text" id="alpha"><br> Bravo Companies Points (Current: <span id="bravocurrentpoints">Loading...</span>):
<input type="text" id="bravo"><br>
<input type="submit" value="Update" onclick="cupSend()">
</div>
<!-- Default Statcounter code for Formation Updat
http://lax18.github.io/JROTC/updatestatus.html -->
<script type="text/javascript">
var sc_project = 11861364;
var sc_invisible = 1;
var sc_security = "18cad4fb";
</script>
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
<noscript><div class="statcounter"><a title="Web Analytics"
href="http://statcounter.com/" target="_blank"><img
class="statcounter"
src="//c.statcounter.com/11861364/0/18cad4fb/1/" alt="Web
Analytics"></a></div></noscript>
<!-- End of Statcounter Code -->
</div>
</body>
</html>