Skip to content

Commit 957f8bd

Browse files
committed
docs: add input sounds
1 parent c1a9036 commit 957f8bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ <h1 class="sr-only">Half-Life Dedicated Server with Docker</h1>
767767
<script>
768768
const clickSound = new Audio("click.mp3");
769769
const noSound = new Audio("no.mp3");
770+
const inputSound = new Audio("input.mp3");
770771
noSound.volume = 0.6;
771772

772773
// Map data for each game
@@ -1052,14 +1053,23 @@ <h1 class="sr-only">Half-Life Dedicated Server with Docker</h1>
10521053
updateMapOptions();
10531054
updateCommand();
10541055

1055-
// Attach sound effects to interactive elements (excluding text inputs)
10561056
const interactiveElements = document.querySelectorAll(
10571057
"button:not(.close), a, select, input[type='checkbox'], input[type='radio']"
10581058
);
10591059
interactiveElements.forEach((element) => {
10601060
element.addEventListener("mousedown", playButtonSound);
10611061
});
10621062

1063+
const inputElements = document.querySelectorAll(
1064+
"input[type='text'], input[type='password'], input[type='number']"
1065+
);
1066+
inputElements.forEach((element) => {
1067+
element.addEventListener("click", () => {
1068+
inputSound.currentTime = 0;
1069+
inputSound.play().catch(() => {});
1070+
});
1071+
});
1072+
10631073
// Attach "no" sound to close button
10641074
const closeBtn = document.querySelector(".window-button.close");
10651075
if (closeBtn) {

docs/input.mp3

4.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)