From 9fa99fe69d7e3df82ab3c05aea36e7d6a249e422 Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Mon, 21 Nov 2011 09:56:33 -0500 Subject: [PATCH] Fixes for Firefox --- TODO | 3 +++ static/application.css | 1 + static/application.js | 8 ++++---- static/index.html | 36 +++++++++++++++++++++++------------- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 9538502..16c9971 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,9 @@ test in other browsers and add note to README maximum size of a haste fix any annoying visual quirks add FAVICON +cache static in memory +bug in ^n while editing # shared version only some way to do announcements easily (and use for ads) +copy URL to clipboard button diff --git a/static/application.css b/static/application.css index 2bd4ef8..e53339d 100644 --- a/static/application.css +++ b/static/application.css @@ -19,6 +19,7 @@ textarea { #box { padding: 0px; + margin: 0px; width: 100%; height: 100%; } diff --git a/static/application.js b/static/application.js index d79b394..31ba0cc 100644 --- a/static/application.js +++ b/static/application.js @@ -59,8 +59,8 @@ var haste = function(appName, options) { this.$textarea = $('textarea'); this.$box = $('#box'); this.$code = $('#box code'); - this.configureShortcuts(); this.options = options; + this.configureShortcuts(); }; // Set the page title - include the appName @@ -120,7 +120,7 @@ haste.prototype.loadDocument = function(key) { _this.setTitle(title); _this.fullKey(); _this.$textarea.val('').hide(); - _this.$box.show(); + _this.$box.show().focus(); } else { _this.newDocument(); @@ -151,7 +151,7 @@ haste.prototype.lockDocument = function() { _this.fullKey(); window.history.pushState(null, _this.appName + '-' + ret.key, '/' + ret.key); _this.$textarea.val('').hide(); - _this.$box.show(); + _this.$box.show().focus(); } }); }; @@ -159,7 +159,7 @@ haste.prototype.lockDocument = function() { // Configure keyboard shortcuts for the textarea haste.prototype.configureShortcuts = function() { var _this = this; - $('body').keydown(function(evt) { + $(document.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 7ca2172..0cc6796 100644 --- a/static/index.html +++ b/static/index.html @@ -12,19 +12,29 @@ @@ -33,7 +43,7 @@
- +