This commit is contained in:
seaweedchan 2013-09-22 04:40:37 -07:00
parent 6d4da42eb2
commit 93589e80ef
3 changed files with 49 additions and 48 deletions

View File

@ -4924,7 +4924,7 @@
} }
if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) {
QR.captcha.nodes.input.focus(); QR.captcha.nodes.input.focus();
if (Conf['Captcha Warning Notifications']) { if (Conf['Captcha Warning Notifications'] && !d.hidden) {
QR.notify(el); QR.notify(el);
} else { } else {
$.addClass(QR.captcha.nodes.input, 'error'); $.addClass(QR.captcha.nodes.input, 'error');
@ -4942,17 +4942,17 @@
notify: function(el) { notify: function(el) {
var notice, notif; var notice, notif;
notice = new Notice('warning', el); notice = new Notice('warning', el);
QR.notifications.push(notice); if (!(Header.areNotificationsEnabled && d.hidden)) {
if (!Header.areNotificationsEnabled) { return QR.notifications.push(notice);
return; } else {
notif = new Notification(el.textContent, {
body: el.textContent,
icon: Favicon.logo
});
return notif.onclick = function() {
return window.focus();
};
} }
notif = new Notification(el.textContent, {
body: el.textContent,
icon: Favicon.logo
});
return notif.onclick = function() {
return window.focus();
};
}, },
notifications: [], notifications: [],
cleanNotifications: function() { cleanNotifications: function() {

View File

@ -4927,7 +4927,7 @@
} }
if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) {
QR.captcha.nodes.input.focus(); QR.captcha.nodes.input.focus();
if (Conf['Captcha Warning Notifications']) { if (Conf['Captcha Warning Notifications'] && !d.hidden) {
QR.notify(el); QR.notify(el);
} else { } else {
$.addClass(QR.captcha.nodes.input, 'error'); $.addClass(QR.captcha.nodes.input, 'error');
@ -4945,26 +4945,26 @@
notify: function(el) { notify: function(el) {
var notice, notif; var notice, notif;
notice = new Notice('warning', el); notice = new Notice('warning', el);
QR.notifications.push(notice); if (!(Header.areNotificationsEnabled && d.hidden)) {
if (!Header.areNotificationsEnabled) { return QR.notifications.push(notice);
return; } else {
notif = new Notification(el.textContent, {
body: el.textContent,
icon: Favicon.logo
});
notif.onclick = function() {
return window.focus();
};
notif.onclose = function() {
return notice.close();
};
return notif.onshow = function() {
return setTimeout(function() {
notif.onclose = null;
return notif.close();
}, 7 * $.SECOND);
};
} }
notif = new Notification(el.textContent, {
body: el.textContent,
icon: Favicon.logo
});
notif.onclick = function() {
return window.focus();
};
notif.onclose = function() {
return notice.close();
};
return notif.onshow = function() {
return setTimeout(function() {
notif.onclose = null;
return notif.close();
}, 7 * $.SECOND);
};
}, },
notifications: [], notifications: [],
cleanNotifications: function() { cleanNotifications: function() {

View File

@ -141,7 +141,7 @@ 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()
if Conf['Captcha Warning Notifications'] if Conf['Captcha Warning Notifications'] and !d.hidden
QR.notify el QR.notify el
else else
$.addClass QR.captcha.nodes.input, 'error' $.addClass QR.captcha.nodes.input, 'error'
@ -153,22 +153,23 @@ QR =
notify: (el) -> notify: (el) ->
notice = new Notice 'warning', el notice = new Notice 'warning', el
QR.notifications.push notice unless Header.areNotificationsEnabled and d.hidden
return unless Header.areNotificationsEnabled QR.notifications.push notice
notif = new Notification el.textContent, else
body: el.textContent notif = new Notification el.textContent,
icon: Favicon.logo body: el.textContent
notif.onclick = -> window.focus() icon: Favicon.logo
<% if (type === 'crx') { %> notif.onclick = -> window.focus()
# Firefox automatically closes notifications <% if (type === 'crx') { %>
# so we can't control the onclose properly. # Firefox automatically closes notifications
notif.onclose = -> notice.close() # so we can't control the onclose properly.
notif.onshow = -> notif.onclose = -> notice.close()
setTimeout -> notif.onshow = ->
notif.onclose = null setTimeout ->
notif.close() notif.onclose = null
, 7 * $.SECOND notif.close()
<% } %> , 7 * $.SECOND
<% } %>
notifications: [] notifications: []
cleanNotifications: -> cleanNotifications: ->