summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2016-12-05 16:02:45 +0530
committerKushal Pandya <kushal@gitlab.com>2016-12-21 13:16:17 +0530
commit3d134c50b3baf83b5f675d5e6bda2171924d2ab8 (patch)
tree0b3f3eddf31bf97b8ff0f44ddf0dc2ba4d6dbaef
parent769a9bcc48d1969f65988f0caae26cd2129e8e3c (diff)
downloadgitlab-ce-3d134c50b3baf83b5f675d5e6bda2171924d2ab8.tar.gz
Improve isInViewport impl, autoscroll behavior
- Improve isInViewport impementation to be robust. - Autoscroll is now a status indicator instead of toggle button - Scrolling build log enables autoscroll itself when scrolled to bottom.
-rw-r--r--app/assets/javascripts/build.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js
index fc4b4aeb73c..874cf0d3023 100644
--- a/app/assets/javascripts/build.js
+++ b/app/assets/javascripts/build.js
@@ -179,6 +179,7 @@
if ($autoScrollContainer.length) { // Show and Reposition Autoscroll Status Message
$autoScrollContainer.show().css({ top: $body.outerHeight() - 75 });
+<<<<<<< fbd5f4507b310d6dc1305696851e9860b48fa0ba
}
}
@@ -195,6 +196,31 @@
// Check if Refresh Animation is in Viewport and enable Autoscroll, disable otherwise.
$autoScrollStatus.data("state", isInViewport($('.js-build-refresh')) ? 'enabled' : 'disabled');
}
+=======
+ }
+ }
+
+ if (!isInViewport($upBuildTrace) && !isInViewport($downBuildTrace)) { // User is somewhere in middle of Build Log
+ $scrollTopBtn.show().addClass('sticky');
+ $scrollBottomBtn.show().addClass('sticky');
+
+ if ($autoScrollContainer.length) {
+ $autoScrollContainer.hide();
+ }
+ }
+
+ if (this.buildStatus === "running" || this.buildStatus === "pending") {
+ if (isInViewport($('.js-build-refresh'))) { // Check if Refresh Animation is in Viewport
+ if ($autoScrollStatus.data("state") === 'disabled') {
+ $autoScrollStatus.data("state", 'enabled'); // Enable Autoscroll
+ }
+ } else {
+ if ($autoScrollStatus.data("state") === 'enabled') {
+ $autoScrollStatus.data("state", 'disabled'); // Disable Autoscroll
+ }
+ }
+ }
+>>>>>>> Improve isInViewport impl, autoscroll behavior
};
Build.prototype.shouldHideSidebarForViewport = function() {