Skip to content

Commit

Permalink
Merge pull request #6 from jm1021/Fun-Facts
Browse files Browse the repository at this point in the history
Added toggleable fun facts checkbox
  • Loading branch information
jm1021 authored Mar 30, 2024
2 parents 5580400 + 67c3962 commit d614efe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions assets/js/platformer3x/SettingsControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,27 @@ export class SettingsControl extends LocalStorage{
var invertControl = settingsControl.isInvertedInput;
document.getElementById("sidebar").append(invertControl);

var hintsSection = document.createElement("div")
hintsSection.innerHTML = "Toggle fun facts: "

var hintsButton = document.createElement("input")
hintsButton.type = "checkbox"
hintsButton.checked = true

hintsButton.addEventListener("click", () => {
const hints = document.getElementsByClassName("fun_facts")[0]

if (!hintsButton.checked) {
hints.style.display = "none"
}
else {
hints.style.display = "unset"
}
})

hintsSection.append(hintsButton)
document.getElementById("sidebar").append(hintsSection)

// Get/Construct HTML input and event update for game speed
var gameSpeed = settingsControl.gameSpeedInput;
document.getElementById("sidebar").append(gameSpeed);
Expand Down

0 comments on commit d614efe

Please sign in to comment.