-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·368 lines (344 loc) · 15.5 KB
/
index.html
File metadata and controls
executable file
·368 lines (344 loc) · 15.5 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!-- Crowd Course Python interactive learning. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" href="assets/images/favicon.ico">
<title>Python 3 - Crowd Course - Stanford Engineering</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/bootcards-desktop.min.css">
<link rel="stylesheet" href="assets/css/bootcards-demo-app.css">
<link rel="stylesheet" href="assets/css/main.css">
<style>
.sidebarContent {
background:#7CA1CA;
color:#FFF;
position: absolute;
left: -300px;
top: 50px;
height: auto;
width: 300px;
padding: 10px;
transition: left 300ms cubic-bezier(0.17, 0.04, 0.03, 0.94);
overflow: hidden;
box-sizing: border-box;
font-size: 12px;
}
#toggle {
position:absolute;
appearance:none;
cursor:pointer;
left:-100%;
top:-100%;
}
#toggle + .container label {
/*position:absolute;*/
cursor:pointer;
padding:10px;
background: #7CA1CA;
width: 100px;
border-radius: 3px;
padding: 8px 10px;
color: #FFF;
line-height:20px;
font-size:12px;
text-align:center;
-webkit-font-smoothing: antialiased;
cursor: pointer;
/*margin:20px 50px;*/
transition: all 500ms ease;
}
#toggle + .container label:after {
content:"Chapters"
}
.container {
transition: all 400ms cubic-bezier(0.17, 0.04, 0.03, 0.94);
/*doesn't seem to work*/
}
#toggle:checked ~ .container .sidebarContent {
left: 0;
}
#toggle:checked ~ .container {
margin-left: 300px;
}
#toggle:checked + .container label {
background: #D65C5C;
}
#toggle:checked + .container label:after {
content:"Hide"
}
.sidebarContent a.list-group-item:before {
/*removes the arrow*/
content: "";
}
.sidebarContent .panel-default .panel-heading {
padding: 5px 15px;
}
.sidebarContent h4 {
font-size: 14px;
}
.sidebarContent a.list-group-item {
margin-left: 0;
padding-left: 15px;
}
.sidebarContent .panel-heading a:focus {
outline: none;
}
.sidebarContent .panel-heading a,
.sidebarContent .panel-heading a:hover,
.sidebarContent .panel-heading a:focus {
text-decoration: none;
color: #777777;
}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body id="bootcards">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<button type="button" class="btn btn-default btn-back navbar-left pull-left hidden" onclick="history.back()">
<i class="fa fa-lg fa-chevron-left"></i><span>Back</span>
</button>
<button type="button" class="btn btn-default btn-menu navbar-left pull-left offCanvasToggle" data-toggle="offcanvas">
<i class="fa fa-lg fa-bars"></i><span>Menu</span>
</button>
<a class="navbar-brand no-break-out" title="Python 3 - Crowd Course" href="#">Python 3 - Crowd Course</a>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#" data-pjax="#main" data-title="Home"><i class="fa fa-home"></i> Home</a></li>
<li><a href="#" data-pjax="#main" data-title="Syllabus"><i class="fa fa-book"></i> Syllabus</a></li>
<li><a href="#" data-pjax="#main" data-title="Contact"><i class="fa fa-users"></i> Contact</a></li>
</ul>
</div>
</div>
</div>
<nav id="offCanvasMenu" class="navmenu offcanvas offcanvas-left">
<ul class="nav">
<li class="active"><a href="#" data-pjax="#main" data-title="Home"><i class="fa fa-lg fa-home"></i> Home</a></li>
<li><a href="#" data-pjax="#main" data-title="Syllabus"><i class="fa fa-lg fa-book"></i> Syllabus</a></li>
<li><a href="#" data-pjax="#main" data-title="Contact"><i class="fa fa-lg fa-users"></i> Contact</a></li>
</ul>
<div style="margin-top:20px; padding-left: 20px; font-size: 12px; color: #777">v1.0</div>
</nav>
<input type="checkbox" name="toggle" id="toggle" />
<div class="container">
<label for="toggle"></label>
<div class="sidebarContent">
<div class="panel-group" id="accordion-cat-1">
<div class="panel panel-default panel-faq">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#accordion-cat-1" href="#faq-cat-1-sub-1">
<h4 class="panel-title">
Chapter 1
<span class="pull-right"><i class="glyphicon glyphicon-plus"></i></span>
<h5>Data types, Data Structures, Operators and I/O</h5>
</h4>
</a>
</div>
<div id="faq-cat-1-sub-1" class="panel-collapse collapse">
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item active">
<h4 class="list-group-item-heading">Numbers, operators, and operations</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">Input and Output operations</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
</div>
</div>
</div>
</div>
<div class="panel panel-default panel-faq">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#accordion-cat-1" href="#faq-cat-1-sub-2">
<h4 class="panel-title">
Chapter 1
<span class="pull-right"><i class="glyphicon glyphicon-plus"></i></span>
<h5>Data types, Data Structures, Operators and I/O</h5>
</h4>
</a>
</div>
<div id="faq-cat-1-sub-2" class="panel-collapse collapse">
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item active">
<h4 class="list-group-item-heading">Numbers, operators, and operations</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading">Input and Output operations</h4>
<p class="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container bootcards-container" id="main">
<!-- <div class="row"> -->
<!-- <a href="#" class="btn btn-danger" id="opener"><i class="glyphicon glyphicon-align-justify"></i></a> -->
<!-- </div> -->
<!-- <div class="row"> -->
<!-- <div class="col-sm-12"> -->
<!-- <nav><ul class="pagination navbar-nav"></ul></nav> -->
<!-- </div> -->
<!-- </div> -->
<div class="row">
<div class="bootcards-cards">
<div class="col-sm-6">
<div class="panel panel-default bootcards-chart">
<div class="panel-heading">
<h3 id="video-title" class="panel-title">Video</h3>
</div>
<div class="video embed-responsive embed-responsive-16by9">
<div id="video-placeholder" class="embed-responsive-item"></div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="panel panel-default bootcards-chart">
<div class="panel-heading">
<div class="btn-group" role="group" aria-label="...">
<button type="button" onclick="runIt()" class="btn btn-default"><i class="fa fa-play" data-content="Try this!"></i></button>
<button type="button" onclick="showEditor()" class="btn btn-default"><i class="fa fa-pencil-square-o"></i></button>
<button type="button" class="btn btn-default"><i class="fa fa-question-circle"></i></button>
</div>
</div>
<div class="embed-responsive embed-responsive-16by9">
<div id="editor" class="embed-responsive-item"></div>
<pre id="output" style="display:none" class="embed-responsive-item"></pre>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default bootcards-chart">
<div class="panel-heading">
<h3 class="panel-title">Notes</h3>
</div>
<div class="embed-responsive embed-responsive-16by9">
<iframe src="assets/info_panel/while_loop.html"></iframe>
</div>
</div>
</div>
</div>
<!-- Putting this into the container for now -->
<span id="current-time">0:00</span> / <span id="duration">0:00</span>
</div>
<div class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<div class="bootcards-desktop-footer clearfix">
<a href="https://msande.stanford.edu/" target="_blank"><img src="http://crowdcourse.stanford.edu/images/MS&E-web.png" alt="UCSC" height="50" align="left"></a>
</div>
</div>
</div>
<script>
var isDesktop = true;
</script>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="http://www.skulpt.org/static/skulpt.min.js"></script>
<script src="http://www.skulpt.org/static/skulpt-stdlib.js"></script>
<!-- <script src="assets/js/src-noconflict/ace.js" charset="utf-8"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
<script>
Sk.python3 = true; // set python 3's syntax
//Initializing ace editor
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/python");
editor.$blockScrolling = Infinity;
var session = editor.session;
//Initializing typing function
function say(str) {
showEditor(); // display editor just in case if student navigates away
(function iterator(index) {
if (index < str.length) {
session.insert({
row: session.getLength(),
column: 0
}, str.charAt(index));
setTimeout(function() {
iterator(++index);
}, 0);
}
})(0);
}
// output functions are configurable. This one just appends some text
// to a pre element.
function outf(text) {
var mypre = document.getElementById("output");
mypre.innerHTML = mypre.innerHTML + text;
}
function builtinRead(x) {
if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
throw "File not found: '" + x + "'";
return Sk.builtinFiles["files"][x];
}
function sleepFor(sleepDuration) {
var now = new Date().getTime();
while (new Date().getTime() < now + sleepDuration) { /* do nothing */ }
}
// Here's everything you need to run a python program in skulpt
// grab the code from your textarea
// get a reference to your pre element for output
// configure the output function
// call Sk.importMainWithBody()
function runIt() {
var prog = editor.getValue();
var mypre = document.getElementById("output");
mypre.innerHTML = '';
Sk.canvas = "mycanvas";
Sk.pre = "output";
Sk.configure({
output: outf,
read: builtinRead
});
try {
sleepFor(1);
eval(Sk.importMainWithBody("<stdin>", false, prog));
//state = 'true';
$('#editor').hide();
$('#output').show();
//player.playVideo();
} catch (e) {
alert(e.toString())
//state = 'false';
//player.pauseVideo();
}
}
function showEditor() {
$('#editor').show();
$('#output').hide();
}
var player = null;
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
<script src="https://www.youtube.com/iframe_api"></script>
<script src="assets/js/script.js"></script>
<script src="assets/js/load-content.js"></script>
</body>
</html>