jclic 2.1.21 → 2.1.23

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.
Files changed (175) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/jclic-node.js +9 -8
  3. package/dist/jclic-node.js.map +1 -1
  4. package/dist/jclic.min.js +2 -2
  5. package/dist/jclic.min.js.map +1 -1
  6. package/package.json +4 -4
  7. package/src/GlobalData.js +1 -1
  8. package/src/JClicPlayer.js +2 -2
  9. package/src/bags/MediaBag.js +6 -5
  10. package/dist/1078.jclic-node.js +0 -282
  11. package/dist/1078.jclic-node.js.map +0 -1
  12. package/dist/1196.jclic-node.js +0 -808
  13. package/dist/1196.jclic-node.js.map +0 -1
  14. package/dist/1253.jclic-node.js +0 -1432
  15. package/dist/1253.jclic-node.js.map +0 -1
  16. package/dist/13.jclic-node.js +0 -103
  17. package/dist/13.jclic-node.js.map +0 -1
  18. package/dist/1567.jclic-node.js +0 -2313
  19. package/dist/1567.jclic-node.js.map +0 -1
  20. package/dist/1588.jclic-node.js +0 -602
  21. package/dist/1588.jclic-node.js.map +0 -1
  22. package/dist/1725.jclic-node.js +0 -836
  23. package/dist/1725.jclic-node.js.map +0 -1
  24. package/dist/1731.jclic-node.js +0 -438
  25. package/dist/1731.jclic-node.js.map +0 -1
  26. package/dist/1842.jclic-node.js +0 -651
  27. package/dist/1842.jclic-node.js.map +0 -1
  28. package/dist/2160.jclic-node.js +0 -1016
  29. package/dist/2160.jclic-node.js.map +0 -1
  30. package/dist/222.jclic-node.js +0 -129
  31. package/dist/222.jclic-node.js.map +0 -1
  32. package/dist/2316.jclic-node.js +0 -949
  33. package/dist/2316.jclic-node.js.map +0 -1
  34. package/dist/2355.jclic-node.js +0 -371
  35. package/dist/2355.jclic-node.js.map +0 -1
  36. package/dist/2366.jclic-node.js +0 -431
  37. package/dist/2366.jclic-node.js.map +0 -1
  38. package/dist/2379.jclic-node.js +0 -202
  39. package/dist/2379.jclic-node.js.map +0 -1
  40. package/dist/2437.jclic-node.js +0 -450
  41. package/dist/2437.jclic-node.js.map +0 -1
  42. package/dist/2531.jclic-node.js +0 -869
  43. package/dist/2531.jclic-node.js.map +0 -1
  44. package/dist/2608.jclic-node.js +0 -160
  45. package/dist/2608.jclic-node.js.map +0 -1
  46. package/dist/2715.jclic-node.js +0 -554
  47. package/dist/2715.jclic-node.js.map +0 -1
  48. package/dist/277.jclic-node.js +0 -22
  49. package/dist/277.jclic-node.js.map +0 -1
  50. package/dist/2921.jclic-node.js +0 -660
  51. package/dist/2921.jclic-node.js.map +0 -1
  52. package/dist/2952.jclic-node.js +0 -101
  53. package/dist/2952.jclic-node.js.map +0 -1
  54. package/dist/3018.jclic-node.js +0 -421
  55. package/dist/3018.jclic-node.js.map +0 -1
  56. package/dist/3019.jclic-node.js +0 -682
  57. package/dist/3019.jclic-node.js.map +0 -1
  58. package/dist/3231.jclic-node.js +0 -274
  59. package/dist/3231.jclic-node.js.map +0 -1
  60. package/dist/331.jclic-node.js +0 -115
  61. package/dist/331.jclic-node.js.map +0 -1
  62. package/dist/3391.jclic-node.js +0 -276
  63. package/dist/3391.jclic-node.js.map +0 -1
  64. package/dist/3502.jclic-node.js +0 -671
  65. package/dist/3502.jclic-node.js.map +0 -1
  66. package/dist/3653.jclic-node.js +0 -982
  67. package/dist/3653.jclic-node.js.map +0 -1
  68. package/dist/371.jclic.min.js +0 -2
  69. package/dist/371.jclic.min.js.map +0 -1
  70. package/dist/3856.jclic-node.js +0 -575
  71. package/dist/3856.jclic-node.js.map +0 -1
  72. package/dist/4112.jclic-node.js +0 -659
  73. package/dist/4112.jclic-node.js.map +0 -1
  74. package/dist/4123.jclic-node.js +0 -910
  75. package/dist/4123.jclic-node.js.map +0 -1
  76. package/dist/427.jclic-node.js +0 -894
  77. package/dist/427.jclic-node.js.map +0 -1
  78. package/dist/4483.jclic-node.js +0 -327
  79. package/dist/4483.jclic-node.js.map +0 -1
  80. package/dist/4548.jclic-node.js +0 -1078
  81. package/dist/4548.jclic-node.js.map +0 -1
  82. package/dist/466.jclic-node.js +0 -99
  83. package/dist/466.jclic-node.js.map +0 -1
  84. package/dist/485.jclic-node.js +0 -783
  85. package/dist/485.jclic-node.js.map +0 -1
  86. package/dist/4921.jclic-node.js +0 -500
  87. package/dist/4921.jclic-node.js.map +0 -1
  88. package/dist/5091.jclic-node.js +0 -239
  89. package/dist/5091.jclic-node.js.map +0 -1
  90. package/dist/520.jclic-node.js +0 -550
  91. package/dist/520.jclic-node.js.map +0 -1
  92. package/dist/5312.jclic-node.js +0 -1126
  93. package/dist/5312.jclic-node.js.map +0 -1
  94. package/dist/5338.jclic-node.js +0 -212
  95. package/dist/5338.jclic-node.js.map +0 -1
  96. package/dist/5344.jclic-node.js +0 -229
  97. package/dist/5344.jclic-node.js.map +0 -1
  98. package/dist/5550.jclic-node.js +0 -238
  99. package/dist/5550.jclic-node.js.map +0 -1
  100. package/dist/5626.jclic-node.js +0 -614
  101. package/dist/5626.jclic-node.js.map +0 -1
  102. package/dist/5977.jclic-node.js +0 -1081
  103. package/dist/5977.jclic-node.js.map +0 -1
  104. package/dist/6148.jclic-node.js +0 -345
  105. package/dist/6148.jclic-node.js.map +0 -1
  106. package/dist/6176.jclic-node.js +0 -481
  107. package/dist/6176.jclic-node.js.map +0 -1
  108. package/dist/6221.jclic-node.js +0 -1072
  109. package/dist/6221.jclic-node.js.map +0 -1
  110. package/dist/6238.jclic-node.js +0 -718
  111. package/dist/6238.jclic-node.js.map +0 -1
  112. package/dist/6454.jclic-node.js +0 -1413
  113. package/dist/6454.jclic-node.js.map +0 -1
  114. package/dist/6565.jclic-node.js +0 -294
  115. package/dist/6565.jclic-node.js.map +0 -1
  116. package/dist/6579.jclic-node.js +0 -719
  117. package/dist/6579.jclic-node.js.map +0 -1
  118. package/dist/6715.jclic-node.js +0 -148
  119. package/dist/6715.jclic-node.js.map +0 -1
  120. package/dist/6777.jclic-node.js +0 -171
  121. package/dist/6777.jclic-node.js.map +0 -1
  122. package/dist/6782.jclic-node.js +0 -1611
  123. package/dist/6782.jclic-node.js.map +0 -1
  124. package/dist/6847.jclic-node.js +0 -601
  125. package/dist/6847.jclic-node.js.map +0 -1
  126. package/dist/6856.jclic-node.js +0 -252
  127. package/dist/6856.jclic-node.js.map +0 -1
  128. package/dist/696.jclic-node.js +0 -1821
  129. package/dist/696.jclic-node.js.map +0 -1
  130. package/dist/698.jclic-node.js +0 -583
  131. package/dist/698.jclic-node.js.map +0 -1
  132. package/dist/704.jclic-node.js +0 -80
  133. package/dist/704.jclic-node.js.map +0 -1
  134. package/dist/7046.jclic-node.js +0 -735
  135. package/dist/7046.jclic-node.js.map +0 -1
  136. package/dist/7220.jclic-node.js +0 -156
  137. package/dist/7220.jclic-node.js.map +0 -1
  138. package/dist/7257.jclic-node.js +0 -931
  139. package/dist/7257.jclic-node.js.map +0 -1
  140. package/dist/743.jclic-node.js +0 -583
  141. package/dist/743.jclic-node.js.map +0 -1
  142. package/dist/757.jclic-node.js +0 -1072
  143. package/dist/757.jclic-node.js.map +0 -1
  144. package/dist/7781.jclic-node.js +0 -202
  145. package/dist/7781.jclic-node.js.map +0 -1
  146. package/dist/7912.jclic-node.js +0 -2103
  147. package/dist/7912.jclic-node.js.map +0 -1
  148. package/dist/827.jclic-node.js +0 -708
  149. package/dist/827.jclic-node.js.map +0 -1
  150. package/dist/8276.jclic-node.js +0 -409
  151. package/dist/8276.jclic-node.js.map +0 -1
  152. package/dist/8322.jclic-node.js +0 -498
  153. package/dist/8322.jclic-node.js.map +0 -1
  154. package/dist/8641.jclic-node.js +0 -360
  155. package/dist/8641.jclic-node.js.map +0 -1
  156. package/dist/8837.jclic-node.js +0 -651
  157. package/dist/8837.jclic-node.js.map +0 -1
  158. package/dist/8895.jclic-node.js +0 -151
  159. package/dist/8895.jclic-node.js.map +0 -1
  160. package/dist/9072.jclic-node.js +0 -1285
  161. package/dist/9072.jclic-node.js.map +0 -1
  162. package/dist/9078.jclic-node.js +0 -935
  163. package/dist/9078.jclic-node.js.map +0 -1
  164. package/dist/9103.jclic-node.js +0 -718
  165. package/dist/9103.jclic-node.js.map +0 -1
  166. package/dist/9359.jclic-node.js +0 -145
  167. package/dist/9359.jclic-node.js.map +0 -1
  168. package/dist/9409.jclic-node.js +0 -921
  169. package/dist/9409.jclic-node.js.map +0 -1
  170. package/dist/9513.jclic-node.js +0 -720
  171. package/dist/9513.jclic-node.js.map +0 -1
  172. package/dist/9704.jclic-node.js +0 -81
  173. package/dist/9704.jclic-node.js.map +0 -1
  174. package/dist/9950.jclic-node.js +0 -827
  175. package/dist/9950.jclic-node.js.map +0 -1
@@ -1,827 +0,0 @@
1
- "use strict";
2
- exports.id = 9950;
3
- exports.ids = [9950,5550];
4
- exports.modules = {
5
-
6
- /***/ 5550:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11
- /* harmony export */ });
12
- /* unused harmony export MediaBag */
13
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
14
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
15
- /* harmony import */ var _MediaBagElement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1196);
16
- /* harmony import */ var _skins_Skin_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(757);
17
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1253);
18
- /**
19
- * File : bags/MediaBag.js
20
- * Created : 07/04/2015
21
- * By : Francesc Busquets <francesc@gmail.com>
22
- *
23
- * JClic.js
24
- * An HTML5 player of JClic activities
25
- * https://projectestac.github.io/jclic.js
26
- *
27
- * @source https://github.com/projectestac/jclic.js
28
- *
29
- * @license EUPL-1.2
30
- * @licstart
31
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
32
- *
33
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
34
- * the European Commission- subsequent versions of the EUPL (the "Licence");
35
- * You may not use this work except in compliance with the Licence.
36
- *
37
- * You may obtain a copy of the Licence at:
38
- * https://joinup.ec.europa.eu/software/page/eupl
39
- *
40
- * Unless required by applicable law or agreed to in writing, software
41
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
42
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
43
- * Licence for the specific language governing permissions and limitations
44
- * under the Licence.
45
- * @licend
46
- * @module
47
- */
48
-
49
-
50
-
51
-
52
-
53
-
54
- /**
55
- * This class stores and manages all the media components (images, sounds, animations, video,
56
- * MIDI files, etc.) needed to run the activities of a {@link module:project/JClicProject.JClicProject JClicProject}. The main member of
57
- * the class is `elements`. This is where {@link module:bads/MediaBagElement.MediaBagElement} objects are stored.
58
- */
59
- class MediaBag {
60
- /**
61
- * MediaBag constructor
62
- * @param {module:project/JClicProject.JClicProject} project - The JClic project to which this media bag belongs
63
- */
64
- constructor(project) {
65
- this.project = project;
66
- this.elements = {};
67
- }
68
-
69
- /**
70
- * Loads this object settings from a specific JQuery XML element
71
- * @param {external:jQuery} $xml - The XML element to parse
72
- */
73
- setProperties($xml) {
74
- $xml.children('media').each((_n, child) => {
75
- const mbe = new _MediaBagElement_js__WEBPACK_IMPORTED_MODULE_1__["default"](this.project.basePath, null, this.project.zip);
76
- mbe.setProperties(jquery__WEBPACK_IMPORTED_MODULE_0___default()(child));
77
- this.elements[mbe.name] = mbe;
78
- });
79
- return this;
80
- }
81
-
82
- /**
83
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
84
- * parent references, constants and also attributes retaining the default value.
85
- * The resulting object is commonly usued to serialize elements in JSON format.
86
- * @returns {object} - The resulting object, with minimal attrributes
87
- */
88
- getAttributes() {
89
- return Object.keys(this.elements).map(k => this.elements[k].getAttributes());
90
- }
91
-
92
- /**
93
- * Loads the MediaBag content from a data object
94
- * @param {object} data - The data object to parse
95
- */
96
- setAttributes(data) {
97
- data.forEach(el => {
98
- const mbe = new _MediaBagElement_js__WEBPACK_IMPORTED_MODULE_1__["default"](this.project.basePath, null, this.project.zip);
99
- mbe.setAttributes(el);
100
- this.elements[mbe.name] = mbe;
101
- });
102
- return this;
103
- }
104
-
105
- /**
106
- * Finds a {@link module:bads/MediaBagElement.MediaBagElement} by its name, creating a new one if not found and requested.
107
- * @param {string} name - The name of the element
108
- * @param {boolean} [create] - When `true`, a new MediaBagElement will be created if not found,
109
- * using 'name' as its file name.
110
- * @returns {module:bags/MediaBagElement.MediaBagElement}
111
- */
112
- getElement(name, create) {
113
- name = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .nSlash */ .c4)(name);
114
- let result = this.elements[name];
115
- if (create && !result)
116
- result = this.getElementByFileName(name, create);
117
- return result;
118
- }
119
-
120
- /**
121
- * Gets a {@link module:bads/MediaBagElement.MediaBagElement} by its file name.
122
- * @param {string} file - The requested file name
123
- * @param {boolean} [create] - When `true`, a new {@link module:bads/MediaBagElement.MediaBagElement} will be created if not
124
- * found.
125
- * @returns {module:bags/MediaBagElement.MediaBagElement}
126
- */
127
- getElementByFileName(file, create) {
128
- let result = null;
129
- if (file) {
130
- file = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .nSlash */ .c4)(file);
131
- for (let name in this.elements) {
132
- if (this.elements[name].file === file) {
133
- result = this.elements[name];
134
- break;
135
- }
136
- }
137
- if (!result && create) {
138
- result = new _MediaBagElement_js__WEBPACK_IMPORTED_MODULE_1__["default"](this.project.basePath, null, this.project.zip);
139
- result.name = file;
140
- result.file = file;
141
- result.ext = file.toLowerCase().split('#')[0].split('.').pop();
142
- result.type = result.getFileType(result.ext);
143
- this.elements[result.name] = result;
144
- }
145
- }
146
- return result;
147
- }
148
-
149
- /**
150
- * Get the names of the media elements that are of the given type.
151
- * When the search type is `font`, the `fontName` property is used instead of `name`
152
- * @param {string} type - The type of elements to search
153
- * @returns {string[]}
154
- */
155
- getElementsOfType(type) {
156
- const result = [];
157
- jquery__WEBPACK_IMPORTED_MODULE_0___default().each(this.elements, (name, element) => {
158
- if (element.type === type)
159
- result.push(type === 'font' ? element.fontName : name);
160
- });
161
- return result;
162
- }
163
-
164
- /**
165
- * Preloads all resources.
166
- *
167
- * __Use with care!__ Calling this method will start loading all the resources defined in the
168
- * MediaBag, whether used or not in the current activity.
169
- * @param {string} type - The type of media to be build. When `null` or `undefined`, all
170
- * resources will be build.
171
- * @param {function} [callback] - Function to be called when each element is ready.
172
- * @param {module:JClicPlayer.JClicPlayer} [ps] - An optional `PlayStation` (currently a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) used to dynamically load fonts
173
- * @returns {number} - The total number of elements that will be built
174
- */
175
- buildAll(type, callback, ps) {
176
- let count = 0;
177
- jquery__WEBPACK_IMPORTED_MODULE_0___default().each(this.elements, (name, element) => {
178
- if (!type || element.type === type) {
179
- element.build(callback, ps, false);
180
- count++;
181
- }
182
- });
183
- return count;
184
- }
185
-
186
- /**
187
- * Checks if there are media waiting to be loaded
188
- * @returns {number} - The amount of media elements already loaded, or -1 if all elements are ready
189
- */
190
- countWaitingElements() {
191
- let
192
- ready = 0,
193
- allReady = true;
194
-
195
- // Only for debug purposes: return always 'false'
196
- // TODO: Check loading process!
197
- jquery__WEBPACK_IMPORTED_MODULE_0___default().each(this.elements, (name, element) => {
198
- if (element.data && !element.ready && !element.checkReady() && !element.checkTimeout()) {
199
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__/* .log */ .Rm)('debug', '... waiting for: %s', name);
200
- allReady = false;
201
- } else
202
- ready++;
203
- });
204
- return allReady ? -1 : ready;
205
- }
206
-
207
- /**
208
- * Loads a {@link module:skins/Skin.Skin Skin} object
209
- * @param {string} name - The skin name to be loaded
210
- * @param {string} ps - The {@link module:JClicPlayer.JClicPlayer JClicPlayer} linked to the skin
211
- * @returns {module:skins/Skin.Skin}
212
- */
213
- getSkinElement(name, ps) {
214
- return _skins_Skin_js__WEBPACK_IMPORTED_MODULE_2__["default"].getSkin(name, ps);
215
- }
216
- }
217
-
218
- Object.assign(MediaBag.prototype, {
219
- /**
220
- * The collection of {@link module:bads/MediaBagElement.MediaBagElement} objects
221
- * @name module:bags/MediaBag.MediaBag#elements
222
- * @type {object} */
223
- elements: null,
224
- /**
225
- * The JClic project to which this MediaBag belongs
226
- * @name module:bags/MediaBag.MediaBag#project
227
- * @type {module:project/JClicProject.JClicProject} */
228
- project: null,
229
- });
230
-
231
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MediaBag);
232
-
233
-
234
- /***/ }),
235
-
236
- /***/ 9950:
237
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
238
-
239
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
240
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
241
- /* harmony export */ });
242
- /* unused harmony export JClicProject */
243
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
244
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
245
- /* harmony import */ var _ProjectSettings_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(570);
246
- /* harmony import */ var _bags_ActivitySequence_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2316);
247
- /* harmony import */ var _bags_MediaBag_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5550);
248
- /* harmony import */ var _Activity_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1567);
249
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1253);
250
- /* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7912);
251
- /**
252
- * File : project/JClicProject.js
253
- * Created : 01/04/2015
254
- * By : Francesc Busquets <francesc@gmail.com>
255
- *
256
- * JClic.js
257
- * An HTML5 player of JClic activities
258
- * https://projectestac.github.io/jclic.js
259
- *
260
- * @source https://github.com/projectestac/jclic.js
261
- *
262
- * @license EUPL-1.2
263
- * @licstart
264
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
265
- *
266
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
267
- * the European Commission- subsequent versions of the EUPL (the "Licence");
268
- * You may not use this work except in compliance with the Licence.
269
- *
270
- * You may obtain a copy of the Licence at:
271
- * https://joinup.ec.europa.eu/software/page/eupl
272
- *
273
- * Unless required by applicable law or agreed to in writing, software
274
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
275
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
276
- * Licence for the specific language governing permissions and limitations
277
- * under the Licence.
278
- * @licend
279
- * @module
280
- */
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
- /**
291
- * JClicProject contains all the components of a JClic project: activities, sequences, media
292
- * files, descriptors and metadata.
293
- *
294
- * This encapsulation is achieved by three auxiliary objects:
295
- * - {@link module:project/ProjectSettings.ProjectSettings ProjectSettings}: stores metadata like full title, description, authors, languages,
296
- * educational topics...
297
- * - {@link module:bags/ActivitySequence.ActivitySequence ActivitySequence}: defines the order in which the activities must be shown.
298
- * - {@link module:bags/MediaBag.MediaBag MediaBag}: contains the list of all media files used by the activities
299
- */
300
- class JClicProject {
301
- /**
302
- * JClicProject constructor
303
- */
304
- constructor() {
305
- this.settings = new _ProjectSettings_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
306
- this.activitySequence = new _bags_ActivitySequence_js__WEBPACK_IMPORTED_MODULE_2__["default"](this);
307
- this._activities = {};
308
- this.mediaBag = new _bags_MediaBag_js__WEBPACK_IMPORTED_MODULE_3__["default"](this);
309
- }
310
-
311
- /**
312
- * Loads the project settings from a main jQuery XML element
313
- * @param {external:jQuery} $xml - The XML element
314
- * @param {string} path - The full path of this project
315
- * @param {external:JSZip} [zip] - An optional JSZip object where this project is encapsulated
316
- * @param {object} [options] - An object with miscellaneous options
317
- * @returns {module:project/JClicProject.JClicProject}
318
- */
319
- setProperties($xml, path, zip, options) {
320
- if (path) {
321
- this.path = path;
322
- if (path.file)
323
- this.basePath = path;
324
- else
325
- this.basePath = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .getBasePath */ .DT)(path);
326
- }
327
- this.zip = zip;
328
- this.name = $xml.attr('name');
329
- this.version = $xml.attr('version');
330
- if ($xml.attr('type') !== undefined && $xml.attr('type') !== '')
331
- this.type = $xml.attr('type');
332
- if ($xml.attr('code') !== undefined && $xml.attr('code') !== '')
333
- this.code = $xml.attr('code');
334
- this.settings.setProperties($xml.children('settings'));
335
- this.activitySequence.setProperties($xml.children('sequence'));
336
- this.mediaBag.setProperties($xml.children('mediaBag'));
337
- this.reportableActs = 0;
338
- this._activities = {};
339
- const $node = $xml.children('activities');
340
- const $acts = $node.children('activity');
341
- const ownFonts = this.mediaBag.getElementsOfType('font');
342
- if (ownFonts.length > 0)
343
- options.ownFonts = (options.ownFonts || []).concat(ownFonts);
344
- // Skip checkTree when in NodeJS, due to a JSDOM error with jQuery in XML mode
345
- if (!_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .settings */ .W0.NODEJS)
346
- _AWT_js__WEBPACK_IMPORTED_MODULE_6__/* .Font */ .KQ.checkTree($acts, options);
347
- $acts.each((_n, act) => {
348
- const $act = jquery__WEBPACK_IMPORTED_MODULE_0___default()(act);
349
- this._activities[(0,_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .nSlash */ .c4)($act.attr('name'))] = $act;
350
- if ($act.children('settings').attr('report') === 'true')
351
- this.reportableActs++;
352
- });
353
- return this;
354
- }
355
-
356
- /**
357
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
358
- * parent references, constants and also attributes retaining the default value.
359
- * The resulting object is commonly usued to serialize elements in JSON format.
360
- * @returns {object} - The resulting object, with minimal attrributes
361
- */
362
- getAttributes() {
363
- const keys = Object.keys(this._activities);
364
- this.activities = {};
365
- keys.forEach(k => {
366
- const act = this._activities[k];
367
- this.activities[k] = act.jquery ? _Activity_js__WEBPACK_IMPORTED_MODULE_4__["default"].getActivity(act, this) : act;
368
- });
369
-
370
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .getAttr */ .iu)(this, ['name', 'version', 'type', 'code', 'settings', 'activitySequence', 'activities', 'mediaBag']);
371
- }
372
-
373
- /**
374
- * Gets a JSON string representing the content of this project. This string can be transformed later into a data
375
- * object suitable for `setAttributes`.
376
- * @param {number} [space] - The number of white spaces to place between items. Defaults to zero (meaning all the JSON rendered in one single line)
377
- * @returns {string} - The JSON text
378
- */
379
- getJSON(space = 0) {
380
- return JSON.stringify(
381
- this.getAttributes(),
382
- (_key, val) => val.toFixed ? Number(val.toFixed(4)) : val,
383
- space
384
- );
385
- }
386
-
387
- /**
388
- * Loads the project settings from a data object
389
- * @param {object} data - The data object
390
- * @param {string} path - The full path of this project
391
- * @param {external:JSZip} [zip] - An optional JSZip object where this project is encapsulated
392
- * @param {object} [options] - An object with miscellaneous options
393
- * @returns {module:project/JClicProject.JClicProject}
394
- */
395
- setAttributes(data, path, zip, options) {
396
- if (path) {
397
- this.path = path;
398
- if (path.file)
399
- this.basePath = path;
400
- else
401
- this.basePath = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .getBasePath */ .DT)(path);
402
- }
403
- this.zip = zip;
404
- this.name = data.name;
405
- this.version = data.version;
406
- if (data.type)
407
- this.type = data.type;
408
- if (data.code)
409
- this.code = data.code;
410
- this.settings.setAttributes(data.settings);
411
- this.activitySequence.setAttributes(data.activitySequence);
412
- this.mediaBag.setAttributes(data.mediaBag);
413
- this.reportableActs = 0;
414
- this._activities = data.activities;
415
-
416
- const ownFonts = this.mediaBag.getElementsOfType('font');
417
- if (ownFonts.length > 0)
418
- options.ownFonts = (options.ownFonts || []).concat(ownFonts);
419
- // TODO: Check fonts
420
- _AWT_js__WEBPACK_IMPORTED_MODULE_6__/* .Font */ .KQ.checkTree(this._activities, options);
421
- this.reportableActs = Object.keys(this._activities)
422
- .filter(k => this._activities[k].includeInReports)
423
- .length;
424
- return this;
425
- }
426
-
427
- /**
428
- * Finds activities by name and builds the corresponding {@link module:Activity.Activity Activity} object.
429
- * @param {string} name - The name of the requested activity
430
- * @returns {module:Activity.Activity}
431
- */
432
- getActivity(name) {
433
- return _Activity_js__WEBPACK_IMPORTED_MODULE_4__["default"].getActivity(this._activities[(0,_Utils_js__WEBPACK_IMPORTED_MODULE_5__/* .nSlash */ .c4)(name)], this);
434
- }
435
-
436
- /**
437
- *
438
- * Builds the {@link module:skins/Skin.Skin Skin}, {@link module:media/EventSounds.EventSounds EventSounds} and {@link module:bags/MediaBag.MediaBag MediaBag} fonts associated to this project.
439
- * @param {module:JClicPlayer.JClicPlayer} ps - The PlayStation (usually a {@link module:JClicPlayer.JClicPlayer JClicPlayer}) linked to this project.
440
- */
441
- realize(ps) {
442
- // Build skin
443
- if (this.skin === null && this.settings.skinFileName !== null && this.settings.skinFileName.length > 0)
444
- this.skin = this.mediaBag.getSkinElement(this.settings.skinFileName, ps);
445
-
446
- this.settings.eventSounds.realize(ps, this.mediaBag);
447
-
448
- // Build all elements of type `font`
449
- this.mediaBag.buildAll('font', null, ps);
450
- }
451
-
452
- /**
453
- * Run finalizers on realized objects
454
- */
455
- end() {
456
- // TODO: Implement JClicProject.end()
457
- }
458
- }
459
-
460
- Object.assign(JClicProject.prototype, {
461
- /**
462
- * The project's name
463
- * @name module:project/JClicProject.JClicProject#name
464
- * @type {string} */
465
- name: 'unknown',
466
- /**
467
- * The version of the XML file format used to save the project (currently 0.1.3)
468
- * @name module:project/JClicProject.JClicProject#version
469
- * @type {string} */
470
- version: '0.1.3',
471
- /**
472
- * Optional property that can be used by reporting systems
473
- * @name module:project/JClicProject.JClicProject#type
474
- * @type {string} */
475
- type: null,
476
- /**
477
- * Optional property that can be used by reporting systems
478
- * @name module:project/JClicProject.JClicProject#code
479
- * @type {string} */
480
- code: null,
481
- /**
482
- * Object containing the project settings
483
- * @name module:project/JClicProject.JClicProject#settings
484
- * @type {module:project/ProjectSettings.ProjectSettings} */
485
- settings: null,
486
- /**
487
- * Object containing the order in which the activities should be played
488
- * @name module:project/JClicProject.JClicProject#activitySequence
489
- * @type {module:bags/ActivitySequence.ActivitySequence} */
490
- activitySequence: null,
491
- /**
492
- * Array of jQuery xml elements containing the data of each activity. Don't rely on this object
493
- * to retrieve real activities. Use the method {@link module:project/JClicProject.JClicProject#getActivity getActivity} instead.
494
- * @name module:project/JClicProject.JClicProject#_activities
495
- * @private
496
- * @type {external:jQuery[]} */
497
- _activities: null,
498
- /**
499
- * Number of activities suitable to be included reports
500
- * @name module:project/JClicProject.JClicProject#reportableActs
501
- * @type {number}
502
- */
503
- reportableActs: 0,
504
- /**
505
- * The collection of all media elements used in this project
506
- * @name module:project/JClicProject.JClicProject#mediaBag
507
- * @type {module:bags/MediaBag.MediaBag} */
508
- mediaBag: null,
509
- /**
510
- * The object that builds and manages the visual interface presented to users
511
- * @name module:project/JClicProject.JClicProject#skin
512
- * @type {module:skins/Skin.Skin} */
513
- skin: null,
514
- /**
515
- * Relative path or absolute URL to be used as a base to access files, usually in conjunction
516
- * with {@link module:JClicPlayer.JClicPlayer#basePath}
517
- * @name module:project/JClicProject.JClicProject#basePath
518
- * @type {string} */
519
- basePath: '',
520
- /**
521
- * Full path of this project
522
- * @name module:project/JClicProject.JClicProject#path
523
- * @type {string} */
524
- path: null,
525
- /**
526
- * The JSZip object where this project is stored (can be `null`)
527
- * @name module:project/JClicProject.JClicProject#zip
528
- * @type {external:JSZip} */
529
- zip: null,
530
- });
531
-
532
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JClicProject);
533
-
534
-
535
- /***/ }),
536
-
537
- /***/ 570:
538
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
539
-
540
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
541
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
542
- /* harmony export */ });
543
- /* unused harmony export ProjectSettings */
544
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
545
- /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
546
- /* harmony import */ var _media_EventSounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5338);
547
- /* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1253);
548
- /**
549
- * File : project/ProjectSettings.js
550
- * Created : 01/04/2015
551
- * By : Francesc Busquets <francesc@gmail.com>
552
- *
553
- * JClic.js
554
- * An HTML5 player of JClic activities
555
- * https://projectestac.github.io/jclic.js
556
- *
557
- * @source https://github.com/projectestac/jclic.js
558
- *
559
- * @license EUPL-1.2
560
- * @licstart
561
- * (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
562
- *
563
- * Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
564
- * the European Commission- subsequent versions of the EUPL (the "Licence");
565
- * You may not use this work except in compliance with the Licence.
566
- *
567
- * You may obtain a copy of the Licence at:
568
- * https://joinup.ec.europa.eu/software/page/eupl
569
- *
570
- * Unless required by applicable law or agreed to in writing, software
571
- * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
572
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
573
- * Licence for the specific language governing permissions and limitations
574
- * under the Licence.
575
- * @licend
576
- * @module
577
- */
578
-
579
- /* global window */
580
-
581
-
582
-
583
-
584
-
585
- /**
586
- * This class contains miscellaneous settings of JClic projects.
587
- *
588
- * In addition to the members of this class, there can be other properties in JClic project files
589
- * that are not currently loaded:
590
- * - iconFileName
591
- * - descriptors
592
- * - area
593
- * - level
594
- * - locale
595
- * - authors
596
- * - organizations
597
- * - revisions
598
- */
599
- class ProjectSettings {
600
- /**
601
- * ProjectSettings constructor
602
- * @param {module:project/JClicProject.JClicProject} project - The project to which this settings belongs
603
- */
604
- constructor(project) {
605
- this.project = project;
606
- this.authors = [];
607
- this.organizations = [];
608
- this.revisions = [];
609
- this.languages = [];
610
- this.locales = [];
611
- this.description = {};
612
- this.tags = {};
613
- }
614
-
615
- /**
616
- * Reads the ProjectSettings values from a JQuery XML element
617
- * @param {external:jQuery} $xml - The XML element to parse
618
- */
619
- setProperties($xml) {
620
- let single_description = null;
621
- const multiple_descriptions = [];
622
-
623
- $xml.children().each((_n, child) => {
624
- switch (child.nodeName) {
625
- case 'title':
626
- this.title = child.textContent;
627
- break;
628
- case 'description':
629
- single_description = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getXmlNodeText */ .H_)(child);
630
- break;
631
- case 'descriptions':
632
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(child).children().each((_n, desc) => multiple_descriptions.push((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseXmlNode */ .Fy)(desc)));
633
- break;
634
- case 'author':
635
- this.authors.push((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .reduceTextsToStrings */ .DC)((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseXmlNode */ .Fy)(child)));
636
- break;
637
- case 'organization':
638
- this.organizations.push((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .reduceTextsToStrings */ .DC)((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseXmlNode */ .Fy)(child)));
639
- break;
640
- case 'revision':
641
- const revision = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .reduceTextsToStrings */ .DC)((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseXmlNode */ .Fy)(child));
642
- if (revision.date)
643
- revision.date = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseOldDate */ .DV)(revision.date);
644
- this.revisions.push(revision);
645
- break;
646
- case 'language':
647
- this.languages.push((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .cleanOldLanguageTag */ .bG)(child.textContent));
648
- break;
649
- case 'eventSounds':
650
- this.eventSounds = new _media_EventSounds_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
651
- this.eventSounds.setProperties(jquery__WEBPACK_IMPORTED_MODULE_0___default()(child));
652
- break;
653
- case 'skin':
654
- this.skinFileName = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child).attr('file');
655
- break;
656
- case 'descriptors':
657
- this.tags = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .parseXmlNode */ .Fy)(child, true);
658
- if (this.tags['#text']) {
659
- this.tags.other = this.tags['#text'].textContent;
660
- delete this.tags['#text'];
661
- }
662
- break;
663
- case 'license':
664
- this.license = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getXmlNodeText */ .H_)(child);
665
- break;
666
- case 'cover':
667
- case 'thumb':
668
- const img = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getXmlNodeText */ .H_)(child);
669
- if (img.file)
670
- this[child.nodeName] = img.file;
671
- break;
672
- }
673
- });
674
-
675
- this.buildLocales();
676
-
677
- multiple_descriptions.forEach(d => {
678
- if (d.language && d.text)
679
- this.description[d.language] = d.text;
680
- });
681
-
682
- if (single_description && this.languages.length > 0 && !this.description[this.languages[0]])
683
- this.description[this.languages[0]] = single_description;
684
-
685
- return this;
686
- }
687
-
688
- buildLocales() {
689
- // Try to find an array of valid locales
690
- // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
691
- if (this.languages.length > 0 && window.Intl && window.Intl.getCanonicalLocales) {
692
- this.locales = [];
693
- this.languages.forEach(lang => {
694
- // Languages usually are stored in the form: "English (en)"
695
- const matches = /\(([a-z,A-Z,-]+)\)/.exec(lang);
696
- if (matches && matches.length > 1) {
697
- try {
698
- const canonicals = window.Intl.getCanonicalLocales(matches[1]);
699
- if (canonicals)
700
- this.locales = this.locales.concat(canonicals);
701
- } catch (_err) {
702
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .log */ .Rm)('error', `Invalid language: ${lang}`);
703
- }
704
- }
705
- });
706
- }
707
- return this;
708
- }
709
-
710
- /**
711
- * Gets a object with the basic attributes needed to rebuild this instance excluding functions,
712
- * parent references, constants and also attributes retaining the default value.
713
- * The resulting object is commonly usued to serialize elements in JSON format.
714
- * @returns {object} - The resulting object, with minimal attrributes
715
- */
716
- getAttributes() {
717
- return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAttr */ .iu)(this, [
718
- 'title', 'description',
719
- 'tags', 'languages', 'license',
720
- 'authors', 'organizations',
721
- 'revisions',
722
- 'cover', 'thumb',
723
- 'skinFileName', 'eventSounds'
724
- ]);
725
- }
726
-
727
- /**
728
- * Reads the properties of this ProjectSettings from a data object
729
- * @param {object} data - The data object to be parsed, or just the text content
730
- * @returns {module:project/ProjectSettings.ProjectSettings}
731
- */
732
- setAttributes(data) {
733
- (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .setAttr */ .ob)(this, data, [
734
- 'title', 'description',
735
- 'tags', 'languages', 'license',
736
- 'authors', 'organizations',
737
- 'revisions',
738
- 'cover', 'thumb',
739
- 'skinFileName', 'eventSounds'
740
- ]);
741
-
742
- // Build Date objects in revisions
743
- if (this.revisions)
744
- this.revisions.forEach(rv => {
745
- if (rv.date)
746
- rv.date = new Date(rv.date);
747
- });
748
-
749
- return this.buildLocales();
750
- }
751
- }
752
-
753
- Object.assign(ProjectSettings.prototype, {
754
- /**
755
- * The JClicProject to which this ProjectSettings belongs
756
- * @name module:project/ProjectSettings.ProjectSettings#project
757
- * @type {module:project/JClicProject.JClicProject} */
758
- project: null,
759
- /**
760
- * The project title
761
- * @name module:project/ProjectSettings.ProjectSettings#title
762
- * @type {string} */
763
- title: 'Untitled',
764
- /**
765
- * The authors of this project.
766
- * Each author is represented by an object with the following attributes:
767
- * `name` (mandatory), `mail`, `rol`, `organization` and `url`
768
- * @name module:project/ProjectSettings.ProjectSettings#authors
769
- * @type {object[]} */
770
- authors: null,
771
- /**
772
- * Schools, companies and other institutions involved on this project.
773
- * Each organization is represented by an object with the following attributes:
774
- * `name` (mandatory), `mail`, `url`, `address`, `pc`, `city`, `state`, `country`, `comments`
775
- * @name module:project/ProjectSettings.ProjectSettings#organizations
776
- * @type {object[]} */
777
- organizations: null,
778
- /**
779
- * The history of revisions made to this project.
780
- * Revisions are represented by objects with the following attributes:
781
- * `date` (mandatory), `description`, `comments` and `author`
782
- * @name module:project/ProjectSettings.ProjectSettings#revisions
783
- * @type {object[]} */
784
- revisions: null,
785
- /**
786
- * Project's description, maybe in multiple languages.
787
- * @name module:project/ProjectSettings.ProjectSettings#description
788
- * @type {object} */
789
- description: null,
790
- /**
791
- * JClic projects can use more than one language, so use a string array
792
- * @name module:project/ProjectSettings.ProjectSettings#languages
793
- * @type {string[]} */
794
- languages: null,
795
- tags: null,
796
- cover: null,
797
- thumb: null,
798
- license: {
799
- type: 'by-nc-sa',
800
- url: 'https://creativecommons.org/licenses/by-nc-sa/4.0',
801
- },
802
- /**
803
- * Array of canonical locales, as defined in
804
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation|Intl}
805
- * @name module:project/ProjectSettings.ProjectSettings#locales
806
- * @type {string[]} */
807
- locales: null,
808
- /**
809
- * The name of an optional 'skin' (visual aspect) can be set for the whole project, or for each {@link module:Activity.Activity Activity}
810
- * @name module:project/ProjectSettings.ProjectSettings#skinFileName
811
- * @type {string} */
812
- skinFileName: null,
813
- /**
814
- * The main {@link module:media/EventSounds.EventSounds EventSounds} object of the project
815
- * @name module:project/ProjectSettings.ProjectSettings#eventSounds
816
- * @type {module:media/EventSounds.EventSounds} */
817
- eventSounds: new _media_EventSounds_js__WEBPACK_IMPORTED_MODULE_1__["default"](),
818
- });
819
-
820
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProjectSettings);
821
-
822
-
823
- /***/ })
824
-
825
- };
826
- ;
827
- //# sourceMappingURL=9950.jclic-node.js.map