-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtutorial.js
More file actions
88 lines (78 loc) · 2.53 KB
/
Copy pathtutorial.js
File metadata and controls
88 lines (78 loc) · 2.53 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
function cb_tutorial() {
if (cb.inTutorial) return;
cb.inTutorial = true;
cb_tutorial1();
}
function cb_tutorial_setREPLExpression() {
cb.stop();
cb.query('replay=1+2*3');
cb.handle_query();
cb.focusREPL();
}
function cb_tutorial1() {
$('#cb-repl').popover({
animation: true,
placement: 'bottom',
trigger: 'manual',
title: 'Console',
content:
'<p>This is the Console. After the prompt, enter the JavaScript code you wish to execute.</p> ' +
'<p><a class="btn btn-primary" onclick="cb_tutorial_setREPLExpression();">Show me</a> ' +
'<a class="btn btn-primary" onclick="cb_tutorial2();">Next</a></p>',
html: true,
});
$('#cb-repl').popover('show');
cb.focusREPL();
}
function cb_tutorial2() {
$('#cb-repl').popover('destroy');
$('#play-button').popover({
animation: true,
placement: 'bottom',
trigger: 'manual',
title: 'Play button',
content:
'<p>Use this button to evaluate the code entered at the Console, or simply press the Enter key.</p>' +
'<p><a class="btn btn-primary" onclick="cb_tutorial_setREPLExpression();' + "setTimeout(function () { $('#play-button').click(); }, 100);" + '">Show me</a> ' +
'<a class="btn btn-primary" onclick="cb_tutorial3();">Next</a></p>',
html: true,
});
$('#play-button').popover('show');
cb.focusREPL();
}
function cb_tutorial3() {
$('#play-button').popover('destroy');
$('#step-button').popover({
animation: true,
placement: 'bottom',
trigger: 'manual',
title: 'Step button',
content:
'<p>Use this button to execute one step of the code.</p>' +
'<p><a class="btn btn-primary" onclick="cb_tutorial_setREPLExpression();' + "setTimeout(function () { $('#step-button').click(); }, 100); cb_tutorial4();" + '">Show me</a> ' +
'<a class="btn btn-primary" onclick="cb_tutorial_end();">Done</a></p>',
html: true,
});
$('#step-button').popover('show');
cb.focusREPL();
}
function cb_tutorial4() {
$('#step-button').popover('destroy');
$('#step-button').popover({
animation: false,
placement: 'bottom',
trigger: 'manual',
title: 'Step button',
content:
'<p>Press the button again to execute the next step. Repeat until the code is fully evaluated, or press the Play button.</p>' +
'<p><a class="btn btn-primary" onclick="cb_tutorial_end();">Done</a></p>',
html: true,
});
$('#step-button').popover('show');
cb.focusREPL();
}
function cb_tutorial_end() {
$('#step-button').popover('destroy');
cb.focusREPL();
cb.inTutorial = false;
}