From af02375b7c43aebca5808089f9994ba84b9217eb Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Sat, 19 Nov 2011 00:30:14 -0500 Subject: [PATCH] Show certain options only sometimes --- static/application.css | 1 + static/application.js | 23 +++++++++++++++++++++++ static/index.html | 9 +-------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/static/application.css b/static/application.css index 120140b..bd279d0 100644 --- a/static/application.css +++ b/static/application.css @@ -37,6 +37,7 @@ textarea { color: #999; font-size: 13px; font-family: monospace; + line-height: 1.3em; } #key em { diff --git a/static/application.js b/static/application.js index d9e7eb3..b1c6e24 100644 --- a/static/application.js +++ b/static/application.js @@ -68,6 +68,26 @@ haste.prototype.setTitle = function(ext) { document.title = title; }; +// Show the light key +haste.prototype.lightKey = function() { + var text = ''; + text += '' + this.appName + ''; + text += '^s - save
'; + text += '^n - new'; + $('#key').html(text); +}; + +// Show the full key +haste.prototype.fullKey = function() { + var text = ''; + text += '' + this.appName + ''; + text += '^s - save
'; + text += '^n - new
'; + text += '^d - duplicate
'; + text += '^t - twitter'; + $('#key').html(text); +}; + // Remove the current document (if there is one) // and set up for a new one haste.prototype.newDocument = function(hideHistory) { @@ -77,6 +97,7 @@ haste.prototype.newDocument = function(hideHistory) { window.history.pushState(null, this.appName, '/'); } this.setTitle(); + this.lightKey(); this.$textarea.show('fast', function() { this.focus(); }); @@ -94,6 +115,7 @@ haste.prototype.loadDocument = function(key) { title += ' - ' + ret.language; } _this.setTitle(title); + _this.fullKey(); _this.$textarea.val('').hide(); _this.$box.show(); } @@ -123,6 +145,7 @@ haste.prototype.lockDocument = function() { title += ' - ' + ret.language; } _this.setTitle(title); + _this.fullKey(); window.history.pushState(null, _this.appName + '-' + ret.key, '/' + ret.key); _this.$textarea.val('').hide(); _this.$box.show(); diff --git a/static/index.html b/static/index.html index 8d321b8..68c60dc 100644 --- a/static/index.html +++ b/static/index.html @@ -32,14 +32,7 @@ -
- haste - ^s - save
- ^n - new
- ^d - duplicate
- ^t - tweet -
- +