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) ->
|
addPostQuotingYou: (post) ->
|
||||||
return unless QR.db
|
return unless QR.db
|
||||||
for quotelink in post.nodes.quotelinks
|
for quotelink in post.nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
|
||||||
if QR.db.get Get.postDataFromLink quotelink
|
Unread.postsQuotingYou.push post
|
||||||
Unread.postsQuotingYou.push post
|
Unread.openNotification post
|
||||||
return
|
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) ->
|
onUpdate: (e) ->
|
||||||
if e.detail[404]
|
if e.detail[404]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user