Merge pull request #138 from zond/master

Added a button to turn auto tail on/off
This commit is contained in:
Brad Rydzewski 2014-02-27 16:01:11 -08:00
commit 77ff7971d3
3 changed files with 40 additions and 2 deletions

View file

@ -1082,3 +1082,14 @@ ul.account-radio-group li img {
.url { .url {
word-break: break-all; word-break: break-all;
} }
#follow {
position: relative;
z-index: 100;
float: right;
right: 1em;
top: -2.5em;
padding: 0 1em;
border-radius: 7px;
background: #999;
cursor: pointer;
}

View file

@ -1271,3 +1271,17 @@ pre {
.url { .url {
word-break: break-all; word-break: break-all;
} }
#follow {
position: relative;
z-index: 100;
float: right;
right: 1em;
top: -2.5em;
padding: 0 1em;
border-radius: 7px;
background: #999;
cursor: pointer;
}

View file

@ -45,14 +45,25 @@
</div> </div>
</div> </div>
<pre id="stdout"></pre> <pre id="stdout"></pre>
<span id="follow">Follow</span>
</div><!-- ./container --> </div><!-- ./container -->
{{ end }} {{ end }}
{{ define "script" }} {{ define "script" }}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"></script>
<script> <script>
window.autofollow = false;
$(document).ready(function() { $(document).ready(function() {
$(".timeago").timeago(); $(".timeago").timeago();
$("#follow").bind("click", function(ev) {
if (window.autofollow) {
window.autofollow = false;
$("#follow").text("Follow");
} else {
window.autofollow = true;
$("#follow").text("Stop following");
}
});
}); });
</script> </script>
@ -124,7 +135,9 @@
outputWS.onclose = function (e) { window.location.reload(); }; outputWS.onclose = function (e) { window.location.reload(); };
outputWS.onmessage = function (e) { outputWS.onmessage = function (e) {
outputBox.innerHTML += formatLine(e.data); outputBox.innerHTML += formatLine(e.data);
window.scrollTo(0, document.body.scrollHeight) if (window.autofollow) {
window.scrollTo(0, document.body.scrollHeight);
}
}; };
{{ else }} {{ else }}
$.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) { $.get("/{{ .Repo.Slug }}/commit/{{ .Commit.Hash }}/build/{{ .Build.Slug }}/out.txt", function( data ) {
@ -132,4 +145,4 @@
}); });
{{ end }} {{ end }}
</script> </script>
{{ end }} {{ end }}