When visiting the tail-reload page, for a short amount of time the "unscrolled" version is shown. To circumvent that, let's scroll down immediately at the first possibility to fill the gap between the loading of the document and the first AJAX request coming in. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
40 lines
863 B
Plaintext
40 lines
863 B
Plaintext
[% WRAPPER layout.tt title=title %]
|
|
[% PROCESS common.tt %]
|
|
|
|
[% project = build.project %]
|
|
[% jobset = build.jobset %]
|
|
[% job = build.job %]
|
|
|
|
<h2>Last 50 log lines of [% INCLUDE renderFullJobNameOfBuild %] build <a href="[% c.uri_for('/build' build.id) %]">[% build.id %]</a>[%IF step %] step [% step.stepnr %][% END %]</h2>
|
|
|
|
[% IF reload %]
|
|
<script>
|
|
function scrollDown() {
|
|
$("#contents").scrollTop($("#contents").get(0).scrollHeight);
|
|
}
|
|
|
|
function injectTail() {
|
|
$.ajax({
|
|
url: "[% url %]",
|
|
dataType: "text",
|
|
success: function (tail) {
|
|
$("#contents").text(tail);
|
|
scrollDown();
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
scrollDown();
|
|
injectTail();
|
|
setInterval(injectTail, 5000);
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
<pre class="taillog" id="contents">
|
|
[% HTML.escape(contents) %]
|
|
</pre>
|
|
|
|
[% END %]
|