mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 07:56:23 +00:00
Add steps for notify only every two minutes there is new messages in all conversations
This commit is contained in:
parent
9a67df98e6
commit
a0babdc613
17
js/script.js
17
js/script.js
@ -16,6 +16,7 @@ var curContactName = '';
|
||||
var lastMsgDate = 0;
|
||||
var unreadCountCurrentConv = 0;
|
||||
var unreadCountAllConv = 0;
|
||||
var unreadCountNotifStep = 12;
|
||||
var originalTitle = document.title;
|
||||
|
||||
$.urlParam = function(name){
|
||||
@ -113,8 +114,22 @@ var checkNewMessages = function() {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Decrement notification step counter, but stop it a zero
|
||||
* Stop at zero permit to notify instanly the user when
|
||||
* there is new messages in all conversations
|
||||
*/
|
||||
|
||||
if (unreadCountNotifStep > 0) {
|
||||
unreadCountNotifStep--;
|
||||
}
|
||||
|
||||
if (unreadCountAllConv > 0) {
|
||||
desktopNotify(unreadCountAllConv + " unread message(s) for all conversations");
|
||||
// We notify user every two minutes for all messages
|
||||
if (unreadCountNotifStep == 0) {
|
||||
desktopNotify(unreadCountAllConv + " unread message(s) for all conversations");
|
||||
unreadCountNotifStep = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user