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