-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathupgrades.js
28 lines (22 loc) · 1023 Bytes
/
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
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.ImageHotspotQuestion'] = (function () {
return {
1: {
8: function (parameters, finished, extras) {
var extrasOut = extras || {};
// Copy title to new metadata structure if present
if (parameters.imageHotspotQuestion && parameters.imageHotspotQuestion.backgroundImageSettings) {
var title = parameters.imageHotspotQuestion.backgroundImageSettings.questionTitle || ((extras && extras.metadata) ? extras.metadata.title : undefined);
extrasOut.metadata = {
title: title
};
// Remove old parameter
delete parameters.imageHotspotQuestion.backgroundImageSettings.questionTitle;
// Move image data out of array -- H5P semantics peculiarity
parameters.imageHotspotQuestion.backgroundImageSettings = parameters.imageHotspotQuestion.backgroundImageSettings.backgroundImage;
}
finished(null, parameters, extrasOut);
}
}
};
})();