Show a desktop notification for 5 seconds when someone replies to you.
Close #971.
This commit is contained in:
parent
36dfe49031
commit
e539c35a53
@ -91,10 +91,24 @@ Unread =
|
||||
|
||||
addPostQuotingYou: (post) ->
|
||||
return unless QR.db
|
||||
for quotelink in post.nodes.quotelinks
|
||||
if QR.db.get Get.postDataFromLink quotelink
|
||||
Unread.postsQuotingYou.push post
|
||||
return
|
||||
for quotelink in post.nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
|
||||
Unread.postsQuotingYou.push post
|
||||
Unread.openNotification post
|
||||
return
|
||||
openNotification: (post) ->
|
||||
return unless d.hidden
|
||||
name = if Conf['Anonymize']
|
||||
'Anonymous'
|
||||
else
|
||||
$('.nameBlock', post.nodes.info).textContent.trim()
|
||||
notif = new Notification "#{name} replied to you.",
|
||||
body: post.info.comment
|
||||
notif.onclick = ->
|
||||
Header.scrollToPost post.nodes.root
|
||||
window.focus()
|
||||
setTimeout ->
|
||||
notif.close()
|
||||
, 5 * $.SECOND
|
||||
|
||||
onUpdate: (e) ->
|
||||
if e.detail[404]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user