diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-01-03 10:07:02 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-01-03 10:07:02 +0000 |
commit | dacef28388f6e60582bd8edd11d6b09bc03bbfc9 (patch) | |
tree | ea4848a41eafa38625347fd91d62f6d52cd7abb5 /app | |
parent | fced41b1a9a92eefa96ae2f6727804759341ccda (diff) | |
parent | a276391b18e113d443716bd719bb9f70e3fd3d99 (diff) | |
download | gitlab-ce-dacef28388f6e60582bd8edd11d6b09bc03bbfc9.tar.gz |
Merge branch '41120-performance-bar-auto-scroll' into 'master'
Resolve "Performance bar prevent the auto-scroll-to-bottom when visiting a job's page"
Closes #41120
See merge request gitlab-org/gitlab-ce!16084
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/job.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/app/assets/javascripts/job.js b/app/assets/javascripts/job.js index 573c4deb3e4..8f32dcc94e2 100644 --- a/app/assets/javascripts/job.js +++ b/app/assets/javascripts/job.js @@ -96,14 +96,15 @@ export default class Job { // eslint-disable-next-line class-methods-use-this canScroll() { - return this.$document.height() > this.$window.height(); + return $(document).height() > $(window).height(); } toggleScroll() { - const currentPosition = this.$document.scrollTop(); - const scrollHeight = this.$document.height(); + const $document = $(document); + const currentPosition = $document.scrollTop(); + const scrollHeight = $document.height(); - const windowHeight = this.$window.height(); + const windowHeight = $(window).height(); if (this.canScroll()) { if (currentPosition > 0 && (scrollHeight - currentPosition !== windowHeight)) { @@ -127,18 +128,22 @@ export default class Job { this.toggleDisableButton(this.$scrollBottomBtn, true); } } - + // eslint-disable-next-line class-methods-use-this isScrolledToBottom() { - const currentPosition = this.$document.scrollTop(); - const scrollHeight = this.$document.height(); + const $document = $(document); + + const currentPosition = $document.scrollTop(); + const scrollHeight = $document.height(); + + const windowHeight = $(window).height(); - const windowHeight = this.$window.height(); return scrollHeight - currentPosition === windowHeight; } // eslint-disable-next-line class-methods-use-this scrollDown() { - this.$document.scrollTop(this.$document.height()); + const $document = $(document); + $document.scrollTop($document.height()); } scrollToBottom() { @@ -148,7 +153,7 @@ export default class Job { } scrollToTop() { - this.$document.scrollTop(0); + $(document).scrollTop(0); this.hasBeenScrolled = true; this.toggleScroll(); } |