Fix some annoying visual quirks

This commit is contained in:
John Crepezzi 2011-11-19 00:02:11 -05:00
parent a213bdf9da
commit b9e9bd154c
3 changed files with 5 additions and 3 deletions

1
TODO
View file

@ -2,6 +2,7 @@ cache headers for static assets
tests tests
test in other browsers and add note to README test in other browsers and add note to README
maximum size of a haste maximum size of a haste
fix any annoying visual quirks
# shared version only # shared version only
twitter posting with ^T twitter posting with ^T

View file

@ -74,7 +74,9 @@ haste.prototype.newDocument = function(hideHistory) {
window.history.pushState(null, this.appName, '/'); window.history.pushState(null, this.appName, '/');
} }
this.setTitle(); this.setTitle();
this.$textarea.val('').show().focus(); this.$textarea.show('fast', function() {
this.focus();
});
} }
// Load a document and show it // Load a document and show it
@ -128,7 +130,7 @@ haste.prototype.lockDocument = function() {
// Configure keyboard shortcuts for the textarea // Configure keyboard shortcuts for the textarea
haste.prototype.configureShortcuts = function() { haste.prototype.configureShortcuts = function() {
var _this = this; var _this = this;
$('body').keyup(function(evt) { $('body').keydown(function(evt) {
// ^L or ^S for lock // ^L or ^S for lock
if (evt.ctrlKey && (evt.keyCode === 76 || evt.keyCode === 83)) { if (evt.ctrlKey && (evt.keyCode === 76 || evt.keyCode === 83)) {
if (_this.$textarea.val().replace(/^\s+|\s+$/g, '') !== '') { if (_this.$textarea.val().replace(/^\s+|\s+$/g, '') !== '') {

View file

@ -15,7 +15,6 @@
$(function() { $(function() {
// Set up // Set up
var app = new haste('haste'); var app = new haste('haste');
$('textarea').focus();
// Handle pops // Handle pops
window.onpopstate = function(evt) { window.onpopstate = function(evt) {
var path = evt.target.location.pathname; var path = evt.target.location.pathname;