-
Notifications
You must be signed in to change notification settings - Fork 28
/
template.html
84 lines (67 loc) · 2.98 KB
/
template.html
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<%
codePath = 'examples/'+exampleId+'/soln.py'
nLines = sum(1 for line in open(codePath))
editorHeight = 20.0 * nLines
%>
<title>{{title}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="../../style.css">
<!-- Java Script -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- font awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<!-- SWAL -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<!-- Stanford -->
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Source+Serif+Pro:400,600,700' rel='stylesheet' type='text/css'>
<body>
<div class="container container-course">
<div class="row">
<div class="col">
<h1>{{title}}</h1>
<p class="subtleHeading">{{credit}}</p>
<hr/>
{{!html}}
<h2>Solution</h2>
<p>
<a class="btn btn-primary" id="soln-btn" onclick="toggleButtonText()"
data-toggle="collapse" href="#soln-collapse" aria-expanded="false"
aria-controls="Collapse">
Show Solution
</a>
</p>
<div class="collapse" id="soln-collapse">
<pre class="console" id="editor" style="height:{{editorHeight}}px">{{soln}}</pre>
</div>
<script src="../../plugins/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme('ace/theme/eclipse');
editor.getSession().setMode("ace/mode/python");
editor.setReadOnly(true);
editor.renderer.setShowGutter(false);
editor.setFontSize("14px");
/*editor.setTheme("ace/theme/eclipse");
editor.getSession().setMode("ace/mode/java");*/
</script>
<script>
function toggleButtonText() {
var elem = document.getElementById("soln-btn");
if (elem.innerHTML.trim() === "Show Solution") {
elem.innerHTML = "Hide Solution";
} else {
elem.innerHTML = "Show Solution";
}
}
</script>
<hr/>
</div>
</div>
</div>
</body>