diff --git a/fishroom/web/chat_log.html b/fishroom/web/chat_log.html index 9b1399d..8a9c237 100644 --- a/fishroom/web/chat_log.html +++ b/fishroom/web/chat_log.html @@ -125,6 +125,21 @@

Loading ...

msg.id = fishLogData.current_id; fishLogData.current_id++; fishLogData.msgs.push(msg); + // Notification sending... + var notification_title = 'New message from ' + msg.sender; + if ('Notification' in window) { + if (Notification.permission === 'granted') { + var notification = new Notification(notification_title); + } + + else if (Notification.permission !== 'denied') { + Notification.requestPermission(function (permission) { + if (permission === 'granted') { + var notification = new Notification(notification_title); + } + }); + } + } } var fetchLog = function(limit, lastId, scrollDown) {