Skip to content

Commit 87bb1f3

Browse files
add fill animation on wp-login button while we wait
1 parent 3285dc7 commit 87bb1f3

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

includes/protect-wp-login.php

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
<?php
22

33
add_action('login_footer', function () {
4-
?><script>
5-
window.setTimeout(() => {
6-
let input = document.createElement('input');
7-
input.type = 'hidden';
8-
input.name = 'login-ok';
9-
input.value = '1';
10-
document.querySelector('#loginform').prepend(input);
11-
}, 3000);
4+
?><style>
5+
#wp-submit {
6+
background-color: #2271b1 !important;
7+
background-image: linear-gradient(to right, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.18)) !important;
8+
background-repeat: no-repeat !important;
9+
background-size: 0% 100% !important;
10+
border-color: #2271b1 !important;
11+
color: #fff !important;
12+
}
13+
14+
#wp-submit.waiting-animate {
15+
background-size: 100% 100% !important;
16+
transition: background-size 2.5s linear !important;
17+
}
18+
</style>
19+
<script>
20+
document.addEventListener('DOMContentLoaded', () => {
21+
let button = document.querySelector('#wp-submit');
22+
if (!button) {
23+
return;
24+
}
25+
requestAnimationFrame(() => {
26+
button.classList.add('waiting-animate');
27+
});
28+
29+
window.setTimeout(() => {
30+
let input = document.createElement('input');
31+
input.type = 'hidden';
32+
input.name = 'login-ok';
33+
input.value = '1';
34+
document.querySelector('#loginform').prepend(input);
35+
button.classList.remove('waiting-animate');
36+
}, 2500);
37+
})
38+
1239
</script><?php
1340
});
1441

0 commit comments

Comments
 (0)