cleanup
This commit is contained in:
parent
e99f137316
commit
35a9051f56
|
@ -29,8 +29,6 @@ Discourse.Scrolling = Em.Mixin.create({
|
||||||
|
|
||||||
$(document).bind('touchmove.discourse', onScroll);
|
$(document).bind('touchmove.discourse', onScroll);
|
||||||
$(window).bind('scroll.discourse', onScroll);
|
$(window).bind('scroll.discourse', onScroll);
|
||||||
|
|
||||||
// resize is should also fire this cause it causes scrolling of sorts
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -123,7 +123,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
didInsertElement: function(e) {
|
didInsertElement: function(e) {
|
||||||
var topicView = this;
|
var topicView = this;
|
||||||
this.bindScrolling({debounce: 0});
|
this.bindScrolling({debounce: 0});
|
||||||
$(window).bind('resize.discourse-on-scroll', function() { scrolled(false); });
|
$(window).bind('resize.discourse-on-scroll', function() { topicView.updatePosition(false); });
|
||||||
|
|
||||||
var controller = this.get('controller');
|
var controller = this.get('controller');
|
||||||
controller.subscribe();
|
controller.subscribe();
|
||||||
|
@ -140,14 +140,12 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
return Discourse.ClickTrack.trackClick(e);
|
return Discourse.ClickTrack.trackClick(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scrolled();
|
this.updatePosition(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Triggered whenever any posts are rendered, debounced to save over calling
|
// Triggered whenever any posts are rendered, debounced to save over calling
|
||||||
postsRendered: Discourse.debounce(function() {
|
postsRendered: Discourse.debounce(function() {
|
||||||
var $window = $(window);
|
this.updatePosition(false);
|
||||||
var $lastPost = $('.row:last');
|
|
||||||
this.scrolled(false);
|
|
||||||
}, 50),
|
}, 50),
|
||||||
|
|
||||||
resetRead: function(e) {
|
resetRead: function(e) {
|
||||||
|
@ -345,21 +343,26 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
},
|
},
|
||||||
|
|
||||||
updateDock: function(postView) {
|
updateDock: function(postView) {
|
||||||
|
var post;
|
||||||
if (!postView) return;
|
if (!postView) return;
|
||||||
post = postView.get('post');
|
post = postView.get('post');
|
||||||
if (!post) return;
|
if (!post) return;
|
||||||
this.set('progressPosition', post.get('post_number'));
|
this.set('progressPosition', post.get('post_number'));
|
||||||
},
|
},
|
||||||
|
|
||||||
nonUrgentScrolled: Discourse.debounce(function(opts){
|
nonUrgentPositionUpdate: Discourse.debounce(function(opts){
|
||||||
var screenTrack = this.get('screenTrack');
|
var screenTrack = this.get('screenTrack');
|
||||||
if(opts.track && screenTrack) {
|
if(opts.userActive && screenTrack) {
|
||||||
screenTrack.scrolled();
|
screenTrack.scrolled();
|
||||||
}
|
}
|
||||||
this.set('controller.currentPost', opts.currentPost);
|
this.set('controller.currentPost', opts.currentPost);
|
||||||
},500),
|
},500),
|
||||||
|
|
||||||
scrolled: function(track) {
|
scrolled: function(){
|
||||||
|
this.updatePosition(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
updatePosition: function(userActive) {
|
||||||
var $lastPost, firstLoaded, lastPostOffset, offset,
|
var $lastPost, firstLoaded, lastPostOffset, offset,
|
||||||
title, info, rows, screenTrack, _this, currentPost;
|
title, info, rows, screenTrack, _this, currentPost;
|
||||||
|
|
||||||
|
@ -387,7 +390,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
currentPost = currentPost || seen;
|
currentPost = currentPost || seen;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nonUrgentScrolled({track: track!==false, currentPost: currentPost});
|
this.nonUrgentPositionUpdate({userActive: userActive, currentPost: currentPost});
|
||||||
|
|
||||||
offset = window.pageYOffset || $('html').scrollTop();
|
offset = window.pageYOffset || $('html').scrollTop();
|
||||||
firstLoaded = this.get('firstPostLoaded');
|
firstLoaded = this.get('firstPostLoaded');
|
||||||
|
@ -425,6 +428,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
|
|
||||||
browseMoreMessage: (function() {
|
browseMoreMessage: (function() {
|
||||||
var category, opts;
|
var category, opts;
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
popularLink: "<a href=\"/\">" + (Em.String.i18n("topic.view_popular_topics")) + "</a>"
|
popularLink: "<a href=\"/\">" + (Em.String.i18n("topic.view_popular_topics")) + "</a>"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue