QR notification fixes.

This commit is contained in:
ccd0 2015-03-14 10:50:35 -07:00
parent 29afe88625
commit 2824f3cde4
2 changed files with 15 additions and 19 deletions

View File

@ -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,19 +179,16 @@ 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
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') { %>
if chrome?
# Firefox automatically closes notifications
# so we can't control the onclose properly.
notif.onclose = -> notice.close()
@ -200,7 +197,6 @@ QR =
notif.onclose = null
notif.close()
, 7 * $.SECOND
<% } %>
notifications: []

View File

@ -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}"