Add "defer" for inline Javascript

* Also utilize ECMAScript 6, 2015 syntax
This commit is contained in:
Andrew Chen Wang 2020-11-14 10:27:14 -05:00 committed by GitHub
parent 607c9676f5
commit 1fa5d79813
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,17 +62,17 @@
{% block inline_javascript %}
{{ block.super }}
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
var actions = document.getElementsByName('action_remove');
window.addEventListener('DOMContentLoaded',function() {
const message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
const actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {
if (! confirm(message)) {
if (!confirm(message)) {
e.preventDefault();
}
});
}
})();
});
$('.form-group').removeClass('row');
</script>