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 = {
|
var msgobj = {
|
||||||
username: username,
|
username: username,
|
||||||
msg: msg,
|
msg: msg,
|
||||||
msgclass: msgclass
|
msgclass: msgclass,
|
||||||
|
time: Date.now()
|
||||||
};
|
};
|
||||||
if(data) {
|
if(data) {
|
||||||
for(var key in data) {
|
for(var key in data) {
|
||||||
|
|
|
@ -210,3 +210,7 @@ html, body {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timestamp {
|
||||||
|
font-size: 8pt;
|
||||||
|
}
|
||||||
|
|
|
@ -43,12 +43,13 @@ function parseBool(x) {
|
||||||
else return Boolean(x);
|
else return Boolean(x);
|
||||||
}
|
}
|
||||||
var USEROPTS = {
|
var USEROPTS = {
|
||||||
theme: readCookie("cytube_theme") || "default",
|
theme : readCookie("cytube_theme") || "default",
|
||||||
css: readCookie("cytube_css") || "",
|
css : readCookie("cytube_css") || "",
|
||||||
layout: readCookie("cytube_layout") || "default",
|
layout : readCookie("cytube_layout") || "default",
|
||||||
synch: parseBool(readCookie("cytube_synch")) || true,
|
synch : parseBool(readCookie("cytube_synch")) || true,
|
||||||
hidevid: parseBool(readCookie("cytube_hidevid")) || false,
|
hidevid : parseBool(readCookie("cytube_hidevid")) || false,
|
||||||
modhat: parseBool(readCookie("cytube_modhat")) || false
|
show_timestamps : parseBool(readCookie("cytube_show_timestamps")) || false,
|
||||||
|
modhat : parseBool(readCookie("cytube_modhat")) || false
|
||||||
};
|
};
|
||||||
applyOpts();
|
applyOpts();
|
||||||
$("#optlink").click(showUserOpts);
|
$("#optlink").click(showUserOpts);
|
||||||
|
|
|
@ -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);
|
var name = $("<span/>").appendTo(div);
|
||||||
$("<strong/>").text("<" + data.username + "> ").appendTo(name);
|
$("<strong/>").text(data.username + ": ").appendTo(name);
|
||||||
var message = $("<span/>").appendTo(div);
|
var message = $("<span/>").appendTo(div);
|
||||||
message[0].innerHTML = data.msg;
|
message[0].innerHTML = data.msg;
|
||||||
if(data.modflair) {
|
if(data.modflair) {
|
||||||
|
@ -1055,6 +1060,13 @@ function showUserOpts() {
|
||||||
hidevid.prop("checked", USEROPTS.hidevid);
|
hidevid.prop("checked", USEROPTS.hidevid);
|
||||||
addOption("Hide Video", vidcontainer);
|
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) {
|
if(RANK >= Rank.Moderator) {
|
||||||
$("<hr>").appendTo(form);
|
$("<hr>").appendTo(form);
|
||||||
var modhatcontainer = $("<label/>").addClass("checkbox")
|
var modhatcontainer = $("<label/>").addClass("checkbox")
|
||||||
|
@ -1070,11 +1082,12 @@ function showUserOpts() {
|
||||||
.appendTo(footer);
|
.appendTo(footer);
|
||||||
|
|
||||||
submit.click(function() {
|
submit.click(function() {
|
||||||
USEROPTS.theme = themeselect.val();
|
USEROPTS.theme = themeselect.val();
|
||||||
USEROPTS.css = usercss.val();
|
USEROPTS.css = usercss.val();
|
||||||
USEROPTS.layout = layoutselect.val();
|
USEROPTS.layout = layoutselect.val();
|
||||||
USEROPTS.synch = synch.prop("checked");
|
USEROPTS.synch = synch.prop("checked");
|
||||||
USEROPTS.hidevid= hidevid.prop("checked");
|
USEROPTS.hidevid = hidevid.prop("checked");
|
||||||
|
USEROPTS.show_timestamps = showts.prop("checked");
|
||||||
if(RANK >= Rank.Moderator) {
|
if(RANK >= Rank.Moderator) {
|
||||||
USEROPTS.modhat = modhat.prop("checked");
|
USEROPTS.modhat = modhat.prop("checked");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue