forked from otacke/h5p-crossword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrades.js
70 lines (64 loc) · 2.08 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
61
62
63
64
65
66
67
68
69
70
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.Crossword'] = (function () {
return {
0: {
/**
* Asynchronous content upgrade hook.
*
* Add new background parameter, was black by default.
* Add new scoreWords parameter, was false by default.
*
* @param {Object} parameters
* @param {function} finished
*/
2: function (parameters, finished, extras) {
parameters.behaviour.backgroundColor = '#000000';
parameters.behaviour.scoreWords = false;
finished(null, parameters, extras);
},
/**
* Asynchronous content upgrade hook.
*
* Add new applyPenalties parameter, was true by default.
*
* @param {Object} parameters
* @param {function} finished
*/
3: function (parameters, finished, extras) {
parameters.behaviour.applyPenalties = true;
finished(null, parameters, extras);
},
/**
* Asynchronous content upgrade hook.
*
* Move options to new theme group.
*
* @param {Object} parameters
* @param {function} finished
*/
4: function (parameters, finished, extras) {
if (parameters && parameters.behaviour) {
parameters.theme = {
backgroundColor: '#173354',
gridColor: '#000000',
cellBackgroundColor: '#ffffff',
cellColor: '#000000',
clueIdColor: '#606060',
cellBackgroundColorHighlight: '#3e8de8',
cellColorHighlight: '#ffffff',
clueIdColorHighlight: '#e0e0e0'
};
if (parameters.behaviour.backgroundImage) {
parameters.theme.backgroundImage = parameters.behaviour.backgroundImage;
}
delete parameters.behaviour.backgroundImage;
if (parameters.behaviour.backgroundColor) {
parameters.theme.backgroundColor = parameters.behaviour.backgroundColor;
}
delete parameters.behaviour.backgroundColor;
}
finished(null, parameters, extras);
}
}
};
})();