mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-12-06 21:01:42 +01:00
[CHANGE] Move inline JS into $(document).ready(()) block
This commit is contained in:
parent
464016ac05
commit
b1f5aad9f9
@ -65,6 +65,7 @@
|
|||||||
{% include 'bundles/timers-js.html' %}
|
{% include 'bundles/timers-js.html' %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(() => {
|
||||||
// Data
|
// Data
|
||||||
const timers = [
|
const timers = [
|
||||||
{% for op in optimer %}
|
{% for op in optimer %}
|
||||||
@ -143,5 +144,6 @@
|
|||||||
|
|
||||||
// Start timed updates
|
// Start timed updates
|
||||||
setInterval(timedUpdate, 1000);
|
setInterval(timedUpdate, 1000);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,29 +1,32 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
<div id="esi-alert" class="col-12 collapse">
|
<div id="esi-alert" class="col-12 collapse">
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<p class="text-center ">{% translate 'Your Server received an ESI error response code of ' %}<b id="esi-code">?</b></p>
|
<p class="text-center ">{% translate 'Your Server received an ESI error response code of ' %}<b id="esi-code">?</b></p>
|
||||||
<hr>
|
<hr>
|
||||||
<pre id="esi-data" class="text-center text-wrap"></pre>
|
<pre id="esi-data" class="text-center text-wrap"></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const elemCard = document.getElementById('esi-alert');
|
$(document).ready(() => {
|
||||||
const elemMessage = document.getElementById('esi-data');
|
const elements = {
|
||||||
const elemCode = document.getElementById('esi-code');
|
card: document.getElementById('esi-alert'),
|
||||||
|
message: document.getElementById('esi-data'),
|
||||||
|
code: document.getElementById('esi-code')
|
||||||
|
};
|
||||||
|
|
||||||
fetchGet({url: '{% url "authentication:esi_check" %}'})
|
fetchGet({url: '{% url "authentication:esi_check" %}'})
|
||||||
.then((data) => {
|
.then(({status, data}) => {
|
||||||
console.log('ESI Check: ', JSON.stringify(data, null, 2));
|
console.log('ESI Check:', JSON.stringify({status, data}, null, 2));
|
||||||
|
|
||||||
if (data.status !== 200) {
|
if (status !== 200) {
|
||||||
elemCode.textContent = data.status;
|
elements.code.textContent = status;
|
||||||
elemMessage.textContent = data.data.error;
|
elements.message.textContent = data.error;
|
||||||
|
|
||||||
new bootstrap.Collapse(elemCard, {toggle: true});
|
new bootstrap.Collapse(elements.card, {toggle: true});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => console.error('Error fetching ESI check:', error));
|
||||||
console.error('Error fetching ESI check:', error);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
|
|||||||
@ -96,6 +96,7 @@
|
|||||||
{% get_datatables_language_static LANGUAGE_CODE as DT_LANG_PATH %}
|
{% get_datatables_language_static LANGUAGE_CODE as DT_LANG_PATH %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(() => {
|
||||||
const timers = [
|
const timers = [
|
||||||
{% for timer in timers %}
|
{% for timer in timers %}
|
||||||
{
|
{
|
||||||
@ -175,7 +176,6 @@
|
|||||||
// Start timed updates
|
// Start timed updates
|
||||||
setInterval(timedUpdate, 1000);
|
setInterval(timedUpdate, 1000);
|
||||||
|
|
||||||
$(document).ready(() => {
|
|
||||||
const dtOptions = {
|
const dtOptions = {
|
||||||
language: {url: '{{ DT_LANG_PATH }}'},
|
language: {url: '{{ DT_LANG_PATH }}'},
|
||||||
order: [
|
order: [
|
||||||
@ -185,7 +185,10 @@
|
|||||||
|
|
||||||
{% if perms.auth.timer_management %}
|
{% if perms.auth.timer_management %}
|
||||||
dtOptions['columnDefs'] = [
|
dtOptions['columnDefs'] = [
|
||||||
{ "orderable": false, "targets": 7 }
|
{
|
||||||
|
"orderable": false,
|
||||||
|
"targets": 7
|
||||||
|
}
|
||||||
];
|
];
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user