Clean up layout deferral. Require login.
This commit is contained in:
@@ -24,20 +24,32 @@ var BabyStats = function(container) {
|
||||
this.intervals_ = {};
|
||||
|
||||
this.cosmo_ = new Cosmopolite();
|
||||
hogfather.PublicChat.Create(this.cosmo_).then(function(chat) {
|
||||
this.chat_ = chat;
|
||||
if (window.location.hash) {
|
||||
var id = window.location.hash.substring(1);
|
||||
hogfather.PublicChat.Join(this.cosmo_, id).then(
|
||||
this.onChatReady_.bind(this));
|
||||
} else {
|
||||
hogfather.PublicChat.Create(this.cosmo_).then(
|
||||
this.onChatReady_.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
this.buildCells_();
|
||||
this.buildStylesheet_();
|
||||
this.buildLayout_();
|
||||
|
||||
window.addEventListener('resize', this.rebuildIfNeeded_.bind(this));
|
||||
BabyStats.prototype.onChatReady_ = function(chat) {
|
||||
this.chat_ = chat;
|
||||
|
||||
var grid = this.calculateGrid_();
|
||||
this.gridWidthCells_ = grid.gridWidthCells;
|
||||
this.gridHeightCells_ = grid.gridHeightCells;
|
||||
this.buildGrid_();
|
||||
}.bind(this));
|
||||
window.location.hash = this.chat_.getID();
|
||||
|
||||
this.buildCells_();
|
||||
this.buildStylesheet_();
|
||||
this.buildLayout_();
|
||||
|
||||
window.addEventListener('resize', this.rebuildIfNeeded_.bind(this));
|
||||
|
||||
var grid = this.calculateGrid_();
|
||||
this.gridWidthCells_ = grid.gridWidthCells;
|
||||
this.gridHeightCells_ = grid.gridHeightCells;
|
||||
this.buildGrid_();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user