From 5c36d646a5267098d98b404d4269940c020a6533 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Mon, 26 Aug 2013 21:31:30 +0200 Subject: [PATCH] Start desktop notification closing timeout only after they appeared. --- src/Monitoring/Unread.coffee | 7 ++++--- src/Posting/QR.coffee | 16 +++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index fdcbc7f16..6ccdf0244 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -104,9 +104,10 @@ Unread = notif.onclick = -> Header.scrollToPost post.nodes.root window.focus() - setTimeout -> - notif.close() - , 7 * $.SECOND + 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 cad8ea4b4..2091d9045 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -122,10 +122,11 @@ QR = # Firefox automatically closes notifications # so we can't control the onclose properly. notif.onclose = -> notice.close() - setTimeout -> - notif.onclose = null - notif.close() - , 7 * $.SECOND + notif.onshow = -> + setTimeout -> + notif.onclose = null + notif.close() + , 7 * $.SECOND <% } %> notifications: [] cleanNotifications: -> @@ -1108,9 +1109,10 @@ QR = QR.open() QR.captcha.nodes.input.focus() window.focus() - setTimeout -> - notif.close() - , 7 * $.SECOND + notif.onshow = -> + setTimeout -> + notif.close() + , 7 * $.SECOND unless Conf['Persistent QR'] or QR.cooldown.auto QR.close()