72 lines
1.9 KiB
HTML
72 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>CodeMirror: Lazy Mode Loading Demo</title>
|
|
<link rel="stylesheet" href="../lib/codemirror.css">
|
|
<script src="../lib/codemirror.js"></script>
|
|
<script src="../lib/util/loadmode.js"></script>
|
|
<script src="../mode/clike/clike.js"></script>
|
|
<script src="../mode/pascal/pascal.js"></script>
|
|
<script src="../mode/python/python.js"></script>
|
|
<script src="../mode/shell/shell.js"></script>
|
|
<link rel="stylesheet" href="../doc/docs.css">
|
|
<link rel="stylesheet" href="../theme/eclipse.css">
|
|
</head>
|
|
<body>
|
|
<form><textarea id="code" name="code">
|
|
procedure a
|
|
begin
|
|
a:=9;
|
|
end
|
|
int main()
|
|
{
|
|
for(int i=0;i<100;i++)
|
|
cout<<a;
|
|
}
|
|
</textarea></form>
|
|
|
|
<select onchange ="change()" id="modeselect">
|
|
|
|
<option value="1">C (GCC 4.4)</option>
|
|
<option value="2">C++ (G++ 4.4)</option>
|
|
<option value="3">Java (Sun JDK 5)</option>
|
|
<option value="4">Java (Sun JDK 6)</option>
|
|
<option value="5">Pascal (Free Pascal 2.4)</option>
|
|
<option value="6">Python 2.5</option>
|
|
<option value="7">C# (Mono 2.0)</option>
|
|
<option value="8">Bash (Bash 3)</option>
|
|
</select>
|
|
<script>
|
|
//CodeMirror.modeURL = "../mode/%N/%N.js";
|
|
|
|
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
lineNumbers: true,
|
|
tabSize: 4,
|
|
indentUnit: 4,
|
|
indentWithTabs: true,
|
|
mode: "text/x-csrc"
|
|
});
|
|
//var a;
|
|
var arr = new Array();
|
|
arr[0] = "text/x-csrc";
|
|
arr[1] = "text/x-csrc";
|
|
arr[2] = "text/x-c++src";
|
|
arr[3] = "text/x-java";
|
|
arr[4] = "text/x-java";
|
|
arr[5] = "text/x-pascal";
|
|
arr[6] = "text/x-python";
|
|
arr[7] = "text/x-csharp";
|
|
arr[8] = "text/x-sh";
|
|
|
|
|
|
var modeInput = document.getElementById("modeselect");
|
|
function change() {
|
|
editor.setOption("mode",arr[modeInput.value]);
|
|
editor.setOption("theme", "eclipse");
|
|
CodeMirror.autoLoadMode(editor, arr[modeInput.value]);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|