From 3b44d34035e3a1da4830a9c636417a51809e54b6 Mon Sep 17 00:00:00 2001 From: Brian Chen Date: Wed, 7 Aug 2019 16:07:35 -0700 Subject: [PATCH] Added results page --- results.html | 11 +++++++++++ results.js | 7 +++++++ scales.js | 15 +++++++++++++-- second-step.html | 2 +- third-step.html | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 results.html create mode 100644 results.js diff --git a/results.html b/results.html new file mode 100644 index 0000000..794f4db --- /dev/null +++ b/results.html @@ -0,0 +1,11 @@ + + + + + Results + +

Your Vocal Range Results

+ + + + diff --git a/results.js b/results.js new file mode 100644 index 0000000..5c034a0 --- /dev/null +++ b/results.js @@ -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); diff --git a/scales.js b/scales.js index 1f98d44..26fbdd0 100644 --- a/scales.js +++ b/scales.js @@ -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") { @@ -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"; + } +} diff --git a/second-step.html b/second-step.html index e96bc29..36b4650 100644 --- a/second-step.html +++ b/second-step.html @@ -8,7 +8,7 @@

Second Step: Sing Higher

Sing from your base note to the top of your vocal range.

- + diff --git a/third-step.html b/third-step.html index ecca7d4..bdc3b4c 100644 --- a/third-step.html +++ b/third-step.html @@ -8,6 +8,7 @@

Third Step: Sing Lower

Sing from your base note to the bottom of your vocal range.

+