From 2824f3cde45909ed8c32a0ff21815643fc48a1d6 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 14 Mar 2015 10:50:35 -0700 Subject: [PATCH] QR notification fixes. --- src/Posting/QR.coffee | 32 ++++++++++++++------------------ src/Posting/QR.post.coffee | 2 +- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index e61499952..3f6fbeedc 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -170,7 +170,7 @@ QR = QR.setCustomCooldown enabled $.set 'customCooldownEnabled', enabled - error: (err) -> + error: (err, focusOverride) -> QR.open() if typeof err is 'string' el = $.tn err @@ -179,28 +179,24 @@ QR = el.removeAttribute 'style' if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent QR.captcha.setup true - QR.notify el - alert el.textContent if d.hidden and not QR.cooldown.auto - - notify: (el) -> notice = new Notice 'warning', el - unless Header.areNotificationsEnabled and d.hidden - QR.notifications.push notice - else + QR.notifications.push notice + 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 (type === 'crx') { %> - # 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 - <% } %> + 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: [] diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index de322ef08..7f96fdcba 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -170,7 +170,7 @@ QR.post = class e.stopPropagation() @rm() if @ in QR.posts $.on rmAll, 'click', QR.post.rmErrored - QR.error div + QR.error div, true fileError: (message) -> @error 'file-error', "#{@filename}: #{message}"