v1.18.x
barisusakli 11 years ago
parent 274acc8eec
commit 4c28de659c

@ -382,13 +382,15 @@ var socket,
} }
if (title.length > 0 && !app.isFocused) { if (title.length > 0 && !app.isFocused) {
if (!titleObj.titles[0]) {
titleObj.titles[0] = window.document.title;
}
titleObj.titles[1] = title; titleObj.titles[1] = title;
if (titleObj.interval) { if (titleObj.interval) {
clearInterval(titleObj.interval); clearInterval(titleObj.interval);
} }
titleObj.interval = setInterval(function() { titleObj.interval = setInterval(function() {
var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1]; var title = titleObj.titles[titleObj.titles.indexOf(window.document.title) ^ 1];
if (title) { if (title) {
window.document.title = title; window.document.title = title;
} }
@ -532,7 +534,6 @@ var socket,
$(window).focus(function(){ $(window).focus(function(){
app.isFocused = true; app.isFocused = true;
app.alternatingTitle(''); app.alternatingTitle('');
}); });

@ -53,7 +53,8 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) {
socket.on('event:chats.receive', function(data) { socket.on('event:chats.receive', function(data) {
var username = data.message.fromUser.username; var username = data.message.fromUser.username;
if(parseInt(data.message.fromUser.uid, 10) === parseInt(app.uid, 10)) { var isSelf = parseInt(data.message.fromUser.uid, 10) === parseInt(app.uid, 10);
if (isSelf) {
username = data.message.toUser.username; username = data.message.toUser.username;
} }
@ -70,17 +71,19 @@ define(['taskbar', 'string', 'sounds'], function(taskbar, S, sounds) {
module.toggleNew(modal.attr('UUID'), true); module.toggleNew(modal.attr('UUID'), true);
} }
if (!modal.is(":visible") || !app.isFocused) { if (!isSelf && (!modal.is(":visible") || !app.isFocused)) {
app.alternatingTitle(username + ' has messaged you'); app.alternatingTitle(username + ' has messaged you');
} }
} else { } else {
module.createModal(username, data.withUid, function(modal) { module.createModal(username, data.withUid, function(modal) {
module.toggleNew(modal.attr('UUID'), true); module.toggleNew(modal.attr('UUID'), true);
if (!isSelf) {
app.alternatingTitle(username + ' has messaged you'); app.alternatingTitle(username + ' has messaged you');
}
}); });
} }
if (parseInt(app.uid, 10) !== parseInt(data.message.fromuid, 10)) { if (!isSelf) {
sounds.play('chat-incoming'); sounds.play('chat-incoming');
} }
}); });

Loading…
Cancel
Save