misc: prevent double click in display_message_and_continue.html (#60815)

This commit is contained in:
Benjamin Dauvergne 2022-01-19 13:13:52 +01:00
parent ecec41b67a
commit 35bf68f922
1 changed files with 15 additions and 3 deletions

View File

@ -7,9 +7,21 @@
</div>
{% if only_info %}
<script>
window.setTimeout(function () {
document.getElementById('a2-continue').click();
}, 3000);
$(function () {
var $a2_continue = $('#a2-continue');
var clicked = false;
$a2_continue.on('click', function (event) {
if (! clicked) {
# prevent double click for 3 seconds
clicked = true;
window.setTimeout(function () { clicked = false; }, 3000);
} else {
event.preventDefault();
}
});
# automatic click after 3 seconds
window.setTimeout(function () { if (!clicked) { $a2_continue.click(); } }, 3000);
});
</script>
{% endif %}
{% endblock %}