mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
auto-focus auto-open auto-close chat function
This commit is contained in:
parent
2db81050f1
commit
2257cc0c1f
1 changed files with 26 additions and 6 deletions
|
@ -14,11 +14,14 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var chatAnimationIsStarted = false;
|
||||||
|
|
||||||
var chat = (function()
|
var chat = (function()
|
||||||
{
|
{
|
||||||
var self = {
|
var self = {
|
||||||
show: function ()
|
show: function ()
|
||||||
{
|
{ if (chatAnimationIsStarted) return;
|
||||||
|
chatAnimationIsStarted = true;
|
||||||
$("#chaticon").hide("slide", {
|
$("#chaticon").hide("slide", {
|
||||||
direction: "down"
|
direction: "down"
|
||||||
}, 500, function ()
|
}, 500, function ()
|
||||||
|
@ -46,19 +49,27 @@ var chat = (function()
|
||||||
},
|
},
|
||||||
hide: function ()
|
hide: function ()
|
||||||
{
|
{
|
||||||
|
if (chatAnimationIsStarted) return;
|
||||||
|
chatAnimationIsStarted = true;
|
||||||
|
|
||||||
$("#chatcounter").text("0");
|
$("#chatcounter").text("0");
|
||||||
$("#chatbox").hide("slide", { direction: "down" }, 750, function()
|
$("#chatbox").hide("slide", { direction: "down" }, 750, function()
|
||||||
{
|
{
|
||||||
$("#chaticon").show("slide", { direction: "down" }, 500);
|
$("#chaticon").show("slide", { direction: "down" }, 500, function()
|
||||||
|
{
|
||||||
|
chatAnimationIsStarted = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
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");
|
||||||
},
|
}
|
||||||
|
chatAnimationIsStarted = false;
|
||||||
|
},
|
||||||
send: function()
|
send: function()
|
||||||
{
|
{
|
||||||
var text = $("#chatinput").val();
|
var text = $("#chatinput").val();
|
||||||
|
@ -98,7 +109,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 +119,15 @@ var chat = (function()
|
||||||
},
|
},
|
||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
|
$("#chaticon").mouseenter(function(){
|
||||||
|
if (!chatAnimationIsStarted) self.show();
|
||||||
|
});
|
||||||
|
$("#titlecross").mouseenter(function(){
|
||||||
|
if (!chatAnimationIsStarted) self.hide();
|
||||||
|
});
|
||||||
|
$("#chatbox").mouseenter(function(){
|
||||||
|
if (!chatAnimationIsStarted) $("#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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue