Work around SeaMonkey desktop notifications bug. #383

This commit is contained in:
ccd0 2015-06-28 19:33:47 -07:00
parent 456123fa70
commit 7edf0eda95
2 changed files with 27 additions and 23 deletions

View File

@ -127,16 +127,18 @@ Unread =
openNotification: (post) -> openNotification: (post) ->
return unless Header.areNotificationsEnabled return unless Header.areNotificationsEnabled
notif = new Notification "#{post.info.nameBlock} replied to you", # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey)
body: post.info.commentDisplay try
icon: Favicon.logo notif = new Notification "#{post.info.nameBlock} replied to you",
notif.onclick = -> body: post.info.commentDisplay
Header.scrollToIfNeeded post.nodes.root, true icon: Favicon.logo
window.focus() notif.onclick = ->
notif.onshow = -> Header.scrollToIfNeeded post.nodes.root, true
setTimeout -> window.focus()
notif.close() notif.onshow = ->
, 7 * $.SECOND setTimeout ->
notif.close()
, 7 * $.SECOND
onUpdate: (e) -> onUpdate: (e) ->
if !e.detail[404] if !e.detail[404]

View File

@ -196,19 +196,21 @@ QR =
unless Header.areNotificationsEnabled unless Header.areNotificationsEnabled
alert el.textContent if d.hidden and not QR.cooldown.auto alert el.textContent if d.hidden and not QR.cooldown.auto
else if d.hidden or not (focusOverride or d.hasFocus()) else if d.hidden or not (focusOverride or d.hasFocus())
notif = new Notification el.textContent, # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey)
body: el.textContent try
icon: Favicon.logo notif = new Notification el.textContent,
notif.onclick = -> window.focus() body: el.textContent
if chrome? icon: Favicon.logo
# Firefox automatically closes notifications notif.onclick = -> window.focus()
# so we can't control the onclose properly. if chrome?
notif.onclose = -> notice.close() # Firefox automatically closes notifications
notif.onshow = -> # so we can't control the onclose properly.
setTimeout -> notif.onclose = -> notice.close()
notif.onclose = null notif.onshow = ->
notif.close() setTimeout ->
, 7 * $.SECOND notif.onclose = null
notif.close()
, 7 * $.SECOND
notifications: [] notifications: []