mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Upgrade ember-cloaking to not trigger scroll events when the back button
is hit.
This commit is contained in:
parent
748767e222
commit
61ff04d68b
2 changed files with 16 additions and 7 deletions
|
@ -71,12 +71,12 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
}
|
||||
}.observes('controller.enteredAt'),
|
||||
|
||||
didInsertElement: function() {
|
||||
_inserted: function() {
|
||||
this.bindScrolling({name: 'topic-view'});
|
||||
|
||||
var topicView = this;
|
||||
var self = this;
|
||||
$(window).resize('resize.discourse-on-scroll', function() {
|
||||
topicView.scrolled();
|
||||
self.scrolled();
|
||||
});
|
||||
|
||||
// This get seems counter intuitive, but it's to trigger the observer on
|
||||
|
@ -88,10 +88,10 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
if ($(e.target).hasClass('mention')) { return false; }
|
||||
return Discourse.ClickTrack.trackClick(e);
|
||||
});
|
||||
},
|
||||
}.on('didInsertElement'),
|
||||
|
||||
// This view is being removed. Shut down operations
|
||||
willDestroyElement: function() {
|
||||
_destroyed: function() {
|
||||
this.unbindScrolling('topic-view');
|
||||
$(window).unbind('resize.discourse-on-scroll');
|
||||
|
||||
|
@ -102,7 +102,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
|
||||
// this happens after route exit, stuff could have trickled in
|
||||
this.set('controller.controllers.header.showExtraInfo', false);
|
||||
},
|
||||
}.on('willDestroyElement'),
|
||||
|
||||
debounceLoadSuggested: Discourse.debounce(function(){
|
||||
if (this.get('isDestroyed') || this.get('isDestroying')) { return; }
|
||||
|
|
11
vendor/assets/javascripts/ember-cloaking.js
vendored
11
vendor/assets/javascripts/ember-cloaking.js
vendored
|
@ -95,6 +95,8 @@
|
|||
@method scrolled
|
||||
**/
|
||||
scrolled: function() {
|
||||
if (!this.get('scrollingEnabled')) { return; }
|
||||
|
||||
var childViews = this.get('childViews');
|
||||
if ((!childViews) || (childViews.length === 0)) { return; }
|
||||
|
||||
|
@ -189,11 +191,18 @@
|
|||
$(window).bind('scroll.ember-cloak', onScrollMethod);
|
||||
this.addObserver('wrapperTop', self, onScrollMethod);
|
||||
this.addObserver('wrapperHeight', self, onScrollMethod);
|
||||
|
||||
this.set('scrollingEnabled', true);
|
||||
}.on('didInsertElement'),
|
||||
|
||||
_endEvents: function() {
|
||||
cleanUp: function() {
|
||||
$(document).unbind('touchmove.ember-cloak');
|
||||
$(window).unbind('scroll.ember-cloak');
|
||||
this.set('scrollingEnabled', false);
|
||||
},
|
||||
|
||||
_endEvents: function() {
|
||||
this.cleanUp();
|
||||
}.on('willDestroyElement')
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue