From 89c25d355d694689378f2794b2fe76a307ac5b2b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 2 Oct 2013 11:24:55 -0400 Subject: [PATCH] FIX: Progress bar not updating properly sometimes --- app/assets/javascripts/discourse/views/topic_view.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index a4f885d53fa..0a39045b5d4 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -37,8 +37,8 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { } // speeds up stuff, bypass jquery slowness and extra checks - var totalWidth = $topicProgress[0].offsetWidth; - var progressWidth = this.get('controller.streamPercentage') * totalWidth; + var totalWidth = $topicProgress[0].offsetWidth, + progressWidth = this.get('controller.streamPercentage') * totalWidth; $topicProgress.find('.bg') .css("border-right-width", (progressWidth === totalWidth) ? "0px" : "1px") @@ -107,6 +107,11 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { }); }); + // This get seems counter intuitive, but it's to trigger the observer on + // the streamPercentage for this view. Otherwise the process bar does not + // update. + this.get('controller.streamPercentage'); + this.$().on('mouseup.discourse-redirect', '.cooked a, a.track-link', function(e) { if ($(e.target).hasClass('mention')) { return false; } return Discourse.ClickTrack.trackClick(e);