Skip to content

Commit d93ba10

Browse files
committed
add history.go(0)
1 parent 85736d1 commit d93ba10

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

17-movie app/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ form.addEventListener("submit", (e) => {
5353
if (searchTerm && searchTerm !== "") {
5454
getMovies(SEARCH_API + searchTerm);
5555
search.value = "";
56-
} else window.location.reload();
56+
} else history.go(0);
5757
});

46-quiz app/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ submitButton.addEventListener("click", () => {
7878
else {
7979
quiz.innerHTML = `
8080
<h2>You answered ${score}/${quizData.length} questions correctly</h2>
81-
<button onclick="location.reload()">Reload</button>
81+
<button onclick="history.go(0)">Play Again</button>
8282
`;
8383
}
8484
}

70-typing game/index.html

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ <h1 id="word"></h1>
3434
type="text"
3535
id="text"
3636
autocomplete="off"
37-
autofocus
3837
placeholder="Type the word here..."
3938
/>
4039
<p class="time-container">Time left: <span id="time">10s</span></p>

70-typing game/script.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function gameOver() {
7070
endgameElement.innerHTML = `
7171
<h1>Time ran out</h1>
7272
<p>Your final score is ${score}</p>
73-
<button onclick="location.reload()">Play Again</button>
73+
<button onclick="history.go(0)">Play Again</button>
7474
`;
7575
endgameElement.style.display = "flex";
7676
}
@@ -99,3 +99,4 @@ settingsForm.addEventListener("change", (e) => {
9999
// Init
100100
difficultySelect.value = difficulty;
101101
addWordToDom();
102+
text.focus();

70-typing game/style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ button:focus, input:focus {
6464
.settings-btn {
6565
position: absolute;
6666
bottom: 30px;
67-
right: 30px;
67+
left: 30px;
6868
}
6969

7070
.settings {

0 commit comments

Comments
 (0)