update js on index to run after all is loaded

pull/1/head
lza_menace 4 years ago
parent e7f1e045ce
commit 49f69707c4

@ -52,22 +52,24 @@
</section>
{% endif %}
<script>
{% for op in funded_ops %}
fetch('/api/info/{{ op.codename }}')
.then((resp) => resp.json())
.then(function(data) {
if(data['synchronized']){
var html = '<i class="fa fa-check-circle is-green"></i> Synced'
} else if (data['error']) {
var html = '<i class="fa fa-exclamation-triangle is-red"></i> Error'
} else {
var html = '<i class="fa fa-sync-alt fa-spin"></i> Syncing'
}
var s = document.getElementById('{{ op.codename }}-status')
s.innerHTML = html
})
{% endfor %}
<script type="text/javascript">
window.onload = function() {
{% for op in funded_ops %}
fetch('/api/info/{{ op.codename }}')
.then((resp) => resp.json())
.then(function(data) {
if(data['synchronized']){
var html = '<i class="fa fa-check-circle is-green"></i> Synced'
} else if (data['error']) {
var html = '<i class="fa fa-exclamation-triangle is-red"></i> Error'
} else {
var html = '<i class="fa fa-sync-alt fa-spin"></i> Syncing'
}
var s = document.getElementById('{{ op.codename }}-status')
s.innerHTML = html
})
{% endfor %}
}
</script>
{% include 'includes/footer.html' %}

Loading…
Cancel
Save