Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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}<span> unread</span>`;
Expand All @@ -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}<span> new</span>`;
Expand All @@ -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}<span> new</span>`;
Expand Down Expand Up @@ -265,4 +268,4 @@ const app = {
}
return false;
}
}
}
Binary file added public/audio/beep.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,4 @@ router.post('/boost', async (req, res) => {
});
}
writeBoosts(boosts);
});
});