mirror of https://github.com/calzoneman/sync.git
Add timestamps (optional) to chat messages
This commit is contained in:
parent
3600a3114a
commit
d8894f0280
|
@ -1234,7 +1234,8 @@ Channel.prototype.sendMessage = function(username, msg, msgclass, data) {
|
|||
var msgobj = {
|
||||
username: username,
|
||||
msg: msg,
|
||||
msgclass: msgclass
|
||||
msgclass: msgclass,
|
||||
time: Date.now()
|
||||
};
|
||||
if(data) {
|
||||
for(var key in data) {
|
||||
|
|
|
@ -210,3 +210,7 @@ html, body {
|
|||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.timestamp {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ var USEROPTS = {
|
|||
layout : readCookie("cytube_layout") || "default",
|
||||
synch : parseBool(readCookie("cytube_synch")) || true,
|
||||
hidevid : parseBool(readCookie("cytube_hidevid")) || false,
|
||||
show_timestamps : parseBool(readCookie("cytube_show_timestamps")) || false,
|
||||
modhat : parseBool(readCookie("cytube_modhat")) || false
|
||||
};
|
||||
applyOpts();
|
||||
|
|
|
@ -203,8 +203,13 @@ function formatChatMessage(data) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(USEROPTS.show_timestamps) {
|
||||
var time = $("<span/>").addClass("timestamp").appendTo(div);
|
||||
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
|
||||
time.text("["+timestamp+"] ");
|
||||
}
|
||||
var name = $("<span/>").appendTo(div);
|
||||
$("<strong/>").text("<" + data.username + "> ").appendTo(name);
|
||||
$("<strong/>").text(data.username + ": ").appendTo(name);
|
||||
var message = $("<span/>").appendTo(div);
|
||||
message[0].innerHTML = data.msg;
|
||||
if(data.modflair) {
|
||||
|
@ -1055,6 +1060,13 @@ function showUserOpts() {
|
|||
hidevid.prop("checked", USEROPTS.hidevid);
|
||||
addOption("Hide Video", vidcontainer);
|
||||
|
||||
|
||||
var tscontainer = $("<label/>").addClass("checkbox")
|
||||
.text("Show timestamps in chat");
|
||||
var showts = $("<input/>").attr("type", "checkbox").appendTo(tscontainer);
|
||||
showts.prop("checked", USEROPTS.show_timestamps);
|
||||
addOption("Show timestamps", tscontainer);
|
||||
|
||||
if(RANK >= Rank.Moderator) {
|
||||
$("<hr>").appendTo(form);
|
||||
var modhatcontainer = $("<label/>").addClass("checkbox")
|
||||
|
@ -1075,6 +1087,7 @@ function showUserOpts() {
|
|||
USEROPTS.layout = layoutselect.val();
|
||||
USEROPTS.synch = synch.prop("checked");
|
||||
USEROPTS.hidevid = hidevid.prop("checked");
|
||||
USEROPTS.show_timestamps = showts.prop("checked");
|
||||
if(RANK >= Rank.Moderator) {
|
||||
USEROPTS.modhat = modhat.prop("checked");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue