diff --git a/web/alert/index.js b/web/alert/index.js index 48ecc49..9f1aa53 100644 --- a/web/alert/index.js +++ b/web/alert/index.js @@ -12,7 +12,7 @@ $(async function () { $(audio).on("loadedmetadata", function() { resolve(audio); }); - audio.volume = volume/100.0; + audio.volume = Math.max(1,Math.min(0,volume/100.0)); audio.src = src; audio.play().catch((err)=>{ if(err.toString().startsWith('NotAllowedError')){ @@ -34,7 +34,7 @@ $(async function () { let audio = await playAudio(music); node.style.opacity = 1; nodeIm.style.opacity = 1; - await sleep(audio.duration*1000 - 1000); + await sleep(Math.max(audio.duration*1000 - 500,3000)); node.style.opacity = 0; nodeIm.style.opacity = 0; }