Rename to haste

This commit is contained in:
John Crepezzi 2011-11-18 17:23:23 -05:00
parent fe68e42b90
commit a6bd69f20a
3 changed files with 40 additions and 43 deletions

25
static/application.css Normal file
View File

@ -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;
}

View File

@ -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

View File

@ -2,36 +2,10 @@
<head>
<title>heist</title>
<title>haste</title>
<link rel="stylesheet" type="text/css" href="solarized_dark.css"/>
<style type="text/css">
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;
}
</style>
<link rel="stylesheet" type="text/css" href="application.css"/>
<script type="text/javascript" src="jquery-1.7.min.js"></script>
<script type="text/javascript" src="highlight.min.js"></script>
@ -40,7 +14,7 @@
<script type="text/javascript">
$(function() {
// Set up
var app = new heist('heist');
var app = new haste('haste');
$('textarea').focus();
// Handle pops
window.onpopstate = function(evt) {