diff --git a/public/app.js b/public/app.js index 57635ad..c3a734e 100644 --- a/public/app.js +++ b/public/app.js @@ -37,6 +37,12 @@ const getCookie = (name) => { return null; } +const beep = () => { + console.log("BEEP!"); + var snd = new Audio('/audio/beep.wav'); + snd.play(); +} + const app = { newPosts: 0, newNotifications: 0, @@ -58,8 +64,7 @@ const app = { if (newPosts) { if (meta.newPosts > 0) { if (meta.newPosts > app.newPosts) { - // BEEP! - console.log('BEEP!'); + beep(); } app.newPosts = meta.newPosts; newPosts.innerHTML = `${meta.newPosts} unread`; @@ -73,8 +78,7 @@ const app = { if (newNotifications) { if (meta.newNotifications > 0) { if (meta.newNotifications > app.newNotifications) { - // BEEP! - console.log('BEEP!'); + beep(); } app.newNotifications = meta.newNotifications; newNotifications.innerHTML = `${meta.newNotifications} new`; @@ -88,8 +92,7 @@ const app = { if (newDMs) { if (meta.newDMs > 0) { if (meta.newDMs > app.newDMs) { - // BEEP! - console.log('BEEP!'); + beep(); } app.newDMs = meta.newDMs; newDMs.innerHTML = `${meta.newDMs} new`; @@ -265,4 +268,4 @@ const app = { } return false; } -} \ No newline at end of file +} diff --git a/public/audio/beep.wav b/public/audio/beep.wav new file mode 100644 index 0000000..e83a142 Binary files /dev/null and b/public/audio/beep.wav differ diff --git a/routes/admin.js b/routes/admin.js index 167bb0e..d034c30 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -545,4 +545,4 @@ router.post('/boost', async (req, res) => { }); } writeBoosts(boosts); -}); \ No newline at end of file +});