mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 15:04:45 +00:00
54 lines
2.1 KiB
JavaScript
54 lines
2.1 KiB
JavaScript
/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */
|
|
function openNav() {
|
|
document.getElementById("mySidenav").style.width = "250px";
|
|
document.getElementById("main").style.marginLeft = "250px";
|
|
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
|
|
}
|
|
|
|
/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */
|
|
function closeNav() {
|
|
document.getElementById("mySidenav").style.width = "0";
|
|
document.getElementById("main").style.marginLeft = "0";
|
|
document.body.style.backgroundColor = "white";
|
|
}
|
|
|
|
window.onload = function() {
|
|
var promise1 = new Promise(function(resolve, reject) {
|
|
document.getElementById('sideload').style.display = 'block';
|
|
var config = {
|
|
apiKey: "(insert the TitanScout Api Key Here)",
|
|
authDomain: "titanscoutandroid.firebaseapp.com",
|
|
databaseURL: "https://titanscoutandroid.firebaseio.com",
|
|
projectId: "titanscoutandroid",
|
|
storageBucket: "titanscoutandroid.appspot.com",
|
|
messagingSenderId: "1097635313476"
|
|
};
|
|
//eventually find a less-jank way to do this tho
|
|
firebase.initializeApp(config);
|
|
promise2 = new Promise(function(resolve,reject){
|
|
setTimeout(function(){
|
|
user = firebase.auth().currentUser
|
|
resolve(user)
|
|
},10)
|
|
});
|
|
promise2.then(function(user){
|
|
resolve(user)
|
|
})
|
|
});
|
|
promise1.then(function(user) {
|
|
if (user != null) {
|
|
if (user.displayName != null) {
|
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;
|
|
} else if (user.email != null) {
|
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
|
|
} else if (user.phoneNumber != null) {
|
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber;
|
|
} else {
|
|
document.getElementById('status').innerHTML = "You are signed in.";
|
|
}
|
|
} else {
|
|
window.location.replace('../');
|
|
}
|
|
});
|
|
}
|