From b4949c0d836c8bcda54afab7a97ca9fe91cf8419 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 28 Oct 2016 10:46:05 +0200 Subject: [PATCH 1/4] Don't store results if they have no score. HFP-173 (cherry picked from commit 516c70a) --- js/h5p.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 60cfdd4..65ec2e1 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1637,7 +1637,7 @@ H5P.shuffleArray = function (array) { * Reported time consumption/usage */ H5P.setFinished = function (contentId, score, maxScore, time) { - if (H5PIntegration.postUserStatistics === true) { + if (score && H5PIntegration.postUserStatistics === true) { /** * Return unix timestamp for the given JS Date. * From 426f51caa0ca7f4408cbaae4479620b904818fb4 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 28 Oct 2016 13:45:11 +0200 Subject: [PATCH 2/4] Check that score is a number before storing it to the database. HFP-173 (cherry picked from commit bae3145) --- js/h5p.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 65ec2e1..e6b4555 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1637,7 +1637,7 @@ H5P.shuffleArray = function (array) { * Reported time consumption/usage */ H5P.setFinished = function (contentId, score, maxScore, time) { - if (score && H5PIntegration.postUserStatistics === true) { + if (typeof score === 'number' && H5PIntegration.postUserStatistics === true) { /** * Return unix timestamp for the given JS Date. * From 7e90871cb733419ecc8f8af606297ad8df88a257 Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Fri, 11 Nov 2016 11:51:20 +0100 Subject: [PATCH 3/4] Fixing typo --- js/h5p.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index e6b4555..69829c2 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -85,14 +85,14 @@ H5P.init = function (target) { } // Determine if we can use full screen - if (H5P.canHasFullScreen === undefined) { + if (H5P.fullscreenEnabled === undefined) { /** * Use this variable to check if fullscreen is supported. Fullscreen can be * restricted when embedding since not all browsers support the native * fullscreen, and the semi-fullscreen solution doesn't work when embedded. * @type {boolean} */ - H5P.canHasFullScreen = (H5P.isFramed && H5P.externalEmbed !== false) ? ((document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled) ? true : false) : true; + H5P.fullscreenEnabled = (H5P.isFramed && H5P.externalEmbed !== false) ? ((document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled) ? true : false) : true; // We should consider document.msFullscreenEnabled when they get their // element sizing corrected. Ref. https://connect.microsoft.com/IE/feedback/details/838286/ie-11-incorrectly-reports-dom-element-sizes-in-fullscreen-mode-when-fullscreened-element-is-within-an-iframe } @@ -141,7 +141,7 @@ H5P.init = function (target) { var instance = H5P.newRunnable(library, contentId, $container, true, {standalone: true}); // Check if we should add and display a fullscreen button for this H5P. - if (contentData.fullScreen == 1 && H5P.canHasFullScreen) { + if (contentData.fullScreen == 1 && H5P.fullscreenEnabled) { H5P.jQuery('
').prependTo($container).children().click(function () { H5P.fullScreen($container, instance); }); From 6001b68b99a019a2dc59469b9becf2542d0c4d4e Mon Sep 17 00:00:00 2001 From: Paal Joergensen Date: Fri, 11 Nov 2016 11:57:54 +0100 Subject: [PATCH 4/4] Making naming harder to misunderstand --- js/h5p.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 69829c2..c6767b5 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -85,14 +85,14 @@ H5P.init = function (target) { } // Determine if we can use full screen - if (H5P.fullscreenEnabled === undefined) { + if (H5P.fullscreenSupported === undefined) { /** * Use this variable to check if fullscreen is supported. Fullscreen can be * restricted when embedding since not all browsers support the native * fullscreen, and the semi-fullscreen solution doesn't work when embedded. * @type {boolean} */ - H5P.fullscreenEnabled = (H5P.isFramed && H5P.externalEmbed !== false) ? ((document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled) ? true : false) : true; + H5P.fullscreenSupported = (H5P.isFramed && H5P.externalEmbed !== false) ? ((document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled) ? true : false) : true; // We should consider document.msFullscreenEnabled when they get their // element sizing corrected. Ref. https://connect.microsoft.com/IE/feedback/details/838286/ie-11-incorrectly-reports-dom-element-sizes-in-fullscreen-mode-when-fullscreened-element-is-within-an-iframe } @@ -141,7 +141,7 @@ H5P.init = function (target) { var instance = H5P.newRunnable(library, contentId, $container, true, {standalone: true}); // Check if we should add and display a fullscreen button for this H5P. - if (contentData.fullScreen == 1 && H5P.fullscreenEnabled) { + if (contentData.fullScreen == 1 && H5P.fullscreenSupported) { H5P.jQuery('
').prependTo($container).children().click(function () { H5P.fullScreen($container, instance); });