Clean up layout deferral. Require login.

This commit is contained in:
Ian Gulliver
2015-12-27 19:50:37 -08:00
parent fe5eff8923
commit 29f0d7600c
2 changed files with 25 additions and 11 deletions

View File

@@ -9,12 +9,14 @@ handlers:
static_files: static/babystats.html static_files: static/babystats.html
upload: static/babystats.html upload: static/babystats.html
secure: always secure: always
login: required
http_headers: http_headers:
X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff
- url: /static - url: /static
static_dir: static static_dir: static
secure: always secure: always
login: required
http_headers: http_headers:
X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff

View File

@@ -24,20 +24,32 @@ var BabyStats = function(container) {
this.intervals_ = {}; this.intervals_ = {};
this.cosmo_ = new Cosmopolite(); this.cosmo_ = new Cosmopolite();
hogfather.PublicChat.Create(this.cosmo_).then(function(chat) { if (window.location.hash) {
this.chat_ = chat; 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_(); window.location.hash = this.chat_.getID();
this.gridWidthCells_ = grid.gridWidthCells;
this.gridHeightCells_ = grid.gridHeightCells; this.buildCells_();
this.buildGrid_(); this.buildStylesheet_();
}.bind(this)); this.buildLayout_();
window.addEventListener('resize', this.rebuildIfNeeded_.bind(this));
var grid = this.calculateGrid_();
this.gridWidthCells_ = grid.gridWidthCells;
this.gridHeightCells_ = grid.gridHeightCells;
this.buildGrid_();
}; };