2015-04-08 15:04:29 +02:00
|
|
|
var H5PUpgrades = H5PUpgrades || {};
|
|
|
|
|
|
|
|
H5PUpgrades['H5P.QuestionSet'] = (function ($) {
|
|
|
|
return {
|
|
|
|
1: {
|
2015-04-14 13:56:32 +02:00
|
|
|
3: function (parameters, finished) {
|
2015-04-08 15:04:29 +02:00
|
|
|
for (var i = 0; i < parameters.questions.length; i++) {
|
|
|
|
if (parameters.questions[i].subContentId === undefined) {
|
|
|
|
// NOTE: We avoid using H5P.createUUID since this is an upgrade script and H5P function may change in the
|
|
|
|
// future
|
|
|
|
parameters.questions[i].subContentId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(char) {
|
|
|
|
var random = Math.random()*16|0, newChar = char === 'x' ? random : (random&0x3|0x8);
|
|
|
|
return newChar.toString(16);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2016-03-17 14:09:13 +01:00
|
|
|
finished(null, parameters);
|
|
|
|
},
|
|
|
|
8: function (parameters, finished) {
|
|
|
|
parameters.texts = parameters.texts || {};
|
|
|
|
|
|
|
|
if (parameters.questionLabel) {
|
|
|
|
parameters.texts.questionLabel = parameters.questionLabel;
|
|
|
|
delete parameters.questionLabel;
|
|
|
|
}
|
|
|
|
|
2015-04-08 15:04:29 +02:00
|
|
|
finished(null, parameters);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
})(H5P.jQuery);
|