his audio request

This commit is contained in:
zyqunix 2024-12-07 17:27:05 +01:00
parent a025525d04
commit 6b5270c64f
3 changed files with 23 additions and 22 deletions

View file

@ -1,29 +1,19 @@
const sounds = {
autist: 'wav/sound1.wav',
downie: 'wav/sound2.wav',
retard: 'wav/sound3.wav',
'retarded autistic downie': 'wav/sound4.wav'
};
const buttons = document.querySelectorAll('button');
buttons.forEach(button => {
const audio = button.querySelector('audio');
button.addEventListener('click', function() {
if (audio) {
audio.play();
}
});
});
const button = document.getElementById('playButton');
const header = document.getElementById('played');
const toggle = document.getElementById('toggle');
const ad = document.getElementById('ad');
let isHidden = false;
button.addEventListener('click', function() {
const audio = document.getElementById('audio');
const keys = Object.keys(sounds);
let randKey = keys[Math.floor(Math.random() * keys.length)];
let randSound = sounds[randKey];
audio.src = randSound;
audio.play();
header.innerHTML = randKey;
});
toggle.addEventListener('click', function() {
if (!isHidden) {
ad.style.display = 'none';