var H5P = H5P || {}; /** * Constructor. * * @param {Object} params Options for this library. * @param {Number} id Content identifier * @returns {undefined} */ (function ($) { H5P.Image = function (params, id, extras) { H5P.EventDispatcher.call(this); this.extras = extras; if (params.file === undefined || !(params.file instanceof Object)) { this.placeholder = true; } else { this.source = H5P.getPath(params.file.path, id); this.width = params.file.width; this.height = params.file.height; } this.alt = (!params.decorative && params.alt !== undefined) ? this.stripHTML(this.htmlDecode(params.alt)) : ''; if (params.title !== undefined) { this.title = this.stripHTML(this.htmlDecode(params.title)); } }; H5P.Image.prototype = Object.create(H5P.EventDispatcher.prototype); H5P.Image.prototype.constructor = H5P.Image; /** * Wipe out the content of the wrapper and put our HTML in it. * * @param {jQuery} $wrapper * @returns {undefined} */ H5P.Image.prototype.attach = function ($wrapper) { var self = this; var source = this.source; if (self.$img === undefined) { if(self.placeholder) { self.$img = $('
', { width: '100%', height: '100%', class: 'h5p-placeholder', title: this.title === undefined ? '' : this.title, on: { load: function () { self.trigger('loaded'); } } }); } else { self.$img = $('', { width: '100%', height: '100%', src: source, alt: this.alt, title: this.title === undefined ? '' : this.title, on: { load: function () { self.trigger('loaded'); } } }); } } $wrapper.addClass('h5p-image').html(self.$img); }; /** * Retrieve decoded HTML encoded string. * * @param {string} input HTML encoded string. * @returns {string} Decoded string. */ H5P.Image.prototype.htmlDecode = function (input) { const dparser = new DOMParser().parseFromString(input, 'text/html'); return dparser.documentElement.textContent; }; /** * Retrieve string without HTML tags. * * @param {string} input Input string. * @returns {string} Output string. */ H5P.Image.prototype.stripHTML = function (html) { const div = document.createElement('div'); div.innerHTML = html; return div.textContent || div.innerText || ''; }; return H5P.Image; }(H5P.jQuery)); ; var H5P = H5P || {}; /** * H5P Link Library Module. */ H5P.Link = (function ($) { /** * Link constructor. * * @param {Object} parameters */ function Link(parameters) { // Add default parameters parameters = $.extend(true, { title: 'New link', linkWidget: { protocol: '', url: '' } }, parameters); var url = ''; if (parameters.linkWidget.protocol !== 'other') { url += parameters.linkWidget.protocol; } url += parameters.linkWidget.url; /** * Public. Attach. * * @param {jQuery} $container */ this.attach = function ($container) { var sanitizedUrl = sanitizeUrlProtocol(url); $container.addClass('h5p-link').html('' + parameters.title + '') .keypress(function (event) { if (event.which === 32) { this.click(); } }); }; /** * Return url * * @returns {string} */ this.getUrl = function () { return url; }; /** * Private. Remove illegal url protocols from uri */ var sanitizeUrlProtocol = function(uri) { var allowedProtocols = ['http', 'https', 'ftp', 'irc', 'mailto', 'news', 'nntp', 'rtsp', 'sftp', 'ssh', 'tel', 'telnet', 'webcal']; var first = true; var before = ''; while (first || uri != before) { first = false; before = uri; var colonPos = uri.indexOf(':'); if (colonPos > 0) { // We found a possible protocol var protocol = uri.substr(0, colonPos); // If the colon is preceeded by a hash, slash or question mark it isn't a protocol if (protocol.match(/[/?#]/g)) { break; } // Is this a forbidden protocol? if (allowedProtocols.indexOf(protocol.toLowerCase()) == -1) { // If illegal, remove the protocol... uri = uri.substr(colonPos + 1); } } } return uri; }; } return Link; })(H5P.jQuery); ; H5P.AdvancedText = (function ($, EventDispatcher) { /** * A simple library for displaying text with advanced styling. * * @class H5P.AdvancedText * @param {Object} parameters * @param {Object} [parameters.text='New text'] * @param {number} id */ function AdvancedText(parameters, id) { var self = this; EventDispatcher.call(this); var html = (parameters.text === undefined ? 'New text' : parameters.text); /** * Wipe container and add text html. * * @alias H5P.AdvancedText#attach * @param {H5P.jQuery} $container */ self.attach = function ($container) { $container.addClass('h5p-advanced-text').html(html); }; } AdvancedText.prototype = Object.create(EventDispatcher.prototype); AdvancedText.prototype.constructor = AdvancedText; return AdvancedText; })(H5P.jQuery, H5P.EventDispatcher); ; /* * flowplayer.js 3.2.12. The Flowplayer API * * Copyright 2009-2011 Flowplayer Oy * * This file is part of Flowplayer. * * Flowplayer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Flowplayer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Flowplayer. If not, see . * * Date: ${date} * Revision: ${revision} */ !function(){function h(p){console.log("$f.fireEvent",[].slice.call(p))}function l(r){if(!r||typeof r!="object"){return r}var p=new r.constructor();for(var q in r){if(r.hasOwnProperty(q)){p[q]=l(r[q])}}return p}function n(u,r){if(!u){return}var p,q=0,s=u.length;if(s===undefined){for(p in u){if(r.call(u[p],p,u[p])===false){break}}}else{for(var t=u[0];q1){var u=arguments[1],r=(arguments.length==3)?arguments[2]:{};if(typeof u=="string"){u={src:u}}u=j({bgcolor:"#000000",version:[10,1],expressInstall:"http://releases.flowplayer.org/swf/expressinstall.swf",cachebusting:false},u);if(typeof p=="string"){if(p.indexOf(".")!=-1){var t=[];n(o(p),function(){t.push(new b(this,l(u),l(r)))});return new d(t)}else{var s=c(p);return new b(s!==null?s:l(p),l(u),l(r))}}else{if(p){return new b(p,l(u),l(r))}}}return null};j(window.$f,{fireEvent:function(){var q=[].slice.call(arguments);var r=$f(q[0]);return r?r._fireEvent(q.slice(1)):null},addPlugin:function(p,q){b.prototype[p]=q;return $f},each:n,extend:j});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(r,q){if(!arguments.length||typeof arguments[0]=="number"){var p=[];this.each(function(){var s=$f(this);if(s){p.push(s)}});return arguments.length?p[arguments[0]]:new d(p)}return this.each(function(){$f(this,l(r),q?l(q):{})})}}}();!function(){var h=document.all,j="http://get.adobe.com/flashplayer",c=typeof jQuery=="function",e=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,b={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function i(m,l){if(l){for(var f in l){if(l.hasOwnProperty(f)){m[f]=l[f]}}}return m}function a(f,n){var m=[];for(var l in f){if(f.hasOwnProperty(l)){m[l]=n(f[l])}}return m}window.flashembed=function(f,m,l){if(typeof f=="string"){f=document.getElementById(f.replace("#",""))}if(!f){return}if(typeof m=="string"){m={src:m}}return new d(f,i(i({},b),m),l)};var g=i(window.flashembed,{conf:b,getVersion:function(){var m,f;try{f=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(o){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");f=m&&m.GetVariable("$version")}catch(n){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");f=m&&m.GetVariable("$version")}catch(l){}}}f=e.exec(f);return f?[1*f[1],1*f[(f[1]*1>9?2:3)]*1]:[0,0]},asString:function(l){if(l===null||l===undefined){return null}var f=typeof l;if(f=="object"&&l.push){f="array"}switch(f){case"string":l=l.replace(new RegExp('(["\\\\])',"g"),"\\$1");l=l.replace(/^\s?(\d+\.?\d*)%/,"$1pct");return'"'+l+'"';case"array":return"["+a(l,function(o){return g.asString(o)}).join(",")+"]";case"function":return'"function()"';case"object":var m=[];for(var n in l){if(l.hasOwnProperty(n)){m.push('"'+n+'":'+g.asString(l[n]))}}return"{"+m.join(",")+"}"}return String(l).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(o,l){o=i({},o);var n=''}o.width=o.height=o.id=o.w3c=o.src=null;o.onFail=o.version=o.expressInstall=null;for(var m in o){if(o[m]){n+=''}}var p="";if(l){for(var f in l){if(l[f]){var q=l[f];p+=f+"="+(/function|object/.test(typeof q)?g.asString(q):q)+"&"}}p=p.slice(0,-1);n+='"}n+="";return n},isSupported:function(f){return k[0]>f[0]||k[0]==f[0]&&k[1]>=f[1]}});var k=g.getVersion();function d(f,n,m){if(g.isSupported(n.version)){f.innerHTML=g.getHTML(n,m)}else{if(n.expressInstall&&g.isSupported([6,65])){f.innerHTML=g.getHTML(i(n,{src:n.expressInstall}),{MMredirectURL:encodeURIComponent(location.href),MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!f.innerHTML.replace(/\s/g,"")){f.innerHTML="

Flash version "+n.version+" or greater is required

"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"

"+(f.tagName=="A"?"

Click here to download latest version

":"

Download latest version from here

");if(f.tagName=="A"||f.tagName=="DIV"){f.onclick=function(){location.href=j}}}if(n.onFail){var l=n.onFail.call(this);if(typeof l=="string"){f.innerHTML=l}}}}if(h){window[n.id]=document.getElementById(n.id)}i(this,{getRoot:function(){return f},getOptions:function(){return n},getConf:function(){return m},getApi:function(){return f.firstChild}})}if(c){jQuery.tools=jQuery.tools||{version:"3.2.12"};jQuery.tools.flashembed={conf:b};jQuery.fn.flashembed=function(l,f){return this.each(function(){$(this).data("flashembed",flashembed(this,l,f))})}}}();; var H5P = H5P || {}; /** * H5P audio module * * @external {jQuery} $ H5P.jQuery */ H5P.Audio = (function ($) { /** * @param {Object} params Options for this library. * @param {Number} id Content identifier. * @param {Object} extras Extras. * @returns {undefined} */ function C(params, id, extras) { H5P.EventDispatcher.call(this); this.contentId = id; this.params = params; this.extras = extras; this.toggleButtonEnabled = true; // Retrieve previous state if (extras && extras.previousState !== undefined) { this.oldTime = extras.previousState.currentTime; } this.params = $.extend({}, { playerMode: 'minimalistic', fitToWrapper: false, controls: true, autoplay: false, audioNotSupported: "Your browser does not support this audio", playAudio: "Play audio", pauseAudio: "Pause audio" }, params); // Required if e.g. used in CoursePresentation as area to click on if (this.params.playerMode === 'transparent') { this.params.fitToWrapper = true; } this.on('resize', this.resize, this); } C.prototype = Object.create(H5P.EventDispatcher.prototype); C.prototype.constructor = C; /** * Adds a minimalistic audio player with only "play" and "pause" functionality. * * @param {jQuery} $container Container for the player. * @param {boolean} transparentMode true: the player is only visible when hovering over it; false: player's UI always visible */ C.prototype.addMinimalAudioPlayer = function ($container, transparentMode) { var INNER_CONTAINER = 'h5p-audio-inner'; var AUDIO_BUTTON = 'h5p-audio-minimal-button'; var PLAY_BUTTON = 'h5p-audio-minimal-play'; var PLAY_BUTTON_PAUSED = 'h5p-audio-minimal-play-paused'; var PAUSE_BUTTON = 'h5p-audio-minimal-pause'; var self = this; this.$container = $container; self.$inner = $('
', { 'class': INNER_CONTAINER + (transparentMode ? ' h5p-audio-transparent' : '') }).appendTo($container); var audioButton = $('