Make CodeMirror usage optional. update email address

This commit is contained in:
Joshua Bell
2012-06-20 12:13:06 -04:00
parent d7b3a08957
commit 895bd172d8
3 changed files with 30 additions and 10 deletions

View File

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