From 5c6d940a5aa43e22283c110e2d0d47f049a7f37b Mon Sep 17 00:00:00 2001 From: choelzl Date: Thu, 24 Feb 2022 02:31:24 +0100 Subject: [PATCH] WIP --- web/alert/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }