From 57b1c88435a467ff0e869b703179920f1746ee44 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 2 Dec 2013 14:19:15 +0100 Subject: [PATCH 1/3] Fixed FontAwesome to avoid collisions and preserve backwards compatibility. --- fonts/fontawesome-webfont.eot | Bin fonts/fontawesome-webfont.svg | 0 fonts/fontawesome-webfont.ttf | Bin fonts/fontawesome-webfont.woff | Bin styles/h5p.css | 14 ++++++-------- 5 files changed, 6 insertions(+), 8 deletions(-) mode change 100644 => 100755 fonts/fontawesome-webfont.eot mode change 100644 => 100755 fonts/fontawesome-webfont.svg mode change 100644 => 100755 fonts/fontawesome-webfont.ttf mode change 100644 => 100755 fonts/fontawesome-webfont.woff diff --git a/fonts/fontawesome-webfont.eot b/fonts/fontawesome-webfont.eot old mode 100644 new mode 100755 diff --git a/fonts/fontawesome-webfont.svg b/fonts/fontawesome-webfont.svg old mode 100644 new mode 100755 diff --git a/fonts/fontawesome-webfont.ttf b/fonts/fontawesome-webfont.ttf old mode 100644 new mode 100755 diff --git a/fonts/fontawesome-webfont.woff b/fonts/fontawesome-webfont.woff old mode 100644 new mode 100755 diff --git a/styles/h5p.css b/styles/h5p.css index 1cbea68..b9874d6 100644 --- a/styles/h5p.css +++ b/styles/h5p.css @@ -1,10 +1,8 @@ +/* Font Awesome font licensed under SIL OFL 1.1 ยท Code licensed under MIT License */ @font-face { - font-family: 'FontAwesome'; - src:url('../fonts/fontawesome-webfont.eot'); - src:url('../fonts/FontAwesome.otf?#iefix') format('embedded-opentype'), - url('../fonts/fontawesome-webfont.woff') format('woff'), - url('../fonts/fontawesome-webfont.ttf') format('truetype'), - url('../fonts/fontawesome-webfont.svg') format('svg'); + font-family: 'H5PFontAwesome4'; /* Named so to avoid collisions and preserve backwards compatibility! */ + src: url('../fonts/fontawesome-webfont.eot?v=4.0.3'); + src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; } @@ -42,7 +40,7 @@ div.h5p-semi-fullscreen { } .h5p-enable-fullscreen:before, .h5p-disable-fullscreen:before { - font-family: FontAwesome; + font-family: H5PFontAwesome4; margin-right: 10px; content: "\f0b2"; font-size: 1.2em; @@ -168,4 +166,4 @@ body.h5p-iframe-content div.h5p-content { } body.h5p-iframe-content.h5p-fullscreen div.h5p-content { height: 100%; -} \ No newline at end of file +} From 0884bf369a0ca027f9c418461d9f42c004c439e7 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 3 Dec 2013 11:36:31 +0100 Subject: [PATCH 2/3] Added more attrs for videos. --- fonts/fontawesome-webfont.eot | Bin fonts/fontawesome-webfont.svg | 0 fonts/fontawesome-webfont.ttf | Bin fonts/fontawesome-webfont.woff | Bin h5p.classes.php | 27 +++++++++++++++++++++++++-- 5 files changed, 25 insertions(+), 2 deletions(-) mode change 100755 => 100644 fonts/fontawesome-webfont.eot mode change 100755 => 100644 fonts/fontawesome-webfont.svg mode change 100755 => 100644 fonts/fontawesome-webfont.ttf mode change 100755 => 100644 fonts/fontawesome-webfont.woff diff --git a/fonts/fontawesome-webfont.eot b/fonts/fontawesome-webfont.eot old mode 100755 new mode 100644 diff --git a/fonts/fontawesome-webfont.svg b/fonts/fontawesome-webfont.svg old mode 100755 new mode 100644 diff --git a/fonts/fontawesome-webfont.ttf b/fonts/fontawesome-webfont.ttf old mode 100755 new mode 100644 diff --git a/fonts/fontawesome-webfont.woff b/fonts/fontawesome-webfont.woff old mode 100755 new mode 100644 diff --git a/h5p.classes.php b/h5p.classes.php index 3c27445..8ceb611 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1641,9 +1641,32 @@ class H5PContentValidator { // code. $validkeys = array_merge(array('path', 'mime'), $typevalidkeys); if (isset($semantics->extraAttributes)) { - $validkeys = array_merge($validkeys, $semantics->extraAttributes); + $validkeys = array_merge($validkeys, $semantics->extraAttributes); // TODO: Validate extraAttributes } $this->filterParams($file, $validkeys); + + if (isset($file->width)) { + $file->width = intval($file->width); + } + + if (isset($file->height)) { + $file->height = intval($file->height); + } + + if (isset($file->codecs)) { + $file->codecs = htmlspecialchars($file->codecs, ENT_QUOTES, 'UTF-8', FALSE); + } + + if (isset($file->quality)) { + if (!is_object($file->quality) || !isset($file->quality->level) || !isset($file->quality->label)) { + unset($file->quality); + } + else { + $this->filterParams($file->quality, array('level', 'label')); + $file->quality->level = intval($file->quality->level); + $file->quality->label = htmlspecialchars($file->quality->label, ENT_QUOTES, 'UTF-8', FALSE); + } + } } /** @@ -1665,7 +1688,7 @@ class H5PContentValidator { */ public function validateVideo(&$video, $semantics) { foreach ($video as &$variant) { - $this->_validateFilelike($variant, $semantics, array('width', 'height')); + $this->_validateFilelike($variant, $semantics, array('width', 'height', 'codecs', 'quality')); } } From bb496b4d297e27c596b396c92a0f372b4dedf27c Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Wed, 4 Dec 2013 15:21:34 +0100 Subject: [PATCH 3/3] HPN-36: Fixed semi-fullscreen exit with key. --- js/h5p.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 9f08836..e6244b9 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -104,8 +104,8 @@ H5P.init = function () { * @param {function} exitCallback Callback function called when user exits fullscreen. * @returns {undefined} */ -H5P.fullScreenIframe = function (contentId, obj, exitCallback) { - H5P.fullScreen(H5P.jQuery('#iframe-wrapper-' + contentId), obj, exitCallback); +H5P.fullScreenIframe = function (contentId, obj, exitCallback, $body) { + H5P.fullScreen(H5P.jQuery('#h5p-iframe-' + contentId + '-wrapper'), obj, exitCallback, $body); }; /** @@ -116,7 +116,7 @@ H5P.fullScreenIframe = function (contentId, obj, exitCallback) { * @returns {undefined} */ H5P.resizeIframe = function (contentId, height) { - var iframe = document.getElementById('iframe-' + contentId); + var iframe = document.getElementById('h5p-iframe-' + contentId); // Don't allow iFrame to grow beyond window height; if (height > window.innerHeight) { height = window.innerHeight; @@ -132,13 +132,17 @@ H5P.resizeIframe = function (contentId, height) { * @param {function} exitCallback Callback function called when user exits fullscreen. * @returns {undefined} */ -H5P.fullScreen = function ($el, obj, exitCallback) { +H5P.fullScreen = function ($el, obj, exitCallback, $body) { + if ($body === undefined) { + $body = H5P.$body; + } + if (H5P.isFramed) { var $classes = H5P.jQuery('html').add(H5P.$body).add($el); $classes.addClass('h5p-fullscreen'); window.parent.H5P.fullScreenIframe($el.data('content-id'), obj, function () { $classes.removeClass('h5p-fullscreen'); - }); + }, $body); return; } @@ -160,7 +164,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) { // H5P.jQuery('#h5pfullscreenreplacementplaceholder').before($el).remove(); $disable.remove(); H5P.isFullscreen = false; - H5P.$body.unbind('keyup', keyup); + $body.unbind('keyup', keyup); H5P.jQuery(".h5p-iframe").each(function (idx, el) { H5P.resizeIframe(H5P.jQuery(el).data('content-id'), 0); @@ -182,7 +186,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) { } }; $disable.click(disableSemiFullscreen); - H5P.$body.keyup(keyup); + $body.keyup(keyup); } else { var first, eventName = H5P.fullScreenBrowserPrefix + 'fullscreenchange'; @@ -467,4 +471,4 @@ if (H5P.jQuery) { H5P.init(); } }); -} \ No newline at end of file +}