Implement #251 (sound may change)

This commit is contained in:
Calvin Montgomery 2013-08-28 16:03:31 -05:00
parent 27ef20a76a
commit 613acd2055
3 changed files with 12 additions and 1 deletions

View File

@ -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;

View File

@ -614,6 +614,12 @@ function showOptionsMenu() {
blink.prop("checked", USEROPTS.blink_title);
addOption("Chat Notice", blinkcontainer);
var boopcontainer = $("<label/>").addClass("checkbox")
.text("Play a sound in addition to flashing the title");
var boop = $("<input/>").attr("type", "checkbox").appendTo(boopcontainer);
boop.prop("checked", USEROPTS.boop);
addOption("Chat Sound", boopcontainer);
var sendbtncontainer = $("<label/>").addClass("checkbox")
.text("Add a send button to the chatbox");
var sendbtn = $("<input/>").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;

BIN
www/assets/sounds/boop.wav Normal file

Binary file not shown.