diff --git a/index.htm b/index.htm index 366c069..3a79b66 100644 --- a/index.htm +++ b/index.htm @@ -111,7 +111,7 @@ By Joshua Bell
-
+ @@ -164,7 +164,7 @@ By Joshua Bell

History

- + diff --git a/index.js b/index.js index 70fb507..10832a1 100644 --- a/index.js +++ b/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 diff --git a/styles.css b/styles.css index 385acd2..61ca41a 100644 --- a/styles.css +++ b/styles.css @@ -1,4 +1,3 @@ - body { background-color: #EEEACD; } h1, h2, h3, p { margin-bottom: 6pt; margin-top: 6pt; } td { vertical-align: top; }