instead of doing magic on scroll events, move the button to the bottom of the stdout pre.

This commit is contained in:
Martin Bruse 2014-02-27 12:04:51 +00:00
parent 0c9a9f6d63
commit bc2043d4cf
3 changed files with 10 additions and 26 deletions

View file

@ -1083,15 +1083,13 @@ ul.account-radio-group li img {
word-break: break-all;
}
#follow {
position: absolute;
z-index: 1000;
position: relative;
z-index: 100;
float: right;
right: 1em;
top: .5em;
top: -2.5em;
padding: 0 1em;
border-radius: 7px;
background: #999;
cursor: pointer;
}
#follow-container {
position: relative;
}

View file

@ -1273,17 +1273,15 @@ pre {
}
#follow {
position: absolute;
z-index: 1000;
position: relative;
z-index: 100;
float: right;
right: 1em;
top: .5em;
top: -2.5em;
padding: 0 1em;
border-radius: 7px;
background: #999;
cursor: pointer;
}
#follow-container {
position: relative;
}

View file

@ -44,10 +44,8 @@
<dd>{{ .Commit.Message }}</dd>
</div>
</div>
<div id="follow-container">
<span id="follow">Follow</span>
<pre id="stdout"></pre>
</div>
<pre id="stdout"></pre>
<span id="follow">Follow</span>
</div><!-- ./container -->
{{ end }}
@ -55,7 +53,6 @@
<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) {
@ -67,14 +64,6 @@
$("#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>
@ -147,7 +136,6 @@
outputWS.onmessage = function (e) {
outputBox.innerHTML += formatLine(e.data);
if (window.autofollow) {
window.autofollow_ignore = true;
window.scrollTo(0, document.body.scrollHeight);
}
};