MsRewards/Flask/templates/dev.html

31 lines
1.1 KiB
HTML

{% extends "base.html" %}
{% block left_pannel %}
{% endblock %}
{% block content %}
{%if not current_user.is_authenticated %}
<button class="unselected" onclick="location.href = '/login';">login</button>
{% else %}
<iframe id="iframe" src="{{url_for('static', filename='logs/dev.txt')}}" width="100%" height="80%"></iframe>
<script>
function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
var myIframe = document.getElementById('iframe');
myIframe.addEventListener("load", async () => {
var myIframe = document.getElementById('iframe');
let doc = myIframe.contentDocument;
console.log(1);
doc.body.innerHTML = doc.body.innerHTML + '<style>html{color:white;}</style>';
myIframe.contentWindow.scrollTo(0, myIframe.contentDocument.body.scrollHeight);
console.log(2);
await delay(2000);
document.getElementById('iframe').contentWindow.location.reload();
});
</script>
{% endif %}
{% endblock %}