|
|
@ -22,11 +22,12 @@ class CaptchaController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
refreshCaptchas() { |
|
|
|
refreshCaptchas(e) { |
|
|
|
if (this.refreshing) { |
|
|
|
if (this.refreshing) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
this.refreshing = true; |
|
|
|
this.refreshing = true; |
|
|
|
|
|
|
|
e && e.target.classList.add('spin'); |
|
|
|
document.cookie = 'captchaid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; |
|
|
|
document.cookie = 'captchaid=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; |
|
|
|
const xhr = new XMLHttpRequest(); |
|
|
|
const xhr = new XMLHttpRequest(); |
|
|
|
xhr.onload = () => { |
|
|
|
xhr.onload = () => { |
|
|
@ -37,9 +38,11 @@ class CaptchaController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.refreshing = false; |
|
|
|
this.refreshing = false; |
|
|
|
|
|
|
|
e && e.target.classList.remove('spin'); |
|
|
|
} |
|
|
|
} |
|
|
|
xhr.onerror = () => { |
|
|
|
xhr.onerror = () => { |
|
|
|
this.refreshing = false; |
|
|
|
this.refreshing = false; |
|
|
|
|
|
|
|
e && e.target.classList.remove('spin'); |
|
|
|
} |
|
|
|
} |
|
|
|
xhr.open('GET', '/captcha', true); |
|
|
|
xhr.open('GET', '/captcha', true); |
|
|
|
xhr.send(null); |
|
|
|
xhr.send(null); |
|
|
@ -59,7 +62,7 @@ class CaptchaController { |
|
|
|
const captchaImg = document.createElement('img'); |
|
|
|
const captchaImg = document.createElement('img'); |
|
|
|
const refreshDiv = document.createElement('div'); |
|
|
|
const refreshDiv = document.createElement('div'); |
|
|
|
refreshDiv.classList.add('captcharefresh', 'noselect'); |
|
|
|
refreshDiv.classList.add('captcharefresh', 'noselect'); |
|
|
|
refreshDiv.addEventListener('click', () => this.refreshCaptchas(), true); |
|
|
|
refreshDiv.addEventListener('click', (e) => this.refreshCaptchas(e), true); |
|
|
|
refreshDiv.textContent = '↻'; |
|
|
|
refreshDiv.textContent = '↻'; |
|
|
|
field.placeholder = 'loading'; |
|
|
|
field.placeholder = 'loading'; |
|
|
|
captchaImg.src = '/captcha'; |
|
|
|
captchaImg.src = '/captcha'; |
|
|
|