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" in the document and initializes H5P instances where found. */ 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 && 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'; } } // 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('