Archived
1
0

update rollover in livechan ui

This commit is contained in:
Jeff Becker 2016-07-04 11:28:10 -04:00
parent e461462bd6
commit 13e0010419
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B

View File

@ -688,9 +688,9 @@ ConvoBar.prototype.update = function(convo, chat) {
while(self.convoPosts[convo].length > scrollback) { while(self.convoPosts[convo].length > scrollback) {
// remove oldest from convo tracker // remove oldest from convo tracker
var child_data = self.convoPosts[convo].shift(); var child_data = self.convoPosts[convo].shift();
var child = document.getElementById("livechan_chat_"+child_data.Count); //var child = document.getElementById("livechan_chat_"+child_data.Count);
// remove element from main chat element // remove element from main chat element
self.parent.chatElems.output.removeChild(child.parentNode.parentElement); //self.parent.chatElems.output.removeChild(child.parentNode.parentElement);
} }
} }
@ -1111,7 +1111,9 @@ Chat.prototype.scroll = function() {
Chat.prototype.rollover = function() { Chat.prototype.rollover = function() {
var self = this; var self = this;
var chatSize = self.options.scrollback || 50; var chatSize = self.options.scrollback || 50;
self.chatElems.convobar.rolloverAll(chatSize); while ( this.chatElems.output.childNodes.length > chatSize ) {
this.chatElems.output.childNodes.removeChild(this.chatElems.output.childNodes[0]);
}
} }
/* @brief Inserts the chat into the DOM, overwriting if need be. /* @brief Inserts the chat into the DOM, overwriting if need be.
@ -1134,6 +1136,7 @@ Chat.prototype.insertChat = function(chat, data) {
outputElem.appendChild(chat); outputElem.appendChild(chat);
// scroll to end // scroll to end
self.scroll(); self.scroll();
self.rollover();
} }
@ -1201,14 +1204,14 @@ Chat.prototype.generateChat = function(data) {
var i = document.createElement("img"); var i = document.createElement("img");
i.src = src_url; i.src = src_url;
var e = document.createElement("div"); var e = document.createElement("div");
e.setAttribute("id", "hover_"+data.Count); e.setAttribute("id", "hover_"+data.ShortHash);
e.setAttribute("class", "hover"); e.setAttribute("class", "hover");
e.appendChild(i); e.appendChild(i);
chat.appendChild(e); chat.appendChild(e);
}); });
img.addEventListener('mouseout', function () { img.addEventListener('mouseout', function () {
// unload image // unload image
var e = document.getElementById("hover_"+data.Count); var e = document.getElementById("hover_"+data.ShortHash);
e.parentElement.removeChild(e); e.parentElement.removeChild(e);
}); });
} }