From f939e00f4464a7dbadaae94e694c8cd7cd413361 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Mon, 21 Oct 2013 13:22:13 +0200 Subject: [PATCH] Fix styling issues for sites that has uncleard floating blocks --- h5p.classes.php | 12 ++++++------ js/h5p.js | 16 +++++++++++++++- styles/h5p.css | 7 ++----- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index 29ce875..0068902 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -90,10 +90,10 @@ interface H5PFrameworkInterface { * FALSE otherwise */ public function isPatchedLibrary($library); - + /** * Is H5P in development mode? - * + * * @return boolean * TRUE if H5P development mode is active * FALSE otherwise @@ -784,12 +784,12 @@ class H5PValidator { */ private function getJsonData($filePath, $return_as_string = FALSE) { $json = file_get_contents($filePath); - if (!$json) { - return FALSE; + if ($json === FALSE) { + return FALSE; // Cannot read from file. } $jsonData = json_decode($json, TRUE); - if (!$jsonData) { - return FALSE; + if ($jsonData === NULL) { + return FALSE; // JSON cannot be decoded or the recursion limit has been reached. } return $return_as_string ? $json : $jsonData; } diff --git a/js/h5p.js b/js/h5p.js index 0bb48c7..e03adb2 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -44,7 +44,7 @@ H5P.init = function () { obj.attach($el); if (H5PIntegration.getFullscreen(contentId)) { - H5P.jQuery('
' + H5PIntegration.fullscreenText + '
').insertBefore($el).children().click(function () { + H5P.jQuery('').insertBefore($el).children().click(function () { H5P.fullScreen($el, obj); return false; }); @@ -303,6 +303,20 @@ H5P.shuffleArray = function(array) { return array; }; +/** + * Post finished results for user. + * + * @param {Number} contentId + * @param {Number} points + * @param {Number} maxPoints + */ +H5P.setFinished = function (contentId, points, maxPoints) { + return; // Not yet implemented for Drupal! + if (H5P.postUserStatistics === true) { + H5P.jQuery.post(H5P.ajaxPath + 'setFinished', {contentId: contentId, points: points, maxPoints: maxPoints}); + } +}; + // Add indexOf to browsers that lack them. (IEs) if(!Array.prototype.indexOf) { Array.prototype.indexOf = function(needle) { diff --git a/styles/h5p.css b/styles/h5p.css index 5238262..4b2b265 100644 --- a/styles/h5p.css +++ b/styles/h5p.css @@ -16,9 +16,7 @@ div.h5p-semi-fullscreen { .h5p-content-controls { margin-bottom: 10px; -} -.h5p-content-controls > div:last-child { - clear: both; + text-align: right; } .h5p-content-controls > a:link, .h5p-content-controls > a:visited, a.h5p-disable-fullscreen:link, a.h5p-disable-fullscreen:visited { @@ -26,8 +24,7 @@ div.h5p-semi-fullscreen { } .h5p-enable-fullscreen, .h5p-disable-fullscreen { - float: right; - display: block; + display: inline-block; padding: 6px 12px; background: #539ad7; background-image: -webkit-linear-gradient(top, #4584ba, #539ad7);