Added comments to confusing post list method
Этот коммит содержится в:
@@ -29,12 +29,15 @@ function getStateFromStores() {
|
|||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: "PostList",
|
displayName: "PostList",
|
||||||
scrollPosition: 0,
|
scrollPosition: 0,
|
||||||
preventScrollTrigger: false,
|
preventScrollTrigger: false, // Can't think of an intuitive name, but when true,
|
||||||
|
// scrollPosition is affected by the 'on scroll' event below
|
||||||
gotMorePosts: false,
|
gotMorePosts: false,
|
||||||
oldScrollHeight: 0,
|
oldScrollHeight: 0,
|
||||||
oldZoom: 0,
|
oldZoom: 0,
|
||||||
scrolledToNew: false,
|
scrolledToNew: false,
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
|
||||||
|
// Add CSS required to have the theme colors
|
||||||
var user = UserStore.getCurrentUser();
|
var user = UserStore.getCurrentUser();
|
||||||
if (user.props && user.props.theme) {
|
if (user.props && user.props.theme) {
|
||||||
utils.changeCss('div.theme', 'background-color:'+user.props.theme+';');
|
utils.changeCss('div.theme', 'background-color:'+user.props.theme+';');
|
||||||
@@ -55,11 +58,13 @@ module.exports = React.createClass({
|
|||||||
$('.team__header').addClass('theme--gray');
|
$('.team__header').addClass('theme--gray');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start our Store listeners
|
||||||
PostStore.addChangeListener(this._onChange);
|
PostStore.addChangeListener(this._onChange);
|
||||||
ChannelStore.addChangeListener(this._onChange);
|
ChannelStore.addChangeListener(this._onChange);
|
||||||
UserStore.addStatusesChangeListener(this._onTimeChange);
|
UserStore.addStatusesChangeListener(this._onTimeChange);
|
||||||
SocketStore.addChangeListener(this._onSocketChange);
|
SocketStore.addChangeListener(this._onSocketChange);
|
||||||
|
|
||||||
|
// Initialize perfect scrollbar
|
||||||
$(".post-list-holder-by-time").perfectScrollbar();
|
$(".post-list-holder-by-time").perfectScrollbar();
|
||||||
|
|
||||||
this.resize();
|
this.resize();
|
||||||
@@ -69,6 +74,8 @@ module.exports = React.createClass({
|
|||||||
this.oldScrollHeight = post_holder.scrollHeight;
|
this.oldScrollHeight = post_holder.scrollHeight;
|
||||||
this.oldZoom = (window.outerWidth - 8) / window.innerWidth;
|
this.oldZoom = (window.outerWidth - 8) / window.innerWidth;
|
||||||
|
|
||||||
|
/*************** End of 'run on mount' code, Start of event listeners *****************/
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
$(post_holder).perfectScrollbar('update');
|
$(post_holder).perfectScrollbar('update');
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user