From 321a11fe41d5b75e0d7b3070a8fcc1f8220cc2d7 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 31 May 2016 11:13:04 -0400 Subject: [PATCH] FIX: Docking of old widget regressed --- .../components/topic-progress.js.es6 | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6 index 6e0315e319c..6f9c5533011 100644 --- a/app/assets/javascripts/discourse/components/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6 @@ -118,25 +118,24 @@ export default Ember.Component.extend({ _dock() { const maximumOffset = $('#topic-footer-buttons').offset(), - composerHeight = $('#reply-control').height() || 0, - $topicProgressWrapper = this.$(), - style = $topicProgressWrapper.attr('style') || '', - offset = window.pageYOffset || $('html').scrollTop(); + composerHeight = $('#reply-control').height() || 0, + $topicProgressWrapper = this.$(), + offset = window.pageYOffset || $('html').scrollTop(); let isDocked = false; if (maximumOffset) { const threshold = maximumOffset.top, - windowHeight = $(window).height(), - topicProgressHeight = $('#topic-progress').height(); + windowHeight = $(window).height(), + topicProgressHeight = $('#topic-progress').height(); isDocked = offset >= threshold - windowHeight + topicProgressHeight + composerHeight; } + const dockPos = $(document).height() - $('#topic-bottom').offset().top; + if (composerHeight > 0) { if (isDocked) { - if (style.indexOf('bottom') >= 0) { - $topicProgressWrapper.css('bottom', ''); - } + $topicProgressWrapper.css('bottom', dockPos); } else { const height = composerHeight + "px"; if ($topicProgressWrapper.css('bottom') !== height) { @@ -144,9 +143,7 @@ export default Ember.Component.extend({ } } } else { - if (style.indexOf('bottom') >= 0) { - $topicProgressWrapper.css('bottom', ''); - } + $topicProgressWrapper.css('bottom', isDocked ? dockPos : ''); } this.set('docked', isDocked); },