-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
31 lines (28 loc) · 941 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
document.addEventListener("DOMContentLoaded", function() {
var editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
//mode: language
mode: 'text/x-c++src',
//theme
theme: 'midnight',
//line number
lineNumbers: true,
//closing brackets
autoCloseBrackets: true,
});
//height width
var width = window.innerWidth;
editor.setSize(0.7 * width, '500');
//syntax highlighting according to language
var option = document.getElementById('specificSizeSelect');
option.addEventListener('change', function() {
if(option.value == 'Java'){
editor.setOption('mode', 'text/x-java');
}
else if(option.value == 'python'){
editor.setOption('mode', 'text/x-python');
}
else{
editor.setOption('mode', 'text/x-c++src');
}
})
});