diff --git a/website/api/api.js b/website/api/api.js index 9e4fb55..f164344 100644 --- a/website/api/api.js +++ b/website/api/api.js @@ -286,7 +286,7 @@ class API { let xhr = new XMLHttpRequest(); xhr.open('GET', `${this.url}get_test/`); xhr.send(); - xhr.onload = () => { + xhr.onload = () =>{ const effectiveWidth = (windowWidth - 200) / 13; let textArr = JSON.parse(xhr.response); let finalText = []; diff --git a/website/screens/profilescreen.js b/website/screens/profilescreen.js index 046bf60..6155cad 100644 --- a/website/screens/profilescreen.js +++ b/website/screens/profilescreen.js @@ -84,8 +84,8 @@ class ProfileScreen { for (let i = user.tests.length-1-offset; i >= user.tests.length-13-offset && i >= 0; i--) { this.testButtons.push([ new Button(400, j, 100, 30, `${i+1}`, true, true , "#000", "#000", "#fff"), // test # button - new Button(500, j, 100, 30, `${user.tests[i].accuracy}`, true, true , "#000", "#000", "#fff"), // accuracy button - new Button(600, j, 100, 30, `${user.tests[i].wpm}`, true, true , "#000", "#000", "#fff"), // wpm button + new Button(500, j, 100, 30, `${user.tests[i].wpm}`, true, true , "#000", "#000", "#fff"), // accuracy button + new Button(600, j, 100, 30, `${user.tests[i].accuracy}`, true, true , "#000", "#000", "#fff"), // wpm button new Button(700, j, 240, 30, `${user.tests[i].test_length}`, true, true , "#000", "#000", "#fff") ]) j+=30; diff --git a/website/ui_elements/timer.js b/website/ui_elements/timer.js index e13a399..950be0a 100644 --- a/website/ui_elements/timer.js +++ b/website/ui_elements/timer.js @@ -45,8 +45,9 @@ class Timer { this.bar = pBar; this.startTime; this.time = pTime; - this.timeElapsed; + this.timeElapsed = 0; this.ended; + this.hasStarted = false; } getX() { @@ -153,6 +154,7 @@ class Timer { // I am using the amount of frames passed to calculate the time, assuming that the website is running at 60q frames // per second this.timeElapsed = 0; + this.hasStarted = true; } /** @@ -201,12 +203,20 @@ class Timer { // draws a bar that move across the screen to show the time left if (this.bar) { fill(user.colorScheme.timerBar); - rect(this.y, this.x, windowWidth - windowWidth * (this.timeElapsed / this.time), this.height); + if (this.hasStarted) { + rect(this.y, this.x, windowWidth - windowWidth * (this.timeElapsed / this.time), this.height); + } else { + rect(this.y, this.x, windowWidth, this.height); + } } // draws the text in the corner of the screen noStroke(); fill(user.colorScheme.timerText); - text(Math.ceil(this.time - this.timeElapsed), this.x + this.width / 6, this.y + this.height / 2) + if (this.hasStarted) { + text(Math.ceil(this.time - this.timeElapsed), this.x + this.width / 6, this.y + this.height / 2); + } else { + text("Type A Letter To Start", this.x + this.width / 6, this.y + this.height / 2); + } } } \ No newline at end of file