-
Notifications
You must be signed in to change notification settings - Fork 70
/
upgrades.js
60 lines (52 loc) · 1.8 KB
/
upgrades.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.DragText'] = (function ($) {
return {
1: {
1: {
contentUpgrade: function (parameters, finished) {
// Moved all behavioural settings into "behaviour" group.
parameters.behaviour = {
enableRetry: parameters.enableTryAgain === undefined ? true : parameters.enableTryAgain,
enableSolutionsButton: parameters.enableShowSolution === undefined ? true : parameters.enableShowSolution,
instantFeedback: parameters.instantFeedback === undefined ? false : parameters.instantFeedback
};
delete parameters.enableTryAgain;
delete parameters.enableShowSolution;
delete parameters.instantFeedback;
finished(null, parameters);
}
},
/**
* Asynchronous content upgrade hook.
* Upgrades content parameters to support DragText 1.6
*
* Move old feedback message to the new overall feedback system.
*
* @param {object} parameters
* @param {function} finished
*/
6: function (parameters, finished) {
if (parameters && parameters.score) {
parameters.overallFeedback = [
{
'from': 0,
'to': 100,
'feedback': parameters.score
}
];
delete parameters.score;
}
finished(null, parameters);
},
8: function (parameters, finished, extras) {
var title = (parameters) ? parameters.taskDescription : 'Drag the Words';
extras = extras || {};
extras.metadata = extras.metadata || {};
if (title) {
extras.metadata.title = title.replace(/<[^>]*>?/g, '');
}
finished(null, parameters, extras);
}
}
};
})(H5P.jQuery);