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.
- package/CHANGELOG.md +13 -0
- package/dist/jclic-node.js +9 -8
- package/dist/jclic-node.js.map +1 -1
- package/dist/jclic.min.js +2 -2
- package/dist/jclic.min.js.map +1 -1
- package/package.json +4 -4
- package/src/GlobalData.js +1 -1
- package/src/JClicPlayer.js +2 -2
- package/src/bags/MediaBag.js +6 -5
- package/dist/1078.jclic-node.js +0 -282
- package/dist/1078.jclic-node.js.map +0 -1
- package/dist/1196.jclic-node.js +0 -808
- package/dist/1196.jclic-node.js.map +0 -1
- package/dist/1253.jclic-node.js +0 -1432
- package/dist/1253.jclic-node.js.map +0 -1
- package/dist/13.jclic-node.js +0 -103
- package/dist/13.jclic-node.js.map +0 -1
- package/dist/1567.jclic-node.js +0 -2313
- package/dist/1567.jclic-node.js.map +0 -1
- package/dist/1588.jclic-node.js +0 -602
- package/dist/1588.jclic-node.js.map +0 -1
- package/dist/1725.jclic-node.js +0 -836
- package/dist/1725.jclic-node.js.map +0 -1
- package/dist/1731.jclic-node.js +0 -438
- package/dist/1731.jclic-node.js.map +0 -1
- package/dist/1842.jclic-node.js +0 -651
- package/dist/1842.jclic-node.js.map +0 -1
- package/dist/2160.jclic-node.js +0 -1016
- package/dist/2160.jclic-node.js.map +0 -1
- package/dist/222.jclic-node.js +0 -129
- package/dist/222.jclic-node.js.map +0 -1
- package/dist/2316.jclic-node.js +0 -949
- package/dist/2316.jclic-node.js.map +0 -1
- package/dist/2355.jclic-node.js +0 -371
- package/dist/2355.jclic-node.js.map +0 -1
- package/dist/2366.jclic-node.js +0 -431
- package/dist/2366.jclic-node.js.map +0 -1
- package/dist/2379.jclic-node.js +0 -202
- package/dist/2379.jclic-node.js.map +0 -1
- package/dist/2437.jclic-node.js +0 -450
- package/dist/2437.jclic-node.js.map +0 -1
- package/dist/2531.jclic-node.js +0 -869
- package/dist/2531.jclic-node.js.map +0 -1
- package/dist/2608.jclic-node.js +0 -160
- package/dist/2608.jclic-node.js.map +0 -1
- package/dist/2715.jclic-node.js +0 -554
- package/dist/2715.jclic-node.js.map +0 -1
- package/dist/277.jclic-node.js +0 -22
- package/dist/277.jclic-node.js.map +0 -1
- package/dist/2921.jclic-node.js +0 -660
- package/dist/2921.jclic-node.js.map +0 -1
- package/dist/2952.jclic-node.js +0 -101
- package/dist/2952.jclic-node.js.map +0 -1
- package/dist/3018.jclic-node.js +0 -421
- package/dist/3018.jclic-node.js.map +0 -1
- package/dist/3019.jclic-node.js +0 -682
- package/dist/3019.jclic-node.js.map +0 -1
- package/dist/3231.jclic-node.js +0 -274
- package/dist/3231.jclic-node.js.map +0 -1
- package/dist/331.jclic-node.js +0 -115
- package/dist/331.jclic-node.js.map +0 -1
- package/dist/3391.jclic-node.js +0 -276
- package/dist/3391.jclic-node.js.map +0 -1
- package/dist/3502.jclic-node.js +0 -671
- package/dist/3502.jclic-node.js.map +0 -1
- package/dist/3653.jclic-node.js +0 -982
- package/dist/3653.jclic-node.js.map +0 -1
- package/dist/371.jclic.min.js +0 -2
- package/dist/371.jclic.min.js.map +0 -1
- package/dist/3856.jclic-node.js +0 -575
- package/dist/3856.jclic-node.js.map +0 -1
- package/dist/4112.jclic-node.js +0 -659
- package/dist/4112.jclic-node.js.map +0 -1
- package/dist/4123.jclic-node.js +0 -910
- package/dist/4123.jclic-node.js.map +0 -1
- package/dist/427.jclic-node.js +0 -894
- package/dist/427.jclic-node.js.map +0 -1
- package/dist/4483.jclic-node.js +0 -327
- package/dist/4483.jclic-node.js.map +0 -1
- package/dist/4548.jclic-node.js +0 -1078
- package/dist/4548.jclic-node.js.map +0 -1
- package/dist/466.jclic-node.js +0 -99
- package/dist/466.jclic-node.js.map +0 -1
- package/dist/485.jclic-node.js +0 -783
- package/dist/485.jclic-node.js.map +0 -1
- package/dist/4921.jclic-node.js +0 -500
- package/dist/4921.jclic-node.js.map +0 -1
- package/dist/5091.jclic-node.js +0 -239
- package/dist/5091.jclic-node.js.map +0 -1
- package/dist/520.jclic-node.js +0 -550
- package/dist/520.jclic-node.js.map +0 -1
- package/dist/5312.jclic-node.js +0 -1126
- package/dist/5312.jclic-node.js.map +0 -1
- package/dist/5338.jclic-node.js +0 -212
- package/dist/5338.jclic-node.js.map +0 -1
- package/dist/5344.jclic-node.js +0 -229
- package/dist/5344.jclic-node.js.map +0 -1
- package/dist/5550.jclic-node.js +0 -238
- package/dist/5550.jclic-node.js.map +0 -1
- package/dist/5626.jclic-node.js +0 -614
- package/dist/5626.jclic-node.js.map +0 -1
- package/dist/5977.jclic-node.js +0 -1081
- package/dist/5977.jclic-node.js.map +0 -1
- package/dist/6148.jclic-node.js +0 -345
- package/dist/6148.jclic-node.js.map +0 -1
- package/dist/6176.jclic-node.js +0 -481
- package/dist/6176.jclic-node.js.map +0 -1
- package/dist/6221.jclic-node.js +0 -1072
- package/dist/6221.jclic-node.js.map +0 -1
- package/dist/6238.jclic-node.js +0 -718
- package/dist/6238.jclic-node.js.map +0 -1
- package/dist/6454.jclic-node.js +0 -1413
- package/dist/6454.jclic-node.js.map +0 -1
- package/dist/6565.jclic-node.js +0 -294
- package/dist/6565.jclic-node.js.map +0 -1
- package/dist/6579.jclic-node.js +0 -719
- package/dist/6579.jclic-node.js.map +0 -1
- package/dist/6715.jclic-node.js +0 -148
- package/dist/6715.jclic-node.js.map +0 -1
- package/dist/6777.jclic-node.js +0 -171
- package/dist/6777.jclic-node.js.map +0 -1
- package/dist/6782.jclic-node.js +0 -1611
- package/dist/6782.jclic-node.js.map +0 -1
- package/dist/6847.jclic-node.js +0 -601
- package/dist/6847.jclic-node.js.map +0 -1
- package/dist/6856.jclic-node.js +0 -252
- package/dist/6856.jclic-node.js.map +0 -1
- package/dist/696.jclic-node.js +0 -1821
- package/dist/696.jclic-node.js.map +0 -1
- package/dist/698.jclic-node.js +0 -583
- package/dist/698.jclic-node.js.map +0 -1
- package/dist/704.jclic-node.js +0 -80
- package/dist/704.jclic-node.js.map +0 -1
- package/dist/7046.jclic-node.js +0 -735
- package/dist/7046.jclic-node.js.map +0 -1
- package/dist/7220.jclic-node.js +0 -156
- package/dist/7220.jclic-node.js.map +0 -1
- package/dist/7257.jclic-node.js +0 -931
- package/dist/7257.jclic-node.js.map +0 -1
- package/dist/743.jclic-node.js +0 -583
- package/dist/743.jclic-node.js.map +0 -1
- package/dist/757.jclic-node.js +0 -1072
- package/dist/757.jclic-node.js.map +0 -1
- package/dist/7781.jclic-node.js +0 -202
- package/dist/7781.jclic-node.js.map +0 -1
- package/dist/7912.jclic-node.js +0 -2103
- package/dist/7912.jclic-node.js.map +0 -1
- package/dist/827.jclic-node.js +0 -708
- package/dist/827.jclic-node.js.map +0 -1
- package/dist/8276.jclic-node.js +0 -409
- package/dist/8276.jclic-node.js.map +0 -1
- package/dist/8322.jclic-node.js +0 -498
- package/dist/8322.jclic-node.js.map +0 -1
- package/dist/8641.jclic-node.js +0 -360
- package/dist/8641.jclic-node.js.map +0 -1
- package/dist/8837.jclic-node.js +0 -651
- package/dist/8837.jclic-node.js.map +0 -1
- package/dist/8895.jclic-node.js +0 -151
- package/dist/8895.jclic-node.js.map +0 -1
- package/dist/9072.jclic-node.js +0 -1285
- package/dist/9072.jclic-node.js.map +0 -1
- package/dist/9078.jclic-node.js +0 -935
- package/dist/9078.jclic-node.js.map +0 -1
- package/dist/9103.jclic-node.js +0 -718
- package/dist/9103.jclic-node.js.map +0 -1
- package/dist/9359.jclic-node.js +0 -145
- package/dist/9359.jclic-node.js.map +0 -1
- package/dist/9409.jclic-node.js +0 -921
- package/dist/9409.jclic-node.js.map +0 -1
- package/dist/9513.jclic-node.js +0 -720
- package/dist/9513.jclic-node.js.map +0 -1
- package/dist/9704.jclic-node.js +0 -81
- package/dist/9704.jclic-node.js.map +0 -1
- package/dist/9950.jclic-node.js +0 -827
- package/dist/9950.jclic-node.js.map +0 -1
package/dist/9072.jclic-node.js
DELETED
|
@@ -1,1285 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 9072;
|
|
3
|
-
exports.ids = [9072,3018,2355];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 9072:
|
|
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 exports AlignType, ActiveBoxContent */
|
|
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 _AWT_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7912);
|
|
16
|
-
/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1253);
|
|
17
|
-
/* harmony import */ var _BoxBase_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3018);
|
|
18
|
-
/* harmony import */ var _media_MediaContent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2355);
|
|
19
|
-
/**
|
|
20
|
-
* File : boxes/ActiveBoxContent.js
|
|
21
|
-
* Created : 13/04/2015
|
|
22
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
23
|
-
*
|
|
24
|
-
* JClic.js
|
|
25
|
-
* An HTML5 player of JClic activities
|
|
26
|
-
* https://projectestac.github.io/jclic.js
|
|
27
|
-
*
|
|
28
|
-
* @source https://github.com/projectestac/jclic.js
|
|
29
|
-
*
|
|
30
|
-
* @license EUPL-1.2
|
|
31
|
-
* @licstart
|
|
32
|
-
* (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
|
|
33
|
-
*
|
|
34
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
35
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
36
|
-
* You may not use this work except in compliance with the Licence.
|
|
37
|
-
*
|
|
38
|
-
* You may obtain a copy of the Licence at:
|
|
39
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
43
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
44
|
-
* Licence for the specific language governing permissions and limitations
|
|
45
|
-
* under the Licence.
|
|
46
|
-
* @licend
|
|
47
|
-
* @module
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* This class is used as a container for horizontal and vertical alignments of content inside a cell.
|
|
58
|
-
*/
|
|
59
|
-
class AlignType {
|
|
60
|
-
/**
|
|
61
|
-
* AlignType constructor
|
|
62
|
-
* @param {string} [h] - Horizontal alignment. Possible values are `left`, `center` and `right`
|
|
63
|
-
* @param {string} [v] - Vertical alignment. Possible values are `top`, `center` and `bottom`
|
|
64
|
-
*/
|
|
65
|
-
constructor(h, v) {
|
|
66
|
-
if (h)
|
|
67
|
-
this.h = h;
|
|
68
|
-
if (v)
|
|
69
|
-
this.v = v;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
74
|
-
* parent references, constants and also attributes retaining the default value.
|
|
75
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
76
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
77
|
-
*/
|
|
78
|
-
getAttributes() {
|
|
79
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAttr */ .iu)(this, ['h|center', 'v|center']);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Reads the properties of this AlignType from a data object
|
|
84
|
-
* @param {object} data - The data object to be parsed
|
|
85
|
-
* @returns {module:boxes/ActiveBoxContent.AlignType}
|
|
86
|
-
*/
|
|
87
|
-
setAttributes(data) {
|
|
88
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .setAttr */ .ob)(this, data, ['h', 'v']);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Object.assign(AlignType.prototype, {
|
|
93
|
-
h: 'center',
|
|
94
|
-
v: 'center',
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* This class defines a content that can be displayed by {@link module:boxes/ActiveBox.ActiveBox ActiveBox} objects. This content
|
|
99
|
-
* can be a text, an image, a fragment of an image or a combination of text and images. The style
|
|
100
|
-
* (colors, font and size, borders, shadows, margins, etc.) are specified in the `style` attribute,
|
|
101
|
-
* always pointing to a {@link module:boxes/BoxBase.BoxBase BoxBase} object.
|
|
102
|
-
*/
|
|
103
|
-
class ActiveBoxContent {
|
|
104
|
-
/**
|
|
105
|
-
* ActiveBoxContent constructor
|
|
106
|
-
* @param {string} [id] - An optional identifier.
|
|
107
|
-
*/
|
|
108
|
-
constructor(id) {
|
|
109
|
-
if (typeof id !== 'undefined')
|
|
110
|
-
this.id = id;
|
|
111
|
-
this.imgAlign = new AlignType();
|
|
112
|
-
this.txtAlign = new AlignType();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
* Loads settings from a specific JQuery XML element
|
|
118
|
-
* @param {external:jQuery} $xml - The XML element to be parsed
|
|
119
|
-
* @param {module:bags/MediaBag.MediaBag} mediaBag - The media bag used to retrieve images and other media
|
|
120
|
-
*/
|
|
121
|
-
setProperties($xml, mediaBag) {
|
|
122
|
-
//
|
|
123
|
-
// Read attributes
|
|
124
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, val) => {
|
|
125
|
-
switch (name) {
|
|
126
|
-
case 'id':
|
|
127
|
-
case 'item':
|
|
128
|
-
this[name] = Number(val);
|
|
129
|
-
break;
|
|
130
|
-
|
|
131
|
-
case 'width':
|
|
132
|
-
case 'height':
|
|
133
|
-
if (this.dimension === null)
|
|
134
|
-
this.dimension = new _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Dimension */ .fg(0, 0);
|
|
135
|
-
this.dimension[name] = Number(val);
|
|
136
|
-
break;
|
|
137
|
-
|
|
138
|
-
case 'txtAlign':
|
|
139
|
-
case 'imgAlign':
|
|
140
|
-
this[name] = this.readAlign(val);
|
|
141
|
-
break;
|
|
142
|
-
|
|
143
|
-
case 'hAlign':
|
|
144
|
-
// Old style
|
|
145
|
-
this['txtAlign'] = this.readAlign(val + ',center');
|
|
146
|
-
this['imgAlign'] = this.readAlign(val + ',center');
|
|
147
|
-
break;
|
|
148
|
-
|
|
149
|
-
case 'border':
|
|
150
|
-
case 'avoidOverlapping':
|
|
151
|
-
this[name] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getBoolean */ .pW)(val);
|
|
152
|
-
break;
|
|
153
|
-
|
|
154
|
-
case 'image':
|
|
155
|
-
this.image = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .nSlash */ .c4)(val);
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
//
|
|
161
|
-
// Read inner elements
|
|
162
|
-
$xml.children().each((_n, child) => {
|
|
163
|
-
const $node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child);
|
|
164
|
-
switch (child.nodeName) {
|
|
165
|
-
case 'style':
|
|
166
|
-
this.style = new _BoxBase_js__WEBPACK_IMPORTED_MODULE_3__["default"](null).setProperties($node);
|
|
167
|
-
break;
|
|
168
|
-
case 'media':
|
|
169
|
-
this.mediaContent = new _media_MediaContent_js__WEBPACK_IMPORTED_MODULE_4__["default"]().setProperties($node);
|
|
170
|
-
break;
|
|
171
|
-
case 'p':
|
|
172
|
-
if (this.text === null)
|
|
173
|
-
this.text = '';
|
|
174
|
-
else
|
|
175
|
-
this.text += '\n';
|
|
176
|
-
this.text += child.textContent;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
if (mediaBag)
|
|
182
|
-
this.realizeContent(mediaBag);
|
|
183
|
-
|
|
184
|
-
return this;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
189
|
-
* parent references, constants and also attributes retaining the default value.
|
|
190
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
191
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
192
|
-
*/
|
|
193
|
-
getAttributes() {
|
|
194
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getAttr */ .iu)(this, [
|
|
195
|
-
'id', 'item', 'dimension', 'border', 'avoidOverlapping', 'image', 'text',
|
|
196
|
-
'objectType', // Used in TextActivityDocument
|
|
197
|
-
'txtAlign', 'imgAlign', // AlignType
|
|
198
|
-
'style', // BoxBase
|
|
199
|
-
'mediaContent', // MediaContent
|
|
200
|
-
]);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Reads the properties of this ActiveBoxContent from a data object
|
|
205
|
-
* @param {object|string} data - The data object to be parsed, or just the text content
|
|
206
|
-
* @param {module:bags/MediaBag.MediaBag} mediaBag - The media bag used to retrieve images and other media
|
|
207
|
-
* @returns {module:boxes/ActiveBoxContent.ActiveBoxContent}
|
|
208
|
-
*/
|
|
209
|
-
setAttributes(data, mediaBag) {
|
|
210
|
-
|
|
211
|
-
if (typeof data === 'string')
|
|
212
|
-
this.text = data;
|
|
213
|
-
else
|
|
214
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .setAttr */ .ob)(this, data, [
|
|
215
|
-
'id', 'item', 'border', 'avoidOverlapping', 'image', 'text',
|
|
216
|
-
'objectType',
|
|
217
|
-
{ key: 'dimension', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_1__/* .Dimension */ .fg },
|
|
218
|
-
{ key: 'txtAlign', fn: AlignType },
|
|
219
|
-
{ key: 'imgAlign', fn: AlignType },
|
|
220
|
-
{ key: 'style', fn: _BoxBase_js__WEBPACK_IMPORTED_MODULE_3__["default"] },
|
|
221
|
-
{ key: 'mediaContent', fn: _media_MediaContent_js__WEBPACK_IMPORTED_MODULE_4__["default"] },
|
|
222
|
-
]);
|
|
223
|
-
|
|
224
|
-
if (mediaBag)
|
|
225
|
-
this.realizeContent(mediaBag);
|
|
226
|
-
|
|
227
|
-
return this;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Decode expressions with combined values of horizontal and vertical alignments in the form:
|
|
232
|
-
* "(left|middle|right),(top|middle|bottom)"
|
|
233
|
-
* @param {string} str - The string to parse
|
|
234
|
-
* @returns {module:boxes/ActiveBoxContent.ActiveBoxContent~alignType}
|
|
235
|
-
*/
|
|
236
|
-
readAlign(str) {
|
|
237
|
-
const align = new AlignType();
|
|
238
|
-
if (str) {
|
|
239
|
-
const v = str.split(',');
|
|
240
|
-
align.h = v[0].replace('middle', 'center');
|
|
241
|
-
align.v = v[1].replace('middle', 'center');
|
|
242
|
-
}
|
|
243
|
-
return align;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Checks if this is an empty content (`text` and `img` are _null_)
|
|
248
|
-
*/
|
|
249
|
-
isEmpty() {
|
|
250
|
-
return this.text === null && this.img === null;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Checks if two contents are equivalent
|
|
255
|
-
* @param {module:boxes/ActiveBoxContent.ActiveBoxContent} abc - The content to compare with this.
|
|
256
|
-
* @param {boolean} checkCase - When `true` the comparing will be case-sensitive.
|
|
257
|
-
* @returns {boolean}
|
|
258
|
-
*/
|
|
259
|
-
isEquivalent(abc, checkCase) {
|
|
260
|
-
if (abc === this)
|
|
261
|
-
return true;
|
|
262
|
-
let result = false;
|
|
263
|
-
if (abc !== null) {
|
|
264
|
-
if (this.isEmpty() && abc.isEmpty())
|
|
265
|
-
result = this.id === abc.id;
|
|
266
|
-
else
|
|
267
|
-
result = (this.text === null ? abc.text === null
|
|
268
|
-
: checkCase ? this.text === abc.text
|
|
269
|
-
: this.text.toLocaleLowerCase() === abc.text.toLocaleLowerCase()
|
|
270
|
-
) &&
|
|
271
|
-
(this.mediaContent === null ? abc.mediaContent === null
|
|
272
|
-
: this.mediaContent.isEquivalent(abc.mediaContent)
|
|
273
|
-
) &&
|
|
274
|
-
this.img === abc.img &&
|
|
275
|
-
(this.imgClip === null ? abc.imgClip === null
|
|
276
|
-
: this.imgClip.equals(abc.imgClip));
|
|
277
|
-
}
|
|
278
|
-
return result;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Sets the text content of this ActiveBox
|
|
283
|
-
* @param {string} tx
|
|
284
|
-
*/
|
|
285
|
-
setTextContent(tx) {
|
|
286
|
-
// only plain text allowed!
|
|
287
|
-
if (tx !== null) {
|
|
288
|
-
this.text = tx;
|
|
289
|
-
this.checkHtmlText();
|
|
290
|
-
} else {
|
|
291
|
-
this.text = null;
|
|
292
|
-
this.innerHtmlText = null;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Checks if cell's text uses HTML, initializing the `innerHtmlText` member as needed.
|
|
298
|
-
*/
|
|
299
|
-
checkHtmlText() {
|
|
300
|
-
this.innerHtmlText = null;
|
|
301
|
-
if ((0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .startsWith */ .w1)(this.text, '<html>', true)) {
|
|
302
|
-
const htmlText = this.text.trim();
|
|
303
|
-
const s = htmlText.toLocaleLowerCase();
|
|
304
|
-
if (s.indexOf('<body') === -1) {
|
|
305
|
-
const s2 = s.indexOf('</html>');
|
|
306
|
-
if (s2 >= 0)
|
|
307
|
-
this.innerHtmlText = htmlText.substring(6, s2);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Sets a fragment of a main image as a graphic content of this cell.
|
|
314
|
-
* Cells cannot have two graphic contents, so `image` (the specific image of this cell) should
|
|
315
|
-
* be cleared with this setting.
|
|
316
|
-
* @param {external:HTMLImageElement} img - The image data
|
|
317
|
-
* @param {module:AWT.Shape} imgClip - A shape that clips the portion of image assigned to this content.
|
|
318
|
-
* @param {string} [animatedGifFile] - When `img` is an animated GIF, its file name
|
|
319
|
-
*/
|
|
320
|
-
setImgContent(img, imgClip, animatedGifFile) {
|
|
321
|
-
this.img = img;
|
|
322
|
-
this.image = null;
|
|
323
|
-
this.imgClip = imgClip;
|
|
324
|
-
if (animatedGifFile)
|
|
325
|
-
this.animatedGifFile = animatedGifFile;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Prepares the media content
|
|
330
|
-
* @param {module:JClicPlayer.JClicPlayer} playStation - Usually a {@link module:JClicPlayer.JClicPlayer JClicPlayer}
|
|
331
|
-
*/
|
|
332
|
-
prepareMedia(playStation) {
|
|
333
|
-
if (!this.amp && this.mediaContent && this.mediaContent.type === 'PLAY_VIDEO') {
|
|
334
|
-
this.amp = playStation.getActiveMediaPlayer(this.mediaContent);
|
|
335
|
-
this.amp.realize();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Reads and initializes the image associated to this content
|
|
341
|
-
* @param {module:bags/MediaBag.MediaBag} mediaBag - The media bag of the current project.
|
|
342
|
-
*/
|
|
343
|
-
realizeContent(mediaBag, ps = null) {
|
|
344
|
-
if (this.image !== null && this.image.length > 0) {
|
|
345
|
-
this.mbe = mediaBag.getElement(this.image, true);
|
|
346
|
-
if (this.mbe) {
|
|
347
|
-
this.mbe.build(() => {
|
|
348
|
-
this.img = this.mbe.data;
|
|
349
|
-
this.animatedGifFile = this.mbe.animated ? this.mbe.getFullPath() : null;
|
|
350
|
-
}, ps, true);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
if (this.mediaContent !== null) {
|
|
354
|
-
if (this.image === null && (this.text === null || this.text.length === 0)) {
|
|
355
|
-
this.img = this.mediaContent.getIcon();
|
|
356
|
-
this.animatedGifFile = null;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
this.checkHtmlText(mediaBag);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Gets a string representing this content, useful for checking if two different contents are
|
|
364
|
-
* equivalent.
|
|
365
|
-
* @returns {string}
|
|
366
|
-
*/
|
|
367
|
-
getDescription() {
|
|
368
|
-
const result = [];
|
|
369
|
-
if (this.text && this.text.length)
|
|
370
|
-
result.push(this.text);
|
|
371
|
-
if (this.image)
|
|
372
|
-
result.push(`${(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getMsg */ .qG)('image')} ${this.image}`);
|
|
373
|
-
if (this.imgClip)
|
|
374
|
-
result.push(this.imgClip.toString());
|
|
375
|
-
if (this.mediaContent)
|
|
376
|
-
result.push(this.mediaContent.getDescription());
|
|
377
|
-
return result.join(' ');
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
*
|
|
382
|
-
* Overwrites the original `Object.toString` method, returning `getDescription` instead
|
|
383
|
-
* @returns {string}
|
|
384
|
-
*/
|
|
385
|
-
toString() {
|
|
386
|
-
const result = [];
|
|
387
|
-
if (this.text && this.text.length)
|
|
388
|
-
result.push(this.text);
|
|
389
|
-
if (this.image)
|
|
390
|
-
result.push(`${(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getMsg */ .qG)('image')} ${this.image}`);
|
|
391
|
-
if (this.imgClip)
|
|
392
|
-
result.push(`${(0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getMsg */ .qG)('image fragment')} ${(this.id >= 0 ? this.id : this.item) + 1}`);
|
|
393
|
-
return result.join(' ') || (0,_Utils_js__WEBPACK_IMPORTED_MODULE_2__/* .getMsg */ .qG)('cell');
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
Object.assign(ActiveBoxContent.prototype, {
|
|
398
|
-
/**
|
|
399
|
-
* The {@link module:boxes/BoxBase.BoxBase BoxBase} attribute of this content. Can be `null`, meaning {@link module:boxes/ActiveBox.ActiveBox ActiveBox} will
|
|
400
|
-
* try to find a suitable style scanning down through its own BoxBase, their parent's and, finally,
|
|
401
|
-
* the default values defined in `BoxBase.prototype`.
|
|
402
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#style
|
|
403
|
-
* @type {module:boxes/BoxBase.BoxBase} */
|
|
404
|
-
style: null,
|
|
405
|
-
/**
|
|
406
|
-
* Optimal dimension of any {@link module:boxes/ActiveBox.ActiveBox ActiveBox} taking this content.
|
|
407
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#dimension
|
|
408
|
-
* @type {module:AWT.Dimension} */
|
|
409
|
-
dimension: null,
|
|
410
|
-
/**
|
|
411
|
-
* The {@link module:boxes/ActiveBox.ActiveBox ActiveBox} can have or not a border despite the settings of {@link module:boxes/BoxBase.BoxBase BoxBase}.
|
|
412
|
-
* The default value `null` means not to take in consideration this setting.
|
|
413
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#border
|
|
414
|
-
* @type {boolean|null} */
|
|
415
|
-
border: null,
|
|
416
|
-
/**
|
|
417
|
-
* The text to display on the {@link module:boxes/ActiveBox.ActiveBox ActiveBox}. It can have up to two paragraphs.
|
|
418
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#text
|
|
419
|
-
* @type {string} */
|
|
420
|
-
text: null,
|
|
421
|
-
/**
|
|
422
|
-
* The name of the image file to display on the {@link module:boxes/ActiveBox.ActiveBox ActiveBox}.
|
|
423
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#image
|
|
424
|
-
* @type {string} */
|
|
425
|
-
image: null,
|
|
426
|
-
/**
|
|
427
|
-
* An optional shape used to clip the image.
|
|
428
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#imgClip
|
|
429
|
-
* @type {module:AWT.Shape} */
|
|
430
|
-
imgClip: null,
|
|
431
|
-
/**
|
|
432
|
-
* The media content associated with this object.
|
|
433
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#mediaContent
|
|
434
|
-
* @type {module:media/MediaContent.MediaContent} */
|
|
435
|
-
mediaContent: null,
|
|
436
|
-
/**
|
|
437
|
-
* @typedef ActiveBoxContent~alignType
|
|
438
|
-
* @type {object}
|
|
439
|
-
* @property {string} h - Valid values are: `left`, `middle`, `right`
|
|
440
|
-
* @property {string} v - Valud values are: `top`, `middle`, `bottom` */
|
|
441
|
-
/**
|
|
442
|
-
* The horizontal and vertical alignment of the image inside the cell.
|
|
443
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#imgAlign
|
|
444
|
-
* @type {module:boxes/ActiveBoxContent.AlignType} */
|
|
445
|
-
imgAlign: null,
|
|
446
|
-
/**
|
|
447
|
-
* The horizontal and vertical alignment of the text inside the cell.
|
|
448
|
-
* Valid values are: `left`, `middle`, `right`, `top` and `bottom`.
|
|
449
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#txtAlign
|
|
450
|
-
* @type {module:boxes/ActiveBoxContent.AlignType} */
|
|
451
|
-
txtAlign: null,
|
|
452
|
-
/**
|
|
453
|
-
* Whether to avoid overlapping of image and text inside the cell when both are present.
|
|
454
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#avoidOverlapping
|
|
455
|
-
* @type {boolean} */
|
|
456
|
-
avoidOverlapping: false,
|
|
457
|
-
/**
|
|
458
|
-
* Numeric identifier used in activities to resolve relationships between cells
|
|
459
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#id
|
|
460
|
-
* @type {number} */
|
|
461
|
-
id: -1,
|
|
462
|
-
/**
|
|
463
|
-
* Numeric identifier used in activities to resolve relationships between cells
|
|
464
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#item
|
|
465
|
-
* @type {number} */
|
|
466
|
-
item: -1,
|
|
467
|
-
//
|
|
468
|
-
// Transient properties build and modified at run-time
|
|
469
|
-
/**
|
|
470
|
-
* The realized image used by this box content.
|
|
471
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#img
|
|
472
|
-
* @type {external:HTMLImageElement} */
|
|
473
|
-
img: null,
|
|
474
|
-
/**
|
|
475
|
-
* When `img` is an animated GIF file, this field should contain its file name
|
|
476
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#animatedGifFile
|
|
477
|
-
* @type {string} */
|
|
478
|
-
animatedGifFile: null,
|
|
479
|
-
/**
|
|
480
|
-
* When not null, this content should be treated as an HTML element
|
|
481
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#innerHtmlText
|
|
482
|
-
* @type {string} */
|
|
483
|
-
innerHtmlText: null,
|
|
484
|
-
/**
|
|
485
|
-
* The {@link module:media/ActiveMediaPlayer.ActiveMediaPlayer ActiveMediaPlayer} associated with this content. Updated at run-time.
|
|
486
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#amp
|
|
487
|
-
* @type {module:media/ActiveMediaPlayer.ActiveMediaPlayer} */
|
|
488
|
-
amp: null,
|
|
489
|
-
/**
|
|
490
|
-
* The {@link module:bads/MediaBagElement.MediaBagElement} associated with this content, if any. Updated at run-time.
|
|
491
|
-
* @name module:boxes/ActiveBoxContent.ActiveBoxContent#mbe
|
|
492
|
-
* @type {module:bags/MediaBagElement.MediaBagElement} */
|
|
493
|
-
mbe: null,
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* An empty ActiveBoxContent
|
|
498
|
-
* @type {module:boxes/ActiveBoxContent.ActiveBoxContent}
|
|
499
|
-
*/
|
|
500
|
-
ActiveBoxContent.EMPTY_CONTENT = new ActiveBoxContent();
|
|
501
|
-
|
|
502
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ActiveBoxContent);
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
/***/ }),
|
|
506
|
-
|
|
507
|
-
/***/ 3018:
|
|
508
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
509
|
-
|
|
510
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
511
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
512
|
-
/* harmony export */ });
|
|
513
|
-
/* unused harmony export BoxBase */
|
|
514
|
-
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7750);
|
|
515
|
-
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
|
516
|
-
/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1253);
|
|
517
|
-
/* harmony import */ var _AWT_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7912);
|
|
518
|
-
/**
|
|
519
|
-
* File : boxes/BoxBase.js
|
|
520
|
-
* Created : 12/04/2015
|
|
521
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
522
|
-
*
|
|
523
|
-
* JClic.js
|
|
524
|
-
* An HTML5 player of JClic activities
|
|
525
|
-
* https://projectestac.github.io/jclic.js
|
|
526
|
-
*
|
|
527
|
-
* @source https://github.com/projectestac/jclic.js
|
|
528
|
-
*
|
|
529
|
-
* @license EUPL-1.2
|
|
530
|
-
* @licstart
|
|
531
|
-
* (c) 2000-2020 Catalan Educational Telematic Network (XTEC)
|
|
532
|
-
*
|
|
533
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
534
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
535
|
-
* You may not use this work except in compliance with the Licence.
|
|
536
|
-
*
|
|
537
|
-
* You may obtain a copy of the Licence at:
|
|
538
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
539
|
-
*
|
|
540
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
541
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
542
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
543
|
-
* Licence for the specific language governing permissions and limitations
|
|
544
|
-
* under the Licence.
|
|
545
|
-
* @licend
|
|
546
|
-
* @module
|
|
547
|
-
*/
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
const defaultValues = _Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .settings */ .W0.BoxBase;
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* This class contains all the main visual attributes needed to draw {@link module:boxes/AbstractBox.AbstractBox AbstractBox} objects:
|
|
557
|
-
* background and foreground colors, gradients, colors for special states (inactive, alternative,
|
|
558
|
-
* disabled...), margins, fonts, border strokes, etc.
|
|
559
|
-
*
|
|
560
|
-
* Objects derived from {@link module:boxes/AbstractBox.AbstractBox AbstractBox} can have inheritance: boxes that act as "containers"
|
|
561
|
-
* of other boxes (like {@link module:boxes/BoxBag.BoxBag BoxBag}). Most of the attributes of `BoxBase` can be `null`,
|
|
562
|
-
* meaning that the value of the ancestor -or the default value if the box has no ancestors- must
|
|
563
|
-
* be used.
|
|
564
|
-
*/
|
|
565
|
-
class BoxBase {
|
|
566
|
-
/**
|
|
567
|
-
* BoxBase constructor
|
|
568
|
-
* @param {module:boxes/BoxBase.BoxBase} [parent] - Another BoxBase object used to determine the value of properties not
|
|
569
|
-
* locally set.
|
|
570
|
-
*/
|
|
571
|
-
constructor(parent) {
|
|
572
|
-
this.parent = parent || null;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Loads the BoxBase settings from a specific JQuery XML element
|
|
577
|
-
* @param {external:jQuery} $xml - The XML element to parse
|
|
578
|
-
*/
|
|
579
|
-
setProperties($xml) {
|
|
580
|
-
//
|
|
581
|
-
// Read attributes
|
|
582
|
-
(0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .attrForEach */ .GM)($xml.get(0).attributes, (name, val) => {
|
|
583
|
-
switch (name) {
|
|
584
|
-
case 'shadow':
|
|
585
|
-
case 'transparent':
|
|
586
|
-
this[name] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getBoolean */ .pW)(val, false);
|
|
587
|
-
break;
|
|
588
|
-
case 'margin':
|
|
589
|
-
this[name] = Number(val);
|
|
590
|
-
break;
|
|
591
|
-
case 'borderStroke':
|
|
592
|
-
this.borderStroke = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(Number(val));
|
|
593
|
-
break;
|
|
594
|
-
case 'markerStroke':
|
|
595
|
-
this.markerStroke = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(Number(val));
|
|
596
|
-
break;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
//
|
|
600
|
-
// Read inner elements
|
|
601
|
-
$xml.children().each((_n, child) => {
|
|
602
|
-
const $node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(child);
|
|
603
|
-
switch (child.nodeName) {
|
|
604
|
-
case 'font':
|
|
605
|
-
this.font = (new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ()).setProperties($node);
|
|
606
|
-
break;
|
|
607
|
-
|
|
608
|
-
case 'gradient':
|
|
609
|
-
this.bgGradient = new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Gradient */ .Hf().setProperties($node);
|
|
610
|
-
break;
|
|
611
|
-
|
|
612
|
-
case 'color':
|
|
613
|
-
this.textColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('foreground'), this.textColor);
|
|
614
|
-
this.backColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('background'), this.backColor);
|
|
615
|
-
this.shadowColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('shadow'), this.shadowColor);
|
|
616
|
-
this.inactiveColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('inactive'), this.inactiveColor);
|
|
617
|
-
this.alternativeColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('alternative'), this.alternativeColor);
|
|
618
|
-
this.borderColor = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .checkColor */ .I4)($node.attr('border'), this.borderColor);
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
return this;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
627
|
-
* parent references, constants and also attributes retaining the default value.
|
|
628
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
629
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
630
|
-
*/
|
|
631
|
-
getAttributes() {
|
|
632
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .getAttr */ .iu)(this, [
|
|
633
|
-
'shadow', 'transparent', 'margin',
|
|
634
|
-
'borderStroke', 'markerStroke', // AWT.Stroke
|
|
635
|
-
'font', // AWT.Font
|
|
636
|
-
'bgGradient', // AWT.Gradient
|
|
637
|
-
`textColor|${BoxBase.prototype.textColor}`,
|
|
638
|
-
`backColor|${BoxBase.prototype.backColor}`,
|
|
639
|
-
`shadowColor|${BoxBase.prototype.shadowColor}`,
|
|
640
|
-
`inactiveColor|${BoxBase.prototype.inactiveColor}`,
|
|
641
|
-
`alternativeColor|${BoxBase.prototype.alternativeColor}`,
|
|
642
|
-
`borderColor|${BoxBase.prototype.borderColor}`,
|
|
643
|
-
]);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Reads the properties of this BoxBase from a data object
|
|
648
|
-
* @param {object} data - The data object to be parsed
|
|
649
|
-
* @returns {module:boxes/BoxBase.BoxBase}
|
|
650
|
-
*/
|
|
651
|
-
setAttributes(data) {
|
|
652
|
-
return (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .setAttr */ .ob)(this, data, [
|
|
653
|
-
'shadow', 'transparent', 'margin',
|
|
654
|
-
{ key: 'borderStroke', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc },
|
|
655
|
-
{ key: 'markerStroke', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc },
|
|
656
|
-
{ key: 'font', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ },
|
|
657
|
-
{ key: 'bgGradient', fn: _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Gradient */ .Hf },
|
|
658
|
-
'textColor',
|
|
659
|
-
'backColor',
|
|
660
|
-
'shadowColor',
|
|
661
|
-
'inactiveColor',
|
|
662
|
-
'alternativeColor',
|
|
663
|
-
'borderColor',
|
|
664
|
-
]);
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* Gets the value of the specified property, scanning down to parents and prototype if not defined.
|
|
669
|
-
* @param {string} property - The property to retrieve
|
|
670
|
-
* @returns {any} - The object or value associated to this property
|
|
671
|
-
*/
|
|
672
|
-
get(property) {
|
|
673
|
-
if (this.hasOwnProperty(property) || this.parent === null)
|
|
674
|
-
return this[property];
|
|
675
|
-
else
|
|
676
|
-
return this.parent.get(property);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Sets the value of a specific property.
|
|
681
|
-
* @param {string} property - The property name.
|
|
682
|
-
* @param {any} value - Depends on the type of property
|
|
683
|
-
*/
|
|
684
|
-
set(property, value) {
|
|
685
|
-
this[property] = value;
|
|
686
|
-
return this;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Gets the value of the specified property, scanning down to parents if not defined, and returning
|
|
691
|
-
* always an own property (not from prototype)
|
|
692
|
-
* @param {string} property - The property to retrieve
|
|
693
|
-
* @returns {any} - The object or value associated to this property
|
|
694
|
-
*/
|
|
695
|
-
getOwn(property) {
|
|
696
|
-
if (this.hasOwnProperty(property))
|
|
697
|
-
return this[property];
|
|
698
|
-
else if (this.parent !== null)
|
|
699
|
-
return this.parent.getOwn(property);
|
|
700
|
-
else {
|
|
701
|
-
if (typeof this[property] === 'object')
|
|
702
|
-
this[property] = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .cloneObject */ .h2)(BoxBase.prototype[property]);
|
|
703
|
-
else
|
|
704
|
-
this[property] = BoxBase.prototype[property];
|
|
705
|
-
}
|
|
706
|
-
return this[property];
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Gets the properties defined in this BoxBase as a collection of CSS attributes
|
|
711
|
-
* @param {object} [css] - An optional set of initial CSS properties
|
|
712
|
-
* @param {boolean} [inactive=false] - When `true`, get CSS attributes for an inactive cell
|
|
713
|
-
* @param {boolean} [inverse=false] - When `true`, get CSS attributes for an inverse cell
|
|
714
|
-
* @param {boolean} [alternative=false] - When `true`, get CSS attributes for an alternative cell
|
|
715
|
-
* @returns {object}
|
|
716
|
-
*/
|
|
717
|
-
getCSS(css, inactive = false, inverse = false, alternative = false) {
|
|
718
|
-
// (css will be created by [AWT.Font.toCss](AWT.html) if null or undefined)
|
|
719
|
-
const font = this.get('font');
|
|
720
|
-
css = font.toCss(css);
|
|
721
|
-
|
|
722
|
-
css['color'] = inverse ? this.get('backColor')
|
|
723
|
-
: alternative ? this.get('alternativeColor')
|
|
724
|
-
: this.get('textColor');
|
|
725
|
-
|
|
726
|
-
const transparent = this.get('transparent');
|
|
727
|
-
css['background-color'] = transparent ? 'transparent'
|
|
728
|
-
: inactive ? this.get('inactiveColor')
|
|
729
|
-
: inverse ? this.get('textColor') : this.get('backColor');
|
|
730
|
-
|
|
731
|
-
const bgGradient = this.get('bgGradient');
|
|
732
|
-
if (bgGradient && !transparent)
|
|
733
|
-
css['background-image'] = bgGradient.getCss();
|
|
734
|
-
|
|
735
|
-
if (this.shadow === 1) {
|
|
736
|
-
const delta = Math.max(1, Math.round(font.size / 10));
|
|
737
|
-
const color = this.get('shadowColor');
|
|
738
|
-
css['text-shadow'] = `${delta}px ${delta}px 3px ${color}`;
|
|
739
|
-
}
|
|
740
|
-
return css;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* This utility method computes the width and height of text lines rendered on an HTML
|
|
745
|
-
* __canvas__ element, reducing the font size of the BoxBase as needed when they exceed the maximum
|
|
746
|
-
* width and/or height.
|
|
747
|
-
* @param {external:CanvasRenderingContext2D} ctx - The canvas rendering context used to draw the text.
|
|
748
|
-
* @param {string} text - The text to drawn.
|
|
749
|
-
* @param {number} maxWidth - Maximum width
|
|
750
|
-
* @param {number} maxHeight - Maximum height
|
|
751
|
-
* @returns {object[]} - An array of objects representing lines of text. Each object has a `text`
|
|
752
|
-
* member with the text displayed in the line, and a `size` member with the line {@link module:AWT.Dimension}
|
|
753
|
-
*/
|
|
754
|
-
prepareText(ctx, text, maxWidth, maxHeight) {
|
|
755
|
-
const
|
|
756
|
-
result = [],
|
|
757
|
-
font = this.get('font'),
|
|
758
|
-
height = font.getHeight();
|
|
759
|
-
let totalHeight = 0;
|
|
760
|
-
|
|
761
|
-
// divide the text in lines
|
|
762
|
-
const lines = text.trim().split('\n');
|
|
763
|
-
ctx.font = font.cssFont();
|
|
764
|
-
for (let l = 0; l < lines.length; l++) {
|
|
765
|
-
let line = lines[l].trim();
|
|
766
|
-
let width = ctx.measureText(line).width;
|
|
767
|
-
if (width > maxWidth) {
|
|
768
|
-
// retain the last string offset that was inside maxWidth
|
|
769
|
-
let
|
|
770
|
-
lastOK = 0,
|
|
771
|
-
lastOKWidth = 0;
|
|
772
|
-
for (let p = 0; p < line.length; p++) {
|
|
773
|
-
// Find next separator
|
|
774
|
-
if ((0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__/* .isSeparator */ .k$)(line[p])) {
|
|
775
|
-
const w = ctx.measureText(line.substring(0, p).trim()).width;
|
|
776
|
-
if (w > maxWidth)
|
|
777
|
-
break;
|
|
778
|
-
lastOK = p;
|
|
779
|
-
lastOKWidth = w;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
if (lastOK > 0) {
|
|
783
|
-
// Add a new line with the tail of the line
|
|
784
|
-
lines.splice(l + 1, 0, line.substring(lastOK + 1).trim());
|
|
785
|
-
// Adjust the current line
|
|
786
|
-
line = lines[l] = line.substring(0, lastOK).trim();
|
|
787
|
-
width = lastOKWidth;
|
|
788
|
-
}
|
|
789
|
-
else {
|
|
790
|
-
// No solution found. Try resizing down the font.
|
|
791
|
-
if (font.size > defaultValues.MIN_FONT_SIZE) {
|
|
792
|
-
this.getOwn('font').zoom(-1);
|
|
793
|
-
return this.prepareText(ctx, text, maxWidth, maxHeight);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
// Add the line and the calculated dimension to `result`
|
|
799
|
-
result.push({
|
|
800
|
-
text: line,
|
|
801
|
-
size: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Dimension */ .fg(width, height)
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
totalHeight += height;
|
|
805
|
-
|
|
806
|
-
if (totalHeight > maxHeight && font.size > defaultValues.MIN_FONT_SIZE) {
|
|
807
|
-
// Max height exceeded. Try resizing down the font
|
|
808
|
-
this.getOwn('font').zoom(-1);
|
|
809
|
-
return this.prepareText(ctx, text, maxWidth, maxHeight);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
return result;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
Object.assign(BoxBase.prototype, {
|
|
817
|
-
/**
|
|
818
|
-
* The parent BoxBase object
|
|
819
|
-
* @name module:boxes/BoxBase.BoxBase#parent
|
|
820
|
-
* @type {module:boxes/BoxBase.BoxBase} */
|
|
821
|
-
parent: null,
|
|
822
|
-
/**
|
|
823
|
-
* Default values
|
|
824
|
-
* @name module:boxes/BoxBase.BoxBase#defaultValues
|
|
825
|
-
* @type {object} */
|
|
826
|
-
default: defaultValues,
|
|
827
|
-
/**
|
|
828
|
-
* Font size can be dynamically reduced to fit the available space if any element using this
|
|
829
|
-
* `BoxBase` requests it. When this happen, this field contains the real font currently used
|
|
830
|
-
* to draw text.
|
|
831
|
-
* @name module:boxes/BoxBase.BoxBase#font
|
|
832
|
-
* @type {module:AWT.Font} */
|
|
833
|
-
font: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Font */ .KQ(),
|
|
834
|
-
/**
|
|
835
|
-
* The current font size of this BoxBase. Can be dynamically adjusted when drawing.
|
|
836
|
-
* @name module:boxes/BoxBase.BoxBase#dynFontSize
|
|
837
|
-
* @type {number} */
|
|
838
|
-
dynFontSize: 0,
|
|
839
|
-
/**
|
|
840
|
-
* Counts the number of times the `dynFontSize` has been reset. This is useful to avoid excessive
|
|
841
|
-
* recursive loops searching the optimal font size.
|
|
842
|
-
* @name module:boxes/BoxBase.BoxBase#resetFontCounter
|
|
843
|
-
* @type {number} */
|
|
844
|
-
resetFontCounter: 0,
|
|
845
|
-
/**
|
|
846
|
-
* The background color
|
|
847
|
-
* @name module:boxes/BoxBase.BoxBase#backColor
|
|
848
|
-
* @type {string} */
|
|
849
|
-
backColor: defaultValues.BACK_COLOR,
|
|
850
|
-
/**
|
|
851
|
-
* The background gradient. Default is `null`.
|
|
852
|
-
* @name module:boxes/BoxBase.BoxBase#bgGradient
|
|
853
|
-
* @type {module:AWT.Gradient} */
|
|
854
|
-
bgGradient: null,
|
|
855
|
-
/**
|
|
856
|
-
* The color used to write text.
|
|
857
|
-
* @name module:boxes/BoxBase.BoxBase#textColor
|
|
858
|
-
* @type {string} */
|
|
859
|
-
textColor: defaultValues.TEXT_COLOR,
|
|
860
|
-
/**
|
|
861
|
-
* The color used to draw a shadow below regular text.
|
|
862
|
-
* @name module:boxes/BoxBase.BoxBase#shadowColor
|
|
863
|
-
* @type {string} */
|
|
864
|
-
shadowColor: defaultValues.SHADOW_COLOR,
|
|
865
|
-
/**
|
|
866
|
-
* The color of the border.
|
|
867
|
-
* @name module:boxes/BoxBase.BoxBase#borderColor
|
|
868
|
-
* @type {string} */
|
|
869
|
-
borderColor: defaultValues.BORDER_COLOR,
|
|
870
|
-
/**
|
|
871
|
-
* The color used to draw text when a cell is in `inactive` state.
|
|
872
|
-
* @name module:boxes/BoxBase.BoxBase#inactiveColor
|
|
873
|
-
* @type {string} */
|
|
874
|
-
inactiveColor: defaultValues.INACTIVE_COLOR,
|
|
875
|
-
/**
|
|
876
|
-
* The color used to draw text when a cell is in `alternative` state.
|
|
877
|
-
* @name module:boxes/BoxBase.BoxBase#alternativeColor
|
|
878
|
-
* @type {string} */
|
|
879
|
-
alternativeColor: defaultValues.ALTERNATIVE_COLOR,
|
|
880
|
-
/**
|
|
881
|
-
* Whether the text should have a shadow or not
|
|
882
|
-
* @name module:boxes/BoxBase.BoxBase#shadow
|
|
883
|
-
* @type {boolean} */
|
|
884
|
-
shadow: false,
|
|
885
|
-
/**
|
|
886
|
-
* Whether the cell's background (and its hosted component, if any) should be transparent
|
|
887
|
-
* @name module:boxes/BoxBase.BoxBase#transparent
|
|
888
|
-
* @type {boolean} */
|
|
889
|
-
transparent: false,
|
|
890
|
-
/**
|
|
891
|
-
* Wheter the cell's background should be painted or not. This property has no effect on
|
|
892
|
-
* hosted components.
|
|
893
|
-
* @name module:boxes/BoxBase.BoxBase#dontFill
|
|
894
|
-
* @type {boolean} */
|
|
895
|
-
dontFill: false,
|
|
896
|
-
/**
|
|
897
|
-
* The margin to respect between text elements and the limits of the cell or other elements.
|
|
898
|
-
* @name module:boxes/BoxBase.BoxBase#textMargin
|
|
899
|
-
* @type {number} */
|
|
900
|
-
textMargin: defaultValues.AC_MARGIN,
|
|
901
|
-
/**
|
|
902
|
-
* The stroke used to draw the border.
|
|
903
|
-
* @name module:boxes/BoxBase.BoxBase#borderStroke
|
|
904
|
-
* @type {module:AWT.Stroke} */
|
|
905
|
-
borderStroke: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(defaultValues.BORDER_STROKE_WIDTH),
|
|
906
|
-
/**
|
|
907
|
-
* The stroke used to draw a border around marked cells.
|
|
908
|
-
* @name module:boxes/BoxBase.BoxBase#markerStroke
|
|
909
|
-
* @type {module:AWT.Stroke} */
|
|
910
|
-
markerStroke: new _AWT_js__WEBPACK_IMPORTED_MODULE_2__/* .Stroke */ .tc(defaultValues.MARKER_STROKE_WIDTH),
|
|
911
|
-
});
|
|
912
|
-
|
|
913
|
-
BoxBase.DEFAULT_BOX_BASE = new BoxBase();
|
|
914
|
-
|
|
915
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BoxBase);
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
/***/ }),
|
|
919
|
-
|
|
920
|
-
/***/ 2355:
|
|
921
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
// EXPORTS
|
|
925
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
926
|
-
"default": () => (/* binding */ media_MediaContent)
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
// UNUSED EXPORTS: MediaContent
|
|
930
|
-
|
|
931
|
-
// EXTERNAL MODULE: external "jquery"
|
|
932
|
-
var external_jquery_ = __webpack_require__(7750);
|
|
933
|
-
var external_jquery_default = /*#__PURE__*/__webpack_require__.n(external_jquery_);
|
|
934
|
-
// EXTERNAL MODULE: ./src/AWT.js
|
|
935
|
-
var AWT = __webpack_require__(7912);
|
|
936
|
-
// EXTERNAL MODULE: ./src/Utils.js
|
|
937
|
-
var Utils = __webpack_require__(1253);
|
|
938
|
-
;// ./src/media/icons/generic.svg
|
|
939
|
-
const generic_namespaceObject = "<svg height=\"48\" viewBox=\"0 0 48 48\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M28.8 12L28 8H10v34h4V28h11.2l.8 4h14V12z\" />\n</svg>\n";
|
|
940
|
-
;// ./src/media/icons/audio.svg
|
|
941
|
-
const audio_namespaceObject = "<svg fill=\"#000000\" height=\"48\" viewBox=\"0 0 24 24\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z\" />\n</svg>\n";
|
|
942
|
-
;// ./src/media/icons/mic.svg
|
|
943
|
-
const mic_namespaceObject = "<svg fill=\"#000000\" height=\"48\" viewBox=\"0 0 24 24\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z\" />\n</svg>\n";
|
|
944
|
-
;// ./src/media/icons/movie.svg
|
|
945
|
-
const movie_namespaceObject = "<svg fill=\"#000000\" height=\"48\" viewBox=\"0 0 24 24\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z\" />\n</svg>\n";
|
|
946
|
-
;// ./src/media/icons/music.svg
|
|
947
|
-
const music_namespaceObject = "<svg fill=\"#000000\" height=\"48\" viewBox=\"0 0 24 24\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z\" />\n</svg>\n";
|
|
948
|
-
;// ./src/media/icons/url.svg
|
|
949
|
-
const url_namespaceObject = "<svg fill=\"#000000\" height=\"48\" viewBox=\"0 0 24 24\" width=\"48\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z\" />\n</svg>\n";
|
|
950
|
-
;// ./src/media/MediaContent.js
|
|
951
|
-
/**
|
|
952
|
-
* File : media/MediaContent.js
|
|
953
|
-
* Created : 13/04/2015
|
|
954
|
-
* By : Francesc Busquets <francesc@gmail.com>
|
|
955
|
-
*
|
|
956
|
-
* JClic.js
|
|
957
|
-
* An HTML5 player of JClic activities
|
|
958
|
-
* https://projectestac.github.io/jclic.js
|
|
959
|
-
*
|
|
960
|
-
* @source https://github.com/projectestac/jclic.js
|
|
961
|
-
*
|
|
962
|
-
* @license EUPL-1.2
|
|
963
|
-
* @licstart
|
|
964
|
-
* (c) 2000-2020 Educational Telematic Network of Catalonia (XTEC)
|
|
965
|
-
*
|
|
966
|
-
* Licensed under the EUPL, Version 1.1 or -as soon they will be approved by
|
|
967
|
-
* the European Commission- subsequent versions of the EUPL (the "Licence");
|
|
968
|
-
* You may not use this work except in compliance with the Licence.
|
|
969
|
-
*
|
|
970
|
-
* You may obtain a copy of the Licence at:
|
|
971
|
-
* https://joinup.ec.europa.eu/software/page/eupl
|
|
972
|
-
*
|
|
973
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
974
|
-
* distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
|
|
975
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
976
|
-
* Licence for the specific language governing permissions and limitations
|
|
977
|
-
* under the Licence.
|
|
978
|
-
* @licend
|
|
979
|
-
* @module
|
|
980
|
-
*/
|
|
981
|
-
|
|
982
|
-
/* global Image */
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
/**
|
|
996
|
-
* This object contains a description of any multimedia content (sound, video, MIDI, voice
|
|
997
|
-
* recording..) or special actions (jump to another point in the sequence, link to an URL, etc.)
|
|
998
|
-
* associated to an {@link module:boxes/ActiveBox.ActiveBox ActiveBox} object.
|
|
999
|
-
*/
|
|
1000
|
-
class MediaContent {
|
|
1001
|
-
/**
|
|
1002
|
-
* MediaContent constructor
|
|
1003
|
-
* @param {string} type - The type of media. Valid values are: `UNKNOWN`, `PLAY_AUDIO`, `PLAY_VIDEO`,
|
|
1004
|
-
* `PLAY_MIDI`, `PLAY_CDAUDIO`, `RECORD_AUDIO`, `PLAY_RECORDED_AUDIO`, `RUN_CLIC_ACTIVITY`,
|
|
1005
|
-
* `RUN_CLIC_PACKAGE`, `RUN_EXTERNAL`, `URL`, `EXIT` and `RETURN`
|
|
1006
|
-
* @param {string} [file] - Optional parameter indicating the media file name
|
|
1007
|
-
*/
|
|
1008
|
-
constructor(type, file) {
|
|
1009
|
-
this.type = type;
|
|
1010
|
-
if (file)
|
|
1011
|
-
this.file = file;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* Loads the MediaContent settings from a specific JQuery XML element
|
|
1016
|
-
* @param {external:jQuery} $xml
|
|
1017
|
-
*/
|
|
1018
|
-
setProperties($xml) {
|
|
1019
|
-
(0,Utils/* attrForEach */.GM)($xml.get(0).attributes, (name, val) => {
|
|
1020
|
-
switch (name) {
|
|
1021
|
-
case 'type':
|
|
1022
|
-
this.type = val;
|
|
1023
|
-
break;
|
|
1024
|
-
case 'file':
|
|
1025
|
-
this.file = (0,Utils/* nSlash */.c4)(val);
|
|
1026
|
-
break;
|
|
1027
|
-
case 'params':
|
|
1028
|
-
this.externalParam = (0,Utils/* nSlash */.c4)(val);
|
|
1029
|
-
break;
|
|
1030
|
-
|
|
1031
|
-
case 'pFrom':
|
|
1032
|
-
this.absLocationFrom = val;
|
|
1033
|
-
break;
|
|
1034
|
-
|
|
1035
|
-
case 'buffer':
|
|
1036
|
-
this.recBuffer = Number(val);
|
|
1037
|
-
break;
|
|
1038
|
-
case 'level':
|
|
1039
|
-
case 'from':
|
|
1040
|
-
case 'to':
|
|
1041
|
-
case 'length':
|
|
1042
|
-
this[name] = Number(val);
|
|
1043
|
-
break;
|
|
1044
|
-
|
|
1045
|
-
case 'px':
|
|
1046
|
-
case 'py':
|
|
1047
|
-
if (this.absLocation === null)
|
|
1048
|
-
this.absLocation = new AWT/* Point */.bR(0, 0);
|
|
1049
|
-
if (name === 'px')
|
|
1050
|
-
this.absLocation.x = Number(val);
|
|
1051
|
-
else
|
|
1052
|
-
this.absLocation.y = Number(val);
|
|
1053
|
-
break;
|
|
1054
|
-
|
|
1055
|
-
case 'stretch':
|
|
1056
|
-
case 'free':
|
|
1057
|
-
case 'catchMouseEvents':
|
|
1058
|
-
case 'loop':
|
|
1059
|
-
case 'autostart':
|
|
1060
|
-
this[name] = (0,Utils/* getBoolean */.pW)(val);
|
|
1061
|
-
break;
|
|
1062
|
-
}
|
|
1063
|
-
});
|
|
1064
|
-
return this;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* Gets a object with the basic attributes needed to rebuild this instance excluding functions,
|
|
1069
|
-
* parent references, constants and also attributes retaining the default value.
|
|
1070
|
-
* The resulting object is commonly usued to serialize elements in JSON format.
|
|
1071
|
-
* @returns {object} - The resulting object, with minimal attrributes
|
|
1072
|
-
*/
|
|
1073
|
-
getAttributes() {
|
|
1074
|
-
return (0,Utils/* getAttr */.iu)(this, [
|
|
1075
|
-
'type', 'file', 'externalParam',
|
|
1076
|
-
'absLocation', // -> AWT.Point
|
|
1077
|
-
'absLocationFrom', 'recBuffer',
|
|
1078
|
-
'level|1', 'from', 'to', 'length',
|
|
1079
|
-
'stretch', 'free', 'catchMouseEvents', 'loop', 'autostart'
|
|
1080
|
-
]);
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
* Reads the properties of this MediaContent from a data object
|
|
1085
|
-
* @param {object} data - The data object to be parsed
|
|
1086
|
-
* @returns {module:media/MediaContent.MediaContent}
|
|
1087
|
-
*/
|
|
1088
|
-
setAttributes(data) {
|
|
1089
|
-
return (0,Utils/* setAttr */.ob)(this, data, [
|
|
1090
|
-
'type', 'file', 'externalParam',
|
|
1091
|
-
{ key: 'absLocation', fn: AWT/* Point */.bR },
|
|
1092
|
-
'absLocationFrom', 'recBuffer',
|
|
1093
|
-
'level', 'from', 'to', 'length',
|
|
1094
|
-
'stretch', 'free', 'catchMouseEvents', 'loop', 'autostart',
|
|
1095
|
-
]);
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* Compares this object with another MediaContent.
|
|
1100
|
-
* @param {module:media/MediaContent.MediaContent} mc - The Media Content to compare against to.
|
|
1101
|
-
* @returns {boolean} - `true` when both objects are equivalent.
|
|
1102
|
-
*/
|
|
1103
|
-
isEquivalent(mc) {
|
|
1104
|
-
return this.type === mc.type &&
|
|
1105
|
-
(this.file === mc.file ||
|
|
1106
|
-
this.file !== null && mc.file !== null &&
|
|
1107
|
-
this.file.toLocaleLowerCase() === mc.file.toLocaleLowerCase()) &&
|
|
1108
|
-
this.from === mc.from &&
|
|
1109
|
-
this.to === mc.to &&
|
|
1110
|
-
this.recBuffer === mc.recBuffer;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
/**
|
|
1114
|
-
* Gets a string representing this media content, useful for checking if two different elements
|
|
1115
|
-
* are equivalent.
|
|
1116
|
-
* @returns {string}
|
|
1117
|
-
*/
|
|
1118
|
-
getDescription() {
|
|
1119
|
-
let result = `${this.type}`;
|
|
1120
|
-
if (this.file)
|
|
1121
|
-
result = `${result} ${this.file}${this.from >= 0 ? ` from:${this.from}` : ''}${this.to >= 0 ? ` to:${this.to}` : ''}`;
|
|
1122
|
-
else if (this.externalParam)
|
|
1123
|
-
result = `${result} ${this.externalParam}`;
|
|
1124
|
-
return result;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
* Returns a simplified description of this media content. Useful for accessibility methods.
|
|
1129
|
-
* @returns {string}
|
|
1130
|
-
*/
|
|
1131
|
-
toString() {
|
|
1132
|
-
return `${this.type}${this.file ? ` ${this.file}` : ''}`;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
/**
|
|
1136
|
-
* Returns an image to be used as icon for representing this media content.
|
|
1137
|
-
* @returns {external:HTMLImageElement}
|
|
1138
|
-
*/
|
|
1139
|
-
getIcon() {
|
|
1140
|
-
let icon = null;
|
|
1141
|
-
switch (this.type) {
|
|
1142
|
-
case 'PLAY_AUDIO':
|
|
1143
|
-
case 'PLAY_RECORDED_AUDIO':
|
|
1144
|
-
icon = 'audio';
|
|
1145
|
-
break;
|
|
1146
|
-
case 'RECORD_AUDIO':
|
|
1147
|
-
icon = 'mic';
|
|
1148
|
-
break;
|
|
1149
|
-
case 'PLAY_VIDEO':
|
|
1150
|
-
icon = 'movie';
|
|
1151
|
-
break;
|
|
1152
|
-
case 'PLAY_MIDI':
|
|
1153
|
-
icon = 'music';
|
|
1154
|
-
break;
|
|
1155
|
-
case 'URL':
|
|
1156
|
-
icon = 'url';
|
|
1157
|
-
break;
|
|
1158
|
-
default:
|
|
1159
|
-
icon = 'generic';
|
|
1160
|
-
break;
|
|
1161
|
-
}
|
|
1162
|
-
return icon ? MediaContent.ICONS[icon] : null;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
Object.assign(MediaContent.prototype, {
|
|
1167
|
-
/**
|
|
1168
|
-
* The type of media. Valid values are: `UNKNOWN`, `PLAY_AUDIO`, `PLAY_VIDEO`,
|
|
1169
|
-
* `PLAY_MIDI`, `PLAY_CDAUDIO`, `RECORD_AUDIO`, `PLAY_RECORDED_AUDIO`, `RUN_CLIC_ACTIVITY`,
|
|
1170
|
-
* `RUN_CLIC_PACKAGE`, `RUN_EXTERNAL`, `URL`, `EXIT` and `RETURN`
|
|
1171
|
-
* @name module:media/MediaContent.MediaContent#type
|
|
1172
|
-
* @type {string} */
|
|
1173
|
-
type: 'UNKNOWN',
|
|
1174
|
-
/**
|
|
1175
|
-
* The priority level is important when different medias want to play together. Objects with
|
|
1176
|
-
* highest priority level can mute lower ones.
|
|
1177
|
-
* @name module:media/MediaContent.MediaContent#level
|
|
1178
|
-
* @type {number} */
|
|
1179
|
-
level: 1,
|
|
1180
|
-
/**
|
|
1181
|
-
* Media file name
|
|
1182
|
-
* @name module:media/MediaContent.MediaContent#file
|
|
1183
|
-
* @type {string} */
|
|
1184
|
-
file: null,
|
|
1185
|
-
/**
|
|
1186
|
-
* Optional parameters passed to external calls
|
|
1187
|
-
* @name module:media/MediaContent.MediaContent#externalParams
|
|
1188
|
-
* @type {string} */
|
|
1189
|
-
externalParam: null,
|
|
1190
|
-
/**
|
|
1191
|
-
* Special setting used to play only a fragment of media. `-1` means not used (plays full
|
|
1192
|
-
* length, from the beginning)
|
|
1193
|
-
* @name module:media/MediaContent.MediaContent#from
|
|
1194
|
-
* @type {number} */
|
|
1195
|
-
from: -1,
|
|
1196
|
-
/**
|
|
1197
|
-
* Special setting used to play only a fragment of media. `-1` means not used (plays to the end
|
|
1198
|
-
* of the media)
|
|
1199
|
-
* @name module:media/MediaContent.MediaContent#to
|
|
1200
|
-
* @type {number} */
|
|
1201
|
-
to: -1,
|
|
1202
|
-
/**
|
|
1203
|
-
* When `type` is `RECORD_AUDIO`, this member stores the maximum length of the recorded
|
|
1204
|
-
* sound, in seconds.
|
|
1205
|
-
* @name module:media/MediaContent.MediaContent#length
|
|
1206
|
-
* @type {number} */
|
|
1207
|
-
length: 3,
|
|
1208
|
-
/**
|
|
1209
|
-
* When `type` is `RECORD_AUDIO`, this member stores the buffer ID where the recording
|
|
1210
|
-
* will be stored.
|
|
1211
|
-
* @name module:media/MediaContent.MediaContent#recBuffer
|
|
1212
|
-
* @type {number} */
|
|
1213
|
-
recBuffer: 0,
|
|
1214
|
-
/**
|
|
1215
|
-
* Whether to stretch or not the video size to fit the cell space.
|
|
1216
|
-
* @name module:media/MediaContent.MediaContent#stretch
|
|
1217
|
-
* @type {boolean} */
|
|
1218
|
-
stretch: false,
|
|
1219
|
-
/**
|
|
1220
|
-
* When `true`, the video plays out of the cell, centered on the activity window.
|
|
1221
|
-
* @name module:media/MediaContent.MediaContent#free
|
|
1222
|
-
* @type {boolean} */
|
|
1223
|
-
free: false,
|
|
1224
|
-
/**
|
|
1225
|
-
* Places the video window at a specific location.
|
|
1226
|
-
* @name module:media/MediaContent.MediaContent#absLocation
|
|
1227
|
-
* @type {module:AWT.Point} */
|
|
1228
|
-
absLocation: null,
|
|
1229
|
-
/**
|
|
1230
|
-
* When {@link module:media/MediaContent.MediaContent#absLocation} is not `null`, this field indicates from where to
|
|
1231
|
-
* measure its coordinates. Valid values are: `BOX`, `WINDOW` or `FRAME`.
|
|
1232
|
-
* @name module:media/MediaContent.MediaContent#absLocationFrom
|
|
1233
|
-
* @type {string} */
|
|
1234
|
-
absLocationFrom: null,
|
|
1235
|
-
/**
|
|
1236
|
-
* `true` when the video window must catch mouse clicks.
|
|
1237
|
-
* @name module:media/MediaContent.MediaContent#catchMouseEvents
|
|
1238
|
-
* @type {boolean} */
|
|
1239
|
-
catchMouseEvents: false,
|
|
1240
|
-
/**
|
|
1241
|
-
* Whether to repeat the media in loop, or just one time.
|
|
1242
|
-
* @name module:media/MediaContent.MediaContent#loop
|
|
1243
|
-
* @type {boolean} */
|
|
1244
|
-
loop: false,
|
|
1245
|
-
/**
|
|
1246
|
-
* When `true`, the media will automatically start playing when the associated {@link module:boxes/ActiveBox.ActiveBox ActiveBox}
|
|
1247
|
-
* become active.
|
|
1248
|
-
* @name module:media/MediaContent.MediaContent#autoStart
|
|
1249
|
-
* @type {boolean} */
|
|
1250
|
-
autoStart: false,
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* Default icons for media types.
|
|
1255
|
-
* @type {object} */
|
|
1256
|
-
const ICONS = {
|
|
1257
|
-
generic: generic_namespaceObject,
|
|
1258
|
-
audio: audio_namespaceObject,
|
|
1259
|
-
movie: movie_namespaceObject,
|
|
1260
|
-
mic: mic_namespaceObject,
|
|
1261
|
-
music: music_namespaceObject,
|
|
1262
|
-
url: url_namespaceObject,
|
|
1263
|
-
};
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
* Collection of icon {@link external:HTMLImageElement} objects
|
|
1267
|
-
* @name module:media/MediaContent.MediaContent.ICONS
|
|
1268
|
-
* @type {object} */
|
|
1269
|
-
MediaContent.ICONS = {};
|
|
1270
|
-
|
|
1271
|
-
// Load the icons
|
|
1272
|
-
external_jquery_default().each(ICONS, (key, value) => {
|
|
1273
|
-
const img = new Image();
|
|
1274
|
-
img.src = (0,Utils/* svgToURI */.g8)(value);
|
|
1275
|
-
MediaContent.ICONS[key] = img;
|
|
1276
|
-
});
|
|
1277
|
-
|
|
1278
|
-
/* harmony default export */ const media_MediaContent = (MediaContent);
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
/***/ })
|
|
1282
|
-
|
|
1283
|
-
};
|
|
1284
|
-
;
|
|
1285
|
-
//# sourceMappingURL=9072.jclic-node.js.map
|