More refactoring

This commit is contained in:
Berkeley Martinez
2015-11-17 21:25:16 -08:00
parent 748f7ab93f
commit 29f90505b7
30 changed files with 1043 additions and 1569 deletions

View File

@@ -0,0 +1,53 @@
window.common = (function(global) {
const {
CodeMirror,
document: doc,
common = { init: [] }
} = global;
const { challengeType = '0' } = common;
if (
!CodeMirror ||
challengeType === '0' ||
challengeType === '7'
) {
common.updateOutputDisplay = () => {};
common.appendToOutputDisplay = () => {};
return common;
}
var codeOutput = CodeMirror.fromTextArea(
doc.getElementById('codeOutput'),
{
lineNumbers: false,
mode: 'text',
theme: 'monokai',
readOnly: 'nocursor',
lineWrapping: true
}
);
codeOutput.setValue(`
/**
* Your output will go here.
* Console.log() -type statements
* will appear in your browser\'s
* DevTools JavaScript console.
*/'
`);
codeOutput.setSize('100%', '100%');
common.updateOutputDisplay = function updateOutputDisplay(str) {
codeOutput.setValue(str);
return str;
};
common.appendToOutputDisplay = function appendToOutputDisplay(str) {
codeOutput.setValue(codeOutput.getValue() + str);
return str;
};
return common;
}(window));