mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
gritter now implemented
This commit is contained in:
parent
2ae3dae492
commit
1c7810783c
6 changed files with 129 additions and 7 deletions
|
@ -22,7 +22,6 @@
|
|||
|
||||
var padutils = require('./pad_utils').padutils;
|
||||
var padcookie = require('./pad_cookie').padcookie;
|
||||
|
||||
var Tinycon = require('tinycon/tinycon');
|
||||
|
||||
var chat = (function()
|
||||
|
@ -36,6 +35,7 @@ var chat = (function()
|
|||
{
|
||||
$("#chaticon").hide();
|
||||
$("#chatbox").show();
|
||||
$("#gritter-notice-wrapper").hide();
|
||||
self.scrollDown();
|
||||
chatMentions = 0;
|
||||
Tinycon.setBubble(0);
|
||||
|
@ -62,6 +62,8 @@ var chat = (function()
|
|||
$("#chatcounter").text("0");
|
||||
$("#chaticon").show();
|
||||
$("#chatbox").hide();
|
||||
$.gritter.removeAll();
|
||||
$("#gritter-notice-wrapper").show();
|
||||
},
|
||||
scrollDown: function()
|
||||
{
|
||||
|
@ -130,17 +132,41 @@ var chat = (function()
|
|||
// is the users focus already in the chatbox?
|
||||
var alreadyFocused = $("#chatinput").is(":focus");
|
||||
|
||||
// does the user already have the chatbox open?
|
||||
var chatOpen = $("#chatbox").is(":visible");
|
||||
|
||||
$("#chatcounter").text(count);
|
||||
// chat throb stuff -- Just make it throw for twice as long
|
||||
if(wasMentioned && !alreadyFocused && !isHistoryAdd)
|
||||
if(wasMentioned && !alreadyFocused && !isHistoryAdd && !chatOpen)
|
||||
{ // If the user was mentioned show for twice as long and flash the browser window
|
||||
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text).show().delay(4000).hide(400);
|
||||
$.gritter.add({
|
||||
// (string | mandatory) the heading of the notification
|
||||
title: authorName,
|
||||
// (string | mandatory) the text inside the notification
|
||||
text: text,
|
||||
// (bool | optional) if you want it to fade out on its own or just sit there
|
||||
sticky: true,
|
||||
// (int | optional) the time you want it to be alive for before fading out
|
||||
time: '2000'
|
||||
});
|
||||
|
||||
chatMentions++;
|
||||
Tinycon.setBubble(chatMentions);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text).show().delay(2000).hide(400);
|
||||
if(!chatOpen){
|
||||
$.gritter.add({
|
||||
// (string | mandatory) the heading of the notification
|
||||
title: authorName,
|
||||
// (string | mandatory) the text inside the notification
|
||||
text: text,
|
||||
// (bool | optional) if you want it to fade out on its own or just sit there
|
||||
sticky: false,
|
||||
// (int | optional) the time you want it to be alive for before fading out
|
||||
time: '4000'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// Clear the chat mentions when the user clicks on the chat input box
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*/
|
||||
|
||||
(function($){
|
||||
|
||||
/**
|
||||
* Set it up as an object under the jQuery namespace
|
||||
*/
|
||||
|
|
|
@ -364,6 +364,13 @@ function handshake()
|
|||
});
|
||||
}
|
||||
|
||||
$.extend($.gritter.options, {
|
||||
position: 'bottom-right', // defaults to 'top-right' but can be 'bottom-left', 'bottom-right', 'top-left', 'top-right' (added in 1.7.1)
|
||||
fade_in_speed: 'medium', // how fast notifications fade in (string or int)
|
||||
fade_out_speed: 2000, // how fast the notices fade out
|
||||
time: 6000 // hang on the screen for...
|
||||
});
|
||||
|
||||
var pad = {
|
||||
// don't access these directly from outside this file, except
|
||||
// for debugging
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue