mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Being mentioned in a chat
This commit is contained in:
parent
88a8853fda
commit
f465ebaab9
1 changed files with 23 additions and 3 deletions
|
@ -87,6 +87,17 @@ var chat = (function()
|
||||||
});
|
});
|
||||||
|
|
||||||
var text = padutils.escapeHtmlWithClickableLinks(padutils.escapeHtml(msg.text), "_blank");
|
var text = padutils.escapeHtmlWithClickableLinks(padutils.escapeHtml(msg.text), "_blank");
|
||||||
|
|
||||||
|
/* Performs an action if your name is mentioned */
|
||||||
|
var myName = $('#myusernameedit').val();
|
||||||
|
myName = myName.toLowerCase();
|
||||||
|
var chatText = text.toLowerCase();
|
||||||
|
var wasMentioned = false;
|
||||||
|
if (chatText.indexOf(myName) !== -1 && myName != "undefined"){
|
||||||
|
wasMentioned = true;
|
||||||
|
}
|
||||||
|
/* End of new action */
|
||||||
|
|
||||||
var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName);
|
var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName);
|
||||||
|
|
||||||
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time'>" + timeStr + "</span> " + text + "</p>";
|
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time'>" + timeStr + "</span> " + text + "</p>";
|
||||||
|
@ -98,10 +109,19 @@ 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 throw for twice as long
|
||||||
|
if(wasMentioned)
|
||||||
|
{ // If the user was mentioned show for twice as long and flash the browser window
|
||||||
|
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text);
|
||||||
|
$('#chatthrob').effect("pulsate", {times:1,mode:"hide"},4000);
|
||||||
|
document.title = "You were mentioned in a chat: " + document.title;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$('#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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.scrollDown();
|
self.scrollDown();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue