jclic 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/dist-node/jclic-node.js +14157 -0
- package/dist-node/jclic-node.umd.cjs +530 -0
- package/package.json +38 -26
- package/.vscode/launch.json +0 -33
- package/.vscode/settings.json +0 -13
- package/CHANGELOG.md +0 -672
- package/TRANSLATIONS.md +0 -11
- package/build-locales.mjs +0 -82
- package/dist/jclic-node.js +0 -31680
- package/dist/jclic-node.js.map +0 -1
- package/dist/jclic.components.LICENSE +0 -2254
- package/dist/jclic.min.js +0 -27
- package/dist/jclic.min.js.map +0 -1
- package/eslint.config.mjs +0 -31
- package/jsdoc.config.js +0 -71
- package/locales/ar.po +0 -244
- package/locales/ast.po +0 -246
- package/locales/bs.po +0 -247
- package/locales/ca.po +0 -248
- package/locales/ca_ES@valencia.po +0 -248
- package/locales/cs.po +0 -244
- package/locales/da.po +0 -244
- package/locales/de.po +0 -246
- package/locales/el.po +0 -244
- package/locales/es.po +0 -248
- package/locales/eu.po +0 -244
- package/locales/fr.po +0 -244
- package/locales/gl.po +0 -244
- package/locales/he.po +0 -244
- package/locales/hr.po +0 -245
- package/locales/it.po +0 -246
- package/locales/ja.po +0 -242
- package/locales/jclic.js.pot +0 -241
- package/locales/nb_NO.po +0 -244
- package/locales/nl.po +0 -244
- package/locales/pl.po +0 -244
- package/locales/pt.po +0 -244
- package/locales/pt_BR.po +0 -248
- package/locales/ro.po +0 -248
- package/locales/ru.po +0 -245
- package/locales/ta.po +0 -244
- package/locales/tr.po +0 -246
- package/locales/uk.po +0 -247
- package/locales/vec.po +0 -244
- package/locales/zh_TW.po +0 -246
- package/patches/po2json+1.0.0-beta-3.patch +0 -12
- package/src/AWT.js +0 -2067
- package/src/Activity.js +0 -1311
- package/src/Deps.js +0 -232
- package/src/GlobalData.js +0 -5
- package/src/JClic.js +0 -196
- package/src/JClicPlayer.js +0 -1308
- package/src/PlayerHistory.js +0 -305
- package/src/Utils.js +0 -1355
- package/src/activities/associations/ComplexAssociation.js +0 -321
- package/src/activities/associations/SimpleAssociation.js +0 -519
- package/src/activities/memory/MemoryGame.js +0 -423
- package/src/activities/panels/Explore.js +0 -349
- package/src/activities/panels/Identify.js +0 -356
- package/src/activities/panels/InformationScreen.js +0 -262
- package/src/activities/panels/Menu.js +0 -209
- package/src/activities/panels/icons/ico00.png +0 -0
- package/src/activities/panels/icons/ico01.png +0 -0
- package/src/activities/panels/icons/ico02.png +0 -0
- package/src/activities/panels/icons/ico03.png +0 -0
- package/src/activities/panels/icons/icofolder.png +0 -0
- package/src/activities/puzzles/DoublePuzzle.js +0 -424
- package/src/activities/puzzles/ExchangePuzzle.js +0 -374
- package/src/activities/puzzles/HolePuzzle.js +0 -360
- package/src/activities/text/Complete.js +0 -127
- package/src/activities/text/Evaluator.js +0 -534
- package/src/activities/text/FillInBlanks.js +0 -426
- package/src/activities/text/IdentifyText.js +0 -253
- package/src/activities/text/OrderText.js +0 -421
- package/src/activities/text/TextActivityBase.js +0 -557
- package/src/activities/text/TextActivityDocument.js +0 -660
- package/src/activities/text/WrittenAnswer.js +0 -557
- package/src/activities/textGrid/CrossWord.js +0 -565
- package/src/activities/textGrid/WordSearch.js +0 -458
- package/src/activities/textGrid/icons/hIcon.svg +0 -3
- package/src/activities/textGrid/icons/vIcon.svg +0 -3
- package/src/automation/AutoContentProvider.js +0 -182
- package/src/automation/arith/Arith.js +0 -864
- package/src/bags/ActivitySequence.js +0 -318
- package/src/bags/ActivitySequenceElement.js +0 -161
- package/src/bags/ActivitySequenceJump.js +0 -140
- package/src/bags/ConditionalJumpInfo.js +0 -113
- package/src/bags/JumpInfo.js +0 -136
- package/src/bags/MediaBag.js +0 -215
- package/src/bags/MediaBagElement.js +0 -516
- package/src/boxes/AbstractBox.js +0 -699
- package/src/boxes/ActiveBagContent.js +0 -494
- package/src/boxes/ActiveBox.js +0 -810
- package/src/boxes/ActiveBoxBag.js +0 -357
- package/src/boxes/ActiveBoxContent.js +0 -484
- package/src/boxes/ActiveBoxGrid.js +0 -179
- package/src/boxes/BoxBag.js +0 -500
- package/src/boxes/BoxBase.js +0 -398
- package/src/boxes/BoxConnector.js +0 -325
- package/src/boxes/TextGrid.js +0 -887
- package/src/boxes/TextGridContent.js +0 -215
- package/src/init-jsdom.js +0 -65
- package/src/jclic-node.js +0 -219
- package/src/media/ActiveMediaBag.js +0 -145
- package/src/media/ActiveMediaPlayer.js +0 -297
- package/src/media/AudioBuffer.js +0 -219
- package/src/media/EventSounds.js +0 -169
- package/src/media/EventSoundsElement.js +0 -155
- package/src/media/MediaContent.js +0 -328
- package/src/media/MidiAudioPlayer.js +0 -254
- package/src/media/icons/audio.svg +0 -3
- package/src/media/icons/generic.svg +0 -3
- package/src/media/icons/mic.svg +0 -3
- package/src/media/icons/movie.svg +0 -3
- package/src/media/icons/music.svg +0 -3
- package/src/media/icons/url.svg +0 -3
- package/src/media/sounds/actionError.mp3 +0 -0
- package/src/media/sounds/actionOk.mp3 +0 -0
- package/src/media/sounds/click.mp3 +0 -0
- package/src/media/sounds/finishedError.mp3 +0 -0
- package/src/media/sounds/finishedOk.mp3 +0 -0
- package/src/media/sounds/start.mp3 +0 -0
- package/src/project/JClicProject.js +0 -282
- package/src/project/ProjectSettings.js +0 -273
- package/src/report/ActionReg.js +0 -123
- package/src/report/ActivityReg.js +0 -271
- package/src/report/EncryptMin.js +0 -210
- package/src/report/Reporter.js +0 -727
- package/src/report/SCORM.js +0 -272
- package/src/report/SequenceReg.js +0 -275
- package/src/report/SessionReg.js +0 -340
- package/src/report/SessionStorageReporter.js +0 -131
- package/src/report/TCPReporter.js +0 -628
- package/src/shapers/ClassicJigSaw.js +0 -138
- package/src/shapers/Holes.js +0 -77
- package/src/shapers/JigSaw.js +0 -161
- package/src/shapers/Rectangular.js +0 -78
- package/src/shapers/Shaper.js +0 -386
- package/src/shapers/TriangularJigSaw.js +0 -121
- package/src/skins/BlueSkin.js +0 -80
- package/src/skins/Counter.js +0 -152
- package/src/skins/CustomSkin.js +0 -412
- package/src/skins/DefaultSkin.js +0 -376
- package/src/skins/EmptySkin.js +0 -82
- package/src/skins/GreenSkin.js +0 -94
- package/src/skins/MiniSkin.js +0 -130
- package/src/skins/OrangeSkin.js +0 -78
- package/src/skins/SimpleSkin.js +0 -92
- package/src/skins/Skin.js +0 -1021
- package/src/skins/assets/actionsIcon.svg +0 -3
- package/src/skins/assets/appLogo.svg +0 -8
- package/src/skins/assets/basic.css +0 -41
- package/src/skins/assets/closeDialogIcon.svg +0 -3
- package/src/skins/assets/closeIcon.svg +0 -3
- package/src/skins/assets/copyIcon.svg +0 -3
- package/src/skins/assets/fullScreenExitIcon.svg +0 -3
- package/src/skins/assets/fullScreenIcon.svg +0 -3
- package/src/skins/assets/infoIcon.svg +0 -3
- package/src/skins/assets/main.css +0 -43
- package/src/skins/assets/mainHalf.css +0 -23
- package/src/skins/assets/mainTwoThirds.css +0 -23
- package/src/skins/assets/mini.css +0 -15
- package/src/skins/assets/nextIcon.svg +0 -3
- package/src/skins/assets/okDialogIcon.svg +0 -3
- package/src/skins/assets/prevIcon.svg +0 -3
- package/src/skins/assets/reports.css +0 -156
- package/src/skins/assets/reportsIcon.svg +0 -3
- package/src/skins/assets/scoreIcon.svg +0 -3
- package/src/skins/assets/simple.css +0 -16
- package/src/skins/assets/simpleHalf.css +0 -11
- package/src/skins/assets/simpleTwoThirds.css +0 -11
- package/src/skins/assets/timeIcon.svg +0 -4
- package/src/skins/assets/waitAnim.css +0 -54
- package/src/skins/assets/waitImgBig.svg +0 -3
- package/src/skins/assets/waitImgSmall.svg +0 -3
- package/webpack.config.mjs +0 -169
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File : boxes/TextGridContent.js
|
|
3
|
-
* Created : 14/04/2015
|
|
4
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
5
|
-
*
|
|
6
|
-
* JClic.js
|
|
7
|
-
* An HTML5 player of JClic activities
|
|
8
|
-
* https://projectestac.github.io/jclic.js
|
|
9
|
-
*
|
|
10
|
-
* @source https://github.com/projectestac/jclic.js
|
|
11
|
-
*
|
|
12
|
-
* @license EUPL-1.2
|
|
13
|
-
* @licstart
|
|
14
|
-
* (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
|
|
15
|
-
*
|
|
16
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
17
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
18
|
-
* You may not use this work except in compliance with the Licence.
|
|
19
|
-
*
|
|
20
|
-
* You may obtain a copy of the Licence at:
|
|
21
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
25
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
26
|
-
* Licence for the specific language governing permissions and limitations
|
|
27
|
-
* under the Licence.
|
|
28
|
-
* @licend
|
|
29
|
-
* @module
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
import $ from 'jquery';
|
|
33
|
-
import { settings, attrForEach, getBoolean, getAttr, setAttr } from '../Utils.js';
|
|
34
|
-
import BoxBase from './BoxBase.js';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* This class encapsulates the content of {@link module:boxes/TextGrid.TextGrid TextGrid} objects.
|
|
38
|
-
*
|
|
39
|
-
* It implements methods to set and retrieve individual characters on the grid, and parsing of
|
|
40
|
-
* XML objects. It also contains information about the optimal size and other graphic properties
|
|
41
|
-
* (fonts, colors, etc.) of the grid.
|
|
42
|
-
*/
|
|
43
|
-
export class TextGridContent {
|
|
44
|
-
/**
|
|
45
|
-
* TextGridContent constructor
|
|
46
|
-
*/
|
|
47
|
-
constructor() {
|
|
48
|
-
this.style = new BoxBase(null);
|
|
49
|
-
this.text = [];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Loads the object settings from a specific JQuery XML element
|
|
54
|
-
* @param {external:jQuery} $xml
|
|
55
|
-
*/
|
|
56
|
-
setProperties($xml) {
|
|
57
|
-
// Read attributes
|
|
58
|
-
attrForEach($xml.get(0).attributes, (name, val) => {
|
|
59
|
-
switch (name) {
|
|
60
|
-
case 'rows':
|
|
61
|
-
// WARNING: Due to a bug in JClic, the meaning of "rows" and "columns" must be
|
|
62
|
-
// interchanged:
|
|
63
|
-
this.ncw = Number(val);
|
|
64
|
-
break;
|
|
65
|
-
case 'columns':
|
|
66
|
-
this.nch = Number(val);
|
|
67
|
-
break;
|
|
68
|
-
case 'cellWidth':
|
|
69
|
-
this.w = Number(val);
|
|
70
|
-
break;
|
|
71
|
-
case 'cellHeight':
|
|
72
|
-
this.h = Number(val);
|
|
73
|
-
break;
|
|
74
|
-
case 'border':
|
|
75
|
-
this.border = getBoolean(val);
|
|
76
|
-
break;
|
|
77
|
-
case 'wild':
|
|
78
|
-
case 'randomChars':
|
|
79
|
-
this[name] = val;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Read inner elements
|
|
85
|
-
$xml.children('style:first').each((_n, child) => {
|
|
86
|
-
this.style = new BoxBase().setProperties($(child));
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
$xml.find('text:first > row').each((_n, el) => this.text.push(el.textContent));
|
|
90
|
-
|
|
91
|
-
for (let i = this.text.length; i < this.nch; i++)
|
|
92
|
-
this.text[i] = '';
|
|
93
|
-
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
99
|
-
* parent references, constants and also attributes retaining the default value.
|
|
100
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
101
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
102
|
-
*/
|
|
103
|
-
getAttributes() {
|
|
104
|
-
return getAttr(this, [
|
|
105
|
-
'ncw', 'nch',
|
|
106
|
-
'w', 'h',
|
|
107
|
-
'text',
|
|
108
|
-
'style', // BoxBase
|
|
109
|
-
'border',
|
|
110
|
-
'wild|*',
|
|
111
|
-
`randomChars|${settings.RANDOM_CHARS}`,
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Reads the properties of this TextGridContent from a data object
|
|
117
|
-
* @param {object|string} data - The data object to be parsed, or just the text content
|
|
118
|
-
* @returns {module:boxes/TextGridContent.TextGridContent}
|
|
119
|
-
*/
|
|
120
|
-
setAttributes(data) {
|
|
121
|
-
return setAttr(this, data, [
|
|
122
|
-
'ncw', 'nch',
|
|
123
|
-
'w', 'h',
|
|
124
|
-
'text',
|
|
125
|
-
{ key: 'style', fn: BoxBase },
|
|
126
|
-
'border',
|
|
127
|
-
'wild',
|
|
128
|
-
`randomChars`,
|
|
129
|
-
]);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Counts the number of wildcard characters present in this TextGrid
|
|
134
|
-
* @returns {number}
|
|
135
|
-
*/
|
|
136
|
-
countWildChars() {
|
|
137
|
-
let result = 0;
|
|
138
|
-
if (this.text)
|
|
139
|
-
for (let y = 0; y < this.nch; y++)
|
|
140
|
-
for (let x = 0; x < this.ncw; x++)
|
|
141
|
-
if (this.text[y].charAt(x) === this.wild)
|
|
142
|
-
result++;
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Counts the total number of characters, including wildcard characters.
|
|
148
|
-
* @returns {number}
|
|
149
|
-
*/
|
|
150
|
-
getNumChars() {
|
|
151
|
-
return this.ncw * this.nch;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Sets the specified character as a content of the cell located at specific coordinates
|
|
156
|
-
* @param {number} x - The X coordinate of the cell
|
|
157
|
-
* @param {number} y - The X coordinate of the cell
|
|
158
|
-
* @param {string} ch - The character to be placed on the specified cell
|
|
159
|
-
*/
|
|
160
|
-
setCharAt(x, y, ch) {
|
|
161
|
-
if (x >= 0 && x < this.ncw && y >= 0 && y < this.nch)
|
|
162
|
-
this.text[y] = this.text[y].substring(0, x) + ch + this.text[y].substring(x + 1);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
Object.assign(TextGridContent.prototype, {
|
|
167
|
-
/**
|
|
168
|
-
* Grid columns
|
|
169
|
-
* @name module:boxes/TextGridContent.TextGridContent#ncw
|
|
170
|
-
* @type {number} */
|
|
171
|
-
ncw: 1,
|
|
172
|
-
/**
|
|
173
|
-
* Grid rows
|
|
174
|
-
* @name module:boxes/TextGridContent.TextGridContent#nch
|
|
175
|
-
* @type {number} */
|
|
176
|
-
nch: 1,
|
|
177
|
-
/**
|
|
178
|
-
* Width of cells
|
|
179
|
-
* @name module:boxes/TextGridContent.TextGridContent#w
|
|
180
|
-
* @type {number} */
|
|
181
|
-
w: 20,
|
|
182
|
-
/**
|
|
183
|
-
* Height of cells
|
|
184
|
-
* @name module:boxes/TextGridContent.TextGridContent#h
|
|
185
|
-
* @type {number} */
|
|
186
|
-
h: 20,
|
|
187
|
-
/**
|
|
188
|
-
* Whether the cells must be surrounded by a border or not
|
|
189
|
-
* @name module:boxes/TextGridContent.TextGridContent#border
|
|
190
|
-
* @type {boolean} */
|
|
191
|
-
border: false,
|
|
192
|
-
/**
|
|
193
|
-
* The {@link module:boxes/BoxBase.BoxBase BoxBase} object with visual settings of the text grid
|
|
194
|
-
* @name module:boxes/TextGridContent.TextGridContent#style
|
|
195
|
-
* @type {module:boxes/BoxBase.BoxBase} */
|
|
196
|
-
style: null,
|
|
197
|
-
/**
|
|
198
|
-
* An array of String objects textning the chars of cells. One string per row, one character of
|
|
199
|
-
* this string per cell.
|
|
200
|
-
* @name module:boxes/TextGridContent.TextGridContent#text
|
|
201
|
-
* @type {string[]} */
|
|
202
|
-
text: null,
|
|
203
|
-
/**
|
|
204
|
-
* The letter used as wildcardtext
|
|
205
|
-
* @name module:boxes/TextGridContent.TextGridContent#wild
|
|
206
|
-
* @type {string} */
|
|
207
|
-
wild: '*',
|
|
208
|
-
/**
|
|
209
|
-
* A String with the chars to take as source when randomly filling empty cells
|
|
210
|
-
* @name module:boxes/TextGridContent.TextGridContent#randomChars
|
|
211
|
-
* @type {string} */
|
|
212
|
-
randomChars: settings.RANDOM_CHARS,
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
export default TextGridContent;
|
package/src/init-jsdom.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* File : init-jsdom.js
|
|
3
|
-
* Created : 12/11/2024
|
|
4
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
5
|
-
*
|
|
6
|
-
* JClic.js
|
|
7
|
-
* An HTML5 player of JClic activities
|
|
8
|
-
* https://projectestac.github.io/jclic.js
|
|
9
|
-
*
|
|
10
|
-
* @source https://github.com/projectestac/jclic.js
|
|
11
|
-
*
|
|
12
|
-
* @license EUPL-1.2
|
|
13
|
-
* @licstart
|
|
14
|
-
* (c) 2000-2024 Educational Telematic Network of Catalonia (XTEC)
|
|
15
|
-
*
|
|
16
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
17
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
18
|
-
* You may not use this work except in compliance with the Licence.
|
|
19
|
-
*
|
|
20
|
-
* You may obtain a copy of the Licence at:
|
|
21
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
25
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
26
|
-
* Licence for the specific language governing permissions and limitations
|
|
27
|
-
* under the Licence.
|
|
28
|
-
* @licend
|
|
29
|
-
* @module
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/* global global, globalThis */
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Initializes some global variables needed for JClic in order to be used in nodeJS
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
import jsdom from 'jsdom';
|
|
39
|
-
import { DOMParser } from '@xmldom/xmldom';
|
|
40
|
-
|
|
41
|
-
// Create a new DOM object
|
|
42
|
-
const dom = new jsdom.JSDOM('<!DOCTYPE html><head></head><body></body>', { url: 'https://example.com' });
|
|
43
|
-
|
|
44
|
-
// `global` is a legacy object in NodeJS 22 and will be replaced soon by `globalThis`
|
|
45
|
-
// Also, provide a fallback empty object in case of no `global` object at all (should not occur!)
|
|
46
|
-
const globalObject = globalThis || global || {};
|
|
47
|
-
|
|
48
|
-
// Assign global variables, only if not already assigned
|
|
49
|
-
if (!globalObject.window)
|
|
50
|
-
globalObject.window = dom.window;
|
|
51
|
-
if (!globalObject.document)
|
|
52
|
-
globalObject.document = dom.window.document;
|
|
53
|
-
if (!globalObject.navigator)
|
|
54
|
-
globalObject.navigator = dom.window.navigator;
|
|
55
|
-
if (!globalObject.Image)
|
|
56
|
-
globalObject.Image = dom.window.Image;
|
|
57
|
-
if (!globalObject.Audio)
|
|
58
|
-
globalObject.Audio = dom.window.Audio;
|
|
59
|
-
if (!globalObject.XMLHttpRequest)
|
|
60
|
-
globalObject.XMLHttpRequest = dom.window.XMLHttpRequest;
|
|
61
|
-
if (!globalObject.DOMParser)
|
|
62
|
-
globalObject.DOMParser = DOMParser;
|
|
63
|
-
|
|
64
|
-
// This is just a side-effect module
|
|
65
|
-
export default {};
|
package/src/jclic-node.js
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* File : jclic-node.js
|
|
3
|
-
* Created : 12/11/2024
|
|
4
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
5
|
-
*
|
|
6
|
-
* JClic.js
|
|
7
|
-
* An HTML5 player of JClic activities
|
|
8
|
-
* https://projectestac.github.io/jclic.js
|
|
9
|
-
*
|
|
10
|
-
* @source https://github.com/projectestac/jclic.js
|
|
11
|
-
*
|
|
12
|
-
* @license EUPL-1.2
|
|
13
|
-
* @licstart
|
|
14
|
-
* (c) 2000-2024 Educational Telematic Network of Catalonia (XTEC)
|
|
15
|
-
*
|
|
16
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
17
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
18
|
-
* You may not use this work except in compliance with the Licence.
|
|
19
|
-
*
|
|
20
|
-
* You may obtain a copy of the Licence at:
|
|
21
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
25
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
26
|
-
* Licence for the specific language governing permissions and limitations
|
|
27
|
-
* under the Licence.
|
|
28
|
-
* @licend
|
|
29
|
-
* @module
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
// Initialize fake DOM global variables like 'window' or 'document'.
|
|
33
|
-
import './init-jsdom.js';
|
|
34
|
-
|
|
35
|
-
import $ from 'jquery';
|
|
36
|
-
import AWT from './AWT.js';
|
|
37
|
-
import Activity from './Activity.js';
|
|
38
|
-
import GlobalData from './GlobalData.js';
|
|
39
|
-
import JClicPlayer from './JClicPlayer.js';
|
|
40
|
-
import Utils from './Utils.js';
|
|
41
|
-
import PlayerHistory from './PlayerHistory.js';
|
|
42
|
-
import ComplexAssociation from './activities/associations/ComplexAssociation.js';
|
|
43
|
-
import SimpleAssociation from './activities/associations/SimpleAssociation.js';
|
|
44
|
-
import MemoryGame from './activities/memory/MemoryGame.js';
|
|
45
|
-
import Explore from './activities/panels/Explore.js';
|
|
46
|
-
import Identify from './activities/panels/Identify.js';
|
|
47
|
-
import InformationScreen from './activities/panels/InformationScreen.js';
|
|
48
|
-
import Menu from './activities/panels/Menu.js';
|
|
49
|
-
import DoublePuzzle from './activities/puzzles/DoublePuzzle.js';
|
|
50
|
-
import ExchangePuzzle from './activities/puzzles/ExchangePuzzle.js';
|
|
51
|
-
import HolePuzzle from './activities/puzzles/HolePuzzle.js';
|
|
52
|
-
import Complete from './activities/text/Complete.js';
|
|
53
|
-
import Evaluator from './activities/text/Evaluator.js';
|
|
54
|
-
import FillInBlanks from './activities/text/FillInBlanks.js';
|
|
55
|
-
import CrossWord from './activities/textGrid/CrossWord.js';
|
|
56
|
-
import WordSearch from './activities/textGrid/WordSearch.js';
|
|
57
|
-
import IdentifyText from './activities/text/IdentifyText.js';
|
|
58
|
-
import OrderText from './activities/text/OrderText.js';
|
|
59
|
-
import TextActivityBase from './activities/text/TextActivityBase.js';
|
|
60
|
-
import TextActivityDocument from './activities/text/TextActivityDocument.js';
|
|
61
|
-
import WrittenAnswer from './activities/text/WrittenAnswer.js';
|
|
62
|
-
import Arith from './automation/arith/Arith.js';
|
|
63
|
-
import AutoContentProvider from './automation/AutoContentProvider.js';
|
|
64
|
-
import ActivitySequenceElement from './bags/ActivitySequenceElement.js';
|
|
65
|
-
import ActivitySequence from './bags/ActivitySequence.js';
|
|
66
|
-
import ActivitySequenceJump from './bags/ActivitySequenceJump.js';
|
|
67
|
-
import ConditionalJumpInfo from './bags/ConditionalJumpInfo.js';
|
|
68
|
-
import JumpInfo from './bags/JumpInfo.js';
|
|
69
|
-
import MediaBagElement from './bags/MediaBagElement.js';
|
|
70
|
-
import MediaBag from './bags/MediaBag.js';
|
|
71
|
-
import AbstractBox from './boxes/AbstractBox.js';
|
|
72
|
-
import ActiveBagContent from './boxes/ActiveBagContent.js';
|
|
73
|
-
import ActiveBoxBag from './boxes/ActiveBoxBag.js';
|
|
74
|
-
import ActiveBoxContent from './boxes/ActiveBoxContent.js';
|
|
75
|
-
import ActiveBoxGrid from './boxes/ActiveBoxGrid.js';
|
|
76
|
-
import ActiveBox from './boxes/ActiveBox.js';
|
|
77
|
-
import BoxBag from './boxes/BoxBag.js';
|
|
78
|
-
import BoxBase from './boxes/BoxBase.js';
|
|
79
|
-
import BoxConnector from './boxes/BoxConnector.js';
|
|
80
|
-
import TextGridContent from './boxes/TextGridContent.js';
|
|
81
|
-
import TextGrid from './boxes/TextGrid.js';
|
|
82
|
-
import ActiveMediaBag from './media/ActiveMediaBag.js';
|
|
83
|
-
import ActiveMediaPlayer from './media/ActiveMediaPlayer.js';
|
|
84
|
-
import AudioBuffer from './media/AudioBuffer.js';
|
|
85
|
-
import EventSoundsElement from './media/EventSoundsElement.js';
|
|
86
|
-
import EventSounds from './media/EventSounds.js';
|
|
87
|
-
import MediaContent from './media/MediaContent.js';
|
|
88
|
-
import MidiAudioPlayer from './media/MidiAudioPlayer.js';
|
|
89
|
-
import JClicProject from './project/JClicProject.js';
|
|
90
|
-
import ProjectSettings from './project/ProjectSettings.js';
|
|
91
|
-
import ActionReg from './report/ActionReg.js';
|
|
92
|
-
import ActivityReg from './report/ActivityReg.js';
|
|
93
|
-
import EncryptMin from './report/EncryptMin.js';
|
|
94
|
-
import Reporter from './report/Reporter.js';
|
|
95
|
-
import SCORM from './report/SCORM.js';
|
|
96
|
-
import SequenceReg from './report/SequenceReg.js';
|
|
97
|
-
import SessionReg from './report/SessionReg.js';
|
|
98
|
-
import SessionStorageReporter from './report/SessionStorageReporter.js';
|
|
99
|
-
import TCPReporter from './report/TCPReporter.js';
|
|
100
|
-
import ClassicJigSaw from './shapers/ClassicJigSaw.js';
|
|
101
|
-
import Holes from './shapers/Holes.js';
|
|
102
|
-
import JigSaw from './shapers/JigSaw.js';
|
|
103
|
-
import Rectangular from './shapers/Rectangular.js';
|
|
104
|
-
import Shaper from './shapers/Shaper.js';
|
|
105
|
-
import TriangularJigSaw from './shapers/TriangularJigSaw.js';
|
|
106
|
-
import BlueSkin from './skins/BlueSkin.js';
|
|
107
|
-
import Counter from './skins/Counter.js';
|
|
108
|
-
import CustomSkin from './skins/CustomSkin.js';
|
|
109
|
-
import DefaultSkin from './skins/DefaultSkin.js';
|
|
110
|
-
import EmptySkin from './skins/EmptySkin.js';
|
|
111
|
-
import GreenSkin from './skins/GreenSkin.js';
|
|
112
|
-
import MiniSkin from './skins/MiniSkin.js';
|
|
113
|
-
import OrangeSkin from './skins/OrangeSkin.js';
|
|
114
|
-
import SimpleSkin from './skins/SimpleSkin.js';
|
|
115
|
-
import Skin from './skins/Skin.js';
|
|
116
|
-
|
|
117
|
-
// Export all JClic core classes plus jQuery, so they can be used in NodeJS
|
|
118
|
-
export default ({
|
|
119
|
-
$,
|
|
120
|
-
AWT,
|
|
121
|
-
Activity,
|
|
122
|
-
GlobalData,
|
|
123
|
-
JClicPlayer,
|
|
124
|
-
Utils,
|
|
125
|
-
PlayerHistory,
|
|
126
|
-
JClicProject,
|
|
127
|
-
activities: {
|
|
128
|
-
ComplexAssociation,
|
|
129
|
-
SimpleAssociation,
|
|
130
|
-
MemoryGame,
|
|
131
|
-
Explore,
|
|
132
|
-
Identify,
|
|
133
|
-
InformationScreen,
|
|
134
|
-
Menu,
|
|
135
|
-
DoublePuzzle,
|
|
136
|
-
ExchangePuzzle,
|
|
137
|
-
HolePuzzle,
|
|
138
|
-
Complete,
|
|
139
|
-
Evaluator,
|
|
140
|
-
FillInBlanks,
|
|
141
|
-
CrossWord,
|
|
142
|
-
WordSearch,
|
|
143
|
-
IdentifyText,
|
|
144
|
-
OrderText,
|
|
145
|
-
TextActivityBase,
|
|
146
|
-
TextActivityDocument,
|
|
147
|
-
WrittenAnswer,
|
|
148
|
-
},
|
|
149
|
-
automation: {
|
|
150
|
-
Arith,
|
|
151
|
-
AutoContentProvider,
|
|
152
|
-
},
|
|
153
|
-
bags: {
|
|
154
|
-
ActivitySequenceElement,
|
|
155
|
-
ActivitySequence,
|
|
156
|
-
ActivitySequenceJump,
|
|
157
|
-
ConditionalJumpInfo,
|
|
158
|
-
JumpInfo,
|
|
159
|
-
MediaBagElement,
|
|
160
|
-
MediaBag,
|
|
161
|
-
},
|
|
162
|
-
boxes: {
|
|
163
|
-
AbstractBox,
|
|
164
|
-
ActiveBagContent,
|
|
165
|
-
ActiveBoxBag,
|
|
166
|
-
ActiveBoxContent,
|
|
167
|
-
ActiveBoxGrid,
|
|
168
|
-
ActiveBox,
|
|
169
|
-
BoxBag,
|
|
170
|
-
BoxBase,
|
|
171
|
-
BoxConnector,
|
|
172
|
-
TextGridContent,
|
|
173
|
-
TextGrid,
|
|
174
|
-
},
|
|
175
|
-
media: {
|
|
176
|
-
ActiveMediaBag,
|
|
177
|
-
ActiveMediaPlayer,
|
|
178
|
-
AudioBuffer,
|
|
179
|
-
EventSoundsElement,
|
|
180
|
-
EventSounds,
|
|
181
|
-
MediaContent,
|
|
182
|
-
MidiAudioPlayer,
|
|
183
|
-
},
|
|
184
|
-
project: {
|
|
185
|
-
JClicProject,
|
|
186
|
-
ProjectSettings,
|
|
187
|
-
},
|
|
188
|
-
report: {
|
|
189
|
-
ActionReg,
|
|
190
|
-
ActivityReg,
|
|
191
|
-
EncryptMin,
|
|
192
|
-
Reporter,
|
|
193
|
-
SCORM,
|
|
194
|
-
SequenceReg,
|
|
195
|
-
SessionReg,
|
|
196
|
-
SessionStorageReporter,
|
|
197
|
-
TCPReporter,
|
|
198
|
-
},
|
|
199
|
-
shapers: {
|
|
200
|
-
ClassicJigSaw,
|
|
201
|
-
Holes,
|
|
202
|
-
JigSaw,
|
|
203
|
-
Rectangular,
|
|
204
|
-
Shaper,
|
|
205
|
-
TriangularJigSaw,
|
|
206
|
-
},
|
|
207
|
-
skins: {
|
|
208
|
-
BlueSkin,
|
|
209
|
-
Counter,
|
|
210
|
-
CustomSkin,
|
|
211
|
-
DefaultSkin,
|
|
212
|
-
EmptySkin,
|
|
213
|
-
GreenSkin,
|
|
214
|
-
MiniSkin,
|
|
215
|
-
OrangeSkin,
|
|
216
|
-
SimpleSkin,
|
|
217
|
-
Skin,
|
|
218
|
-
},
|
|
219
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File : media/ActiveMediaBag.js
|
|
3
|
-
* Created : 28/04/2015
|
|
4
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
5
|
-
*
|
|
6
|
-
* JClic.js
|
|
7
|
-
* An HTML5 player of JClic activities
|
|
8
|
-
* https://projectestac.github.io/jclic.js
|
|
9
|
-
*
|
|
10
|
-
* @source https://github.com/projectestac/jclic.js
|
|
11
|
-
*
|
|
12
|
-
* @license EUPL-1.2
|
|
13
|
-
* @licstart
|
|
14
|
-
* (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
|
|
15
|
-
*
|
|
16
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
17
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
18
|
-
* You may not use this work except in compliance with the Licence.
|
|
19
|
-
*
|
|
20
|
-
* You may obtain a copy of the Licence at:
|
|
21
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
25
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
26
|
-
* Licence for the specific language governing permissions and limitations
|
|
27
|
-
* under the Licence.
|
|
28
|
-
* @licend
|
|
29
|
-
* @module
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
import ActiveMediaPlayer from './ActiveMediaPlayer.js';
|
|
33
|
-
import { settings } from '../Utils.js';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* This class stores a collection of realized {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} objects, related to a
|
|
37
|
-
* {@link module:project/JClicProject.JClicProject JClicProject} or {@link module:Activity.Activity Activity}.
|
|
38
|
-
*/
|
|
39
|
-
export class ActiveMediaBag {
|
|
40
|
-
/**
|
|
41
|
-
* ActiveMediaBag constructor
|
|
42
|
-
*/
|
|
43
|
-
constructor() {
|
|
44
|
-
this.players = [];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Creates a new {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} linked to this media bag
|
|
49
|
-
* @param {module:media/MediaContent.MediaContent} mc - The content used by the new player
|
|
50
|
-
* @param {module:bags/MediaBag.MediaBag} mb - The project's MediaBag
|
|
51
|
-
* @param {module:JClicPlayer.JClicPlayer} ps - An object implementing the
|
|
52
|
-
* [PlayStation](http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html) interface,
|
|
53
|
-
* usually a {@link module:JClicPlayer.JClicPlayer JClicPlayer}.
|
|
54
|
-
* @returns {module:media/ActiveMediaPlayer.ActiveMediaPlayer}
|
|
55
|
-
*/
|
|
56
|
-
createActiveMediaPlayer(mc, mb, ps) {
|
|
57
|
-
let amp = null;
|
|
58
|
-
switch (mc.type) {
|
|
59
|
-
case 'RECORD_AUDIO':
|
|
60
|
-
if (mc.length <= 0 || mc.length >= settings.MAX_RECORD_LENGTH)
|
|
61
|
-
break;
|
|
62
|
-
/* falls through */
|
|
63
|
-
case 'PLAY_RECORDED_AUDIO':
|
|
64
|
-
if (mc.recBuffer < 0 || mc.recBuffer >= 10)
|
|
65
|
-
break;
|
|
66
|
-
/* falls through */
|
|
67
|
-
case 'PLAY_AUDIO':
|
|
68
|
-
case 'PLAY_MIDI':
|
|
69
|
-
case 'PLAY_VIDEO':
|
|
70
|
-
amp = new ActiveMediaPlayer(mc, mb, ps);
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
if (amp !== null)
|
|
74
|
-
this.players.push(amp);
|
|
75
|
-
return amp;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Looks for an already existing {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} equivalent to the requested.
|
|
80
|
-
* When not found, a new one is created and and returned.
|
|
81
|
-
* @param {module:media/MediaContent.MediaContent} mc - The content used by the new player
|
|
82
|
-
* @param {module:bags/MediaBag.MediaBag} mb - The project's MediaBag
|
|
83
|
-
* @param {module:JClicPlayer.JClicPlayer} ps - An object implementing the
|
|
84
|
-
* {@link http://projectestac.github.io/jclic/apidoc/edu/xtec/jclic/PlayStation.html|PlayStation} interface,
|
|
85
|
-
* usually a {@link module:JClicPlayer.JClicPlayer JClicPlayer}.
|
|
86
|
-
* @returns {module:media/ActiveMediaPlayer.ActiveMediaPlayer}
|
|
87
|
-
*/
|
|
88
|
-
getActiveMediaPlayer(mc, mb, ps) {
|
|
89
|
-
return this.players.find(p => p.mc === mc || p.mc.isEquivalent(mc))
|
|
90
|
-
|| this.createActiveMediaPlayer(mc, mb, ps);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes from the list of players the {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} related to the specified {@link module:media/MediaContent.MediaContent}.
|
|
95
|
-
* @param {module:media/MediaContent.MediaContent} mc - The media content to look for.
|
|
96
|
-
*/
|
|
97
|
-
removeActiveMediaPlayer(mc) {
|
|
98
|
-
const i = this.players.findIndex(p => p.mc === mc);
|
|
99
|
-
if (i >= 0) {
|
|
100
|
-
this.players[i].clear();
|
|
101
|
-
// removes the element pointed by 'i'
|
|
102
|
-
this.players.splice(i, 1);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Realizes all the media elements stored in this bag
|
|
108
|
-
*/
|
|
109
|
-
realizeAll() {
|
|
110
|
-
this.players.forEach(p => p.realize());
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Stops playing all media elements stored in this bag
|
|
115
|
-
* @param {number} level - Level at and below what all media players will be muted.
|
|
116
|
-
*/
|
|
117
|
-
stopAll(level) {
|
|
118
|
-
if (typeof level === 'undefined')
|
|
119
|
-
level = -1;
|
|
120
|
-
this.players.forEach(amp => {
|
|
121
|
-
if (level === -1 || amp.mc !== null && amp.mc.level <= level)
|
|
122
|
-
amp.stop();
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Removes all players from this media bag
|
|
128
|
-
*/
|
|
129
|
-
removeAll() {
|
|
130
|
-
this.players.forEach(p => p.clear());
|
|
131
|
-
// Empty the `players` array
|
|
132
|
-
this.players.length = 0;
|
|
133
|
-
ActiveMediaPlayer.prototype.clearAllAudioBuffers();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
Object.assign(ActiveMediaBag.prototype, {
|
|
138
|
-
/**
|
|
139
|
-
* The collection of {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} objects stored in this media bag.
|
|
140
|
-
* @name module:media/ActiveMediaBag.ActiveMediaBag#players
|
|
141
|
-
* @type {module:media/ActiveMediaPlayer.ActiveMediaPlayer[]} */
|
|
142
|
-
players: [],
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export default ActiveMediaBag;
|