mirror of
				https://github.com/nerzhul/ocsms.git
				synced 2025-10-28 00:49:11 +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
					
				
							
								
								
									
										15
									
								
								js/script.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								js/script.js
									
									
									
									
									
								
							| @ -16,6 +16,7 @@ var curContactName = ''; | |||||||
| var lastMsgDate = 0; | var lastMsgDate = 0; | ||||||
| var unreadCountCurrentConv = 0; | var unreadCountCurrentConv = 0; | ||||||
| var unreadCountAllConv = 0; | var unreadCountAllConv = 0; | ||||||
|  | var unreadCountNotifStep = 12; | ||||||
| var originalTitle = document.title; | var originalTitle = document.title; | ||||||
| 
 | 
 | ||||||
| $.urlParam = function(name){ | $.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) { | 			if (unreadCountAllConv > 0) { | ||||||
|  | 				// We notify user every two minutes for all messages
 | ||||||
|  | 				if (unreadCountNotifStep == 0) { | ||||||
| 					desktopNotify(unreadCountAllConv + " unread message(s) for all conversations"); | 					desktopNotify(unreadCountAllConv + " unread message(s) for all conversations"); | ||||||
|  | 					unreadCountNotifStep = 12; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	); | 	); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user