From a6bd69f20a6d04d095604d3696c29e4c41398c7b Mon Sep 17 00:00:00 2001 From: John Crepezzi Date: Fri, 18 Nov 2011 17:23:23 -0500 Subject: [PATCH] Rename to haste --- static/application.css | 25 +++++++++++++++++++++++++ static/application.js | 26 ++++++++++++-------------- static/index.html | 32 +++----------------------------- 3 files changed, 40 insertions(+), 43 deletions(-) create mode 100644 static/application.css diff --git a/static/application.css b/static/application.css new file mode 100644 index 0000000..f5a79ef --- /dev/null +++ b/static/application.css @@ -0,0 +1,25 @@ +body { + background: #002B36; + padding: 0px; + margin: 0px; +} +textarea { + background: transparent; + border: 0px; + color: #fff; + padding: 20px; + width: 100%; + height: 100%; + font-family: monospace; + outline: none; + resize: none; + font-size: 13px; +} +#box { + padding: 0px; + width: 100%; + height: 100%; +} +#box code { + padding: 20px; +} diff --git a/static/application.js b/static/application.js index c0d0142..35745ef 100644 --- a/static/application.js +++ b/static/application.js @@ -1,13 +1,11 @@ ///// represents a single document -// TODO change name to haste - -var heist_document = function() { +var haste_document = function() { this.locked = false; }; // Get this document from the server and lock it here -heist_document.prototype.load = function(key, callback) { +haste_document.prototype.load = function(key, callback) { var _this = this; $.ajax('/documents/' + key, { type: 'get', @@ -29,7 +27,7 @@ heist_document.prototype.load = function(key, callback) { }; // Save this document to the server and lock it here -heist_document.prototype.save = function(data, callback) { +haste_document.prototype.save = function(data, callback) { if (this.locked) { return false; } @@ -53,7 +51,7 @@ heist_document.prototype.save = function(data, callback) { ///// represents the paste application -var heist = function(appName) { +var haste = function(appName) { this.appName = appName; this.$textarea = $('textarea'); this.$box = $('#box'); @@ -64,15 +62,15 @@ var heist = function(appName) { // TODO add key of commands // Set the page title - include the appName -heist.prototype.setTitle = function(ext) { +haste.prototype.setTitle = function(ext) { var title = ext ? this.appName + ' - ' + ext : this.appName; document.title = title; }; // Remove the current document (if there is one) // and set up for a new one -heist.prototype.newDocument = function(hideHistory) { - this.doc = new heist_document(); +haste.prototype.newDocument = function(hideHistory) { + this.doc = new haste_document(); this.$box.hide(); if (!hideHistory) { window.history.pushState(null, this.appName, '/'); @@ -82,9 +80,9 @@ heist.prototype.newDocument = function(hideHistory) { } // Load a document and show it -heist.prototype.loadDocument = function(key) { +haste.prototype.loadDocument = function(key) { var _this = this; - _this.doc = new heist_document(); + _this.doc = new haste_document(); _this.doc.load(key, function(ret) { if (ret) { _this.$code.html(ret.value); @@ -103,7 +101,7 @@ heist.prototype.loadDocument = function(key) { }; // Duplicate the current document - only if locked -heist.prototype.duplicateDocument = function() { +haste.prototype.duplicateDocument = function() { if (this.doc.locked) { var currentData = this.doc.data; this.newDocument(); @@ -112,7 +110,7 @@ heist.prototype.duplicateDocument = function() { }; // Lock the current document -heist.prototype.lockDocument = function() { +haste.prototype.lockDocument = function() { var _this = this; this.doc.save(this.$textarea.val(), function(ret) { if (ret) { @@ -130,7 +128,7 @@ heist.prototype.lockDocument = function() { }; // Configure keyboard shortcuts for the textarea -heist.prototype.configureShortcuts = function() { +haste.prototype.configureShortcuts = function() { var _this = this; $('body').keyup(function(evt) { // ^L or ^S for lock diff --git a/static/index.html b/static/index.html index b809880..503a8b0 100644 --- a/static/index.html +++ b/static/index.html @@ -2,36 +2,10 @@ - heist + haste - + @@ -40,7 +14,7 @@