Short opacity transition when adding notifications. #932

This commit is contained in:
Nicolas Stepien 2013-03-10 22:02:30 +01:00
parent 7a6dcb5f73
commit 818d78380e
3 changed files with 8 additions and 2 deletions

View File

@ -1127,6 +1127,7 @@
this.el = $.el('div', {
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
});
this.el.style.opacity = 0;
this.setType(type);
$.on(this.el.firstElementChild, 'click', this.close);
if (typeof content === 'string') {
@ -1147,6 +1148,8 @@
}
$.off(d, 'visibilitychange', this.add);
$.add($.id('notifications'), this.el);
this.el.clientHeight;
this.el.style.opacity = 1;
if (this.timeout) {
return setTimeout(this.close, this.timeout * $.SECOND);
}
@ -6964,7 +6967,7 @@
if (err) {
if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') {
if (/mistyped/i.test(err.textContent)) {
err = 'Error: You seem to have mistyped the CAPTCHA.';
err = 'You seem to have mistyped the CAPTCHA.';
}
QR.cooldown.auto = QR.captcha.isEnabled ? !!QR.captcha.captchas.length : err === 'Connection error with sys.4chan.org.' ? true : false;
QR.cooldown.set({

View File

@ -96,6 +96,7 @@ class Notification
@el = $.el 'div',
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
@el.style.opacity = 0
@setType type
$.on @el.firstElementChild, 'click', @close
if typeof content is 'string'
@ -113,6 +114,8 @@ class Notification
return
$.off d, 'visibilitychange', @add
$.add $.id('notifications'), @el
@el.clientHeight # force reflow
@el.style.opacity = 1
setTimeout @close, @timeout * $.SECOND if @timeout
close = ->

View File

@ -927,7 +927,7 @@ QR =
if /captcha|verification/i.test(err.textContent) or err is 'Connection error with sys.4chan.org.'
# Remove the obnoxious 4chan Pass ad.
if /mistyped/i.test err.textContent
err = 'Error: You seem to have mistyped the CAPTCHA.'
err = 'You seem to have mistyped the CAPTCHA.'
# Enable auto-post if we have some cached captchas.
QR.cooldown.auto = if QR.captcha.isEnabled
!!QR.captcha.captchas.length