Commit f3698317 authored by icc's avatar icc

Fixed iframe id's missing h5p prefix.

Fixed semi-fullscreen exit with key.
parent ce72800e
......@@ -331,8 +331,8 @@ function h5p_view($node, $teaser = FALSE, $page = FALSE) {
}
else {
h5p_add_files_and_settings($node, 'iframe');
$html = '<div class="h5p-iframe-wrapper" id="iframe-wrapper-##h5pId##">';
$html .= '<iframe id="iframe-##h5pId##" class="h5p-iframe" data-class="##mainLibrary##" data-content-id="##h5pId##" style="width: 100%; height: 400px; border: none;" src="about:blank" frameBorder="0"></iframe>';
$html = '<div class="h5p-iframe-wrapper" id="h5p-iframe-##h5pId##-wrapper">';
$html .= '<iframe id="h5p-iframe-##h5pId##" class="h5p-iframe" data-class="##mainLibrary##" data-content-id="##h5pId##" style="width: 100%; height: 400px; border: none;" src="about:blank" frameBorder="0"></iframe>';
$html .= '</div>';
$html = str_replace(array('##h5pId##', '##mainLibrary##'), array($content_id, $main_library), $html);
}
......
......@@ -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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment