Skip to content

Commit

Permalink
Added results page
Browse files Browse the repository at this point in the history
  • Loading branch information
bychen9 committed Aug 7, 2019
1 parent a9c4976 commit 3b44d34
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
11 changes: 11 additions & 0 deletions results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<title>Results</title>
<head>
<h2>Your Vocal Range Results</h2>
<body>
</body>
<script src="results.js"></script>
</html>
7 changes: 7 additions & 0 deletions results.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let lowNote = localStorage.getItem('lowNote');
let highNote = localStorage.getItem('highNote');
let body = document.querySelector("body");
let text = document.createElement("p");
let node = document.createTextNode(lowNote + " to " + highNote);
text.append(node);
body.append(text);
15 changes: 13 additions & 2 deletions scales.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ if (fileName[0] == "second-step.html") {

let i = 1;

let octaveNumber = base.charAt(1);
let octaveNumber = base.charAt(1);
let note;
function nextNote() {
let note;
if (fileName[0] == "second-step.html") {
note = upNotes[(baseIndex + i) % 7];
if (note === "A") {
Expand Down Expand Up @@ -52,3 +52,14 @@ pass.onclick = function() {
}
nextNote();
}

let fail = document.getElementById("fail");
fail.onclick = function() {
if (fileName[0] === "second-step.html") {
localStorage.setItem('highNote', note + octaveNumber);
location.href = "third-step.html";
} else {
localStorage.setItem('lowNote', note + octaveNumber);
location.href = "results.html";
}
}
2 changes: 1 addition & 1 deletion second-step.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2>Second Step: Sing Higher</h2>
<body>
<p>Sing from your base note to the top of your vocal range.</p>
<button id="pass">Pass</button>
<button id="next" onclick = "location.href = 'third-step.html'">Next Step</button>
<button id="fail">Fail</button>
</body>
<script src="scales.js"></script>
</html>
1 change: 1 addition & 0 deletions third-step.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h2>Third Step: Sing Lower</h2>
<body>
<p>Sing from your base note to the bottom of your vocal range.</p>
<button id="pass">Pass</button>
<button id="fail">Fail</button>
</body>
<script src="scales.js"></script>
</html>

0 comments on commit 3b44d34

Please sign in to comment.