1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-01 03:21:21 +00:00

Things working

This commit is contained in:
John Crepezzi 2011-11-17 22:44:48 -05:00
commit 9d0b0c9f21
5 changed files with 9267 additions and 0 deletions

76
application.js Normal file
View file

@ -0,0 +1,76 @@
var application = function() {
};
// TODO implement save as a jquery method
// TODO maybe remove jquery
// TODO support for browsers without pushstate
// TODO tab support
// TODO support for push state navigation
// TODO layerX and layerY fix warnings
// TODO turn off spelling correction
var save = function(data, callback) {
var high = hljs.highlightAuto(data);
var pack = {
language: high.language,
data: data
};
pack.value = high.value;
pack.uuid = '123456';
callback(pack);
};
$(function() {
$('textarea').focus();
$('textarea').keyup(function(evt) {
if (evt.ctrlKey && evt.which === 76) {
save($('textarea').val(), function(ret) {
if (ret) {
$('#box code').html(ret.value);
// window.history.pushState(null, 'Heist - ' + ret.language, '/~john/heist/' + ret.uuid);
document.title = 'heist - ' + ret.language;
$('textarea').hide();
$('#box').show();
}
});
}
});
$('textarea').keydown(function(evt) {
if (evt.keyCode === 9) {
evt.preventDefault();
var myValue = ' ';
// Inspired by http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery
// For browsers like Internet Explorer
if (document.selection) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
}
// Mozilla and Webkit
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
var endPos = this.selectionEnd;
var scrollTop = this.scrollTop;
this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos,this.value.length);
this.focus();
this.selectionStart = startPos + myValue.length;
this.selectionEnd = startPos + myValue.length;
this.scrollTop = scrollTop;
}
else {
this.value += myValue;
this.focus();
}
}
});
});

1
highlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

50
index.html Normal file
View file

@ -0,0 +1,50 @@
<html>
<head>
<title>heist</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>
<script type="text/javascript" src="jquery-1.6.3.js"></script>
<script type="text/javascript" src="highlight.min.js"></script>
<script type="text/javascript" src="application.js"></script>
</head>
<body>
<pre id="box" style="display:none;"><code></code></pre>
<textarea></textarea>
</body>
</html>

9044
jquery-1.6.3.js vendored Normal file

File diff suppressed because it is too large Load diff

96
solarized_dark.css Normal file
View file

@ -0,0 +1,96 @@
/*
Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
*/
pre code {
display: block; padding: 0.5em;
background: #002b36; color: #839496;
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .doctype,
pre .lisp .string,
pre .javadoc {
color: #586e75;
font-style: italic;
}
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .method,
pre .addition,
pre .css .tag,
pre .lisp .title {
color: #859900;
}
pre .number,
pre .command,
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula,
pre .regexp,
pre .hexcolor {
color: #2aa198;
}
pre .title,
pre .localvars,
pre .function .title,
pre .chunk,
pre .decorator,
pre .builtin,
pre .built_in,
pre .lisp .title,
pre .identifier,
pre .title .keymethods,
pre .id {
color: #268bd2;
}
pre .tag .title,
pre .rules .property,
pre .django .tag .keyword {
font-weight: bold;
}
pre .attribute,
pre .variable,
pre .instancevar,
pre .lisp .body,
pre .smalltalk .number,
pre .constant,
pre .class .title,
pre .parent,
pre .haskell .label {
color: #b58900;
}
pre .preprocessor,
pre .pi,
pre .shebang,
pre .symbol,
pre .diff .change,
pre .special,
pre .keymethods,
pre .attr_selector,
pre .important,
pre .subst,
pre .cdata {
color: #cb4b16;
}
pre .deletion {
color: #dc322f;
}
pre .tex .formula {
background: #073642;
}