mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-22 07:30:19 +00:00
Make CodeMirror usage optional. update email address
This commit is contained in:
parent
d7b3a08957
commit
895bd172d8
@ -111,7 +111,7 @@ By <a href="mailto:inexorabletash@hotmail.com">Joshua Bell</a>
|
||||
<!-- Source code editor inserted here -->
|
||||
<div id="editorframe"></div>
|
||||
|
||||
<form id="submission" method="post" enctype="text/plain" action="mailto:inexorabletash@hotmail.com?subject=Applesoft%20Sample%20Submission">
|
||||
<form id="submission" method="post" enctype="text/plain" action="mailto:inexorabletash@gmail.com?subject=Applesoft%20Sample%20Submission">
|
||||
<textarea name="source" id="source" style="display: none;">
|
||||
</textarea>
|
||||
<input type="submit" id="btn_share" value="Share your sample!">
|
||||
@ -164,7 +164,7 @@ By <a href="mailto:inexorabletash@hotmail.com">Joshua Bell</a>
|
||||
<h3 id="history">History</h3>
|
||||
<div id="feed"></div>
|
||||
|
||||
|
||||
<!-- CodeMirror syntax highlighting - this is optional -->
|
||||
<script src="cm2/lib/codemirror.js"></script>
|
||||
<link rel="stylesheet" href="cm2/lib/codemirror.css">
|
||||
<script src="cm2/mode/basic/basic.js"></script>
|
||||
|
35
index.js
35
index.js
@ -42,13 +42,34 @@ window.onload = function () {
|
||||
};
|
||||
var pdl = [0, 0, 0, 0];
|
||||
|
||||
// Lexical highlighting
|
||||
var editor = new CodeMirror($('#editorframe'), {
|
||||
mode: 'basic',
|
||||
tabMode: 'default',
|
||||
content: $('#source').value,
|
||||
height: '100%'
|
||||
});
|
||||
// Lexical highlighting, if available
|
||||
var editor;
|
||||
if (typeof CodeMirror === 'function') {
|
||||
editor = new CodeMirror($('#editorframe'), {
|
||||
mode: 'basic',
|
||||
tabMode: 'default',
|
||||
content: $('#source').value,
|
||||
height: '100%'
|
||||
});
|
||||
} else {
|
||||
editor = (function () {
|
||||
var textArea = document.createElement('textarea');
|
||||
$('#editorframe').appendChild(textArea);
|
||||
textArea.style.width = '598px';
|
||||
textArea.style.height = '384px';
|
||||
return {
|
||||
getValue: function () {
|
||||
return textArea.value;
|
||||
},
|
||||
setValue: function (value) {
|
||||
textArea.value = value;
|
||||
},
|
||||
setCursor: function (line, column) {
|
||||
// TODO: Implement me!
|
||||
}
|
||||
};
|
||||
}());
|
||||
}
|
||||
|
||||
$('#btn_share').onclick = function () {
|
||||
// Load up the hidden text area with the current source
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
body { background-color: #EEEACD; }
|
||||
h1, h2, h3, p { margin-bottom: 6pt; margin-top: 6pt; }
|
||||
td { vertical-align: top; }
|
||||
|
Loading…
Reference in New Issue
Block a user