Loading TODO +3 −0 Original line number Diff line number Diff line Loading @@ -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 static/application.css +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ textarea { #box { padding: 0px; margin: 0px; width: 100%; height: 100%; } Loading static/application.js +4 −4 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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(); } }); }; Loading @@ -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, '') !== '') { Loading static/index.html +23 −13 Original line number Diff line number Diff line Loading @@ -12,11 +12,9 @@ <script type="text/javascript" src="application.js"></script> <script type="text/javascript"> $(function() { // Set up var app = new haste('haste', { twitter: true }); var app = null; // Handle pops window.onpopstate = function(evt) { var handlePop = function(evt) { var path = evt.target.location.pathname; if (path === '/') { app.newDocument(true); Loading @@ -25,6 +23,18 @@ app.loadDocument(path.substring(1, path.length)); } }; // If pop before loading jquery, delay load window.onpopstate = function(evt) { try { handlePop(evt); } catch(err) { // not loaded yet } }; // Construct app and load if not loaded $(function() { app = new haste('haste', { twitter: true }); handlePop({ target: window }); }); </script> Loading @@ -33,7 +43,7 @@ <body> <div id="key"></div> <pre id="box" style="display:none;"><code></code></pre> <pre id="box" style="display:none;" tabindex="0"><code></code></pre> <textarea spellcheck="false" style="display:none;"></textarea> </body> Loading Loading
TODO +3 −0 Original line number Diff line number Diff line Loading @@ -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
static/application.css +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ textarea { #box { padding: 0px; margin: 0px; width: 100%; height: 100%; } Loading
static/application.js +4 −4 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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(); } }); }; Loading @@ -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, '') !== '') { Loading
static/index.html +23 −13 Original line number Diff line number Diff line Loading @@ -12,11 +12,9 @@ <script type="text/javascript" src="application.js"></script> <script type="text/javascript"> $(function() { // Set up var app = new haste('haste', { twitter: true }); var app = null; // Handle pops window.onpopstate = function(evt) { var handlePop = function(evt) { var path = evt.target.location.pathname; if (path === '/') { app.newDocument(true); Loading @@ -25,6 +23,18 @@ app.loadDocument(path.substring(1, path.length)); } }; // If pop before loading jquery, delay load window.onpopstate = function(evt) { try { handlePop(evt); } catch(err) { // not loaded yet } }; // Construct app and load if not loaded $(function() { app = new haste('haste', { twitter: true }); handlePop({ target: window }); }); </script> Loading @@ -33,7 +43,7 @@ <body> <div id="key"></div> <pre id="box" style="display:none;"><code></code></pre> <pre id="box" style="display:none;" tabindex="0"><code></code></pre> <textarea spellcheck="false" style="display:none;"></textarea> </body> Loading