diff --git a/src/General/Notice.coffee b/src/General/Notice.coffee index d0624a3a4..60b46ff77 100644 --- a/src/General/Notice.coffee +++ b/src/General/Notice.coffee @@ -25,4 +25,5 @@ class Notice setTimeout @close, @timeout * $.SECOND if @timeout close: => + $.off d, 'visibilitychange', @add $.rm @el diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 03f178910..da7130e04 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -111,8 +111,17 @@ QR = if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent # Focus the captcha input on captcha error. QR.captcha.nodes.input.focus() - alert el.textContent if d.hidden - QR.notifications.push new Notice 'warning', el + notice = new Notice 'warning', el + QR.notifications.push notice + return unless d.hidden + notif = new Notification el.textContent, + iconUrl: Favicon.empty + notif.onclick = -> window.focus() + notif.onclose = -> notice.close() + setTimeout -> + notif.onclose = null + notif.close() + , 5 * $.SECOND notifications: [] cleanNotifications: -> for notification in QR.notifications