-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirmation.html
75 lines (68 loc) · 2.7 KB
/
confirmation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<!-- saved from url=(0054)https://science-bowl.firebaseapp.com/confirmation.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://www.gstatic.com/firebasejs/3.1.0/firebase.js"></script>
<script src="init.js"></script>
<script>
var config = {
apiKey: "AIzaSyC5vrJU4FkBRmGzAYMvtqYXu3F06OC7bQM",
authDomain: "science-bowl.firebaseapp.com",
databaseURL: "https://science-bowl.firebaseio.com",
storageBucket: "science-bowl.appspot.com",
};
firebase.initializeApp(config);
</script>
<script type="text/javascript">
firebase.auth().onAuthStateChanged(function(user) {
if (!user) {
location.replace(LOGIN);
}
if(sessionStorage.subj == undefined){
location.replace(ENTRY);
}
});
function startup(){
var out = document.getElementById("quest");
var str = "Subject: "+ sessionStorage.getItem("subj")+ "-" + sessionStorage.getItem("subSubj")+ "<br>"+ "Difficulty: "
+ sessionStorage.getItem("diff")+ "<br>"+
"Question: " + sessionStorage.getItem("question") + "<br>" + "W) " + sessionStorage.getItem("inW")
+ "<br>" + "X) " + sessionStorage.getItem("inX") + "<br>" + "Y) " + sessionStorage.getItem("inY")
+ "<br>" + "Z) " + sessionStorage.getItem("inZ") + "<br>" + "Correct Answer: " + sessionStorage.getItem("correct");
out.innerHTML = str;
}
function goBack(){
location.replace("entry.html");
}
function confirm(){
var database = firebase.database();
var useRef = database.ref("tmp/"+sessionStorage.getItem("subj")+"/"+sessionStorage.getItem("subSubj")+"/"+sessionStorage.getItem("diff"));
useRef.push().set({
question: sessionStorage.getItem("question"),
w: sessionStorage.getItem("inW"),
x: sessionStorage.getItem("inX"),
y: sessionStorage.getItem("inY"),
z: sessionStorage.getItem("inZ"),
correct: sessionStorage.getItem("correct"),
email: firebase.auth().currentUser.email
} ,function(error){
console.log(error);
if(error){
alert("Oops, data could not be saved.");
return;
}else{
alert("Saved!");
sessionStorage.clear();
location.replace("entry.html");
}
});
}
</script>
<title>Question Entry</title>
</head>
<body onload="javascript:startup()">
<h1>Are you sure this is what you meant to submit???</h1> <br>
<div id="quest">Sad</div>
<button onclick="confirm()">Confirm</button>
<button onclick="goBack()">No, go back</button>
</body>
</html>