-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.patch
More file actions
170 lines (158 loc) · 6.38 KB
/
extension.patch
File metadata and controls
170 lines (158 loc) · 6.38 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
diff --git a/js/tutorial/sections.js b/js/tutorial/sections.js
index f7cd4cd..550c671 100644
--- a/js/tutorial/sections.js
+++ b/js/tutorial/sections.js
@@ -17,6 +17,21 @@ function register_VIM_TUTORIAL_SECTIONS(interpreter, messager, createSection, re
messager.removeListener('pressed_key', forAbortId);
}
});
+
+ if (API != null)
+ {
+ var numLevels = $('.section_menu_append_target').children().length;
+ var sectionElement = $('.section_menu_item.selected');
+ var levelId = sectionElement.index() + 1;
+ var sectionTitle = sectionElement.text();
+
+ if (!sectionTitle.endsWith(" ✅"))
+ {
+ sectionElement.text(sectionTitle + " ✅");
+ }
+
+ ScormSaveAnswer(levelId, numLevels);
+ }
}
function defaultPre() { interpreter.environment.setInsertMode(); }
diff --git a/js/tutorial/tutorial_engine.js b/js/tutorial/tutorial_engine.js
index cb4bc5e..d613927 100644
--- a/js/tutorial/tutorial_engine.js
+++ b/js/tutorial/tutorial_engine.js
@@ -19,6 +19,22 @@ function createTutorial(context, interpreter, messager, doc) {
function showCommandOneByOne(commands, userInputAccepterCreator) {
if(commands.length === 0) {
sendMessageAsync('tutorial_next_section');
+
+ if (API != null)
+ {
+ var numLevels = $('.section_menu_append_target').children().length;
+ var sectionElement = $('.section_menu_item.selected');
+ var levelId = String(sectionElement.index() + 1);
+ var sectionTitle = sectionElement.text();
+
+ if (!sectionTitle.endsWith(" ✅"))
+ {
+ sectionElement.text(sectionTitle + " ✅");
+ }
+
+ ScormSaveAnswer(levelId, numLevels);
+ }
+
return;
}
@@ -57,6 +73,23 @@ function createTutorial(context, interpreter, messager, doc) {
G.for_each_indexed(G.reverse(tutorial_sections), function(section, index) {
var sectionNumber = tutorial_sections.length - index - 1;
var sectionName = (1 + sectionNumber) + ". " + section.name;
+
+ if (API != null)
+ {
+ var sd = ScormProcessGetValue("cmi.suspend_data");
+
+ if (sd != null)
+ {
+ var levelId = String(1 + sectionNumber);
+
+ var sd_arr = sd.split(",");
+ if (sd_arr.includes(levelId))
+ {
+ sectionName = sectionName + " ✅";
+ }
+ }
+ }
+
var $section = $('<div />',
{ 'class': 'section_menu_item',
'number': sectionNumber,
diff --git a/sandbox.html b/sandbox.html
index 738b9e5..19dc891 100644
--- a/sandbox.html
+++ b/sandbox.html
@@ -39,29 +39,17 @@
init_vim();
});
</script>
-
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-1334187-4']);
- _gaq.push(['_trackPageview']);
-
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
</head>
<body>
<div class="navigation">
<a href="tutorial.html">Tutorial</a>
<a href="sandbox.html" class="selected">Practice</a>
- <a href="development.html">Development</a>
+ <a href="sandbox-pl.html">🇵🇱</a>
<!--
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.openvim.com/sandbox.html" data-text="OpenVim - Interactive Vim sandbox" data-count="horizontal" data-via="egaga">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
-->
- <a class="bug_or_request" href="https://github.com/egaga/openvim/issues/new">Bugs</a>
+ <!-- <a class="bug_or_request" href="https://github.com/egaga/openvim/issues/new">Bugs</a> -->
</div>
<div style="margin-left: 15px">
diff --git a/tutorial.html b/tutorial.html
index e54613a..1faa87b 100644
--- a/tutorial.html
+++ b/tutorial.html
@@ -4,6 +4,7 @@
<head>
<meta charset='utf-8' />
+ <script src="js/scorm.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/css.css?version={VERSION}" />
<link rel="stylesheet" type="text/css" href="css/tutorial.css?version={VERSION}" />
<link rel="stylesheet" type="text/css" href="css/virtual_keyboard.css?version={VERSION}" />
@@ -38,6 +39,8 @@
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.6.4");
+
+ ScormProcessInitialize();
const urlParams = new URLSearchParams(window.location.search);
@@ -50,32 +53,21 @@
});
</script>
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-1334187-4']);
- _gaq.push(['_trackPageview']);
-
- (function () {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
</head>
-<body>
+<body onload="openNav();" onbeforeunload="ScormProcessTerminate();" onunload="ScormProcessTerminate();">
<div id="main">
<div class="navigation">
<span style="font-size:25px; cursor:pointer; color: white; margin: 0 10px;" onclick="openNav()">☰</span>
<a href="tutorial.html" class="selected">Tutorial</a>
<a href="sandbox.html">Practice</a>
- <a href="development.html">Development</a>
+ <a href="tutorial-pl.html">🇵🇱</a>
<!--
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.openvim.com/tutorial.html" data-text="OpenVim - Interactive Vim tutorial" data-count="horizontal" data-via="egaga">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
-->
- <a class="bug_or_request" href="https://github.com/egaga/openvim/issues/new">Bugs</a>
+ <!-- <a class="bug_or_request" href="https://github.com/egaga/openvim/issues/new">Bugs</a> -->
</div>
<div class="screen_view">