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 {
|
||||
text-decoration: italic;
|
||||
color: #bbbbbb;
|
||||
font-style: italic;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
|
||||
.spoiler {
|
||||
|
@ -89,5 +89,5 @@
|
|||
}
|
||||
|
||||
.greentext {
|
||||
color: #99ff99;
|
||||
color: #789922; /* Color value directly from 4chan */
|
||||
}
|
||||
|
|
|
@ -42,13 +42,7 @@ function initCallbacks() {
|
|||
});
|
||||
|
||||
socket.on('chatMsg', function(data) {
|
||||
var div = document.createElement('div');
|
||||
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);
|
||||
var div = formatChatMessage(data);
|
||||
$('#messagebuffer')[0].appendChild(div);
|
||||
// Cap chatbox at most recent 100 messages
|
||||
if($('#messagebuffer').children().length > 100) {
|
||||
|
|
|
@ -96,6 +96,26 @@ function addUserDropdown(entry, name) {
|
|||
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
|
||||
function makeQueueEntry(video) {
|
||||
var li = $('<li />');
|
||||
|
|
Loading…
Reference in New Issue