Repository navigation
Expand file tree
/
Copy pathhtmlcontent.h
More file actions
59 lines (59 loc) · 2.12 KB
/
Copy pathhtmlcontent.h
File metadata and controls
59 lines (59 loc) · 2.12 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#define EDITPAGE "<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"utf-8\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">" \
"<title>mbed mruby editor</title>" \
"<link href=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.css\" rel=\"stylesheet\" type=\"text/css\">" \
"<link href=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/solarized.min.css\" rel=\"stylesheet\" type=\"text/css\">" \
"<link href=\"http://fonts.googleapis.com/css?family=Source+Code+Pro\" rel=\"stylesheet\" type=\"text/css\">" \
"<style>" \
"textarea{font-family: 'Source Code Pro', sans-serif;}" \
"h2{color: #333;}" \
"#nav-bar{height: 30px;}" \
"#header{height: 2.5em;}" \
"#editor{height: 500px; width: 100%;}" \
"</style>" \
"</head>" \
"<body>" \
"<div id=\"header\">" \
"<h2>mbed mruby editor</h2>" \
"</div>" \
"<div id=\"nav-bar\">" \
"<button id=\"run-btn\">Run</button>" \
"</div>" \
"<div id=\"editor-container\">" \
"<textarea id=\"editor\">include Mbed\n" \
"led = DigitalOut.new LED1\n" \
"sleep 1\n" \
"led.write 1\n" \
"sleep 1\n" \
"led.write 0\n" \
"sleep 1\n" \
"led.write 1</textarea>\n" \
"</div>\n" \
"<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js\"></script>" \
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>" \
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/ruby/ruby.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>" \
"<script>" \
"var editor = CodeMirror.fromTextArea(document.getElementById(\"editor\"), {" \
" lineNumbers: true," \
" mode: \"ruby\"," \
" theme: \"solarized light\"" \
"});" \
"$('#run-btn').click(function() {" \
" var code = editor.getValue();" \
" $.ajax({" \
" url: 'run'," \
" type: 'POST'," \
" data: code," \
" contentType: 'text/plain'," \
" success: function() {" \
" }," \
" error: function() {" \
" }" \
" });" \
"});" \
"</script>" \
"</body>" \
"</html>"