Browse Source

added Sending... progress indicator (to email submission)

2015
joates 8 years ago
parent
commit
18686d5023
  1. 16
      src/email.js

16
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) {
var progress = 0
, timerID = null
e.preventDefault()
status_msg.className = 'info'
status_msg.innerHTML = "Got it, thanks"
setTimeout(function() { form.submit() }, 600)
status_msg.innerHTML = "Sending"
timerID = setInterval(function() {
if (++progress < 8) {
status_msg.innerHTML += "."
} else {
clearInterval(timerID)
form.submit()
}
}, 150)
} else {
input_email.value = ''
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…
Cancel
Save