auto-open on chat icon; auto-focus on chat input; fix for https://github.com/Pita/etherpad-lite/issues/208

This commit is contained in:
Wikinaut 2011-11-18 07:43:51 +01:00
parent 66a9798615
commit 0fc72bc7e7

View file

@ -55,9 +55,10 @@ var chat = (function()
scrollDown: function() scrollDown: function()
{ {
//console.log($('#chatbox').css("display")); //console.log($('#chatbox').css("display"));
if($('#chatbox').css("display") != "none") {
if($('#chatbox').css("display") != "none")
$('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow"); $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow");
$("#chatinput").focus();
}
}, },
send: function() send: function()
{ {
@ -98,7 +99,7 @@ var chat = (function()
var count = Number($("#chatcounter").text()); var count = Number($("#chatcounter").text());
count++; count++;
$("#chatcounter").text(count); $("#chatcounter").text(count);
// chat throb stuff -- Just make it throb in for ~2 secs then fadeotu // chat throb stuff -- Just make it throb in for ~2 secs then fadeout
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text); $('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text);
$('#chatthrob').effect("pulsate", {times:1,mode:"hide"},2000); $('#chatthrob').effect("pulsate", {times:1,mode:"hide"},2000);
} }
@ -108,6 +109,13 @@ var chat = (function()
}, },
init: function() init: function()
{ {
$("#chaticon").mouseenter(function(){
self.show();
});
$("#chatbox").mouseenter(function(evt){
if ( !$("#chatinput").is(":focus") ) $("#chatinput").focus();
});
$("#chatinput").keypress(function(evt) $("#chatinput").keypress(function(evt)
{ {
//if the user typed enter, fire the send //if the user typed enter, fire the send