mirror of https://github.com/calzoneman/sync.git
Fixes to clientside chat stuff
This commit is contained in:
parent
789471f395
commit
fc27736017
|
@ -75,8 +75,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.action {
|
.action {
|
||||||
text-decoration: italic;
|
font-style: italic;
|
||||||
color: #bbbbbb;
|
color: #aaaaaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spoiler {
|
.spoiler {
|
||||||
|
@ -89,5 +89,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.greentext {
|
.greentext {
|
||||||
color: #99ff99;
|
color: #789922; /* Color value directly from 4chan */
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,7 @@ function initCallbacks() {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('chatMsg', function(data) {
|
socket.on('chatMsg', function(data) {
|
||||||
var div = document.createElement('div');
|
var div = formatChatMessage(data);
|
||||||
var span = document.createElement('span');
|
|
||||||
$(span).addClass(data.msgclass);
|
|
||||||
if(data.msgclass != "action")
|
|
||||||
data.msg = "<strong><" + data.username + "></strong> " + data.msg;
|
|
||||||
span.innerHTML = data.msg;
|
|
||||||
div.appendChild(span);
|
|
||||||
$('#messagebuffer')[0].appendChild(div);
|
$('#messagebuffer')[0].appendChild(div);
|
||||||
// Cap chatbox at most recent 100 messages
|
// Cap chatbox at most recent 100 messages
|
||||||
if($('#messagebuffer').children().length > 100) {
|
if($('#messagebuffer').children().length > 100) {
|
||||||
|
|
|
@ -96,6 +96,26 @@ function addUserDropdown(entry, name) {
|
||||||
return ul;
|
return ul;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatChatMessage(data) {
|
||||||
|
var div = document.createElement('div');
|
||||||
|
if(data.msgclass == "action") {
|
||||||
|
var message = document.createElement('span');
|
||||||
|
$(message).addClass('action');
|
||||||
|
message.innerHTML = data.username + " " + data.msg;
|
||||||
|
div.appendChild(message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var name = document.createElement('span');
|
||||||
|
var message = document.createElement('span');
|
||||||
|
name.innerHTML = "<strong><" + data.username + "></strong> ";
|
||||||
|
$(message).addClass(data.msgclass);
|
||||||
|
message.innerHTML = data.msg;
|
||||||
|
div.appendChild(name);
|
||||||
|
div.appendChild(message);
|
||||||
|
}
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
|
||||||
// Creates and formats a queue entry
|
// Creates and formats a queue entry
|
||||||
function makeQueueEntry(video) {
|
function makeQueueEntry(video) {
|
||||||
var li = $('<li />');
|
var li = $('<li />');
|
||||||
|
|
Loading…
Reference in New Issue