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

Loading…
Cancel
Save