Restore deprecated variable H5P.canHasFullScreen for backwards compatability

HFP-339
improved-embed-and-download^2
Timothy Lim 2016-12-12 11:28:23 +01:00
parent d76ce3f3a5
commit a4d6f3aaab
2 changed files with 17 additions and 1 deletions

View File

@ -1676,7 +1676,7 @@ class H5PCore {
public static $coreApi = array( public static $coreApi = array(
'majorVersion' => 1, 'majorVersion' => 1,
'minorVersion' => 11 'minorVersion' => 12
); );
public static $styles = array( public static $styles = array(
'styles/h5p.css', 'styles/h5p.css',

View File

@ -97,6 +97,15 @@ H5P.init = function (target) {
// 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 // 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
} }
// Deprecated variable, kept to maintain backwards compatability
if (H5P.canHasFullScreen === undefined) {
/**
* @deprecated since version 1.11
* @type {boolean}
*/
H5P.canHasFullScreen = (H5P.isFramed && H5P.externalEmbed !== false) ? ((document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled) ? true : false) : true;
}
// H5Ps added in normal DIV. // H5Ps added in normal DIV.
var $containers = H5P.jQuery('.h5p-content:not(.h5p-initialized)', target).each(function () { var $containers = H5P.jQuery('.h5p-content:not(.h5p-initialized)', target).each(function () {
var $element = H5P.jQuery(this).addClass('h5p-initialized'); var $element = H5P.jQuery(this).addClass('h5p-initialized');
@ -147,6 +156,13 @@ H5P.init = function (target) {
}); });
} }
// Check if we should add and display a fullscreen button for this H5P using
// the deprecated variable for backwards compatability.
if (contentData.fullScreen == 1 && H5P.canHasFullScreen) {
H5P.jQuery('<div class="h5p-content-controls"><div role="button" tabindex="0" class="h5p-enable-fullscreen" title="' + H5P.t('fullscreen') + '"></div></div>').prependTo($container).children().click(function () {
H5P.fullScreen($container, instance);
});
}
// Create action bar // Create action bar
var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>'); var $actions = H5P.jQuery('<ul class="h5p-actions"></ul>');