Replace QR alerts with desktop notifications. #1053
This commit is contained in:
parent
c64792f35c
commit
253a4a8fbe
@ -25,4 +25,5 @@ class Notice
|
||||
setTimeout @close, @timeout * $.SECOND if @timeout
|
||||
|
||||
close: =>
|
||||
$.off d, 'visibilitychange', @add
|
||||
$.rm @el
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user