diff --git a/src/assets/effects/click_1.wav b/src/assets/effects/click_1.wav new file mode 100644 index 0000000..3e11d7a Binary files /dev/null and b/src/assets/effects/click_1.wav differ diff --git a/src/assets/effects/hover_1.wav b/src/assets/effects/hover_1.wav new file mode 100644 index 0000000..defadef Binary files /dev/null and b/src/assets/effects/hover_1.wav differ diff --git a/src/assets/effects/hover_2.wav b/src/assets/effects/hover_2.wav new file mode 100644 index 0000000..c2ff37f Binary files /dev/null and b/src/assets/effects/hover_2.wav differ diff --git a/src/assets/effects/hover_3.wav b/src/assets/effects/hover_3.wav new file mode 100644 index 0000000..248958b Binary files /dev/null and b/src/assets/effects/hover_3.wav differ diff --git a/src/assets/effects/hover_4.wav b/src/assets/effects/hover_4.wav new file mode 100644 index 0000000..d3ce789 Binary files /dev/null and b/src/assets/effects/hover_4.wav differ diff --git a/src/assets/effects/hover_5.wav b/src/assets/effects/hover_5.wav new file mode 100644 index 0000000..6b72c63 Binary files /dev/null and b/src/assets/effects/hover_5.wav differ diff --git a/src/assets/effects/hover_6.wav b/src/assets/effects/hover_6.wav new file mode 100644 index 0000000..917526f Binary files /dev/null and b/src/assets/effects/hover_6.wav differ diff --git a/src/assets/sound.js b/src/assets/sound.js new file mode 100644 index 0000000..eed1887 --- /dev/null +++ b/src/assets/sound.js @@ -0,0 +1,25 @@ +function load_effects(names) { + return names.map(name => { + let audio = document.createElement("audio"); + audio.src = `/assets/effects/${name}.wav`; + audio.volume = 0.1; + return audio; + }); +} + +function play_random(effects) { + let index = Math.floor(Math.random() * effects.length); + effects[index].pause(); + effects[index].play().catch(() => { }); +} + +document.addEventListener("DOMContentLoaded", () => { + let click_effects = load_effects(["click_1"]); + let hover_effects = load_effects(["hover_1", "hover_2", "hover_3", "hover_4", "hover_5", "hover_6"]); + let links = [...document.getElementsByTagName("a")]; + links.forEach(link => { + link.addEventListener("mouseover", () => play_random(hover_effects)); + link.addEventListener("mousedown", () => play_random(click_effects)); + }); +}) + diff --git a/src/en/index.html b/src/en/index.html index 403363a..6bea724 100644 --- a/src/en/index.html +++ b/src/en/index.html @@ -8,6 +8,7 @@ +
diff --git a/src/index.html b/src/index.html index c126ac8..a191e75 100644 --- a/src/index.html +++ b/src/index.html @@ -8,6 +8,7 @@ +