Improve chat highlight options per #369
This commit is contained in:
parent
1917baa4c3
commit
8069378afc
|
@ -88,11 +88,23 @@ mixin us-chat
|
|||
mixin rcheckbox("us-chat-timestamp", "Show timestamps in chat")
|
||||
mixin rcheckbox("us-sort-rank", "Sort userlist by rank")
|
||||
mixin rcheckbox("us-sort-afk", "Sort AFKers to bottom")
|
||||
mixin rcheckbox("us-chat-notice", "Ping on all new messages")
|
||||
.col-sm-4
|
||||
.col-sm-8
|
||||
p.text-info When unchecked, you will only be pinged if your name is mentioned
|
||||
mixin rcheckbox("us-boop", "Play a sound when pinged")
|
||||
p.text-info The following 2 options apply to how and when you will be notified if a new chat message is received while CyTube is not the active window.
|
||||
.form-group
|
||||
label.control-label.col-sm-4(for="#us-blink-title") Blink page title on new messages
|
||||
.col-sm-8
|
||||
select#us-blink-title
|
||||
option(value="never") Never
|
||||
option(value="onlyping") Only when I am mentioned or PMed
|
||||
option(value="always") Always
|
||||
.form-group
|
||||
label.control-label.col-sm-4(for="#us-ping-sound") Notification sound on new messages
|
||||
.col-sm-8
|
||||
select#us-ping-sound
|
||||
option(value="never") Never
|
||||
option(value="onlyping") Only when I am mentioned or PMed
|
||||
option(value="always") Always
|
||||
mixin rcheckbox("us-sendbtn", "Add a send button to chat")
|
||||
|
||||
mixin us-mod
|
||||
|
|
|
@ -488,6 +488,8 @@ Callbacks = {
|
|||
|
||||
if (data.username === CLIENT.name) {
|
||||
name = data.to;
|
||||
} else {
|
||||
pingMessage(true);
|
||||
}
|
||||
var pm = initPm(name);
|
||||
var msg = formatChatMessage(data, pm.data("last"));
|
||||
|
|
|
@ -118,7 +118,7 @@ var USEROPTS = {
|
|||
hidevid : getOrDefault("hidevid", false),
|
||||
show_timestamps : getOrDefault("show_timestamps", true),
|
||||
modhat : getOrDefault("modhat", false),
|
||||
blink_title : getOrDefault("blink_title", false),
|
||||
blink_title : getOrDefault("blink_title", "onlyping"),
|
||||
sync_accuracy : getOrDefault("sync_accuracy", 2),
|
||||
wmode_transparent : getOrDefault("wmode_transparent", true),
|
||||
chatbtn : getOrDefault("chatbtn", false),
|
||||
|
@ -132,12 +132,32 @@ var USEROPTS = {
|
|||
sort_rank : getOrDefault("sort_rank", true),
|
||||
sort_afk : getOrDefault("sort_afk", false),
|
||||
default_quality : getOrDefault("default_quality", ""),
|
||||
boop : getOrDefault("boop", false),
|
||||
boop : getOrDefault("boop", "never"),
|
||||
secure_connection : getOrDefault("secure_connection", false),
|
||||
no_h264 : getOrDefault("no_h264", default_noh264()),
|
||||
show_shadowchat : getOrDefault("show_shadowchat", false)
|
||||
};
|
||||
|
||||
/* Backwards compatibility check */
|
||||
if (USEROPTS.blink_title === true) {
|
||||
USEROPTS.blink_title = "always";
|
||||
} else if (USEROPTS.blink_title === false) {
|
||||
USEROPTS.blink_title = "onlyping";
|
||||
}
|
||||
/* Last ditch */
|
||||
if (["never", "onlyping", "always"].indexOf(USEROPTS.blink_title) === -1) {
|
||||
USEROPTS.blink_title = "onlyping";
|
||||
}
|
||||
|
||||
if (USEROPTS.boop === true) {
|
||||
USEROPTS.boop = "onlyping";
|
||||
} else if (USEROPTS.boop === false) {
|
||||
USEROPTS.boop = "never";
|
||||
}
|
||||
if (["never", "onlyping", "always"].indexOf(USEROPTS.boop) === -1) {
|
||||
USEROPTS.boop = "onlyping";
|
||||
}
|
||||
|
||||
var VOLUME = parseFloat(getOrDefault("volume", 1));
|
||||
|
||||
var NO_WEBSOCKETS = USEROPTS.altsocket;
|
||||
|
|
|
@ -628,8 +628,8 @@ function showUserOptions() {
|
|||
$("#us-chat-timestamp").prop("checked", USEROPTS.show_timestamps);
|
||||
$("#us-sort-rank").prop("checked", USEROPTS.sort_rank);
|
||||
$("#us-sort-afk").prop("checked", USEROPTS.sort_afk);
|
||||
$("#us-chat-notice").prop("checked", USEROPTS.blink_title);
|
||||
$("#us-boop").prop("checked", USEROPTS.boop);
|
||||
$("#us-blink-title").val(USEROPTS.blink_title);
|
||||
$("#us-ping-sound").val(USEROPTS.boop);
|
||||
$("#us-sendbtn").prop("checked", USEROPTS.chatbtn);
|
||||
|
||||
$("#us-modflair").prop("checked", USEROPTS.modhat);
|
||||
|
@ -660,8 +660,8 @@ function saveUserOptions() {
|
|||
USEROPTS.show_timestamps = $("#us-chat-timestamp").prop("checked");
|
||||
USEROPTS.sort_rank = $("#us-sort-rank").prop("checked");
|
||||
USEROPTS.sort_afk = $("#us-sort-afk").prop("checked");
|
||||
USEROPTS.blink_title = $("#us-chat-notice").prop("checked");
|
||||
USEROPTS.boop = $("#us-boop").prop("checked");
|
||||
USEROPTS.blink_title = $("#us-blink-title").val();
|
||||
USEROPTS.boop = $("#us-ping-sound").val();
|
||||
USEROPTS.chatbtn = $("#us-sendbtn").prop("checked");
|
||||
|
||||
if (CLIENT.rank >= 2) {
|
||||
|
@ -1422,27 +1422,34 @@ 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;
|
||||
else
|
||||
document.title = "*Chat*";
|
||||
}, 1000);
|
||||
}
|
||||
if(CLIENT.name && data.username != CLIENT.name) {
|
||||
if(data.msg.toUpperCase().indexOf(CLIENT.name.toUpperCase()) != -1) {
|
||||
|
||||
var isHighlight = false;
|
||||
if (CLIENT.name && data.username != CLIENT.name) {
|
||||
if (data.msg.toLowerCase().indexOf(CLIENT.name.toLowerCase()) != -1) {
|
||||
div.addClass("nick-highlight");
|
||||
if(!FOCUSED && !TITLE_BLINK) {
|
||||
USEROPTS.boop && CHATSOUND.play();
|
||||
TITLE_BLINK = setInterval(function() {
|
||||
if(document.title == "*Chat*")
|
||||
document.title = PAGETITLE;
|
||||
else
|
||||
document.title = "*Chat*";
|
||||
}, 1000);
|
||||
}
|
||||
isHighlight = true;
|
||||
}
|
||||
}
|
||||
|
||||
pingMessage(isHighlight);
|
||||
|
||||
}
|
||||
|
||||
function pingMessage(isHighlight) {
|
||||
if (!FOCUSED) {
|
||||
if (!TITLE_BLINK && (USEROPTS.blink_title === "always" ||
|
||||
USEROPTS.blink_title === "onlyping" && isHighlight)) {
|
||||
TITLE_BLINK = setInterval(function() {
|
||||
if(document.title == "*Chat*")
|
||||
document.title = PAGETITLE;
|
||||
else
|
||||
document.title = "*Chat*";
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
if (USEROPTS.boop === "always" || (USEROPTS.boop === "onlyping" &&
|
||||
isHighlight)) {
|
||||
CHATSOUND.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue