Skip to content

Commit 68c0aaf

Browse files
committed
Merge branch 'b-7.3.x-captcha-improvments-OXDEV-8662' into b-7.3.x
2 parents d6eca92 + d3f2351 commit 68c0aaf

145 files changed

Lines changed: 296 additions & 75 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 54 additions & 28 deletions

assets/out/src/css/captcha-form.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
flex-direction: row;
2424
align-items: center;
2525
}
26+
.captcha-img {
27+
transition: transform .2s;
28+
}
29+
.captcha-img:hover {
30+
transform: scale(2);
31+
}
2632

2733
.image-captcha .col-md-6 {
2834
flex: 1;

assets/out/src/js/index.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ document.querySelectorAll('.password-toggle').forEach((el) => {
3434
});
3535

3636
document.querySelectorAll('.captcha-reload').forEach((el) => {
37-
el.addEventListener('click', function() {
38-
new CaptchaRefresh({
39-
url: document.getElementById('captcha').getAttribute('data-url')
40-
})
41-
});
37+
new CaptchaRefresh({
38+
url: document.getElementById('captcha').getAttribute('data-url'),
39+
fieldTarget: el
40+
})
4241
});
4342

4443
document.querySelectorAll('.captcha-play').forEach((el) => {
45-
el.addEventListener('click', function() {
46-
new CaptchaAudio({
47-
url: document.getElementById('captcha').getAttribute('data-url-audio')
48-
})
49-
});
44+
new CaptchaAudio({
45+
url: document.getElementById('captcha').getAttribute('data-url-audio'),
46+
fieldTarget: el
47+
})
5048
});

assets/out/src/js/module/captcha-audio.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,23 @@
66
export class CaptchaAudio {
77
constructor(options) {
88
this.url = options.url;
9+
this.fieldTarget = options.fieldTarget;
10+
this.delayInMilliseconds = 1000;
911

10-
this.ajaxRequest();
12+
this.registerEvents();
13+
}
14+
15+
registerEvents() {
16+
let self = this;
17+
let requestDelayTimeout;
18+
19+
this.fieldTarget.addEventListener('click', function() {
20+
if (typeof requestDelayTimeout === 'undefined' || requestDelayTimeout < Date.now()) {
21+
self.ajaxRequest();
22+
23+
requestDelayTimeout = Date.now() + self.delayInMilliseconds;
24+
}
25+
});
1126
}
1227

1328
ajaxRequest() {

assets/out/src/js/module/captcha-refresh.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,37 @@
66
export class CaptchaRefresh {
77
constructor(options) {
88
this.url = options.url;
9+
this.fieldTarget = options.fieldTarget;
10+
this.delayInMilliseconds = 1000;
911

10-
this.ajaxRequest();
12+
this.registerEvents();
13+
}
14+
15+
registerEvents() {
16+
let self = this;
17+
let requestDelayTimeout;
18+
19+
this.fieldTarget.addEventListener('click', function() {
20+
if (self.signal) {
21+
self.controller.abort();
22+
}
23+
24+
if (typeof requestDelayTimeout === 'undefined' || requestDelayTimeout < Date.now()) {
25+
self.ajaxRequest();
26+
27+
requestDelayTimeout = Date.now() + self.delayInMilliseconds;
28+
}
29+
});
1130
}
1231

1332
ajaxRequest() {
1433
let self = this;
34+
self.controller = new AbortController();
35+
self.signal = self.controller.signal;
1536

1637
fetch(this.url, {
17-
method: "GET"
38+
method: "GET",
39+
signal: self.signal,
1840
}).then(function(response) {
1941
return response.text();
2042
}).then(function(data) {

assets/sounds/de/lower/a.wav

345 KB
Binary file not shown.

assets/sounds/de/lower/b.wav

172 KB
Binary file not shown.

assets/sounds/de/lower/c.wav

172 KB
Binary file not shown.

assets/sounds/de/lower/d.wav

172 KB
Binary file not shown.

assets/sounds/de/lower/e.wav

172 KB
Binary file not shown.

0 commit comments

Comments
 (0)