Prevent chat from autoscrolling when mouse inside

This commit is contained in:
calzoneman 2013-03-30 00:55:25 -05:00
parent 31fd011b4d
commit 7b11651e1e
2 changed files with 9 additions and 1 deletions

View file

@ -103,7 +103,8 @@ function initCallbacks() {
if($("#messagebuffer").children().length > 100) {
$($("#messagebufer").children()[0]).remove();
}
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
if(SCROLLCHAT)
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
});
socket.on("playlist", function(data) {
@ -298,6 +299,9 @@ function initCallbacks() {
socket.on("newPoll", function(data) {
addPoll(data);
if(SCROLLCHAT) {
$("#messagebuffer").scrollTop($("#messagebuffer").prop("scrollHeight"));
}
});
socket.on("updatePoll", function(data) {

View file

@ -22,6 +22,7 @@ var OLDINDEX = -1;
var CHATHIST = [];
var CHATHISTIDX = 0;
var FOCUSED = true;
var SCROLLCHAT = true;
var PAGETITLE = "Sync";
var TITLE_BLINK;
var uname = readCookie("sync_uname");
@ -254,6 +255,9 @@ $("#chatline").keydown(function(ev) {
}
});
$("#messagebuffer").mouseenter(function() { SCROLLCHAT = false; });
$("#messagebuffer").mouseleave(function() { SCROLLCHAT = true; });
$("#opt_submit").click(function() {
var ptitle = $("#opt_pagetitle").val();
if(ptitle == "")