From de12b495273ce69c47c40c62ff966f6c4c56e75a Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Sun, 10 Dec 2023 14:56:15 +0100 Subject: [PATCH] [CHANGE] JS updated to ES8+ standard where ever possible --- .../templates/authentication/tokens.html | 52 +++++---- .../templates/corputils/corpstats.html | 64 +++++------ .../corputils/templates/corputils/search.html | 18 +-- .../fatlinkstatisticscorpview.html | 12 +- .../fatlinkstatisticsview.html | 12 +- .../templates/groupmanagement/audit.html | 104 +++++++++--------- .../groupmanagement/groupmembers.html | 32 +++--- .../templates/groupmanagement/groups.html | 13 ++- allianceauth/srp/templates/srp/data.html | 17 +-- .../static/allianceauth/js/eve-time.js | 14 ++- .../js/refresh-notification-icon.js | 14 +-- .../allianceauth/js/refresh_notifications.js | 71 +++++++----- allianceauth/static/allianceauth/js/timers.js | 16 +-- 13 files changed, 231 insertions(+), 208 deletions(-) diff --git a/allianceauth/authentication/templates/authentication/tokens.html b/allianceauth/authentication/templates/authentication/tokens.html index 801c3f8c..601bf026 100644 --- a/allianceauth/authentication/templates/authentication/tokens.html +++ b/allianceauth/authentication/templates/authentication/tokens.html @@ -34,32 +34,36 @@ {% block extra_javascript %} {% include "bundles/datatables-js-bs5.html" %} + + {% endblock extra_javascript %} {% block extra_css %} {% include "bundles/datatables-css-bs5.html" %} {% endblock extra_css %} - -{% block extra_script %} - $(document).ready(function(){ - let grp = 2; - var table = $('#table_tokens').DataTable({ - "columnDefs": [{ orderable: false, targets: [0,1] },{ "visible": false, "targets": grp }], - "order": [[grp, 'asc']], - "drawCallback": function (settings) { - var api = this.api(); - var rows = api.rows({ page: 'current' }).nodes(); - var last = null; - api.column(grp, { page: 'current' }) - .data() - .each(function (group, i) { - if (last !== group) { - $(rows).eq(i).before('' + group + ''); - last = group; - } - }); - }, - "stateSave": true, - }); - }); -{% endblock extra_script %} diff --git a/allianceauth/corputils/templates/corputils/corpstats.html b/allianceauth/corputils/templates/corputils/corpstats.html index 7ef11c98..393d58cc 100644 --- a/allianceauth/corputils/templates/corputils/corpstats.html +++ b/allianceauth/corputils/templates/corputils/corpstats.html @@ -234,40 +234,40 @@ {% block extra_javascript %} {% include 'bundles/datatables-js-bs5.html' %} + + {% endblock %} {% block extra_css %} {% include 'bundles/datatables-css-bs5.html' %} {% endblock %} - -{% block extra_script %} - $(document).ready(() => { - $('#table-mains').DataTable({ - "columnDefs": [ - { "sortable": false, "targets": [1] }, - ], - "stateSave": true, - "stateDuration": 0 - }); - - $('#table-members').DataTable({ - "columnDefs": [ - { "searchable": false, "targets": [0, 2] }, - { "sortable": false, "targets": [0, 2] }, - ], - "order": [[ 1, "asc" ]], - "stateSave": true, - "stateDuration": 0 - }); - - $('#table-unregistered').DataTable({ - "columnDefs": [ - { "searchable": false, "targets": [0, 2] }, - { "sortable": false, "targets": [0, 2] }, - ], - "order": [[ 1, "asc" ]], - "stateSave": true, - "stateDuration": 0 - }); - }); -{% endblock %} diff --git a/allianceauth/corputils/templates/corputils/search.html b/allianceauth/corputils/templates/corputils/search.html index 94781013..8a100304 100644 --- a/allianceauth/corputils/templates/corputils/search.html +++ b/allianceauth/corputils/templates/corputils/search.html @@ -41,17 +41,17 @@ {% block extra_javascript %} {% include 'bundles/datatables-js-bs5.html' %} + + {% endblock %} {% block extra_css %} {% include 'bundles/datatables-css-bs5.html' %} {% endblock %} - -{% block extra_script %} - $(document).ready(() => { - $('#table-search').DataTable({ - "stateSave": true, - "stateDuration": 0 - }); - }); -{% endblock %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html index b6948c57..3132d889 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html @@ -54,8 +54,10 @@ {% endblock content %} -{% block extra_script %} - $(document).ready(() => { - $("[rel=tooltip]").tooltip(); - }); -{% endblock extra_script %} +{% block extra_javascript %} + +{% endblock extra_javascript %} diff --git a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html index daec850d..f48a1d64 100644 --- a/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html +++ b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html @@ -58,8 +58,10 @@ {% endblock content %} -{% block extra_script %} - $(document).ready(() => { - $("[rel=tooltip]").tooltip(); - }); -{% endblock extra_script %} +{% block extra_javascript %} + +{% endblock extra_javascript %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/audit.html b/allianceauth/groupmanagement/templates/groupmanagement/audit.html index d22f72e2..a61d8afa 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/audit.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/audit.html @@ -66,60 +66,60 @@ {% include 'bundles/datatables-js-bs5.html' %} {% include 'bundles/moment-js.html' with locale=True %} {% include 'bundles/filterdropdown-js.html' %} + + {% endblock %} {% block extra_css %} {% include 'bundles/datatables-css-bs5.html' %} {% endblock %} - -{% block extra_script %} - $.fn.dataTable.moment = function(format, locale) { - let types = $.fn.dataTable.ext.type; - - // Add type detection - types.detect.unshift(function(d) { - return moment(d, format, locale, true).isValid() ? - 'moment-'+format : - null; - }); - - // Add sorting method - use an integer for the sorting - types.order[ 'moment-'+format+'-pre' ] = function(d) { - return moment(d, format, locale, true).unix(); - }; - }; - - $(document).ready(function(){ - $.fn.dataTable.moment('YYYY-MMM-D, HH:mm'); - - $('#log-entries').DataTable({ - order: [[0, 'desc'], [1, 'asc']], - filterDropDown: - { - columns: [ - { - idx: 1 - }, - { - idx: 2 - }, - { - idx: 3 - }, - { - idx: 4 - }, - { - idx: 5 - }, - { - idx: 6 - } - ], - bootstrap: true - }, - "stateSave": true, - "stateDuration": 0 - }); - }); -{% endblock %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html b/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html index 9cad2137..fffd8f4e 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groupmembers.html @@ -77,24 +77,24 @@ {% block extra_javascript %} {% include 'bundles/datatables-js-bs5.html' %} + + {% endblock %} {% block extra_css %} {% include 'bundles/datatables-css-bs5.html' %} {% endblock %} - -{% block extra_script %} - $(document).ready(function(){ - $('#tab_group_members').DataTable({ - order: [[0, "asc"]], - columnDefs: [ - { - "sortable": false, - "targets": [2] - }, - ], - "stateSave": true, - "stateDuration": 0 - }); - }); -{% endblock %} diff --git a/allianceauth/groupmanagement/templates/groupmanagement/groups.html b/allianceauth/groupmanagement/templates/groupmanagement/groups.html index 6284f65f..f06275b2 100644 --- a/allianceauth/groupmanagement/templates/groupmanagement/groups.html +++ b/allianceauth/groupmanagement/templates/groupmanagement/groups.html @@ -78,16 +78,17 @@ {% endif %} {% endblock content %} + {% block extra_javascript %} {% include 'bundles/datatables-js-bs5.html' %} + + {% endblock %} {% block extra_css %} {% include 'bundles/datatables-css-bs5.html' %} {% endblock %} - -{% block extra_script %} - $(document).ready(function () { - $('#groupsTable').DataTable(); - }); -{% endblock extra_script %} diff --git a/allianceauth/srp/templates/srp/data.html b/allianceauth/srp/templates/srp/data.html index 5bb57a29..a1552bf8 100644 --- a/allianceauth/srp/templates/srp/data.html +++ b/allianceauth/srp/templates/srp/data.html @@ -163,7 +163,8 @@ ESC to cancel{% endblocktranslate %}" id="blah">