From 7edf0eda957fe06e5864f58f0f9bb18a41350a69 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 28 Jun 2015 19:33:47 -0700 Subject: [PATCH] Work around SeaMonkey desktop notifications bug. #383 --- src/Monitoring/Unread.coffee | 22 ++++++++++++---------- src/Posting/QR.coffee | 28 +++++++++++++++------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 80a296297..e3c7a0c5f 100755 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -127,16 +127,18 @@ Unread = openNotification: (post) -> return unless Header.areNotificationsEnabled - notif = new Notification "#{post.info.nameBlock} replied to you", - body: post.info.commentDisplay - icon: Favicon.logo - notif.onclick = -> - Header.scrollToIfNeeded post.nodes.root, true - window.focus() - notif.onshow = -> - setTimeout -> - notif.close() - , 7 * $.SECOND + # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey) + try + notif = new Notification "#{post.info.nameBlock} replied to you", + body: post.info.commentDisplay + icon: Favicon.logo + notif.onclick = -> + Header.scrollToIfNeeded post.nodes.root, true + window.focus() + notif.onshow = -> + setTimeout -> + notif.close() + , 7 * $.SECOND onUpdate: (e) -> if !e.detail[404] diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 9bb9877b2..974b18e07 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -196,19 +196,21 @@ QR = unless Header.areNotificationsEnabled alert el.textContent if d.hidden and not QR.cooldown.auto else if d.hidden or not (focusOverride or d.hasFocus()) - notif = new Notification el.textContent, - body: el.textContent - icon: Favicon.logo - notif.onclick = -> window.focus() - if chrome? - # Firefox automatically closes notifications - # so we can't control the onclose properly. - notif.onclose = -> notice.close() - notif.onshow = -> - setTimeout -> - notif.onclose = null - notif.close() - , 7 * $.SECOND + # XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1130502 (SeaMonkey) + try + notif = new Notification el.textContent, + body: el.textContent + icon: Favicon.logo + notif.onclick = -> window.focus() + if chrome? + # Firefox automatically closes notifications + # so we can't control the onclose properly. + notif.onclose = -> notice.close() + notif.onshow = -> + setTimeout -> + notif.onclose = null + notif.close() + , 7 * $.SECOND notifications: []