From b9e9bd154ceb054cdeffe87cc9f3159aa9629dcc Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Sat, 19 Nov 2011 00:02:11 -0500 Subject: [PATCH] Fix some annoying visual quirks --- TODO | 1 + static/application.js | 6 ++++-- static/index.html | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 7baae52..9a3a534 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,7 @@ cache headers for static assets tests test in other browsers and add note to README maximum size of a haste +fix any annoying visual quirks # shared version only twitter posting with ^T diff --git a/static/application.js b/static/application.js index 2a690d8..3a5fa4d 100644 --- a/static/application.js +++ b/static/application.js @@ -74,7 +74,9 @@ haste.prototype.newDocument = function(hideHistory) { window.history.pushState(null, this.appName, '/'); } this.setTitle(); - this.$textarea.val('').show().focus(); + this.$textarea.show('fast', function() { + this.focus(); + }); } // Load a document and show it @@ -128,7 +130,7 @@ haste.prototype.lockDocument = function() { // Configure keyboard shortcuts for the textarea haste.prototype.configureShortcuts = function() { var _this = this; - $('body').keyup(function(evt) { + $('body').keydown(function(evt) { // ^L or ^S for lock if (evt.ctrlKey && (evt.keyCode === 76 || evt.keyCode === 83)) { if (_this.$textarea.val().replace(/^\s+|\s+$/g, '') !== '') { diff --git a/static/index.html b/static/index.html index d2157de..49a1cb8 100644 --- a/static/index.html +++ b/static/index.html @@ -15,7 +15,6 @@ $(function() { // Set up var app = new haste('haste'); - $('textarea').focus(); // Handle pops window.onpopstate = function(evt) { var path = evt.target.location.pathname;