forked from Squatconf/Website
added Sending... progress indicator (to email submission)
This commit is contained in:
parent
f620653e86
commit
18686d5023
20
src/email.js
20
src/email.js
|
@ -21,12 +21,22 @@ process.nextTick(function() {
|
|||
if (input_email && input_email.value) {
|
||||
var is_valid = check_email(input_email.value)
|
||||
if (is_valid) {
|
||||
status_msg.className = 'info'
|
||||
status_msg.innerHTML = "Got it, thanks"
|
||||
setTimeout(function() { form.submit() }, 600)
|
||||
} else {
|
||||
input_email.value = ''
|
||||
var progress = 0
|
||||
, timerID = null
|
||||
e.preventDefault()
|
||||
status_msg.className = 'info'
|
||||
status_msg.innerHTML = "Sending"
|
||||
timerID = setInterval(function() {
|
||||
if (++progress < 8) {
|
||||
status_msg.innerHTML += "."
|
||||
} else {
|
||||
clearInterval(timerID)
|
||||
form.submit()
|
||||
}
|
||||
}, 150)
|
||||
} else {
|
||||
e.preventDefault()
|
||||
input_email.value = ''
|
||||
status_msg.className = 'error'
|
||||
status_msg.innerHTML = "that doesn't look like an email address,"
|
||||
+ "<br />please try again..."
|
||||
|
|
Loading…
Reference in a new issue