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
|
setTimeout @close, @timeout * $.SECOND if @timeout
|
||||||
|
|
||||||
close: =>
|
close: =>
|
||||||
|
$.off d, 'visibilitychange', @add
|
||||||
$.rm @el
|
$.rm @el
|
||||||
|
|||||||
@ -111,8 +111,17 @@ QR =
|
|||||||
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
|
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
|
||||||
# Focus the captcha input on captcha error.
|
# Focus the captcha input on captcha error.
|
||||||
QR.captcha.nodes.input.focus()
|
QR.captcha.nodes.input.focus()
|
||||||
alert el.textContent if d.hidden
|
notice = new Notice 'warning', el
|
||||||
QR.notifications.push 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: []
|
notifications: []
|
||||||
cleanNotifications: ->
|
cleanNotifications: ->
|
||||||
for notification in QR.notifications
|
for notification in QR.notifications
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user