[CHANGE] Moved timers table to its own template

This commit is contained in:
Peter Pfeufer 2023-12-09 17:53:03 +01:00
parent 11a32c90a8
commit 0bd3acc230
No known key found for this signature in database
GPG Key ID: 6051D2C6AD4EBC27
2 changed files with 248 additions and 524 deletions

View File

@ -0,0 +1,202 @@
{% load evelinks %}
{% load i18n %}
<div class="table-responsive">
<table class="table">
<tr>
<th class="text-center">{% translate "Details" %}</th>
<th class="text-center">{% translate "Objective" %}</th>
<th class="text-center">{% translate "System" %}</th>
<th class="text-center">{% translate "Structure" %}</th>
<th class="text-center">{% translate "Eve Time" %}</th>
<th class="text-center">{% translate "Local Time" %}</th>
<th class="text-center">{% translate "Creator" %}</th>
{% if perms.auth.timer_management %}
<th class="text-center">{% translate "Action" %}</th>
{% endif %}
</tr>
{% for timer in timers %}
{% if timer.important == True %}
<tr class="danger">
{% else %}
<tr class="info">
{% endif %}
<td style="width: 150px;" class="text-center">
{{ timer.details }}
{% if timer.timer_type != 'UNSPECIFIED' %}
<br>({{ timer.get_timer_type_display }})
{% endif %}
</td>
<td class="text-center">
{% if timer.objective == "Hostile" %}
<div class="badge bg-danger">
{% translate "Hostile" %}
</div>
{% endif %}
{% if timer.objective == "Friendly" %}
<div class="badge bg-primary">
{% translate "Friendly" %}
</div>
{% endif %}
{% if timer.objective == "Neutral" %}
<div class="badge bg-default">
{% translate "Neutral" %}
</div>
{% endif %}
</td>
<td class="text-center">
<a href="{{ timer.system|dotlan_solar_system_url }}">
{{ timer.system }} {{ timer.planet_moon }}
</a>
</td>
<td class="text-center">
{% if timer.structure == "POCO" %}
<div class="badge bg-info">
POCO
</div>
{% endif %}
{% if timer.structure == "I-HUB" %}
<div class="badge bg-warning">
I-HUB
</div>
{% endif %}
{% if timer.structure == "TCU" %}
<div class="badge bg-danger">
TCU
</div>
{% endif %}
{% if timer.structure == "POS[S]" %}
<div class="badge bg-info">
POS [S]
</div>
{% endif %}
{% if timer.structure == "POS[M]" %}
<div class="badge bg-info">
POS [M]
</div>
{% endif %}
{% if timer.structure == "POS[L]" %}
<div class="badge bg-info">
POS [L]
</div>
{% endif %}
{% if timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %}
<div class="badge bg-danger">
Astrahus
</div>
{% endif %}
{% if timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %}
<div class="badge bg-danger">
Fortizar
</div>
{% endif %}
{% if timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %}
<div class="badge bg-danger">
Keepstar
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
<div class="badge bg-warning">
Raitaru
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
<div class="badge bg-warning">
Azbel
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %}
<div class="badge bg-warning">
Sotiyo
</div>
{% endif %}
{% if timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
<div class="badge bg-warning">
Athanor
</div>
{% endif %}
{% if timer.structure == "Refinery[L]" or timer.structure == "Tatara"%}
<div class="badge bg-warning">
Tatara
</div>
{% endif %}
{% if timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">
Cyno Beacon
</div>
{% endif %}
{% if timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">
Tenebrex Cyno Jammer
</div>
{% endif %}
{% if timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">
Ansiblex Jump Gate
</div>
{% endif %}
{% if timer.structure == "Moon Mining Cycle" %}
<div class="badge bg-success">
Moon Mining Cycle
</div>
{% endif %}
{% if timer.structure == "Other" %}
<div class="badge bg-default">
Other
</div>
{% endif %}
</td>
<td class="text-center" nowrap>
{{ timer.eve_time | date:"Y-m-d H:i" }}
</td>
<td class="text-center" nowrap>
<div id="localtime{{ timer.id }}"></div>
<div id="countdown{{ timer.id }}"></div>
</td>
<td class="text-center">
{{ timer.eve_character.character_name }}
</td>
{% if perms.auth.timer_management %}
<td class="text-center">
<a href="{% url 'timerboard:delete' timer.id %}" class="btn btn-danger">
<i class="fa-solid fa-trash fa-fw"></i>
</a>
<a href="{% url 'timerboard:edit' timer.id %}" class="btn btn-info">
<i class="fa-solid fa-pen-to-square fa-fw"></i>
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>

View File

@ -1,362 +1,43 @@
{% extends "allianceauth/base-bs5.html" %} {% extends "allianceauth/base-bs5.html" %}
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% load evelinks %} {% load evelinks %}
{% block page_title %}{% translate "Structure Timer Management" %}{% endblock page_title %} {% get_current_language as LANGUAGE_CODE %}
{% block extra_css %}{% endblock extra_css %}
{% block page_title %}
{% translate "Structure Timer Management" %}
{% endblock page_title %}
{% block header_nav_brand %}
{% translate "Structure Timers" %}
{% endblock header_nav_brand %}
{% block content %} {% block content %}
<div class="col-lg-12"> <div>
<h1 class="page-header text-center">{% translate "Structure Timers" %} <div class="text-end mb-3">
<div class="text-end"> {% if perms.auth.timer_management %}
{% if perms.auth.timer_management %} <a href="{% url 'timerboard:add' %}" class="btn btn-success">
<a href="{% url 'timerboard:add' %}" class="btn btn-success"> {% translate "Create Structure Timer" %}
{% translate "Create Structure Timer" %} </a>
</a> {% endif %}
{% endif %} </div>
</div>
</h1>
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<div class="badge bg-info text-start"> <div class="badge bg-info text-start">
<b>{% translate "Current Eve Time:" %} </b> <span>{% translate "Current Eve Time:" %}</span>
<span id="current-time"></span>
</div> </div>
<strong class="badge bg-info text-start" id="current-time"></strong>
</div> </div>
{% if corp_timers %} {% if corp_timers %}
<h4><b>{% translate "Corp Timers" %}</b></h4> <h4><b>{% translate "Corp Timers" %}</b></h4>
<div class="table-responsive"> {% include "timerboard/timertable.html" with timers=corp_timers %}
<table class="table">
<tr>
<th style="width:150px" class="text-center">{% translate "Details" %}</th>
<th class="text-center">{% translate "Objective" %}</th>
<th class="text-center">{% translate "System" %}</th>
<th class="text-center">{% translate "Structure" %}</th>
<th class="text-center">{% translate "Eve Time" %}</th>
<th class="text-center">{% translate "Local Time" %}</th>
<th class="text-center">{% translate "Creator" %}</th>
{% if perms.auth.timer_management %}
<th class="text-center">{% translate "Action" %}</th>
{% endif %}
</tr>
{% for timer in corp_timers %}
{% if timer.important == True %}
<tr class="danger">
{% else %}
<tr class="info">
{% endif %}
<td style="width:150px" class="text-center">
{{ timer.details }}
{% if timer.timer_type != 'UNSPECIFIED' %}
<br>({{ timer.get_timer_type_display }})
{% endif %}
</td>
<td class="text-center">
{% if timer.objective == "Hostile" %}
<div class="badge bg-danger">
{% translate "Hostile" %}
</div>
{% endif %}
{% if timer.objective == "Friendly" %}
<div class="badge bg-primary">
{% translate "Friendly" %}
</div>
{% endif %}
{% if timer.objective == "Neutral" %}
<div class="badge bg-default">
{% translate "Neutral" %}
</div>
{% endif %}
</td>
<td class="text-center"><a href="{{ timer.system|dotlan_solar_system_url }}">
{{ timer.system }} {{ timer.planet_moon }}
</a>
</td>
<td class="text-center">
{% if timer.structure == "POCO" %}
<div class="badge bg-info">
POCO
</div>
{% endif %}
{% if timer.structure == "I-HUB" %}
<div class="badge bg-warning">
I-HUB
</div>
{% endif %}
{% if timer.structure == "TCU" %}
<div class="badge bg-danger">
TCU
</div>
{% endif %}
{% if timer.structure == "POS[S]" %}
<div class="badge bg-info">
POS [S]
</div>
{% endif %}
{% if timer.structure == "POS[M]" %}
<div class="badge bg-info">
POS [M]
</div>
{% endif %}
{% if timer.structure == "POS[L]" %}
<div class="badge bg-info">
POS [L]
</div>
{% endif %}
{% if timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %}
<div class="badge bg-danger">
Astrahus
</div>
{% endif %}
{% if timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %}
<div class="badge bg-danger">
Fortizar
</div>
{% endif %}
{% if timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %}
<div class="badge bg-danger">
Keepstar
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
<div class="badge bg-warning">
Raitaru
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
<div class="badge bg-warning">
Azbel
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %}
<div class="badge bg-warning">
Sotiyo
</div>
{% endif %}
{% if timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
<div class="badge bg-warning">
Athanor
</div>
{% endif %}
{% if timer.structure == "Refinery[L]" or timer.structure == "Tatara"%}
<div class="badge bg-warning">
Tatara
</div>
{% endif %}
{% if timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">
Cyno Beacon
</div>
{% endif %}
{% if timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">
Tenebrex Cyno Jammer
</div>
{% endif %}
{% if timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">
Ansiblex Jump Gate
</div>
{% endif %}
{% if timer.structure == "Moon Mining Cycle" %}
<div class="badge bg-success">
Moon Mining Cycle
</div>
{% endif %}
{% if timer.structure == "Other" %}
<div class="badge bg-default">
Other
</div>
{% endif %}
</td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>
<td class="text-center" nowrap>
<div id="localtime{{ timer.id }}"></div>
<div id="countdown{{ timer.id }}"></div>
</td>
<td class="text-center">{{ timer.eve_character.character_name }}</td>
{% if perms.auth.timer_management %}
<td class="text-center">
<a href="{% url 'timerboard:delete' timer.id %}" class="btn btn-danger">
<span class="glyphicon glyphicon-remove"></span>
</a>
<a href="{% url 'timerboard:edit' timer.id %}" class="btn btn-info">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endif %} {% endif %}
<h4><b>{% translate "Next Timers" %}</b></h4> <h4><b>{% translate "Next Timers" %}</b></h4>
{% if future_timers %} {% if future_timers %}
<div class="table-responsive"> {% include "timerboard/timertable.html" with timers=future_timers %}
<table class="table">
<tr>
<th style="width:150px" class="text-center">{% translate "Details" %}</th>
<th class="text-center">{% translate "Objective" %}</th>
<th class="text-center">{% translate "System" %}</th>
<th class="text-center">{% translate "Structure" %}</th>
<th class="text-center">{% translate "Eve Time" %}</th>
<th class="text-center">{% translate "Local Time" %}</th>
<th class="text-center">{% translate "Creator" %}</th>
{% if perms.auth.timer_management %}
<th class="text-center">{% translate "Action" %}</th>
{% endif %}
</tr>
{% for timer in future_timers %}
{% if timer.important == True %}
<tr class="danger">
{% else %}
<tr class="info">
{% endif %}
<td style="width:150px" class="text-center">
{{ timer.details }}
{% if timer.timer_type != 'UNSPECIFIED' %}
<br>({{ timer.get_timer_type_display }})
{% endif %}
</td>
<td class="text-center">
{% if timer.objective == "Hostile" %}
<div class="badge bg-danger">
{% translate "Hostile" %}
</div>
{% endif %}
{% if timer.objective == "Friendly" %}
<div class="badge bg-primary">
{% translate "Friendly" %}
</div>
{% endif %}
{% if timer.objective == "Neutral" %}
<div class="badge bg-default">
{% translate "Neutral" %}
</div>
{% endif %}
</td>
<td class="text-center">
<a href="{{ timer.system|dotlan_solar_system_url }}">
{{ timer.system }} {{ timer.planet_moon }}
</a>
</td>
<td class="text-center">
{% if timer.structure == "POCO" %}
<div class="badge bg-info">
POCO
</div>
{% endif %}
{% if timer.structure == "I-HUB" %}
<div class="badge bg-warning">
I-HUB
</div>
{% endif %}
{% if timer.structure == "TCU" %}
<div class="badge bg-danger">
TCU
</div>
{% endif %}
{% if timer.structure == "POS[S]" %}
<div class="badge bg-info">
POS [S]
</div>
{% endif %}
{% if timer.structure == "POS[M]" %}
<div class="badge bg-info">
POS [M]
</div>
{% endif %}
{% if timer.structure == "POS[L]" %}
<div class="badge bg-info">
POS [L]
</div>
{% endif %}
{% if timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %}
<div class="badge bg-danger">
Astrahus
</div>
{% endif %}
{% if timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %}
<div class="badge bg-danger">
Fortizar
</div>
{% endif %}
{% if timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %}
<div class="badge bg-danger">
Keepstar
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
<div class="badge bg-warning">
Raitaru
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
<div class="badge bg-warning">
Azbel
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %}
<div class="badge bg-warning">
Sotiyo
</div>
{% endif %}
{% if timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
<div class="badge bg-warning">
Athanor
</div>
{% endif %}
{% if timer.structure == "Refinery[L]" or timer.structure == "Tatara" %}
<div class="badge bg-warning">
Tatara
</div>
{% endif %}
{% if timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">
Pharolux Cyno Beacon
</div>
{% endif %}
{% if timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">
Tenebrex Cyno Jammer
</div>
{% endif %}
{% if timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">
Ansiblex Jump Gate
</div>
{% endif %}
{% if timer.structure == "Moon Mining Cycle" %}
<div class="badge bg-success">
Moon Mining Cycle
</div>
{% endif %}
{% if timer.structure == "Other" %}
<div class="badge bg-default">
Other
</div>
{% endif %}
</td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>
<td class="text-center" nowrap>
<div id="localtime{{ timer.id }}"></div>
<div id="countdown{{ timer.id }}"></div>
</td>
<td class="text-center">{{ timer.eve_character.character_name }}</td>
{% if perms.auth.timer_management %}
<td class="text-center">
<a href="{% url 'timerboard:delete' timer.id %}" class="btn btn-danger">
<span class="glyphicon glyphicon-remove"></span>
</a>
<a href="{% url 'timerboard:edit' timer.id %}" class="btn btn-info">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% else %} {% else %}
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
{% translate "No upcoming timers." %} {% translate "No upcoming timers." %}
@ -365,182 +46,21 @@
<h4><b>{% translate "Past Timers" %}</b></h4> <h4><b>{% translate "Past Timers" %}</b></h4>
{% if past_timers %} {% if past_timers %}
<div class="table-responsive"> {% include "timerboard/timertable.html" with timers=past_timers %}
<table class="table">
<tr>
<th style="width:150px" class="text-center">{% translate "Details" %}</th>
<th class="text-center">{% translate "Objective" %}</th>
<th class="text-center">{% translate "System" %}</th>
<th class="text-center">{% translate "Structure" %}</th>
<th class="text-center">{% translate "Eve Time" %}</th>
<th class="text-center">{% translate "Local Time" %}</th>
<th class="text-center">{% translate "Creator" %}</th>
{% if perms.auth.timer_management %}
<th class="text-center">{% translate "Action" %}</th>
{% endif %}
</tr>
{% for timer in past_timers %}
{% if timer.important == True %}
<tr class="danger">
{% else %}
<tr class="info">
{% endif %}
<td style="width:150px" class="text-center">
{{ timer.details }}
{% if timer.timer_type != 'UNSPECIFIED' %}
<br>({{ timer.get_timer_type_display }})
{% endif %}
</td>
<td class="text-center">
{% if timer.objective == "Hostile" %}
<div class="badge bg-danger">
{% translate "Hostile" %}
</div>
{% endif %}
{% if timer.objective == "Friendly" %}
<div class="badge bg-primary">
{% translate "Friendly" %}
</div>
{% endif %}
{% if timer.objective == "Neutral" %}
<div class="badge bg-default">
{% translate "Neutral" %}
</div>
{% endif %}
</td>
<td class="text-center">
<a href="{{ timer.system|dotlan_solar_system_url }}">
{{ timer.system }} {{ timer.planet_moon }}
</a>
</td>
<td class="text-center">
{% if timer.structure == "POCO" %}
<div class="badge bg-info">
POCO
</div>
{% endif %}
{% if timer.structure == "I-HUB" %}
<div class="badge bg-warning">
I-HUB
</div>
{% endif %}
{% if timer.structure == "TCU" %}
<div class="badge bg-danger">
TCU
</div>
{% endif %}
{% if timer.structure == "POS[S]" %}
<div class="badge bg-info">
POS [S]
</div>
{% endif %}
{% if timer.structure == "POS[M]" %}
<div class="badge bg-info">
POS [M]
</div>
{% endif %}
{% if timer.structure == "POS[L]" %}
<div class="badge bg-info">
POS [L]
</div>
{% endif %}
{% if timer.structure == "Citadel[M]" or timer.structure == "Astrahus" %}
<div class="badge bg-danger">
Astrahus
</div>
{% endif %}
{% if timer.structure == "Citadel[L]" or timer.structure == "Fortizar" %}
<div class="badge bg-danger">
Fortizar
</div>
{% endif %}
{% if timer.structure == "Citadel[XL]" or timer.structure == "Keepstar" %}
<div class="badge bg-danger">
Keepstar
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[M]" or timer.structure == "Raitaru" %}
<div class="badge bg-warning">
Raitaru
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[L]" or timer.structure == "Azbel" %}
<div class="badge bg-warning">
Azbel
</div>
{% endif %}
{% if timer.structure == "Engineering Complex[XL]" or timer.structure == "Sotiyo" %}
<div class="badge bg-warning">
Sotiyo
</div>
{% endif %}
{% if timer.structure == "Refinery[M]" or timer.structure == "Athanor" %}
<div class="badge bg-warning">
Athanor
</div>
{% endif %}
{% if timer.structure == "Refinery[L]" or timer.structure == "Tatara" %}
<div class="badge bg-warning">
Tatara
</div>
{% endif %}
{% if timer.structure == "Cyno Beacon" or timer.structure == "Pharolux Cyno Beacon" %}
<div class="badge bg-warning">
Pharolux Cyno Beacon
</div>
{% endif %}
{% if timer.structure == "Cyno Jammer" or timer.structure == "Tenebrex Cyno Jammer" %}
<div class="badge bg-warning">
Tenebrex Cyno Jammer
</div>
{% endif %}
{% if timer.structure == "Jump Gate" or timer.structure == "Ansiblex Jump Gate" %}
<div class="badge bg-warning">
Ansiblex Jump Gate
</div>
{% endif %}
{% if timer.structure == "Moon Mining Cycle" %}
<div class="badge bg-success">
Moon Mining Cycle
</div>
{% endif %}
{% if timer.structure == "Other" %}
<div class="badge bg-default">
Other
</div>
{% endif %}
</td>
<td class="text-center" nowrap>{{ timer.eve_time | date:"Y-m-d H:i" }}</td>
<td class="text-center" nowrap>
<div id="localtime{{ timer.id }}"></div>
<div id="countdown{{ timer.id }}"></div>
</td>
<td class="text-center">{{ timer.eve_character.character_name }}</td>
{% if perms.auth.timer_management %}
<td class="text-center">
<a href="{% url 'timerboard:delete' timer.id %}" class="btn btn-danger">
<span class="glyphicon glyphicon-remove"></span>
</a>
<a href="{% url 'timerboard:edit' timer.id %}" class="btn btn-info">
<span class="glyphicon glyphicon-pencil"></span>
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% else %} {% else %}
<div class="alert alert-warning text-center"> <div class="alert alert-warning text-center">
{% translate "No past timers." %} {% translate "No past timers." %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% endblock content %}
{% block extra_javascript %}
{% include "bundles/moment-js.html" with locale=True %} {% include "bundles/moment-js.html" with locale=True %}
{% include "bundles/timers-js.html" %} {% include "bundles/timers-js.html" %}
<script> <script>
let timers = [ const timers = [
{% for timer in timers %} {% for timer in timers %}
{ {
'id': {{ timer.id }}, 'id': {{ timer.id }},
@ -548,6 +68,7 @@
'expired': false 'expired': false
}, },
{% endfor %} {% endfor %}
{% for timer in corp_timers %} {% for timer in corp_timers %}
{ {
'id': {{ timer.id }}, 'id': {{ timer.id }},
@ -561,9 +82,9 @@
* Update a timer * Update a timer
* @param timer Timer information * @param timer Timer information
*/ */
let updateTimer = function (timer) { const updateTimer = (timer) => {
if (timer.targetDate.isAfter(Date.now())) { if (timer.targetDate.isAfter(Date.now())) {
let duration = moment.duration(timer.targetDate - moment(), 'milliseconds'); const duration = moment.duration(timer.targetDate - moment(), 'milliseconds');
document.getElementById("countdown" + timer.id).innerHTML = getDurationString(duration); document.getElementById("countdown" + timer.id).innerHTML = getDurationString(duration);
} else { } else {
@ -573,8 +94,8 @@
} }
}; };
let updateAllTimers = function () { const updateAllTimers = () => {
let l = timers.length; const l = timers.length;
for (let i=0; i < l; ++i) { for (let i=0; i < l; ++i) {
if (timers[i].expired) continue; if (timers[i].expired) continue;
@ -583,33 +104,34 @@
} }
}; };
function timedUpdate() {
updateClock();
updateAllTimers();
}
/** /**
* Set the local time info for the timer * Set the local time info for the timer
* @param timer Timer information * @param timer Timer information
*/ */
let setLocalTime = function (timer) { const setLocalTime = (timer) => {
document.getElementById("localtime" + timer.id).innerHTML = timer.targetDate.format("ddd @ LT"); document.getElementById("localtime" + timer.id).innerHTML = timer.targetDate.format("ddd @ LT");
}; };
/** /**
* Set all local time fields * Set all local time fields
*/ */
let setAllLocalTimes = function () { const setAllLocalTimes = () => {
let l = timers.length; const l = timers.length;
for (let i=0; i < l; ++i) { for (let i=0; i < l; ++i) {
setLocalTime(timers[i]); setLocalTime(timers[i]);
} }
}; };
let updateClock = function () { const updateClock = () => {
document.getElementById("current-time").innerHTML = getCurrentEveTimeString(); document.getElementById("current-time").innerHTML = getCurrentEveTimeString();
}; };
const timedUpdate = () => {
updateClock();
updateAllTimers();
}
// Set initial values // Set initial values
setAllLocalTimes(); setAllLocalTimes();
timedUpdate(); timedUpdate();
@ -617,4 +139,4 @@
// Start timed updates // Start timed updates
setInterval(timedUpdate, 1000); setInterval(timedUpdate, 1000);
</script> </script>
{% endblock content %} {% endblock extra_javascript %}