better affordance on captcha refresh icon

merge-requests/208/head
Thomas Lynch 4 years ago
parent 546582b54e
commit 9b01ba2657
  1. 24
      gulp/res/css/style.css
  2. 7
      gulp/res/js/captcha.js

@ -516,6 +516,19 @@ td, th {
display: inline-block;
}
.spin {
animation: spin 1s infinite linear;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes pulsate {
0% {
opacity: 1;
@ -1029,22 +1042,15 @@ iframe.bypass {
}
.captcharefresh {
line-height: 18px;
position: absolute;
bottom: 0;
bottom: 5px;
left: 5px;
font-size: 18px;
cursor: pointer;
color: black;
}
.captcharefresh {
position: absolute;
bottom: 0;
left: 5px;
font-size: 18px;
cursor: pointer;
}
.label, .rlabel {
padding: 3px;
border: 1px solid var(--box-border-color);

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

Loading…
Cancel
Save