Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
color: white;
text-align: center;
}
#MUSIC_TOGGLE {
position: fixed;
right: 10px;
bottom: 10px;
}
</style>
</head>
<body>
Expand All @@ -111,6 +116,7 @@ <h2 id="time_remaining"></h2>
<button class="diff-btn" id="MEDIUM">Medium</button>
<button class="diff-btn" id="HARD">Hard</button>
<button class="diff-btn" id="EXTREME">Extreme</button>
<button id="MUSIC_TOGGLE">Toggle Music</button>
</div>
</div>
<audio src="http://www.nyan.cat/music/technyancolor.ogg" autoplay loop></audio>
Expand Down
12 changes: 12 additions & 0 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const catch_me = document.getElementById("catch_me"),
level_num = document.getElementById("level_num"),
level_description = document.getElementById("level_description"),
time_remaining = document.getElementById("time_remaining");
toggle_button = document.getElementById("MUSIC_TOGGLE");

// Useful global values
const catch_height = 50,
Expand Down Expand Up @@ -95,6 +96,17 @@ diff_btns.forEach(el => {
})
});

toggle_button.addEventListener("click", e => {
source = document.getElementsByTagName("audio")[0];
// if not muted then mute
if (!source.muted) {
source.muted = true;
}
else {
source.muted = false;
}
});


const setTargets = () => {
target_time = 60; // seconds
Expand Down