var handler = {}
handler.message = function(object) {
var safe_message = $('
').text(object.msg).html();
safe_message = replaceURLWithHTMLLinks(safe_message);
var safe_from = $('').text(object.nick).html();
return chatboxAppend(safe_from, safe_message)
};
handler.join = function(object) {
var safe_from = $('').text(object.from).html();
$(''+getCurTime()+' | '+safe_from+' | joined |
').insertBefore('#foot');
$('#nicklist').append('' + safe_from + '
') ;
};
handler.quit = function(object) {
var safe_from = $('').text(object.from).html();
$(''+getCurTime()+' | '+safe_from+' | quit |
').insertBefore('#foot');
console.log('removing', safe_from);
$(getNicklistElement(safe_from)).remove();
};
handler.nicklist = function(object) {
Object.keys(object.nicklist).forEach(function (nick) {
// console.log('nick',nick);
var hash_from = btoa(nick).replace(/=/g,'_');
// $('.name').each(function (i,e) { console.log(i,e); if (e.innerHTML === 'kweb') { $(e).attr("style", "color:green") } })
$('#nicklist').append('' + nick + '
') ;
});
};
handler.nickchange = function(object) {
var safe_from = $('').text(object.nick).html();
var safe_newnick = $('').text(object.newnick).html();
$(''+getCurTime()+' | '+safe_from+' | is now known as '+object.newnick+' |
').insertBefore('#foot');
$(getNicklistElement(safe_from)).remove();
$('#nicklist').append('' + safe_newnick + '
') ;
};