var H5P = H5P || {}; // This needs to be determined before init is run. H5P.isFramed = (window.self !== window.top); // (window.parent !== window); // Initialize H5P content // Scans for ".h5p-content" H5P.init = function () { if (H5P.$window === undefined) { H5P.$window = H5P.jQuery(window); } if (H5P.$body === undefined) { H5P.$body = H5P.jQuery('body'); } // Is this H5P being run in a frame? if (H5P.isFramed) { H5P.$body.addClass('h5p-iframe-content'); } if (H5P.fullScreenBrowserPrefix === undefined) { if (document.documentElement.requestFullScreen) { H5P.fullScreenBrowserPrefix = ''; } else if (document.documentElement.webkitRequestFullScreen && navigator.userAgent.indexOf('Android') === -1 // Skip Android ) { // Safari has stopped working as of v6.0.3. (Specifying keyboard input // makes webkitRequestFullScreen silently fail.) The following code // assumes that the Safari developers figure out how to properly handle // their own extension before reaching version 6.0.10. Until then, we // treat Safari as an old IE. (Please note: Just looking for Safari in // the UA string will also match Chrome.) if (navigator.userAgent.match(/Version\/6\.0\.[3-9].*Safari/)) { H5P.fullScreenBrowserPrefix = undefined; } else { H5P.fullScreenBrowserPrefix = 'webkit'; } } else if (document.documentElement.mozRequestFullScreen) { H5P.fullScreenBrowserPrefix = 'moz'; } else if (document.documentElement.msRequestFullScreen) { H5P.fullScreenBrowserPrefix = 'ms'; } } // H5Ps added in normal DIV. H5P.jQuery(".h5p-content").each(function (idx, el) { var $el = H5P.jQuery(el), contentId = $el.data('content-id'), mainLibrary = $el.data('class'), obj = new (H5P.classFromName(mainLibrary))(H5P.jQuery.parseJSON(H5PIntegration.getJsonContent(contentId)), contentId); // Render H5P in container. obj.attach($el); // Add Fullscreen button if relevant. if (H5PIntegration.getFullscreen(contentId)) { H5P.jQuery('