Nicer page titles

This commit is contained in:
John Crepezzi 2011-11-18 16:42:05 -05:00
parent d69839b2fb
commit f935ac56c2
2 changed files with 11 additions and 3 deletions

View file

@ -102,7 +102,11 @@ heist.prototype.loadDocument = function(key) {
_this.doc.load(key, function(ret) {
if (ret) {
_this.$code.html(ret.value);
_this.setTitle(ret.language ? ret.language : 'unknown');
var title = ret.key;
if (ret.language) {
title += ' - ' + ret.language;
}
_this.setTitle(title);
_this.$textarea.val('').hide();
_this.$box.show();
}
@ -127,7 +131,11 @@ heist.prototype.lockDocument = function() {
this.doc.save(this.$textarea.val(), function(ret) {
if (ret) {
_this.$code.html(ret.value);
_this.setTitle(ret.language ? ret.language : 'unknown');
var title = ret.key;
if (ret.language) {
title += ' - ' + ret.language;
}
_this.setTitle(title);
window.history.pushState(null, _this.appName + '-' + ret.key, '/' + ret.key);
_this.$textarea.val('').hide();
_this.$box.show();