var H5P = H5P || {}; // Determine if we're inside an iframe. H5P.isFramed = (window.self !== window.top); // Useful jQuery object. H5P.$window = H5P.jQuery(window); // Detect if we support fullscreen, and what prefix to use. if (document.documentElement.requestFullScreen) { H5P.fullScreenBrowserPrefix = ''; } else if (document.documentElement.webkitRequestFullScreen && navigator.userAgent.indexOf('Android') === -1 // Skip Android && navigator.userAgent.indexOf('Version/') === -1 // Skip Safari ) { H5P.fullScreenBrowserPrefix = 'webkit'; } else if (document.documentElement.mozRequestFullScreen) { H5P.fullScreenBrowserPrefix = 'moz'; } else if (document.documentElement.msRequestFullscreen) { H5P.fullScreenBrowserPrefix = 'ms'; } /** * Initialize H5P content. * Scans for ".h5p-content" in the document and initializes H5P instances where found. */ H5P.init = function () { // Useful jQuery object. H5P.$body = H5P.jQuery('body'); // Prepare internal resizer for content. var $window = H5P.jQuery(window.top); // H5Ps added in normal DIV. var $containers = H5P.jQuery(".h5p-content").each(function () { var $element = H5P.jQuery(this); var $container = H5P.jQuery('
').appendTo($element); var contentId = $element.data('content-id'); var contentData = H5PIntegration.getContentData(contentId); var library = { library: contentData.library, params: H5P.jQuery.parseJSON(contentData.jsonContent) }; // Create new instance. var instance = H5P.newRunnable(library, contentId); instance.attach($container); // Not sent to newRunnable to avoid resize. // Check if we should add and display a fullscreen button for this H5P. if (contentData.fullScreen == 1) { H5P.jQuery('