Skip to content

Commit

Permalink
Append sound that hymn of the Bolshevik
Browse files Browse the repository at this point in the history
  • Loading branch information
KajizukaTaichi committed May 23, 2024
1 parent 8aca6b4 commit d8ebf7f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ const alarmSound = document.getElementById('alarmSound');

let timer;

let originalSound = alarmSound.src;
let alternateSound = "https://upload.wikimedia.org/wikipedia/commons/9/9c/Gimn_Sovetskogo_Soyuza_(1944_Stalinist_lyrics).oga";
let soundIndex = 0;
let soundList = [
alarmSound.src,
"https://upload.wikimedia.org/wikipedia/commons/9/9c/Gimn_Sovetskogo_Soyuza_(1944_Stalinist_lyrics).oga",
"https://upload.wikimedia.org/wikipedia/commons/1/1c/Gimn_partii_bolshevikov_(Hymn_of_the_Bolshevik_Party).ogg"
];


let countType = 0;

let isAlternateSound = false;
Expand Down Expand Up @@ -87,8 +93,13 @@ document.addEventListener('keydown', function (event) {
if (countType > 2) {
countType = 0;
if (confirm("Is it okay to change alarm sound?")) {
isAlternateSound = !isAlternateSound;
alarmSound.src = isAlternateSound ? alternateSound : originalSound;
if (soundIndex < soundList.length - 1) {
soundIndex++;
} else {
soundIndex = 0;
}

alarmSound.src = soundList[soundIndex]
timerDisplay.textContent = 'Changed alarm sound';
}
}
Expand Down

0 comments on commit d8ebf7f

Please sign in to comment.