diff --git a/www/assets/js/data.js b/www/assets/js/data.js
index c413fab3..e21a7d66 100644
--- a/www/assets/js/data.js
+++ b/www/assets/js/data.js
@@ -63,6 +63,7 @@ var LASTCHATTIME = 0;
var FOCUSED = true;
var PAGETITLE = "CyTube";
var TITLE_BLINK;
+var CHATSOUND = new Audio("assets/sounds/boop.wav");
var KICKED = false;
var NAME = readCookie("cytube_uname");
var SESSION = readCookie("cytube_session");
@@ -118,7 +119,8 @@ var USEROPTS = {
ignore_channeljs : getOrDefault("ignore_channeljs", false),
sort_rank : getOrDefault("sort_rank", false),
sort_afk : getOrDefault("sort_afk", false),
- default_quality : getOrDefault("default_quality", "#quality_auto")
+ default_quality : getOrDefault("default_quality", "#quality_auto"),
+ boop : gerOrDefault("boop", false)
};
var NO_WEBSOCKETS = USEROPTS.altsocket;
diff --git a/www/assets/js/util.js b/www/assets/js/util.js
index 982fee5a..e3015986 100644
--- a/www/assets/js/util.js
+++ b/www/assets/js/util.js
@@ -614,6 +614,12 @@ function showOptionsMenu() {
blink.prop("checked", USEROPTS.blink_title);
addOption("Chat Notice", blinkcontainer);
+ var boopcontainer = $("").addClass("checkbox")
+ .text("Play a sound in addition to flashing the title");
+ var boop = $("").attr("type", "checkbox").appendTo(boopcontainer);
+ boop.prop("checked", USEROPTS.boop);
+ addOption("Chat Sound", boopcontainer);
+
var sendbtncontainer = $("").addClass("checkbox")
.text("Add a send button to the chatbox");
var sendbtn = $("").attr("type", "checkbox").appendTo(sendbtncontainer);
@@ -665,6 +671,7 @@ function showOptionsMenu() {
USEROPTS.ignore_channeljs = nojs.prop("checked");
USEROPTS.sort_rank = sr.prop("checked");
USEROPTS.sort_afk = sa.prop("checked");
+ USEROPTS.boop = boop.prop("checked");
sortUserlist();
if(CLIENT.rank >= Rank.Moderator) {
USEROPTS.modhat = modhat.prop("checked");
@@ -1384,6 +1391,7 @@ function addChatMessage(data) {
if(SCROLLCHAT)
scrollChat();
if(USEROPTS.blink_title && !FOCUSED && !TITLE_BLINK) {
+ USEROPTS.boop && CHATSOUND.play();
TITLE_BLINK = setInterval(function() {
if(document.title == "*Chat*")
document.title = PAGETITLE;
@@ -1395,6 +1403,7 @@ function addChatMessage(data) {
if(data.msg.toUpperCase().indexOf(CLIENT.name.toUpperCase()) != -1) {
div.addClass("nick-highlight");
if(!FOCUSED && !TITLE_BLINK) {
+ USEROPTS.boop && CHATSOUND.play();
TITLE_BLINK = setInterval(function() {
if(document.title == "*Chat*")
document.title = PAGETITLE;
diff --git a/www/assets/sounds/boop.wav b/www/assets/sounds/boop.wav
new file mode 100644
index 00000000..3e9236c3
Binary files /dev/null and b/www/assets/sounds/boop.wav differ