Commit da3e84ec authored by keshav.k's avatar keshav.k Committed by Jakob Perry
Browse files

Issue #3170158 by keshav.k, amietpatial: Add loader when user click on New...

Issue #3170158 by keshav.k, amietpatial: Add loader when user click on New captcha link, Because it takes time to load the captcha
parent aa9e22f7
...@@ -15,3 +15,6 @@ image-captcha-refresh: ...@@ -15,3 +15,6 @@ image-captcha-refresh:
version: 1.0 version: 1.0
js: js:
js/image_captcha_refresh.js: {} js/image_captcha_refresh.js: {}
css:
theme:
image_captcha_refresh.css: {}
.image_captcha_refresh_loader {
border: 5px solid #f3f3f3;
border-radius: 50%;
border-top: 5px solid #000;
width: 30px;
height: 30px;
-webkit-animation: image_captcha_refresh_spin 1s linear infinite;
animation: image_captcha_refresh_spin 1s linear infinite;
position: absolute;
left: 0;
right: 0;
margin: auto;
top: 0;
bottom: 0;
}
/* Safari */
@-webkit-keyframes image_captcha_refresh_spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes image_captcha_refresh_spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.captcha {
position: relative;
}
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
var date = new Date(); var date = new Date();
var baseUrl = document.location.origin; var baseUrl = document.location.origin;
var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime(); var url = baseUrl + '/' + $(this).attr('href') + '?' + date.getTime();
// Adding loader.
$('.captcha').append('<div class="image_captcha_refresh_loader"></div>');
$.get( $.get(
url, url,
{}, {},
...@@ -32,6 +34,7 @@ ...@@ -32,6 +34,7 @@
$('.captcha', $form).find('img').attr('src', response.data.url); $('.captcha', $form).find('img').attr('src', response.data.url);
$('input[name=captcha_sid]', $form).val(response.data.sid); $('input[name=captcha_sid]', $form).val(response.data.sid);
$('input[name=captcha_token]', $form).val(response.data.token); $('input[name=captcha_token]', $form).val(response.data.token);
$('.captcha .image_captcha_refresh_loader').remove();
} }
else { else {
alert(response.message); alert(response.message);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment