Skip to content

Commit

Permalink
Merge pull request #32 from DewGew/DewGew-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
DewGew authored Nov 14, 2023
2 parents b9601c3 + a516f13 commit d2101da
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ h6 {
.logging_window{
display: block;
padding: 9.5px;
font-size: 16px;
font-size: 12px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
Expand Down
25 changes: 20 additions & 5 deletions templates/logging.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ <h1>Logs</h1>

<div class="card-body">
<h5 class="card-title">Logs <span>| {{ user.username }}</span></h5>
<iframe class="logging_window" id="logging_window"
src="{{ url_for('stream')}}">
</iframe>
<pre class="logging_window" id="output">
</pre>
</br>
<form class="form-check form-switch">
<label><input class="form-check-input" type="checkbox" value="AutoScroll" id="autoScroll" label="Auto Scroll">Auto-Scroll</label>
</form>
<!-- <div class="text-center"><button type="button" class="btn btn-secondary" onClick="location.href=location.href">Refresh Logpage</button></div> -->
</div>
</div>

Expand All @@ -57,13 +57,28 @@ <h5 class="card-title">Logs <span>| {{ user.username }}</span></h5>
{% include 'footer.html' %}
<script>
$(document).ready(function() {
var output = document.getElementById('output');

var xhr = new XMLHttpRequest();
xhr.onerror= function(xhr) {
location.href=location.href
};
xhr.open('GET', '{{ url_for('stream') }}');
xhr.send();

setInterval(function() {
output.textContent = xhr.responseText;
}, 1000);

//set initial state.
$('#autoScroll').val(this.checked);

$('#autoScroll').change(function() {
if(this.checked) {
console.log("On")
const scroll = setInterval('frames[0].scrollTo(0,9999999)',1000)
var myInt = setInterval(function() {
var elem = document.getElementById('output');
elem.scrollTop = elem.scrollHeight;
}, 1000);
}
$('#autoScroll').val(this.checked);
});
Expand Down

0 comments on commit d2101da

Please sign in to comment.