mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-22 16:36:30 +00:00
added a button to turn auto tail on/off
This commit is contained in:
parent
80c42309d3
commit
0c9a9f6d63
3 changed files with 57 additions and 3 deletions
|
@ -1082,3 +1082,16 @@ ul.account-radio-group li img {
|
|||
.url {
|
||||
word-break: break-all;
|
||||
}
|
||||
#follow {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
right: 1em;
|
||||
top: .5em;
|
||||
padding: 0 1em;
|
||||
border-radius: 7px;
|
||||
background: #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
#follow-container {
|
||||
position: relative;
|
||||
}
|
||||
|
|
|
@ -1271,3 +1271,19 @@ pre {
|
|||
.url {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#follow {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
right: 1em;
|
||||
top: .5em;
|
||||
padding: 0 1em;
|
||||
border-radius: 7px;
|
||||
background: #999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#follow-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,15 +44,37 @@
|
|||
<dd>{{ .Commit.Message }}</dd>
|
||||
</div>
|
||||
</div>
|
||||
<pre id="stdout"></pre>
|
||||
<div id="follow-container">
|
||||
<span id="follow">Follow</span>
|
||||
<pre id="stdout"></pre>
|
||||
</div>
|
||||
</div><!-- ./container -->
|
||||
{{ end }}
|
||||
|
||||
{{ define "script" }}
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
|
||||
<script>
|
||||
window.autofollow = false;
|
||||
window.autofollow_ignore = false;
|
||||
$(document).ready(function() {
|
||||
$(".timeago").timeago();
|
||||
$("#follow").bind("click", function(ev) {
|
||||
if (window.autofollow) {
|
||||
window.autofollow = false;
|
||||
$("#follow").text("Follow");
|
||||
} else {
|
||||
window.autofollow = true;
|
||||
$("#follow").text("Stop following");
|
||||
}
|
||||
});
|
||||
$(window).bind("scroll", function(ev) {
|
||||
if (window.autofollow_ignore) {
|
||||
window.autofollow_ignore = false;
|
||||
} else {
|
||||
window.autofollow = false;
|
||||
$("#follow").text("Follow");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -124,7 +146,10 @@
|
|||
outputWS.onclose = function (e) { window.location.reload(); };
|
||||
outputWS.onmessage = function (e) {
|
||||
outputBox.innerHTML += formatLine(e.data);
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
if (window.autofollow) {
|
||||
window.autofollow_ignore = true;
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
}
|
||||
};
|
||||
{{ else }}
|
||||
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) {
|
||||
|
@ -132,4 +157,4 @@
|
|||
});
|
||||
{{ end }}
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue