diff --git a/library.json b/library.json index 587ddaf..8a6566e 100644 --- a/library.json +++ b/library.json @@ -6,8 +6,8 @@ "license": "MIT", "author": "Joubel", "majorVersion": 1, - "minorVersion": 15, - "patchVersion": 2, + "minorVersion": 16, + "patchVersion": 0, "runnable": 1, "fullscreen": 0, "embedTypes": [ diff --git a/upgrades.js b/upgrades.js index 177aef6..df13abc 100644 --- a/upgrades.js +++ b/upgrades.js @@ -40,8 +40,42 @@ H5PUpgrades['H5P.Column'] = (function () { // Done finished(null, parameters); - } + }, + + /** + * Asynchronous content upgrade hook. + * Upgrades content parameters to support Column 1.14. + * + * - Converts H5P.TwitterUserFeed to H5P.AdvancedText + * + * @param {Object} parameters + * @param {function} finished + */ + 16: function (parameters, finished, extras) { + + if (parameters && parameters.content) { + + debugger + + // Go through content + for (var i = 0; i < parameters.content.length; i++) { + if (parameters.content[i] && parameters.content[i].content) { + + const content = parameters.content[i].content; + if (content.library && content.library.split(' ')[0] === 'H5P.TwitterUserFeed') { + + content.library = 'H5P.AdvancedText 1.1'; + + content.params = content.params || {}; + content.params.text = '
Twitter changed their API and user feeds can no longer be displayed here.
'; + } + } + } + } + // Done + finished(null, parameters, extras); + } } }; })();