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; word-break: break-all;
} }
#follow { #follow {
position: absolute; position: relative;
z-index: 1000; z-index: 100;
float: right;
right: 1em; right: 1em;
top: .5em; top: -2.5em;
padding: 0 1em; padding: 0 1em;
border-radius: 7px; border-radius: 7px;
background: #999; background: #999;
cursor: pointer; cursor: pointer;
} }
#follow-container {
position: relative;
}

View file

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

View file

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