From 8c388af04abf93d028cd5cc75c219fb38f2d683e Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Sun, 14 Feb 2021 13:41:54 +0100 Subject: [PATCH 1/2] Remove Twitter user feed from content type options --- library.json | 6 +++--- semantics.json | 1 - upgrades.js | 36 +++++++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/library.json b/library.json index a9debf9..a2f4c48 100644 --- a/library.json +++ b/library.json @@ -6,8 +6,8 @@ "license": "MIT", "author": "Joubel", "majorVersion": 1, - "minorVersion": 13, - "patchVersion": 1, + "minorVersion": 14, + "patchVersion": 0, "runnable": 1, "fullscreen": 0, "embedTypes": [ @@ -27,4 +27,4 @@ "path": "styles/h5p-column.css" } ] -} \ No newline at end of file +} diff --git a/semantics.json b/semantics.json index 2b5a104..94c1208 100644 --- a/semantics.json +++ b/semantics.json @@ -48,7 +48,6 @@ "H5P.Summary 1.10", "H5P.Timeline 1.1", "H5P.TrueFalse 1.6", - "H5P.TwitterUserFeed 1.0", "H5P.Video 1.5" ] }, diff --git a/upgrades.js b/upgrades.js index 177aef6..7fdc182 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 + */ + 14: 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); + } } }; })(); From c9add7911bf13e513309514c420d382103c3d61b Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Thu, 2 Jun 2022 08:53:21 +0200 Subject: [PATCH 2/2] Update to match minor version number --- upgrades.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrades.js b/upgrades.js index 7fdc182..df13abc 100644 --- a/upgrades.js +++ b/upgrades.js @@ -51,7 +51,7 @@ H5PUpgrades['H5P.Column'] = (function () { * @param {Object} parameters * @param {function} finished */ - 14: function (parameters, finished, extras) { + 16: function (parameters, finished, extras) { if (parameters && parameters.content) {