From 0c9a9f6d63b004d213f3635953f8d87d22027eea Mon Sep 17 00:00:00 2001 From: Martin Bruse Date: Thu, 27 Feb 2014 10:28:24 +0000 Subject: [PATCH 1/2] added a button to turn auto tail on/off --- cmd/droned/assets/css/drone.css | 13 ++++++++++++ cmd/droned/assets/css/drone.less | 16 +++++++++++++++ pkg/template/pages/repo_commit.html | 31 ++++++++++++++++++++++++++--- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/cmd/droned/assets/css/drone.css b/cmd/droned/assets/css/drone.css index 4676616b2..171c1b2d3 100644 --- a/cmd/droned/assets/css/drone.css +++ b/cmd/droned/assets/css/drone.css @@ -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; +} diff --git a/cmd/droned/assets/css/drone.less b/cmd/droned/assets/css/drone.less index 8e4263aaf..178d1ede2 100644 --- a/cmd/droned/assets/css/drone.less +++ b/cmd/droned/assets/css/drone.less @@ -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; +} + diff --git a/pkg/template/pages/repo_commit.html b/pkg/template/pages/repo_commit.html index 985e733b4..cb433f27a 100644 --- a/pkg/template/pages/repo_commit.html +++ b/pkg/template/pages/repo_commit.html @@ -44,15 +44,37 @@
{{ .Commit.Message }}
-

+		
+ Follow +

+		
{{ end }} {{ define "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 }} -{{ end }} \ No newline at end of file +{{ end }} From bc2043d4cf5ff9b68a829213b0aaf8d00cfd968c Mon Sep 17 00:00:00 2001 From: Martin Bruse Date: Thu, 27 Feb 2014 12:04:51 +0000 Subject: [PATCH 2/2] instead of doing magic on scroll events, move the button to the bottom of the stdout pre. --- cmd/droned/assets/css/drone.css | 10 ++++------ cmd/droned/assets/css/drone.less | 10 ++++------ pkg/template/pages/repo_commit.html | 16 ++-------------- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/cmd/droned/assets/css/drone.css b/cmd/droned/assets/css/drone.css index 171c1b2d3..77b7ee7b0 100644 --- a/cmd/droned/assets/css/drone.css +++ b/cmd/droned/assets/css/drone.css @@ -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; -} diff --git a/cmd/droned/assets/css/drone.less b/cmd/droned/assets/css/drone.less index 178d1ede2..433ed20bb 100644 --- a/cmd/droned/assets/css/drone.less +++ b/cmd/droned/assets/css/drone.less @@ -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; -} diff --git a/pkg/template/pages/repo_commit.html b/pkg/template/pages/repo_commit.html index cb433f27a..ec64a8021 100644 --- a/pkg/template/pages/repo_commit.html +++ b/pkg/template/pages/repo_commit.html @@ -44,10 +44,8 @@
{{ .Commit.Message }}
-
- Follow -

-		
+

+		Follow
 	
 {{ end }}
 
@@ -55,7 +53,6 @@
 	
 	
 
@@ -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);
 			}
 		};