HPN-36: Fixed semi-fullscreen exit with key.
parent
0884bf369a
commit
bb496b4d29
20
js/h5p.js
20
js/h5p.js
|
@ -104,8 +104,8 @@ H5P.init = function () {
|
||||||
* @param {function} exitCallback Callback function called when user exits fullscreen.
|
* @param {function} exitCallback Callback function called when user exits fullscreen.
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
H5P.fullScreenIframe = function (contentId, obj, exitCallback) {
|
H5P.fullScreenIframe = function (contentId, obj, exitCallback, $body) {
|
||||||
H5P.fullScreen(H5P.jQuery('#iframe-wrapper-' + contentId), obj, exitCallback);
|
H5P.fullScreen(H5P.jQuery('#h5p-iframe-' + contentId + '-wrapper'), obj, exitCallback, $body);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +116,7 @@ H5P.fullScreenIframe = function (contentId, obj, exitCallback) {
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
H5P.resizeIframe = function (contentId, height) {
|
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;
|
// Don't allow iFrame to grow beyond window height;
|
||||||
if (height > window.innerHeight) {
|
if (height > window.innerHeight) {
|
||||||
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.
|
* @param {function} exitCallback Callback function called when user exits fullscreen.
|
||||||
* @returns {undefined}
|
* @returns {undefined}
|
||||||
*/
|
*/
|
||||||
H5P.fullScreen = function ($el, obj, exitCallback) {
|
H5P.fullScreen = function ($el, obj, exitCallback, $body) {
|
||||||
|
if ($body === undefined) {
|
||||||
|
$body = H5P.$body;
|
||||||
|
}
|
||||||
|
|
||||||
if (H5P.isFramed) {
|
if (H5P.isFramed) {
|
||||||
var $classes = H5P.jQuery('html').add(H5P.$body).add($el);
|
var $classes = H5P.jQuery('html').add(H5P.$body).add($el);
|
||||||
$classes.addClass('h5p-fullscreen');
|
$classes.addClass('h5p-fullscreen');
|
||||||
window.parent.H5P.fullScreenIframe($el.data('content-id'), obj, function () {
|
window.parent.H5P.fullScreenIframe($el.data('content-id'), obj, function () {
|
||||||
$classes.removeClass('h5p-fullscreen');
|
$classes.removeClass('h5p-fullscreen');
|
||||||
});
|
}, $body);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +164,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) {
|
||||||
// H5P.jQuery('#h5pfullscreenreplacementplaceholder').before($el).remove();
|
// H5P.jQuery('#h5pfullscreenreplacementplaceholder').before($el).remove();
|
||||||
$disable.remove();
|
$disable.remove();
|
||||||
H5P.isFullscreen = false;
|
H5P.isFullscreen = false;
|
||||||
H5P.$body.unbind('keyup', keyup);
|
$body.unbind('keyup', keyup);
|
||||||
|
|
||||||
H5P.jQuery(".h5p-iframe").each(function (idx, el) {
|
H5P.jQuery(".h5p-iframe").each(function (idx, el) {
|
||||||
H5P.resizeIframe(H5P.jQuery(el).data('content-id'), 0);
|
H5P.resizeIframe(H5P.jQuery(el).data('content-id'), 0);
|
||||||
|
@ -182,7 +186,7 @@ H5P.fullScreen = function ($el, obj, exitCallback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$disable.click(disableSemiFullscreen);
|
$disable.click(disableSemiFullscreen);
|
||||||
H5P.$body.keyup(keyup);
|
$body.keyup(keyup);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var first, eventName = H5P.fullScreenBrowserPrefix + 'fullscreenchange';
|
var first, eventName = H5P.fullScreenBrowserPrefix + 'fullscreenchange';
|
||||||
|
@ -467,4 +471,4 @@ if (H5P.jQuery) {
|
||||||
H5P.init();
|
H5P.init();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue